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 = CopyAODtoFemtoV0(aodv0);
832 tEvent->V0Collection()->push_back(trackCopyV0);
834 //cout<<"Pushback v0 to v0collection"<<endl;
841 AliFemtoTrack* AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack
842 // AliPWG2AODTrack *tPWG2AODTrack
845 // Copy the track information from the AOD into the internal AliFemtoTrack
846 // If it exists, use the additional information from the PWG2 AOD
847 AliFemtoTrack *tFemtoTrack = new AliFemtoTrack();
849 // Primary Vertex position
851 fEvent->GetPrimaryVertex()->GetPosition(fV1);
852 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
853 tFemtoTrack->SetPrimaryVertex(fV1);
855 tFemtoTrack->SetCharge(tAodTrack->Charge());
858 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
860 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
861 tFemtoTrack->SetP(v);//setting momentum
862 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
863 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
864 //setting track helix
865 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
866 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
867 tFemtoTrack->SetHelix(helix);
870 tFemtoTrack->SetTrackId(tAodTrack->GetID());
871 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
872 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
874 // Track quality information
876 tAodTrack->GetCovMatrix(covmat);
878 if (!fDCAglobalTrack) {
880 tFemtoTrack->SetImpactD(tAodTrack->DCA());
881 tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
885 // double covimpact[3];
887 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
888 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
889 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
890 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
891 // //cout << "sth went wrong with dca propagation" << endl;
892 // tFemtoTrack->SetImpactD(-1000.0);
893 // tFemtoTrack->SetImpactZ(-1000.0);
897 // tFemtoTrack->SetImpactD(impact[0]);
898 // tFemtoTrack->SetImpactZ(impact[1]);
904 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
905 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
907 // tFemtoTrack->SetImpactD(0.0);
908 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
910 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
913 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
914 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
918 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
919 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
920 // << tAodTrack->Yv() - fV1[1]
921 // << "xv = " << tAodTrack->Xv() << endl
922 // << "fv1[0] = " << fV1[0] << endl
923 // << "yv = " << tAodTrack->Yv() << endl
924 // << "fv1[1] = " << fV1[1] << endl
925 // << "zv = " << tAodTrack->Zv() << endl
926 // << "fv1[2] = " << fV1[2] << endl
927 // << "impact[0] = " << impact[0] << endl
928 // << "impact[1] = " << impact[1] << endl
931 tFemtoTrack->SetCdd(covmat[0]);
932 tFemtoTrack->SetCdz(covmat[1]);
933 tFemtoTrack->SetCzz(covmat[2]);
934 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
935 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
936 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
937 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
938 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
939 tFemtoTrack->SetTPCsignalN(1);
940 tFemtoTrack->SetTPCsignalS(1);
941 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
943 // if (tPWG2AODTrack) {
944 // // Copy the PWG2 specific information if it exists
945 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
946 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
948 // double xtpc[3] = {0,0,0};
949 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
950 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
951 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
952 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
955 // If not use dummy values
956 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
957 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
959 float globalPositionsAtRadii[9][3];
960 float bfield = 5*fMagFieldSign;
962 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
963 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
964 double **tpcPositions;
965 tpcPositions = new double*[9];
967 tpcPositions[i] = new double[3];
968 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
971 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
972 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
973 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
976 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
977 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
978 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
980 delete [] tpcPositions[i];
981 delete [] tpcPositions;
984 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
988 for (int ik=0; ik<3; ik++) {
991 tFemtoTrack->SetKinkIndexes(indexes);
994 for (int ii=0; ii<6; ii++){
995 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
1001 AliFemtoV0* AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0 )
1003 AliFemtoV0 *tFemtoV0 = new AliFemtoV0();
1005 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
1006 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
1007 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
1008 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
1009 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
1010 tFemtoV0->SetdecayVertexV0(decayvertex);
1011 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
1012 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
1013 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
1014 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
1015 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
1016 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
1017 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
1018 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
1019 tFemtoV0->SetmomPos(mompos);
1020 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
1021 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
1022 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
1023 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
1024 tFemtoV0->SetmomNeg(momneg);
1026 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
1027 //void SettpcHitsPos(const int& i);
1028 //void SettpcHitsNeg(const int& i);
1030 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
1031 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
1034 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
1035 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
1036 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
1037 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
1038 tFemtoV0->SetmomV0(momv0);
1039 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
1040 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
1041 tFemtoV0->SeteLambda(tAODv0->ELambda());
1042 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
1043 tFemtoV0->SetePosProton(tAODv0->EPosProton());
1044 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
1045 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
1046 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
1047 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
1048 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
1049 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
1051 //void SetcTauLambda( float x);
1052 //void SetcTauK0Short( float x);
1054 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
1055 tFemtoV0->SetptV0(tAODv0->Pt());
1056 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
1057 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
1058 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
1059 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
1060 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
1062 tFemtoV0->SetidNeg(tAODv0->GetNegID());
1063 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
1064 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
1065 tFemtoV0->SetidPos(tAODv0->GetPosID());
1067 tFemtoV0->SetEtaV0(tAODv0->Eta());
1068 tFemtoV0->SetPhiV0(tAODv0->Phi());
1069 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
1070 //tFemtoV0->SetYV0(tAODv0->Y());
1073 //void SetdedxNeg(float x);
1074 //void SeterrdedxNeg(float x);//Gael 04Fev2002
1075 //void SetlendedxNeg(float x);//Gael 04Fev2002
1076 //void SetdedxPos(float x);
1077 //void SeterrdedxPos(float x);//Gael 04Fev2002
1078 //void SetlendedxPos(float x);//Gael 04Fev2002
1080 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
1081 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
1083 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
1084 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
1087 if(trackpos && trackneg)
1089 tFemtoV0->SetEtaPos(trackpos->Eta());
1090 tFemtoV0->SetEtaNeg(trackneg->Eta());
1091 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1092 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1093 tFemtoV0->SetptPos(trackpos->Pt());
1094 tFemtoV0->SetptNeg(trackneg->Pt());
1096 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1097 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1098 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1099 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1100 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1101 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1102 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1103 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1104 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1105 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1106 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1107 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1109 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1110 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1111 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1112 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1113 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1114 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1117 float bfield = 5*fMagFieldSign;
1118 float globalPositionsAtRadiiPos[9][3];
1119 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1120 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1121 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1123 float globalPositionsAtRadiiNeg[9][3];
1124 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1125 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1126 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1128 AliFemtoThreeVector tmpVec;
1129 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetY(tpcEntrancePos[1]); tmpVec.SetZ(tpcEntrancePos[2]);
1130 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1132 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetY(tpcExitPos[1]); tmpVec.SetZ(tpcExitPos[2]);
1133 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1135 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetY(tpcEntranceNeg[1]); tmpVec.SetZ(tpcEntranceNeg[2]);
1136 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1138 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetY(tpcExitNeg[1]); tmpVec.SetZ(tpcExitNeg[2]);
1139 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1142 AliFemtoThreeVector vecTpcPos[9];
1143 AliFemtoThreeVector vecTpcNeg[9];
1144 for(int i=0;i<9;i++)
1146 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1147 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1149 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1150 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1152 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1153 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1155 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1156 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1159 Float_t probMisPos = 1.0;
1160 Float_t probMisNeg = 1.0;
1162 if (tFemtoV0->StatusPos() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1163 probMisPos = fAODpidUtil->GetTOFMismatchProbability(trackpos);
1165 if (tFemtoV0->StatusNeg() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1166 probMisNeg = fAODpidUtil->GetTOFMismatchProbability(trackneg);
1169 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 || probMisPos > 0.01)
1171 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 || probMisNeg > 0.01)
1173 tFemtoV0->SetPosNSigmaTOFK(-1000);
1174 tFemtoV0->SetNegNSigmaTOFK(-1000);
1175 tFemtoV0->SetPosNSigmaTOFP(-1000);
1176 tFemtoV0->SetNegNSigmaTOFP(-1000);
1177 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1178 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1180 tFemtoV0->SetTOFProtonTimePos(-1000);
1181 tFemtoV0->SetTOFPionTimePos(-1000);
1182 tFemtoV0->SetTOFKaonTimePos(-1000);
1183 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1184 tFemtoV0->SetTOFPionTimeNeg(-1000);
1185 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1190 if(trackpos->IsOn(AliESDtrack::kTOFpid)) {
1191 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1192 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1193 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1195 if(trackneg->IsOn(AliESDtrack::kTOFpid)) {
1196 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1197 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1198 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1200 double TOFSignalPos = trackpos->GetTOFsignal();
1201 double TOFSignalNeg = trackneg->GetTOFsignal();
1202 TOFSignalPos -= fAODpidUtil->GetTOFResponse().GetStartTime(trackpos->P());
1203 TOFSignalNeg -= fAODpidUtil->GetTOFResponse().GetStartTime(trackneg->P());
1206 trackpos->GetIntegratedTimes(pidPos);
1207 trackneg->GetIntegratedTimes(pidNeg);
1209 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1210 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1211 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1212 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1213 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1214 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1221 tFemtoV0->SetStatusPos(999);
1222 tFemtoV0->SetStatusNeg(999);
1225 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1229 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1231 fFilterBit = (1 << (ibit));
1235 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1240 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1246 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1251 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1253 fEstEventMult = aType;
1256 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1258 if (aLabel < 0) return 0;
1259 AliAODMCParticle *aodP;
1261 if (aLabel > mcP->GetEntries())
1262 posstack = mcP->GetEntries();
1266 aodP = (AliAODMCParticle *) mcP->At(posstack);
1267 if (aodP->GetLabel() > posstack) {
1269 aodP = (AliAODMCParticle *) mcP->At(posstack);
1270 if (aodP->GetLabel() == aLabel) return aodP;
1273 while (posstack > 0);
1277 aodP = (AliAODMCParticle *) mcP->At(posstack);
1278 if (aodP->GetLabel() == aLabel) return aodP;
1281 while (posstack < mcP->GetEntries());
1287 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1288 AliFemtoTrack *tFemtoTrack)
1291 if (fDCAglobalTrack) {
1293 // code from Michael and Prabhat from AliAnalysisTaskDptDptCorrelations
1294 const AliAODVertex* vertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
1295 float vertexX = -999.;
1296 float vertexY = -999.;
1297 float vertexZ = -999.;
1301 vertex->GetCovarianceMatrix(fCov);
1302 if(vertex->GetNContributors() > 0) {
1304 vertexX = vertex->GetX();
1305 vertexY = vertex->GetY();
1306 vertexZ = vertex->GetZ();
1313 tAodTrack->GetXYZ(pos);
1315 Double_t DCAX = pos[0] - vertexX;
1316 Double_t DCAY = pos[1] - vertexY;
1317 Double_t DCAZ = pos[2] - vertexZ;
1319 Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1321 tFemtoTrack->SetImpactD(DCAXY);
1322 tFemtoTrack->SetImpactZ(DCAZ);
1325 // // // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1327 // double impact[2];
1328 // double covimpact[3];
1330 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
1331 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
1332 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1333 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1335 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1336 // //cout << "sth went wrong with dca propagation" << endl;
1337 // tFemtoTrack->SetImpactD(-1000.0);
1338 // tFemtoTrack->SetImpactZ(-1000.0);
1342 // tFemtoTrack->SetImpactD(impact[0]);
1343 // tFemtoTrack->SetImpactZ(impact[1]);
1345 // delete trk_clone;
1349 tAodTrack->GetPID(aodpid);
1350 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1351 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1352 tFemtoTrack->SetPidProbPion(aodpid[2]);
1353 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1354 tFemtoTrack->SetPidProbProton(aodpid[4]);
1356 aodpid[0] = -100000.0;
1357 aodpid[1] = -100000.0;
1358 aodpid[2] = -100000.0;
1359 aodpid[3] = -100000.0;
1360 aodpid[4] = -100000.0;
1363 Float_t probMis = 1.0;
1365 //what is that code? for what do we need it? nsigma values are not enough?
1366 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1367 tTOF = tAodTrack->GetTOFsignal();
1368 tAodTrack->GetIntegratedTimes(aodpid);
1370 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1372 probMis = fAODpidUtil->GetTOFMismatchProbability(tAodTrack);
1377 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1379 ////// TPC ////////////////////////////////////////////
1381 float nsigmaTPCK=-1000.;
1382 float nsigmaTPCPi=-1000.;
1383 float nsigmaTPCP=-1000.;
1384 float nsigmaTPCE=-1000.;
1386 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1388 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1389 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1390 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1391 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1392 nsigmaTPCE = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kElectron);
1395 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1396 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1397 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1398 tFemtoTrack->SetNSigmaTPCE(nsigmaTPCE);
1400 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1401 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1402 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1404 tFemtoTrack->SetTPCsignalN(1);
1405 tFemtoTrack->SetTPCsignalS(1);
1406 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1408 ///////TOF//////////////////////
1411 float nsigmaTOFPi=-1000.;
1412 float nsigmaTOFK=-1000.;
1413 float nsigmaTOFP=-1000.;
1414 float nsigmaTOFE=-1000.;
1416 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1417 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1418 (tAodTrack->GetStatus() & AliESDtrack::kTIME) //AliESDtrack::kTIME=0x80000000
1419 && probMis < 0.01) // TOF mismatch probaility
1421 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1424 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1425 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1426 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1427 nsigmaTOFE = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kElectron);
1429 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1430 Double_t tof=tAodTrack->GetTOFsignal();
1431 if(tof > 0.) vp=len/tof/0.03;
1434 tFemtoTrack->SetVTOF(vp);
1435 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1436 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1437 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1438 tFemtoTrack->SetNSigmaTOFE(nsigmaTOFE);
1441 //////////////////////////////////////
1445 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1447 fCentRange[0] = min; fCentRange[1] = max;
1449 fEstEventMult = kCentrality;
1452 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1454 if(anocent==false) {fEstEventMult=kCentrality;}
1455 else {fEstEventMult=kReference; fUsePreCent = 0; }
1458 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1460 fAODpidUtil = aAODpidUtil;
1461 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1464 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1466 fAODheader = aAODheader;
1470 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1480 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1485 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1487 // Gets the global position of the track at nine different radii in the TPC
1488 // track is the track you want to propagate
1489 // bfield is the magnetic field of your event
1490 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1492 // Initialize the array to something indicating there was no propagation
1493 for(Int_t i=0;i<9;i++){
1494 for(Int_t j=0;j<3;j++){
1495 globalPositionsAtRadii[i][j]=-9999.;
1499 // Make a copy of the track to not change parameters of the track
1500 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1501 //printf("\nAfter CopyFromVTrack\n");
1504 // The global position of the the track
1505 Double_t xyz[3]={-9999.,-9999.,-9999.};
1507 // Counter for which radius we want
1509 // The radii at which we get the global positions
1510 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1511 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1512 // The global radius we are at
1513 Float_t globalRadius=0;
1515 // Propagation is done in local x of the track
1516 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1517 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1518 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1519 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1520 // adds to the global radius
1522 // Stop if the propagation was not succesful. This can happen for low pt tracks
1523 // that don't reach outer radii
1524 if(!etp.PropagateTo(x,bfield))break;
1525 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1526 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1528 // Roughly reached the radius we want
1529 if(globalRadius > Rwanted[iR]){
1531 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1532 while (globalRadius>Rwanted[iR]){
1534 // printf("propagating to x %5.2f\n",x);
1535 if(!etp.PropagateTo(x,bfield))break;
1536 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1537 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1539 //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]);
1540 globalPositionsAtRadii[iR][0]=xyz[0];
1541 globalPositionsAtRadii[iR][1]=xyz[1];
1542 globalPositionsAtRadii[iR][2]=xyz[2];
1543 // Indicate we want the next radius
1553 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)
1558 void AliFemtoEventReaderAOD::SetUseMVPlpSelection(Bool_t mvplp)
1563 void AliFemtoEventReaderAOD::SetIsPileUpEvent(Bool_t ispileup)
1565 fisPileUp = ispileup;
1570 void AliFemtoEventReaderAOD::SetDCAglobalTrack(Bool_t dcagt)
1572 fDCAglobalTrack = dcagt;
1576 bool AliFemtoEventReaderAOD::RejectEventCentFlat(float MagField, float CentPercent)
1577 { // to flatten centrality distribution
1578 bool RejectEvent = kFALSE;
1580 TRandom3* fRandomNumber = new TRandom3(); //for 3D, random sign switching
1581 fRandomNumber->SetSeed(0);
1583 if(MagField > 0) weightBinSign = 0;
1584 else weightBinSign = 1;
1585 float kCentWeight[2][9] = {{.878,.876,.860,.859,.859,.88,.873,.879,.894},
1586 {.828,.793,.776,.772,.775,.796,.788,.804,.839}};
1587 int weightBinCent = (int) CentPercent;
1588 if(fRandomNumber->Rndm() > kCentWeight[weightBinSign][weightBinCent]) RejectEvent = kTRUE;
1589 delete fRandomNumber;
1593 void AliFemtoEventReaderAOD::SetCentralityFlattening(Bool_t dcagt)