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) return NULL; //Vertex rejection for pA analysis.
342 if(fMVPlp) anaUtil->SetUseMVPlpSelection(kTRUE);
343 else anaUtil->SetUseMVPlpSelection(kFALSE);
344 if(fMinPlpContribMV) anaUtil->SetMinPlpContribMV(fMinPlpContribMV);
345 if(fMinPlpContribSPD) anaUtil->SetMinPlpContribSPD(fMinPlpContribSPD);
347 if(anaUtil->IsPileUpEvent(fEvent)) return NULL; //Pile-up rejection.
351 // Primary Vertex position
352 const AliAODVertex* aodvertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
353 if(!aodvertex || aodvertex->GetNContributors() < 1) return NULL; //Bad vertex, skip event.
355 aodvertex->GetPosition(fV1);
356 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
357 tEvent->SetPrimVertPos(vertex);
359 //starting to reading tracks
360 int nofTracks=0; //number of reconstructed tracks in event
362 nofTracks=fEvent->GetNumberOfTracks();
364 AliEventplane *ep = fEvent->GetEventplane();
368 tEvent->SetReactionPlaneAngle(ep->GetEventplane("V0",fEvent,2));
370 tEvent->SetReactionPlaneAngle(ep->GetEventplane("Q"));
373 AliCentrality *cent = fEvent->GetCentrality();
375 if (!fEstEventMult && cent && fUsePreCent) {
376 if ((cent->GetCentralityPercentile("V0M")*10 < fCentRange[0]) ||
377 (cent->GetCentralityPercentile("V0M")*10 > fCentRange[1]))
379 // cout << "Centrality " << cent->GetCentralityPercentile("V0M") << " outside of preselection range " << fCentRange[0] << " - " << fCentRange[1] << endl;
385 float percent = cent->GetCentralityPercentile("V0M");
386 //flatten centrality dist.
389 if(RejectEventCentFlat(fEvent->GetMagneticField(),percent)) return NULL;
393 int realnofTracks=0; // number of track which we use in a analysis
397 for (int il=0; il<20000; il++) labels[il] = -1;
399 // looking for global tracks and saving their numbers to copy from them PID information to TPC-only tracks in the main loop over tracks
400 for (int i=0;i<nofTracks;i++) {
401 const AliAODTrack *aodtrack=fEvent->GetTrack(i);
402 if (!aodtrack->TestFilterBit(fFilterBit)) {
403 if(aodtrack->GetID() < 0) continue;
404 labels[aodtrack->GetID()] = i;
409 for (int i=0;i<nofTracks;i++)
411 AliFemtoTrack* trackCopy = new AliFemtoTrack();
413 // if (fPWG2AODTracks) {
414 // // Read tracks from the additional pwg2 specific AOD part
416 // // Note that in that case all the AOD tracks without the
417 // // additional information will be ignored !
418 // AliPWG2AODTrack *pwg2aodtrack = (AliPWG2AODTrack *) fPWG2AODTracks->At(i);
420 // // Getting the AOD track through the ref of the additional info
421 // AliAODTrack *aodtrack = pwg2aodtrack->GetRefAODTrack();
422 // if (!aodtrack->TestFilterBit(fFilterBit)) {
428 // if (aodtrack->IsOn(AliESDtrack::kTPCrefit))
429 // if (aodtrack->Chi2perNDF() < 6.0)
430 // if (aodtrack->Eta() < 0.9)
434 // CopyAODtoFemtoTrack(aodtrack, trackCopy, pwg2aodtrack);
437 // // Fill the hidden information with the simulated data
438 // // Int_t pLabel = aodtrack->GetLabel();
439 // AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
441 // // Check the mother information
443 // // Using the new way of storing the freeze-out information
444 // // Final state particle is stored twice on the stack
445 // // one copy (mother) is stored with original freeze-out information
446 // // and is not tracked
447 // // the other one (daughter) is stored with primary vertex position
450 // // Freeze-out coordinates
451 // double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
452 // fpx = tPart->Xv() - fV1[0];
453 // fpy = tPart->Yv() - fV1[1];
454 // fpz = tPart->Zv() - fV1[2];
457 // AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
458 // tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
465 // // cout << "Looking for mother ids " << endl;
466 // if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
467 // // cout << "Got mother id" << endl;
468 // AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
469 // // Check if this is the same particle stored twice on the stack
470 // if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
471 // // It is the same particle
472 // // Read in the original freeze-out information
473 // // and convert it from to [fm]
476 // // fpx = mother->Xv()*1e13*0.197327;
477 // // fpy = mother->Yv()*1e13*0.197327;
478 // // fpz = mother->Zv()*1e13*0.197327;
479 // // fpt = mother->T() *1e13*0.197327*0.5;
482 // // Therminator style
483 // fpx = mother->Xv()*1e13;
484 // fpy = mother->Yv()*1e13;
485 // fpz = mother->Zv()*1e13;
486 // fpt = mother->T() *1e13*3e10;
491 // // if (fRotateToEventPlane) {
492 // // double tPhi = TMath::ATan2(fpy, fpx);
493 // // double tRad = TMath::Hypot(fpx, fpy);
495 // // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
496 // // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
499 // tInfo->SetPDGPid(tPart->GetPdgCode());
501 // // if (fRotateToEventPlane) {
502 // // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
503 // // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
505 // // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
506 // // tRad*TMath::Sin(tPhi - tReactionPlane),
510 // tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
511 // Double_t mass2 = (tPart->E() *tPart->E() -
512 // tPart->Px()*tPart->Px() -
513 // tPart->Py()*tPart->Py() -
514 // tPart->Pz()*tPart->Pz());
516 // tInfo->SetMass(TMath::Sqrt(mass2));
518 // tInfo->SetMass(0.0);
520 // tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
521 // trackCopy->SetHiddenInfo(tInfo);
526 // aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
527 // const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
528 // // Check the sanity of the tracks - reject zero momentum tracks
529 // if (ktP.Mag() == 0) {
535 // No additional information exists
536 // Read in the normal AliAODTracks
538 // const AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
539 AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
543 if (aodtrack->IsPrimaryCandidate()) tracksPrim++;
545 if (fFilterBit && !aodtrack->TestFilterBit(fFilterBit)) {
550 if (fFilterMask && !aodtrack->TestFilterBit(fFilterMask)) {
555 // cout << "Muon? " << aodtrack->IsMuonTrack() << endl;
556 // cout << "Type? " << aodtrack->GetType() << endl;
558 // if (aodtrack->IsMuonTrack()) {
559 // cout << "muon" << endl;
564 //counting particles to set multiplicity
565 if(fEstEventMult==kGlobalCount){
566 AliAODTrack* trk_clone = (AliAODTrack*)aodtrack->Clone("trk_clone"); //no DCA cut for global count
567 //if (aodtrack->IsPrimaryCandidate()) //? instead of kinks?
568 if (aodtrack->Chi2perNDF() < 4.0)
569 if (aodtrack->Pt() > 0.15 && aodtrack->Pt() < 20)
570 if (aodtrack->GetTPCNcls() > 70)
571 if (aodtrack->Eta() < 0.8)
576 trackCopy = CopyAODtoFemtoTrack(aodtrack);
578 // copying PID information from the correspondent track
579 // const AliAODTrack *aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
582 AliAODTrack *aodtrackpid;
583 if((fFilterBit == (1 << (7))) || fFilterMask == 128) {//for TPC Only tracks we have to copy PID information from corresponding global tracks
584 aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
587 aodtrackpid = fEvent->GetTrack(i);
590 CopyPIDtoFemtoTrack(aodtrackpid, trackCopy);
593 // Fill the hidden information with the simulated data
594 // Int_t pLabel = aodtrack->GetLabel();
595 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
597 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
598 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
603 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
605 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
606 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
610 // Check the mother information
612 // Using the new way of storing the freeze-out information
613 // Final state particle is stored twice on the stack
614 // one copy (mother) is stored with original freeze-out information
615 // and is not tracked
616 // the other one (daughter) is stored with primary vertex position
619 // Freeze-out coordinates
620 fpx = tPart->Xv() - fV1[0];
621 fpy = tPart->Yv() - fV1[1];
622 fpz = tPart->Zv() - fV1[2];
625 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
633 // cout << "Looking for mother ids " << endl;
634 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
635 // cout << "Got mother id" << endl;
636 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
637 // Check if this is the same particle stored twice on the stack
639 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
640 // It is the same particle
641 // Read in the original freeze-out information
642 // and convert it from to [fm]
645 // fpx = mother->Xv()*1e13*0.197327;
646 // fpy = mother->Yv()*1e13*0.197327;
647 // fpz = mother->Zv()*1e13*0.197327;
648 // fpt = mother->T() *1e13*0.197327*0.5;
652 fpx = mother->Xv()*1e13;
653 fpy = mother->Yv()*1e13;
654 fpz = mother->Zv()*1e13;
655 // fpt = mother->T() *1e13*3e10;
661 // if (fRotateToEventPlane) {
662 // double tPhi = TMath::ATan2(fpy, fpx);
663 // double tRad = TMath::Hypot(fpx, fpy);
665 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
666 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
669 tInfo->SetPDGPid(tPart->GetPdgCode());
671 // if (fRotateToEventPlane) {
672 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
673 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
675 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
676 // tRad*TMath::Sin(tPhi - tReactionPlane),
680 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
681 Double_t mass2 = (tPart->E() *tPart->E() -
682 tPart->Px()*tPart->Px() -
683 tPart->Py()*tPart->Py() -
684 tPart->Pz()*tPart->Pz());
686 tInfo->SetMass(TMath::Sqrt(mass2));
690 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
693 // //if (TMath::Abs(impact[0]) > 0.001) {
694 // if (tPart->IsPhysicalPrimary()){
695 // tInfo->SetPartOrigin(0);
696 // // trackCopy->SetImpactDprim(impact[0]);
697 // //cout << "Read prim" << endl;
699 // else if (tPart->IsSecondaryFromWeakDecay()) {
700 // tInfo->SetPartOrigin(1);
701 // // trackCopy->SetImpactDweak(impact[0]);
702 // //cout << "Read wea" << endl;
704 // else if (tPart->IsSecondaryFromMaterial()) {
705 // tInfo->SetPartOrigin(2);
706 // // trackCopy->SetImpactDmat(impact[0]);
707 // //cout << "Read mat" << endl;
714 trackCopy->SetHiddenInfo(tInfo);
719 //AliExternalTrackParam *param = new AliExternalTrackParam(*aodtrack->GetInnerParam());
720 trackCopy->SetInnerMomentum(aodtrack->GetTPCmomentum());
722 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
723 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
724 // Check the sanity of the tracks - reject zero momentum tracks
725 if (ktP.Mag() == 0) {
731 tEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
732 realnofTracks++;//real number of tracks
735 tEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
736 tEvent->SetNormalizedMult(tracksPrim);
739 tEvent->SetCentralityV0(cent->GetCentralityPercentile("V0M"));
740 tEvent->SetCentralityV0A(cent->GetCentralityPercentile("V0A"));
741 tEvent->SetCentralityV0C(cent->GetCentralityPercentile("V0C"));
742 tEvent->SetCentralityZNA(cent->GetCentralityPercentile("ZNA"));
743 tEvent->SetCentralityZNC(cent->GetCentralityPercentile("ZNC"));
744 tEvent->SetCentralityCL1(cent->GetCentralityPercentile("CL1"));
745 tEvent->SetCentralityCL0(cent->GetCentralityPercentile("CL0"));
746 tEvent->SetCentralityTKL(cent->GetCentralityPercentile("TKL"));
747 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("FMD"));
748 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("NPA"));
749 // tEvent->SetCentralitySPD1(cent->GetCentralityPercentile("CL1"));
750 tEvent->SetCentralityTrk(cent->GetCentralityPercentile("TRK"));
751 tEvent->SetCentralityCND(cent->GetCentralityPercentile("CND"));
754 if (fEstEventMult==kCentrality) {
755 //AliCentrality *cent = fEvent->GetCentrality();
756 //cout<<"AliFemtoEventReaderAOD:"<<lrint(10*cent->GetCentralityPercentile("V0M"))<<endl;
757 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0M")));
758 // if (cent) tEvent->SetNormalizedMult((int) cent->GetCentralityPercentile("V0M"));
760 else if (fEstEventMult==kCentralityV0A) {
761 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0A")));
763 else if (fEstEventMult==kCentralityV0C) {
764 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0C")));
766 else if (fEstEventMult==kCentralityZNA) {
767 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNA")));
769 else if (fEstEventMult==kCentralityZNC) {
770 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNC")));
772 else if (fEstEventMult==kCentralityCL1) {
773 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL1")));
775 else if (fEstEventMult==kCentralityCL0) {
776 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL0")));
778 else if (fEstEventMult==kCentralityTRK) {
779 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TRK")));
781 else if (fEstEventMult==kCentralityTKL) {
782 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TKL")));
784 else if (fEstEventMult==kCentralityCND) {
785 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CND")));
787 else if (fEstEventMult==kCentralityNPA) {
788 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("NPA")));
790 else if (fEstEventMult==kCentralityFMD) {
791 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("FMD")));
793 else if(fEstEventMult==kGlobalCount){
794 tEvent->SetNormalizedMult(tNormMult); //particles counted in the loop, trying to reproduce GetReferenceMultiplicity. If better (default) method appears it should be changed
796 else if(fEstEventMult==kReference)
798 tEvent->SetNormalizedMult(fAODheader->GetRefMultiplicity());
800 else if(fEstEventMult==kTPCOnlyRef)
802 tEvent->SetNormalizedMult(fAODheader->GetTPConlyRefMultiplicity());
804 else if(fEstEventMult == kVZERO)
807 for (Int_t i=0; i<64; i++)
808 multV0 += fEvent->GetVZEROData()->GetMultiplicity(i);
809 tEvent->SetNormalizedMult(multV0);
812 if (mcP) delete [] motherids;
814 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
819 for (Int_t i = 0; i < fEvent->GetNumberOfV0s(); i++) {
820 AliAODv0* aodv0 = fEvent->GetV0(i);
821 if (!aodv0) continue;
822 if(aodv0->GetNDaughters()>2) continue;
823 if(aodv0->GetNProngs()>2) continue;
824 if(aodv0->GetCharge()!=0) continue;
825 if(aodv0->ChargeProng(0)==aodv0->ChargeProng(1)) continue;
826 if(aodv0->CosPointingAngle(fV1)<0.998) continue;
827 AliFemtoV0* trackCopyV0 = new AliFemtoV0();
829 trackCopyV0 = CopyAODtoFemtoV0(aodv0);
830 tEvent->V0Collection()->push_back(trackCopyV0);
831 //cout<<"Pushback v0 to v0collection"<<endl;
838 AliFemtoTrack* AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack
839 // AliPWG2AODTrack *tPWG2AODTrack
842 // Copy the track information from the AOD into the internal AliFemtoTrack
843 // If it exists, use the additional information from the PWG2 AOD
844 AliFemtoTrack *tFemtoTrack = new AliFemtoTrack();
846 // Primary Vertex position
848 fEvent->GetPrimaryVertex()->GetPosition(fV1);
849 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
850 tFemtoTrack->SetPrimaryVertex(fV1);
852 tFemtoTrack->SetCharge(tAodTrack->Charge());
855 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
857 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
858 tFemtoTrack->SetP(v);//setting momentum
859 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
860 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
861 //setting track helix
862 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
863 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
864 tFemtoTrack->SetHelix(helix);
867 tFemtoTrack->SetTrackId(tAodTrack->GetID());
868 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
869 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
871 // Track quality information
873 tAodTrack->GetCovMatrix(covmat);
875 if (!fDCAglobalTrack) {
877 tFemtoTrack->SetImpactD(tAodTrack->DCA());
878 tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
882 // double covimpact[3];
884 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
885 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
886 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
887 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
888 // //cout << "sth went wrong with dca propagation" << endl;
889 // tFemtoTrack->SetImpactD(-1000.0);
890 // tFemtoTrack->SetImpactZ(-1000.0);
894 // tFemtoTrack->SetImpactD(impact[0]);
895 // tFemtoTrack->SetImpactZ(impact[1]);
901 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
902 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
904 // tFemtoTrack->SetImpactD(0.0);
905 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
907 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
910 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
911 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
915 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
916 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
917 // << tAodTrack->Yv() - fV1[1]
918 // << "xv = " << tAodTrack->Xv() << endl
919 // << "fv1[0] = " << fV1[0] << endl
920 // << "yv = " << tAodTrack->Yv() << endl
921 // << "fv1[1] = " << fV1[1] << endl
922 // << "zv = " << tAodTrack->Zv() << endl
923 // << "fv1[2] = " << fV1[2] << endl
924 // << "impact[0] = " << impact[0] << endl
925 // << "impact[1] = " << impact[1] << endl
928 tFemtoTrack->SetCdd(covmat[0]);
929 tFemtoTrack->SetCdz(covmat[1]);
930 tFemtoTrack->SetCzz(covmat[2]);
931 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
932 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
933 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
934 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
935 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
936 tFemtoTrack->SetTPCsignalN(1);
937 tFemtoTrack->SetTPCsignalS(1);
938 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
940 // if (tPWG2AODTrack) {
941 // // Copy the PWG2 specific information if it exists
942 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
943 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
945 // double xtpc[3] = {0,0,0};
946 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
947 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
948 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
949 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
952 // If not use dummy values
953 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
954 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
956 float globalPositionsAtRadii[9][3];
957 float bfield = 5*fMagFieldSign;
959 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
960 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
961 double **tpcPositions;
962 tpcPositions = new double*[9];
964 tpcPositions[i] = new double[3];
965 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
968 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
969 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
970 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
973 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
974 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
975 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
977 delete [] tpcPositions[i];
978 delete [] tpcPositions;
981 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
985 for (int ik=0; ik<3; ik++) {
988 tFemtoTrack->SetKinkIndexes(indexes);
991 for (int ii=0; ii<6; ii++){
992 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
998 AliFemtoV0* AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0 )
1000 AliFemtoV0 *tFemtoV0 = new AliFemtoV0();
1002 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
1003 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
1004 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
1005 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
1006 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
1007 tFemtoV0->SetdecayVertexV0(decayvertex);
1008 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
1009 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
1010 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
1011 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
1012 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
1013 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
1014 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
1015 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
1016 tFemtoV0->SetmomPos(mompos);
1017 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
1018 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
1019 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
1020 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
1021 tFemtoV0->SetmomNeg(momneg);
1023 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
1024 //void SettpcHitsPos(const int& i);
1025 //void SettpcHitsNeg(const int& i);
1027 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
1028 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
1031 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
1032 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
1033 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
1034 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
1035 tFemtoV0->SetmomV0(momv0);
1036 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
1037 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
1038 tFemtoV0->SeteLambda(tAODv0->ELambda());
1039 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
1040 tFemtoV0->SetePosProton(tAODv0->EPosProton());
1041 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
1042 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
1043 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
1044 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
1045 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
1046 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
1048 //void SetcTauLambda( float x);
1049 //void SetcTauK0Short( float x);
1051 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
1052 tFemtoV0->SetptV0(tAODv0->Pt());
1053 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
1054 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
1055 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
1056 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
1057 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
1059 tFemtoV0->SetidNeg(tAODv0->GetNegID());
1060 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
1061 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
1062 tFemtoV0->SetidPos(tAODv0->GetPosID());
1064 tFemtoV0->SetEtaV0(tAODv0->Eta());
1065 tFemtoV0->SetPhiV0(tAODv0->Phi());
1066 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
1067 //tFemtoV0->SetYV0(tAODv0->Y());
1070 //void SetdedxNeg(float x);
1071 //void SeterrdedxNeg(float x);//Gael 04Fev2002
1072 //void SetlendedxNeg(float x);//Gael 04Fev2002
1073 //void SetdedxPos(float x);
1074 //void SeterrdedxPos(float x);//Gael 04Fev2002
1075 //void SetlendedxPos(float x);//Gael 04Fev2002
1077 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
1078 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
1080 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
1081 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
1084 if(trackpos && trackneg)
1086 tFemtoV0->SetEtaPos(trackpos->Eta());
1087 tFemtoV0->SetEtaNeg(trackneg->Eta());
1088 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1089 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1090 tFemtoV0->SetptPos(trackpos->Pt());
1091 tFemtoV0->SetptNeg(trackneg->Pt());
1093 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1094 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1095 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1096 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1097 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1098 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1099 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1100 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1101 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1102 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1103 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1104 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1106 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1107 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1108 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1109 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1110 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1111 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1114 float bfield = 5*fMagFieldSign;
1115 float globalPositionsAtRadiiPos[9][3];
1116 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1117 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1118 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1120 float globalPositionsAtRadiiNeg[9][3];
1121 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1122 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1123 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1125 AliFemtoThreeVector tmpVec;
1126 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetY(tpcEntrancePos[1]); tmpVec.SetZ(tpcEntrancePos[2]);
1127 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1129 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetY(tpcExitPos[1]); tmpVec.SetZ(tpcExitPos[2]);
1130 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1132 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetY(tpcEntranceNeg[1]); tmpVec.SetZ(tpcEntranceNeg[2]);
1133 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1135 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetY(tpcExitNeg[1]); tmpVec.SetZ(tpcExitNeg[2]);
1136 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1139 AliFemtoThreeVector vecTpcPos[9];
1140 AliFemtoThreeVector vecTpcNeg[9];
1141 for(int i=0;i<9;i++)
1143 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1144 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1146 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1147 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1149 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1150 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1152 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1153 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1155 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 )
1157 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 )
1159 tFemtoV0->SetPosNSigmaTOFK(-1000);
1160 tFemtoV0->SetNegNSigmaTOFK(-1000);
1161 tFemtoV0->SetPosNSigmaTOFP(-1000);
1162 tFemtoV0->SetNegNSigmaTOFP(-1000);
1163 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1164 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1166 tFemtoV0->SetTOFProtonTimePos(-1000);
1167 tFemtoV0->SetTOFPionTimePos(-1000);
1168 tFemtoV0->SetTOFKaonTimePos(-1000);
1169 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1170 tFemtoV0->SetTOFPionTimeNeg(-1000);
1171 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1176 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1177 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1178 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1179 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1180 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1181 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1183 double TOFSignalPos = trackpos->GetTOFsignal();
1184 double TOFSignalNeg = trackneg->GetTOFsignal();
1187 trackpos->GetIntegratedTimes(pidPos);
1188 trackneg->GetIntegratedTimes(pidNeg);
1190 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1191 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1192 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1193 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1194 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1195 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1202 tFemtoV0->SetStatusPos(999);
1203 tFemtoV0->SetStatusNeg(999);
1206 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1210 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1212 fFilterBit = (1 << (ibit));
1216 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1221 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1227 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1232 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1234 fEstEventMult = aType;
1237 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1239 if (aLabel < 0) return 0;
1240 AliAODMCParticle *aodP;
1242 if (aLabel > mcP->GetEntries())
1243 posstack = mcP->GetEntries();
1247 aodP = (AliAODMCParticle *) mcP->At(posstack);
1248 if (aodP->GetLabel() > posstack) {
1250 aodP = (AliAODMCParticle *) mcP->At(posstack);
1251 if (aodP->GetLabel() == aLabel) return aodP;
1254 while (posstack > 0);
1258 aodP = (AliAODMCParticle *) mcP->At(posstack);
1259 if (aodP->GetLabel() == aLabel) return aodP;
1262 while (posstack < mcP->GetEntries());
1268 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1269 AliFemtoTrack *tFemtoTrack)
1272 if (fDCAglobalTrack) {
1274 // code from Michael and Prabhat from AliAnalysisTaskDptDptCorrelations
1275 const AliAODVertex* vertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
1276 float vertexX = -999.;
1277 float vertexY = -999.;
1278 float vertexZ = -999.;
1282 vertex->GetCovarianceMatrix(fCov);
1283 if(vertex->GetNContributors() > 0) {
1285 vertexX = vertex->GetX();
1286 vertexY = vertex->GetY();
1287 vertexZ = vertex->GetZ();
1294 tAodTrack->GetXYZ(pos);
1296 Double_t DCAX = pos[0] - vertexX;
1297 Double_t DCAY = pos[1] - vertexY;
1298 Double_t DCAZ = pos[2] - vertexZ;
1300 Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1302 tFemtoTrack->SetImpactD(DCAXY);
1303 tFemtoTrack->SetImpactZ(DCAZ);
1306 // // // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1308 // double impact[2];
1309 // double covimpact[3];
1311 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
1312 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
1313 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1314 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1316 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1317 // //cout << "sth went wrong with dca propagation" << endl;
1318 // tFemtoTrack->SetImpactD(-1000.0);
1319 // tFemtoTrack->SetImpactZ(-1000.0);
1323 // tFemtoTrack->SetImpactD(impact[0]);
1324 // tFemtoTrack->SetImpactZ(impact[1]);
1326 // delete trk_clone;
1330 tAodTrack->GetPID(aodpid);
1331 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1332 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1333 tFemtoTrack->SetPidProbPion(aodpid[2]);
1334 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1335 tFemtoTrack->SetPidProbProton(aodpid[4]);
1337 aodpid[0] = -100000.0;
1338 aodpid[1] = -100000.0;
1339 aodpid[2] = -100000.0;
1340 aodpid[3] = -100000.0;
1341 aodpid[4] = -100000.0;
1344 Float_t probMis = 1.0;
1346 //what is that code? for what do we need it? nsigma values are not enough?
1347 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1348 tTOF = tAodTrack->GetTOFsignal();
1349 tAodTrack->GetIntegratedTimes(aodpid);
1351 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1353 probMis = fAODpidUtil->GetTOFMismatchProbability(tAodTrack);
1358 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1360 ////// TPC ////////////////////////////////////////////
1362 float nsigmaTPCK=-1000.;
1363 float nsigmaTPCPi=-1000.;
1364 float nsigmaTPCP=-1000.;
1365 float nsigmaTPCE=-1000.;
1367 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1369 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1370 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1371 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1372 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1373 nsigmaTPCE = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kElectron);
1376 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1377 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1378 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1379 tFemtoTrack->SetNSigmaTPCE(nsigmaTPCE);
1381 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1382 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1383 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1385 tFemtoTrack->SetTPCsignalN(1);
1386 tFemtoTrack->SetTPCsignalS(1);
1387 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1389 ///////TOF//////////////////////
1392 float nsigmaTOFPi=-1000.;
1393 float nsigmaTOFK=-1000.;
1394 float nsigmaTOFP=-1000.;
1395 float nsigmaTOFE=-1000.;
1397 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1398 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1399 (tAodTrack->GetStatus() & AliESDtrack::kTIME) //AliESDtrack::kTIME=0x80000000
1400 && probMis < 0.01) // TOF mismatch probaility
1402 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1405 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1406 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1407 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1408 nsigmaTOFE = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kElectron);
1410 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1411 Double_t tof=tAodTrack->GetTOFsignal();
1412 if(tof > 0.) vp=len/tof/0.03;
1415 tFemtoTrack->SetVTOF(vp);
1416 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1417 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1418 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1419 tFemtoTrack->SetNSigmaTOFE(nsigmaTOFE);
1422 //////////////////////////////////////
1426 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1428 fCentRange[0] = min; fCentRange[1] = max;
1430 fEstEventMult = kCentrality;
1433 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1435 if(anocent==false) {fEstEventMult=kCentrality;}
1436 else {fEstEventMult=kReference; fUsePreCent = 0; }
1439 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1441 fAODpidUtil = aAODpidUtil;
1442 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1445 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1447 fAODheader = aAODheader;
1451 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1461 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1466 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1468 // Gets the global position of the track at nine different radii in the TPC
1469 // track is the track you want to propagate
1470 // bfield is the magnetic field of your event
1471 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1473 // Initialize the array to something indicating there was no propagation
1474 for(Int_t i=0;i<9;i++){
1475 for(Int_t j=0;j<3;j++){
1476 globalPositionsAtRadii[i][j]=-9999.;
1480 // Make a copy of the track to not change parameters of the track
1481 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1482 //printf("\nAfter CopyFromVTrack\n");
1485 // The global position of the the track
1486 Double_t xyz[3]={-9999.,-9999.,-9999.};
1488 // Counter for which radius we want
1490 // The radii at which we get the global positions
1491 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1492 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1493 // The global radius we are at
1494 Float_t globalRadius=0;
1496 // Propagation is done in local x of the track
1497 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1498 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1499 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1500 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1501 // adds to the global radius
1503 // Stop if the propagation was not succesful. This can happen for low pt tracks
1504 // that don't reach outer radii
1505 if(!etp.PropagateTo(x,bfield))break;
1506 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1507 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1509 // Roughly reached the radius we want
1510 if(globalRadius > Rwanted[iR]){
1512 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1513 while (globalRadius>Rwanted[iR]){
1515 // printf("propagating to x %5.2f\n",x);
1516 if(!etp.PropagateTo(x,bfield))break;
1517 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1518 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1520 //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]);
1521 globalPositionsAtRadii[iR][0]=xyz[0];
1522 globalPositionsAtRadii[iR][1]=xyz[1];
1523 globalPositionsAtRadii[iR][2]=xyz[2];
1524 // Indicate we want the next radius
1534 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)
1539 void AliFemtoEventReaderAOD::SetUseMVPlpSelection(Bool_t mvplp)
1544 void AliFemtoEventReaderAOD::SetIsPileUpEvent(Bool_t ispileup)
1546 fisPileUp = ispileup;
1551 void AliFemtoEventReaderAOD::SetDCAglobalTrack(Bool_t dcagt)
1553 fDCAglobalTrack = dcagt;
1557 bool AliFemtoEventReaderAOD::RejectEventCentFlat(float MagField, float CentPercent)
1558 { // to flatten centrality distribution
1559 bool RejectEvent = kFALSE;
1561 TRandom3* fRandomNumber = new TRandom3(); //for 3D, random sign switching
1562 fRandomNumber->SetSeed(0);
1564 if(MagField > 0) weightBinSign = 0;
1565 else weightBinSign = 1;
1566 float kCentWeight[2][9] = {{.878,.876,.860,.859,.859,.88,.873,.879,.894},
1567 {.828,.793,.776,.772,.775,.796,.788,.804,.839}};
1568 int weightBinCent = (int) CentPercent;
1569 if(fRandomNumber->Rndm() > kCentWeight[weightBinSign][weightBinCent]) RejectEvent = kTRUE;
1574 void AliFemtoEventReaderAOD::SetCentralityFlattening(Bool_t dcagt)