1 ////////////////////////////////////////////////////////////////////////////////
3 // AliFemtoEventReaderStandard - the reader class for the Alice ESD, AOD //
4 // the model Kinematics information tailored for the Task framework //
5 // Authors: Adam Kisiel Adam.Kisiel@cern.ch //
7 ////////////////////////////////////////////////////////////////////////////////
8 #include "AliFemtoEventReaderStandard.h"
14 #include "AliESDEvent.h"
15 #include "AliESDtrack.h"
16 #include "AliESDVertex.h"
18 #include "AliFmPhysicalHelixD.h"
19 #include "AliFmThreeVectorF.h"
21 #include "SystemOfUnits.h"
23 #include "AliFemtoEvent.h"
25 #include "TParticle.h"
26 #include "AliFemtoModelHiddenInfo.h"
27 #include "AliFemtoModelGlobalHiddenInfo.h"
28 #include "AliGenHijingEventHeader.h"
29 #include "AliGenCocktailEventHeader.h"
31 #include "AliAODMCHeader.h"
32 #include "AliAODMCParticle.h"
34 #include "AliVertexerTracks.h"
37 ClassImp(AliFemtoEventReaderStandard)
39 #if !(ST_NO_NAMESPACES)
40 using namespace units;
44 //____________________________
45 AliFemtoEventReaderStandard::AliFemtoEventReaderStandard():
46 AliFemtoEventReader(),
56 fUsePhysicsSel(kFALSE),
61 //constructor with 0 parameters , look at default settings
65 AliFemtoEventReaderStandard::AliFemtoEventReaderStandard(const AliFemtoEventReaderStandard& aReader):
66 AliFemtoEventReader(aReader),
76 fUsePhysicsSel(kFALSE),
82 fCurEvent = aReader.fCurEvent;
83 fCurFile = aReader.fCurFile;
84 fESDEvent = new AliESDEvent();
85 fAODEvent = new AliAODEvent();
86 fStack = aReader.fStack;
87 fInputType = aReader.fInputType;
88 fUsePhysicsSel = aReader.fUsePhysicsSel;
89 if (fUsePhysicsSel) fSelect = new AliPhysicsSelection();
90 fTrackCuts = new AliESDtrackCuts(*(aReader.fTrackCuts));
91 fUseTPCOnly = aReader.fUseTPCOnly;
94 AliFemtoEventReaderStandard::~AliFemtoEventReaderStandard()
99 if (fTrackCuts) delete fTrackCuts;
103 AliFemtoEventReaderStandard& AliFemtoEventReaderStandard::operator=(const AliFemtoEventReaderStandard& aReader)
105 // Assignment operator
106 if (this == &aReader)
109 fCurEvent = aReader.fCurEvent;
110 fCurFile = aReader.fCurFile;
111 if (fESDEvent) delete fESDEvent;
112 fESDEvent = new AliESDEvent();
113 if (fAODEvent) delete fAODEvent;
114 fAODEvent = new AliAODEvent();
115 fStack = aReader.fStack;
116 fGenHeader = aReader.fGenHeader;
117 fInputType = aReader.fInputType;
118 fUsePhysicsSel = aReader.fUsePhysicsSel;
119 if (fUsePhysicsSel) fSelect = new AliPhysicsSelection();
120 if (fTrackCuts) delete fTrackCuts;
121 fTrackCuts = new AliESDtrackCuts(*(aReader.fTrackCuts));
122 fUseTPCOnly = aReader.fUseTPCOnly;
128 AliFemtoString AliFemtoEventReaderStandard::Report()
130 AliFemtoString temp = "\n This is the AliFemtoEventReaderStandard\n";
134 AliFemtoEvent* AliFemtoEventReaderStandard::ReturnHbtEvent()
136 // Get the event, read all the relevant information
137 // and fill the AliFemtoEvent class
138 // Returns a valid AliFemtoEvent
139 AliFemtoEvent *hbtEvent = 0;
140 string tFriendFileName;
142 hbtEvent = new AliFemtoEvent;
144 // Get the friend information
145 cout<<"starting to read event "<<fCurEvent<<endl;
146 if ((fInputType == kESD) || (fInputType == kESDKine)) {
147 if(fESDEvent->GetAliESDOld())fESDEvent->CopyFromOldESD();
149 if (fUsePhysicsSel) {
150 hbtEvent->SetIsCollisionCandidate(fSelect->IsCollisionCandidate(fESDEvent));
151 if (!(fSelect->IsCollisionCandidate(fESDEvent)))
152 printf("Event not a collision candidate\n");
155 hbtEvent->SetIsCollisionCandidate(kTRUE);
158 hbtEvent->SetIsCollisionCandidate(kTRUE);
163 //setting basic things
164 if ((fInputType == kESD) || (fInputType == kESDKine)) {
165 hbtEvent->SetRunNumber(fESDEvent->GetRunNumber());
166 hbtEvent->SetMagneticField(fESDEvent->GetMagneticField()*kilogauss);//to check if here is ok
167 hbtEvent->SetZDCN1Energy(fESDEvent->GetZDCN1Energy());
168 hbtEvent->SetZDCP1Energy(fESDEvent->GetZDCP1Energy());
169 hbtEvent->SetZDCN2Energy(fESDEvent->GetZDCN2Energy());
170 hbtEvent->SetZDCP2Energy(fESDEvent->GetZDCP2Energy());
171 hbtEvent->SetZDCEMEnergy(fESDEvent->GetZDCEMEnergy());
172 hbtEvent->SetZDCParticipants(fESDEvent->GetZDCParticipants());
173 hbtEvent->SetTriggerMask(fESDEvent->GetTriggerMask());
174 hbtEvent->SetTriggerCluster(fESDEvent->GetTriggerCluster());
176 printf("Got event type %i\n", fESDEvent->GetEventType());
180 // if (fUseTPCOnly) {
181 // fESDEvent->GetPrimaryVertexTPC()->GetXYZ(fV1);
182 // fESDEvent->GetPrimaryVertexTPC()->GetCovMatrix(fVCov);
183 // if (!fESDEvent->GetPrimaryVertexTPC()->GetStatus())
184 // fVCov[4] = -1001.0;
187 if (fESDEvent->GetPrimaryVertex()) {
188 fESDEvent->GetPrimaryVertex()->GetXYZ(fV1);
189 fESDEvent->GetPrimaryVertex()->GetCovMatrix(fVCov);
191 if (!fESDEvent->GetPrimaryVertex()->GetStatus()) {
192 // Get the vertex from SPD
193 fESDEvent->GetPrimaryVertexSPD()->GetXYZ(fV1);
194 fESDEvent->GetPrimaryVertexSPD()->GetCovMatrix(fVCov);
197 if (!fESDEvent->GetPrimaryVertexSPD()->GetStatus())
200 fESDEvent->GetPrimaryVertexSPD()->GetXYZ(fV1);
201 fESDEvent->GetPrimaryVertexSPD()->GetCovMatrix(fVCov);
206 if (fESDEvent->GetPrimaryVertexSPD()) {
207 fESDEvent->GetPrimaryVertexSPD()->GetXYZ(fV1);
208 fESDEvent->GetPrimaryVertexSPD()->GetCovMatrix(fVCov);
211 if ((!fESDEvent->GetPrimaryVertex()) && (!fESDEvent->GetPrimaryVertexSPD()))
213 cout << "No vertex found !!!" << endl;
220 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
222 hbtEvent->SetPrimVertPos(vertex);
223 hbtEvent->SetPrimVertCov(fVCov);
226 if ((fInputType == kAOD) || (fInputType == kAODKine)) {
227 hbtEvent->SetRunNumber(fAODEvent->GetRunNumber());
228 hbtEvent->SetMagneticField(fAODEvent->GetMagneticField()*kilogauss);//to check if here is ok
229 hbtEvent->SetZDCN1Energy(fAODEvent->GetZDCN1Energy());
230 hbtEvent->SetZDCP1Energy(fAODEvent->GetZDCP1Energy());
231 hbtEvent->SetZDCN2Energy(fAODEvent->GetZDCN2Energy());
232 hbtEvent->SetZDCP2Energy(fAODEvent->GetZDCP2Energy());
233 hbtEvent->SetZDCEMEnergy(fAODEvent->GetZDCEMEnergy(0));
234 hbtEvent->SetZDCParticipants(0);
235 hbtEvent->SetTriggerMask(fAODEvent->GetTriggerMask());
236 hbtEvent->SetTriggerCluster(fAODEvent->GetTriggerCluster());
238 // Primary Vertex position
239 fAODEvent->GetPrimaryVertex()->GetPosition(fV1);
241 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
242 hbtEvent->SetPrimVertPos(vertex);
245 if ((fInputType == kESDKine) || (fInputType == kAODKine)) {
246 Double_t tReactionPlane = 0;
248 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (fGenHeader);
250 AliGenCocktailEventHeader *cdh = dynamic_cast<AliGenCocktailEventHeader *> (fGenHeader);
252 TList *tGenHeaders = cdh->GetHeaders();
253 for (int ihead = 0; ihead<tGenHeaders->GetEntries(); ihead++) {
254 hdh = dynamic_cast<AliGenHijingEventHeader *> (fGenHeader);
261 tReactionPlane = hdh->ReactionPlaneAngle();
262 cout << "Got reaction plane " << tReactionPlane << endl;
265 hbtEvent->SetReactionPlaneAngle(tReactionPlane);
268 //starting to reading tracks
269 int nofTracks=0; //number of reconstructed tracks in event
270 if ((fInputType == kESD) || (fInputType == kESDKine))
271 nofTracks = fESDEvent->GetNumberOfTracks();
272 else if ((fInputType == kAOD) || (fInputType == kAODKine))
273 nofTracks = fAODEvent->GetNumberOfTracks();
275 int realnofTracks=0;//number of track which we use ina analysis
277 TClonesArray *mcP = 0;
280 if (fInputType == kAODKine) {
281 // Attempt to access MC header
283 mcH = (AliAODMCHeader *) fAODEvent->FindListObject(AliAODMCHeader::StdBranchName());
285 cout << "AOD MC information requested, but no header found!" << endl;
288 mcP = (TClonesArray *) fAODEvent->FindListObject(AliAODMCParticle::StdBranchName());
290 cout << "AOD MC information requested, but no particle array found!" << endl;
292 AliAODHeader * header = dynamic_cast<AliAODHeader*>(fAODEvent->GetHeader());
293 assert(header&&"Not a standard AOD");
295 hbtEvent->SetReactionPlaneAngle(header->GetQTheta(0)/2.0);
298 motherids = new Int_t[((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel()];
299 for (int ip=0; ip<mcP->GetEntries(); ip++) motherids[ip] = 0;
301 // Read in mother ids
302 AliAODMCParticle *motherpart;
303 for (int ip=0; ip<mcP->GetEntries(); ip++) {
304 motherpart = (AliAODMCParticle *) mcP->At(ip);
305 if (motherpart->GetDaughter(0) > 0)
306 motherids[motherpart->GetDaughter(0)] = ip;
307 if (motherpart->GetDaughter(1) > 0)
308 motherids[motherpart->GetDaughter(1)] = ip;
313 if (fInputType == kESDKine) {
314 motherids = new Int_t[fStack->GetNtrack()];
315 for (int ip=0; ip<fStack->GetNtrack(); ip++) motherids[ip] = 0;
317 // Read in mother ids
318 TParticle *motherpart;
319 for (int ip=0; ip<fStack->GetNtrack(); ip++) {
320 motherpart = fStack->Particle(ip);
321 if (motherpart->GetDaughter(0) > 0)
322 motherids[motherpart->GetDaughter(0)] = ip;
323 if (motherpart->GetDaughter(1) > 0)
324 motherids[motherpart->GetDaughter(1)] = ip;
328 for (int i=0;i<nofTracks;i++)
330 // cout << "Reading track " << i << endl;
331 bool tGoodMomentum=true; //flaga to chcek if we can read momentum of this track
333 AliFemtoTrack* trackCopy = new AliFemtoTrack();
335 if ((fInputType == kESD) || (fInputType == kESDKine)) {
337 AliESDtrack *esdtrack = 0x0;
339 AliESDtrack *mcp = fESDEvent->GetTrack(i);
340 esdtrack = AliESDtrackCuts::GetTPCOnlyTrack(fESDEvent, mcp->GetID());
341 // printf("Got %p for track %i | ", esdtrack, mcp->GetID());
344 esdtrack = fESDEvent->GetTrack(i);//getting next track
347 if (esdtrack && (fTrackCuts->AcceptTrack(esdtrack))) {
349 trackCopy->SetCharge((short)esdtrack->GetSign());
351 //in aliroot we have AliPID
352 //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon
353 //we use only 5 first
355 esdtrack->GetESDpid(esdpid);
356 trackCopy->SetPidProbElectron(esdpid[0]);
357 trackCopy->SetPidProbMuon(esdpid[1]);
358 trackCopy->SetPidProbPion(esdpid[2]);
359 trackCopy->SetPidProbKaon(esdpid[3]);
360 trackCopy->SetPidProbProton(esdpid[4]);
366 // if (fUseTPCOnly) {
367 // if (!esdtrack->GetTPCInnerParam()) {
368 // cout << "No TPC inner param !" << endl;
373 // AliExternalTrackParam *param = new AliExternalTrackParam(*esdtrack->GetTPCInnerParam());
374 // param->GetXYZ(rxyz);
375 // param->PropagateToDCA(fESDEvent->GetPrimaryVertexTPC(), (fESDEvent->GetMagneticField()), 10000, impact, covimpact);
376 // param->GetPxPyPz(pxyz);//reading noconstarined momentum
378 // if (fRotateToEventPlane) {
379 // double tPhi = TMath::ATan2(pxyz[1], pxyz[0]);
380 // double tRad = TMath::Hypot(pxyz[0], pxyz[1]);
382 // pxyz[0] = tRad*TMath::Cos(tPhi - tReactionPlane);
383 // pxyz[1] = tRad*TMath::Sin(tPhi - tReactionPlane);
386 // AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
387 // if (v.mag() < 0.0001) {
388 // // cout << "Found 0 momentum ???? " << pxyz[0] << " " << pxyz[1] << " " << pxyz[2] << endl;
393 // trackCopy->SetP(v);//setting momentum
394 // trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
396 // const AliFmThreeVectorD kP(pxyz[0],pxyz[1],pxyz[2]);
397 // const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
398 // //setting helix I do not if it is ok
399 // AliFmPhysicalHelixD helix(kP,kOrigin,(double)(fESDEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge()));
400 // trackCopy->SetHelix(helix);
402 // //some stuff which could be useful
403 // trackCopy->SetImpactD(impact[0]);
404 // trackCopy->SetImpactZ(impact[1]);
405 // trackCopy->SetCdd(covimpact[0]);
406 // trackCopy->SetCdz(covimpact[1]);
407 // trackCopy->SetCzz(covimpact[2]);
408 // trackCopy->SetSigmaToVertex(GetSigmaToVertex(impact, covimpact));
414 tGoodMomentum=esdtrack->GetPxPyPz(pxyz);
416 tGoodMomentum=esdtrack->GetConstrainedPxPyPz(pxyz); //reading constrained momentum
417 // printf("Got good momentum %i\n", tGoodMomentum);
419 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
420 if (v.Mag() < 0.0001) {
426 trackCopy->SetP(v);//setting momentum
427 trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
428 const AliFmThreeVectorD kP(pxyz[0],pxyz[1],pxyz[2]);
429 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
430 //setting helix I do not if it is ok
431 AliFmPhysicalHelixD helix(kP,kOrigin,(double)(fESDEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge()));
432 trackCopy->SetHelix(helix);
434 //some stuff which could be useful
437 esdtrack->GetImpactParameters(imp,cim);
441 covimpact[0] = cim[0];
442 covimpact[1] = cim[1];
443 covimpact[2] = cim[2];
445 trackCopy->SetImpactD(impact[0]);
446 trackCopy->SetImpactZ(impact[1]);
447 trackCopy->SetCdd(covimpact[0]);
448 trackCopy->SetCdz(covimpact[1]);
449 trackCopy->SetCzz(covimpact[2]);
450 trackCopy->SetSigmaToVertex(AliESDtrackCuts::GetSigmaToVertex(esdtrack));
452 trackCopy->SetTrackId(esdtrack->GetID());
453 trackCopy->SetFlags(esdtrack->GetStatus());
454 trackCopy->SetLabel(esdtrack->GetLabel());
456 trackCopy->SetITSchi2(esdtrack->GetITSchi2());
457 trackCopy->SetITSncls(esdtrack->GetNcls(0));
458 trackCopy->SetTPCchi2(esdtrack->GetTPCchi2());
459 trackCopy->SetTPCncls(esdtrack->GetTPCNcls());
460 trackCopy->SetTPCnclsF(esdtrack->GetTPCNclsF());
461 trackCopy->SetTPCsignalN((short)esdtrack->GetTPCsignalN()); //due to bug in aliesdtrack class
462 trackCopy->SetTPCsignalS(esdtrack->GetTPCsignalSigma());
464 trackCopy->SetTPCClusterMap(esdtrack->GetTPCClusterMap());
465 trackCopy->SetTPCSharedMap(esdtrack->GetTPCSharedMap());
468 esdtrack->GetInnerXYZ(xtpc);
470 trackCopy->SetNominalTPCEntrancePoint(xtpc);
472 esdtrack->GetOuterXYZ(xtpc);
474 trackCopy->SetNominalTPCExitPoint(xtpc);
477 for (int ik=0; ik<3; ik++) {
478 indexes[ik] = esdtrack->GetKinkIndex(ik);
480 trackCopy->SetKinkIndexes(indexes);
482 // Fill the hidden information with the simulated data
483 if (fInputType == kESDKine) {
484 if (TMath::Abs(esdtrack->GetLabel()) < fStack->GetNtrack()) {
485 TParticle *tPart = fStack->Particle(TMath::Abs(esdtrack->GetLabel()));
487 // Check the mother information
489 // Using the new way of storing the freeze-out information
490 // Final state particle is stored twice on the stack
491 // one copy (mother) is stored with original freeze-out information
492 // and is not tracked
493 // the other one (daughter) is stored with primary vertex position
496 // Freeze-out coordinates
497 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
498 fpx = tPart->Vx() - fV1[0];
499 fpy = tPart->Vy() - fV1[1];
500 fpz = tPart->Vz() - fV1[2];
503 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
504 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
511 if (motherids[TMath::Abs(esdtrack->GetLabel())]>0) {
512 TParticle *mother = fStack->Particle(motherids[TMath::Abs(esdtrack->GetLabel())]);
513 // Check if this is the same particle stored twice on the stack
514 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
515 // It is the same particle
516 // Read in the original freeze-out information
517 // and convert it from to [fm]
520 fpx = mother->Vx()*1e13*0.197327;
521 fpy = mother->Vy()*1e13*0.197327;
522 fpz = mother->Vz()*1e13*0.197327;
523 fpt = mother->T() *1e13*0.197327;
527 // fpx = mother->Vx()*1e13;
528 // fpy = mother->Vy()*1e13;
529 // fpz = mother->Vz()*1e13;
530 // fpt = mother->T() *1e13*3e10;
535 tInfo->SetPDGPid(tPart->GetPdgCode());
537 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
538 Double_t mass2 = (tPart->Energy() *tPart->Energy() -
539 tPart->Px()*tPart->Px() -
540 tPart->Py()*tPart->Py() -
541 tPart->Pz()*tPart->Pz());
543 tInfo->SetMass(TMath::Sqrt(mass2));
547 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
548 trackCopy->SetHiddenInfo(tInfo);
551 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
553 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
558 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
560 tInfo->SetTrueMomentum(pxyz[0],pxyz[1],pxyz[2]);
562 trackCopy->SetHiddenInfo(tInfo);
565 // cout << "Got freeze-out " << fpx << " " << fpy << " " << fpz << " " << fpt << " " << mass2 << " " << tPart->GetPdgCode() << endl;
568 tGoodMomentum = false;
571 if (esdtrack) delete esdtrack;
574 if ((fInputType == kAOD) || (fInputType == kAODKine)) {
575 // Read in the normal AliAODTracks
576 const AliAODTrack *aodtrack=dynamic_cast<const AliAODTrack*>(fAODEvent->GetTrack(i));
577 assert(aodtrack&&"Not a standard AOD"); // getting the AODtrack directly
579 // if (!aodtrack->TestFilterBit(fFilterBit))
582 CopyAODtoFemtoTrack(aodtrack, trackCopy);
585 // Fill the hidden information with the simulated data
586 // Int_t pLabel = aodtrack->GetLabel();
587 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
589 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
590 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
595 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
597 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
598 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
602 // Check the mother information
604 // Using the new way of storing the freeze-out information
605 // Final state particle is stored twice on the stack
606 // one copy (mother) is stored with original freeze-out information
607 // and is not tracked
608 // the other one (daughter) is stored with primary vertex position
611 // Freeze-out coordinates
612 fpx = tPart->Xv() - fV1[0];
613 fpy = tPart->Yv() - fV1[1];
614 fpz = tPart->Zv() - fV1[2];
617 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
624 // cout << "Looking for mother ids " << endl;
625 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
626 // cout << "Got mother id" << endl;
627 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
628 // Check if this is the same particle stored twice on the stack
630 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
631 // It is the same particle
632 // Read in the original freeze-out information
633 // and convert it from to [fm]
636 // fpx = mother->Xv()*1e13*0.197327;
637 // fpy = mother->Yv()*1e13*0.197327;
638 // fpz = mother->Zv()*1e13*0.197327;
639 // fpt = mother->T() *1e13*0.197327*0.5;
643 fpx = mother->Xv()*1e13;
644 fpy = mother->Yv()*1e13;
645 fpz = mother->Zv()*1e13;
646 // fpt = mother->T() *1e13*3e10;
652 // if (fRotateToEventPlane) {
653 // double tPhi = TMath::ATan2(fpy, fpx);
654 // double tRad = TMath::Hypot(fpx, fpy);
656 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
657 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
660 tInfo->SetPDGPid(tPart->GetPdgCode());
662 // if (fRotateToEventPlane) {
663 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
664 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
666 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
667 // tRad*TMath::Sin(tPhi - tReactionPlane),
671 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
672 Double_t mass2 = (tPart->E() *tPart->E() -
673 tPart->Px()*tPart->Px() -
674 tPart->Py()*tPart->Py() -
675 tPart->Pz()*tPart->Pz());
677 tInfo->SetMass(TMath::Sqrt(mass2));
681 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
683 trackCopy->SetHiddenInfo(tInfo);
687 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
688 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
689 // Check the sanity of the tracks - reject zero momentum tracks
690 if (ktP.Mag() == 0) {
699 //decision if we want this track
700 //if we using diffrent labels we want that this label was use for first time
701 //if we use hidden info we want to have match between sim data and ESD
702 if (tGoodMomentum==true)
704 hbtEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
705 realnofTracks++;//real number of tracks
718 hbtEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
720 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
723 //___________________
724 void AliFemtoEventReaderStandard::SetESDSource(AliESDEvent *aESD)
726 // The chain loads the ESD for us
727 // You must provide the address where it can be found
730 //___________________
731 void AliFemtoEventReaderStandard::SetAODSource(AliAODEvent *aAOD)
733 // The chain loads the ESD for us
734 // You must provide the address where it can be found
737 //___________________
738 void AliFemtoEventReaderStandard::SetStackSource(AliStack *aStack)
740 // The chain loads the stack for us
741 // You must provide the address where it can be found
744 void AliFemtoEventReaderStandard::SetInputType(AliFemtoInputType aInput)
746 // Set the proper input type
749 //___________________
750 void AliFemtoEventReaderStandard::SetGenEventHeader(AliGenEventHeader *aGenHeader)
752 // The chain loads the generator event header for us
753 // You must provide the address where it can be found
754 fGenHeader = aGenHeader;
757 void AliFemtoEventReaderStandard::SetUsePhysicsSelection(const bool usephysics)
759 fUsePhysicsSel = usephysics;
760 if (!fSelect) fSelect = new AliPhysicsSelection();
763 void AliFemtoEventReaderStandard::SetESDTrackCuts(AliESDtrackCuts *esdcuts)
765 // Set external ESD track cuts
766 fTrackCuts = esdcuts;
769 void AliFemtoEventReaderStandard::SetUseTPCOnly(const bool usetpconly)
771 // Set flag to use TPC only tracks
772 fUseTPCOnly = usetpconly;
775 void AliFemtoEventReaderStandard::CopyAODtoFemtoTrack(const AliAODTrack *tAodTrack,
776 AliFemtoTrack *tFemtoTrack)
778 // Copy the track information from the AOD into the internal AliFemtoTrack
779 // If it exists, use the additional information from the PWG2 AOD
781 // Primary Vertex position
783 fAODEvent->GetPrimaryVertex()->GetPosition(fV1);
785 tFemtoTrack->SetCharge(tAodTrack->Charge());
787 //in aliroot we have AliPID
788 //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon
789 //we use only 5 first
791 // AOD pid has 10 components
793 tAodTrack->GetPID(aodpid);
794 tFemtoTrack->SetPidProbElectron(aodpid[0]);
795 tFemtoTrack->SetPidProbMuon(aodpid[1]);
796 tFemtoTrack->SetPidProbPion(aodpid[2]);
797 tFemtoTrack->SetPidProbKaon(aodpid[3]);
798 tFemtoTrack->SetPidProbProton(aodpid[4]);
801 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
802 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
803 tFemtoTrack->SetP(v);//setting momentum
804 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
805 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
806 //setting track helix
807 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
808 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fAODEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
809 tFemtoTrack->SetHelix(helix);
812 tFemtoTrack->SetTrackId(tAodTrack->GetID());
813 tFemtoTrack->SetFlags(1);
814 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
816 // Track quality information
818 tAodTrack->GetCovMatrix(covmat);
819 tFemtoTrack->SetImpactD(covmat[0]);
820 tFemtoTrack->SetImpactZ(covmat[2]);
821 tFemtoTrack->SetCdd(covmat[3]);
822 tFemtoTrack->SetCdz(covmat[4]);
823 tFemtoTrack->SetCzz(covmat[5]);
824 // This information is only available in the ESD
825 // We put in fake values or reasonable estimates
826 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
827 tFemtoTrack->SetITSncls(1);
828 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
829 tFemtoTrack->SetTPCncls(1);
830 tFemtoTrack->SetTPCnclsF(1);
831 tFemtoTrack->SetTPCsignalN(1);
832 tFemtoTrack->SetTPCsignalS(1);
836 tAllTrue.ResetAllBits(kTRUE);
837 tAllFalse.ResetAllBits(kFALSE);
840 // If not use dummy values
841 tFemtoTrack->SetTPCClusterMap(tAllTrue);
842 tFemtoTrack->SetTPCSharedMap(tAllFalse);
844 double xtpc[3] = {0,0,0};
845 tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
846 tFemtoTrack->SetNominalTPCExitPoint(xtpc);
849 for (int ik=0; ik<3; ik++) {
852 tFemtoTrack->SetKinkIndexes(indexes);
855 AliAODMCParticle* AliFemtoEventReaderStandard::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
857 if (aLabel < 0) return 0;
858 AliAODMCParticle *aodP;
860 if (aLabel > mcP->GetEntries())
861 posstack = mcP->GetEntries();
865 aodP = (AliAODMCParticle *) mcP->At(posstack);
866 if (aodP->GetLabel() > posstack) {
868 aodP = (AliAODMCParticle *) mcP->At(posstack);
869 if (aodP->GetLabel() == aLabel) return aodP;
872 while (posstack > 0);
876 aodP = (AliAODMCParticle *) mcP->At(posstack);
877 if (aodP->GetLabel() == aLabel) return aodP;
880 while (posstack < mcP->GetEntries());