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"
15 #include "AliAODEvent.h"
16 #include "AliAODTrack.h"
17 #include "AliAODVertex.h"
18 #include "AliAODMCHeader.h"
19 #include "AliESDtrack.h"
21 #include "AliFmPhysicalHelixD.h"
22 #include "AliFmThreeVectorF.h"
24 #include "SystemOfUnits.h"
26 #include "AliFemtoEvent.h"
27 #include "AliFemtoModelHiddenInfo.h"
28 #include "AliFemtoModelGlobalHiddenInfo.h"
31 #include "AliAODpidUtil.h"
32 #include "AliAnalysisUtils.h"
34 ClassImp(AliFemtoEventReaderAOD)
36 #if !(ST_NO_NAMESPACES)
37 using namespace units;
44 //____________________________
45 //constructor with 0 parameters , look at default settings
46 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD():
54 // fPWG2AODTracks(0x0),
58 fEstEventMult(kCentrality),
72 fDCAglobalTrack(kFALSE),
75 // default constructor
76 fAllTrue.ResetAllBits(kTRUE);
77 fAllFalse.ResetAllBits(kFALSE);
82 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(const AliFemtoEventReaderAOD &aReader) :
83 AliFemtoEventReader(),
91 // fPWG2AODTracks(0x0),
95 fEstEventMult(kCentrality),
108 fMinPlpContribSPD(0),
109 fDCAglobalTrack(kFALSE),
113 fReadMC = aReader.fReadMC;
114 fReadV0 = aReader.fReadV0;
115 fInputFile = aReader.fInputFile;
116 fNumberofEvent = aReader.fNumberofEvent;
117 fCurEvent = aReader.fCurEvent;
118 fEvent = new AliAODEvent();
119 fAodFile = new TFile(aReader.fAodFile->GetName());
120 fAllTrue.ResetAllBits(kTRUE);
121 fAllFalse.ResetAllBits(kFALSE);
122 fFilterBit = aReader.fFilterBit;
123 // fPWG2AODTracks = aReader.fPWG2AODTracks;
124 fAODpidUtil = aReader.fAODpidUtil;
125 fAODheader = aReader.fAODheader;
126 fCentRange[0] = aReader.fCentRange[0];
127 fCentRange[1] = aReader.fCentRange[1];
128 fEstEventMult = aReader.fEstEventMult;
129 fUsePreCent = aReader.fUsePreCent;
130 fpA2013 = aReader.fpA2013;
131 fisPileUp = aReader.fisPileUp;
132 fMVPlp = aReader.fMVPlp;
133 fMinVtxContr = aReader.fMinVtxContr;
134 fMinPlpContribMV = aReader.fMinPlpContribMV;
135 fMinPlpContribSPD = aReader.fMinPlpContribSPD;
136 fDCAglobalTrack = aReader.fDCAglobalTrack;
141 AliFemtoEventReaderAOD::~AliFemtoEventReaderAOD()
147 // if (fPWG2AODTracks) {
148 // fPWG2AODTracks->Delete();
149 // delete fPWG2AODTracks;
154 AliFemtoEventReaderAOD& AliFemtoEventReaderAOD::operator=(const AliFemtoEventReaderAOD& aReader)
156 // assignment operator
157 if (this == &aReader)
160 fInputFile = aReader.fInputFile;
161 fNumberofEvent = aReader.fNumberofEvent;
162 fCurEvent = aReader.fCurEvent;
163 if (fTree) delete fTree;
164 if (fEvent) delete fEvent;
165 fEvent = new AliAODEvent();
166 if (fAodFile) delete fAodFile;
167 fAodFile = new TFile(aReader.fAodFile->GetName());
168 fAllTrue.ResetAllBits(kTRUE);
169 fAllFalse.ResetAllBits(kFALSE);
170 fFilterBit = aReader.fFilterBit;
171 fFilterMask = aReader.fFilterMask;
172 // fPWG2AODTracks = aReader.fPWG2AODTracks;
173 fAODpidUtil = aReader.fAODpidUtil;
174 fAODheader = aReader.fAODheader;
175 fCentRange[0] = aReader.fCentRange[0];
176 fCentRange[1] = aReader.fCentRange[1];
177 fUsePreCent = aReader.fUsePreCent;
178 fEstEventMult = aReader.fEstEventMult;
179 fpA2013 = aReader.fpA2013;
180 fisPileUp = aReader.fisPileUp;
181 fMVPlp = aReader.fMVPlp;
182 fMinVtxContr = aReader.fMinVtxContr;
183 fMinPlpContribMV = aReader.fMinPlpContribMV;
184 fMinPlpContribSPD = aReader.fMinPlpContribSPD;
185 fDCAglobalTrack = aReader.fDCAglobalTrack;
186 fFlatCent= aReader.fFlatCent;
191 AliFemtoString AliFemtoEventReaderAOD::Report()
193 // create reader report
194 AliFemtoString temp = "\n This is the AliFemtoEventReaderAOD\n";
199 void AliFemtoEventReaderAOD::SetInputFile(const char* inputFile)
201 //setting the name of file where names of AOD file are written
202 //it takes only this files which have good trees
204 fInputFile=string(inputFile);
205 ifstream infile(inputFile);
207 fTree = new TChain("aodTree");
209 if(infile.good()==true)
211 //checking if all give files have good tree inside
212 while (infile.eof()==false)
214 infile.getline(buffer,256);
215 TFile *aodFile=TFile::Open(buffer,"READ");
218 TTree* tree = (TTree*) aodFile->Get("aodTree");
221 // cout<<"putting file "<<string(buffer)<<" into analysis"<<endl;
222 fTree->AddFile(buffer);
232 AliFemtoEvent* AliFemtoEventReaderAOD::ReturnHbtEvent()
234 // read in a next hbt event from the chain
235 // convert it to AliFemtoEvent and return
236 // for further analysis
237 AliFemtoEvent *hbtEvent = 0;
238 // cout<<"reader"<<endl;
239 if (fCurEvent==fNumberofEvent)//open next file
241 if(fNumberofEvent==0)
243 fEvent=new AliAODEvent();
244 fEvent->ReadFromTree(fTree);
246 // Check for the existence of the additional information
247 // fPWG2AODTracks = (TClonesArray *) fEvent->GetList()->FindObject("pwg2aodtracks");
249 // if (fPWG2AODTracks) {
250 // cout << "Found additional PWG2 specific information in the AOD!" << endl;
251 // cout << "Reading only tracks with the additional information" << endl;
254 fNumberofEvent=fTree->GetEntries();
255 // cout<<"Number of Entries in file "<<fNumberofEvent<<endl;
258 else //no more data to read
260 // cout<<"no more files "<<hbtEvent<<endl;
266 // cout<<"starting to read event "<<fCurEvent<<endl;
267 fTree->GetEvent(fCurEvent);//getting next event
268 // cout << "Read event " << fEvent << " from file " << fTree << endl;
270 hbtEvent = new AliFemtoEvent;
272 CopyAODtoFemtoEvent(hbtEvent);
279 void AliFemtoEventReaderAOD::CopyAODtoFemtoEvent(AliFemtoEvent *tEvent)
282 // A function that reads in the AOD event
283 // and transfers the neccessary information into
284 // the internal AliFemtoEvent
286 // setting global event characteristics
287 tEvent->SetRunNumber(fEvent->GetRunNumber());
288 tEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
289 tEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
290 tEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
291 tEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
292 tEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
293 tEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy(0));
294 tEvent->SetZDCParticipants(0);
295 tEvent->SetTriggerMask(fEvent->GetTriggerMask());
296 tEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
298 // Attempt to access MC header
302 mcH = (AliAODMCHeader *) fEvent->FindListObject(AliAODMCHeader::StdBranchName());
304 cout << "AOD MC information requested, but no header found!" << endl;
307 mcP = (TClonesArray *) fEvent->FindListObject(AliAODMCParticle::StdBranchName());
309 cout << "AOD MC information requested, but no particle array found!" << endl;
313 tEvent->SetReactionPlaneAngle(fEvent->GetHeader()->GetQTheta(0)/2.0);
317 motherids = new Int_t[((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel()];
318 for (int ip=0; ip<mcP->GetEntries(); ip++) motherids[ip] = 0;
320 // Read in mother ids
321 AliAODMCParticle *motherpart;
322 for (int ip=0; ip<mcP->GetEntries(); ip++) {
323 motherpart = (AliAODMCParticle *) mcP->At(ip);
324 if (motherpart->GetDaughter(0) > 0)
325 motherids[motherpart->GetDaughter(0)] = ip;
326 if (motherpart->GetDaughter(1) > 0)
327 motherids[motherpart->GetDaughter(1)] = ip;
332 if(fisPileUp||fpA2013)
334 AliAnalysisUtils *anaUtil=new AliAnalysisUtils();
336 anaUtil->SetMinVtxContr(fMinVtxContr);
338 if(anaUtil->IsVertexSelected2013pA(fEvent)==kFALSE) return; //Vertex rejection for pA analysis.
339 if(fMVPlp) anaUtil->SetUseMVPlpSelection(kTRUE);
340 else anaUtil->SetUseMVPlpSelection(kFALSE);
341 if(fMinPlpContribMV) anaUtil->SetMinPlpContribMV(fMinPlpContribMV);
342 if(fMinPlpContribSPD) anaUtil->SetMinPlpContribSPD(fMinPlpContribSPD);
344 if(anaUtil->IsPileUpEvent(fEvent)) return; //Pile-up rejection.
348 // Primary Vertex position
349 const AliAODVertex* aodvertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
350 if(!aodvertex || aodvertex->GetNContributors() < 1) return; //Bad vertex, skip event.
352 aodvertex->GetPosition(fV1);
353 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
354 tEvent->SetPrimVertPos(vertex);
356 //starting to reading tracks
357 int nofTracks=0; //number of reconstructed tracks in event
359 nofTracks=fEvent->GetNumberOfTracks();
361 AliEventplane *ep = fEvent->GetEventplane();
365 tEvent->SetReactionPlaneAngle(ep->GetEventplane("V0",fEvent,2));
367 tEvent->SetReactionPlaneAngle(ep->GetEventplane("Q"));
370 AliCentrality *cent = fEvent->GetCentrality();
372 if (!fEstEventMult && cent && fUsePreCent) {
373 if ((cent->GetCentralityPercentile("V0M")*10 < fCentRange[0]) ||
374 (cent->GetCentralityPercentile("V0M")*10 > fCentRange[1]))
376 // cout << "Centrality " << cent->GetCentralityPercentile("V0M") << " outside of preselection range " << fCentRange[0] << " - " << fCentRange[1] << endl;
382 float percent = cent->GetCentralityPercentile("V0M");
383 //flatten centrality dist.
386 if(RejectEventCentFlat(fEvent->GetMagneticField(),percent)) return;
390 int realnofTracks=0; // number of track which we use in a analysis
394 for (int il=0; il<20000; il++) labels[il] = -1;
396 // looking for global tracks and saving their numbers to copy from them PID information to TPC-only tracks in the main loop over tracks
397 for (int i=0;i<nofTracks;i++) {
398 const AliAODTrack *aodtrack=fEvent->GetTrack(i);
399 if (!aodtrack->TestFilterBit(fFilterBit)) {
400 if(aodtrack->GetID() < 0) continue;
401 labels[aodtrack->GetID()] = i;
406 for (int i=0;i<nofTracks;i++)
408 AliFemtoTrack* trackCopy = new AliFemtoTrack();
410 // if (fPWG2AODTracks) {
411 // // Read tracks from the additional pwg2 specific AOD part
413 // // Note that in that case all the AOD tracks without the
414 // // additional information will be ignored !
415 // AliPWG2AODTrack *pwg2aodtrack = (AliPWG2AODTrack *) fPWG2AODTracks->At(i);
417 // // Getting the AOD track through the ref of the additional info
418 // AliAODTrack *aodtrack = pwg2aodtrack->GetRefAODTrack();
419 // if (!aodtrack->TestFilterBit(fFilterBit)) {
425 // if (aodtrack->IsOn(AliESDtrack::kTPCrefit))
426 // if (aodtrack->Chi2perNDF() < 6.0)
427 // if (aodtrack->Eta() < 0.9)
431 // CopyAODtoFemtoTrack(aodtrack, trackCopy, pwg2aodtrack);
434 // // Fill the hidden information with the simulated data
435 // // Int_t pLabel = aodtrack->GetLabel();
436 // AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
438 // // Check the mother information
440 // // Using the new way of storing the freeze-out information
441 // // Final state particle is stored twice on the stack
442 // // one copy (mother) is stored with original freeze-out information
443 // // and is not tracked
444 // // the other one (daughter) is stored with primary vertex position
447 // // Freeze-out coordinates
448 // double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
449 // fpx = tPart->Xv() - fV1[0];
450 // fpy = tPart->Yv() - fV1[1];
451 // fpz = tPart->Zv() - fV1[2];
454 // AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
455 // tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
462 // // cout << "Looking for mother ids " << endl;
463 // if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
464 // // cout << "Got mother id" << endl;
465 // AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
466 // // Check if this is the same particle stored twice on the stack
467 // if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
468 // // It is the same particle
469 // // Read in the original freeze-out information
470 // // and convert it from to [fm]
473 // // fpx = mother->Xv()*1e13*0.197327;
474 // // fpy = mother->Yv()*1e13*0.197327;
475 // // fpz = mother->Zv()*1e13*0.197327;
476 // // fpt = mother->T() *1e13*0.197327*0.5;
479 // // Therminator style
480 // fpx = mother->Xv()*1e13;
481 // fpy = mother->Yv()*1e13;
482 // fpz = mother->Zv()*1e13;
483 // fpt = mother->T() *1e13*3e10;
488 // // if (fRotateToEventPlane) {
489 // // double tPhi = TMath::ATan2(fpy, fpx);
490 // // double tRad = TMath::Hypot(fpx, fpy);
492 // // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
493 // // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
496 // tInfo->SetPDGPid(tPart->GetPdgCode());
498 // // if (fRotateToEventPlane) {
499 // // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
500 // // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
502 // // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
503 // // tRad*TMath::Sin(tPhi - tReactionPlane),
507 // tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
508 // Double_t mass2 = (tPart->E() *tPart->E() -
509 // tPart->Px()*tPart->Px() -
510 // tPart->Py()*tPart->Py() -
511 // tPart->Pz()*tPart->Pz());
513 // tInfo->SetMass(TMath::Sqrt(mass2));
515 // tInfo->SetMass(0.0);
517 // tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
518 // trackCopy->SetHiddenInfo(tInfo);
523 // aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
524 // const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
525 // // Check the sanity of the tracks - reject zero momentum tracks
526 // if (ktP.Mag() == 0) {
532 // No additional information exists
533 // Read in the normal AliAODTracks
535 // const AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
536 AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
540 if (aodtrack->IsPrimaryCandidate()) tracksPrim++;
542 if (fFilterBit && !aodtrack->TestFilterBit(fFilterBit)) {
547 if (fFilterMask && !aodtrack->TestFilterBit(fFilterMask)) {
552 // cout << "Muon? " << aodtrack->IsMuonTrack() << endl;
553 // cout << "Type? " << aodtrack->GetType() << endl;
555 // if (aodtrack->IsMuonTrack()) {
556 // cout << "muon" << endl;
561 //counting particles to set multiplicity
562 if(fEstEventMult==kGlobalCount){
563 AliAODTrack* trk_clone = (AliAODTrack*)aodtrack->Clone("trk_clone"); //no DCA cut for global count
564 //if (aodtrack->IsPrimaryCandidate()) //? instead of kinks?
565 if (aodtrack->Chi2perNDF() < 4.0)
566 if (aodtrack->Pt() > 0.15 && aodtrack->Pt() < 20)
567 if (aodtrack->GetTPCNcls() > 70)
568 if (aodtrack->Eta() < 0.8)
573 CopyAODtoFemtoTrack(aodtrack, trackCopy);
575 // copying PID information from the correspondent track
576 // const AliAODTrack *aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
579 AliAODTrack *aodtrackpid;
580 if((fFilterBit == (1 << (7))) || fFilterMask == 128) {//for TPC Only tracks we have to copy PID information from corresponding global tracks
581 aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
584 aodtrackpid = fEvent->GetTrack(i);
587 CopyPIDtoFemtoTrack(aodtrackpid, trackCopy);
590 // Fill the hidden information with the simulated data
591 // Int_t pLabel = aodtrack->GetLabel();
592 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
594 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
595 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
600 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
602 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
603 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
607 // Check the mother information
609 // Using the new way of storing the freeze-out information
610 // Final state particle is stored twice on the stack
611 // one copy (mother) is stored with original freeze-out information
612 // and is not tracked
613 // the other one (daughter) is stored with primary vertex position
616 // Freeze-out coordinates
617 fpx = tPart->Xv() - fV1[0];
618 fpy = tPart->Yv() - fV1[1];
619 fpz = tPart->Zv() - fV1[2];
622 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
630 // cout << "Looking for mother ids " << endl;
631 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
632 // cout << "Got mother id" << endl;
633 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
634 // Check if this is the same particle stored twice on the stack
636 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
637 // It is the same particle
638 // Read in the original freeze-out information
639 // and convert it from to [fm]
642 // fpx = mother->Xv()*1e13*0.197327;
643 // fpy = mother->Yv()*1e13*0.197327;
644 // fpz = mother->Zv()*1e13*0.197327;
645 // fpt = mother->T() *1e13*0.197327*0.5;
649 fpx = mother->Xv()*1e13;
650 fpy = mother->Yv()*1e13;
651 fpz = mother->Zv()*1e13;
652 // fpt = mother->T() *1e13*3e10;
658 // if (fRotateToEventPlane) {
659 // double tPhi = TMath::ATan2(fpy, fpx);
660 // double tRad = TMath::Hypot(fpx, fpy);
662 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
663 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
666 tInfo->SetPDGPid(tPart->GetPdgCode());
668 // if (fRotateToEventPlane) {
669 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
670 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
672 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
673 // tRad*TMath::Sin(tPhi - tReactionPlane),
677 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
678 Double_t mass2 = (tPart->E() *tPart->E() -
679 tPart->Px()*tPart->Px() -
680 tPart->Py()*tPart->Py() -
681 tPart->Pz()*tPart->Pz());
683 tInfo->SetMass(TMath::Sqrt(mass2));
687 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
690 // //if (TMath::Abs(impact[0]) > 0.001) {
691 // if (tPart->IsPhysicalPrimary()){
692 // tInfo->SetPartOrigin(0);
693 // // trackCopy->SetImpactDprim(impact[0]);
694 // //cout << "Read prim" << endl;
696 // else if (tPart->IsSecondaryFromWeakDecay()) {
697 // tInfo->SetPartOrigin(1);
698 // // trackCopy->SetImpactDweak(impact[0]);
699 // //cout << "Read wea" << endl;
701 // else if (tPart->IsSecondaryFromMaterial()) {
702 // tInfo->SetPartOrigin(2);
703 // // trackCopy->SetImpactDmat(impact[0]);
704 // //cout << "Read mat" << endl;
711 trackCopy->SetHiddenInfo(tInfo);
716 //AliExternalTrackParam *param = new AliExternalTrackParam(*aodtrack->GetInnerParam());
717 trackCopy->SetInnerMomentum(aodtrack->GetTPCmomentum());
719 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
720 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
721 // Check the sanity of the tracks - reject zero momentum tracks
722 if (ktP.Mag() == 0) {
728 tEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
729 realnofTracks++;//real number of tracks
732 tEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
733 tEvent->SetNormalizedMult(tracksPrim);
736 tEvent->SetCentralityV0(cent->GetCentralityPercentile("V0M"));
737 tEvent->SetCentralityV0A(cent->GetCentralityPercentile("V0A"));
738 tEvent->SetCentralityV0C(cent->GetCentralityPercentile("V0C"));
739 tEvent->SetCentralityZNA(cent->GetCentralityPercentile("ZNA"));
740 tEvent->SetCentralityZNC(cent->GetCentralityPercentile("ZNC"));
741 tEvent->SetCentralityCL1(cent->GetCentralityPercentile("CL1"));
742 tEvent->SetCentralityCL0(cent->GetCentralityPercentile("CL0"));
743 tEvent->SetCentralityTKL(cent->GetCentralityPercentile("TKL"));
744 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("FMD"));
745 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("NPA"));
746 // tEvent->SetCentralitySPD1(cent->GetCentralityPercentile("CL1"));
747 tEvent->SetCentralityTrk(cent->GetCentralityPercentile("TRK"));
748 tEvent->SetCentralityCND(cent->GetCentralityPercentile("CND"));
751 if (fEstEventMult==kCentrality) {
752 //AliCentrality *cent = fEvent->GetCentrality();
753 //cout<<"AliFemtoEventReaderAOD:"<<lrint(10*cent->GetCentralityPercentile("V0M"))<<endl;
754 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0M")));
755 // if (cent) tEvent->SetNormalizedMult((int) cent->GetCentralityPercentile("V0M"));
757 else if (fEstEventMult==kCentralityV0A) {
758 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0A")));
760 else if (fEstEventMult==kCentralityV0C) {
761 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0C")));
763 else if (fEstEventMult==kCentralityZNA) {
764 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNA")));
766 else if (fEstEventMult==kCentralityZNC) {
767 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNC")));
769 else if (fEstEventMult==kCentralityCL1) {
770 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL1")));
772 else if (fEstEventMult==kCentralityCL0) {
773 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL0")));
775 else if (fEstEventMult==kCentralityTRK) {
776 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TRK")));
778 else if (fEstEventMult==kCentralityTKL) {
779 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TKL")));
781 else if (fEstEventMult==kCentralityCND) {
782 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CND")));
784 else if (fEstEventMult==kCentralityNPA) {
785 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("NPA")));
787 else if (fEstEventMult==kCentralityFMD) {
788 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("FMD")));
790 else if(fEstEventMult==kGlobalCount){
791 tEvent->SetNormalizedMult(tNormMult); //particles counted in the loop, trying to reproduce GetReferenceMultiplicity. If better (default) method appears it should be changed
793 else if(fEstEventMult==kReference)
795 tEvent->SetNormalizedMult(fAODheader->GetRefMultiplicity());
797 else if(fEstEventMult==kTPCOnlyRef)
799 tEvent->SetNormalizedMult(fAODheader->GetTPConlyRefMultiplicity());
801 else if(fEstEventMult == kVZERO)
804 for (Int_t i=0; i<64; i++)
805 multV0 += fEvent->GetVZEROData()->GetMultiplicity(i);
806 tEvent->SetNormalizedMult(multV0);
809 if (mcP) delete [] motherids;
811 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
816 for (Int_t i = 0; i < fEvent->GetNumberOfV0s(); i++) {
817 AliAODv0* aodv0 = fEvent->GetV0(i);
818 if (!aodv0) continue;
819 if(aodv0->GetNDaughters()>2) continue;
820 if(aodv0->GetNProngs()>2) continue;
821 if(aodv0->GetCharge()!=0) continue;
822 if(aodv0->ChargeProng(0)==aodv0->ChargeProng(1)) continue;
823 if(aodv0->CosPointingAngle(fV1)<0.998) continue;
824 AliFemtoV0* trackCopyV0 = new AliFemtoV0();
826 CopyAODtoFemtoV0(aodv0, trackCopyV0);
827 tEvent->V0Collection()->push_back(trackCopyV0);
828 //cout<<"Pushback v0 to v0collection"<<endl;
834 void AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack,
835 AliFemtoTrack *tFemtoTrack
836 // AliPWG2AODTrack *tPWG2AODTrack
839 // Copy the track information from the AOD into the internal AliFemtoTrack
840 // If it exists, use the additional information from the PWG2 AOD
842 // Primary Vertex position
844 fEvent->GetPrimaryVertex()->GetPosition(fV1);
845 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
847 tFemtoTrack->SetCharge(tAodTrack->Charge());
850 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
852 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
853 tFemtoTrack->SetP(v);//setting momentum
854 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
855 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
856 //setting track helix
857 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
858 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
859 tFemtoTrack->SetHelix(helix);
862 tFemtoTrack->SetTrackId(tAodTrack->GetID());
863 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
864 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
866 // Track quality information
868 tAodTrack->GetCovMatrix(covmat);
870 if (!fDCAglobalTrack) {
872 tFemtoTrack->SetImpactD(tAodTrack->DCA());
873 tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
877 // double covimpact[3];
879 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
880 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
881 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
882 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
883 // //cout << "sth went wrong with dca propagation" << endl;
884 // tFemtoTrack->SetImpactD(-1000.0);
885 // tFemtoTrack->SetImpactZ(-1000.0);
889 // tFemtoTrack->SetImpactD(impact[0]);
890 // tFemtoTrack->SetImpactZ(impact[1]);
896 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
897 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
899 // tFemtoTrack->SetImpactD(0.0);
900 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
902 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
905 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
906 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
910 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
911 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
912 // << tAodTrack->Yv() - fV1[1]
913 // << "xv = " << tAodTrack->Xv() << endl
914 // << "fv1[0] = " << fV1[0] << endl
915 // << "yv = " << tAodTrack->Yv() << endl
916 // << "fv1[1] = " << fV1[1] << endl
917 // << "zv = " << tAodTrack->Zv() << endl
918 // << "fv1[2] = " << fV1[2] << endl
919 // << "impact[0] = " << impact[0] << endl
920 // << "impact[1] = " << impact[1] << endl
923 tFemtoTrack->SetCdd(covmat[0]);
924 tFemtoTrack->SetCdz(covmat[1]);
925 tFemtoTrack->SetCzz(covmat[2]);
926 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
927 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
928 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
929 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
930 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
931 tFemtoTrack->SetTPCsignalN(1);
932 tFemtoTrack->SetTPCsignalS(1);
933 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
935 // if (tPWG2AODTrack) {
936 // // Copy the PWG2 specific information if it exists
937 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
938 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
940 // double xtpc[3] = {0,0,0};
941 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
942 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
943 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
944 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
947 // If not use dummy values
948 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
949 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
951 float globalPositionsAtRadii[9][3];
952 float bfield = 5*fMagFieldSign;
954 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
955 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
956 double **tpcPositions;
957 tpcPositions = new double*[9];
959 tpcPositions[i] = new double[3];
960 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
963 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
964 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
965 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
968 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
969 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
970 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
972 delete [] tpcPositions[i];
973 delete [] tpcPositions;
976 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
980 for (int ik=0; ik<3; ik++) {
983 tFemtoTrack->SetKinkIndexes(indexes);
986 for (int ii=0; ii<6; ii++){
987 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
993 void AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0, AliFemtoV0 *tFemtoV0)
995 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
996 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
997 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
998 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
999 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
1000 tFemtoV0->SetdecayVertexV0(decayvertex);
1001 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
1002 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
1003 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
1004 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
1005 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
1006 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
1007 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
1008 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
1009 tFemtoV0->SetmomPos(mompos);
1010 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
1011 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
1012 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
1013 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
1014 tFemtoV0->SetmomNeg(momneg);
1016 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
1017 //void SettpcHitsPos(const int& i);
1018 //void SettpcHitsNeg(const int& i);
1020 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
1021 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
1023 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
1024 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
1025 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
1026 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
1027 tFemtoV0->SetmomV0(momv0);
1028 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
1029 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
1030 tFemtoV0->SeteLambda(tAODv0->ELambda());
1031 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
1032 tFemtoV0->SetePosProton(tAODv0->EPosProton());
1033 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
1034 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
1035 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
1036 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
1037 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
1038 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
1040 //void SetcTauLambda( float x);
1041 //void SetcTauK0Short( float x);
1043 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
1044 tFemtoV0->SetptV0(tAODv0->Pt());
1045 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
1046 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
1047 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
1048 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
1049 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
1051 tFemtoV0->SetidNeg(tAODv0->GetNegID());
1052 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
1053 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
1054 tFemtoV0->SetidPos(tAODv0->GetPosID());
1056 tFemtoV0->SetEtaV0(tAODv0->Eta());
1057 tFemtoV0->SetPhiV0(tAODv0->Phi());
1058 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
1059 //tFemtoV0->SetYV0(tAODv0->Y());
1061 //void SetdedxNeg(float x);
1062 //void SeterrdedxNeg(float x);//Gael 04Fev2002
1063 //void SetlendedxNeg(float x);//Gael 04Fev2002
1064 //void SetdedxPos(float x);
1065 //void SeterrdedxPos(float x);//Gael 04Fev2002
1066 //void SetlendedxPos(float x);//Gael 04Fev2002
1068 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
1069 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
1071 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
1072 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
1074 if(trackpos && trackneg)
1076 tFemtoV0->SetEtaPos(trackpos->Eta());
1077 tFemtoV0->SetEtaNeg(trackneg->Eta());
1078 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1079 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1080 tFemtoV0->SetptPos(trackpos->Pt());
1081 tFemtoV0->SetptNeg(trackneg->Pt());
1083 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1084 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1085 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1086 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1087 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1088 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1089 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1090 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1091 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1092 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1093 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1094 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1096 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1097 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1098 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1099 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1100 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1101 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1104 float bfield = 5*fMagFieldSign;
1105 float globalPositionsAtRadiiPos[9][3];
1106 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1107 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1108 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1110 float globalPositionsAtRadiiNeg[9][3];
1111 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1112 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1113 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1115 AliFemtoThreeVector tmpVec;
1116 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetY(tpcEntrancePos[1]); tmpVec.SetZ(tpcEntrancePos[2]);
1117 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1119 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetY(tpcExitPos[1]); tmpVec.SetZ(tpcExitPos[2]);
1120 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1122 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetY(tpcEntranceNeg[1]); tmpVec.SetZ(tpcEntranceNeg[2]);
1123 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1125 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetY(tpcExitNeg[1]); tmpVec.SetZ(tpcExitNeg[2]);
1126 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1128 AliFemtoThreeVector vecTpcPos[9];
1129 AliFemtoThreeVector vecTpcNeg[9];
1130 for(int i=0;i<9;i++)
1132 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1133 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1135 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1136 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1138 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1139 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1141 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1142 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1144 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 )
1146 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 )
1148 tFemtoV0->SetPosNSigmaTOFK(-1000);
1149 tFemtoV0->SetNegNSigmaTOFK(-1000);
1150 tFemtoV0->SetPosNSigmaTOFP(-1000);
1151 tFemtoV0->SetNegNSigmaTOFP(-1000);
1152 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1153 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1155 tFemtoV0->SetTOFProtonTimePos(-1000);
1156 tFemtoV0->SetTOFPionTimePos(-1000);
1157 tFemtoV0->SetTOFKaonTimePos(-1000);
1158 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1159 tFemtoV0->SetTOFPionTimeNeg(-1000);
1160 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1165 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1166 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1167 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1168 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1169 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1170 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1172 double TOFSignalPos = trackpos->GetTOFsignal();
1173 double TOFSignalNeg = trackneg->GetTOFsignal();
1176 trackpos->GetIntegratedTimes(pidPos);
1177 trackneg->GetIntegratedTimes(pidNeg);
1179 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1180 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1181 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1182 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1183 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1184 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1189 tFemtoV0->SetStatusPos(999);
1190 tFemtoV0->SetStatusNeg(999);
1192 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1195 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1197 fFilterBit = (1 << (ibit));
1201 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1206 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1212 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1217 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1219 fEstEventMult = aType;
1222 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1224 if (aLabel < 0) return 0;
1225 AliAODMCParticle *aodP;
1227 if (aLabel > mcP->GetEntries())
1228 posstack = mcP->GetEntries();
1232 aodP = (AliAODMCParticle *) mcP->At(posstack);
1233 if (aodP->GetLabel() > posstack) {
1235 aodP = (AliAODMCParticle *) mcP->At(posstack);
1236 if (aodP->GetLabel() == aLabel) return aodP;
1239 while (posstack > 0);
1243 aodP = (AliAODMCParticle *) mcP->At(posstack);
1244 if (aodP->GetLabel() == aLabel) return aodP;
1247 while (posstack < mcP->GetEntries());
1253 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1254 AliFemtoTrack *tFemtoTrack)
1257 if (fDCAglobalTrack) {
1259 // code from Michael and Prabhat from AliAnalysisTaskDptDptCorrelations
1260 const AliAODVertex* vertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
1261 float vertexX = -999.;
1262 float vertexY = -999.;
1263 float vertexZ = -999.;
1267 vertex->GetCovarianceMatrix(fCov);
1268 if(vertex->GetNContributors() > 0) {
1270 vertexX = vertex->GetX();
1271 vertexY = vertex->GetY();
1272 vertexZ = vertex->GetZ();
1279 tAodTrack->GetXYZ(pos);
1281 Double_t DCAX = pos[0] - vertexX;
1282 Double_t DCAY = pos[1] - vertexY;
1283 Double_t DCAZ = pos[2] - vertexZ;
1285 Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1287 tFemtoTrack->SetImpactD(DCAXY);
1288 tFemtoTrack->SetImpactZ(DCAZ);
1291 // // // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1293 // double impact[2];
1294 // double covimpact[3];
1296 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
1297 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
1298 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1299 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1301 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1302 // //cout << "sth went wrong with dca propagation" << endl;
1303 // tFemtoTrack->SetImpactD(-1000.0);
1304 // tFemtoTrack->SetImpactZ(-1000.0);
1308 // tFemtoTrack->SetImpactD(impact[0]);
1309 // tFemtoTrack->SetImpactZ(impact[1]);
1311 // delete trk_clone;
1315 tAodTrack->GetPID(aodpid);
1316 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1317 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1318 tFemtoTrack->SetPidProbPion(aodpid[2]);
1319 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1320 tFemtoTrack->SetPidProbProton(aodpid[4]);
1322 aodpid[0] = -100000.0;
1323 aodpid[1] = -100000.0;
1324 aodpid[2] = -100000.0;
1325 aodpid[3] = -100000.0;
1326 aodpid[4] = -100000.0;
1329 Float_t probMis = 1.0;
1331 //what is that code? for what do we need it? nsigma values are not enough?
1332 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1333 tTOF = tAodTrack->GetTOFsignal();
1334 tAodTrack->GetIntegratedTimes(aodpid);
1336 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1338 probMis = fAODpidUtil->GetTOFMismatchProbability(tAodTrack);
1343 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1345 ////// TPC ////////////////////////////////////////////
1347 float nsigmaTPCK=-1000.;
1348 float nsigmaTPCPi=-1000.;
1349 float nsigmaTPCP=-1000.;
1350 float nsigmaTPCE=-1000.;
1352 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1354 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1355 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1356 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1357 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1358 nsigmaTPCE = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kElectron);
1361 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1362 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1363 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1364 tFemtoTrack->SetNSigmaTPCE(nsigmaTPCE);
1366 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1367 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1368 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1370 tFemtoTrack->SetTPCsignalN(1);
1371 tFemtoTrack->SetTPCsignalS(1);
1372 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1374 ///////TOF//////////////////////
1377 float nsigmaTOFPi=-1000.;
1378 float nsigmaTOFK=-1000.;
1379 float nsigmaTOFP=-1000.;
1380 float nsigmaTOFE=-1000.;
1382 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1383 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1384 (tAodTrack->GetStatus() & AliESDtrack::kTIME) //AliESDtrack::kTIME=0x80000000
1385 && probMis < 0.01) // TOF mismatch probaility
1387 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1390 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1391 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1392 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1393 nsigmaTOFE = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kElectron);
1395 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1396 Double_t tof=tAodTrack->GetTOFsignal();
1397 if(tof > 0.) vp=len/tof/0.03;
1400 tFemtoTrack->SetVTOF(vp);
1401 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1402 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1403 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1404 tFemtoTrack->SetNSigmaTOFE(nsigmaTOFE);
1407 //////////////////////////////////////
1411 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1413 fCentRange[0] = min; fCentRange[1] = max;
1415 fEstEventMult = kCentrality;
1418 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1420 if(anocent==false) {fEstEventMult=kCentrality;}
1421 else {fEstEventMult=kReference; fUsePreCent = 0; }
1424 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1426 fAODpidUtil = aAODpidUtil;
1427 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1430 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1432 fAODheader = aAODheader;
1436 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1446 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1451 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1453 // Gets the global position of the track at nine different radii in the TPC
1454 // track is the track you want to propagate
1455 // bfield is the magnetic field of your event
1456 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1458 // Initialize the array to something indicating there was no propagation
1459 for(Int_t i=0;i<9;i++){
1460 for(Int_t j=0;j<3;j++){
1461 globalPositionsAtRadii[i][j]=-9999.;
1465 // Make a copy of the track to not change parameters of the track
1466 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1467 //printf("\nAfter CopyFromVTrack\n");
1470 // The global position of the the track
1471 Double_t xyz[3]={-9999.,-9999.,-9999.};
1473 // Counter for which radius we want
1475 // The radii at which we get the global positions
1476 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1477 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1478 // The global radius we are at
1479 Float_t globalRadius=0;
1481 // Propagation is done in local x of the track
1482 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1483 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1484 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1485 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1486 // adds to the global radius
1488 // Stop if the propagation was not succesful. This can happen for low pt tracks
1489 // that don't reach outer radii
1490 if(!etp.PropagateTo(x,bfield))break;
1491 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1492 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1494 // Roughly reached the radius we want
1495 if(globalRadius > Rwanted[iR]){
1497 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1498 while (globalRadius>Rwanted[iR]){
1500 // printf("propagating to x %5.2f\n",x);
1501 if(!etp.PropagateTo(x,bfield))break;
1502 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1503 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1505 //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]);
1506 globalPositionsAtRadii[iR][0]=xyz[0];
1507 globalPositionsAtRadii[iR][1]=xyz[1];
1508 globalPositionsAtRadii[iR][2]=xyz[2];
1509 // Indicate we want the next radius
1519 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)
1524 void AliFemtoEventReaderAOD::SetUseMVPlpSelection(Bool_t mvplp)
1529 void AliFemtoEventReaderAOD::SetIsPileUpEvent(Bool_t ispileup)
1531 fisPileUp = ispileup;
1536 void AliFemtoEventReaderAOD::SetDCAglobalTrack(Bool_t dcagt)
1538 fDCAglobalTrack = dcagt;
1542 bool AliFemtoEventReaderAOD::RejectEventCentFlat(float MagField, float CentPercent)
1543 { // to flatten centrality distribution
1544 bool RejectEvent = kFALSE;
1546 TRandom3* fRandomNumber = new TRandom3(); //for 3D, random sign switching
1547 fRandomNumber->SetSeed(0);
1549 if(MagField > 0) weightBinSign = 0;
1550 else weightBinSign = 1;
1551 float kCentWeight[2][9] = {{.878,.876,.860,.859,.859,.88,.873,.879,.894},
1552 {.828,.793,.776,.772,.775,.796,.788,.804,.839}};
1553 int weightBinCent = (int) CentPercent;
1554 if(fRandomNumber->Rndm() > kCentWeight[weightBinSign][weightBinCent]) RejectEvent = kTRUE;
1559 void AliFemtoEventReaderAOD::SetCentralityFlattening(Bool_t dcagt)