本文整理汇总了C++中TString::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ TString::Remove方法的具体用法?C++ TString::Remove怎么用?C++ TString::Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TString
的用法示例。
在下文中一共展示了TString::Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
vector <TString> OnlineConfig::SplitString(TString instring,TString delim)
{
// Utility to split up a string on the deliminator.
// returns a vector of strings.
vector <TString> v;
TString remainingString = instring;
TString tempstring = instring;
int i;
while (remainingString.Index(delim) != -1) {
i = remainingString.Index(delim);
tempstring.Remove(i);
v.push_back(tempstring);
remainingString.Remove(0,i+1);
while(remainingString.Index(delim) == 0) {
remainingString.Remove(0,1);
}
tempstring = remainingString;
}
while(tempstring.EndsWith(delim)) {
tempstring.Chop();
}
if(!tempstring.IsNull()) v.push_back(tempstring);
return v;
}
示例2: FindAny
void FindAny(bool found, const TString& fsname, TClass* cl, TString baseexpected, const char* ext, const char* tag) {
if (baseexpected == "") {
baseexpected = cl->GetName();
Ssiz_t posCol = baseexpected.First('<');
if (posCol != -1) {
baseexpected.Remove(posCol, baseexpected.Length());
}
posCol = baseexpected.Last(':');
if (posCol != -1) {
baseexpected.Remove(0, posCol + 1);
}
baseexpected += ext;
}
if (!found) {
if (baseexpected != "FAIL") {
printf("FAIL: %s file for class %s not found\n", tag, cl->GetName());
}
return;
} else {
if (baseexpected == "FAIL") {
printf("FAIL: expected to not find %s file for class %s but got %s\n",
tag, cl->GetName(), fsname.Data());
return;
}
}
if (!fsname.EndsWith(baseexpected)) {
printf("FAIL: class %s expected %s file %s, got %s\n",
cl->GetName(), tag, baseexpected.Data(), fsname.Data());
return;
}
}
示例3: FinishBatch
void FinishBatch(TString sInput="", TString sOutput="ARHist"){
// Stuff to do at the end of an analysis run
// Here all spectra are saved to disk
printf("Events: %d Events Accepted: %d\n",
gAN->GetNEvent(), gAN->GetNEvAnalysed() );
printf("End-of-Run macro executing\n");
TString sDir = gAR->GetTreeDir();
TString sFile;
if (gAR->IsOnline()) sFile = gAR->GetFileName();
else sFile = gAR->GetTreeFile()->GetName();
while(sFile.Contains("/")) sFile.Remove(0,1+sFile.Index("/"));
sFile.ReplaceAll(".dat",".root");
if(sInput.Length() && sFile.BeginsWith(sInput)) sFile.Remove(0,sInput.Length());
else sFile.Prepend("_");
sFile.Prepend(sOutput);
sFile.Prepend(sDir);
// Save histograms to file and close it
TFile f(sFile, "recreate");
if( !f ){
printf("Open file %s for histogram save FAILED!!\n",sFile.Data());
return;
}
gROOT->GetList()->Write();
f.Close();
printf("All histograms saved to %s\n",sFile.Data());
if (!(gAR->IsOnline())) gSystem->Exit(0);
}
示例4: parseCuts
void bcut::parseCuts(TString cuts){
vcuts_.clear(); // Starting the parsing every time
cuts.ReplaceAll(" ", "");
TString cut;
int pos;
do{
pos = cuts.Index("&&");
cut = cuts;
if(pos != -1) cut.Remove(pos, cut.Length());
vcuts_.push_back(onecut(cut));
cuts.Remove(0, pos+2);
} while(pos != -1);
}
示例5: catalogFile
//--------------------------------------------------------------------------------------------------
void catalogFile(const char *dir, const char *file)
{
TString fileName = TString(dir) + slash + + TString(file);
//printf("Index: %d\n",fileName.Index("castor/cern.ch"));
if (fileName.Index("castor/cern.ch") != -1)
fileName = TString("castor:") + fileName;
if (fileName.Index("pnfs/cmsaf.mit.edu") != -1) {
fileName = dCacheDoor + fileName;
}
if (fileName.Index("mnt/hadoop/cms/store") != -1) {
fileName.Remove(0,15);
fileName = hadoopDoor + fileName;
}
printf("\n Opening: %s\n\n",fileName.Data());
TFile* f = TFile::Open(fileName.Data());
TTree* tree = (TTree*) f->FindObjectAny("Delphes");
if (tree) {
printf("0000 %s %d %d\n",fileName.Data(),tree->GetEntries(),tree->GetEntries());
return;
}
TTree* tree = (TTree*) f->FindObjectAny("Events");
if (tree)
printf("XX-CATALOG-XX %s %d\n",fileName.Data(),tree->GetEntries());
TTree* allTree = (TTree*) f->FindObjectAny("AllEvents");
if (tree && allTree)
printf("XX-CATALOG-XX %s %d %d\n",fileName.Data(),tree->GetEntries(),allTree->GetEntries());
}
示例6: SETUP_LoadLibraries
Bool_t SETUP_LoadLibraries(const TString &libs) {
// Loads a list of colon-separated libraries. Returns kTRUE on success, kFALSE
// if at least one library couldn't load properly. Does not check for double
// loads (but ROOT does).
TString l;
Ssiz_t from;
while ( libs.Tokenize(l, from, ":") ) {
if (l.IsNull()) continue;
if (!l.BeginsWith("lib")) l.Prepend("lib");
if (l.EndsWith(".so")) l.Remove(l.Length()-3, l.Length());
::Info(gMessTag.Data(), ">> Loading library %s...", l.Data());
if (gSystem->Load(l.Data()) < 0) {
::Error(gMessTag.Data(), "Error loading %s, aborting", l.Data());
return kFALSE; // failure
}
}
return kTRUE; // success
return 0;
}
示例7: Finish
void Finish(TString sDir = "")
{
// Finishing Macro for running with Worker
printf("Events: %d Events Accepted: %d\n",
gAN->GetNEvent(), gAN->GetNEvAnalysed() );
printf("\nEnd-of-Run macro executing\n");
// If user has not specified output directory, pull from AR
if(sDir.Length() == 0) sDir = gAR->GetTreeDir();
if(sDir.Length() == 0) sDir = "~/";
// Append "/" to Directory if unspecified
if(!(sDir.EndsWith("/"))) sDir.Append("/");
// Create output filename from input file name
TString sFile;
if (gAR->IsOnline()) sFile = gAR->GetFileName();
else sFile = gAR->GetTreeFile()->GetName();
while(sFile.Contains("/")) sFile.Remove(0,1+sFile.Index("/"));
sFile.ReplaceAll(".dat",".root");
sFile.Prepend("Hist_");
sFile.Prepend(sDir);
// Save histograms to file and close it
TFile f(sFile, "recreate");
f.SetCompressionLevel(4);
gROOT->GetList()->Write();
f.Close();
cout << "All histograms saved to " << sFile << endl;
gSystem->Exit(0);
}
示例8: catalogFile
//--------------------------------------------------------------------------------------------------
void catalogFile(const char *dir, const char *file)
{
// set up the modules
gMod->SetMetaDataString((TString(dir)+slash+TString(file)).Data());
gMod->SetNFileSet(0);
// set up analysis
//hMod->Add(gMod);
//gAna->SetSuperModule(hMod);
gAna->SetSuperModule(gMod);
TString fileName = TString(dir) + slash + + TString(file);
//printf("Index: %d\n",fileName.Index("castor/cern.ch"));
if (fileName.Index("castor/cern.ch") != -1)
fileName = TString("castor:") + fileName;
if (fileName.Index("mnt/hadoop/cms/store") != -1) {
fileName.Remove(0,15);
fileName = hadoopDoor + fileName;
gMod->SetMetaDataString(fileName.Data());
}
printf(" Adding: %s\n",fileName.Data());
gAna->AddFile(fileName);
gAna->SetUseHLT(0);
gAna->SetCacheSize(64*1024*1024);
// run the analysis after successful initialisation
gAna->Run(false);
}
示例9: parseWeights
void bcut::parseWeights(TString weights){
weights.ReplaceAll(" ", "");
cutTypes_.clear();
fWeights_.clear();
fvWeights_.clear();
indWeights_.clear();
TString wgt;
int pos;
do{
pos = weights.Index("*");
wgt = weights;
if(pos != -1) wgt.Remove(pos, wgt.Length());
parseWeight(wgt);
weights.Remove(0, pos+1);
} while(pos != -1);
}
示例10: RecoQA
void RecoQA(const char* inFile) {
gROOT->LoadMacro("bfcread_hist_prefixes_add_to_ps.C");
TString baseName = inFile;
if (baseName.EndsWith(".daq"))
baseName.ReplaceAll(".daq",".hist.root");
else if (baseName.EndsWith(".event.root"))
baseName.ReplaceAll(".event.root",".hist.root");
else if (baseName.EndsWith(".MuDst.root"))
baseName.ReplaceAll(".MuDst.root",".hist.root");
TString histFile = baseName;
baseName.Remove(0,baseName.Last('/')+1);
TString outputName = baseName;
outputName.ReplaceAll(".root",".CC");
TString histList = "StRoot/St_QA_Maker/QAhlist_Reco.h";
if (! gSystem->Which(".",histList.Data()))
histList.Prepend(gSystem->ExpandPathName("$STAR/"));
bfcread_hist_prefixes_add_to_ps(histFile.Data(),"EventQA",
"bfcTree",outputName.Data(),baseName.Data(),histList.Data());
}
示例11: RoundNumber
TString RoundNumber(double num, int decimals, double denom) {
if(denom==0 || !isfinite(num) || !isfinite(denom)) return " - ";
double neg = 1;
if(num*denom<0) neg = -1;
num /= neg*denom;
num += 0.5*pow(10.,-decimals);
if(abs(num) > 1e16) return "-";
long num_int = static_cast<long>(num);
long num_dec = static_cast<long>((1+num-num_int)*pow(10.,decimals));
TString s_dec = "";
s_dec += num_dec;
s_dec.Remove(0,1);
TString result="";
if(neg<0) result+="-";
result+= num_int;
if(decimals>0) {
result+=".";
result+=s_dec;
}
TString afterdot = result;
afterdot.Remove(0,afterdot.First(".")+1);
for(int i=0; i<decimals-afterdot.Length(); i++)
result += "0";
if(result.Length()>15) cout<<"num "<<num<<", denom "<<denom<<" ----> "<<result<<endl;
return result;
}
示例12: ConnectFriends
void ConnectFriends()
{
// Connect the friends tree as soon as available.
//
// Handle the friends first
//
if (!esdTree->FindBranch("ESDfriend.")) {
// Try to add ESDfriend. branch as friend
TString esdFriendTreeFName;
esdFriendTreeFName = (esdTree->GetCurrentFile())->GetName();
TString basename = gSystem->BaseName(esdFriendTreeFName);
Int_t index = basename.Index("#")+1;
basename.Remove(index);
basename += "AliESDfriends.root";
TString dirname = gSystem->DirName(esdFriendTreeFName);
dirname += "/";
esdFriendTreeFName = dirname + basename;
//
TTree* cTree = esdTree->GetTree();
if (!cTree) cTree = esdTree;
cTree->AddFriend("esdFriendTree", esdFriendTreeFName.Data());
cTree->SetBranchStatus("ESDfriend.", 1);
esdFr = (AliESDfriend*)(esdEv->FindListObject("AliESDfriend"));
if (esdFr) cTree->SetBranchAddress("ESDfriend.", &esdFr);
}
}
示例13: MultiJobsMode
void KV_CCIN2P3_GE::GetBatchSystemParameterList(KVNameValueList& nl)
{
// Fill the list with all relevant parameters for batch system,
// set to their default values.
//
// Parameters defined here are:
// JobTime [string]
// JobMemory [string]
// JobDisk [string]
// MultiJobsMode [bool]
// RunsPerJob [int]
// EMailOnStart [bool]
// EMailOnEnd [bool]
// EMailAddress [string]
KVBatchSystem::GetBatchSystemParameterList(nl);
nl.SetValue("JobTime", fDefJobTime);
nl.SetValue("JobMemory", fDefJobMem);
nl.SetValue("JobDisk", fDefJobDisk);
nl.SetValue("MultiJobsMode", MultiJobsMode());
nl.SetValue("RunsPerJob", fRunsPerJob);
nl.SetValue("EMailOnStart", kFALSE);
nl.SetValue("EMailOnEnd", kFALSE);
TString email = gSystem->GetFromPipe("email");
if (email.Index('=') > -1) {
email.Remove(0, email.Index('=') + 2);
nl.SetValue("EMailAddress", email);
}
else
nl.SetValue("EMailAddress", "");
}
示例14: imgconv
// used to create output file for canvas
void imgconv( TCanvas* c, const TString & fname )
{
// return;
if (NULL == c) {
cout << "*** Error in TMVAGlob::imgconv: canvas is NULL" << endl;
}
else {
// create directory if not existing
TString f = fname;
TString dir = f.Remove( f.Last( '/' ), f.Length() - f.Last( '/' ) );
gSystem->mkdir( dir );
TString pngName = fname + ".png";
TString gifName = fname + ".gif";
TString epsName = fname + ".eps";
c->cd();
// create eps (other option: c->Print( epsName ))
if (UsePaperStyle) {
c->Print(epsName);
}
else {
cout << "--- --------------------------------------------------------------------" << endl;
cout << "--- If you want to save the image as eps, gif or png, please comment out " << endl;
cout << "--- the corresponding lines (line no. 239-241) in tmvaglob.C" << endl;
cout << "--- --------------------------------------------------------------------" << endl;
c->Print(epsName);
c->Print(pngName);
// c->Print(gifName);
}
}
}
示例15: Setoutputfileprefix
void Setoutputfileprefix( TString const& filename ){
outputfileprefix = filename;
Int_t pos(0);
for(Int_t i(0);i<outputfileprefix.Sizeof();i++){
if(outputfileprefix[i] == '/')
pos = i;
}
outputfileprefix.Remove(0,pos+1);
outputfileprefix.ReplaceAll(".root","");
}