1 #include "StRoot/StMuDSTMaker/COMMON/StMuArrays.h"
11 char* file =
"QCDprodMBa.MuDst.root",
19 file=
"muonEta2PhiAB_pt20.MuDst.root";
21 gROOT->LoadMacro(
"$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
22 loadSharedLibraries();
23 gSystem->Load(
"StFgtUtil");
25 cout <<
" loading done " << endl;
32 muMk =
new StMuDstMaker(0,0,inDir,file,
"MuDst.root",nFiles);
33 TChain* tree=muMk->
chain(); assert(tree);
34 int nEntries=(int) tree->GetEntries();
35 printf(
"total eve in muDst chain =%d\n",nEntries);
36 if(nEntries<0)
return;
42 h1=
new TH1F(
"nP",
"# of prim tracks per vertex",100,0,200);
43 h2=
new TH1F(
"vR",
"PPV Vertex rank; rank", 300, -1.2e6, 1.2e6); h2->SetLineColor(kRed);
44 h3=
new TH1F(
"vRL",
"PPV Vertex rank, funny X-axis; X=Log10(rank-1e6)+ offset", 150, -9,21);
45 h2->GetXaxis()->SetTitleSize(.043);
46 h2->GetXaxis()->SetTitleSize(.043);
48 h4=
new TH1F(
"trPhi",
" prim tracks phi if PT>1.0 GeV/c; phi (rad)",50,-3.2,3.2);
49 h5=
new TH1F(
"zVerTrg",
" Z trg-vertex , rank>0; Z (cm)", 50,-200,200);
50 h6=
new TH1F(
"zVerPlp",
" Z pileup-vertex , rank<0; Z (cm)", 50,-200,200);
51 h7=
new TH1F(
"nPrV",
"# of prim tr used by PPV; rank>0",15,0,30);
56 for (Int_t iev=0;iev<nEntries; iev++) {
57 if(eventCounter>=nEve)
break;
59 int stat = chain->
Make();
69 int nPrimV=muMk->
muDst()->numberOfPrimaryVertices();
73 bool fired=tic->nominal().isTrigger(trigID);
75 Int_t nGlobTrAll=muMk->
muDst()->GetNGlobalTrack();
80 if(eventCounter%1==0) {
81 printf(
"ieve=%d eventID %d nPrimV=%d nGlobTrAll=%d =============\n", eventCounter,info.id(),nPrimV,nGlobTrAll);
88 if(1)
for(iv=0;iv<nPrimV;iv++) {
94 printf(
"iv=%d Vz=%.2f +/-%.2f \n",iv,r.z(),er.z() );
98 Int_t nPrimTrAll=muMk->
muDst()->GetNPrimaryTrack();
99 for(itr=0;itr<nPrimTrAll;itr++) {
101 if(pr_track->
flag()<=0)
continue;
104 if(nPrimV>0)h1->Fill(nPrimTr);
105 float rank=V->ranking();
107 if(rank>1e6) h3->Fill(log(rank-1e6)+10);
108 else if(rank>0) h3->Fill(log(rank));
109 else h3->Fill(log(rank+1e6)-10);
111 if(1)printf(
" nPrimTr=%d , Z=%.1f VFid=%d:: ntrVF=%d nCtb=%d nBemc=%d nEEmc=%d nTpc=%d sumPt=%.1f rank=%g\n"
112 ,nPrimTr,r.z(), V->vertexFinderId() ,V->nTracksUsed() ,V->nCTBMatch() ,V-> nBEMCMatch() ,V->nEEMCMatch() ,V->nCrossCentralMembrane() ,V->sumTrackPt() ,V->ranking());
113 if (rank>0) h5->Fill(r.z());
114 if (rank>0) h7->Fill(V->nTracksUsed());
115 if (rank<0) h6->Fill(r.z());
122 for(iv=0;iv<nPrimV;iv++) {
124 Int_t nPrimTrAll=muMk->
muDst()->GetNPrimaryTrack();
125 cout<<
"\n Prim "<<nPrimTrAll<<
" tracks belonging to "<<iv<<
"-th prim vertex"<<endl;
130 for(itr=0;itr<nPrimTrAll;itr++) {
132 if(pr_track->
flag()<=0)
continue;
134 cout <<
"\nPrimary track " << ntr <<
" momentum(P vect) " << pr_track->
p() <<
" PT="<<pr_track->
pt()<<
" recoCharge="<<pr_track->
charge()<< endl; cout <<
"\t flag=" << pr_track->
flag() <<
" nHits=" << pr_track->
nHits()<<
" vertID="<< pr_track->
vertexIndex()<< endl;
135 cout <<
"\t primV("<<iv<<
") primDCA=" << pr_track->
dca(iv) << endl;
136 if(pr_track->
dca(iv).mag()>5) cout <<
"^^^^^ 3D DCA magnitude="<<pr_track->
dca(iv).mag()<<endl;
139 if(pr_track->
pt()>1.0) h4->Fill(pr_track->
phi());
149 printf(
" No EMC data for this event\n");
169 printf(
"****************************************** \n");
173 float tMnt=(t2-t1)/60.;
174 float rate=1.*eventCounter/(t2-t1);
175 printf(
"sorting done %d of nEve=%d, CPU rate=%.1f Hz, total time %.1f minute(s) \n\n",eventCounter,nEntries,rate,tMnt);
176 c=
new TCanvas(); c->Divide(2,2);
177 c->cd(1); h5->Fit(
"gaus");
178 c->cd(3); h6->Fit(
"gaus");
179 c->cd(2); h3->Draw();
180 c->cd(4); h7->Draw();
189 void printFgtStrips( TClonesArray * fgtStrips){
192 Int_t nStrips = fgtStrips->GetEntriesFast();
193 printf(
"FGT nStrips=%d\n",nStrips);
194 for( Int_t i = 0; i < nStrips; ++i ){
196 if(strip==0)
continue;
197 Int_t geoId = strip->getGeoId();
198 Short_t seedType=strip->getClusterSeedType();
199 printf(
"i=%d geoId=%d charge=%.1f +/-%.1f seedType=%d\n",i,geoId, strip->getCharge(), strip->getChargeUncert(),seedType);
205 void printFgtClusters( TClonesArray * fgtClusters){
206 assert( fgtClusters );
208 Int_t nClusters = fgtClusters->GetEntriesFast();
209 printf(
"FGT nClusters=%d\n",nClusters);
210 for( Int_t i = 0; i < nClusters; ++i ){
212 if(clus==0)
continue;
213 Int_t geoId = clus->getCentralStripGeoId();
214 printf(
"i=%d cntrGeoId=%d charge=%.1f R=%.1f+/-%.1f phi=%.3f+/-%.3f nStrip=%d\n",i,geoId , clus->getCharge(), clus->getR(),clus->getErrR(), clus->getPhi(), clus->getErrPhi(), clus->getNumStrips());
222 void printFgtInfo( TClonesArray *fgtInfo){
224 Int_t nInfo = fgtInfo->GetEntriesFast();
225 printf(
"FGT nInfo=%d\n",nInfo);
226 for( Int_t i = 0; i < nInfo; ++i ){
227 StMuFgtInfo* info =
static_cast< StMuFgtInfo*
>( (*fgtInfo)[i] );
228 if(info==0)
continue;
242 printf(
"\Total %d hits in Tower (only ADC>0)\n",emc->getNEndcapTowerADC());
244 for (i=0; i< emc->getNEndcapTowerADC(); i++) {
245 emc->getEndcapTowerADC(i,adc,sec,sub,eta);
246 if (adc<=0)
continue;
248 printf(
"i=%d Tower %2.2dT%c%2.2d adc=%4d\n",i,sec,sub+
'A'-1,eta,adc );
250 int adcX=1000+ (eta-1) + (sub-1)*12 +(sec-1)*60;
253 printf(
" Total %d E-Towers with ADC>0\n",nh);
260 int sec,eta,sub,pre,adc;
264 nh= emc->getNEndcapPrsHits();
265 printf(
"\nTotal %d hits in pre1+2+post\n",nh);
266 for (i=0; i<nh; i++) {
267 hit=emc->getEndcapPrsHit(i,sec,sub,eta,pre);
268 int ss=sub + 5*(pre-1);
270 printf(
"i=%d pre/post(%d) %2.2d%c%c%2.2d : energy=%f adc=%d\n",i,pre,sec,pre+
'P'-1,sub+
'A'-1,eta,hit->
getEnergy(),adc);
271 int adcX= (eta-1) + (sub-1) *12 +(sec-1)*60 + 1000*pre;
285 for(uv=
'U'; uv<=
'V'; uv++) {
286 int nh= emc->getNEndcapSmdHits(uv);
287 printf(
"\nTotal %d hits in SMD-%c\n",nh,uv);
288 for (
int i=0; i<nh; i++) {
289 hit=emc->getEndcapSmdHit(uv,i,sec,strip);
291 printf(
" SMD-%c %2.2d%c%3.3d : energy=%f adc=%d\n",uv,sec,uv,strip,hit->
getEnergy(),adc);
292 int adcX= 1000 + strip-1 +(sec-1)*300;
306 printf(
"\Total hits in BTower (only ADC>0)\n");
308 for (i=0; i< 4800; i++) {
309 int adc = emc->getTowerADC(i);
310 if (adc<=1000)
continue;
312 printf(
" Tower id=%d adc=%4d\n",i,adc );
315 printf(
" --> %d towers with ADC>thr\n",nh);
326 nh = emc->getNPrsHits();
327 printf(
"\nTotal %d hits in pre1\n",nh);
330 for (i=0; i<nh; i++) {
336 printf(
"BPRS i=%d, id=%d adc = %d\n",i,
id,adc);
338 printf(
" --> %d BPRS hits with ADC>thr\n",n1);
346 int nh = emc->getNSmdHits(3);
347 printf(
"\nTotal %d hits in SMDE\n",nh);
348 for (
int i=0; i<nh; i++) {
354 printf(
"BSMDE i=%d, id=%d adc = %d\n",i,
id,adc);
357 int nh = emc->getNSmdHits(4);
358 printf(
"\nTotal %d hits in SMDP\n",nh);
359 for (
int i=0; i<nh; i++) {
360 hit = emc->getSmdHit(i,4);
365 printf(
"BSMDP i=%d,id=%d adc = %d\n",i,
id,adc);
368 printf(
" --> %d BSMD-E & %d BSMD-P hits with ADC>thr\n",n1,n2);
375 vector<unsigned int> idL=l1.triggerIds();
376 printf(
"nTrig=%d, trigID: ",idL.size());
377 for(
unsigned int i=0;i<idL.size(); i++){
378 printf(
"%d, ",idL[i]);
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
int getId() const
Return Module number.
Int_t vertexIndex() const
Returns index of associated primary vertex.
float getEnergy() const
Return Hit energy.
Double_t pt() const
Returns pT at point of dca to primary vertex.
virtual void Clear(Option_t *option="")
User defined functions.
int getAdc() const
Return ADC value.
short flag() const
Returns flag, (see StEvent manual for type information)
Short_t charge() const
Returns charge.
const StThreeVectorF & p() const
Returns 3-momentum at dca to primary vertex.
virtual void ls(Option_t *option="") const
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
UShort_t nHits() const
Bingchu.
StThreeVectorF dca(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex.
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Double_t phi() const
Returns phi at point of dca to primary vertex.
static TClonesArray * fgtArray(int type)
returns pointer to the n-th TClonesArray from the fgt arrays
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
Collection of trigger ids as stored in MuDst.