1 #include "StHbtFlowPicoReader.h"
2 #include "StThreeVectorD.hh"
3 #include "StHbtMaker/Infrastructure/StHbtEvent.hh"
4 #include "math_constants.h"
5 #include "SystemOfUnits.h"
10 const
double ETAMIN = -5.;
11 const
double ETAMAX = 5.;
24 cout <<
"StHbtFlowPicoReader::StHbtFlowPicoReader Initializing the reader ! \n";
25 to_do_list_inp = list_inp;
35 std::ifstream input(to_do_list_inp.c_str());
44 L_runs.push_back(filename);
49 cout <<
" chain has "<<L_runs.size()<<
" runs \n";
54 int StHbtFlowPicoReader::Init()
56 cout <<
" StHbtFlowPicoReader::Init\n";
59 DST_Chain =
new TChain(
"FlowTree");
61 vector<string>::const_iterator it = L_runs.begin();
64 while (it!=L_runs.end())
66 if (NEvt_in_chain <NEVENTS)
68 cout <<
"StHbtFlowPicoReader::StHbtFlowPicoReader add " <<*it<<
"\n";
70 TChain* tmpChain =
new TChain(
"FlowTree");
72 int ok1 = tmpChain->Add((*it).c_str());
73 if (!ok1) {cout <<
"tmpChain->Add error !\n";}
74 int tmpEntries = (int)tmpChain->GetEntries();
75 NEvt_in_chain += tmpEntries;
76 cout <<
" in file " <<tmpEntries<<
" total "<<NEvt_in_chain<<
"\n";
78 cout <<
" adding... \n";
79 int ok2 = DST_Chain->Add((*it).c_str());
80 if (!ok2) {cout <<
"DST_Chain->Add error !\n";}
86 cout <<
"ST_txtr::ST_txtr flow_pDST instantiated \n";
87 this->pDST->fChain->SetBranchStatus(
"*",0);
90 this->pDST->fChain->SetBranchStatus(
"mRunID",1);
91 this->pDST->fChain->SetBranchStatus(
"mMagneticField",1);
92 this->pDST->fChain->SetBranchStatus(
"mEventID",1);
93 this->pDST->fChain->SetBranchStatus(
"mNtrack",1);
94 this->pDST->fChain->SetBranchStatus(
"mVertexX",1);
95 this->pDST->fChain->SetBranchStatus(
"mVertexY",1);
96 this->pDST->fChain->SetBranchStatus(
"mVertexZ",1);
97 this->pDST->fChain->SetBranchStatus(
"fTracks.fUniqueID",1);
98 this->pDST->fChain->SetBranchStatus(
"fTracks.fBits",1);
99 this->pDST->fChain->SetBranchStatus(
"fTracks.mPtGlobal",1);
100 this->pDST->fChain->SetBranchStatus(
"fTracks.mEtaGlobal",1);
101 this->pDST->fChain->SetBranchStatus(
"fTracks.mPhiGlobal",1);
102 this->pDST->fChain->SetBranchStatus(
"fTracks.mNhits",1);
103 this->pDST->fChain->SetBranchStatus(
"fTracks.mCharge",1);
104 this->pDST->fChain->SetBranchStatus(
"fTracks.mFitPts",1);
105 this->pDST->fChain->SetBranchStatus(
"fTracks.mMaxPts",1);
106 this->pDST->fChain->SetBranchStatus(
"fTracks.mDedx",1);
107 this->pDST->fChain->SetBranchStatus(
"fTracks.mPidElectron",1);
108 this->pDST->fChain->SetBranchStatus(
"fTracks.mPidPion",1);
109 this->pDST->fChain->SetBranchStatus(
"fTracks.mPidKaon",1);
110 this->pDST->fChain->SetBranchStatus(
"fTracks.mPidProton",1);
111 this->pDST->fChain->SetBranchStatus(
"fTracks.mMostLikelihoodPID",1);
112 this->pDST->fChain->SetBranchStatus(
"fTracks.mMostLikelihoodProb",1);
113 this->pDST->fChain->SetBranchStatus(
"fTracks.mDcaGlobal",1);
114 this->pDST->fChain->SetBranchStatus(
"fTracks.mDcaGlobalX",1);
115 this->pDST->fChain->SetBranchStatus(
"fTracks.mDcaGlobalY",1);
116 this->pDST->fChain->SetBranchStatus(
"fTracks.mDcaGlobalZ",1);
118 Nentries = (int)(this->pDST->fChain->GetEntries());
120 if (Nentries) {
return 0;}
123 cout <<
"StHbtFlowPicoReader::Init() -- see no entries \n";
128 StHbtEvent* StHbtFlowPicoReader::ReturnHbtEvent()
144 cout <<
"StHbtFlowPicoReader::ReturnHbtEvent() crrnt_entry begins "
147 if (crrnt_entry<Nentries)
149 ientry = this->pDST->LoadTree(crrnt_entry);
150 nb = this->pDST->fChain->GetEntry(crrnt_entry); Nbytes += nb;
152 hbtEvent->SetEventNumber(crrnt_eventI);
153 hbtEvent->SetCtbMult(0);
154 hbtEvent->SetZdcAdcEast(0);
155 hbtEvent->SetZdcAdcWest(0);
156 hbtEvent->SetNumberOfTpcHits(0);
158 int Mult = this->pDST->fTracks_;
159 hbtEvent->SetNumberOfTracks(Mult);
160 hbtEvent->SetNumberOfGoodTracks(Mult);
161 hbtEvent->SetReactionPlane(0.);
162 hbtEvent->SetReactionPlaneSubEventDifference(0.);
164 float BTesla = pDST->mMagneticField;
165 float vX = pDST->mVertexX;
166 float vY = pDST->mVertexY;
167 float vZ = pDST->mVertexZ;
171 hbtEvent->SetPrimVertPos(VertexPosition);
174 int UncorrPositivePrim = 0;
175 int UncorrNegativePrim = 0;
177 for (
short itrack = 0; itrack<Mult; itrack++)
180 float Phi = pDST->fTracks_mPhiGlobal[itrack];
181 float pT = pDST->fTracks_mPtGlobal[itrack];
182 float eta = pDST->fTracks_mEtaGlobal[itrack];
183 float pX = pT*cos(Phi);
184 float pY = pT*sin(Phi);
185 float expeta = exp(-eta);
186 float theta = 2*atan(expeta);
188 short charge = pDST->fTracks_mCharge[itrack];
190 if (charge ==0) reject =
true;
192 if ( !(eta>ETAMIN) || !(eta<ETAMAX)) reject =
true;
198 hbtTrack->SetHiddenInfo(0);
205 if (theta<0) {theta = C_PI+theta;}
206 float p = pT/sin(theta);
207 float pZ = p-pT*expeta;
213 hbtTrack->SetP(tmpP);
215 hbtTrack->SetTrackId(itrack);
217 float dEdx = pDST->fTracks_mDedx[itrack];
219 float ProbElectron = pDST->fTracks_mPidElectron[itrack];
220 float ProbPion = pDST->fTracks_mPidPion[itrack];
221 float ProbKaon = pDST->fTracks_mPidKaon[itrack];
222 float ProbProton = pDST->fTracks_mPidProton[itrack];
224 hbtTrack->SetdEdx(dEdx);
226 hbtTrack->SetPidProbElectron(ProbElectron);
228 hbtTrack->SetPidProbPion(ProbPion);
229 hbtTrack->SetPidProbKaon(ProbKaon);
230 hbtTrack->SetPidProbProton(ProbProton);
233 int Nhits = pDST->fTracks_mNhits[itrack];
235 float DCA = pDST->fTracks_mDcaGlobal[itrack];
236 float DCAX = pDST->fTracks_mDcaGlobalX[itrack];
237 float DCAY = pDST->fTracks_mDcaGlobalY[itrack];
238 float DCAZ = pDST->fTracks_mDcaGlobalZ[itrack];
240 float DCAXY = sqrt(DCAX*DCAX+DCAY*DCAY);
242 hbtTrack->SetDCAxyGlobal(DCAXY);
243 hbtTrack->SetDCAzGlobal(DCAZ);
245 if (Nhits>=10 && fabs(eta)<0.5 && DCA<3.)
247 if (charge>0) {UncorrPositivePrim++;}
248 if (charge<0) {UncorrNegativePrim++;}
250 hbtTrack->SetNHits(Nhits);
251 hbtTrack->SetCharge(charge);
252 hbtTrack->SetNHitsPossible(pDST->fTracks_mMaxPts[itrack]);
254 hbtTrack->SetPtGlobal(pT);
256 int gid = pDST->fTracks_mMostLikelihoodPID[itrack];
257 float pid_prob = pDST->fTracks_mMostLikelihoodProb[itrack];
262 if (gid ==2 || gid ==3)
264 hbtTrack->SetNSigmaElectron(0.);
265 hbtTrack->SetNSigmaPion(-1000.);
266 hbtTrack->SetNSigmaKaon(-1000.);
267 hbtTrack->SetNSigmaProton(-1000.);
269 else if (gid==8 || gid ==9)
271 hbtTrack->SetNSigmaElectron(1000.);
272 hbtTrack->SetNSigmaPion(0.);
273 hbtTrack->SetNSigmaKaon(-1000.);
274 hbtTrack->SetNSigmaProton(-1000.);
276 else if (gid==11 || gid==12)
278 hbtTrack->SetNSigmaElectron(1000.);
279 hbtTrack->SetNSigmaPion(1000.);
280 hbtTrack->SetNSigmaKaon(0.);
281 hbtTrack->SetNSigmaProton(-1000.);
283 else if (gid==14 || gid==15)
285 hbtTrack->SetNSigmaElectron(1000.);
286 hbtTrack->SetNSigmaPion(1000.);
287 hbtTrack->SetNSigmaKaon(1000.);
288 hbtTrack->SetNSigmaProton(0.);
292 hbtTrack->SetNSigmaElectron(1000.);
293 hbtTrack->SetNSigmaPion(0.);
294 hbtTrack->SetNSigmaKaon(-1000.);
295 hbtTrack->SetNSigmaProton(-1000.);
305 hbtTrack->SetHelix(mHelix);
307 hbtEvent->TrackCollection()->push_back(hbtTrack);
311 hbtEvent->SetUncorrectedNumberOfPositivePrimaries(UncorrPositivePrim);
312 hbtEvent->SetUncorrectedNumberOfNegativePrimaries(UncorrNegativePrim);
316 cout <<
"StHbtFlowPicoReader return event # "<<crrnt_eventI<<
"\n";
337 StHbtString StHbtFlowPicoReader::Report()
339 return (StHbtString)
" Here is the reader report \n";
342 StHbtFlowPicoReader::~StHbtFlowPicoReader()