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"
14 #include "AliAODEvent.h"
15 #include "AliAODTrack.h"
16 #include "AliAODVertex.h"
17 #include "AliAODMCHeader.h"
18 #include "AliESDtrack.h"
20 #include "AliFmPhysicalHelixD.h"
21 #include "AliFmThreeVectorF.h"
23 #include "SystemOfUnits.h"
25 #include "AliFemtoEvent.h"
26 #include "AliFemtoModelHiddenInfo.h"
27 #include "AliFemtoModelGlobalHiddenInfo.h"
30 #include "AliAODpidUtil.h"
32 ClassImp(AliFemtoEventReaderAOD)
34 #if !(ST_NO_NAMESPACES)
35 using namespace units;
42 //____________________________
43 //constructor with 0 parameters , look at default settings
44 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD():
52 // fPWG2AODTracks(0x0),
56 fEstEventMult(kCentrality),
65 fDCAglobalTrack(kFALSE)
67 // default constructor
68 fAllTrue.ResetAllBits(kTRUE);
69 fAllFalse.ResetAllBits(kFALSE);
74 AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(const AliFemtoEventReaderAOD &aReader) :
75 AliFemtoEventReader(),
83 // fPWG2AODTracks(0x0),
87 fEstEventMult(kCentrality),
96 fDCAglobalTrack(kFALSE)
99 fReadMC = aReader.fReadMC;
100 fReadV0 = aReader.fReadV0;
101 fInputFile = aReader.fInputFile;
102 fNumberofEvent = aReader.fNumberofEvent;
103 fCurEvent = aReader.fCurEvent;
104 fEvent = new AliAODEvent();
105 fAodFile = new TFile(aReader.fAodFile->GetName());
106 fAllTrue.ResetAllBits(kTRUE);
107 fAllFalse.ResetAllBits(kFALSE);
108 fFilterBit = aReader.fFilterBit;
109 // fPWG2AODTracks = aReader.fPWG2AODTracks;
110 fAODpidUtil = aReader.fAODpidUtil;
111 fAODheader = aReader.fAODheader;
112 fCentRange[0] = aReader.fCentRange[0];
113 fCentRange[1] = aReader.fCentRange[1];
114 fEstEventMult = aReader.fEstEventMult;
115 fUsePreCent = aReader.fUsePreCent;
116 fpA2013 = aReader.fpA2013;
117 fDCAglobalTrack = aReader.fDCAglobalTrack;
122 AliFemtoEventReaderAOD::~AliFemtoEventReaderAOD()
128 // if (fPWG2AODTracks) {
129 // fPWG2AODTracks->Delete();
130 // delete fPWG2AODTracks;
135 AliFemtoEventReaderAOD& AliFemtoEventReaderAOD::operator=(const AliFemtoEventReaderAOD& aReader)
137 // assignment operator
138 if (this == &aReader)
141 fInputFile = aReader.fInputFile;
142 fNumberofEvent = aReader.fNumberofEvent;
143 fCurEvent = aReader.fCurEvent;
144 if (fTree) delete fTree;
145 if (fEvent) delete fEvent;
146 fEvent = new AliAODEvent();
147 if (fAodFile) delete fAodFile;
148 fAodFile = new TFile(aReader.fAodFile->GetName());
149 fAllTrue.ResetAllBits(kTRUE);
150 fAllFalse.ResetAllBits(kFALSE);
151 fFilterBit = aReader.fFilterBit;
152 fFilterMask = aReader.fFilterMask;
153 // fPWG2AODTracks = aReader.fPWG2AODTracks;
154 fAODpidUtil = aReader.fAODpidUtil;
155 fAODheader = aReader.fAODheader;
156 fCentRange[0] = aReader.fCentRange[0];
157 fCentRange[1] = aReader.fCentRange[1];
158 fUsePreCent = aReader.fUsePreCent;
159 fEstEventMult = aReader.fEstEventMult;
160 fpA2013 = aReader.fpA2013;
161 fDCAglobalTrack = aReader.fDCAglobalTrack;
166 AliFemtoString AliFemtoEventReaderAOD::Report()
168 // create reader report
169 AliFemtoString temp = "\n This is the AliFemtoEventReaderAOD\n";
174 void AliFemtoEventReaderAOD::SetInputFile(const char* inputFile)
176 //setting the name of file where names of AOD file are written
177 //it takes only this files which have good trees
179 fInputFile=string(inputFile);
180 ifstream infile(inputFile);
182 fTree = new TChain("aodTree");
184 if(infile.good()==true)
186 //checking if all give files have good tree inside
187 while (infile.eof()==false)
189 infile.getline(buffer,256);
190 TFile *aodFile=TFile::Open(buffer,"READ");
193 TTree* tree = (TTree*) aodFile->Get("aodTree");
196 // cout<<"putting file "<<string(buffer)<<" into analysis"<<endl;
197 fTree->AddFile(buffer);
207 AliFemtoEvent* AliFemtoEventReaderAOD::ReturnHbtEvent()
209 // read in a next hbt event from the chain
210 // convert it to AliFemtoEvent and return
211 // for further analysis
212 AliFemtoEvent *hbtEvent = 0;
213 // cout<<"reader"<<endl;
214 if (fCurEvent==fNumberofEvent)//open next file
216 if(fNumberofEvent==0)
218 fEvent=new AliAODEvent();
219 fEvent->ReadFromTree(fTree);
221 // Check for the existence of the additional information
222 // fPWG2AODTracks = (TClonesArray *) fEvent->GetList()->FindObject("pwg2aodtracks");
224 // if (fPWG2AODTracks) {
225 // cout << "Found additional PWG2 specific information in the AOD!" << endl;
226 // cout << "Reading only tracks with the additional information" << endl;
229 fNumberofEvent=fTree->GetEntries();
230 // cout<<"Number of Entries in file "<<fNumberofEvent<<endl;
233 else //no more data to read
235 // cout<<"no more files "<<hbtEvent<<endl;
241 // cout<<"starting to read event "<<fCurEvent<<endl;
242 fTree->GetEvent(fCurEvent);//getting next event
243 // cout << "Read event " << fEvent << " from file " << fTree << endl;
245 hbtEvent = new AliFemtoEvent;
247 CopyAODtoFemtoEvent(hbtEvent);
254 void AliFemtoEventReaderAOD::CopyAODtoFemtoEvent(AliFemtoEvent *tEvent)
257 // A function that reads in the AOD event
258 // and transfers the neccessary information into
259 // the internal AliFemtoEvent
261 // setting global event characteristics
262 tEvent->SetRunNumber(fEvent->GetRunNumber());
263 tEvent->SetMagneticField(fEvent->GetMagneticField()*kilogauss);//to check if here is ok
264 tEvent->SetZDCN1Energy(fEvent->GetZDCN1Energy());
265 tEvent->SetZDCP1Energy(fEvent->GetZDCP1Energy());
266 tEvent->SetZDCN2Energy(fEvent->GetZDCN2Energy());
267 tEvent->SetZDCP2Energy(fEvent->GetZDCP2Energy());
268 tEvent->SetZDCEMEnergy(fEvent->GetZDCEMEnergy(0));
269 tEvent->SetZDCParticipants(0);
270 tEvent->SetTriggerMask(fEvent->GetTriggerMask());
271 tEvent->SetTriggerCluster(fEvent->GetTriggerCluster());
273 // Attempt to access MC header
277 mcH = (AliAODMCHeader *) fEvent->FindListObject(AliAODMCHeader::StdBranchName());
279 cout << "AOD MC information requested, but no header found!" << endl;
282 mcP = (TClonesArray *) fEvent->FindListObject(AliAODMCParticle::StdBranchName());
284 cout << "AOD MC information requested, but no particle array found!" << endl;
288 tEvent->SetReactionPlaneAngle(fEvent->GetHeader()->GetQTheta(0)/2.0);
292 motherids = new Int_t[((AliAODMCParticle *) mcP->At(mcP->GetEntries()-1))->GetLabel()];
293 for (int ip=0; ip<mcP->GetEntries(); ip++) motherids[ip] = 0;
295 // Read in mother ids
296 AliAODMCParticle *motherpart;
297 for (int ip=0; ip<mcP->GetEntries(); ip++) {
298 motherpart = (AliAODMCParticle *) mcP->At(ip);
299 if (motherpart->GetDaughter(0) > 0)
300 motherids[motherpart->GetDaughter(0)] = ip;
301 if (motherpart->GetDaughter(1) > 0)
302 motherids[motherpart->GetDaughter(1)] = ip;
306 // Primary Vertex position
310 const AliAODVertex* trkVtx = fEvent->GetPrimaryVertex();
311 if (!trkVtx || trkVtx->GetNContributors()<=0) return;
312 TString vtxTtl = trkVtx->GetTitle();
313 if (!vtxTtl.Contains("VertexerTracks")) return;
314 Float_t zvtx = trkVtx->GetZ();
315 const AliAODVertex* spdVtx = fEvent->GetPrimaryVertexSPD();
316 if (spdVtx->GetNContributors()<=0) return;
317 TString vtxTyp = spdVtx->GetTitle();
319 spdVtx->GetCovarianceMatrix(cov);
320 Double_t zRes = TMath::Sqrt(cov[5]);
321 if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;
322 if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;
324 if (TMath::Abs(zvtx) > 10) return;
326 fEvent->GetPrimaryVertex()->GetPosition(fV1);
328 AliFmThreeVectorF vertex(fV1[0],fV1[1],fV1[2]);
329 tEvent->SetPrimVertPos(vertex);
331 //starting to reading tracks
332 int nofTracks=0; //number of reconstructed tracks in event
334 // Check to see whether the additional info exists
335 // if (fPWG2AODTracks)
336 // nofTracks=fPWG2AODTracks->GetEntries();
338 nofTracks=fEvent->GetNumberOfTracks();
340 AliEventplane *ep = fEvent->GetEventplane();
344 tEvent->SetReactionPlaneAngle(ep->GetEventplane("V0",fEvent,2));
346 tEvent->SetReactionPlaneAngle(ep->GetEventplane("Q"));
349 AliCentrality *cent = fEvent->GetCentrality();
351 if (!fEstEventMult && cent && fUsePreCent) {
352 if ((cent->GetCentralityPercentile("V0M")*10 < fCentRange[0]) ||
353 (cent->GetCentralityPercentile("V0M")*10 > fCentRange[1]))
355 // cout << "Centrality " << cent->GetCentralityPercentile("V0M") << " outside of preselection range " << fCentRange[0] << " - " << fCentRange[1] << endl;
361 int realnofTracks=0; // number of track which we use in a analysis
365 for (int il=0; il<20000; il++) labels[il] = -1;
367 // looking for global tracks and saving their numbers to copy from them PID information to TPC-only tracks in the main loop over tracks
368 for (int i=0;i<nofTracks;i++) {
369 const AliAODTrack *aodtrack=fEvent->GetTrack(i);
370 if (!aodtrack->TestFilterBit(fFilterBit)) {
371 if(aodtrack->GetID() < 0) continue;
372 labels[aodtrack->GetID()] = i;
377 for (int i=0;i<nofTracks;i++)
379 AliFemtoTrack* trackCopy = new AliFemtoTrack();
381 // if (fPWG2AODTracks) {
382 // // Read tracks from the additional pwg2 specific AOD part
384 // // Note that in that case all the AOD tracks without the
385 // // additional information will be ignored !
386 // AliPWG2AODTrack *pwg2aodtrack = (AliPWG2AODTrack *) fPWG2AODTracks->At(i);
388 // // Getting the AOD track through the ref of the additional info
389 // AliAODTrack *aodtrack = pwg2aodtrack->GetRefAODTrack();
390 // if (!aodtrack->TestFilterBit(fFilterBit)) {
396 // if (aodtrack->IsOn(AliESDtrack::kTPCrefit))
397 // if (aodtrack->Chi2perNDF() < 6.0)
398 // if (aodtrack->Eta() < 0.9)
402 // CopyAODtoFemtoTrack(aodtrack, trackCopy, pwg2aodtrack);
405 // // Fill the hidden information with the simulated data
406 // // Int_t pLabel = aodtrack->GetLabel();
407 // AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
409 // // Check the mother information
411 // // Using the new way of storing the freeze-out information
412 // // Final state particle is stored twice on the stack
413 // // one copy (mother) is stored with original freeze-out information
414 // // and is not tracked
415 // // the other one (daughter) is stored with primary vertex position
418 // // Freeze-out coordinates
419 // double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
420 // fpx = tPart->Xv() - fV1[0];
421 // fpy = tPart->Yv() - fV1[1];
422 // fpz = tPart->Zv() - fV1[2];
425 // AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
426 // tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
433 // // cout << "Looking for mother ids " << endl;
434 // if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
435 // // cout << "Got mother id" << endl;
436 // AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
437 // // Check if this is the same particle stored twice on the stack
438 // if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
439 // // It is the same particle
440 // // Read in the original freeze-out information
441 // // and convert it from to [fm]
444 // // fpx = mother->Xv()*1e13*0.197327;
445 // // fpy = mother->Yv()*1e13*0.197327;
446 // // fpz = mother->Zv()*1e13*0.197327;
447 // // fpt = mother->T() *1e13*0.197327*0.5;
450 // // Therminator style
451 // fpx = mother->Xv()*1e13;
452 // fpy = mother->Yv()*1e13;
453 // fpz = mother->Zv()*1e13;
454 // fpt = mother->T() *1e13*3e10;
459 // // if (fRotateToEventPlane) {
460 // // double tPhi = TMath::ATan2(fpy, fpx);
461 // // double tRad = TMath::Hypot(fpx, fpy);
463 // // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
464 // // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
467 // tInfo->SetPDGPid(tPart->GetPdgCode());
469 // // if (fRotateToEventPlane) {
470 // // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
471 // // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
473 // // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
474 // // tRad*TMath::Sin(tPhi - tReactionPlane),
478 // tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
479 // Double_t mass2 = (tPart->E() *tPart->E() -
480 // tPart->Px()*tPart->Px() -
481 // tPart->Py()*tPart->Py() -
482 // tPart->Pz()*tPart->Pz());
484 // tInfo->SetMass(TMath::Sqrt(mass2));
486 // tInfo->SetMass(0.0);
488 // tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
489 // trackCopy->SetHiddenInfo(tInfo);
494 // aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
495 // const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
496 // // Check the sanity of the tracks - reject zero momentum tracks
497 // if (ktP.Mag() == 0) {
503 // No additional information exists
504 // Read in the normal AliAODTracks
506 // const AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
507 AliAODTrack *aodtrack=fEvent->GetTrack(i); // getting the AODtrack directly
511 if (aodtrack->IsPrimaryCandidate()) tracksPrim++;
513 if (fFilterBit && !aodtrack->TestFilterBit(fFilterBit)) {
518 if (fFilterMask && !aodtrack->TestFilterBit(fFilterMask)) {
523 // cout << "Muon? " << aodtrack->IsMuonTrack() << endl;
524 // cout << "Type? " << aodtrack->GetType() << endl;
526 // if (aodtrack->IsMuonTrack()) {
527 // cout << "muon" << endl;
532 //counting particles to set multiplicity
533 if(fEstEventMult==kGlobalCount){
536 if (aodtrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
537 if(impact[0]<0.2 && TMath::Abs(impact[1]+fV1[2])<2.0)
538 //if (aodtrack->IsPrimaryCandidate()) //? instead of kinks?
539 if (aodtrack->Chi2perNDF() < 4.0)
540 if (aodtrack->Pt() > 0.15 && aodtrack->Pt() < 20)
541 if (aodtrack->GetTPCNcls() > 70)
542 if (aodtrack->Eta() < 0.8)
547 CopyAODtoFemtoTrack(aodtrack, trackCopy);
549 // copying PID information from the correspondent track
550 // const AliAODTrack *aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
553 AliAODTrack *aodtrackpid;
554 if((fFilterBit == (1 << (7))) || fFilterMask==128) //for TPC Only tracks we have to copy PID information from corresponding global tracks
555 aodtrackpid = fEvent->GetTrack(labels[-1-fEvent->GetTrack(i)->GetID()]);
557 aodtrackpid = fEvent->GetTrack(i);
558 CopyPIDtoFemtoTrack(aodtrackpid, trackCopy);
561 // Fill the hidden information with the simulated data
562 // Int_t pLabel = aodtrack->GetLabel();
563 AliAODMCParticle *tPart = GetParticleWithLabel(mcP, (TMath::Abs(aodtrack->GetLabel())));
565 AliFemtoModelGlobalHiddenInfo *tInfo = new AliFemtoModelGlobalHiddenInfo();
566 double fpx=0.0, fpy=0.0, fpz=0.0, fpt=0.0;
571 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
573 tInfo->SetTrueMomentum(0.0, 0.0, 0.0);
574 tInfo->SetEmissionPoint(0.0, 0.0, 0.0, 0.0);
578 // Check the mother information
580 // Using the new way of storing the freeze-out information
581 // Final state particle is stored twice on the stack
582 // one copy (mother) is stored with original freeze-out information
583 // and is not tracked
584 // the other one (daughter) is stored with primary vertex position
587 // Freeze-out coordinates
588 fpx = tPart->Xv() - fV1[0];
589 fpy = tPart->Yv() - fV1[1];
590 fpz = tPart->Zv() - fV1[2];
593 tInfo->SetGlobalEmissionPoint(fpx, fpy, fpz);
601 // cout << "Looking for mother ids " << endl;
602 if (motherids[TMath::Abs(aodtrack->GetLabel())]>0) {
603 // cout << "Got mother id" << endl;
604 AliAODMCParticle *mother = GetParticleWithLabel(mcP, motherids[TMath::Abs(aodtrack->GetLabel())]);
605 // Check if this is the same particle stored twice on the stack
607 if ((mother->GetPdgCode() == tPart->GetPdgCode() || (mother->Px() == tPart->Px()))) {
608 // It is the same particle
609 // Read in the original freeze-out information
610 // and convert it from to [fm]
613 // fpx = mother->Xv()*1e13*0.197327;
614 // fpy = mother->Yv()*1e13*0.197327;
615 // fpz = mother->Zv()*1e13*0.197327;
616 // fpt = mother->T() *1e13*0.197327*0.5;
620 fpx = mother->Xv()*1e13;
621 fpy = mother->Yv()*1e13;
622 fpz = mother->Zv()*1e13;
623 // fpt = mother->T() *1e13*3e10;
629 // if (fRotateToEventPlane) {
630 // double tPhi = TMath::ATan2(fpy, fpx);
631 // double tRad = TMath::Hypot(fpx, fpy);
633 // fpx = tRad*TMath::Cos(tPhi - tReactionPlane);
634 // fpy = tRad*TMath::Sin(tPhi - tReactionPlane);
637 tInfo->SetPDGPid(tPart->GetPdgCode());
639 // if (fRotateToEventPlane) {
640 // double tPhi = TMath::ATan2(tPart->Py(), tPart->Px());
641 // double tRad = TMath::Hypot(tPart->Px(), tPart->Py());
643 // tInfo->SetTrueMomentum(tRad*TMath::Cos(tPhi - tReactionPlane),
644 // tRad*TMath::Sin(tPhi - tReactionPlane),
648 tInfo->SetTrueMomentum(tPart->Px(), tPart->Py(), tPart->Pz());
649 Double_t mass2 = (tPart->E() *tPart->E() -
650 tPart->Px()*tPart->Px() -
651 tPart->Py()*tPart->Py() -
652 tPart->Pz()*tPart->Pz());
654 tInfo->SetMass(TMath::Sqrt(mass2));
658 tInfo->SetEmissionPoint(fpx, fpy, fpz, fpt);
661 // //if (TMath::Abs(impact[0]) > 0.001) {
662 // if (tPart->IsPhysicalPrimary()){
663 // tInfo->SetPartOrigin(0);
664 // // trackCopy->SetImpactDprim(impact[0]);
665 // //cout << "Read prim" << endl;
667 // else if (tPart->IsSecondaryFromWeakDecay()) {
668 // tInfo->SetPartOrigin(1);
669 // // trackCopy->SetImpactDweak(impact[0]);
670 // //cout << "Read wea" << endl;
672 // else if (tPart->IsSecondaryFromMaterial()) {
673 // tInfo->SetPartOrigin(2);
674 // // trackCopy->SetImpactDmat(impact[0]);
675 // //cout << "Read mat" << endl;
682 trackCopy->SetHiddenInfo(tInfo);
687 //AliExternalTrackParam *param = new AliExternalTrackParam(*aodtrack->GetInnerParam());
688 trackCopy->SetInnerMomentum(aodtrack->GetTPCmomentum());
690 aodtrack->PxPyPz(pxyz);//reading noconstarined momentum
691 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
692 // Check the sanity of the tracks - reject zero momentum tracks
693 if (ktP.Mag() == 0) {
699 tEvent->TrackCollection()->push_back(trackCopy);//adding track to analysis
700 realnofTracks++;//real number of tracks
703 tEvent->SetNumberOfTracks(realnofTracks);//setting number of track which we read in event
704 tEvent->SetNormalizedMult(tracksPrim);
707 tEvent->SetCentralityV0(cent->GetCentralityPercentile("V0M"));
708 tEvent->SetCentralityV0A(cent->GetCentralityPercentile("V0A"));
709 tEvent->SetCentralityV0C(cent->GetCentralityPercentile("V0C"));
710 tEvent->SetCentralityZNA(cent->GetCentralityPercentile("ZNA"));
711 tEvent->SetCentralityZNC(cent->GetCentralityPercentile("ZNC"));
712 tEvent->SetCentralityCL1(cent->GetCentralityPercentile("CL1"));
713 tEvent->SetCentralityCL0(cent->GetCentralityPercentile("CL0"));
714 tEvent->SetCentralityTKL(cent->GetCentralityPercentile("TKL"));
715 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("FMD"));
716 tEvent->SetCentralityFMD(cent->GetCentralityPercentile("NPA"));
717 // tEvent->SetCentralitySPD1(cent->GetCentralityPercentile("CL1"));
718 tEvent->SetCentralityTrk(cent->GetCentralityPercentile("TRK"));
719 tEvent->SetCentralityCND(cent->GetCentralityPercentile("CND"));
722 if (fEstEventMult==kCentrality) {
723 //AliCentrality *cent = fEvent->GetCentrality();
724 //cout<<"AliFemtoEventReaderAOD:"<<lrint(10*cent->GetCentralityPercentile("V0M"))<<endl;
725 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0M")));
726 // if (cent) tEvent->SetNormalizedMult((int) cent->GetCentralityPercentile("V0M"));
728 else if (fEstEventMult==kCentralityV0A) {
729 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0A")));
731 else if (fEstEventMult==kCentralityV0C) {
732 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("V0C")));
734 else if (fEstEventMult==kCentralityZNA) {
735 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNA")));
737 else if (fEstEventMult==kCentralityZNC) {
738 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("ZNC")));
740 else if (fEstEventMult==kCentralityCL1) {
741 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL1")));
743 else if (fEstEventMult==kCentralityCL0) {
744 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CL0")));
746 else if (fEstEventMult==kCentralityTRK) {
747 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TRK")));
749 else if (fEstEventMult==kCentralityTKL) {
750 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("TKL")));
752 else if (fEstEventMult==kCentralityCND) {
753 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("CND")));
755 else if (fEstEventMult==kCentralityNPA) {
756 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("NPA")));
758 else if (fEstEventMult==kCentralityFMD) {
759 if (cent) tEvent->SetNormalizedMult(lrint(10*cent->GetCentralityPercentile("FMD")));
761 else if(fEstEventMult==kGlobalCount){
762 tEvent->SetNormalizedMult(tNormMult); //particles counted in the loop, trying to reproduce GetReferenceMultiplicity. If better (default) method appears it should be changed
764 else if(fEstEventMult==kReference)
766 tEvent->SetNormalizedMult(fAODheader->GetRefMultiplicity());
768 else if(fEstEventMult==kTPCOnlyRef)
770 tEvent->SetNormalizedMult(fAODheader->GetTPConlyRefMultiplicity());
772 else if(fEstEventMult == kVZERO)
775 for (Int_t i=0; i<64; i++)
776 multV0 += fEvent->GetVZEROData()->GetMultiplicity(i);
777 tEvent->SetNormalizedMult(multV0);
780 if (mcP) delete [] motherids;
782 // cout<<"end of reading nt "<<nofTracks<<" real number "<<realnofTracks<<endl;
787 for (Int_t i = 0; i < fEvent->GetNumberOfV0s(); i++) {
788 AliAODv0* aodv0 = fEvent->GetV0(i);
789 if (!aodv0) continue;
790 if(aodv0->GetNDaughters()>2) continue;
791 if(aodv0->GetNProngs()>2) continue;
792 if(aodv0->GetCharge()!=0) continue;
793 if(aodv0->ChargeProng(0)==aodv0->ChargeProng(1)) continue;
794 if(aodv0->CosPointingAngle(fV1)<0.998) continue;
795 AliFemtoV0* trackCopyV0 = new AliFemtoV0();
797 CopyAODtoFemtoV0(aodv0, trackCopyV0);
798 tEvent->V0Collection()->push_back(trackCopyV0);
799 //cout<<"Pushback v0 to v0collection"<<endl;
805 void AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack,
806 AliFemtoTrack *tFemtoTrack
807 // AliPWG2AODTrack *tPWG2AODTrack
810 // Copy the track information from the AOD into the internal AliFemtoTrack
811 // If it exists, use the additional information from the PWG2 AOD
813 // Primary Vertex position
815 fEvent->GetPrimaryVertex()->GetPosition(fV1);
816 // fEvent->GetPrimaryVertex()->GetXYZ(fV1);
818 tFemtoTrack->SetCharge(tAodTrack->Charge());
821 tAodTrack->PxPyPz(pxyz);//reading noconstrained momentum
823 AliFemtoThreeVector v(pxyz[0],pxyz[1],pxyz[2]);
824 tFemtoTrack->SetP(v);//setting momentum
825 tFemtoTrack->SetPt(sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]));
826 const AliFmThreeVectorD kOrigin(fV1[0],fV1[1],fV1[2]);
827 //setting track helix
828 const AliFmThreeVectorD ktP(pxyz[0],pxyz[1],pxyz[2]);
829 AliFmPhysicalHelixD helix(ktP,kOrigin,(double)(fEvent->GetMagneticField())*kilogauss,(double)(tFemtoTrack->Charge()));
830 tFemtoTrack->SetHelix(helix);
833 tFemtoTrack->SetTrackId(tAodTrack->GetID());
834 tFemtoTrack->SetFlags(tAodTrack->GetFlags());
835 tFemtoTrack->SetLabel(tAodTrack->GetLabel());
837 // Track quality information
839 tAodTrack->GetCovMatrix(covmat);
841 if (!fDCAglobalTrack) {
845 if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
846 //cout << "sth went wrong with dca propagation" << endl;
847 tFemtoTrack->SetImpactD(-1000.0);
848 tFemtoTrack->SetImpactZ(-1000.0);
852 tFemtoTrack->SetImpactD(impact[0]);
853 tFemtoTrack->SetImpactZ(impact[1]);
857 // if (TMath::Abs(tAodTrack->Xv()) > 0.00000000001)
858 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv())*(tAodTrack->Xv()/TMath::Abs(tAodTrack->Xv())));
860 // tFemtoTrack->SetImpactD(0.0);
861 // tFemtoTrack->SetImpactD(tAodTrack->DCA());
863 // tFemtoTrack->SetImpactZ(tAodTrack->ZAtDCA());
866 // tFemtoTrack->SetImpactD(TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1]));
867 // tFemtoTrack->SetImpactZ(tAodTrack->Zv() - fV1[2]);
871 // << "dca" << TMath::Hypot(tAodTrack->Xv() - fV1[0], tAodTrack->Yv() - fV1[1])
872 // << "xv - fv10 = "<< tAodTrack->Xv() - fV1[0]
873 // << tAodTrack->Yv() - fV1[1]
874 // << "xv = " << tAodTrack->Xv() << endl
875 // << "fv1[0] = " << fV1[0] << endl
876 // << "yv = " << tAodTrack->Yv() << endl
877 // << "fv1[1] = " << fV1[1] << endl
878 // << "zv = " << tAodTrack->Zv() << endl
879 // << "fv1[2] = " << fV1[2] << endl
880 // << "impact[0] = " << impact[0] << endl
881 // << "impact[1] = " << impact[1] << endl
884 tFemtoTrack->SetCdd(covmat[0]);
885 tFemtoTrack->SetCdz(covmat[1]);
886 tFemtoTrack->SetCzz(covmat[2]);
887 tFemtoTrack->SetITSchi2(tAodTrack->Chi2perNDF());
888 tFemtoTrack->SetITSncls(tAodTrack->GetITSNcls());
889 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
890 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
891 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
892 tFemtoTrack->SetTPCsignalN(1);
893 tFemtoTrack->SetTPCsignalS(1);
894 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
896 // if (tPWG2AODTrack) {
897 // // Copy the PWG2 specific information if it exists
898 // tFemtoTrack->SetTPCClusterMap(tPWG2AODTrack->GetTPCClusterMap());
899 // tFemtoTrack->SetTPCSharedMap(tPWG2AODTrack->GetTPCSharedMap());
901 // double xtpc[3] = {0,0,0};
902 // tPWG2AODTrack->GetTPCNominalEntrancePoint(xtpc);
903 // tFemtoTrack->SetNominalTPCEntrancePoint(xtpc);
904 // tPWG2AODTrack->GetTPCNominalExitPoint(xtpc);
905 // tFemtoTrack->SetNominalTPCExitPoint(xtpc);
908 // If not use dummy values
909 tFemtoTrack->SetTPCClusterMap(tAodTrack->GetTPCClusterMap());
910 tFemtoTrack->SetTPCSharedMap(tAodTrack->GetTPCSharedMap());
912 float globalPositionsAtRadii[9][3];
914 float s = fEvent->GetMagneticField();
922 float bfield = 5*fMagFieldSign;
924 GetGlobalPositionAtGlobalRadiiThroughTPC(tAodTrack,bfield,globalPositionsAtRadii);
925 double tpcEntrance[3]={globalPositionsAtRadii[0][0],globalPositionsAtRadii[0][1],globalPositionsAtRadii[0][2]};
926 double **tpcPositions;
927 tpcPositions = new double*[9];
929 tpcPositions[i] = new double[3];
930 double tpcExit[3]={globalPositionsAtRadii[8][0],globalPositionsAtRadii[8][1],globalPositionsAtRadii[8][2]};
933 tpcPositions[i][0] = globalPositionsAtRadii[i][0];
934 tpcPositions[i][1] = globalPositionsAtRadii[i][1];
935 tpcPositions[i][2] = globalPositionsAtRadii[i][2];
938 tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance);
939 tFemtoTrack->SetNominalTPCPoints(tpcPositions);
940 tFemtoTrack->SetNominalTPCExitPoint(tpcExit);
942 delete [] tpcPositions[i];
943 delete [] tpcPositions;
946 // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl;
950 for (int ik=0; ik<3; ik++) {
953 tFemtoTrack->SetKinkIndexes(indexes);
956 for (int ii=0; ii<6; ii++){
957 tFemtoTrack->SetITSHitOnLayer(ii,tAodTrack->HasPointOnITSLayer(ii));
963 void AliFemtoEventReaderAOD::CopyAODtoFemtoV0(AliAODv0 *tAODv0, AliFemtoV0 *tFemtoV0)
965 tFemtoV0->SetdecayLengthV0(tAODv0->DecayLength(fV1));
966 tFemtoV0->SetdecayVertexV0X(tAODv0->DecayVertexV0X());
967 tFemtoV0->SetdecayVertexV0Y(tAODv0->DecayVertexV0Y());
968 tFemtoV0->SetdecayVertexV0Z(tAODv0->DecayVertexV0Z());
969 AliFemtoThreeVector decayvertex(tAODv0->DecayVertexV0X(),tAODv0->DecayVertexV0Y(),tAODv0->DecayVertexV0Z());
970 tFemtoV0->SetdecayVertexV0(decayvertex);
971 tFemtoV0->SetdcaV0Daughters(tAODv0->DcaV0Daughters());
972 tFemtoV0->SetdcaV0ToPrimVertex(tAODv0->DcaV0ToPrimVertex());
973 tFemtoV0->SetdcaPosToPrimVertex(tAODv0->DcaPosToPrimVertex());
974 tFemtoV0->SetdcaNegToPrimVertex(tAODv0->DcaNegToPrimVertex());
975 tFemtoV0->SetmomPosX(tAODv0->MomPosX());
976 tFemtoV0->SetmomPosY(tAODv0->MomPosY());
977 tFemtoV0->SetmomPosZ(tAODv0->MomPosZ());
978 AliFemtoThreeVector mompos(tAODv0->MomPosX(),tAODv0->MomPosY(),tAODv0->MomPosZ());
979 tFemtoV0->SetmomPos(mompos);
980 tFemtoV0->SetmomNegX(tAODv0->MomNegX());
981 tFemtoV0->SetmomNegY(tAODv0->MomNegY());
982 tFemtoV0->SetmomNegZ(tAODv0->MomNegZ());
983 AliFemtoThreeVector momneg(tAODv0->MomNegX(),tAODv0->MomNegY(),tAODv0->MomNegZ());
984 tFemtoV0->SetmomNeg(momneg);
986 //jest cos takiego w AliFemtoV0.h czego nie ma w AliAODv0.h
987 //void SettpcHitsPos(const int& i);
988 //void SettpcHitsNeg(const int& i);
990 //void SetTrackTopologyMapPos(unsigned int word, const unsigned long& m);
991 //void SetTrackTopologyMapNeg(unsigned int word, const unsigned long& m);
993 tFemtoV0->SetmomV0X(tAODv0->MomV0X());
994 tFemtoV0->SetmomV0Y(tAODv0->MomV0Y());
995 tFemtoV0->SetmomV0Z(tAODv0->MomV0Z());
996 AliFemtoThreeVector momv0(tAODv0->MomV0X(),tAODv0->MomV0Y(),tAODv0->MomV0Z());
997 tFemtoV0->SetmomV0(momv0);
998 tFemtoV0->SetalphaV0(tAODv0->AlphaV0());
999 tFemtoV0->SetptArmV0(tAODv0->PtArmV0());
1000 tFemtoV0->SeteLambda(tAODv0->ELambda());
1001 tFemtoV0->SeteK0Short(tAODv0->EK0Short());
1002 tFemtoV0->SetePosProton(tAODv0->EPosProton());
1003 tFemtoV0->SeteNegProton(tAODv0->ENegProton());
1004 tFemtoV0->SetmassLambda(tAODv0->MassLambda());
1005 tFemtoV0->SetmassAntiLambda(tAODv0->MassAntiLambda());
1006 tFemtoV0->SetmassK0Short(tAODv0->MassK0Short());
1007 tFemtoV0->SetrapLambda(tAODv0->RapLambda());
1008 tFemtoV0->SetrapK0Short(tAODv0->RapK0Short());
1010 //void SetcTauLambda( float x);
1011 //void SetcTauK0Short( float x);
1013 //tFemtoV0->SetptV0(::sqrt(tAODv0->Pt2V0())); //!
1014 tFemtoV0->SetptV0(tAODv0->Pt());
1015 tFemtoV0->SetptotV0(::sqrt(tAODv0->Ptot2V0()));
1016 //tFemtoV0->SetptPos(::sqrt(tAODv0->MomPosX()*tAODv0->MomPosX()+tAODv0->MomPosY()*tAODv0->MomPosY()));
1017 //tFemtoV0->SetptotPos(::sqrt(tAODv0->Ptot2Pos()));
1018 //tFemtoV0->SetptNeg(::sqrt(tAODv0->MomNegX()*tAODv0->MomNegX()+tAODv0->MomNegY()*tAODv0->MomNegY()));
1019 //tFemtoV0->SetptotNeg(::sqrt(tAODv0->Ptot2Neg()));
1021 tFemtoV0->SetidNeg(tAODv0->GetNegID());
1022 //cout<<"tAODv0->GetNegID(): "<<tAODv0->GetNegID()<<endl;
1023 //cout<<"tFemtoV0->IdNeg(): "<<tFemtoV0->IdNeg()<<endl;
1024 tFemtoV0->SetidPos(tAODv0->GetPosID());
1026 tFemtoV0->SetEtaV0(tAODv0->Eta());
1027 tFemtoV0->SetPhiV0(tAODv0->Phi());
1028 tFemtoV0->SetCosPointingAngle(tAODv0->CosPointingAngle(fV1));
1029 //tFemtoV0->SetYV0(tAODv0->Y());
1031 //void SetdedxNeg(float x);
1032 //void SeterrdedxNeg(float x);//Gael 04Fev2002
1033 //void SetlendedxNeg(float x);//Gael 04Fev2002
1034 //void SetdedxPos(float x);
1035 //void SeterrdedxPos(float x);//Gael 04Fev2002
1036 //void SetlendedxPos(float x);//Gael 04Fev2002
1038 //tFemtoV0->SetEtaPos(tAODv0->PseudoRapPos());
1039 //tFemtoV0->SetEtaNeg(tAODv0->PseudoRapNeg());
1041 AliAODTrack *trackpos = (AliAODTrack*)tAODv0->GetDaughter(0);
1042 AliAODTrack *trackneg = (AliAODTrack*)tAODv0->GetDaughter(1);
1044 if(trackpos && trackneg)
1046 tFemtoV0->SetEtaPos(trackpos->Eta());
1047 tFemtoV0->SetEtaNeg(trackneg->Eta());
1048 tFemtoV0->SetptotPos(tAODv0->PProng(0));
1049 tFemtoV0->SetptotNeg(tAODv0->PProng(1));
1050 tFemtoV0->SetptPos(trackpos->Pt());
1051 tFemtoV0->SetptNeg(trackneg->Pt());
1053 //tFemtoV0->SetEtaPos(trackpos->Eta()); //tAODv0->PseudoRapPos()
1054 //tFemtoV0->SetEtaNeg(trackneg->Eta()); //tAODv0->PseudoRapNeg()
1055 tFemtoV0->SetTPCNclsPos(trackpos->GetTPCNcls());
1056 tFemtoV0->SetTPCNclsNeg(trackneg->GetTPCNcls());
1057 tFemtoV0->SetTPCclustersPos(trackpos->GetTPCClusterMap());
1058 tFemtoV0->SetTPCclustersNeg(trackneg->GetTPCClusterMap());
1059 tFemtoV0->SetTPCsharingPos(trackpos->GetTPCSharedMap());
1060 tFemtoV0->SetTPCsharingNeg(trackneg->GetTPCSharedMap());
1061 tFemtoV0->SetNdofPos(trackpos->Chi2perNDF());
1062 tFemtoV0->SetNdofNeg(trackneg->Chi2perNDF());
1063 tFemtoV0->SetStatusPos(trackpos->GetStatus());
1064 tFemtoV0->SetStatusNeg(trackneg->GetStatus());
1066 tFemtoV0->SetPosNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kKaon));
1067 tFemtoV0->SetNegNSigmaTPCK(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kKaon));
1068 tFemtoV0->SetPosNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kProton));
1069 tFemtoV0->SetNegNSigmaTPCP(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kProton));
1070 tFemtoV0->SetPosNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackpos,AliPID::kPion));
1071 tFemtoV0->SetNegNSigmaTPCPi(fAODpidUtil->NumberOfSigmasTPC(trackneg,AliPID::kPion));
1074 float bfield = 5*fMagFieldSign;
1075 float globalPositionsAtRadiiPos[9][3];
1076 GetGlobalPositionAtGlobalRadiiThroughTPC(trackpos,bfield,globalPositionsAtRadiiPos);
1077 double tpcEntrancePos[3]={globalPositionsAtRadiiPos[0][0],globalPositionsAtRadiiPos[0][1],globalPositionsAtRadiiPos[0][2]};
1078 double tpcExitPos[3]={globalPositionsAtRadiiPos[8][0],globalPositionsAtRadiiPos[8][1],globalPositionsAtRadiiPos[8][2]};
1080 float globalPositionsAtRadiiNeg[9][3];
1081 GetGlobalPositionAtGlobalRadiiThroughTPC(trackneg,bfield,globalPositionsAtRadiiNeg);
1082 double tpcEntranceNeg[3]={globalPositionsAtRadiiNeg[0][0],globalPositionsAtRadiiNeg[0][1],globalPositionsAtRadiiNeg[0][2]};
1083 double tpcExitNeg[3]={globalPositionsAtRadiiNeg[8][0],globalPositionsAtRadiiNeg[8][1],globalPositionsAtRadiiNeg[8][2]};
1085 AliFemtoThreeVector tmpVec;
1086 tmpVec.SetX(tpcEntrancePos[0]); tmpVec.SetY(tpcEntrancePos[1]); tmpVec.SetZ(tpcEntrancePos[2]);
1087 tFemtoV0->SetNominalTpcEntrancePointPos(tmpVec);
1089 tmpVec.SetX(tpcExitPos[0]); tmpVec.SetY(tpcExitPos[1]); tmpVec.SetZ(tpcExitPos[2]);
1090 tFemtoV0->SetNominalTpcExitPointPos(tmpVec);
1092 tmpVec.SetX(tpcEntranceNeg[0]); tmpVec.SetY(tpcEntranceNeg[1]); tmpVec.SetZ(tpcEntranceNeg[2]);
1093 tFemtoV0->SetNominalTpcEntrancePointNeg(tmpVec);
1095 tmpVec.SetX(tpcExitNeg[0]); tmpVec.SetY(tpcExitNeg[1]); tmpVec.SetZ(tpcExitNeg[2]);
1096 tFemtoV0->SetNominalTpcExitPointNeg(tmpVec);
1098 AliFemtoThreeVector vecTpcPos[9];
1099 AliFemtoThreeVector vecTpcNeg[9];
1100 for(int i=0;i<9;i++)
1102 vecTpcPos[i].SetX(globalPositionsAtRadiiPos[i][0]); vecTpcPos[i].SetY(globalPositionsAtRadiiPos[i][1]); vecTpcPos[i].SetZ(globalPositionsAtRadiiPos[i][2]);
1103 vecTpcNeg[i].SetX(globalPositionsAtRadiiNeg[i][0]); vecTpcNeg[i].SetY(globalPositionsAtRadiiNeg[i][1]); vecTpcNeg[i].SetZ(globalPositionsAtRadiiNeg[i][2]);
1105 tFemtoV0->SetNominalTpcPointPos(vecTpcPos);
1106 tFemtoV0->SetNominalTpcPointNeg(vecTpcNeg);
1108 tFemtoV0->SetTPCMomentumPos(trackpos->GetTPCmomentum());
1109 tFemtoV0->SetTPCMomentumNeg(trackneg->GetTPCmomentum());
1111 tFemtoV0->SetdedxPos(trackpos->GetTPCsignal());
1112 tFemtoV0->SetdedxNeg(trackneg->GetTPCsignal());
1114 if((tFemtoV0->StatusPos()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusPos()&AliESDtrack::kTOFout)==0 )
1116 if((tFemtoV0->StatusNeg()&AliESDtrack::kTOFpid)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTIME)==0 || (tFemtoV0->StatusNeg()&AliESDtrack::kTOFout)==0 )
1118 tFemtoV0->SetPosNSigmaTOFK(-1000);
1119 tFemtoV0->SetNegNSigmaTOFK(-1000);
1120 tFemtoV0->SetPosNSigmaTOFP(-1000);
1121 tFemtoV0->SetNegNSigmaTOFP(-1000);
1122 tFemtoV0->SetPosNSigmaTOFPi(-1000);
1123 tFemtoV0->SetNegNSigmaTOFPi(-1000);
1125 tFemtoV0->SetTOFProtonTimePos(-1000);
1126 tFemtoV0->SetTOFPionTimePos(-1000);
1127 tFemtoV0->SetTOFKaonTimePos(-1000);
1128 tFemtoV0->SetTOFProtonTimeNeg(-1000);
1129 tFemtoV0->SetTOFPionTimeNeg(-1000);
1130 tFemtoV0->SetTOFKaonTimeNeg(-1000);
1135 tFemtoV0->SetPosNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kKaon));
1136 tFemtoV0->SetNegNSigmaTOFK(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kKaon));
1137 tFemtoV0->SetPosNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kProton));
1138 tFemtoV0->SetNegNSigmaTOFP(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kProton));
1139 tFemtoV0->SetPosNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackpos,AliPID::kPion));
1140 tFemtoV0->SetNegNSigmaTOFPi(fAODpidUtil->NumberOfSigmasTOF(trackneg,AliPID::kPion));
1142 double TOFSignalPos = trackpos->GetTOFsignal();
1143 double TOFSignalNeg = trackneg->GetTOFsignal();
1146 trackpos->GetIntegratedTimes(pidPos);
1147 trackneg->GetIntegratedTimes(pidNeg);
1149 tFemtoV0->SetTOFPionTimePos(TOFSignalPos-pidPos[2]);
1150 tFemtoV0->SetTOFKaonTimePos(TOFSignalPos-pidPos[3]);
1151 tFemtoV0->SetTOFProtonTimePos(TOFSignalPos-pidPos[4]);
1152 tFemtoV0->SetTOFPionTimeNeg(TOFSignalNeg-pidNeg[2]);
1153 tFemtoV0->SetTOFKaonTimeNeg(TOFSignalNeg-pidNeg[3]);
1154 tFemtoV0->SetTOFProtonTimeNeg(TOFSignalNeg-pidNeg[4]);
1159 tFemtoV0->SetStatusPos(999);
1160 tFemtoV0->SetStatusNeg(999);
1162 tFemtoV0->SetOnFlyStatusV0(tAODv0->GetOnFlyStatus());
1165 void AliFemtoEventReaderAOD::SetFilterBit(UInt_t ibit)
1167 fFilterBit = (1 << (ibit));
1171 void AliFemtoEventReaderAOD::SetFilterMask(int ibit)
1176 void AliFemtoEventReaderAOD::SetReadMC(unsigned char a)
1182 void AliFemtoEventReaderAOD::SetReadV0(unsigned char a)
1187 void AliFemtoEventReaderAOD::SetUseMultiplicity(EstEventMult aType)
1189 fEstEventMult = aType;
1192 AliAODMCParticle* AliFemtoEventReaderAOD::GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel)
1194 if (aLabel < 0) return 0;
1195 AliAODMCParticle *aodP;
1197 if (aLabel > mcP->GetEntries())
1198 posstack = mcP->GetEntries();
1202 aodP = (AliAODMCParticle *) mcP->At(posstack);
1203 if (aodP->GetLabel() > posstack) {
1205 aodP = (AliAODMCParticle *) mcP->At(posstack);
1206 if (aodP->GetLabel() == aLabel) return aodP;
1209 while (posstack > 0);
1213 aodP = (AliAODMCParticle *) mcP->At(posstack);
1214 if (aodP->GetLabel() == aLabel) return aodP;
1217 while (posstack < mcP->GetEntries());
1223 void AliFemtoEventReaderAOD::CopyPIDtoFemtoTrack(AliAODTrack *tAodTrack,
1224 AliFemtoTrack *tFemtoTrack)
1227 if (fDCAglobalTrack) {
1228 // // copying DCA information (taking it from global tracks gives better resolution than from TPC-only)
1231 double covimpact[3];
1233 if (!tAodTrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),10000,impact,covimpact)) {
1234 //cout << "sth went wrong with dca propagation" << endl;
1235 tFemtoTrack->SetImpactD(-1000.0);
1236 tFemtoTrack->SetImpactZ(-1000.0);
1240 tFemtoTrack->SetImpactD(impact[0]);
1241 tFemtoTrack->SetImpactZ(impact[1]);
1246 tAodTrack->GetPID(aodpid);
1247 tFemtoTrack->SetPidProbElectron(aodpid[0]);
1248 tFemtoTrack->SetPidProbMuon(aodpid[1]);
1249 tFemtoTrack->SetPidProbPion(aodpid[2]);
1250 tFemtoTrack->SetPidProbKaon(aodpid[3]);
1251 tFemtoTrack->SetPidProbProton(aodpid[4]);
1253 aodpid[0] = -100000.0;
1254 aodpid[1] = -100000.0;
1255 aodpid[2] = -100000.0;
1256 aodpid[3] = -100000.0;
1257 aodpid[4] = -100000.0;
1260 Float_t probMis = 1.0;
1262 //what is that code? for what do we need it? nsigma values are not enough?
1263 if (tAodTrack->GetStatus() & AliESDtrack::kTOFpid) { //AliESDtrack::kTOFpid=0x8000
1264 tTOF = tAodTrack->GetTOFsignal();
1265 tAodTrack->GetIntegratedTimes(aodpid);
1267 tTOF -= fAODpidUtil->GetTOFResponse().GetStartTime(tAodTrack->P());
1269 probMis = fAODpidUtil->GetTOFMismatchProbability(tAodTrack);
1274 tFemtoTrack->SetTofExpectedTimes(tTOF-aodpid[2], tTOF-aodpid[3], tTOF-aodpid[4]);
1276 ////// TPC ////////////////////////////////////////////
1278 float nsigmaTPCK=-1000.;
1279 float nsigmaTPCPi=-1000.;
1280 float nsigmaTPCP=-1000.;
1282 // cout<<"in reader fESDpid"<<fESDpid<<endl;
1284 if (tAodTrack->IsOn(AliESDtrack::kTPCpid)){ //AliESDtrack::kTPCpid=0x0080
1285 nsigmaTPCK = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kKaon);
1286 nsigmaTPCPi = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kPion);
1287 nsigmaTPCP = fAODpidUtil->NumberOfSigmasTPC(tAodTrack,AliPID::kProton);
1290 tFemtoTrack->SetNSigmaTPCPi(nsigmaTPCPi);
1291 tFemtoTrack->SetNSigmaTPCK(nsigmaTPCK);
1292 tFemtoTrack->SetNSigmaTPCP(nsigmaTPCP);
1294 tFemtoTrack->SetTPCchi2(tAodTrack->Chi2perNDF());
1295 tFemtoTrack->SetTPCncls(tAodTrack->GetTPCNcls());
1296 tFemtoTrack->SetTPCnclsF(tAodTrack->GetTPCNcls());
1298 tFemtoTrack->SetTPCsignalN(1);
1299 tFemtoTrack->SetTPCsignalS(1);
1300 tFemtoTrack->SetTPCsignal(tAodTrack->GetTPCsignal());
1302 ///////TOF//////////////////////
1305 float nsigmaTOFPi=-1000.;
1306 float nsigmaTOFK=-1000.;
1307 float nsigmaTOFP=-1000.;
1309 if ((tAodTrack->GetStatus() & AliESDtrack::kTOFpid) && //AliESDtrack::kTOFpid=0x8000
1310 (tAodTrack->GetStatus() & AliESDtrack::kTOFout) && //AliESDtrack::kTOFout=0x2000
1311 (tAodTrack->GetStatus() & AliESDtrack::kTIME) //AliESDtrack::kTIME=0x80000000
1312 && probMis < 0.01) // TOF mismatch probaility
1314 if(tAodTrack->IsOn(AliESDtrack::kTOFpid)) //AliESDtrack::kTOFpid=0x8000
1317 nsigmaTOFPi = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kPion);
1318 nsigmaTOFK = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kKaon);
1319 nsigmaTOFP = fAODpidUtil->NumberOfSigmasTOF(tAodTrack,AliPID::kProton);
1321 Double_t len=200;// esdtrack->GetIntegratedLength(); !!!!!
1322 Double_t tof=tAodTrack->GetTOFsignal();
1323 if(tof > 0.) vp=len/tof/0.03;
1326 tFemtoTrack->SetVTOF(vp);
1327 tFemtoTrack->SetNSigmaTOFPi(nsigmaTOFPi);
1328 tFemtoTrack->SetNSigmaTOFK(nsigmaTOFK);
1329 tFemtoTrack->SetNSigmaTOFP(nsigmaTOFP);
1332 //////////////////////////////////////
1336 void AliFemtoEventReaderAOD::SetCentralityPreSelection(double min, double max)
1338 fCentRange[0] = min; fCentRange[1] = max;
1340 fEstEventMult = kCentrality;
1343 void AliFemtoEventReaderAOD::SetNoCentrality(bool anocent)
1345 if(anocent==false) {fEstEventMult=kCentrality;}
1346 else {fEstEventMult=kReference; fUsePreCent = 0; }
1349 void AliFemtoEventReaderAOD::SetAODpidUtil(AliAODpidUtil *aAODpidUtil)
1351 fAODpidUtil = aAODpidUtil;
1352 // printf("fAODpidUtil: %x\n",fAODpidUtil);
1355 void AliFemtoEventReaderAOD::SetAODheader(AliAODHeader *aAODheader)
1357 fAODheader = aAODheader;
1361 void AliFemtoEventReaderAOD::SetMagneticFieldSign(int s)
1371 void AliFemtoEventReaderAOD::SetEPVZERO(Bool_t iepvz)
1376 void AliFemtoEventReaderAOD::GetGlobalPositionAtGlobalRadiiThroughTPC(AliAODTrack *track, Float_t bfield, Float_t globalPositionsAtRadii[9][3])
1378 // Gets the global position of the track at nine different radii in the TPC
1379 // track is the track you want to propagate
1380 // bfield is the magnetic field of your event
1381 // globalPositionsAtRadii is the array of global positions in the radii and xyz
1383 // Initialize the array to something indicating there was no propagation
1384 for(Int_t i=0;i<9;i++){
1385 for(Int_t j=0;j<3;j++){
1386 globalPositionsAtRadii[i][j]=-9999.;
1390 // Make a copy of the track to not change parameters of the track
1391 AliExternalTrackParam etp; etp.CopyFromVTrack(track);
1392 //printf("\nAfter CopyFromVTrack\n");
1395 // The global position of the the track
1396 Double_t xyz[3]={-9999.,-9999.,-9999.};
1398 // Counter for which radius we want
1400 // The radii at which we get the global positions
1401 // IROC (OROC) from 84.1 cm to 132.1 cm (134.6 cm to 246.6 cm)
1402 Float_t Rwanted[9]={85.,105.,125.,145.,165.,185.,205.,225.,245.};
1403 // The global radius we are at
1404 Float_t globalRadius=0;
1406 // Propagation is done in local x of the track
1407 for (Float_t x = etp.GetX();x<247.;x+=1.){ // GetX returns local coordinates
1408 // Starts at the tracks fX and goes outwards. x = 245 is the outer radial limit
1409 // of the TPC when the track is straight, i.e. has inifinite pt and doesn't get bent.
1410 // If the track's momentum is smaller than infinite, it will develop a y-component, which
1411 // adds to the global radius
1413 // Stop if the propagation was not succesful. This can happen for low pt tracks
1414 // that don't reach outer radii
1415 if(!etp.PropagateTo(x,bfield))break;
1416 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1417 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1419 // Roughly reached the radius we want
1420 if(globalRadius > Rwanted[iR]){
1422 // Bigger loop has bad precision, we're nearly one centimeter too far, go back in small steps.
1423 while (globalRadius>Rwanted[iR]){
1425 // printf("propagating to x %5.2f\n",x);
1426 if(!etp.PropagateTo(x,bfield))break;
1427 etp.GetXYZ(xyz); // GetXYZ returns global coordinates
1428 globalRadius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); //Idea to speed up: compare squared radii
1430 //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]);
1431 globalPositionsAtRadii[iR][0]=xyz[0];
1432 globalPositionsAtRadii[iR][1]=xyz[1];
1433 globalPositionsAtRadii[iR][2]=xyz[2];
1434 // Indicate we want the next radius
1444 void AliFemtoEventReaderAOD::SetpA2013(Bool_t pa2013)
1449 void AliFemtoEventReaderAOD::SetDCAglobalTrack(Bool_t dcagt)
1451 fDCAglobalTrack = dcagt;