2 rdEz2histoExample(
int mxEve=5000,
3 char *runL=
"R5132028 R5132029 ",
4 TString iPath=
"/star/data04/sim/balewski/daq/ezTree/pp200/pp2/",
11 "StRoot/StDbLib/StDbLib.so",
12 "StRoot/StEEmcUtil/EEfeeRaw/libEEfeeRaw.so",
13 "StRoot/StEEmcDbMaker/libEEmcDbMaker.so",
14 "StRoot/StEEmcPool/StEzExample/libEzEEtower.so",
19 for(i=0;i<
sizeof(libL)/
sizeof(
char*);i++) {
20 printf(
" load '%s' ...\n",libL[i]);
21 assert( !gSystem->Load(libL[i]));
23 printf(
"loaded %d libraries\n",i);
27 TChain *chain =
new TChain(
"ezstar");
29 char *run=strtok(runL,
" ");
32 printf(
"add run %d '%s' \n",i++,run);
33 TString fullName=iPath+run+
".ez.root";
35 }
while(run=strtok(0,
" "));
37 int nEntries = (Int_t)chain->GetEntries();
38 printf(
"Sort %d of total Events %d\n",mxEve, nEntries);
42 Int_t nEntries = (Int_t)chain->GetEntries();
44 printf(
"\n\nSth is wrong, chain is empty nEntries=%d\n\n",nEntries);
51 chain->SetBranchAddress(
"eemc",&eFee);
52 chain->SetBranchAddress(
"head",&eHead);
53 chain->SetBranchAddress(
"trig",&eTrig);
57 long timeStamp=eHead->getTimeStamp();
59 printf(
"run timeStamp=%d=%s\n" ,timeStamp,ctime((
const time_t *)&timeStamp));
62 EEmcDb *db=
new EEmcDb() ;
63 db->setThreshold(3.0);
64 db->requestDataBase(timeStamp,firstSec,lastSec);
69 sorter->set(&HList,db,eFee,eHead,eTrig);
72 printf(
"Sort %d of total Events %d, use trigId=%d\n",mxEve, nEntries,oflTrigId);
74 int nEve=0,nAcc=0,nOK=0;
76 for(nEve=0; nEve<nEntries && nEve<mxEve; nEve++) {
77 chain->GetEntry(nEve);
78 if(nEve%1000==0)printf(
"in %d, acc %d ok=%d\n",nEve,nAcc,nOK);
79 if(oflTrigId>0 && ! eTrig->isTrigID(oflTrigId) ){
continue;}
82 int nCr=eFee->maskWrongCrates(timeStamp,eHead->getToken(),EEfeeRawEvent::headVer1);
88 float rate=1.*nEve/(t2-t1);
89 printf(
"sorting done, nEve=%d, CPU event rate=%.1f Hz\n",nEve,rate);
96 sorter->saveHisto(
"aaa");
99 h=(TH1F*)HList.FindObject(
"tE");
100 h->Draw(
""); gPad->SetLogy();