StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rdMu2Ped.C
1 TObjArray *HList;
2 
3 int rdMu2Ped(
4  int nEve=300,
5  Int_t nFiles =20,
6  char* file="Rnnn.lis"
7  ){
8  char* inDir = "./" ;
9  inDir="/star/data08/reco/ppProductionMinBias/FullField/dev/2005/174/";
10  file="st_physics_6174067_raw_2040010.MuDst.root";
11 
12  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
13  loadSharedLibraries();
14  cout << " loading done " << endl;
15  assert( !gSystem->Load("StEEmcUtil"));
16  assert( !gSystem->Load("StEEmcPoolmuDst"));
17 
18  // libraries below are needed for DB interface
19  assert( !gSystem->Load("StDbBroker"));
20  assert( !gSystem->Load("St_db_Maker"));
21  assert( !gSystem->Load("StEEmcDbMaker"));
22 
23  // create chain
24  chain = new StChain("StChain");
25 
26  printf("adding muDst from '%s' ....\n",file);
27 
28  // Now we add Makers to the chain...
29  muMk = new StMuDstMaker(0,0,inDir,file,"MuDst.root",nFiles);
30  TChain* tree=muMk->chain(); assert(tree);
31  int nEntries=(int) tree->GetEntries();
32  printf("total eve in chain =%d\n",nEntries);
33  printf("in=%s%s=\n",inDir,file);
34 
35 
36  St_db_Maker *stDb = new St_db_Maker("StarDb", "MySQL:StarDb");
37  stDb->SetFlavor("onlPed","eemcPMTped");
38  stDb->SetFlavor("sim","eemcPMTstat");
39 
40  myDb=new StEEmcDbMaker("eemcDb");
41 
42  HList=new TObjArray;
43  StAdcPedHistoMaker* myMk3=new StAdcPedHistoMaker("myPanitkin",muMk);
44  myMk3->SetHList(HList);
45  myMk3->SetTrigId(96011); // minB-trig for pp200
46  // myMk3->DoPedSubtraction();
47  // myMk3->SetKillMask(0x0001 | 0x0002); // activates kill-byts as well
48 
49  gMessMgr->SwitchOff("D");
50  gMessMgr->SwitchOn("I");
51 
52  chain->Init();
53  chain->ls(3);
54 
55  int eventCounter=0;
56  int stat=0;
57  int t1=time(0);
58  StMuTimer timer;
59  timer.start();
60 
61  //---------------------------------------------------
62  while ( 1) {// loop over events
63  if(eventCounter>=nEve) break;
64  eventCounter++;
65  chain->Clear();
66  stat = chain->Make();
67  if(stat) break;
68  if(eventCounter%200!=0)continue;
69 
70  printf("\n\n ====================%d processing ==============\n", eventCounter);
71 
72  }
73 
74  printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
75  int t2=time(0);
76  if(t1==t2) t2++;
77  float rate=1.*eventCounter/(t2-t1);
78  float nMnts=(t2-t1)/60.;
79  printf("sorting done %d of nEve=%d, elapsed rate=%.1f Hz, tot %.1f minutes\n",eventCounter,nEntries,rate,nMnts);
80 
81  if (eventCounter) {
82  cout << "CPU time/event= " << timer.elapsedTime()/eventCounter << " sec "
83  << " rate= " << eventCounter/timer.elapsedTime() << " Hz" << endl;
84  }
85 
86  TString out="outPed/";
87  out+="Rnnn";
88  out+="ped.hist.root";
89  TFile f( out,"recreate");
90  assert(f.IsOpen());
91  printf("%d histos are written to '%s' ...\n",HList->GetEntries(),out.Data());
92  HList->Write();
93  f.Close();
94 
95 
96 }
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426