1 ////////////////////////////////////////////////////////////////////////////////
3 // AliFemtoEventReaderAOD - the reader class for the Alice AOD //
4 // Reads in AOD information and converts it into internal AliFemtoEvent //
5 // Authors: Marek Chojnacki mchojnacki@knf.pw.edu.pl //
6 // Adam Kisiel kisiel@mps.ohio-state.edu //
8 ////////////////////////////////////////////////////////////////////////////////
10 #include "AliFemtoEventReaderAOD.h"
14 #include "AliAODEvent.h"
15 #include "AliAODTrack.h"
16 #include "AliAODVertex.h"
17 #include "AliAODMCHeader.h"
18 #include "AliESDtrack.h"
20 #include "AliFmPhysicalHelixD.h"
21 #include "AliFmThreeVectorF.h"
23 #include "SystemOfUnits.h"
25 #include "AliFemtoEvent.h"
26 #include "AliFemtoModelHiddenInfo.h"
27 #include "AliFemtoModelGlobalHiddenInfo.h"
30 #include "AliAODpidUtil.h"
32 ClassImp(AliFemtoEventReaderAOD)
34 #if !(ST_NO_NAMESPACES)
35 using namespace units;
42 //____________________________
43 //constructor with 0 parameters , look at default settings
44 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD():
52 // fPWG2AODTracks(0x0),
56 fEstEventMult(kCentrality),
67 // default constructor
68 fAllTrue.ResetAllBits(kTRUE);
69 fAllFalse.ResetAllBits(kFALSE);
74 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(const AliFemtoEventReaderAOD &aReader) :
75 AliFemtoEventReader(),
83 // fPWG2AODTracks(0x0),
87 fEstEventMult(kCentrality),
99 fReadMC = aReader.fReadMC;
100 fReadV0 = aReader.fReadV0;
101 fInputFile = aReader.fInputFile;
102 fFileName = aReader.fFileName;
103 fNumberofEvent = aReader.fNumberofEvent;
104 fCurEvent = aReader.fCurEvent;
105 fEvent = new AliAODEvent();
106 fAodFile = new TFile(aReader.fAodFile->GetName());
107 fAllTrue.ResetAllBits(kTRUE);
108 fAllFalse.ResetAllBits(kFALSE);
109 fFilterBit = aReader.fFilterBit;
110 // fPWG2AODTracks = aReader.fPWG2AODTracks;
111 fAODpidUtil = aReader.fAODpidUtil;
112 fAODheader = aReader.fAODheader;
113 fCentRange[0] = aReader.fCentRange[0];
114 fCentRange[1] = aReader.fCentRange[1];
115 fEstEventMult = aReader.fEstEventMult;
116 fUsePreCent = aReader.fUsePreCent;
117 fpA2013 = aReader.fpA2013;
121 AliFemtoEventReaderAOD::~AliFemtoEventReaderAOD()
127 // if (fPWG2AODTracks) {
128 // fPWG2AODTracks->Delete();
129 // delete fPWG2AODTracks;
134 AliFemtoEventReaderAOD& AliFemtoEventReaderAOD::operator=(const AliFemtoEventReaderAOD& aReader)
136 // assignment operator
137 if (this == &aReader)
140 fInputFile = aReader.fInputFile;
141 fFileName = aReader.fFileName;
142 fNumberofEvent = aReader.fNumberofEvent;
143 fCurEvent = aReader.fCurEvent;
144 if (fTree) delete fTree;
145 if (fEvent) delete fEvent;
146 fEvent = new AliAODEvent();
147 if (fAodFile) delete fAodFile;
148 fAodFile = new TFile(aReader.fAodFile->GetName());
149 fAllTrue.ResetAllBits(kTRUE);
150 fAllFalse.ResetAllBits(kFALSE);
151 fFilterBit = aReader.fFilterBit;
152 fFilterMask = aReader.fFilterMask;
153 // fPWG2AODTracks = aReader.fPWG2AODTracks;
154 fAODpidUtil = aReader.fAODpidUtil;
155 fAODheader = aReader.fAODheader;
156 fCentRange[0] = aReader.fCentRange[0];
157 fCentRange[1] = aReader.fCentRange[1];
158 fUsePreCent = aReader.fUsePreCent;
159 fEstEventMult = aReader.fEstEventMult;
160 fpA2013 = aReader.fpA2013;
165 AliFemtoString AliFemtoEventReaderAOD::Report()
167 // create reader report
168 AliFemtoString temp = "\n This is the AliFemtoEventReaderAOD\n";
173 void AliFemtoEventReaderAOD::SetInputFile(const char* inputFile)
175 //setting the name of file where names of AOD file are written
176 //it takes only this files which have good trees
178 fInputFile=string(inputFile);
179 ifstream infile(inputFile);
181 fTree = new TChain("aodTree");
183 if(infile.good()==true)
185 //checking if all give files have good tree inside
186 while (infile.eof()==false)
188 infile.getline(buffer,256);
189 TFile *aodFile=TFile::Open(buffer,"READ");
192 TTree* tree = (TTree*) aodFile->Get("aodTree");
195 // cout<<"putting file "<<string(buffer)<<" into analysis"<<endl;
196 fTree->AddFile(buffer);
206 AliFemtoEvent* AliFemtoEventReaderAOD::ReturnHbtEvent()
208 // read in a next hbt event from the chain
209 // convert it to AliFemtoEvent and return
210 // for further analysis
211 AliFemtoEvent *hbtEvent = 0;
212 // cout<<"reader"<<endl;
213 if (fCurEvent==fNumberofEvent)//open next file
215 if(fNumberofEvent==0)
217 fEvent=new AliAODEvent();
218 fEvent->ReadFromTree(fTree);
220 // Check for the existence of the additional information
221 // fPWG2AODTracks = (TClonesArray *) fEvent->GetList()->FindObject("pwg2aodtracks");
223 // if (fPWG2AODTracks) {
224 // cout << "Found additional PWG2 specific information in the AOD!" << endl;
225 // cout << "Reading only tracks with the additional information" << endl;
228 fNumberofEvent=fTree->GetEntries();
229 // cout<<"Number of Entries in file "<<fNumberofEvent<<endl;
232 else //no more data to read
234 // cout<<"no more files "<<hbtEvent<<endl;
240 // cout<<"starting to read event "<<fCurEvent<<endl;
241 fTree->GetEvent(fCurEvent);//getting next event
242 // cout << "Read event " << fEvent << " from file " << fTree << endl;
244 hbtEvent = new AliFemtoEvent;
246 CopyAODtoFemtoEvent(hbtEvent);
253 void AliFemtoEventReaderAOD::CopyAODtoFemtoEvent(AliFemtoEvent *tEvent)
256 // A function that reads in the AOD event
257 // and transfers the neccessary information into
258 // the internal AliFemtoEvent
260 // setting global event characteristics
261 tEvent->SetRunNumber(fEvent->GetRunNumber());
262 tEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
263 tEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
264 tEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
265 tEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
266 tEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
267 tEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy(0));
268 tEvent->SetZDCParticipants(0);
269 tEvent->SetTriggerMask(fEvent->GetTriggerMask());
270 tEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
272 // Attempt to access MC header
276 mcH = (AliAODMCHeader *) fEvent->FindListObject(AliAODMCHeader::StdBranchName());
278 cout << "AOD MC information requested, but no header found!" << endl;
281 mcP = (TClonesArray *) fEvent->FindListObject(AliAODMCParticle::StdBranchName());
283 cout << "AOD MC information requested, but no particle array found!" << endl;
287 tEvent->SetReactionPlaneAngle(fEvent->GetHeader()->GetQTheta(0)/2.0);
291 motherids = new Int_t[((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel()];
292 for (int ip=0; ip<mcP->GetEntries(); ip++) motherids[ip] = 0;
294 // Read in mother ids
295 AliAODMCParticle *motherpart;
296 for (int ip=0; ip<mcP->GetEntries(); ip++) {
297 motherpart = (AliAODMCParticle *) mcP->At(ip);
298 if (motherpart->GetDaughter(0) > 0)
299 motherids[motherpart->GetDaughter(0)] = ip;
300 if (motherpart->GetDaughter(1) > 0)
301 motherids[motherpart->GetDaughter(1)] = ip;
305 // Primary Vertex position
309 const AliAODVertex* trkVtx = fEvent->GetPrimaryVertex();
310 if (!trkVtx || trkVtx->GetNContributors()<=0) return;
311 TString vtxTtl = trkVtx->GetTitle();
312 if (!vtxTtl.Contains("VertexerTracks")) return;
313 Float_t zvtx = trkVtx->GetZ();
314 const AliAODVertex* spdVtx = fEvent->GetPrimaryVertexSPD();
315 if (spdVtx->GetNContributors()<=0) return;
316 TString vtxTyp = spdVtx->GetTitle();
318 spdVtx->GetCovarianceMatrix(cov);
319 Double_t zRes = TMath::Sqrt(cov[5]);
320 if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;
321 if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;
323 if (TMath::Abs(zvtx) > 10) return;
325 fEvent->GetPrimaryVertex()->GetPosition(fV1);
327 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
328 tEvent->SetPrimVertPos(vertex);
330 //starting to reading tracks
331 int nofTracks=0; //number of reconstructed tracks in event
333 // Check to see whether the additional info exists
334 // if (fPWG2AODTracks)
335 // nofTracks=fPWG2AODTracks->GetEntries();
337 nofTracks=fEvent->GetNumberOfTracks();
339 AliEventplane *ep = fEvent->GetEventplane();
343 tEvent->SetReactionPlaneAngle(ep->GetEventplane("V0",fEvent,2));
345 tEvent->SetReactionPlaneAngle(ep->GetEventplane("Q"));
348 AliCentrality *cent = fEvent->GetCentrality();
350 if (!fEstEventMult && cent && fUsePreCent) {
351 if ((cent->GetCentralityPercentile("V0M")*10 < fCentRange[0]) ||
352 (cent->GetCentralityPercentile("V0M")*10 > fCentRange[1]))
354 // cout << "Centrality " << cent->GetCentralityPercentile("V0M") << " outside of preselection range " << fCentRange[0] << " - " << fCentRange[1] << endl;
360 int realnofTracks=0; // number of track which we use in a analysis
364 for (int il=0; il<20000; il++) labels[il] = -1;
366 // looking for global tracks and saving their numbers to copy from them PID information to TPC-only tracks in the main loop over tracks
367 for (int i=0;i<nofTracks;i++) {
368 const AliAODTrack *aodtrack=fEvent->GetTrack(i);
369 if (!aodtrack->TestFilterBit(fFilterBit)) {
370 if(aodtrack->GetID() < 0) continue;
371 labels[aodtrack->GetID()] = i;
376 for (int i=0;i<nofTracks;i++)
378 AliFemtoTrack* trackCopy = new AliFemtoTrack();
380 // if (fPWG2AODTracks) {
381 // // Read tracks from the additional pwg2 specific AOD part
383 // // Note that in that case all the AOD tracks without the
384 // // additional information will be ignored !
385 // AliPWG2AODTrack *pwg2aodtrack = (AliPWG2AODTrack *) fPWG2AODTracks->At(i);
387 // // Getting the AOD track through the ref of the additional info
388 // AliAODTrack *aodtrack = pwg2aodtrack->GetRefAODTrack();
389 // if (!aodtrack->TestFilterBit(fFilterBit)) {
395 // if (aodtrack->IsOn(AliESDtrack::kTPCrefit))
396 // if (aodtrack->Chi2perNDF() < 6.0)
397 // if (aodtrack->Eta() < 0.9)
401 // CopyAODtoFemtoTrack(aodtrack, trackCopy, pwg2aodtrack);
404 // // Fill the hidden information with the simulated data
405 // // Int_t pLabel = aodtrack->GetLabel();
406 // AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
408 // // Check the mother information
410 // // Using the new way of storing the freeze-out information
411 // // Final state particle is stored twice on the stack
412 // // one copy (mother) is stored with original freeze-out information
413 // // and is not tracked
414 // // the other one (daughter) is stored with primary vertex position
417 // // Freeze-out coordinates
418 // double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
419 // fpx = tPart->Xv() - fV1[0];
420 // fpy = tPart->Yv() - fV1[1];
421 // fpz = tPart->Zv() - fV1[2];
424 // AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
425 // tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
432 // // cout << "Looking for mother ids " << endl;
433 // if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
434 // // cout << "Got mother id" << endl;
435 // AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
436 // // Check if this is the same particle stored twice on the stack
437 // if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
438 // // It is the same particle
439 // // Read in the original freeze-out information
440 // // and convert it from to [fm]
443 // // fpx = mother->Xv()*1e13*0.197327;
444 // // fpy = mother->Yv()*1e13*0.197327;
445 // // fpz = mother->Zv()*1e13*0.197327;
446 // // fpt = mother->T() *1e13*0.197327*0.5;
449 // // Therminator style
450 // fpx = mother->Xv()*1e13;
451 // fpy = mother->Yv()*1e13;
452 // fpz = mother->Zv()*1e13;
453 // fpt = mother->T() *1e13*3e10;
458 // // if (fRotateToEventPlane) {
459 // // double tPhi = TMath::ATan2(fpy, fpx);
460 // // double tRad = TMath::Hypot(fpx, fpy);
462 // // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
463 // // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
466 // tInfo->SetPDGPid(tPart->GetPdgCode());
468 // // if (fRotateToEventPlane) {
469 // // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
470 // // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
472 // // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
473 // // tRad*TMath::Sin(tPhi - tReactionPlane),
477 // tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
478 // Double_t mass2 = (tPart->E() *tPart->E() -
479 // tPart->Px()*tPart->Px() -
480 // tPart->Py()*tPart->Py() -
481 // tPart->Pz()*tPart->Pz());
483 // tInfo->SetMass(TMath::Sqrt(mass2));
485 // tInfo->SetMass(0.0);
487 // tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
488 // trackCopy->SetHiddenInfo(tInfo);
493 // aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
494 // const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
495 // // Check the sanity of the tracks - reject zero momentum tracks
496 // if (ktP.Mag() == 0) {
502 // No additional information exists
503 // Read in the normal AliAODTracks
505 // const AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
506 AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
510 if (aodtrack->IsPrimaryCandidate()) tracksPrim++;
512 if (fFilterBit && !aodtrack->TestFilterBit(fFilterBit)) {
517 if (fFilterMask && !aodtrack->TestFilterBit(fFilterMask)) {
522 //counting particles to set multiplicity
525 if (aodtrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
526 if(impact[0]<0.2 && TMath::Abs(impact[1]+fV1[2])<2.0)
527 //if (aodtrack->IsPrimaryCandidate()) //? instead of kinks?
528 if (aodtrack->Chi2perNDF() < 4.0)
529 if (aodtrack->Pt() > 0.15 && aodtrack->Pt() < 20)
530 if (aodtrack->GetTPCNcls() > 70)
531 if (aodtrack->Eta() < 0.8)
535 CopyAODtoFemtoTrack(aodtrack, trackCopy);
537 // copying PID information from the correspondent track
538 // const AliAODTrack *aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
541 AliAODTrack *aodtrackpid;
542 if((fFilterBit == (1 << (7))) || fFilterMask==128) //for TPC Only tracks we have to copy PID information from corresponding global tracks
543 aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
545 aodtrackpid = fEvent->GetTrack(i);
546 CopyPIDtoFemtoTrack(aodtrackpid, trackCopy);
549 // Fill the hidden information with the simulated data
550 // Int_t pLabel = aodtrack->GetLabel();
551 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
553 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
554 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
559 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
561 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
562 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
566 // Check the mother information
568 // Using the new way of storing the freeze-out information
569 // Final state particle is stored twice on the stack
570 // one copy (mother) is stored with original freeze-out information
571 // and is not tracked
572 // the other one (daughter) is stored with primary vertex position
575 // Freeze-out coordinates
576 fpx = tPart->Xv() - fV1[0];
577 fpy = tPart->Yv() - fV1[1];
578 fpz = tPart->Zv() - fV1[2];
581 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
588 // cout << "Looking for mother ids " << endl;
589 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
590 // cout << "Got mother id" << endl;
591 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
592 // Check if this is the same particle stored twice on the stack
594 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
595 // It is the same particle
596 // Read in the original freeze-out information
597 // and convert it from to [fm]
600 // fpx = mother->Xv()*1e13*0.197327;
601 // fpy = mother->Yv()*1e13*0.197327;
602 // fpz = mother->Zv()*1e13*0.197327;
603 // fpt = mother->T() *1e13*0.197327*0.5;
607 fpx = mother->Xv()*1e13;
608 fpy = mother->Yv()*1e13;
609 fpz = mother->Zv()*1e13;
610 // fpt = mother->T() *1e13*3e10;
616 // if (fRotateToEventPlane) {
617 // double tPhi = TMath::ATan2(fpy, fpx);
618 // double tRad = TMath::Hypot(fpx, fpy);
620 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
621 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
624 tInfo->SetPDGPid(tPart->GetPdgCode());
626 // if (fRotateToEventPlane) {
627 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
628 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
630 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
631 // tRad*TMath::Sin(tPhi - tReactionPlane),
635 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
636 Double_t mass2 = (tPart->E() *tPart->E() -
637 tPart->Px()*tPart->Px() -
638 tPart->Py()*tPart->Py() -
639 tPart->Pz()*tPart->Pz());
641 tInfo->SetMass(TMath::Sqrt(mass2));
645 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
647 trackCopy->SetHiddenInfo(tInfo);
652 //AliExternalTrackParam *param = new AliExternalTrackParam(*aodtrack->GetInnerParam());
653 trackCopy->SetInnerMomentum(aodtrack->GetTPCmomentum());
655 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
656 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
657 // Check the sanity of the tracks - reject zero momentum tracks
658 if (ktP.Mag() == 0) {
665 tEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
666 realnofTracks++;//real number of tracks
669 tEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
670 tEvent->SetNormalizedMult(tracksPrim);
673 tEvent->SetCentralityV0(cent->GetCentralityPercentile("V0M"));
674 tEvent->SetCentralityV0A(cent->GetCentralityPercentile("V0A"));
675 tEvent->SetCentralityV0C(cent->GetCentralityPercentile("V0C"));
676 tEvent->SetCentralityZNA(cent->GetCentralityPercentile("ZNA"));
677 tEvent->SetCentralityZNC(cent->GetCentralityPercentile("ZNC"));
678 tEvent->SetCentralityCL1(cent->GetCentralityPercentile("CL1"));
679 tEvent->SetCentralityCL0(cent->GetCentralityPercentile("CL0"));
680 tEvent->SetCentralityTKL(cent->GetCentralityPercentile("TKL"));
681 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("FMD"));
682 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("NPA"));
683 // tEvent->SetCentralitySPD1(cent->GetCentralityPercentile("CL1"));
684 tEvent->SetCentralityTrk(cent->GetCentralityPercentile("TRK"));
685 tEvent->SetCentralityCND(cent->GetCentralityPercentile("CND"));
688 if (fEstEventMult==kCentrality) {
689 //AliCentrality *cent = fEvent->GetCentrality();
690 //cout<<"AliFemtoEventReaderAOD:"<<lrint(10*cent->GetCentralityPercentile("V0M"))<<endl;
691 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0M")));
692 // if (cent) tEvent->SetNormalizedMult((int) cent->GetCentralityPercentile("V0M"));
694 else if (fEstEventMult==kCentralityV0A) {
695 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0A")));
697 else if (fEstEventMult==kCentralityV0C) {
698 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0C")));
700 else if (fEstEventMult==kCentralityZNA) {
701 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNA")));
703 else if (fEstEventMult==kCentralityZNC) {
704 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNC")));
706 else if (fEstEventMult==kCentralityCL1) {
707 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL1")));
709 else if (fEstEventMult==kCentralityCL0) {
710 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL0")));
712 else if (fEstEventMult==kCentralityTRK) {
713 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TRK")));
715 else if (fEstEventMult==kCentralityTKL) {
716 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TKL")));
718 else if (fEstEventMult==kCentralityCND) {
719 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CND")));
721 else if (fEstEventMult==kCentralityNPA) {
722 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("NPA")));
724 else if (fEstEventMult==kCentralityFMD) {
725 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("FMD")));
727 else if(fEstEventMult==kGlobalCount){
728 tEvent->SetNormalizedMult(tNormMult); //particles counted in the loop, trying to reproduce GetReferenceMultiplicity. If better (default) method appears it should be changed
730 else if(fEstEventMult==kReference)
732 tEvent->SetNormalizedMult(fAODheader->GetRefMultiplicity());
734 else if(fEstEventMult==kTPCOnlyRef)
736 tEvent->SetNormalizedMult(fAODheader->GetTPConlyRefMultiplicity());
738 else if(fEstEventMult == kVZERO)
741 for (Int_t i=0; i<64; i++)
742 multV0 += fEvent->GetVZEROData()->GetMultiplicity(i);
743 tEvent->SetNormalizedMult(multV0);
746 if (mcP) delete [] motherids;
748 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
753 for (Int_t i = 0; i < fEvent->GetNumberOfV0s(); i++) {
754 AliAODv0* aodv0 = fEvent->GetV0(i);
755 if (!aodv0) continue;
756 if(aodv0->GetNDaughters()>2) continue;
757 if(aodv0->GetNProngs()>2) continue;
758 if(aodv0->GetCharge()!=0) continue;
759 if(aodv0->ChargeProng(0)==aodv0->ChargeProng(1)) continue;
760 if(aodv0->CosPointingAngle(fV1)<0.998) continue;
761 AliFemtoV0* trackCopyV0 = new AliFemtoV0();
763 CopyAODtoFemtoV0(aodv0, trackCopyV0);
764 tEvent->V0Collection()->push_back(trackCopyV0);
765 //cout<<"Pushback v0 to v0collection"<<endl;
771 void AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack,
772 AliFemtoTrack *tFemtoTrack
773 // AliPWG2AODTrack *tPWG2AODTrack
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 fEvent->GetPrimaryVertex()->GetPosition(fV1);
782 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
784 tFemtoTrack->SetCharge(tAodTrack->Charge());
787 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
788 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
789 tFemtoTrack->SetP(v);//setting momentum
790 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
791 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
792 //setting track helix
793 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
794 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
795 tFemtoTrack->SetHelix(helix);
798 tFemtoTrack->SetTrackId(tAodTrack->GetID());
799 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
800 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
802 // Track quality information
804 tAodTrack->GetCovMatrix(covmat);
806 // ! DCA information is done in CopyPIDtoFemtoTrack()
809 // double covimpact[3];
811 // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
812 // //cout << "sth went wrong with dca propagation" << endl;
813 // tFemtoTrack->SetImpactD(-1000.0);
814 // tFemtoTrack->SetImpactZ(-1000.0);
818 // tFemtoTrack->SetImpactD(impact[0]);
819 // tFemtoTrack->SetImpactZ(impact[1]+fV1[2]);
822 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
823 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
825 // tFemtoTrack->SetImpactD(0.0);
826 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
828 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
831 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
832 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
836 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
837 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
838 // << tAodTrack->Yv() - fV1[1]
839 // << "xv = " << tAodTrack->Xv() << endl
840 // << "fv1[0] = " << fV1[0] << endl
841 // << "yv = " << tAodTrack->Yv() << endl
842 // << "fv1[1] = " << fV1[1] << endl
843 // << "zv = " << tAodTrack->Zv() << endl
844 // << "fv1[2] = " << fV1[2] << endl
845 // << "impact[0] = " << impact[0] << endl
846 // << "impact[1] = " << impact[1] << endl
849 tFemtoTrack->SetCdd(covmat[0]);
850 tFemtoTrack->SetCdz(covmat[1]);
851 tFemtoTrack->SetCzz(covmat[2]);
852 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
853 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
854 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
855 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
856 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
857 tFemtoTrack->SetTPCsignalN(1);
858 tFemtoTrack->SetTPCsignalS(1);
859 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
861 // if (tPWG2AODTrack) {
862 // // Copy the PWG2 specific information if it exists
863 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
864 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
866 // double xtpc[3] = {0,0,0};
867 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
868 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
869 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
870 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
873 // If not use dummy values
874 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
875 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
878 float globalPositionsAtRadii[9][3];
879 float bfield = 5*fMagFieldSign;
880 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
881 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
882 double **tpcPositions;
883 tpcPositions = new double*[9];
885 tpcPositions[i] = new double[3];
886 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
889 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
890 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
891 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
893 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
894 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
895 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
899 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
903 for (int ik=0; ik<3; ik++) {
906 tFemtoTrack->SetKinkIndexes(indexes);
909 for (int ii=0; ii<6; ii++){
910 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
916 void AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0, AliFemtoV0 *tFemtoV0)
918 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
919 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
920 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
921 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
922 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
923 tFemtoV0->SetdecayVertexV0(decayvertex);
924 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
925 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
926 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
927 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
928 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
929 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
930 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
931 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
932 tFemtoV0->SetmomPos(mompos);
933 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
934 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
935 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
936 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
937 tFemtoV0->SetmomNeg(momneg);
939 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
940 //void SettpcHitsPos(const int& i);
941 //void SettpcHitsNeg(const int& i);
943 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
944 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
946 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
947 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
948 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
949 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
950 tFemtoV0->SetmomV0(momv0);
951 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
952 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
953 tFemtoV0->SeteLambda(tAODv0->ELambda());
954 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
955 tFemtoV0->SetePosProton(tAODv0->EPosProton());
956 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
957 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
958 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
959 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
960 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
961 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
963 //void SetcTauLambda( float x);
964 //void SetcTauK0Short( float x);
966 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
967 tFemtoV0->SetptV0(tAODv0->Pt());
968 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
969 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
970 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
971 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
972 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
974 tFemtoV0->SetidNeg(tAODv0->GetNegID());
975 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
976 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
977 tFemtoV0->SetidPos(tAODv0->GetPosID());
979 tFemtoV0->SetEtaV0(tAODv0->Eta());
980 tFemtoV0->SetPhiV0(tAODv0->Phi());
981 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
982 //tFemtoV0->SetYV0(tAODv0->Y());
984 //void SetdedxNeg(float x);
985 //void SeterrdedxNeg(float x);//Gael 04Fev2002
986 //void SetlendedxNeg(float x);//Gael 04Fev2002
987 //void SetdedxPos(float x);
988 //void SeterrdedxPos(float x);//Gael 04Fev2002
989 //void SetlendedxPos(float x);//Gael 04Fev2002
991 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
992 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
994 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
995 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
997 if(trackpos && trackneg)
999 tFemtoV0->SetEtaPos(trackpos->Eta());
1000 tFemtoV0->SetEtaNeg(trackneg->Eta());
1001 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1002 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1003 tFemtoV0->SetptPos(trackpos->Pt());
1004 tFemtoV0->SetptNeg(trackneg->Pt());
1006 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1007 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1008 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1009 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1010 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1011 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1012 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1013 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1014 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1015 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1016 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1017 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1019 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1020 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1021 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1022 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1023 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1024 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1027 float bfield = 5*fMagFieldSign;
1028 float globalPositionsAtRadiiPos[9][3];
1029 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1030 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1031 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1033 float globalPositionsAtRadiiNeg[9][3];
1034 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1035 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1036 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1038 AliFemtoThreeVector tmpVec;
1039 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetX(tpcEntrancePos[1]); tmpVec.SetX(tpcEntrancePos[2]);
1040 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1042 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetX(tpcExitPos[1]); tmpVec.SetX(tpcExitPos[2]);
1043 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1045 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetX(tpcEntranceNeg[1]); tmpVec.SetX(tpcEntranceNeg[2]);
1046 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1048 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetX(tpcExitNeg[1]); tmpVec.SetX(tpcExitNeg[2]);
1049 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1051 AliFemtoThreeVector vecTpcPos[9];
1052 AliFemtoThreeVector vecTpcNeg[9];
1053 for(int i=0;i<9;i++)
1055 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1056 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1058 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1059 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1061 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1062 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1064 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1065 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1067 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 )
1069 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 )
1071 tFemtoV0->SetPosNSigmaTOFK(-1000);
1072 tFemtoV0->SetNegNSigmaTOFK(-1000);
1073 tFemtoV0->SetPosNSigmaTOFP(-1000);
1074 tFemtoV0->SetNegNSigmaTOFP(-1000);
1075 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1076 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1078 tFemtoV0->SetTOFProtonTimePos(-1000);
1079 tFemtoV0->SetTOFPionTimePos(-1000);
1080 tFemtoV0->SetTOFKaonTimePos(-1000);
1081 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1082 tFemtoV0->SetTOFPionTimeNeg(-1000);
1083 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1088 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1089 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1090 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1091 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1092 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1093 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1095 double TOFSignalPos = trackpos->GetTOFsignal();
1096 double TOFSignalNeg = trackneg->GetTOFsignal();
1099 trackpos->GetIntegratedTimes(pidPos);
1100 trackneg->GetIntegratedTimes(pidNeg);
1102 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1103 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1104 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1105 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1106 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1107 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1112 tFemtoV0->SetStatusPos(999);
1113 tFemtoV0->SetStatusNeg(999);
1115 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1118 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1120 fFilterBit = (1 << (ibit));
1124 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1129 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1135 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1140 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1142 fEstEventMult = aType;
1145 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1147 if (aLabel < 0) return 0;
1148 AliAODMCParticle *aodP;
1150 if (aLabel > mcP->GetEntries())
1151 posstack = mcP->GetEntries();
1155 aodP = (AliAODMCParticle *) mcP->At(posstack);
1156 if (aodP->GetLabel() > posstack) {
1158 aodP = (AliAODMCParticle *) mcP->At(posstack);
1159 if (aodP->GetLabel() == aLabel) return aodP;
1162 while (posstack > 0);
1166 aodP = (AliAODMCParticle *) mcP->At(posstack);
1167 if (aodP->GetLabel() == aLabel) return aodP;
1170 while (posstack < mcP->GetEntries());
1176 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1177 AliFemtoTrack *tFemtoTrack)
1180 // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1183 double covimpact[3];
1185 if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1186 //cout << "sth went wrong with dca propagation" << endl;
1187 tFemtoTrack->SetImpactD(-1000.0);
1188 tFemtoTrack->SetImpactZ(-1000.0);
1192 tFemtoTrack->SetImpactD(impact[0]);
1193 tFemtoTrack->SetImpactZ(impact[1]);
1197 tAodTrack->GetPID(aodpid);
1198 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1199 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1200 tFemtoTrack->SetPidProbPion(aodpid[2]);
1201 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1202 tFemtoTrack->SetPidProbProton(aodpid[4]);
1204 aodpid[0] = -100000.0;
1205 aodpid[1] = -100000.0;
1206 aodpid[2] = -100000.0;
1207 aodpid[3] = -100000.0;
1208 aodpid[4] = -100000.0;
1212 //what is that code? for what do we need it? nsigma values are not enough?
1213 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1214 tTOF = tAodTrack->GetTOFsignal();
1215 tAodTrack->GetIntegratedTimes(aodpid);
1217 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1220 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1222 ////// TPC ////////////////////////////////////////////
1224 float nsigmaTPCK=-1000.;
1225 float nsigmaTPCPi=-1000.;
1226 float nsigmaTPCP=-1000.;
1228 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1230 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1231 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1232 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1233 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1236 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1237 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1238 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1240 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1241 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1242 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1244 tFemtoTrack->SetTPCsignalN(1);
1245 tFemtoTrack->SetTPCsignalS(1);
1246 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1248 ///////TOF//////////////////////
1251 float nsigmaTOFPi=-1000.;
1252 float nsigmaTOFK=-1000.;
1253 float nsigmaTOFP=-1000.;
1255 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1256 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1257 (tAodTrack->GetStatus() & AliESDtrack::kTIME) ) //AliESDtrack::kTIME=0x80000000
1259 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1262 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1263 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1264 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1266 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1267 Double_t tof=tAodTrack->GetTOFsignal();
1268 if(tof > 0.) vp=len/tof/0.03;
1271 tFemtoTrack->SetVTOF(vp);
1272 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1273 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1274 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1277 //////////////////////////////////////
1281 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1283 fCentRange[0] = min; fCentRange[1] = max;
1285 fEstEventMult = kCentrality;
1288 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1290 if(anocent==false) {fEstEventMult=kCentrality;}
1291 else {fEstEventMult=kReference; fUsePreCent = 0; }
1294 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1296 fAODpidUtil = aAODpidUtil;
1297 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1300 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1302 fAODheader = aAODheader;
1306 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1316 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1321 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1323 // Gets the global position of the track at nine different radii in the TPC
1324 // track is the track you want to propagate
1325 // bfield is the magnetic field of your event
1326 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1328 // Initialize the array to something indicating there was no propagation
1329 for(Int_t i=0;i<9;i++){
1330 for(Int_t j=0;j<3;j++){
1331 globalPositionsAtRadii[i][j]=-9999.;
1335 // Make a copy of the track to not change parameters of the track
1336 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1337 //printf("\nAfter CopyFromVTrack\n");
1340 // The global position of the the track
1341 Double_t xyz[3]={-9999.,-9999.,-9999.};
1343 // Counter for which radius we want
1345 // The radii at which we get the global positions
1346 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1347 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1348 // The global radius we are at
1349 Float_t globalRadius=0;
1351 // Propagation is done in local x of the track
1352 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1353 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1354 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1355 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1356 // adds to the global radius
1358 // Stop if the propagation was not succesful. This can happen for low pt tracks
1359 // that don't reach outer radii
1360 if(!etp.PropagateTo(x,bfield))break;
1361 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1362 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1364 // Roughly reached the radius we want
1365 if(globalRadius > Rwanted[iR]){
1367 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1368 while (globalRadius>Rwanted[iR]){
1370 // printf("propagating to x %5.2f\n",x);
1371 if(!etp.PropagateTo(x,bfield))break;
1372 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1373 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1375 //printf("At Radius:%05.2f (local x %5.2f). Setting position to x %4.1f y %4.1f z %4.1f\n",globalRadius,x,xyz[0],xyz[1],xyz[2]);
1376 globalPositionsAtRadii[iR][0]=xyz[0];
1377 globalPositionsAtRadii[iR][1]=xyz[1];
1378 globalPositionsAtRadii[iR][2]=xyz[2];
1379 // Indicate we want the next radius
1389 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)