本文整理汇总了C++中TObjArray::ls方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjArray::ls方法的具体用法?C++ TObjArray::ls怎么用?C++ TObjArray::ls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjArray
的用法示例。
在下文中一共展示了TObjArray::ls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rdMu2histoExample
int rdMu2histoExample( int nEve=5000 ){
Int_t nFiles = 1;
char* file="st_physics_12108020_raw_1020001.MuDst.root";
char* inDir = "/star/data05/scratch/balewski/mu2011/";
TString fullName=file;
gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
loadSharedLibraries();
cout << " loading done " << endl;
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
gSystem->Load("StEEmcUtil");
gSystem->Load("StEEmcDbMaker");
gSystem->Load("StEzExample");
// create chain
chain = new StChain("StChain");
printf("adding muDst from run '%s' ....\n",fullName.Data());
// Now we add Makers to the chain...
muMk = new StMuDstMaker(0,0,inDir,fullName,".MuDst.root",nFiles);
//switch on only ETOW branch I need
muMk->SetStatus("*",0);
muMk->SetStatus("MuEvent",1);
muMk->SetStatus("EmcTow",1);
TChain* tree=muMk->chain(); assert(tree);
int nEntries=tree->GetEntries();
printf("total eve in chain =%d\n",nEntries);
St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
new StEEmcDbMaker("eemcDb");
gMessMgr->SwitchOff("D");
gMessMgr->SwitchOff("I");
TObjArray HList;
myMk3=new StEEtowerExampleMaker("eeExample","MuDst");
myMk3->Set(&HList);
chain->ls();
chain->Init();
// return;
// read one event first to init DB, excluded from timing measurement
chain->Clear();
stat = chain->Make();
int eventCounter=0;
int stat=0;
int t1=time(0);
//---------------------------------------------------
while ( stat==0 ) {// loop over events
if(eventCounter>=nEve) break;
eventCounter++;
chain->Clear();
stat = chain->Make();
if(eventCounter%500==0)
printf("\n ====================%d processing ============\n", eventCounter);
}
printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
// return;
int t2=time(0);
if(t2==t1) t2=t1+1;
float rate=1.*nEve/(t2-t1);
printf("sorting done %d of nEve=%d, CPU rate=%.1f Hz\n",eventCounter,nEntries,rate);
chain->Finish();
// save output histograms
HList.ls();
myMk3->saveHisto("aaa");
}
示例2: ReadFile
void KVAvailableRunsFile::ReadFile()
{
// Read all infos in available runs file and store as KVNameValueList objects in fAvailableRuns.
// For each run in the file we add a KVNameValueList with the following fields:
//
// Name = run number
// Occurs = number of times run appears in file
// Filename[0] = name of first file for run
// Filename[1] =
// ...
// Filename[Occurs-1] = name of last file for run
// Date[0] = date & time of generation of first file etc.
// KVVersion[0] = name of KaliVeda version used to generate first file etc. (if known)
// Username[0] = name of user who generated first file etc. (if known)
//does runlist exist ?
if (!OpenAvailableRunsFile()) {
Error("ReadFile", "Cannot open available runs file");
return;
}
if(fAvailableRuns) delete fAvailableRuns;
fAvailableRuns = new KVHashList;
fAvailableRuns->SetOwner(kTRUE);
TString fLine;
Int_t line_number=1;
fLine.ReadLine(fRunlist);
KVNumberList duplicate_lines;
Int_t fRunNumber;
while (fRunlist.good()) {
TObjArray *toks = fLine.Tokenize('|'); // split into fields
// number of fields can vary
// nfields = 2: run number, date
// nfields = 3: run number, date, filename
// nfields = 5: run number, date, filename, KaliVeda version, username
Int_t nfields = toks->GetEntries();
KVString kvs(((TObjString *) toks->At(0))->GetString());
fRunNumber = kvs.Atoi();
if(nfields<2){
Warning("ReadFile", "Less than 2 fields in entry for run %d (line:%d)???",fRunNumber,line_number);
toks->ls();
continue;
}
//get date string
KVString datestring(((TObjString *) toks->At(1))->GetString());
// is run already in list ?
KVNameValueList* NVL = (KVNameValueList*)fAvailableRuns->FindObject(kvs);
Int_t Occurs = (NVL ? NVL->GetIntValue("Occurs") : 0);
if(!NVL) {
NVL = new KVNameValueList(kvs);
fAvailableRuns->Add(NVL);
}
else
{
// check date for run is different to any others
Bool_t ok = kTRUE;
for(Int_t ii=0;ii<Occurs;ii++){
KVString olddate = NVL->GetStringValue(Form("Date[%d]",ii));
if(olddate==datestring){
ok=kFALSE;
duplicate_lines.Add(line_number);
break;
}
}
if(!ok){
delete toks;
line_number++;
fLine.ReadLine(fRunlist);
continue;
}
}
Occurs++;
NVL->SetValue("Occurs", Occurs);
NVL->SetValue(Form("Date[%d]",Occurs-1), datestring.Data());
//backwards compatibility
//an old available_runs file will not have the filename field
//in this case we assume that the name of the file is given by the
//dataset's base file name (i.e. with no date/time suffix)
KVString filename;
if (nfields > 2) {
filename = ((TObjString *) toks->At(2))->GetString();
} else {
filename = fDataSet->GetBaseFileName(GetDataType(), fRunNumber);
}
NVL->SetValue(Form("Filename[%d]",Occurs-1), filename.Data());
KVString kvversion,username;
if (nfields > 4) {
kvversion = ((TObjString *) toks->At(3))->GetString();
username = ((TObjString *) toks->At(4))->GetString();
NVL->SetValue(Form("KVVersion[%d]",Occurs-1), kvversion.Data());
NVL->SetValue(Form("Username[%d]",Occurs-1), username.Data());
//.........这里部分代码省略.........