1 ////////////////////////////////////////////////////////////////////////////////
3 // AliFemtoEventReaderAOD - the reader class for the Alice AOD //
4 // Reads in AOD information and converts it into internal AliFemtoEvent //
5 // Authors: Marek Chojnacki mchojnacki@knf.pw.edu.pl //
6 // Adam Kisiel kisiel@mps.ohio-state.edu //
8 ////////////////////////////////////////////////////////////////////////////////
10 #include "AliFemtoEventReaderAOD.h"
15 #include "AliAODEvent.h"
16 #include "AliAODTrack.h"
17 #include "AliAODVertex.h"
18 #include "AliAODMCHeader.h"
19 #include "AliESDtrack.h"
21 #include "AliFmPhysicalHelixD.h"
22 #include "AliFmThreeVectorF.h"
24 #include "SystemOfUnits.h"
26 #include "AliFemtoEvent.h"
27 #include "AliFemtoModelHiddenInfo.h"
28 #include "AliFemtoModelGlobalHiddenInfo.h"
31 #include "AliAODpidUtil.h"
32 #include "AliAnalysisUtils.h"
34 ClassImp(AliFemtoEventReaderAOD)
36 #if !(ST_NO_NAMESPACES)
37 using namespace units;
44 //____________________________
45 //constructor with 0 parameters , look at default settings
46 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD():
54 // fPWG2AODTracks(0x0),
58 fEstEventMult(kCentrality),
72 fDCAglobalTrack(kFALSE),
75 // default constructor
76 fAllTrue.ResetAllBits(kTRUE);
77 fAllFalse.ResetAllBits(kFALSE);
82 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(const AliFemtoEventReaderAOD &aReader) :
83 AliFemtoEventReader(),
91 // fPWG2AODTracks(0x0),
95 fEstEventMult(kCentrality),
108 fMinPlpContribSPD(0),
109 fDCAglobalTrack(kFALSE),
113 fReadMC = aReader.fReadMC;
114 fReadV0 = aReader.fReadV0;
115 fInputFile = aReader.fInputFile;
116 fNumberofEvent = aReader.fNumberofEvent;
117 fCurEvent = aReader.fCurEvent;
118 fEvent = new AliAODEvent();
119 fAodFile = new TFile(aReader.fAodFile->GetName());
120 fAllTrue.ResetAllBits(kTRUE);
121 fAllFalse.ResetAllBits(kFALSE);
122 fFilterBit = aReader.fFilterBit;
123 // fPWG2AODTracks = aReader.fPWG2AODTracks;
124 fAODpidUtil = aReader.fAODpidUtil;
125 fAODheader = aReader.fAODheader;
126 fCentRange[0] = aReader.fCentRange[0];
127 fCentRange[1] = aReader.fCentRange[1];
128 fEstEventMult = aReader.fEstEventMult;
129 fUsePreCent = aReader.fUsePreCent;
130 fpA2013 = aReader.fpA2013;
131 fisPileUp = aReader.fisPileUp;
132 fMVPlp = aReader.fMVPlp;
133 fMinVtxContr = aReader.fMinVtxContr;
134 fMinPlpContribMV = aReader.fMinPlpContribMV;
135 fMinPlpContribSPD = aReader.fMinPlpContribSPD;
136 fDCAglobalTrack = aReader.fDCAglobalTrack;
141 AliFemtoEventReaderAOD::~AliFemtoEventReaderAOD()
147 // if (fPWG2AODTracks) {
148 // fPWG2AODTracks->Delete();
149 // delete fPWG2AODTracks;
154 AliFemtoEventReaderAOD& AliFemtoEventReaderAOD::operator=(const AliFemtoEventReaderAOD& aReader)
156 // assignment operator
157 if (this == &aReader)
160 fInputFile = aReader.fInputFile;
161 fNumberofEvent = aReader.fNumberofEvent;
162 fCurEvent = aReader.fCurEvent;
163 if (fTree) delete fTree;
164 if (fEvent) delete fEvent;
165 fEvent = new AliAODEvent();
166 if (fAodFile) delete fAodFile;
167 fAodFile = new TFile(aReader.fAodFile->GetName());
168 fAllTrue.ResetAllBits(kTRUE);
169 fAllFalse.ResetAllBits(kFALSE);
170 fFilterBit = aReader.fFilterBit;
171 fFilterMask = aReader.fFilterMask;
172 // fPWG2AODTracks = aReader.fPWG2AODTracks;
173 fAODpidUtil = aReader.fAODpidUtil;
174 fAODheader = aReader.fAODheader;
175 fCentRange[0] = aReader.fCentRange[0];
176 fCentRange[1] = aReader.fCentRange[1];
177 fUsePreCent = aReader.fUsePreCent;
178 fEstEventMult = aReader.fEstEventMult;
179 fpA2013 = aReader.fpA2013;
180 fisPileUp = aReader.fisPileUp;
181 fMVPlp = aReader.fMVPlp;
182 fMinVtxContr = aReader.fMinVtxContr;
183 fMinPlpContribMV = aReader.fMinPlpContribMV;
184 fMinPlpContribSPD = aReader.fMinPlpContribSPD;
185 fDCAglobalTrack = aReader.fDCAglobalTrack;
186 fFlatCent= aReader.fFlatCent;
191 AliFemtoString AliFemtoEventReaderAOD::Report()
193 // create reader report
194 AliFemtoString temp = "\n This is the AliFemtoEventReaderAOD\n";
199 void AliFemtoEventReaderAOD::SetInputFile(const char* inputFile)
201 //setting the name of file where names of AOD file are written
202 //it takes only this files which have good trees
204 fInputFile=string(inputFile);
205 ifstream infile(inputFile);
207 fTree = new TChain("aodTree");
209 if(infile.good()==true)
211 //checking if all give files have good tree inside
212 while (infile.eof()==false)
214 infile.getline(buffer,256);
215 TFile *aodFile=TFile::Open(buffer,"READ");
218 TTree* tree = (TTree*) aodFile->Get("aodTree");
221 // cout<<"putting file "<<string(buffer)<<" into analysis"<<endl;
222 fTree->AddFile(buffer);
232 AliFemtoEvent* AliFemtoEventReaderAOD::ReturnHbtEvent()
234 // read in a next hbt event from the chain
235 // convert it to AliFemtoEvent and return
236 // for further analysis
237 AliFemtoEvent *hbtEvent = 0;
238 // cout<<"reader"<<endl;
239 if (fCurEvent==fNumberofEvent)//open next file
241 if(fNumberofEvent==0)
243 fEvent=new AliAODEvent();
244 fEvent->ReadFromTree(fTree);
246 // Check for the existence of the additional information
247 // fPWG2AODTracks = (TClonesArray *) fEvent->GetList()->FindObject("pwg2aodtracks");
249 // if (fPWG2AODTracks) {
250 // cout << "Found additional PWG2 specific information in the AOD!" << endl;
251 // cout << "Reading only tracks with the additional information" << endl;
254 fNumberofEvent=fTree->GetEntries();
255 // cout<<"Number of Entries in file "<<fNumberofEvent<<endl;
258 else //no more data to read
260 // cout<<"no more files "<<hbtEvent<<endl;
266 // cout<<"starting to read event "<<fCurEvent<<endl;
267 fTree->GetEvent(fCurEvent);//getting next event
268 // cout << "Read event " << fEvent << " from file " << fTree << endl;
270 hbtEvent = new AliFemtoEvent;
272 CopyAODtoFemtoEvent(hbtEvent);
279 void AliFemtoEventReaderAOD::CopyAODtoFemtoEvent(AliFemtoEvent *tEvent)
282 // A function that reads in the AOD event
283 // and transfers the neccessary information into
284 // the internal AliFemtoEvent
286 // setting global event characteristics
287 tEvent->SetRunNumber(fEvent->GetRunNumber());
288 tEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
289 tEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
290 tEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
291 tEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
292 tEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
293 tEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy(0));
294 tEvent->SetZDCParticipants(0);
295 tEvent->SetTriggerMask(fEvent->GetTriggerMask());
296 tEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
298 // Attempt to access MC header
302 mcH = (AliAODMCHeader *) fEvent->FindListObject(AliAODMCHeader::StdBranchName());
304 cout << "AOD MC information requested, but no header found!" << endl;
307 mcP = (TClonesArray *) fEvent->FindListObject(AliAODMCParticle::StdBranchName());
309 cout << "AOD MC information requested, but no particle array found!" << endl;
313 tEvent->SetReactionPlaneAngle(fEvent->GetHeader()->GetQTheta(0)/2.0);
317 const int motherTabSize = ((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel();
318 motherids = new int[motherTabSize+1];
319 for (int ip=0; ip<motherTabSize+1; ip++) motherids[ip] = 0;
321 // Read in mother ids
322 AliAODMCParticle *motherpart;
323 for (int ip=0; ip<mcP->GetEntries(); ip++) {
324 motherpart = (AliAODMCParticle *) mcP->At(ip);
325 if (motherpart->GetDaughter(0) > 0)
326 motherids[motherpart->GetDaughter(0)] = ip;
327 if (motherpart->GetDaughter(1) > 0)
328 motherids[motherpart->GetDaughter(1)] = ip;
333 if(fisPileUp||fpA2013)
335 AliAnalysisUtils *anaUtil=new AliAnalysisUtils();
337 anaUtil->SetMinVtxContr(fMinVtxContr);
339 if(anaUtil->IsVertexSelected2013pA(fEvent)==kFALSE) return; //Vertex rejection for pA analysis.
340 if(fMVPlp) anaUtil->SetUseMVPlpSelection(kTRUE);
341 else anaUtil->SetUseMVPlpSelection(kFALSE);
342 if(fMinPlpContribMV) anaUtil->SetMinPlpContribMV(fMinPlpContribMV);
343 if(fMinPlpContribSPD) anaUtil->SetMinPlpContribSPD(fMinPlpContribSPD);
345 if(anaUtil->IsPileUpEvent(fEvent)) return; //Pile-up rejection.
349 // Primary Vertex position
350 const AliAODVertex* aodvertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
351 if(!aodvertex || aodvertex->GetNContributors() < 1) return; //Bad vertex, skip event.
353 aodvertex->GetPosition(fV1);
354 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
355 tEvent->SetPrimVertPos(vertex);
357 //starting to reading tracks
358 int nofTracks=0; //number of reconstructed tracks in event
360 nofTracks=fEvent->GetNumberOfTracks();
362 AliEventplane *ep = fEvent->GetEventplane();
366 tEvent->SetReactionPlaneAngle(ep->GetEventplane("V0",fEvent,2));
368 tEvent->SetReactionPlaneAngle(ep->GetEventplane("Q"));
371 AliCentrality *cent = fEvent->GetCentrality();
373 if (!fEstEventMult && cent && fUsePreCent) {
374 if ((cent->GetCentralityPercentile("V0M")*10 < fCentRange[0]) ||
375 (cent->GetCentralityPercentile("V0M")*10 > fCentRange[1]))
377 // cout << "Centrality " << cent->GetCentralityPercentile("V0M") << " outside of preselection range " << fCentRange[0] << " - " << fCentRange[1] << endl;
383 float percent = cent->GetCentralityPercentile("V0M");
384 //flatten centrality dist.
387 if(RejectEventCentFlat(fEvent->GetMagneticField(),percent)) return;
391 int realnofTracks=0; // number of track which we use in a analysis
395 for (int il=0; il<20000; il++) labels[il] = -1;
397 // looking for global tracks and saving their numbers to copy from them PID information to TPC-only tracks in the main loop over tracks
398 for (int i=0;i<nofTracks;i++) {
399 const AliAODTrack *aodtrack=fEvent->GetTrack(i);
400 if (!aodtrack->TestFilterBit(fFilterBit)) {
401 if(aodtrack->GetID() < 0) continue;
402 labels[aodtrack->GetID()] = i;
407 for (int i=0;i<nofTracks;i++)
409 AliFemtoTrack* trackCopy = new AliFemtoTrack();
411 // if (fPWG2AODTracks) {
412 // // Read tracks from the additional pwg2 specific AOD part
414 // // Note that in that case all the AOD tracks without the
415 // // additional information will be ignored !
416 // AliPWG2AODTrack *pwg2aodtrack = (AliPWG2AODTrack *) fPWG2AODTracks->At(i);
418 // // Getting the AOD track through the ref of the additional info
419 // AliAODTrack *aodtrack = pwg2aodtrack->GetRefAODTrack();
420 // if (!aodtrack->TestFilterBit(fFilterBit)) {
426 // if (aodtrack->IsOn(AliESDtrack::kTPCrefit))
427 // if (aodtrack->Chi2perNDF() < 6.0)
428 // if (aodtrack->Eta() < 0.9)
432 // CopyAODtoFemtoTrack(aodtrack, trackCopy, pwg2aodtrack);
435 // // Fill the hidden information with the simulated data
436 // // Int_t pLabel = aodtrack->GetLabel();
437 // AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
439 // // Check the mother information
441 // // Using the new way of storing the freeze-out information
442 // // Final state particle is stored twice on the stack
443 // // one copy (mother) is stored with original freeze-out information
444 // // and is not tracked
445 // // the other one (daughter) is stored with primary vertex position
448 // // Freeze-out coordinates
449 // double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
450 // fpx = tPart->Xv() - fV1[0];
451 // fpy = tPart->Yv() - fV1[1];
452 // fpz = tPart->Zv() - fV1[2];
455 // AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
456 // tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
463 // // cout << "Looking for mother ids " << endl;
464 // if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
465 // // cout << "Got mother id" << endl;
466 // AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
467 // // Check if this is the same particle stored twice on the stack
468 // if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
469 // // It is the same particle
470 // // Read in the original freeze-out information
471 // // and convert it from to [fm]
474 // // fpx = mother->Xv()*1e13*0.197327;
475 // // fpy = mother->Yv()*1e13*0.197327;
476 // // fpz = mother->Zv()*1e13*0.197327;
477 // // fpt = mother->T() *1e13*0.197327*0.5;
480 // // Therminator style
481 // fpx = mother->Xv()*1e13;
482 // fpy = mother->Yv()*1e13;
483 // fpz = mother->Zv()*1e13;
484 // fpt = mother->T() *1e13*3e10;
489 // // if (fRotateToEventPlane) {
490 // // double tPhi = TMath::ATan2(fpy, fpx);
491 // // double tRad = TMath::Hypot(fpx, fpy);
493 // // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
494 // // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
497 // tInfo->SetPDGPid(tPart->GetPdgCode());
499 // // if (fRotateToEventPlane) {
500 // // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
501 // // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
503 // // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
504 // // tRad*TMath::Sin(tPhi - tReactionPlane),
508 // tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
509 // Double_t mass2 = (tPart->E() *tPart->E() -
510 // tPart->Px()*tPart->Px() -
511 // tPart->Py()*tPart->Py() -
512 // tPart->Pz()*tPart->Pz());
514 // tInfo->SetMass(TMath::Sqrt(mass2));
516 // tInfo->SetMass(0.0);
518 // tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
519 // trackCopy->SetHiddenInfo(tInfo);
524 // aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
525 // const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
526 // // Check the sanity of the tracks - reject zero momentum tracks
527 // if (ktP.Mag() == 0) {
533 // No additional information exists
534 // Read in the normal AliAODTracks
536 // const AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
537 AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
541 if (aodtrack->IsPrimaryCandidate()) tracksPrim++;
543 if (fFilterBit && !aodtrack->TestFilterBit(fFilterBit)) {
548 if (fFilterMask && !aodtrack->TestFilterBit(fFilterMask)) {
553 // cout << "Muon? " << aodtrack->IsMuonTrack() << endl;
554 // cout << "Type? " << aodtrack->GetType() << endl;
556 // if (aodtrack->IsMuonTrack()) {
557 // cout << "muon" << endl;
562 //counting particles to set multiplicity
563 if(fEstEventMult==kGlobalCount){
564 AliAODTrack* trk_clone = (AliAODTrack*)aodtrack->Clone("trk_clone"); //no DCA cut for global count
565 //if (aodtrack->IsPrimaryCandidate()) //? instead of kinks?
566 if (aodtrack->Chi2perNDF() < 4.0)
567 if (aodtrack->Pt() > 0.15 && aodtrack->Pt() < 20)
568 if (aodtrack->GetTPCNcls() > 70)
569 if (aodtrack->Eta() < 0.8)
574 CopyAODtoFemtoTrack(aodtrack, trackCopy);
576 // copying PID information from the correspondent track
577 // const AliAODTrack *aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
580 AliAODTrack *aodtrackpid;
581 if((fFilterBit == (1 << (7))) || fFilterMask == 128) {//for TPC Only tracks we have to copy PID information from corresponding global tracks
582 aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
585 aodtrackpid = fEvent->GetTrack(i);
588 CopyPIDtoFemtoTrack(aodtrackpid, trackCopy);
591 // Fill the hidden information with the simulated data
592 // Int_t pLabel = aodtrack->GetLabel();
593 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
595 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
596 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
601 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
603 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
604 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
608 // Check the mother information
610 // Using the new way of storing the freeze-out information
611 // Final state particle is stored twice on the stack
612 // one copy (mother) is stored with original freeze-out information
613 // and is not tracked
614 // the other one (daughter) is stored with primary vertex position
617 // Freeze-out coordinates
618 fpx = tPart->Xv() - fV1[0];
619 fpy = tPart->Yv() - fV1[1];
620 fpz = tPart->Zv() - fV1[2];
623 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
631 // cout << "Looking for mother ids " << endl;
632 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
633 // cout << "Got mother id" << endl;
634 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
635 // Check if this is the same particle stored twice on the stack
637 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
638 // It is the same particle
639 // Read in the original freeze-out information
640 // and convert it from to [fm]
643 // fpx = mother->Xv()*1e13*0.197327;
644 // fpy = mother->Yv()*1e13*0.197327;
645 // fpz = mother->Zv()*1e13*0.197327;
646 // fpt = mother->T() *1e13*0.197327*0.5;
650 fpx = mother->Xv()*1e13;
651 fpy = mother->Yv()*1e13;
652 fpz = mother->Zv()*1e13;
653 // fpt = mother->T() *1e13*3e10;
659 // if (fRotateToEventPlane) {
660 // double tPhi = TMath::ATan2(fpy, fpx);
661 // double tRad = TMath::Hypot(fpx, fpy);
663 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
664 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
667 tInfo->SetPDGPid(tPart->GetPdgCode());
669 // if (fRotateToEventPlane) {
670 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
671 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
673 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
674 // tRad*TMath::Sin(tPhi - tReactionPlane),
678 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
679 Double_t mass2 = (tPart->E() *tPart->E() -
680 tPart->Px()*tPart->Px() -
681 tPart->Py()*tPart->Py() -
682 tPart->Pz()*tPart->Pz());
684 tInfo->SetMass(TMath::Sqrt(mass2));
688 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
691 // //if (TMath::Abs(impact[0]) > 0.001) {
692 // if (tPart->IsPhysicalPrimary()){
693 // tInfo->SetPartOrigin(0);
694 // // trackCopy->SetImpactDprim(impact[0]);
695 // //cout << "Read prim" << endl;
697 // else if (tPart->IsSecondaryFromWeakDecay()) {
698 // tInfo->SetPartOrigin(1);
699 // // trackCopy->SetImpactDweak(impact[0]);
700 // //cout << "Read wea" << endl;
702 // else if (tPart->IsSecondaryFromMaterial()) {
703 // tInfo->SetPartOrigin(2);
704 // // trackCopy->SetImpactDmat(impact[0]);
705 // //cout << "Read mat" << endl;
712 trackCopy->SetHiddenInfo(tInfo);
717 //AliExternalTrackParam *param = new AliExternalTrackParam(*aodtrack->GetInnerParam());
718 trackCopy->SetInnerMomentum(aodtrack->GetTPCmomentum());
720 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
721 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
722 // Check the sanity of the tracks - reject zero momentum tracks
723 if (ktP.Mag() == 0) {
729 tEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
730 realnofTracks++;//real number of tracks
733 tEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
734 tEvent->SetNormalizedMult(tracksPrim);
737 tEvent->SetCentralityV0(cent->GetCentralityPercentile("V0M"));
738 tEvent->SetCentralityV0A(cent->GetCentralityPercentile("V0A"));
739 tEvent->SetCentralityV0C(cent->GetCentralityPercentile("V0C"));
740 tEvent->SetCentralityZNA(cent->GetCentralityPercentile("ZNA"));
741 tEvent->SetCentralityZNC(cent->GetCentralityPercentile("ZNC"));
742 tEvent->SetCentralityCL1(cent->GetCentralityPercentile("CL1"));
743 tEvent->SetCentralityCL0(cent->GetCentralityPercentile("CL0"));
744 tEvent->SetCentralityTKL(cent->GetCentralityPercentile("TKL"));
745 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("FMD"));
746 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("NPA"));
747 // tEvent->SetCentralitySPD1(cent->GetCentralityPercentile("CL1"));
748 tEvent->SetCentralityTrk(cent->GetCentralityPercentile("TRK"));
749 tEvent->SetCentralityCND(cent->GetCentralityPercentile("CND"));
752 if (fEstEventMult==kCentrality) {
753 //AliCentrality *cent = fEvent->GetCentrality();
754 //cout<<"AliFemtoEventReaderAOD:"<<lrint(10*cent->GetCentralityPercentile("V0M"))<<endl;
755 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0M")));
756 // if (cent) tEvent->SetNormalizedMult((int) cent->GetCentralityPercentile("V0M"));
758 else if (fEstEventMult==kCentralityV0A) {
759 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0A")));
761 else if (fEstEventMult==kCentralityV0C) {
762 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0C")));
764 else if (fEstEventMult==kCentralityZNA) {
765 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNA")));
767 else if (fEstEventMult==kCentralityZNC) {
768 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNC")));
770 else if (fEstEventMult==kCentralityCL1) {
771 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL1")));
773 else if (fEstEventMult==kCentralityCL0) {
774 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL0")));
776 else if (fEstEventMult==kCentralityTRK) {
777 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TRK")));
779 else if (fEstEventMult==kCentralityTKL) {
780 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TKL")));
782 else if (fEstEventMult==kCentralityCND) {
783 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CND")));
785 else if (fEstEventMult==kCentralityNPA) {
786 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("NPA")));
788 else if (fEstEventMult==kCentralityFMD) {
789 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("FMD")));
791 else if(fEstEventMult==kGlobalCount){
792 tEvent->SetNormalizedMult(tNormMult); //particles counted in the loop, trying to reproduce GetReferenceMultiplicity. If better (default) method appears it should be changed
794 else if(fEstEventMult==kReference)
796 tEvent->SetNormalizedMult(fAODheader->GetRefMultiplicity());
798 else if(fEstEventMult==kTPCOnlyRef)
800 tEvent->SetNormalizedMult(fAODheader->GetTPConlyRefMultiplicity());
802 else if(fEstEventMult == kVZERO)
805 for (Int_t i=0; i<64; i++)
806 multV0 += fEvent->GetVZEROData()->GetMultiplicity(i);
807 tEvent->SetNormalizedMult(multV0);
810 if (mcP) delete [] motherids;
812 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
817 for (Int_t i = 0; i < fEvent->GetNumberOfV0s(); i++) {
818 AliAODv0* aodv0 = fEvent->GetV0(i);
819 if (!aodv0) continue;
820 if(aodv0->GetNDaughters()>2) continue;
821 if(aodv0->GetNProngs()>2) continue;
822 if(aodv0->GetCharge()!=0) continue;
823 if(aodv0->ChargeProng(0)==aodv0->ChargeProng(1)) continue;
824 if(aodv0->CosPointingAngle(fV1)<0.998) continue;
825 AliFemtoV0* trackCopyV0 = new AliFemtoV0();
827 CopyAODtoFemtoV0(aodv0, trackCopyV0);
828 tEvent->V0Collection()->push_back(trackCopyV0);
829 //cout<<"Pushback v0 to v0collection"<<endl;
835 void AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack,
836 AliFemtoTrack *tFemtoTrack
837 // AliPWG2AODTrack *tPWG2AODTrack
840 // Copy the track information from the AOD into the internal AliFemtoTrack
841 // If it exists, use the additional information from the PWG2 AOD
843 // Primary Vertex position
845 fEvent->GetPrimaryVertex()->GetPosition(fV1);
846 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
848 tFemtoTrack->SetCharge(tAodTrack->Charge());
851 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
853 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
854 tFemtoTrack->SetP(v);//setting momentum
855 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
856 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
857 //setting track helix
858 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
859 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
860 tFemtoTrack->SetHelix(helix);
863 tFemtoTrack->SetTrackId(tAodTrack->GetID());
864 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
865 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
867 // Track quality information
869 tAodTrack->GetCovMatrix(covmat);
871 if (!fDCAglobalTrack) {
873 tFemtoTrack->SetImpactD(tAodTrack->DCA());
874 tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
878 // double covimpact[3];
880 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
881 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
882 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
883 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
884 // //cout << "sth went wrong with dca propagation" << endl;
885 // tFemtoTrack->SetImpactD(-1000.0);
886 // tFemtoTrack->SetImpactZ(-1000.0);
890 // tFemtoTrack->SetImpactD(impact[0]);
891 // tFemtoTrack->SetImpactZ(impact[1]);
897 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
898 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
900 // tFemtoTrack->SetImpactD(0.0);
901 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
903 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
906 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
907 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
911 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
912 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
913 // << tAodTrack->Yv() - fV1[1]
914 // << "xv = " << tAodTrack->Xv() << endl
915 // << "fv1[0] = " << fV1[0] << endl
916 // << "yv = " << tAodTrack->Yv() << endl
917 // << "fv1[1] = " << fV1[1] << endl
918 // << "zv = " << tAodTrack->Zv() << endl
919 // << "fv1[2] = " << fV1[2] << endl
920 // << "impact[0] = " << impact[0] << endl
921 // << "impact[1] = " << impact[1] << endl
924 tFemtoTrack->SetCdd(covmat[0]);
925 tFemtoTrack->SetCdz(covmat[1]);
926 tFemtoTrack->SetCzz(covmat[2]);
927 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
928 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
929 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
930 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
931 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
932 tFemtoTrack->SetTPCsignalN(1);
933 tFemtoTrack->SetTPCsignalS(1);
934 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
936 // if (tPWG2AODTrack) {
937 // // Copy the PWG2 specific information if it exists
938 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
939 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
941 // double xtpc[3] = {0,0,0};
942 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
943 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
944 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
945 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
948 // If not use dummy values
949 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
950 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
952 float globalPositionsAtRadii[9][3];
953 float bfield = 5*fMagFieldSign;
955 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
956 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
957 double **tpcPositions;
958 tpcPositions = new double*[9];
960 tpcPositions[i] = new double[3];
961 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
964 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
965 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
966 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
969 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
970 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
971 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
973 delete [] tpcPositions[i];
974 delete [] tpcPositions;
977 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
981 for (int ik=0; ik<3; ik++) {
984 tFemtoTrack->SetKinkIndexes(indexes);
987 for (int ii=0; ii<6; ii++){
988 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
994 void AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0, AliFemtoV0 *tFemtoV0)
996 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
997 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
998 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
999 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
1000 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
1001 tFemtoV0->SetdecayVertexV0(decayvertex);
1002 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
1003 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
1004 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
1005 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
1006 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
1007 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
1008 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
1009 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
1010 tFemtoV0->SetmomPos(mompos);
1011 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
1012 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
1013 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
1014 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
1015 tFemtoV0->SetmomNeg(momneg);
1017 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
1018 //void SettpcHitsPos(const int& i);
1019 //void SettpcHitsNeg(const int& i);
1021 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
1022 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
1024 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
1025 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
1026 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
1027 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
1028 tFemtoV0->SetmomV0(momv0);
1029 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
1030 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
1031 tFemtoV0->SeteLambda(tAODv0->ELambda());
1032 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
1033 tFemtoV0->SetePosProton(tAODv0->EPosProton());
1034 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
1035 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
1036 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
1037 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
1038 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
1039 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
1041 //void SetcTauLambda( float x);
1042 //void SetcTauK0Short( float x);
1044 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
1045 tFemtoV0->SetptV0(tAODv0->Pt());
1046 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
1047 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
1048 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
1049 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
1050 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
1052 tFemtoV0->SetidNeg(tAODv0->GetNegID());
1053 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
1054 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
1055 tFemtoV0->SetidPos(tAODv0->GetPosID());
1057 tFemtoV0->SetEtaV0(tAODv0->Eta());
1058 tFemtoV0->SetPhiV0(tAODv0->Phi());
1059 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
1060 //tFemtoV0->SetYV0(tAODv0->Y());
1062 //void SetdedxNeg(float x);
1063 //void SeterrdedxNeg(float x);//Gael 04Fev2002
1064 //void SetlendedxNeg(float x);//Gael 04Fev2002
1065 //void SetdedxPos(float x);
1066 //void SeterrdedxPos(float x);//Gael 04Fev2002
1067 //void SetlendedxPos(float x);//Gael 04Fev2002
1069 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
1070 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
1072 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
1073 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
1075 if(trackpos && trackneg)
1077 tFemtoV0->SetEtaPos(trackpos->Eta());
1078 tFemtoV0->SetEtaNeg(trackneg->Eta());
1079 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1080 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1081 tFemtoV0->SetptPos(trackpos->Pt());
1082 tFemtoV0->SetptNeg(trackneg->Pt());
1084 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1085 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1086 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1087 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1088 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1089 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1090 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1091 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1092 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1093 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1094 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1095 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1097 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1098 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1099 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1100 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1101 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1102 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1105 float bfield = 5*fMagFieldSign;
1106 float globalPositionsAtRadiiPos[9][3];
1107 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1108 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1109 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1111 float globalPositionsAtRadiiNeg[9][3];
1112 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1113 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1114 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1116 AliFemtoThreeVector tmpVec;
1117 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetY(tpcEntrancePos[1]); tmpVec.SetZ(tpcEntrancePos[2]);
1118 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1120 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetY(tpcExitPos[1]); tmpVec.SetZ(tpcExitPos[2]);
1121 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1123 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetY(tpcEntranceNeg[1]); tmpVec.SetZ(tpcEntranceNeg[2]);
1124 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1126 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetY(tpcExitNeg[1]); tmpVec.SetZ(tpcExitNeg[2]);
1127 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1129 AliFemtoThreeVector vecTpcPos[9];
1130 AliFemtoThreeVector vecTpcNeg[9];
1131 for(int i=0;i<9;i++)
1133 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1134 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1136 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1137 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1139 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1140 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1142 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1143 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1145 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 )
1147 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 )
1149 tFemtoV0->SetPosNSigmaTOFK(-1000);
1150 tFemtoV0->SetNegNSigmaTOFK(-1000);
1151 tFemtoV0->SetPosNSigmaTOFP(-1000);
1152 tFemtoV0->SetNegNSigmaTOFP(-1000);
1153 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1154 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1156 tFemtoV0->SetTOFProtonTimePos(-1000);
1157 tFemtoV0->SetTOFPionTimePos(-1000);
1158 tFemtoV0->SetTOFKaonTimePos(-1000);
1159 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1160 tFemtoV0->SetTOFPionTimeNeg(-1000);
1161 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1166 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1167 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1168 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1169 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1170 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1171 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1173 double TOFSignalPos = trackpos->GetTOFsignal();
1174 double TOFSignalNeg = trackneg->GetTOFsignal();
1177 trackpos->GetIntegratedTimes(pidPos);
1178 trackneg->GetIntegratedTimes(pidNeg);
1180 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1181 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1182 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1183 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1184 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1185 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1190 tFemtoV0->SetStatusPos(999);
1191 tFemtoV0->SetStatusNeg(999);
1193 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1196 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1198 fFilterBit = (1 << (ibit));
1202 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1207 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1213 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1218 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1220 fEstEventMult = aType;
1223 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1225 if (aLabel < 0) return 0;
1226 AliAODMCParticle *aodP;
1228 if (aLabel > mcP->GetEntries())
1229 posstack = mcP->GetEntries();
1233 aodP = (AliAODMCParticle *) mcP->At(posstack);
1234 if (aodP->GetLabel() > posstack) {
1236 aodP = (AliAODMCParticle *) mcP->At(posstack);
1237 if (aodP->GetLabel() == aLabel) return aodP;
1240 while (posstack > 0);
1244 aodP = (AliAODMCParticle *) mcP->At(posstack);
1245 if (aodP->GetLabel() == aLabel) return aodP;
1248 while (posstack < mcP->GetEntries());
1254 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1255 AliFemtoTrack *tFemtoTrack)
1258 if (fDCAglobalTrack) {
1260 // code from Michael and Prabhat from AliAnalysisTaskDptDptCorrelations
1261 const AliAODVertex* vertex = (AliAODVertex*) fEvent->GetPrimaryVertex();
1262 float vertexX = -999.;
1263 float vertexY = -999.;
1264 float vertexZ = -999.;
1268 vertex->GetCovarianceMatrix(fCov);
1269 if(vertex->GetNContributors() > 0) {
1271 vertexX = vertex->GetX();
1272 vertexY = vertex->GetY();
1273 vertexZ = vertex->GetZ();
1280 tAodTrack->GetXYZ(pos);
1282 Double_t DCAX = pos[0] - vertexX;
1283 Double_t DCAY = pos[1] - vertexY;
1284 Double_t DCAZ = pos[2] - vertexZ;
1286 Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1288 tFemtoTrack->SetImpactD(DCAXY);
1289 tFemtoTrack->SetImpactZ(DCAZ);
1292 // // // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1294 // double impact[2];
1295 // double covimpact[3];
1297 // AliAODTrack* trk_clone = (AliAODTrack*)tAodTrack->Clone("trk_clone");
1298 // // if(!trk_clone->PropagateToDCA(fAODVertex,aod->GetMagneticField(),300.,dca,cov)) continue;
1299 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1300 // if (!trk_clone->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1302 // // if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1303 // //cout << "sth went wrong with dca propagation" << endl;
1304 // tFemtoTrack->SetImpactD(-1000.0);
1305 // tFemtoTrack->SetImpactZ(-1000.0);
1309 // tFemtoTrack->SetImpactD(impact[0]);
1310 // tFemtoTrack->SetImpactZ(impact[1]);
1312 // delete trk_clone;
1316 tAodTrack->GetPID(aodpid);
1317 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1318 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1319 tFemtoTrack->SetPidProbPion(aodpid[2]);
1320 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1321 tFemtoTrack->SetPidProbProton(aodpid[4]);
1323 aodpid[0] = -100000.0;
1324 aodpid[1] = -100000.0;
1325 aodpid[2] = -100000.0;
1326 aodpid[3] = -100000.0;
1327 aodpid[4] = -100000.0;
1330 Float_t probMis = 1.0;
1332 //what is that code? for what do we need it? nsigma values are not enough?
1333 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1334 tTOF = tAodTrack->GetTOFsignal();
1335 tAodTrack->GetIntegratedTimes(aodpid);
1337 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1339 probMis = fAODpidUtil->GetTOFMismatchProbability(tAodTrack);
1344 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1346 ////// TPC ////////////////////////////////////////////
1348 float nsigmaTPCK=-1000.;
1349 float nsigmaTPCPi=-1000.;
1350 float nsigmaTPCP=-1000.;
1351 float nsigmaTPCE=-1000.;
1353 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1355 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1356 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1357 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1358 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1359 nsigmaTPCE = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kElectron);
1362 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1363 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1364 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1365 tFemtoTrack->SetNSigmaTPCE(nsigmaTPCE);
1367 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1368 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1369 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1371 tFemtoTrack->SetTPCsignalN(1);
1372 tFemtoTrack->SetTPCsignalS(1);
1373 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1375 ///////TOF//////////////////////
1378 float nsigmaTOFPi=-1000.;
1379 float nsigmaTOFK=-1000.;
1380 float nsigmaTOFP=-1000.;
1381 float nsigmaTOFE=-1000.;
1383 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1384 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1385 (tAodTrack->GetStatus() & AliESDtrack::kTIME) //AliESDtrack::kTIME=0x80000000
1386 && probMis < 0.01) // TOF mismatch probaility
1388 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1391 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1392 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1393 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1394 nsigmaTOFE = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kElectron);
1396 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1397 Double_t tof=tAodTrack->GetTOFsignal();
1398 if(tof > 0.) vp=len/tof/0.03;
1401 tFemtoTrack->SetVTOF(vp);
1402 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1403 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1404 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1405 tFemtoTrack->SetNSigmaTOFE(nsigmaTOFE);
1408 //////////////////////////////////////
1412 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1414 fCentRange[0] = min; fCentRange[1] = max;
1416 fEstEventMult = kCentrality;
1419 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1421 if(anocent==false) {fEstEventMult=kCentrality;}
1422 else {fEstEventMult=kReference; fUsePreCent = 0; }
1425 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1427 fAODpidUtil = aAODpidUtil;
1428 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1431 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1433 fAODheader = aAODheader;
1437 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1447 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1452 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1454 // Gets the global position of the track at nine different radii in the TPC
1455 // track is the track you want to propagate
1456 // bfield is the magnetic field of your event
1457 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1459 // Initialize the array to something indicating there was no propagation
1460 for(Int_t i=0;i<9;i++){
1461 for(Int_t j=0;j<3;j++){
1462 globalPositionsAtRadii[i][j]=-9999.;
1466 // Make a copy of the track to not change parameters of the track
1467 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1468 //printf("\nAfter CopyFromVTrack\n");
1471 // The global position of the the track
1472 Double_t xyz[3]={-9999.,-9999.,-9999.};
1474 // Counter for which radius we want
1476 // The radii at which we get the global positions
1477 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1478 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1479 // The global radius we are at
1480 Float_t globalRadius=0;
1482 // Propagation is done in local x of the track
1483 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1484 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1485 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1486 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1487 // adds to the global radius
1489 // Stop if the propagation was not succesful. This can happen for low pt tracks
1490 // that don't reach outer radii
1491 if(!etp.PropagateTo(x,bfield))break;
1492 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1493 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1495 // Roughly reached the radius we want
1496 if(globalRadius > Rwanted[iR]){
1498 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1499 while (globalRadius>Rwanted[iR]){
1501 // printf("propagating to x %5.2f\n",x);
1502 if(!etp.PropagateTo(x,bfield))break;
1503 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1504 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1506 //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]);
1507 globalPositionsAtRadii[iR][0]=xyz[0];
1508 globalPositionsAtRadii[iR][1]=xyz[1];
1509 globalPositionsAtRadii[iR][2]=xyz[2];
1510 // Indicate we want the next radius
1520 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)
1525 void AliFemtoEventReaderAOD::SetUseMVPlpSelection(Bool_t mvplp)
1530 void AliFemtoEventReaderAOD::SetIsPileUpEvent(Bool_t ispileup)
1532 fisPileUp = ispileup;
1537 void AliFemtoEventReaderAOD::SetDCAglobalTrack(Bool_t dcagt)
1539 fDCAglobalTrack = dcagt;
1543 bool AliFemtoEventReaderAOD::RejectEventCentFlat(float MagField, float CentPercent)
1544 { // to flatten centrality distribution
1545 bool RejectEvent = kFALSE;
1547 TRandom3* fRandomNumber = new TRandom3(); //for 3D, random sign switching
1548 fRandomNumber->SetSeed(0);
1550 if(MagField > 0) weightBinSign = 0;
1551 else weightBinSign = 1;
1552 float kCentWeight[2][9] = {{.878,.876,.860,.859,.859,.88,.873,.879,.894},
1553 {.828,.793,.776,.772,.775,.796,.788,.804,.839}};
1554 int weightBinCent = (int) CentPercent;
1555 if(fRandomNumber->Rndm() > kCentWeight[weightBinSign][weightBinCent]) RejectEvent = kTRUE;
1560 void AliFemtoEventReaderAOD::SetCentralityFlattening(Bool_t dcagt)