9 #include "StMuLcp2TreeMaker.h"
12 #include "TClonesArray.h"
13 #include "StL0Trigger.h"
14 #include "StEventInfo.h"
15 #include "StEventSummary.h"
16 #include "StarClassLibrary/StThreeVectorF.hh"
17 #include "StMuDSTMaker/COMMON/StMuEvent.h"
18 #include "StMuDSTMaker/COMMON/StMuTrack.h"
19 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
22 #include "CtbMatching.h"
24 #include "StThreeVector.hh"
54 StMuLcp2TreeMaker::~StMuLcp2TreeMaker(){
55 if(tree) tree->Print();
65 Int_t StMuLcp2TreeMaker::InitRunFromMake (
int runNumber){
67 if(runID==runNumber)
return kStOK;
68 if(runID==888999)
return kStOK;
71 printf(
"\n\n FATAL %s::InitRunFromMake() runID=%d changed to %d, (not implemented),STOP \n",
GetName(),runID,runNumber);
72 assert(runID==runNumber);
79 treeName+=
".tree.root";
80 printf(
"%s::InitRunFromMake() \n runID=%d Setup output tree & histo to '%s' , use BXoff48=%d , CUTS: minNFitPoint=%d maxDCAxy/cm=%.2f maxEta=%.2f minPt/GeV/c=%.2f, minFitPfrac=%.2f maxZvert=%f\n",
GetName(),runID,treeName.Data(),off48,C_minNFitPoint,C_maxDCAxy,C_maxEta,C_minPt,C_minFitPfrac,C_maxZvertex);
82 hfile=
new TFile(treeName,
"RECREATE",
" histograms & trees with LCP ");
83 assert(hfile->IsOpen());
86 h[0]=
new TH1F(
"bX7",
"rates vs. 7bit bXing",129,-0.5,128.5);
87 h[1]=
new TH1F(
"bX48",
"rates vs. 48bit bXing +offset%120 ",129,-0.5,128.5);
88 h[2]=
new TH1F(
"bX120",
"rates vs. true bXing [0-119]",129,-0.5,128.5);
89 h[3]=(TH1F *)
new TH2F(
"sBit120",
"spinBits vs. bXing120",129,-0.5,128.5,17,-0.5,16.5);
90 h[4] =
new TH1F(
"Vz",
"Vertex Z/cm",100,-250,250.);
91 h[5] =
new TH1F(
"nPrim",
"No. of prim TPC tracks",50,-0.5,49.5);
92 h[6] =
new TH1F(
"eta",
"eta of LCP",100,-2.,2.);
94 h[7] =
new TH1F(
"phi",
" phi/rad of LCP", 240,-Pi,Pi);
95 h[8] =
new TH1F(
"pT",
"pT/GeV of LCP",100,0,10.);
96 h[9] =
new TH1F(
"pTm1",
"pT/GeV of LCP, CTB match any",100,0,10.);
97 h[10] =
new TH1F(
"pTm2",
"pT/GeV of LCP, CTB match LCP",100,0,10.);
102 tree =
new TTree(
"T-LCP",
"LCP selected from MinB trigger");
103 tree->Branch(
"bx48", &eve_bx48,
"bx48/I");
104 tree->Branch(
"bx120",&eve_bx120,
"bx120/I");
105 tree->Branch(
"id", &eve_id,
"id/I");
106 tree->Branch(
"sb", &eve_sb,
"sb/I");
107 tree->Branch(
"nPrim",&eve_nPrim,
"nPrim/I");
108 tree->Branch(
"nGlob",&eve_nGlob,
"nGlob/I");
109 tree->Branch(
"vz", &eve_vz ,
"vz/F");
110 tree->Branch(
"cosm", &eve_cosm ,
"cosm/F");
112 tree->Branch(
"pt",&lcp_pt ,
"pt/F");
113 tree->Branch(
"phi",&lcp_phi ,
"phi/F");
114 tree->Branch(
"eta",&lcp_eta ,
"eta/F");
115 tree->Branch(
"q",&lcp_q ,
"q/I");
116 tree->Branch(
"nFit",&lcp_nFit ,
"nFit/I");
118 printf(
" %s::InitRunFromMake(RunNumber=%d) WARN : TTRee NOT created\n",
GetName(),runNumber);
124 int nd=0;
float x1=1,x2=2; TString titCore=
"fixMe2";
129 titCore=
"minFitPfrac"; nd=10; x1=0.325; x2=0.825;
131 hc[0]=
new TH1F(
"CnFP-A",
"Yield vs."+titCore+
", for LCP #Delta#phi <1/8 #pi ",nd,x1,x2);
132 hc[1]=
new TH1F(
"CnFP-B",
"Yield vs."+titCore+
", for LCP #Delta#phi #in [ 1/8 #pi, 3/8 #pi ] ",nd,x1,x2);
133 hc[2]=
new TH1F(
"CnFP-C",
"Yield vs."+titCore+
", for LCP #Delta#phi #in [ 3/8 #pi, 5/8 #pi ] ",nd,x1,x2);
134 hc[3]=
new TH1F(
"CnFP-D",
"Yield vs. "+titCore+
", for LCP #Delta#phi #in [ 5/8 #pi, 7/8 #pi ] ",nd,x1,x2);
135 hc[4]=
new TH1F(
"CnFP-E",
"Yield vs."+titCore+
", for LCP #Delta#phi > 7/8 #pi ",nd,x1,x2);
136 hc[5]=
new TH1F(
"CnFP-L",
"Yield vs."+titCore+
", lost LCP",nd,x1,x2);
137 hc[6]=
new TH1F(
"CnFP-W",
"Yield vs."+titCore+
", won LCP",nd,x1,x2);
146 Int_t StMuLcp2TreeMaker::Init(){
147 return StMaker::Init();
153 void StMuLcp2TreeMaker::clearLCP(){
154 lcp_eta=lcp_phi=lcp_pt=0;
167 printf(
"%s::Make() is called ..........\n",
GetName());
176 ctb->loadHits(muEve);
178 if(runID>100) InitRunFromMake(info.runId());
182 if(trig.triggerWord()!=0x2000)
return kStOK;
185 if(primTrA->GetEntries()<=0)
return kStOK;
189 if(fabs(eve_vz)>C_maxZvertex)
return kStOK;
191 int bx7=trig.bunchCrossingId7bit(info.runId());
193 eve_bx48 = trig.bunchCrossingId();
194 eve_bx120 =(trig.bunchCrossingId()+off48 )%120;
195 eve_sb=trig.spinBits(info.runId());
203 const StMuTrack* lcp= findLCP(C_minPt,C_minNFitPoint, C_maxDCAxy, C_maxEta,C_minFitPfrac);
207 h[1]->Fill(eve_bx48);
208 h[2]->Fill(eve_bx120);
209 ((TH2F*)h[3])->Fill(eve_bx120,eve_sb);
211 h[5]->Fill(eve_nPrim);
224 if(eve_cosm) h[9]->Fill(lcp_pt);
225 if(eve_cosm>1000) h[10]->Fill(lcp_pt);
234 for (
int i=0; i<globTrA->GetEntries();i++) {
235 TObject &oo=globTrA[i];
237 if(gTr->
flag() <=0)
continue;
241 if(dca.perp()>3.)
continue;
242 if(fabs(dca.z())>3.)
continue;
250 if(tree)tree->Fill();
252 printf(
"#%s::Make(%d) nPrim=%d nGlob=%d lcp: pt=%f nFit=%d eta=%f\n",
GetName(),kEve,eve_nPrim, eve_nGlob, lcp_pt,lcp_nFit,lcp_eta);
262 const StMuTrack* StMuLcp2TreeMaker::findLCP(
float XminPt,
int XminNFitP ,
float XmaxDCAxy,
float XmaxEta,
float XminFitPfrac) {
266 int nTr=primTrA->GetEntries();
270 for (
int i=0; i<nTr; i++) {
271 TObject &oo=primTrA[i];
273 if(pTr->
flag() <=0)
continue;
280 if(dca.perp()>XmaxDCAxy)
continue;
286 if ( gTr->
nHitsFit() < XminNFitP)
continue;
287 if ( fabs(gTr->
eta()) > XmaxEta )
continue;
289 if ( frac < XminFitPfrac)
continue;
293 int match=ctb->match(gTr);
294 if(match>0) eve_cosm++;
297 if ( gTr->
pt() < maxPt )
continue;
300 if(match>0)lpMatch++;
306 if(lpMatch) eve_cosm+=1000;
314 void StMuLcp2TreeMaker::examinCut(
const StMuTrack*lcp0){
316 const float Pi=3.1416;
323 phi0=Pi/2+ atan2(p0.y(),p0.x());
326 int nb=hc[0]->GetNbinsX();
330 float x=hc[0]->GetBinCenter(i);
336 lcp1=findLCP(C_minPt,C_minNFitPoint,C_maxDCAxy,C_maxEta,x);
340 if(lcp0 && lcp1==0) {
342 }
else if(lcp1 && lcp0==0) {
344 }
else if(lcp1 && lcp0) {
346 float phi1=Pi/2+ atan2(p1.y(),p1.x());
348 if(delPhi <0) delPhi*=-1;
349 if(delPhi >Pi) delPhi=2*Pi-delPhi;
351 if( delPhi <1./8*Pi) {
353 }
else if( delPhi <3./8*Pi) {
355 }
else if( delPhi <5./8*Pi) {
357 }
else if( delPhi <7./8*Pi) {
Double_t pt() const
Returns pT at point of dca to primary vertex.
UShort_t nHitsFit() const
Return total number of hits used in fit.
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.
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
UShort_t nHitsPoss() const
Return number of possible hits on track.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
virtual const char * GetName() const
special overload
This commented block at the top ...
Double_t phi() const
Returns phi at point of dca to primary vertex.
const StMuTrack * globalTrack() const
Returns pointer to associated global track. Null pointer if no global track available.
StThreeVectorF dcaGlobal(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex of associated global track.
StTrackTopologyMap topologyMap() const
Returns topology map.