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 hbtEvent = CopyAODtoFemtoEvent();
279 AliFemtoEvent* AliFemtoEventReaderAOD::CopyAODtoFemtoEvent()
282 // A function that reads in the AOD event
283 // and transfers the neccessary information into
284 // the internal AliFemtoEvent
286 AliFemtoEvent *tEvent = new AliFemtoEvent();
288 // setting global event characteristics
289 tEvent->SetRunNumber(fEvent->GetRunNumber());
290 tEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
291 tEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
292 tEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
293 tEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
294 tEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
295 tEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy(0));
296 tEvent->SetZDCParticipants(0);
297 tEvent->SetTriggerMask(fEvent->GetTriggerMask());
298 tEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
300 // Attempt to access MC header
304 mcH = (AliAODMCHeader *) fEvent->FindListObject(AliAODMCHeader::StdBranchName());
306 cout << "AOD MC information requested, but no header found!" << endl;
309 mcP = (TClonesArray *) fEvent->FindListObject(AliAODMCParticle::StdBranchName());
311 cout << "AOD MC information requested, but no particle array found!" << endl;
315 tEvent->SetReactionPlaneAngle(fEvent->GetHeader()->GetQTheta(0)/2.0);
319 const int motherTabSize = ((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel();
320 motherids = new int[motherTabSize+1];
321 for (int ip=0; ip<motherTabSize+1; ip++) motherids[ip] = 0;
323 // Read in mother ids
324 AliAODMCParticle *motherpart;
325 for (int ip=0; ip<mcP->GetEntries(); ip++) {
326 motherpart = (AliAODMCParticle *) mcP->At(ip);
327 if (motherpart->GetDaughter(0) > 0)
328 motherids[motherpart->GetDaughter(0)] = ip;
329 if (motherpart->GetDaughter(1) > 0)
330 motherids[motherpart->GetDaughter(1)] = ip;
335 if(fisPileUp||fpA2013)
337 AliAnalysisUtils *anaUtil=new AliAnalysisUtils();
339 anaUtil->SetMinVtxContr(fMinVtxContr);
341 if(anaUtil->IsVertexSelected2013pA(fEvent)==kFALSE)
344 return NULL; //Vertex rejection for pA analysis.
346 if(fMVPlp) anaUtil->SetUseMVPlpSelection(kTRUE);
347 else anaUtil->SetUseMVPlpSelection(kFALSE);
348 if(fMinPlpContribMV) anaUtil->SetMinPlpContribMV(fMinPlpContribMV);
349 if(fMinPlpContribSPD) anaUtil->SetMinPlpContribSPD(fMinPlpContribSPD);
351 if(anaUtil->IsPileUpEvent(fEvent)) { delete tEvent;return NULL;} //Pile-up rejection.
355 // Primary Vertex position
356 const AliAODVertex* aodvertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
357 if(!aodvertex || aodvertex->GetNContributors() < 1) { delete tEvent;return NULL;} //Bad vertex, skip event.
359 aodvertex->GetPosition(fV1);
360 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
361 tEvent->SetPrimVertPos(vertex);
363 //starting to reading tracks
364 int nofTracks=0; //number of reconstructed tracks in event
366 nofTracks=fEvent->GetNumberOfTracks();
368 AliEventplane *ep = fEvent->GetEventplane();
372 tEvent->SetReactionPlaneAngle(ep->GetEventplane("V0",fEvent,2));
374 tEvent->SetReactionPlaneAngle(ep->GetEventplane("Q"));
377 AliCentrality *cent = fEvent->GetCentrality();
379 if (!fEstEventMult && cent && fUsePreCent) {
380 if ((cent->GetCentralityPercentile("V0M")*10 < fCentRange[0]) ||
381 (cent->GetCentralityPercentile("V0M")*10 > fCentRange[1]))
383 // cout << "Centrality " << cent->GetCentralityPercentile("V0M") << " outside of preselection range " << fCentRange[0] << " - " << fCentRange[1] << endl;
389 float percent = cent->GetCentralityPercentile("V0M");
390 //flatten centrality dist.
393 if(RejectEventCentFlat(fEvent->GetMagneticField(),percent)) { delete tEvent; return NULL;}
397 int realnofTracks=0; // number of track which we use in a analysis
401 for (int il=0; il<20000; il++) labels[il] = -1;
403 // looking for global tracks and saving their numbers to copy from them PID information to TPC-only tracks in the main loop over tracks
404 for (int i=0;i<nofTracks;i++) {
405 const AliAODTrack *aodtrack=fEvent->GetTrack(i);
406 if (!aodtrack->TestFilterBit(fFilterBit)) {
407 if(aodtrack->GetID() < 0) continue;
408 labels[aodtrack->GetID()] = i;
413 for (int i=0;i<nofTracks;i++)
415 AliFemtoTrack* trackCopy;// = new AliFemtoTrack();
417 // if (fPWG2AODTracks) {
418 // // Read tracks from the additional pwg2 specific AOD part
420 // // Note that in that case all the AOD tracks without the
421 // // additional information will be ignored !
422 // AliPWG2AODTrack *pwg2aodtrack = (AliPWG2AODTrack *) fPWG2AODTracks->At(i);
424 // // Getting the AOD track through the ref of the additional info
425 // AliAODTrack *aodtrack = pwg2aodtrack->GetRefAODTrack();
426 // if (!aodtrack->TestFilterBit(fFilterBit)) {
432 // if (aodtrack->IsOn(AliESDtrack::kTPCrefit))
433 // if (aodtrack->Chi2perNDF() < 6.0)
434 // if (aodtrack->Eta() < 0.9)
438 // CopyAODtoFemtoTrack(aodtrack, trackCopy, pwg2aodtrack);
441 // // Fill the hidden information with the simulated data
442 // // Int_t pLabel = aodtrack->GetLabel();
443 // AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
445 // // Check the mother information
447 // // Using the new way of storing the freeze-out information
448 // // Final state particle is stored twice on the stack
449 // // one copy (mother) is stored with original freeze-out information
450 // // and is not tracked
451 // // the other one (daughter) is stored with primary vertex position
454 // // Freeze-out coordinates
455 // double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
456 // fpx = tPart->Xv() - fV1[0];
457 // fpy = tPart->Yv() - fV1[1];
458 // fpz = tPart->Zv() - fV1[2];
461 // AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
462 // tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
469 // // cout << "Looking for mother ids " << endl;
470 // if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
471 // // cout << "Got mother id" << endl;
472 // AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
473 // // Check if this is the same particle stored twice on the stack
474 // if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
475 // // It is the same particle
476 // // Read in the original freeze-out information
477 // // and convert it from to [fm]
480 // // fpx = mother->Xv()*1e13*0.197327;
481 // // fpy = mother->Yv()*1e13*0.197327;
482 // // fpz = mother->Zv()*1e13*0.197327;
483 // // fpt = mother->T() *1e13*0.197327*0.5;
486 // // Therminator style
487 // fpx = mother->Xv()*1e13;
488 // fpy = mother->Yv()*1e13;
489 // fpz = mother->Zv()*1e13;
490 // fpt = mother->T() *1e13*3e10;
495 // // if (fRotateToEventPlane) {
496 // // double tPhi = TMath::ATan2(fpy, fpx);
497 // // double tRad = TMath::Hypot(fpx, fpy);
499 // // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
500 // // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
503 // tInfo->SetPDGPid(tPart->GetPdgCode());
505 // // if (fRotateToEventPlane) {
506 // // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
507 // // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
509 // // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
510 // // tRad*TMath::Sin(tPhi - tReactionPlane),
514 // tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
515 // Double_t mass2 = (tPart->E() *tPart->E() -
516 // tPart->Px()*tPart->Px() -
517 // tPart->Py()*tPart->Py() -
518 // tPart->Pz()*tPart->Pz());
520 // tInfo->SetMass(TMath::Sqrt(mass2));
522 // tInfo->SetMass(0.0);
524 // tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
525 // trackCopy->SetHiddenInfo(tInfo);
530 // aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
531 // const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
532 // // Check the sanity of the tracks - reject zero momentum tracks
533 // if (ktP.Mag() == 0) {
539 // No additional information exists
540 // Read in the normal AliAODTracks
542 // const AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
543 AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
547 if (aodtrack->IsPrimaryCandidate()) tracksPrim++;
549 if (fFilterBit && !aodtrack->TestFilterBit(fFilterBit)) {
554 if (fFilterMask && !aodtrack->TestFilterBit(fFilterMask)) {
559 // cout << "Muon? " << aodtrack->IsMuonTrack() << endl;
560 // cout << "Type? " << aodtrack->GetType() << endl;
562 // if (aodtrack->IsMuonTrack()) {
563 // cout << "muon" << endl;
568 //counting particles to set multiplicity
569 if(fEstEventMult==kGlobalCount){
570 AliAODTrack* trk_clone = (AliAODTrack*)aodtrack->Clone("trk_clone"); //no DCA cut for global count
571 //if (aodtrack->IsPrimaryCandidate()) //? instead of kinks?
572 if (aodtrack->Chi2perNDF() < 4.0)
573 if (aodtrack->Pt() > 0.15 && aodtrack->Pt() < 20)
574 if (aodtrack->GetTPCNcls() > 70)
575 if (aodtrack->Eta() < 0.8)
580 trackCopy = CopyAODtoFemtoTrack(aodtrack);
582 // copying PID information from the correspondent track
583 // const AliAODTrack *aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
586 AliAODTrack *aodtrackpid;
587 if((fFilterBit == (1 << (7))) || fFilterMask == 128) {//for TPC Only tracks we have to copy PID information from corresponding global tracks
588 aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
591 aodtrackpid = fEvent->GetTrack(i);
594 CopyPIDtoFemtoTrack(aodtrackpid, trackCopy);
597 // Fill the hidden information with the simulated data
598 // Int_t pLabel = aodtrack->GetLabel();
599 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
601 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
602 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
607 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
609 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
610 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
614 // Check the mother information
616 // Using the new way of storing the freeze-out information
617 // Final state particle is stored twice on the stack
618 // one copy (mother) is stored with original freeze-out information
619 // and is not tracked
620 // the other one (daughter) is stored with primary vertex position
623 // Freeze-out coordinates
624 fpx = tPart->Xv() - fV1[0];
625 fpy = tPart->Yv() - fV1[1];
626 fpz = tPart->Zv() - fV1[2];
629 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
637 // cout << "Looking for mother ids " << endl;
638 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
639 // cout << "Got mother id" << endl;
640 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
641 // Check if this is the same particle stored twice on the stack
643 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
644 // It is the same particle
645 // Read in the original freeze-out information
646 // and convert it from to [fm]
649 // fpx = mother->Xv()*1e13*0.197327;
650 // fpy = mother->Yv()*1e13*0.197327;
651 // fpz = mother->Zv()*1e13*0.197327;
652 // fpt = mother->T() *1e13*0.197327*0.5;
656 fpx = mother->Xv()*1e13;
657 fpy = mother->Yv()*1e13;
658 fpz = mother->Zv()*1e13;
659 // fpt = mother->T() *1e13*3e10;
665 // if (fRotateToEventPlane) {
666 // double tPhi = TMath::ATan2(fpy, fpx);
667 // double tRad = TMath::Hypot(fpx, fpy);
669 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
670 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
673 tInfo->SetPDGPid(tPart->GetPdgCode());
675 // if (fRotateToEventPlane) {
676 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
677 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
679 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
680 // tRad*TMath::Sin(tPhi - tReactionPlane),
684 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
685 Double_t mass2 = (tPart->E() *tPart->E() -
686 tPart->Px()*tPart->Px() -
687 tPart->Py()*tPart->Py() -
688 tPart->Pz()*tPart->Pz());
690 tInfo->SetMass(TMath::Sqrt(mass2));
694 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
697 // //if (TMath::Abs(impact[0]) > 0.001) {
698 // if (tPart->IsPhysicalPrimary()){
699 // tInfo->SetPartOrigin(0);
700 // // trackCopy->SetImpactDprim(impact[0]);
701 // //cout << "Read prim" << endl;
703 // else if (tPart->IsSecondaryFromWeakDecay()) {
704 // tInfo->SetPartOrigin(1);
705 // // trackCopy->SetImpactDweak(impact[0]);
706 // //cout << "Read wea" << endl;
708 // else if (tPart->IsSecondaryFromMaterial()) {
709 // tInfo->SetPartOrigin(2);
710 // // trackCopy->SetImpactDmat(impact[0]);
711 // //cout << "Read mat" << endl;
718 trackCopy->SetHiddenInfo(tInfo);
723 //AliExternalTrackParam *param = new AliExternalTrackParam(*aodtrack->GetInnerParam());
724 trackCopy->SetInnerMomentum(aodtrack->GetTPCmomentum());
726 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
727 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
728 // Check the sanity of the tracks - reject zero momentum tracks
729 if (ktP.Mag() == 0) {
735 tEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
736 realnofTracks++;//real number of tracks
739 tEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
740 tEvent->SetNormalizedMult(tracksPrim);
743 tEvent->SetCentralityV0(cent->GetCentralityPercentile("V0M"));
744 tEvent->SetCentralityV0A(cent->GetCentralityPercentile("V0A"));
745 tEvent->SetCentralityV0C(cent->GetCentralityPercentile("V0C"));
746 tEvent->SetCentralityZNA(cent->GetCentralityPercentile("ZNA"));
747 tEvent->SetCentralityZNC(cent->GetCentralityPercentile("ZNC"));
748 tEvent->SetCentralityCL1(cent->GetCentralityPercentile("CL1"));
749 tEvent->SetCentralityCL0(cent->GetCentralityPercentile("CL0"));
750 tEvent->SetCentralityTKL(cent->GetCentralityPercentile("TKL"));
751 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("FMD"));
752 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("NPA"));
753 // tEvent->SetCentralitySPD1(cent->GetCentralityPercentile("CL1"));
754 tEvent->SetCentralityTrk(cent->GetCentralityPercentile("TRK"));
755 tEvent->SetCentralityCND(cent->GetCentralityPercentile("CND"));
758 if (fEstEventMult==kCentrality) {
759 //AliCentrality *cent = fEvent->GetCentrality();
760 //cout<<"AliFemtoEventReaderAOD:"<<lrint(10*cent->GetCentralityPercentile("V0M"))<<endl;
761 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0M")));
762 // if (cent) tEvent->SetNormalizedMult((int) cent->GetCentralityPercentile("V0M"));
764 else if (fEstEventMult==kCentralityV0A) {
765 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0A")));
767 else if (fEstEventMult==kCentralityV0C) {
768 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0C")));
770 else if (fEstEventMult==kCentralityZNA) {
771 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNA")));
773 else if (fEstEventMult==kCentralityZNC) {
774 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNC")));
776 else if (fEstEventMult==kCentralityCL1) {
777 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL1")));
779 else if (fEstEventMult==kCentralityCL0) {
780 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL0")));
782 else if (fEstEventMult==kCentralityTRK) {
783 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TRK")));
785 else if (fEstEventMult==kCentralityTKL) {
786 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TKL")));
788 else if (fEstEventMult==kCentralityCND) {
789 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CND")));
791 else if (fEstEventMult==kCentralityNPA) {
792 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("NPA")));
794 else if (fEstEventMult==kCentralityFMD) {
795 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("FMD")));
797 else if(fEstEventMult==kGlobalCount){
798 tEvent->SetNormalizedMult(tNormMult); //particles counted in the loop, trying to reproduce GetReferenceMultiplicity. If better (default) method appears it should be changed
800 else if(fEstEventMult==kReference)
802 tEvent->SetNormalizedMult(fAODheader->GetRefMultiplicity());
804 else if(fEstEventMult==kTPCOnlyRef)
806 tEvent->SetNormalizedMult(fAODheader->GetTPConlyRefMultiplicity());
808 else if(fEstEventMult == kVZERO)
811 for (Int_t i=0; i<64; i++)
812 multV0 += fEvent->GetVZEROData()->GetMultiplicity(i);
813 tEvent->SetNormalizedMult(multV0);
816 if (mcP) delete [] motherids;
818 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
823 for (Int_t i = 0; i < fEvent->GetNumberOfV0s(); i++) {
824 AliAODv0* aodv0 = fEvent->GetV0(i);
825 if (!aodv0) continue;
826 if(aodv0->GetNDaughters()>2) continue;
827 if(aodv0->GetNProngs()>2) continue;
828 if(aodv0->GetCharge()!=0) continue;
829 if(aodv0->ChargeProng(0)==aodv0->ChargeProng(1)) continue;
830 if(aodv0->CosPointingAngle(fV1)<0.998) continue;
831 AliFemtoV0* trackCopyV0 = new AliFemtoV0();
833 trackCopyV0 = CopyAODtoFemtoV0(aodv0);
834 tEvent->V0Collection()->push_back(trackCopyV0);
835 //cout<<"Pushback v0 to v0collection"<<endl;
842 AliFemtoTrack* AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack
843 // AliPWG2AODTrack *tPWG2AODTrack
846 // Copy the track information from the AOD into the internal AliFemtoTrack
847 // If it exists, use the additional information from the PWG2 AOD
848 AliFemtoTrack *tFemtoTrack = new AliFemtoTrack();
850 // Primary Vertex position
852 fEvent->GetPrimaryVertex()->GetPosition(fV1);
853 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
854 tFemtoTrack->SetPrimaryVertex(fV1);
856 tFemtoTrack->SetCharge(tAodTrack->Charge());
859 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
861 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
862 tFemtoTrack->SetP(v);//setting momentum
863 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
864 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
865 //setting track helix
866 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
867 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
868 tFemtoTrack->SetHelix(helix);
871 tFemtoTrack->SetTrackId(tAodTrack->GetID());
872 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
873 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
875 // Track quality information
877 tAodTrack->GetCovMatrix(covmat);
879 if (!fDCAglobalTrack) {
881 tFemtoTrack->SetImpactD(tAodTrack->DCA());
882 tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
886 // double covimpact[3];
888 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
889 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
890 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
891 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
892 // //cout << "sth went wrong with dca propagation" << endl;
893 // tFemtoTrack->SetImpactD(-1000.0);
894 // tFemtoTrack->SetImpactZ(-1000.0);
898 // tFemtoTrack->SetImpactD(impact[0]);
899 // tFemtoTrack->SetImpactZ(impact[1]);
905 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
906 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
908 // tFemtoTrack->SetImpactD(0.0);
909 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
911 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
914 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
915 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
919 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
920 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
921 // << tAodTrack->Yv() - fV1[1]
922 // << "xv = " << tAodTrack->Xv() << endl
923 // << "fv1[0] = " << fV1[0] << endl
924 // << "yv = " << tAodTrack->Yv() << endl
925 // << "fv1[1] = " << fV1[1] << endl
926 // << "zv = " << tAodTrack->Zv() << endl
927 // << "fv1[2] = " << fV1[2] << endl
928 // << "impact[0] = " << impact[0] << endl
929 // << "impact[1] = " << impact[1] << endl
932 tFemtoTrack->SetCdd(covmat[0]);
933 tFemtoTrack->SetCdz(covmat[1]);
934 tFemtoTrack->SetCzz(covmat[2]);
935 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
936 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
937 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
938 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
939 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
940 tFemtoTrack->SetTPCsignalN(1);
941 tFemtoTrack->SetTPCsignalS(1);
942 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
944 // if (tPWG2AODTrack) {
945 // // Copy the PWG2 specific information if it exists
946 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
947 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
949 // double xtpc[3] = {0,0,0};
950 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
951 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
952 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
953 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
956 // If not use dummy values
957 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
958 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
960 float globalPositionsAtRadii[9][3];
961 float bfield = 5*fMagFieldSign;
963 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
964 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
965 double **tpcPositions;
966 tpcPositions = new double*[9];
968 tpcPositions[i] = new double[3];
969 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
972 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
973 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
974 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
977 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
978 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
979 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
981 delete [] tpcPositions[i];
982 delete [] tpcPositions;
985 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
989 for (int ik=0; ik<3; ik++) {
992 tFemtoTrack->SetKinkIndexes(indexes);
995 for (int ii=0; ii<6; ii++){
996 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
1002 AliFemtoV0* AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0 )
1004 AliFemtoV0 *tFemtoV0 = new AliFemtoV0();
1006 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
1007 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
1008 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
1009 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
1010 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
1011 tFemtoV0->SetdecayVertexV0(decayvertex);
1012 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
1013 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
1014 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
1015 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
1016 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
1017 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
1018 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
1019 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
1020 tFemtoV0->SetmomPos(mompos);
1021 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
1022 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
1023 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
1024 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
1025 tFemtoV0->SetmomNeg(momneg);
1027 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
1028 //void SettpcHitsPos(const int& i);
1029 //void SettpcHitsNeg(const int& i);
1031 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
1032 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
1035 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
1036 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
1037 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
1038 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
1039 tFemtoV0->SetmomV0(momv0);
1040 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
1041 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
1042 tFemtoV0->SeteLambda(tAODv0->ELambda());
1043 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
1044 tFemtoV0->SetePosProton(tAODv0->EPosProton());
1045 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
1046 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
1047 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
1048 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
1049 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
1050 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
1052 //void SetcTauLambda( float x);
1053 //void SetcTauK0Short( float x);
1055 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
1056 tFemtoV0->SetptV0(tAODv0->Pt());
1057 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
1058 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
1059 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
1060 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
1061 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
1063 tFemtoV0->SetidNeg(tAODv0->GetNegID());
1064 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
1065 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
1066 tFemtoV0->SetidPos(tAODv0->GetPosID());
1068 tFemtoV0->SetEtaV0(tAODv0->Eta());
1069 tFemtoV0->SetPhiV0(tAODv0->Phi());
1070 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
1071 //tFemtoV0->SetYV0(tAODv0->Y());
1074 //void SetdedxNeg(float x);
1075 //void SeterrdedxNeg(float x);//Gael 04Fev2002
1076 //void SetlendedxNeg(float x);//Gael 04Fev2002
1077 //void SetdedxPos(float x);
1078 //void SeterrdedxPos(float x);//Gael 04Fev2002
1079 //void SetlendedxPos(float x);//Gael 04Fev2002
1081 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
1082 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
1084 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
1085 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
1088 if(trackpos && trackneg)
1090 tFemtoV0->SetEtaPos(trackpos->Eta());
1091 tFemtoV0->SetEtaNeg(trackneg->Eta());
1092 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1093 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1094 tFemtoV0->SetptPos(trackpos->Pt());
1095 tFemtoV0->SetptNeg(trackneg->Pt());
1097 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1098 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1099 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1100 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1101 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1102 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1103 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1104 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1105 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1106 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1107 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1108 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1110 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1111 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1112 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1113 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1114 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1115 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1118 float bfield = 5*fMagFieldSign;
1119 float globalPositionsAtRadiiPos[9][3];
1120 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1121 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1122 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1124 float globalPositionsAtRadiiNeg[9][3];
1125 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1126 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1127 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1129 AliFemtoThreeVector tmpVec;
1130 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetY(tpcEntrancePos[1]); tmpVec.SetZ(tpcEntrancePos[2]);
1131 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1133 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetY(tpcExitPos[1]); tmpVec.SetZ(tpcExitPos[2]);
1134 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1136 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetY(tpcEntranceNeg[1]); tmpVec.SetZ(tpcEntranceNeg[2]);
1137 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1139 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetY(tpcExitNeg[1]); tmpVec.SetZ(tpcExitNeg[2]);
1140 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1143 AliFemtoThreeVector vecTpcPos[9];
1144 AliFemtoThreeVector vecTpcNeg[9];
1145 for(int i=0;i<9;i++)
1147 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1148 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1150 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1151 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1153 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1154 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1156 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1157 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1160 Float_t probMisPos = 1.0;
1161 Float_t probMisNeg = 1.0;
1163 if (tFemtoV0->StatusPos() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1164 probMisPos = fAODpidUtil->GetTOFMismatchProbability(trackpos);
1166 if (tFemtoV0->StatusNeg() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1167 probMisNeg = fAODpidUtil->GetTOFMismatchProbability(trackneg);
1170 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 || probMisPos > 0.01)
1172 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 || probMisNeg > 0.01)
1174 tFemtoV0->SetPosNSigmaTOFK(-1000);
1175 tFemtoV0->SetNegNSigmaTOFK(-1000);
1176 tFemtoV0->SetPosNSigmaTOFP(-1000);
1177 tFemtoV0->SetNegNSigmaTOFP(-1000);
1178 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1179 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1181 tFemtoV0->SetTOFProtonTimePos(-1000);
1182 tFemtoV0->SetTOFPionTimePos(-1000);
1183 tFemtoV0->SetTOFKaonTimePos(-1000);
1184 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1185 tFemtoV0->SetTOFPionTimeNeg(-1000);
1186 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1191 if(trackpos->IsOn(AliESDtrack::kTOFpid)) {
1192 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1193 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1194 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1196 if(trackneg->IsOn(AliESDtrack::kTOFpid)) {
1197 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1198 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1199 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1201 double TOFSignalPos = trackpos->GetTOFsignal();
1202 double TOFSignalNeg = trackneg->GetTOFsignal();
1203 TOFSignalPos -= fAODpidUtil->GetTOFResponse().GetStartTime(trackpos->P());
1204 TOFSignalNeg -= fAODpidUtil->GetTOFResponse().GetStartTime(trackneg->P());
1207 trackpos->GetIntegratedTimes(pidPos);
1208 trackneg->GetIntegratedTimes(pidNeg);
1210 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1211 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1212 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1213 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1214 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1215 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1222 tFemtoV0->SetStatusPos(999);
1223 tFemtoV0->SetStatusNeg(999);
1226 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1230 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1232 fFilterBit = (1 << (ibit));
1236 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1241 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1247 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1252 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1254 fEstEventMult = aType;
1257 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1259 if (aLabel < 0) return 0;
1260 AliAODMCParticle *aodP;
1262 if (aLabel > mcP->GetEntries())
1263 posstack = mcP->GetEntries();
1267 aodP = (AliAODMCParticle *) mcP->At(posstack);
1268 if (aodP->GetLabel() > posstack) {
1270 aodP = (AliAODMCParticle *) mcP->At(posstack);
1271 if (aodP->GetLabel() == aLabel) return aodP;
1274 while (posstack > 0);
1278 aodP = (AliAODMCParticle *) mcP->At(posstack);
1279 if (aodP->GetLabel() == aLabel) return aodP;
1282 while (posstack < mcP->GetEntries());
1288 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1289 AliFemtoTrack *tFemtoTrack)
1292 if (fDCAglobalTrack) {
1294 // code from Michael and Prabhat from AliAnalysisTaskDptDptCorrelations
1295 const AliAODVertex* vertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
1296 float vertexX = -999.;
1297 float vertexY = -999.;
1298 float vertexZ = -999.;
1302 vertex->GetCovarianceMatrix(fCov);
1303 if(vertex->GetNContributors() > 0) {
1305 vertexX = vertex->GetX();
1306 vertexY = vertex->GetY();
1307 vertexZ = vertex->GetZ();
1314 tAodTrack->GetXYZ(pos);
1316 Double_t DCAX = pos[0] - vertexX;
1317 Double_t DCAY = pos[1] - vertexY;
1318 Double_t DCAZ = pos[2] - vertexZ;
1320 Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1322 tFemtoTrack->SetImpactD(DCAXY);
1323 tFemtoTrack->SetImpactZ(DCAZ);
1326 // // // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1328 // double impact[2];
1329 // double covimpact[3];
1331 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
1332 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
1333 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1334 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1336 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1337 // //cout << "sth went wrong with dca propagation" << endl;
1338 // tFemtoTrack->SetImpactD(-1000.0);
1339 // tFemtoTrack->SetImpactZ(-1000.0);
1343 // tFemtoTrack->SetImpactD(impact[0]);
1344 // tFemtoTrack->SetImpactZ(impact[1]);
1346 // delete trk_clone;
1350 tAodTrack->GetPID(aodpid);
1351 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1352 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1353 tFemtoTrack->SetPidProbPion(aodpid[2]);
1354 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1355 tFemtoTrack->SetPidProbProton(aodpid[4]);
1357 aodpid[0] = -100000.0;
1358 aodpid[1] = -100000.0;
1359 aodpid[2] = -100000.0;
1360 aodpid[3] = -100000.0;
1361 aodpid[4] = -100000.0;
1364 Float_t probMis = 1.0;
1366 //what is that code? for what do we need it? nsigma values are not enough?
1367 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1368 tTOF = tAodTrack->GetTOFsignal();
1369 tAodTrack->GetIntegratedTimes(aodpid);
1371 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1373 probMis = fAODpidUtil->GetTOFMismatchProbability(tAodTrack);
1378 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1380 ////// TPC ////////////////////////////////////////////
1382 float nsigmaTPCK=-1000.;
1383 float nsigmaTPCPi=-1000.;
1384 float nsigmaTPCP=-1000.;
1385 float nsigmaTPCE=-1000.;
1387 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1389 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1390 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1391 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1392 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1393 nsigmaTPCE = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kElectron);
1396 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1397 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1398 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1399 tFemtoTrack->SetNSigmaTPCE(nsigmaTPCE);
1401 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1402 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1403 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1405 tFemtoTrack->SetTPCsignalN(1);
1406 tFemtoTrack->SetTPCsignalS(1);
1407 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1409 ///////TOF//////////////////////
1412 float nsigmaTOFPi=-1000.;
1413 float nsigmaTOFK=-1000.;
1414 float nsigmaTOFP=-1000.;
1415 float nsigmaTOFE=-1000.;
1417 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1418 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1419 (tAodTrack->GetStatus() & AliESDtrack::kTIME) //AliESDtrack::kTIME=0x80000000
1420 && probMis < 0.01) // TOF mismatch probaility
1422 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1425 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1426 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1427 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1428 nsigmaTOFE = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kElectron);
1430 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1431 Double_t tof=tAodTrack->GetTOFsignal();
1432 if(tof > 0.) vp=len/tof/0.03;
1435 tFemtoTrack->SetVTOF(vp);
1436 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1437 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1438 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1439 tFemtoTrack->SetNSigmaTOFE(nsigmaTOFE);
1442 //////////////////////////////////////
1446 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1448 fCentRange[0] = min; fCentRange[1] = max;
1450 fEstEventMult = kCentrality;
1453 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1455 if(anocent==false) {fEstEventMult=kCentrality;}
1456 else {fEstEventMult=kReference; fUsePreCent = 0; }
1459 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1461 fAODpidUtil = aAODpidUtil;
1462 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1465 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1467 fAODheader = aAODheader;
1471 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1481 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1486 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1488 // Gets the global position of the track at nine different radii in the TPC
1489 // track is the track you want to propagate
1490 // bfield is the magnetic field of your event
1491 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1493 // Initialize the array to something indicating there was no propagation
1494 for(Int_t i=0;i<9;i++){
1495 for(Int_t j=0;j<3;j++){
1496 globalPositionsAtRadii[i][j]=-9999.;
1500 // Make a copy of the track to not change parameters of the track
1501 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1502 //printf("\nAfter CopyFromVTrack\n");
1505 // The global position of the the track
1506 Double_t xyz[3]={-9999.,-9999.,-9999.};
1508 // Counter for which radius we want
1510 // The radii at which we get the global positions
1511 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1512 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1513 // The global radius we are at
1514 Float_t globalRadius=0;
1516 // Propagation is done in local x of the track
1517 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1518 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1519 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1520 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1521 // adds to the global radius
1523 // Stop if the propagation was not succesful. This can happen for low pt tracks
1524 // that don't reach outer radii
1525 if(!etp.PropagateTo(x,bfield))break;
1526 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1527 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1529 // Roughly reached the radius we want
1530 if(globalRadius > Rwanted[iR]){
1532 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1533 while (globalRadius>Rwanted[iR]){
1535 // printf("propagating to x %5.2f\n",x);
1536 if(!etp.PropagateTo(x,bfield))break;
1537 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1538 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1540 //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]);
1541 globalPositionsAtRadii[iR][0]=xyz[0];
1542 globalPositionsAtRadii[iR][1]=xyz[1];
1543 globalPositionsAtRadii[iR][2]=xyz[2];
1544 // Indicate we want the next radius
1554 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)
1559 void AliFemtoEventReaderAOD::SetUseMVPlpSelection(Bool_t mvplp)
1564 void AliFemtoEventReaderAOD::SetIsPileUpEvent(Bool_t ispileup)
1566 fisPileUp = ispileup;
1571 void AliFemtoEventReaderAOD::SetDCAglobalTrack(Bool_t dcagt)
1573 fDCAglobalTrack = dcagt;
1577 bool AliFemtoEventReaderAOD::RejectEventCentFlat(float MagField, float CentPercent)
1578 { // to flatten centrality distribution
1579 bool RejectEvent = kFALSE;
1581 TRandom3* fRandomNumber = new TRandom3(); //for 3D, random sign switching
1582 fRandomNumber->SetSeed(0);
1584 if(MagField > 0) weightBinSign = 0;
1585 else weightBinSign = 1;
1586 float kCentWeight[2][9] = {{.878,.876,.860,.859,.859,.88,.873,.879,.894},
1587 {.828,.793,.776,.772,.775,.796,.788,.804,.839}};
1588 int weightBinCent = (int) CentPercent;
1589 if(fRandomNumber->Rndm() > kCentWeight[weightBinSign][weightBinCent]) RejectEvent = kTRUE;
1594 void AliFemtoEventReaderAOD::SetCentralityFlattening(Bool_t dcagt)