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"
36 ClassImp(AliFemtoEventReaderStandard)
38 #if !(ST_NO_NAMESPACES)
39 using namespace units;
43 //____________________________
44 AliFemtoEventReaderStandard::AliFemtoEventReaderStandard():
45 AliFemtoEventReader(),
55 fUsePhysicsSel(kFALSE),
60 //constructor with 0 parameters , look at default settings
64 AliFemtoEventReaderStandard::AliFemtoEventReaderStandard(const AliFemtoEventReaderStandard& aReader):
65 AliFemtoEventReader(aReader),
75 fUsePhysicsSel(kFALSE),
81 fCurEvent = aReader.fCurEvent;
82 fCurFile = aReader.fCurFile;
83 fESDEvent = new AliESDEvent();
84 fAODEvent = new AliAODEvent();
85 fStack = aReader.fStack;
86 fInputType = aReader.fInputType;
87 fUsePhysicsSel = aReader.fUsePhysicsSel;
88 if (fUsePhysicsSel) fSelect = new AliPhysicsSelection();
89 fTrackCuts = new AliESDtrackCuts(*(aReader.fTrackCuts));
90 fUseTPCOnly = aReader.fUseTPCOnly;
93 AliFemtoEventReaderStandard::~AliFemtoEventReaderStandard()
98 if (fTrackCuts) delete fTrackCuts;
102 AliFemtoEventReaderStandard& AliFemtoEventReaderStandard::operator=(const AliFemtoEventReaderStandard& aReader)
104 // Assignment operator
105 if (this == &aReader)
108 fCurEvent = aReader.fCurEvent;
109 fCurFile = aReader.fCurFile;
110 if (fESDEvent) delete fESDEvent;
111 fESDEvent = new AliESDEvent();
112 if (fAODEvent) delete fAODEvent;
113 fAODEvent = new AliAODEvent();
114 fStack = aReader.fStack;
115 fGenHeader = aReader.fGenHeader;
116 fInputType = aReader.fInputType;
117 fUsePhysicsSel = aReader.fUsePhysicsSel;
118 if (fUsePhysicsSel) fSelect = new AliPhysicsSelection();
119 if (fTrackCuts) delete fTrackCuts;
120 fTrackCuts = new AliESDtrackCuts(*(aReader.fTrackCuts));
121 fUseTPCOnly = aReader.fUseTPCOnly;
127 AliFemtoString AliFemtoEventReaderStandard::Report()
129 AliFemtoString temp = "\n This is the AliFemtoEventReaderStandard\n";
133 AliFemtoEvent* AliFemtoEventReaderStandard::ReturnHbtEvent()
135 // Get the event, read all the relevant information
136 // and fill the AliFemtoEvent class
137 // Returns a valid AliFemtoEvent
138 AliFemtoEvent *hbtEvent = 0;
139 string tFriendFileName;
141 hbtEvent = new AliFemtoEvent;
143 // Get the friend information
144 cout<<"starting to read event "<<fCurEvent<<endl;
145 if ((fInputType == kESD) || (fInputType == kESDKine)) {
146 if(fESDEvent->GetAliESDOld())fESDEvent->CopyFromOldESD();
148 if (fUsePhysicsSel) {
149 hbtEvent->SetIsCollisionCandidate(fSelect->IsCollisionCandidate(fESDEvent));
150 if (!(fSelect->IsCollisionCandidate(fESDEvent)))
151 printf("Event not a collision candidate\n");
154 hbtEvent->SetIsCollisionCandidate(kTRUE);
157 hbtEvent->SetIsCollisionCandidate(kTRUE);
160 hbtEvent = new AliFemtoEvent;
164 //setting basic things
165 if ((fInputType == kESD) || (fInputType == kESDKine)) {
166 hbtEvent->SetRunNumber(fESDEvent->GetRunNumber());
167 hbtEvent->SetMagneticField(fESDEvent->GetMagneticField()*kilogauss);//to check if here is ok
168 hbtEvent->SetZDCN1Energy(fESDEvent->GetZDCN1Energy());
169 hbtEvent->SetZDCP1Energy(fESDEvent->GetZDCP1Energy());
170 hbtEvent->SetZDCN2Energy(fESDEvent->GetZDCN2Energy());
171 hbtEvent->SetZDCP2Energy(fESDEvent->GetZDCP2Energy());
172 hbtEvent->SetZDCEMEnergy(fESDEvent->GetZDCEMEnergy());
173 hbtEvent->SetZDCParticipants(fESDEvent->GetZDCParticipants());
174 hbtEvent->SetTriggerMask(fESDEvent->GetTriggerMask());
175 hbtEvent->SetTriggerCluster(fESDEvent->GetTriggerCluster());
177 printf("Got event type %i\n", fESDEvent->GetEventType());
181 // if (fUseTPCOnly) {
182 // fESDEvent->GetPrimaryVertexTPC()->GetXYZ(fV1);
183 // fESDEvent->GetPrimaryVertexTPC()->GetCovMatrix(fVCov);
184 // if (!fESDEvent->GetPrimaryVertexTPC()->GetStatus())
185 // fVCov[4] = -1001.0;
188 if (fESDEvent->GetPrimaryVertex()) {
189 fESDEvent->GetPrimaryVertex()->GetXYZ(fV1);
190 fESDEvent->GetPrimaryVertex()->GetCovMatrix(fVCov);
192 if (!fESDEvent->GetPrimaryVertex()->GetStatus()) {
193 // Get the vertex from SPD
194 fESDEvent->GetPrimaryVertexSPD()->GetXYZ(fV1);
195 fESDEvent->GetPrimaryVertexSPD()->GetCovMatrix(fVCov);
198 if (!fESDEvent->GetPrimaryVertexSPD()->GetStatus())
201 fESDEvent->GetPrimaryVertexSPD()->GetXYZ(fV1);
202 fESDEvent->GetPrimaryVertexSPD()->GetCovMatrix(fVCov);
207 if (fESDEvent->GetPrimaryVertexSPD()) {
208 fESDEvent->GetPrimaryVertexSPD()->GetXYZ(fV1);
209 fESDEvent->GetPrimaryVertexSPD()->GetCovMatrix(fVCov);
212 if ((!fESDEvent->GetPrimaryVertex()) && (!fESDEvent->GetPrimaryVertexSPD()))
214 cout << "No vertex found !!!" << endl;
221 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
223 hbtEvent->SetPrimVertPos(vertex);
224 hbtEvent->SetPrimVertCov(fVCov);
227 if ((fInputType == kAOD) || (fInputType == kAODKine)) {
228 hbtEvent->SetRunNumber(fAODEvent->GetRunNumber());
229 hbtEvent->SetMagneticField(fAODEvent->GetMagneticField()*kilogauss);//to check if here is ok
230 hbtEvent->SetZDCN1Energy(fAODEvent->GetZDCN1Energy());
231 hbtEvent->SetZDCP1Energy(fAODEvent->GetZDCP1Energy());
232 hbtEvent->SetZDCN2Energy(fAODEvent->GetZDCN2Energy());
233 hbtEvent->SetZDCP2Energy(fAODEvent->GetZDCP2Energy());
234 hbtEvent->SetZDCEMEnergy(fAODEvent->GetZDCEMEnergy(0));
235 hbtEvent->SetZDCParticipants(0);
236 hbtEvent->SetTriggerMask(fAODEvent->GetTriggerMask());
237 hbtEvent->SetTriggerCluster(fAODEvent->GetTriggerCluster());
239 // Primary Vertex position
240 fAODEvent->GetPrimaryVertex()->GetPosition(fV1);
242 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
243 hbtEvent->SetPrimVertPos(vertex);
246 if ((fInputType == kESDKine) || (fInputType == kAODKine)) {
247 Double_t tReactionPlane = 0;
249 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (fGenHeader);
251 AliGenCocktailEventHeader *cdh = dynamic_cast<AliGenCocktailEventHeader *> (fGenHeader);
253 TList *tGenHeaders = cdh->GetHeaders();
254 for (int ihead = 0; ihead<tGenHeaders->GetEntries(); ihead++) {
255 hdh = dynamic_cast<AliGenHijingEventHeader *> (fGenHeader);
262 tReactionPlane = hdh->ReactionPlaneAngle();
263 cout << "Got reaction plane " << tReactionPlane << endl;
266 hbtEvent->SetReactionPlaneAngle(tReactionPlane);
269 //starting to reading tracks
270 int nofTracks=0; //number of reconstructed tracks in event
271 if ((fInputType == kESD) || (fInputType == kESDKine))
272 nofTracks = fESDEvent->GetNumberOfTracks();
273 else if ((fInputType == kAOD) || (fInputType == kAODKine))
274 nofTracks = fAODEvent->GetNumberOfTracks();
276 int realnofTracks=0;//number of track which we use ina analysis
278 TClonesArray *mcP = 0;
281 if (fInputType == kAODKine) {
282 // Attempt to access MC header
284 mcH = (AliAODMCHeader *) fAODEvent->FindListObject(AliAODMCHeader::StdBranchName());
286 cout << "AOD MC information requested, but no header found!" << endl;
289 mcP = (TClonesArray *) fAODEvent->FindListObject(AliAODMCParticle::StdBranchName());
291 cout << "AOD MC information requested, but no particle array found!" << endl;
294 hbtEvent->SetReactionPlaneAngle(fAODEvent->GetHeader()->GetQTheta(0)/2.0);
297 motherids = new Int_t[((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel()];
298 for (int ip=0; ip<mcP->GetEntries(); ip++) motherids[ip] = 0;
300 // Read in mother ids
301 AliAODMCParticle *motherpart;
302 for (int ip=0; ip<mcP->GetEntries(); ip++) {
303 motherpart = (AliAODMCParticle *) mcP->At(ip);
304 if (motherpart->GetDaughter(0) > 0)
305 motherids[motherpart->GetDaughter(0)] = ip;
306 if (motherpart->GetDaughter(1) > 0)
307 motherids[motherpart->GetDaughter(1)] = ip;
312 if (fInputType == kESDKine) {
313 motherids = new Int_t[fStack->GetNtrack()];
314 for (int ip=0; ip<fStack->GetNtrack(); ip++) motherids[ip] = 0;
316 // Read in mother ids
317 TParticle *motherpart;
318 for (int ip=0; ip<fStack->GetNtrack(); ip++) {
319 motherpart = fStack->Particle(ip);
320 if (motherpart->GetDaughter(0) > 0)
321 motherids[motherpart->GetDaughter(0)] = ip;
322 if (motherpart->GetDaughter(1) > 0)
323 motherids[motherpart->GetDaughter(1)] = ip;
327 for (int i=0;i<nofTracks;i++)
329 // cout << "Reading track " << i << endl;
330 bool tGoodMomentum=true; //flaga to chcek if we can read momentum of this track
332 AliFemtoTrack* trackCopy = new AliFemtoTrack();
334 if ((fInputType == kESD) || (fInputType == kESDKine)) {
336 AliESDtrack *esdtrack = 0x0;
338 AliESDtrack *mcp = fESDEvent->GetTrack(i);
339 esdtrack = AliESDtrackCuts::GetTPCOnlyTrack(fESDEvent, mcp->GetID());
340 // printf("Got %p for track %i | ", esdtrack, mcp->GetID());
343 esdtrack = fESDEvent->GetTrack(i);//getting next track
346 if (esdtrack && (fTrackCuts->AcceptTrack(esdtrack))) {
348 trackCopy->SetCharge((short)esdtrack->GetSign());
350 //in aliroot we have AliPID
351 //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon
352 //we use only 5 first
354 esdtrack->GetESDpid(esdpid);
355 trackCopy->SetPidProbElectron(esdpid[0]);
356 trackCopy->SetPidProbMuon(esdpid[1]);
357 trackCopy->SetPidProbPion(esdpid[2]);
358 trackCopy->SetPidProbKaon(esdpid[3]);
359 trackCopy->SetPidProbProton(esdpid[4]);
365 // if (fUseTPCOnly) {
366 // if (!esdtrack->GetTPCInnerParam()) {
367 // cout << "No TPC inner param !" << endl;
372 // AliExternalTrackParam *param = new AliExternalTrackParam(*esdtrack->GetTPCInnerParam());
373 // param->GetXYZ(rxyz);
374 // param->PropagateToDCA(fESDEvent->GetPrimaryVertexTPC(), (fESDEvent->GetMagneticField()), 10000, impact, covimpact);
375 // param->GetPxPyPz(pxyz);//reading noconstarined momentum
377 // if (fRotateToEventPlane) {
378 // double tPhi = TMath::ATan2(pxyz[1], pxyz[0]);
379 // double tRad = TMath::Hypot(pxyz[0], pxyz[1]);
381 // pxyz[0] = tRad*TMath::Cos(tPhi - tReactionPlane);
382 // pxyz[1] = tRad*TMath::Sin(tPhi - tReactionPlane);
385 // AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
386 // if (v.mag() < 0.0001) {
387 // // cout << "Found 0 momentum ???? " << pxyz[0] << " " << pxyz[1] << " " << pxyz[2] << endl;
392 // trackCopy->SetP(v);//setting momentum
393 // trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
395 // const AliFmThreeVectorD kP(pxyz[0],pxyz[1],pxyz[2]);
396 // const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
397 // //setting helix I do not if it is ok
398 // AliFmPhysicalHelixD helix(kP,kOrigin,(double)(fESDEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge()));
399 // trackCopy->SetHelix(helix);
401 // //some stuff which could be useful
402 // trackCopy->SetImpactD(impact[0]);
403 // trackCopy->SetImpactZ(impact[1]);
404 // trackCopy->SetCdd(covimpact[0]);
405 // trackCopy->SetCdz(covimpact[1]);
406 // trackCopy->SetCzz(covimpact[2]);
407 // trackCopy->SetSigmaToVertex(GetSigmaToVertex(impact, covimpact));
413 tGoodMomentum=esdtrack->GetPxPyPz(pxyz);
415 tGoodMomentum=esdtrack->GetConstrainedPxPyPz(pxyz); //reading constrained momentum
416 // printf("Got good momentum %i\n", tGoodMomentum);
418 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
419 if (v.Mag() < 0.0001) {
425 trackCopy->SetP(v);//setting momentum
426 trackCopy->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
427 const AliFmThreeVectorD kP(pxyz[0],pxyz[1],pxyz[2]);
428 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
429 //setting helix I do not if it is ok
430 AliFmPhysicalHelixD helix(kP,kOrigin,(double)(fESDEvent->GetMagneticField())*kilogauss,(double)(trackCopy->Charge()));
431 trackCopy->SetHelix(helix);
433 //some stuff which could be useful
436 esdtrack->GetImpactParameters(imp,cim);
440 covimpact[0] = cim[0];
441 covimpact[1] = cim[1];
442 covimpact[2] = cim[2];
444 trackCopy->SetImpactD(impact[0]);
445 trackCopy->SetImpactZ(impact[1]);
446 trackCopy->SetCdd(covimpact[0]);
447 trackCopy->SetCdz(covimpact[1]);
448 trackCopy->SetCzz(covimpact[2]);
449 trackCopy->SetSigmaToVertex(AliESDtrackCuts::GetSigmaToVertex(esdtrack));
451 trackCopy->SetTrackId(esdtrack->GetID());
452 trackCopy->SetFlags(esdtrack->GetStatus());
453 trackCopy->SetLabel(esdtrack->GetLabel());
455 trackCopy->SetITSchi2(esdtrack->GetITSchi2());
456 trackCopy->SetITSncls(esdtrack->GetNcls(0));
457 trackCopy->SetTPCchi2(esdtrack->GetTPCchi2());
458 trackCopy->SetTPCncls(esdtrack->GetTPCNcls());
459 trackCopy->SetTPCnclsF(esdtrack->GetTPCNclsF());
460 trackCopy->SetTPCsignalN((short)esdtrack->GetTPCsignalN()); //due to bug in aliesdtrack class
461 trackCopy->SetTPCsignalS(esdtrack->GetTPCsignalSigma());
463 trackCopy->SetTPCClusterMap(esdtrack->GetTPCClusterMap());
464 trackCopy->SetTPCSharedMap(esdtrack->GetTPCSharedMap());
467 esdtrack->GetInnerXYZ(xtpc);
469 trackCopy->SetNominalTPCEntrancePoint(xtpc);
471 esdtrack->GetOuterXYZ(xtpc);
473 trackCopy->SetNominalTPCExitPoint(xtpc);
476 for (int ik=0; ik<3; ik++) {
477 indexes[ik] = esdtrack->GetKinkIndex(ik);
479 trackCopy->SetKinkIndexes(indexes);
481 // Fill the hidden information with the simulated data
482 if (fInputType == kESDKine) {
483 if (TMath::Abs(esdtrack->GetLabel()) < fStack->GetNtrack()) {
484 TParticle *tPart = fStack->Particle(TMath::Abs(esdtrack->GetLabel()));
486 // Check the mother information
488 // Using the new way of storing the freeze-out information
489 // Final state particle is stored twice on the stack
490 // one copy (mother) is stored with original freeze-out information
491 // and is not tracked
492 // the other one (daughter) is stored with primary vertex position
495 // Freeze-out coordinates
496 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
497 fpx = tPart->Vx() - fV1[0];
498 fpy = tPart->Vy() - fV1[1];
499 fpz = tPart->Vz() - fV1[2];
502 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
503 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
510 if (motherids[TMath::Abs(esdtrack->GetLabel())]>0) {
511 TParticle *mother = fStack->Particle(motherids[TMath::Abs(esdtrack->GetLabel())]);
512 // Check if this is the same particle stored twice on the stack
513 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
514 // It is the same particle
515 // Read in the original freeze-out information
516 // and convert it from to [fm]
519 fpx = mother->Vx()*1e13*0.197327;
520 fpy = mother->Vy()*1e13*0.197327;
521 fpz = mother->Vz()*1e13*0.197327;
522 fpt = mother->T() *1e13*0.197327;
526 // fpx = mother->Vx()*1e13;
527 // fpy = mother->Vy()*1e13;
528 // fpz = mother->Vz()*1e13;
529 // fpt = mother->T() *1e13*3e10;
534 tInfo->SetPDGPid(tPart->GetPdgCode());
536 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
537 Double_t mass2 = (tPart->Energy() *tPart->Energy() -
538 tPart->Px()*tPart->Px() -
539 tPart->Py()*tPart->Py() -
540 tPart->Pz()*tPart->Pz());
542 tInfo->SetMass(TMath::Sqrt(mass2));
546 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
547 trackCopy->SetHiddenInfo(tInfo);
550 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
552 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
557 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
559 tInfo->SetTrueMomentum(pxyz[0],pxyz[1],pxyz[2]);
561 trackCopy->SetHiddenInfo(tInfo);
564 // cout << "Got freeze-out " << fpx << " " << fpy << " " << fpz << " " << fpt << " " << mass2 << " " << tPart->GetPdgCode() << endl;
567 tGoodMomentum = false;
570 if (esdtrack) delete esdtrack;
573 if ((fInputType == kAOD) || (fInputType == kAODKine)) {
574 // Read in the normal AliAODTracks
575 const AliAODTrack *aodtrack=fAODEvent->GetTrack(i); // getting the AODtrack directly
577 // if (!aodtrack->TestFilterBit(fFilterBit))
580 CopyAODtoFemtoTrack(aodtrack, trackCopy);
583 // Fill the hidden information with the simulated data
584 // Int_t pLabel = aodtrack->GetLabel();
585 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
587 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
588 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
593 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
595 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
596 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
600 // Check the mother information
602 // Using the new way of storing the freeze-out information
603 // Final state particle is stored twice on the stack
604 // one copy (mother) is stored with original freeze-out information
605 // and is not tracked
606 // the other one (daughter) is stored with primary vertex position
609 // Freeze-out coordinates
610 fpx = tPart->Xv() - fV1[0];
611 fpy = tPart->Yv() - fV1[1];
612 fpz = tPart->Zv() - fV1[2];
615 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
622 // cout << "Looking for mother ids " << endl;
623 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
624 // cout << "Got mother id" << endl;
625 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
626 // Check if this is the same particle stored twice on the stack
628 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
629 // It is the same particle
630 // Read in the original freeze-out information
631 // and convert it from to [fm]
634 // fpx = mother->Xv()*1e13*0.197327;
635 // fpy = mother->Yv()*1e13*0.197327;
636 // fpz = mother->Zv()*1e13*0.197327;
637 // fpt = mother->T() *1e13*0.197327*0.5;
641 fpx = mother->Xv()*1e13;
642 fpy = mother->Yv()*1e13;
643 fpz = mother->Zv()*1e13;
644 // fpt = mother->T() *1e13*3e10;
650 // if (fRotateToEventPlane) {
651 // double tPhi = TMath::ATan2(fpy, fpx);
652 // double tRad = TMath::Hypot(fpx, fpy);
654 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
655 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
658 tInfo->SetPDGPid(tPart->GetPdgCode());
660 // if (fRotateToEventPlane) {
661 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
662 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
664 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
665 // tRad*TMath::Sin(tPhi - tReactionPlane),
669 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
670 Double_t mass2 = (tPart->E() *tPart->E() -
671 tPart->Px()*tPart->Px() -
672 tPart->Py()*tPart->Py() -
673 tPart->Pz()*tPart->Pz());
675 tInfo->SetMass(TMath::Sqrt(mass2));
679 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
681 trackCopy->SetHiddenInfo(tInfo);
685 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
686 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
687 // Check the sanity of the tracks - reject zero momentum tracks
688 if (ktP.Mag() == 0) {
697 //decision if we want this track
698 //if we using diffrent labels we want that this label was use for first time
699 //if we use hidden info we want to have match between sim data and ESD
700 if (tGoodMomentum==true)
702 hbtEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
703 realnofTracks++;//real number of tracks
716 hbtEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
718 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
721 //___________________
722 void AliFemtoEventReaderStandard::SetESDSource(AliESDEvent *aESD)
724 // The chain loads the ESD for us
725 // You must provide the address where it can be found
728 //___________________
729 void AliFemtoEventReaderStandard::SetAODSource(AliAODEvent *aAOD)
731 // The chain loads the ESD for us
732 // You must provide the address where it can be found
735 //___________________
736 void AliFemtoEventReaderStandard::SetStackSource(AliStack *aStack)
738 // The chain loads the stack for us
739 // You must provide the address where it can be found
742 void AliFemtoEventReaderStandard::SetInputType(AliFemtoInputType aInput)
744 // Set the proper input type
747 //___________________
748 void AliFemtoEventReaderStandard::SetGenEventHeader(AliGenEventHeader *aGenHeader)
750 // The chain loads the generator event header for us
751 // You must provide the address where it can be found
752 fGenHeader = aGenHeader;
755 void AliFemtoEventReaderStandard::SetUsePhysicsSelection(const bool usephysics)
757 fUsePhysicsSel = usephysics;
758 if (!fSelect) fSelect = new AliPhysicsSelection();
761 void AliFemtoEventReaderStandard::SetESDTrackCuts(AliESDtrackCuts *esdcuts)
763 // Set external ESD track cuts
764 fTrackCuts = esdcuts;
767 void AliFemtoEventReaderStandard::SetUseTPCOnly(const bool usetpconly)
769 // Set flag to use TPC only tracks
770 fUseTPCOnly = usetpconly;
773 void AliFemtoEventReaderStandard::CopyAODtoFemtoTrack(const AliAODTrack *tAodTrack,
774 AliFemtoTrack *tFemtoTrack)
776 // Copy the track information from the AOD into the internal AliFemtoTrack
777 // If it exists, use the additional information from the PWG2 AOD
779 // Primary Vertex position
781 fAODEvent->GetPrimaryVertex()->GetPosition(fV1);
783 tFemtoTrack->SetCharge(tAodTrack->Charge());
785 //in aliroot we have AliPID
786 //0-electron 1-muon 2-pion 3-kaon 4-proton 5-photon 6-pi0 7-neutron 8-kaon0 9-eleCon
787 //we use only 5 first
789 // AOD pid has 10 components
791 tAodTrack->GetPID(aodpid);
792 tFemtoTrack->SetPidProbElectron(aodpid[0]);
793 tFemtoTrack->SetPidProbMuon(aodpid[1]);
794 tFemtoTrack->SetPidProbPion(aodpid[2]);
795 tFemtoTrack->SetPidProbKaon(aodpid[3]);
796 tFemtoTrack->SetPidProbProton(aodpid[4]);
799 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
800 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
801 tFemtoTrack->SetP(v);//setting momentum
802 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
803 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
804 //setting track helix
805 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
806 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fAODEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
807 tFemtoTrack->SetHelix(helix);
810 tFemtoTrack->SetTrackId(tAodTrack->GetID());
811 tFemtoTrack->SetFlags(1);
812 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
814 // Track quality information
816 tAodTrack->GetCovMatrix(covmat);
817 tFemtoTrack->SetImpactD(covmat[0]);
818 tFemtoTrack->SetImpactZ(covmat[2]);
819 tFemtoTrack->SetCdd(covmat[3]);
820 tFemtoTrack->SetCdz(covmat[4]);
821 tFemtoTrack->SetCzz(covmat[5]);
822 // This information is only available in the ESD
823 // We put in fake values or reasonable estimates
824 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
825 tFemtoTrack->SetITSncls(1);
826 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
827 tFemtoTrack->SetTPCncls(1);
828 tFemtoTrack->SetTPCnclsF(1);
829 tFemtoTrack->SetTPCsignalN(1);
830 tFemtoTrack->SetTPCsignalS(1);
834 tAllTrue.ResetAllBits(kTRUE);
835 tAllFalse.ResetAllBits(kFALSE);
838 // If not use dummy values
839 tFemtoTrack->SetTPCClusterMap(tAllTrue);
840 tFemtoTrack->SetTPCSharedMap(tAllFalse);
842 double xtpc[3] = {0,0,0};
843 tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
844 tFemtoTrack->SetNominalTPCExitPoint(xtpc);
847 for (int ik=0; ik<3; ik++) {
850 tFemtoTrack->SetKinkIndexes(indexes);
853 AliAODMCParticle* AliFemtoEventReaderStandard::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
855 if (aLabel < 0) return 0;
856 AliAODMCParticle *aodP;
858 if (aLabel > mcP->GetEntries())
859 posstack = mcP->GetEntries();
863 aodP = (AliAODMCParticle *) mcP->At(posstack);
864 if (aodP->GetLabel() > posstack) {
866 aodP = (AliAODMCParticle *) mcP->At(posstack);
867 if (aodP->GetLabel() == aLabel) return aodP;
870 while (posstack > 0);
874 aodP = (AliAODMCParticle *) mcP->At(posstack);
875 if (aodP->GetLabel() == aLabel) return aodP;
878 while (posstack < mcP->GetEntries());