15 #include "TTreeHelper.h"
17 #include "StarRoot/TUnixTime.h"
19 #include "StMessMgr.h"
20 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
21 #include "StMuDSTMaker/COMMON/StMuDst.h"
22 #include "StMuDSTMaker/COMMON/StMuEvent.h"
23 #include "StMuDSTMaker/COMMON/StMuTrack.h"
24 #include "StMuDSTMaker/COMMON/StMuMcTrack.h"
25 #include "StMuDSTMaker/COMMON/StMuMcVertex.h"
26 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
27 #include "StBTofHeader.h"
28 #include "StThreeVectorF.hh"
29 #include "StPhysicalHelixD.hh"
32 void makeMuDstQA(TString InputFileList, Int_t nFiles = 1, Int_t nEvents = 0, TString OutputFile =
"test.histo.root" );
34 void makeMuDstQA(TString InputFileList, Int_t nFiles, Int_t nEvents, TString OutputFile )
39 gROOT -> Macro(
"loadMuDst.C");
49 muDstMaker -> SetStatus(
"*",0) ;
50 muDstMaker -> SetStatus(
"MuEvent",1) ;
51 muDstMaker -> SetStatus(
"PrimaryVertices",1) ;
52 muDstMaker -> SetStatus(
"PrimaryTracks",1) ;
53 muDstMaker -> SetStatus(
"GlobalTracks",1) ;
54 muDstMaker -> SetStatus(
"CovGlobTrack",1);
55 muDstMaker -> SetStatus(
"MCAll",1) ;
56 muDstMaker -> SetStatus(
"BTofHeader",1) ;
57 muDstMaker -> SetDebug(0) ;
59 if ( nEvents == 0 ) nEvents = 10000000 ;
62 TFile *tags_output =
new TFile( OutputFile,
"recreate" ) ;
66 TH1F *hPhiMc =
new TH1F(
"hPhiMc",
"Phi of Mc tracks",200,-TMath::Pi(),TMath::Pi());
67 TH1F *hPtMc =
new TH1F(
"hPtMc",
"Pt of Mc tracks",200,0,5.0);
68 TH1F *hSelPtMc =
new TH1F(
"hSelPtMc",
"Pt of selected Mc tracks",38,0.2,4.0);
69 TH1F *hEtaMc =
new TH1F(
"hEtaMc",
"Eta of Mc tracks",200,-2.0,2.0);
70 TH1F *hPhi =
new TH1F(
"hPhi",
"Phi of matched RC tracks",200,-TMath::Pi(),TMath::Pi());
71 TH1F *hPt =
new TH1F(
"hPt",
"Pt of matched RC tracks",200,0,5.0);
72 TH1F *hSelPt =
new TH1F(
"hSelPt",
"Pt of selected matched RC tracks",38,0.2,4.0);
73 TH1F *hEffPt =
new TH1F(
"hEffPt",
"Efficiency in pt bins",38,0.2,4.0);
74 TH1F *hEta =
new TH1F(
"hEta",
"Eta of matched RC tracks",200,-2.0,2.0);
82 Int_t iInit = chain -> Init() ;
83 if (iInit) chain->FatalErr(iInit,
"on init");
86 Int_t istat = 0, i = 1;
87 while (i <= nEvents && istat != 2) {
88 if(i%10==0)cout << endl <<
"== Event " << i <<
" start ==" << endl;
90 istat = chain->
Make(i);
93 cout <<
"Last event processed. Status = " << istat << endl;
95 cout <<
"Error event processed. Status = " << istat << endl;
98 if(istat !=
kStOK)
continue;
105 LOG_WARN <<
" No MuDst " << endm;
continue;
110 LOG_WARN <<
" No MuEvent " << endm;
continue;
122 if ( ! selectedVertex ){
123 LOG_INFO <<
"Vertex is not valid" << endm;
131 if ( ! selectedVertex )
continue;
133 if ( ! mMuEvent->triggerIdCollection().nominal().isTrigger(610001) && ! mMuEvent->triggerIdCollection().nominal().isTrigger(610011) && ! mMuEvent->triggerIdCollection().nominal().isTrigger(610021) && ! mMuEvent->triggerIdCollection().nominal().isTrigger(610031) && ! mMuEvent->triggerIdCollection().nominal().isTrigger(610041) && ! mMuEvent->triggerIdCollection().nominal().isTrigger(610051) )
continue ;
141 TClonesArray *MuMcVertices = mMuDst->mcArray(0);
142 Int_t NoMuMcVertices = MuMcVertices->GetEntriesFast();
143 TClonesArray *MuMcTracks = mMuDst->mcArray(1);
144 Int_t NoMuMcTracks = MuMcTracks->GetEntriesFast();
145 LOG_INFO <<
"# of MC tracks = "<< NoMuMcTracks <<
" # of MC vertices = "<< NoMuMcVertices << endm;
146 if (! NoMuMcVertices || ! NoMuMcTracks) {
147 LOG_WARN <<
"Ev. " << i <<
" has no MC information ==> skip it" << endm;
153 for(Int_t itrk=0; itrk<NoMuMcTracks; itrk++){
155 if (! mcTrack)
continue;
158 Int_t IdVx = mcTrack->IdVx();
159 if (IdVx != 1)
continue;
161 const int Gid = mcTrack->GePid();
165 hPtMc->Fill(mcTrack->Pxyz().perp());
166 hPhiMc->Fill(mcTrack->Pxyz().phi());
167 hEtaMc->Fill(mcTrack->Pxyz().pseudoRapidity());
168 if(fabs(mcTrack->Pxyz().pseudoRapidity())<0.5)hSelPtMc->Fill(mcTrack->Pxyz().perp());
171 LOG_WARN <<
"Gid: "<<Gid<<
" in Ev. "<<i<<endm;
177 TObjArrayIter GetTracks(tracks) ;
179 while ( ( ptrack = (
StMuTrack*)GetTracks.Next() ) )
181 if (ptrack->idTruth() <= 0 || ptrack->idTruth() > NoMuMcTracks) {
187 LOG_WARN <<
"Inconsistency in mcArray(1), ignored" << endm;
190 if (mcTrack->Id() != ptrack->idTruth()) {
191 LOG_WARN <<
"Mismatched idTruth " << ptrack->idTruth() <<
" and mcTrack Id " << mcTrack->Id()
192 <<
" this track is ignored" << endm;
194 Int_t idMcVx = mcTrack->IdVx();
195 while (idMcVx != 1) {
197 Int_t idMcTrack = mcVertex->IdParTrk();
198 if (! idMcTrack)
break;
200 idMcVx = mcTrackP->IdVx();
203 if (idMcVx != 1)
continue;
205 if(mcTrack->GePid() != 11)
continue;
206 if(mcTrack->IdVx() != 1) {
207 LOG_WARN<<
"mc track may not directly originate from PV!"<<endm;
209 if(ptrack->qaTruth()<50.)
continue;
211 if(ptrack->
nHits()<=15)
continue;
212 if(ptrack->
flag()<=0)
continue;
213 if(abs(ptrack->
charge())!=1)
continue;
218 hEta->Fill(p.pseudoRapidity());
219 if(fabs(p.pseudoRapidity())<0.5)hSelPt->Fill(p.perp());
223 hEffPt->Divide(hSelPt,hSelPtMc,1,1,
"B");
225 if (nEvents > 1) chain ->
Finish() ;
227 if(tags_output!=NULL) tags_output ->
Write() ;
228 if(tags_output!=NULL) tags_output -> Close() ;
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in 'physical events'. Therefore there is only 1 primary vert...
virtual void Clear(Option_t *option="")
User defined functions.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
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.
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
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.
static Int_t currentVertexIndex()
Get the index number of the current primary vertex.
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...