StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rdMu2bbc.C
1 
2 class StChain;
4 
5 class StMuDstMaker;
6 class TChain;
7 
8 StMuDstMaker* muMk;
9 StChain *chain=0;
10 
11 int rdMu2bbc(
12  TString fullName="ccX",
13  int nEve=10000,
14  Int_t nFiles = 4,
15  char* file="inp/R5112017.lis", // min-b
16  //char* file="inp/R5118053.lis", // prodPP
17  char* inDir = "./",
18  char* outDir = "outBbc/"
19 ){
20 
21  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
22  loadSharedLibraries();
23  cout << " loading done " << endl;
24  gSystem->Load("myTest1");
25 
26  // create chain
27  chain = new StChain("StChain");
28 
29  printf("adding muDst from '%s' ....\n",file);
30  // Now we add Makers to the chain...
31  muMk = new StMuDstMaker(0,0,inDir,file,"MuDst.root",nFiles);
32  TChain* tree=muMk->chain(); assert(tree);
33  int nEntries=tree->GetEntries();
34  printf("total eve in chain =%d\n",nEntries);
35 
36  myMk3=new StBbcVertexMaker("bbcVertex","MuDst");
37  TObjArray HList;
38  myMk3->SetHList(&HList);
39  myMk3->readCalib("outBbc/bbcEcalib2.dat");
40  myMk3->readCalib("outBbc/bbcWcalib2.dat");
41  myMk3->setTdcCalib(2.0); // cm/tdc ch
42 
43  gMessMgr->SwitchOff("D");
44  gMessMgr->SwitchOn("I");
45 
46  chain->Init();
47  chain->ls(3);
48  // return;
49  int eventCounter=0;
50  int stat=0;
51  int t1=time(0);
52  //---------------------------------------------------
53  while ( stat==0 ) {// loop over events
54  if(eventCounter>=nEve) break;
55  eventCounter++;
56  chain->Clear();
57  stat = chain->Make();
58 
59  if(eventCounter%1000!=0)continue;
60 
61  printf("\n\n ====================%d processing ==============\n", eventCounter);
62 
63  }
64  printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
65  int t2=time(0);
66  float rate=1.*eventCounter/(t2-t1);
67  float nMnts=(t2-t1)/60.;
68  printf("sorting done %d of nEve=%d, CPU rate=%.1f Hz, tot %.1f minutes\n",eventCounter,nEntries,rate,nMnts);
69 
70  chain->Finish();
71  // HList.ls();
72  fullName+=".hist.root";
73  TFile f( outDir+fullName,"recreate");
74  assert(f.IsOpen());
75  printf("%d histos are written to '%s' ...\n",HList.GetEntries(),fullName.Data());
76  HList.Write();
77  f.Close();
78  assert(!f.IsOpen());
79 
80 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426
Axample to access muDst and pass it to ezTree analyzis class.