1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 #include "AliTwoParticlePIDCorr.h"
17 #include "AliVParticle.h"
30 #include "AliCentrality.h"
31 #include "Riostream.h"
34 #include "AliCFContainer.h"
36 #include "THnSparse.h"
40 #include "AliESDpid.h"
41 #include "AliAODpidUtil.h"
42 #include <AliPIDResponse.h>
43 #include "AliPIDCombined.h"
45 #include <AliAnalysisManager.h>
46 #include <AliInputEventHandler.h>
47 #include "AliAODInputHandler.h"
49 #include "AliAnalysisTaskSE.h"
50 #include "AliAnalysisManager.h"
51 #include "AliCentrality.h"
53 #include "AliVEvent.h"
54 #include "AliAODEvent.h"
55 #include "AliAODTrack.h"
56 #include "AliVTrack.h"
58 #include "THnSparse.h"
60 #include "AliAODMCHeader.h"
61 #include "AliAODMCParticle.h"
62 #include "AliMCEventHandler.h"
63 #include "AliMCEvent.h"
64 #include "AliMCParticle.h"
65 #include "TParticle.h"
66 #include <TDatabasePDG.h>
67 #include <TParticlePDG.h>
69 #include "AliGenCocktailEventHeader.h"
70 #include "AliGenEventHeader.h"
71 #include "AliCollisionGeometry.h"
72 #include "AliOADBContainer.h"
74 #include "AliEventPoolManager.h"
75 #include "AliAnalysisUtils.h"
76 using namespace AliPIDNameSpace;
79 ClassImp(AliTwoParticlePIDCorr)
80 ClassImp(LRCParticlePID)
82 const char * kPIDTypeName[]={"TPC","TOF","TPC-TOF"} ;
83 const char * kDetectorName[]={"ITS","TPC","TOF"} ;
84 const char * kParticleSpeciesName[]={"Pions","Kaons","Protons","Undefined"} ;
85 //Source code::dphicorrelations,VnV0, TaskBFpsi, AliHelperPID,
87 //________________________________________________________________________
88 AliTwoParticlePIDCorr::AliTwoParticlePIDCorr() // All data members should be initialised here
93 fCentralityMethod("V0A"),
95 fRequestEventPlane(kFALSE),
96 fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)
101 fSharedClusterCut(-1),
102 fSharedTPCmapCut(-1),
104 skipParticlesAbove(0),
106 ffilltrigassoUNID(kFALSE),
107 ffilltrigUNIDassoID(kFALSE),
108 ffilltrigIDassoUNID(kTRUE),
109 ffilltrigIDassoID(kFALSE),
110 ffilltrigIDassoIDMCTRUTH(kFALSE),
111 fMaxNofMixingTracks(50000),
112 fPtOrderMCTruth(kTRUE),
113 fPtOrderDataReco(kTRUE),
114 fWeightPerEvent(kFALSE),
115 fTriggerSpeciesSelection(kFALSE),
116 fAssociatedSpeciesSelection(kFALSE),
117 fRandomizeReactionPlane(kFALSE),
118 fTriggerSpecies(SpPion),
119 fAssociatedSpecies(SpPion),
122 fSelectHighestPtTrig(kFALSE),
123 fcontainPIDtrig(kTRUE),
124 fcontainPIDasso(kFALSE),
126 frejectPileUp(kFALSE),
131 fselectprimaryTruth(kTRUE),
132 fonlyprimarydatareco(kFALSE),
135 ffillhistQAReco(kFALSE),
136 ffillhistQATruth(kFALSE),
137 kTrackVariablesPair(0),
170 fhistJetTrigestimate(0),
171 fTwoTrackDistancePtdip(0x0),
172 fTwoTrackDistancePtdipmix(0x0),
173 fCentralityCorrelation(0x0),
174 fHistVZEROAGainEqualizationMap(0),
175 fHistVZEROCGainEqualizationMap(0),
176 fHistVZEROChannelGainEqualizationMap(0),
177 fCentralityWeights(0),
180 fHistEQVZEROvsTPCmultiplicity(0x0),
181 fHistEQVZEROAvsTPCmultiplicity(0x0),
182 fHistEQVZEROCvsTPCmultiplicity(0x0),
183 fHistVZEROCvsEQVZEROCmultiplicity(0x0),
184 fHistVZEROAvsEQVZEROAmultiplicity(0x0),
185 fHistVZEROCvsVZEROAmultiplicity(0x0),
186 fHistEQVZEROCvsEQVZEROAmultiplicity(0x0),
187 fHistVZEROSignal(0x0),
188 fHistEventPlaneTruth(0x0),
189 fHistPsiMinusPhi(0x0),
204 gReactionPlane(999.),
232 fControlConvResoncances(0),
247 fCorrelatonTruthPrimary(0),
248 fCorrelatonTruthPrimarymix(0),
254 fTHnCorrIDUNIDmix(0),
256 fTHnTrigcountMCTruthPrim(0),
259 fAnalysisType("AOD"),
261 ftwoTrackEfficiencyCutDataReco(kTRUE),
262 twoTrackEfficiencyCutValue(0.02),
268 fRequestTOFPID(kTRUE),
269 fPIDType(NSigmaTPCTOF),
270 fFIllPIDQAHistos(kTRUE),
273 fdiffPIDcutvalues(kFALSE),
278 fHighPtKaonNSigmaPID(-1),
279 fHighPtKaonSigma(3.5),
280 fUseExclusiveNSigma(kFALSE),
281 fRemoveTracksT0Fill(kFALSE),
283 fTriggerSelectCharge(0),
284 fAssociatedSelectCharge(0),
285 fTriggerRestrictEta(-1),
286 fEtaOrdering(kFALSE),
287 fCutConversions(kFALSE),
288 fCutResonances(kFALSE),
289 fRejectResonanceDaughters(-1),
291 fInjectedSignals(kFALSE),
292 fRemoveWeakDecays(kFALSE),
293 fRemoveDuplicates(kFALSE),
294 fapplyTrigefficiency(kFALSE),
295 fapplyAssoefficiency(kFALSE),
296 ffillefficiency(kFALSE),
297 fmesoneffrequired(kFALSE),
298 fkaonprotoneffrequired(kFALSE),
303 for ( Int_t i = 0; i < 16; i++) {
307 for ( Int_t i = 0; i < 6; i++ ){
308 fTrackHistEfficiency[i] = NULL;
309 effcorection[i]=NULL;
312 for ( Int_t i = 0; i < 2; i++ ){
313 fTwoTrackDistancePt[i]=NULL;
314 fTwoTrackDistancePtmix[i]=NULL;
317 for(Int_t ipart=0;ipart<NSpecies;ipart++)
318 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++)
319 fnsigmas[ipart][ipid]=999.;
321 for(Int_t ipart=0;ipart<NSpecies;ipart++) {fHasDoubleCounting[ipart]=kFALSE;}
323 for(Int_t i = 0; i != 2; ++i)
324 for(Int_t j = 0; j != 2; ++j)
325 for(Int_t iC = 0; iC < 9; iC++){
326 fMeanQ[iC][i][j] = 0.;
327 fWidthQ[iC][i][j] = 1.;
328 fMeanQv3[iC][i][j] = 0.;
329 fWidthQv3[iC][i][j] = 1.;
333 //________________________________________________________________________
334 AliTwoParticlePIDCorr::AliTwoParticlePIDCorr(const char *name) // All data members should be initialised here
335 :AliAnalysisTaskSE(name),
339 fCentralityMethod("V0A"),
341 fRequestEventPlane(kFALSE),
342 fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)
347 fSharedClusterCut(-1),
348 fSharedTPCmapCut(-1),
350 skipParticlesAbove(0),
352 ffilltrigassoUNID(kFALSE),
353 ffilltrigUNIDassoID(kFALSE),
354 ffilltrigIDassoUNID(kTRUE),
355 ffilltrigIDassoID(kFALSE),
356 ffilltrigIDassoIDMCTRUTH(kFALSE),
357 fMaxNofMixingTracks(50000),
358 fPtOrderMCTruth(kTRUE),
359 fPtOrderDataReco(kTRUE),
360 fWeightPerEvent(kFALSE),
361 fTriggerSpeciesSelection(kFALSE),
362 fAssociatedSpeciesSelection(kFALSE),
363 fRandomizeReactionPlane(kFALSE),
364 fTriggerSpecies(SpPion),
365 fAssociatedSpecies(SpPion),
368 fSelectHighestPtTrig(kFALSE),
369 fcontainPIDtrig(kTRUE),
370 fcontainPIDasso(kFALSE),
372 frejectPileUp(kFALSE),
377 fselectprimaryTruth(kTRUE),
378 fonlyprimarydatareco(kFALSE),
381 ffillhistQAReco(kFALSE),
382 ffillhistQATruth(kFALSE),
383 kTrackVariablesPair(0),
416 fhistJetTrigestimate(0),
417 fTwoTrackDistancePtdip(0x0),
418 fTwoTrackDistancePtdipmix(0x0),
419 fCentralityCorrelation(0x0),
420 fHistVZEROAGainEqualizationMap(0),
421 fHistVZEROCGainEqualizationMap(0),
422 fHistVZEROChannelGainEqualizationMap(0),
423 fCentralityWeights(0),
426 fHistEQVZEROvsTPCmultiplicity(0x0),
427 fHistEQVZEROAvsTPCmultiplicity(0x0),
428 fHistEQVZEROCvsTPCmultiplicity(0x0),
429 fHistVZEROCvsEQVZEROCmultiplicity(0x0),
430 fHistVZEROAvsEQVZEROAmultiplicity(0x0),
431 fHistVZEROCvsVZEROAmultiplicity(0x0),
432 fHistEQVZEROCvsEQVZEROAmultiplicity(0x0),
433 fHistVZEROSignal(0x0),
434 fHistEventPlaneTruth(0x0),
435 fHistPsiMinusPhi(0x0),
450 gReactionPlane(999.),
478 fControlConvResoncances(0),
493 fCorrelatonTruthPrimary(0),
494 fCorrelatonTruthPrimarymix(0),
500 fTHnCorrIDUNIDmix(0),
502 fTHnTrigcountMCTruthPrim(0),
505 fAnalysisType("AOD"),
507 ftwoTrackEfficiencyCutDataReco(kTRUE),
508 twoTrackEfficiencyCutValue(0.02),
514 fRequestTOFPID(kTRUE),
515 fPIDType(NSigmaTPCTOF),
516 fFIllPIDQAHistos(kTRUE),
519 fdiffPIDcutvalues(kFALSE),
524 fHighPtKaonNSigmaPID(-1),
525 fHighPtKaonSigma(3.5),
526 fUseExclusiveNSigma(kFALSE),
527 fRemoveTracksT0Fill(kFALSE),
529 fTriggerSelectCharge(0),
530 fAssociatedSelectCharge(0),
531 fTriggerRestrictEta(-1),
532 fEtaOrdering(kFALSE),
533 fCutConversions(kFALSE),
534 fCutResonances(kFALSE),
535 fRejectResonanceDaughters(-1),
537 fInjectedSignals(kFALSE),
538 fRemoveWeakDecays(kFALSE),
539 fRemoveDuplicates(kFALSE),
540 fapplyTrigefficiency(kFALSE),
541 fapplyAssoefficiency(kFALSE),
542 ffillefficiency(kFALSE),
543 fmesoneffrequired(kFALSE),
544 fkaonprotoneffrequired(kFALSE),
547 // The last in the above list should not have a comma after it
551 for ( Int_t i = 0; i < 16; i++) {
555 for ( Int_t i = 0; i < 6; i++ ){
556 fTrackHistEfficiency[i] = NULL;
557 effcorection[i]=NULL;
561 for ( Int_t i = 0; i < 2; i++ ){
562 fTwoTrackDistancePt[i]=NULL;
563 fTwoTrackDistancePtmix[i]=NULL;
566 for(Int_t ipart=0;ipart<NSpecies;ipart++)
567 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++)
568 fnsigmas[ipart][ipid]=999.;
570 for(Int_t ipart=0;ipart<NSpecies;ipart++) {fHasDoubleCounting[ipart]=kFALSE;}
572 for(Int_t i = 0; i != 2; ++i)
573 for(Int_t j = 0; j != 2; ++j)
574 for(Int_t iC = 0; iC < 9; iC++){
575 fMeanQ[iC][i][j] = 0.;
576 fWidthQ[iC][i][j] = 1.;
577 fMeanQv3[iC][i][j] = 0.;
578 fWidthQv3[iC][i][j] = 1.;
582 // Define input and output slots here (never in the dummy constructor)
583 // Input slot #0 works with a TChain - it is connected to the default input container
584 // Output slot #1 writes into a TH1 container
586 DefineOutput(1, TList::Class()); // for output list
587 DefineOutput(2, TList::Class());
591 //________________________________________________________________________
592 AliTwoParticlePIDCorr::~AliTwoParticlePIDCorr()
594 // Destructor. Clean-up the output list, but not the histograms that are put inside
595 // (the list is owner and will clean-up these histograms). Protect in PROOF case.
596 if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
601 if (fOutputList && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
606 if (fPID) delete fPID;
607 if (fPIDCombined) delete fPIDCombined;
610 //________________________________________________________________________
612 //////////////////////////////////////////////////////////////////////////////////////////////////
614 TH2F* AliTwoParticlePIDCorr::GetHistogram2D(const char * name){
615 // returns histo named name
616 return (TH2F*) fOutputList->FindObject(name);
619 //////////////////////////////////////////////////////////////////////////////////////////////////
621 Float_t AliTwoParticlePIDCorr::PhiRange(Float_t DPhi)
625 // Puts the argument in the range [-pi/2,3 pi/2].
628 if (DPhi < -TMath::Pi()/2) DPhi += 2*TMath::Pi();
629 if (DPhi > 3*TMath::Pi()/2) DPhi -= 2*TMath::Pi();
634 //________________________________________________________________________
635 void AliTwoParticlePIDCorr::UserCreateOutputObjects()
638 // Called once (on the worker node)
639 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
640 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
641 fPID = inputHandler->GetPIDResponse();
643 //AliAnalysisUtils *fUtils = new AliAnalysisUtils();
645 //get the efficiency correction map
647 // global switch disabling the reference
648 // (to avoid "Replacing existing TH1" if several wagons are created in train)
649 Bool_t oldStatus = TH1::AddDirectoryStatus();
650 TH1::AddDirectory(kFALSE);
652 const Int_t nPsiTOF = 10;
653 const Int_t nCentrBin = 9;
656 fOutput = new TList();
657 fOutput->SetOwner(); // IMPORTANT!
659 fOutputList = new TList;
660 fOutputList->SetOwner();
661 fOutputList->SetName("PIDQAList");
665 fList->SetName("EPQAList");
667 fEventCounter = new TH1F("fEventCounter","EventCounter", 19, 0.5,19.5);
668 fEventCounter->GetXaxis()->SetBinLabel(1,"Event Accesed");
669 fEventCounter->GetXaxis()->SetBinLabel(3,"After PileUP Cut");//only for Data
670 fEventCounter->GetXaxis()->SetBinLabel(5,"Have A Vertex");
671 fEventCounter->GetXaxis()->SetBinLabel(7,"After vertex Cut");
672 fEventCounter->GetXaxis()->SetBinLabel(9,"Getting centrality");
673 fEventCounter->GetXaxis()->SetBinLabel(11,"After centrality flattening");
674 fEventCounter->GetXaxis()->SetBinLabel(13,"Within 0-100% centrality");
675 fEventCounter->GetXaxis()->SetBinLabel(15,"Event Analyzed");
676 //fEventCounter->GetXaxis()->SetBinLabel(8,"Event Analysis finished");
677 fOutput->Add(fEventCounter);
679 fEtaSpectrasso=new TH2F("fEtaSpectraasso","fEtaSpectraasso",180,-0.9,0.9,100,0.,20. );
680 fOutput->Add(fEtaSpectrasso);
682 fphiSpectraasso=new TH2F("fphiSpectraasso","fphiSpectraasso",72,0,2*TMath::Pi(),100,0.,20.);
683 fOutput->Add(fphiSpectraasso);
685 if(fSampleType=="pPb" || fSampleType=="PbPb"){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 20000, 0,40000);
686 fOutput->Add(fCentralityCorrelation);
689 if(fCentralityMethod=="V0M" || fCentralityMethod=="V0A" || fCentralityMethod=="V0C" || fCentralityMethod=="CL1" || fCentralityMethod=="ZNA" || fCentralityMethod=="V0AEq" || fCentralityMethod=="V0CEq" || fCentralityMethod=="V0MEq")
691 TString gCentName[8] = {"V0A","V0C","V0M","V0AEq","V0CEq","V0MEq","CL1","ZNA"};
692 fHistCentStats = new TH2F("fHistCentStats",
693 "Centrality statistics;;Cent percentile",
694 8,-0.5,7.5,220,-5,105);
695 for(Int_t i = 1; i <= 8; i++){
696 fHistCentStats->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());
697 //fHistCentStatsUsed->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());
699 fOutput->Add(fHistCentStats);
702 if(fCentralityMethod.EndsWith("_MANUAL"))
704 fhistcentrality=new TH1F("fhistcentrality","referencemultiplicity",30001,-0.5,30000.5);
705 fOutput->Add(fhistcentrality);
708 fhistcentrality=new TH1F("fhistcentrality","centrality",220,-5,105);
709 fOutput->Add(fhistcentrality);
712 if(fCentralityMethod.EndsWith("_MANUAL"))
714 TString gmultName[4] = {"V0A_MANUAL","V0C_MANUAL","V0M_MANUAL","TRACKS_MANUAL"};
715 fHistRefmult = new TH2F("fHistRefmult",
716 "Reference multiplicity",
717 4,-0.5,3.5,10000,0,20000);
718 for(Int_t i = 1; i <= 4; i++){
719 fHistRefmult->GetXaxis()->SetBinLabel(i,gmultName[i-1].Data());
720 //fHistCentStatsUsed->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());
722 fOutput->Add(fHistRefmult);
724 if(fCentralityMethod == "V0A_MANUAL" || fCentralityMethod == "V0M_MANUAL" || fCentralityMethod == "V0C_MANUAL" ){
725 //TPC vs EQVZERO multiplicity
726 fHistEQVZEROvsTPCmultiplicity = new TH2F("fHistEQVZEROvsTPCmultiplicity","EqVZERO vs TPC multiplicity",10001,-0.5,10000.5,4001,-0.5,4000.5);
727 fHistEQVZEROvsTPCmultiplicity->GetXaxis()->SetTitle("EqVZERO multiplicity (a.u.)");
728 fHistEQVZEROvsTPCmultiplicity->GetYaxis()->SetTitle("TPC multiplicity (a.u.)");
729 fOutput->Add(fHistEQVZEROvsTPCmultiplicity);
732 fHistEQVZEROAvsTPCmultiplicity = new TH2F("fHistEQVZEROAvsTPCmultiplicity","EqVZERO_A vs TPC multiplicity",10001,-0.5,10000.5,4001,-0.5,4000.5);
733 fHistEQVZEROAvsTPCmultiplicity->GetXaxis()->SetTitle("EqVZERO_A multiplicity (a.u.)");
734 fHistEQVZEROAvsTPCmultiplicity->GetYaxis()->SetTitle("TPC multiplicity (a.u.)");
735 fOutput->Add(fHistEQVZEROAvsTPCmultiplicity);
738 fHistEQVZEROCvsTPCmultiplicity = new TH2F("fHistEQVZEROCvsTPCmultiplicity","EqVZERO_C vs TPC multiplicity",10001,-0.5,10000.5,4001,-0.5,4000.5);
739 fHistEQVZEROCvsTPCmultiplicity->GetXaxis()->SetTitle("EqVZERO_C multiplicity (a.u.)");
740 fHistEQVZEROCvsTPCmultiplicity->GetYaxis()->SetTitle("TPC multiplicity (a.u.)");
741 fOutput->Add(fHistEQVZEROCvsTPCmultiplicity);
743 //EQVZERO vs VZERO multiplicity
744 fHistVZEROCvsEQVZEROCmultiplicity = new TH2F("fHistVZEROCvsEQVZEROCmultiplicity","EqVZERO_C vs VZERO_C multiplicity",10001,-0.5,10000.5,10001,-0.5,10000.5);
745 fHistVZEROCvsEQVZEROCmultiplicity->GetXaxis()->SetTitle("VZERO_C multiplicity (a.u.)");
746 fHistVZEROCvsEQVZEROCmultiplicity->GetYaxis()->SetTitle("EqVZERO_C multiplicity (a.u.)");
747 fOutput->Add(fHistVZEROCvsEQVZEROCmultiplicity);
750 fHistVZEROAvsEQVZEROAmultiplicity = new TH2F("fHistVZEROAvsEQVZEROAmultiplicity","EqVZERO_A vs VZERO_A multiplicity",10001,-0.5,10000.5,10001,-0.5,10000.5);
751 fHistVZEROAvsEQVZEROAmultiplicity->GetXaxis()->SetTitle("VZERO_A multiplicity (a.u.)");
752 fHistVZEROAvsEQVZEROAmultiplicity->GetYaxis()->SetTitle("EqVZERO_A multiplicity (a.u.)");
753 fOutput->Add(fHistVZEROAvsEQVZEROAmultiplicity);
756 //VZEROC vs VZEROA multiplicity
757 fHistVZEROCvsVZEROAmultiplicity = new TH2F("fHistVZEROCvsVZEROAmultiplicity","VZERO_C vs VZERO_A multiplicity",10001,-0.5,10000.5,10001,-0.5,10000.5);
758 fHistVZEROCvsVZEROAmultiplicity->GetXaxis()->SetTitle("VZERO_C multiplicity (a.u.)");
759 fHistVZEROCvsVZEROAmultiplicity->GetYaxis()->SetTitle("VZERO_A multiplicity (a.u.)");
760 fOutput->Add(fHistVZEROCvsVZEROAmultiplicity);
764 //EQVZEROC vs EQVZEROA multiplicity
765 fHistEQVZEROCvsEQVZEROAmultiplicity = new TH2F("fHistEQVZEROCvsEQVZEROAmultiplicity","EqVZERO_C vs EqVZERO_A multiplicity",10001,-0.5,10000.5,10001,-0.5,10000.5);
766 fHistEQVZEROCvsEQVZEROAmultiplicity->GetXaxis()->SetTitle("EqVZERO_C multiplicity (a.u.)");
767 fHistEQVZEROCvsEQVZEROAmultiplicity->GetYaxis()->SetTitle("EqVZERO_A multiplicity (a.u.)");
768 fOutput->Add(fHistEQVZEROCvsEQVZEROAmultiplicity);
770 fHistVZEROSignal = new TH2F("fHistVZEROSignal","VZERO signal vs VZERO channel;VZERO channel; Signal (a.u.)",64,0.5,64.5,3001,-0.5,30000.5);
771 fOutput->Add(fHistVZEROSignal);
775 if(fRequestEventPlane){
778 fHistPsiMinusPhi = new TH2D("fHistPsiMinusPhi","",4,-0.5,3.5,100,0,2.*TMath::Pi());
779 fList->Add(fHistPsiMinusPhi);
781 fEventPlanePID = new TH3F("fEventPlanePID",";centrality;eventplane;PID",20,0.0,100.0,4,-0.5,3.5,4,-0.5,3.5);
782 fList->Add(fEventPlanePID);
786 if(fCutConversions || fCutResonances)
788 fControlConvResoncances = new TH2F("fControlConvResoncances", ";id;delta mass", 3, -0.5, 2.5, 100, -0.1, 0.1);
789 fOutput->Add(fControlConvResoncances);
792 fHistoTPCdEdx = new TH2F("fHistoTPCdEdx", ";p_{T} (GeV/c);dE/dx (au.)",200,0.0,10.0,500, 0., 500.);
793 fOutputList->Add(fHistoTPCdEdx);
794 fHistoTOFbeta = new TH2F(Form("fHistoTOFbeta"), ";p_{T} (GeV/c);v/c",100, 0., fmaxPt, 500, 0.1, 1.1);
795 fOutputList->Add(fHistoTOFbeta);
797 fTPCTOFPion3d=new TH3F ("fTPCTOFpion3d", "fTPCTOFpion3d",100,0., 10., 120,-60.,60.,120,-60.,60);
798 fOutputList->Add(fTPCTOFPion3d);
800 fTPCTOFKaon3d=new TH3F ("fTPCTOFKaon3d", "fTPCTOFKaon3d",100,0., 10., 120,-60.,60.,120,-60.,60);
801 fOutputList->Add(fTPCTOFKaon3d);
803 fTPCTOFProton3d=new TH3F ("fTPCTOFProton3d", "fTPCTOFProton3d",100,0., 10., 120,-60.,60.,120,-60.,60);
804 fOutputList->Add(fTPCTOFProton3d);
808 fPionPt = new TH1F("fPionPt","p_{T} distribution",200,0.,10.);
809 fOutputList->Add(fPionPt);
810 fPionEta= new TH1F("fPionEta","#eta distribution",360,-1.8,1.8);
811 fOutputList->Add(fPionEta);
812 fPionPhi = new TH1F("fPionPhi","#phi distribution",340,0,6.8);
813 fOutputList->Add(fPionPhi);
815 fKaonPt = new TH1F("fKaonPt","p_{T} distribution",200,0.,10.);
816 fOutputList->Add(fKaonPt);
817 fKaonEta= new TH1F("fKaonEta","#eta distribution",360,-1.8,1.8);
818 fOutputList->Add(fKaonEta);
819 fKaonPhi = new TH1F("fKaonPhi","#phi distribution",340,0,6.8);
820 fOutputList->Add(fKaonPhi);
822 fProtonPt = new TH1F("fProtonPt","p_{T} distribution",200,0.,10.);
823 fOutputList->Add(fProtonPt);
824 fProtonEta= new TH1F("fProtonEta","#eta distribution",360,-1.8,1.8);
825 fOutputList->Add(fProtonEta);
826 fProtonPhi= new TH1F("fProtonPhi","#phi distribution",340,0,6.8);
827 fOutputList->Add(fProtonPhi);
830 fHistQA[0] = new TH1F("fHistQAvx", "Histo Vx All ", 50, -5., 5.);
831 fHistQA[1] = new TH1F("fHistQAvy", "Histo Vy All", 50, -5., 5.);
832 fHistQA[2] = new TH1F("fHistQAvz", "Histo Vz All", 50, -25., 25.);
833 fHistQA[3] = new TH1F("fHistQAvxA", "Histo Vx After Cut ", 50, -5., 5.);
834 fHistQA[4] = new TH1F("fHistQAvyA", "Histo Vy After Cut", 50, -5., 5.);
835 fHistQA[5] = new TH1F("fHistQAvzA", "Histo Vz After Cut", 50, -25., 25.);
836 fHistQA[6] = new TH1F("fHistQADcaXyC", "Histo DCAxy after cut", 50, -5., 5.);
837 fHistQA[7] = new TH1F("fHistQADcaZC", "Histo DCAz after cut", 50, -5., 5.);
838 fHistQA[8] = new TH1F("fHistQAPt","p_{T} distribution",200,0.,10.);
839 fHistQA[9] = new TH1F("fHistQAEta","#eta distribution",360,-1.8,1.8);
840 fHistQA[10] = new TH1F("fHistQAPhi","#phi distribution",340,0,6.8);
841 fHistQA[11] = new TH1F("fHistQANCls","Number of TPC cluster",200,0,200);
842 fHistQA[13] = new TH1F("fHistQAChi2","Chi2 per NDF",100,0,10);
843 fHistQA[12] = new TH1F("fHistQANCls1","Number of TPC cluster1",200,0,200);
844 fHistQA[14] = new TH1F("nCrossedRowsTPC","Number of TPC ccrossed rows",200,0,200);
845 fHistQA[15] = new TH1F("ratioCrossedRowsOverFindableClustersTPC","Number of TPC ccrossed rows find clusters",200,0,2);
847 for(Int_t i = 0; i < 16; i++)
849 fOutput->Add(fHistQA[i]);
852 fPriHistShare = new TH1F ("fPriHistShare","Shared clusters, primaries;#shared clusters;counts",160,0,160);
853 fOutput->Add(fPriHistShare);
855 Int_t eventplaneaxis=0;
857 if (fRequestEventPlane) eventplaneaxis=1;
859 kTrackVariablesPair=6+SetChargeAxis+eventplaneaxis;
861 if(fcontainPIDtrig && !fcontainPIDasso) kTrackVariablesPair=7+SetChargeAxis+eventplaneaxis;
863 if(!fcontainPIDtrig && fcontainPIDasso) kTrackVariablesPair=7+SetChargeAxis+eventplaneaxis;
865 if(fcontainPIDtrig && fcontainPIDasso) kTrackVariablesPair=8+SetChargeAxis+eventplaneaxis;
868 // two particle histograms
869 Int_t anaSteps = 1; // analysis steps
870 const char* title = "d^{2}N_{ch}/d#varphid#eta";
872 Int_t iBinPair[kTrackVariablesPair]; // binning for track variables
873 Double_t* dBinsPair[kTrackVariablesPair]; // bins for track variables
874 TString* axisTitlePair; // axis titles for track variables
875 axisTitlePair=new TString[kTrackVariablesPair];
877 TString defaultBinningStr;
878 defaultBinningStr = "eta: -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0\n"
879 "p_t_assoc: 0.5, 0.75, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 8.0,10.0\n"
880 "p_t_leading_course: 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0,10.0\n"
881 "p_t_eff:0.0,0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0,5.5, 6.0, 7.0, 8.0,9.0,10.0\n"
882 "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"
883 "delta_phi: -1.570796, -1.483530, -1.396263, -1.308997, -1.221730, -1.134464, -1.047198, -0.959931, -0.872665, -0.785398, -0.698132, -0.610865, -0.523599, -0.436332, -0.349066, -0.261799, -0.174533, -0.087266, 0.0, 0.087266, 0.174533, 0.261799, 0.349066, 0.436332, 0.523599, 0.610865, 0.698132, 0.785398, 0.872665, 0.959931, 1.047198, 1.134464, 1.221730, 1.308997, 1.396263, 1.483530, 1.570796, 1.658063, 1.745329, 1.832596, 1.919862, 2.007129, 2.094395, 2.181662, 2.268928, 2.356194, 2.443461, 2.530727, 2.617994, 2.705260, 2.792527, 2.879793, 2.967060, 3.054326, 3.141593, 3.228859, 3.316126, 3.403392, 3.490659, 3.577925, 3.665191, 3.752458, 3.839724, 3.926991, 4.014257, 4.101524, 4.188790, 4.276057, 4.363323, 4.450590, 4.537856, 4.625123, 4.712389\n" // this binning starts at -pi/2 and is modulo 3
884 "delta_eta: -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,2.1, 2.2, 2.3, 2.4\n"
885 "multiplicity: 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1\n";
887 if(fRequestEventPlane){
888 defaultBinningStr += "eventPlane: -0.5,0.5,1.5,2.5,3.5\n"; // Event Plane Bins (Psi: -0.5->0.5 (in plane), 0.5->1.5 (intermediate), 1.5->2.5 (out of plane), 2.5->3.5 (rest))
892 defaultBinningStr += "PIDTrig: -0.5,0.5,1.5,2.5,3.5\n"; // course
895 defaultBinningStr += "PIDAsso: -0.5,0.5,1.5,2.5,3.5\n"; // course
898 if(SetChargeAxis==2){
899 defaultBinningStr += "TrigCharge: -2.0,0.0,2.0\n"; // course
900 defaultBinningStr += "AssoCharge: -2.0,0.0,2.0\n"; // course
902 // =========================================================
903 // Customization (adopted from AliUEHistograms)
904 // =========================================================
906 TObjArray* lines = defaultBinningStr.Tokenize("\n");
907 for (Int_t i=0; i<lines->GetEntriesFast(); i++)
909 TString line(lines->At(i)->GetName());
910 TString tag = line(0, line.Index(":")+1);
911 if (!fCustomBinning.BeginsWith(tag) && !fCustomBinning.Contains(TString("\n") + tag))
912 fBinningString += line + "\n";
914 AliInfo(Form("Using custom binning for %s", tag.Data()));
917 fBinningString += fCustomBinning;
919 AliInfo(Form("Used AliTHn Binning:\n%s",fBinningString.Data()));
921 // =========================================================
923 // =========================================================
925 dBinsPair[0] = GetBinning(fBinningString, "multiplicity", iBinPair[0]);
926 axisTitlePair[0] = " multiplicity";
928 dBinsPair[1] = GetBinning(fBinningString, "vertex", iBinPair[1]);
929 axisTitlePair[1] = "v_{Z} (cm)";
931 dBinsPair[2] = GetBinning(fBinningString, "p_t_leading_course", iBinPair[2]);
932 axisTitlePair[2] = "p_{T,trig.} (GeV/c)";
934 dBinsPair[3] = GetBinning(fBinningString, "p_t_assoc", iBinPair[3]);
935 axisTitlePair[3] = "p_{T,assoc.} (GeV/c)";
937 dBinsPair[4] = GetBinning(fBinningString, "delta_eta", iBinPair[4]);
938 axisTitlePair[4] = "#Delta#eta";
940 dBinsPair[5] = GetBinning(fBinningString, "delta_phi", iBinPair[5]);
941 axisTitlePair[5] = "#Delta#varphi (rad)";
945 if(fRequestEventPlane){
946 dBinsPair[dim_val] = GetBinning(fBinningString, "eventPlane", iBinPair[dim_val]);
947 axisTitlePair[dim_val] = "#varphi - #Psi_{2} (a.u.)";
951 if(!fcontainPIDtrig && !fcontainPIDasso && SetChargeAxis==2){
952 dBinsPair[dim_val] = GetBinning(fBinningString, "TrigCharge", iBinPair[dim_val]);
953 axisTitlePair[dim_val] = "TrigCharge";
955 dBinsPair[dim_val+1] = GetBinning(fBinningString, "AssoCharge", iBinPair[dim_val+1]);
956 axisTitlePair[dim_val+1] = "AssoCharge";
959 if(fcontainPIDtrig && !fcontainPIDasso){
960 dBinsPair[dim_val] = GetBinning(fBinningString, "PIDTrig", iBinPair[dim_val]);
961 axisTitlePair[dim_val] = "PIDTrig";
962 if(SetChargeAxis==2){
963 dBinsPair[dim_val+1] = GetBinning(fBinningString, "TrigCharge", iBinPair[dim_val+1]);
964 axisTitlePair[dim_val+1] = "TrigCharge";
966 dBinsPair[dim_val+2] = GetBinning(fBinningString, "AssoCharge", iBinPair[dim_val+2]);
967 axisTitlePair[dim_val+2] = "AssoCharge";
971 if(!fcontainPIDtrig && fcontainPIDasso){
972 dBinsPair[dim_val] = GetBinning(fBinningString, "PIDAsso", iBinPair[dim_val]);
973 axisTitlePair[dim_val] = "PIDAsso";
975 if(SetChargeAxis==2){
976 dBinsPair[dim_val+1] = GetBinning(fBinningString, "TrigCharge", iBinPair[dim_val+1]);
977 axisTitlePair[dim_val+1] = "TrigCharge";
979 dBinsPair[dim_val+2] = GetBinning(fBinningString, "AssoCharge", iBinPair[dim_val+2]);
980 axisTitlePair[dim_val+2] = "AssoCharge";
984 if(fcontainPIDtrig && fcontainPIDasso){
986 dBinsPair[dim_val] = GetBinning(fBinningString, "PIDTrig", iBinPair[dim_val]);
987 axisTitlePair[dim_val] = "PIDTrig";
989 dBinsPair[dim_val+1] = GetBinning(fBinningString, "PIDAsso", iBinPair[dim_val+1]);
990 axisTitlePair[dim_val+1] = "PIDAsso";
992 if(SetChargeAxis==2){
993 dBinsPair[dim_val+2] = GetBinning(fBinningString, "TrigCharge", iBinPair[dim_val+2]);
994 axisTitlePair[dim_val+2] = "TrigCharge";
996 dBinsPair[dim_val+3] = GetBinning(fBinningString, "AssoCharge", iBinPair[dim_val+3]);
997 axisTitlePair[dim_val+3] = "AssoCharge";
1002 Double_t* EtaBin = GetBinning(fBinningString, "eta", nEtaBin);
1004 Int_t nPteffbin = -1;
1005 Double_t* Pteff = GetBinning(fBinningString, "p_t_eff", nPteffbin);
1008 fminPtTrig=dBinsPair[2][0];
1009 fmaxPtTrig=dBinsPair[2][iBinPair[2]];
1010 fminPtAsso=dBinsPair[3][0];
1011 fmaxPtAsso=dBinsPair[3][iBinPair[3]];
1012 fmincentmult=dBinsPair[0][0];
1013 fmaxcentmult=dBinsPair[0][iBinPair[0]];
1015 //event pool manager
1016 Int_t MaxNofEvents=1000;
1017 const Int_t NofVrtxBins=10+(1+10)*2;
1018 Double_t ZvrtxBins[NofVrtxBins+1]={ -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10,
1019 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110,
1020 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210};
1022 if(fCentralityMethod.EndsWith("_MANUAL"))
1024 const Int_t NofCentBins=10;
1025 Double_t CentralityBins[NofCentBins+1]={0.,9.,14.,19.,26.,34.,44.,58.,80.,500.,1000.};//Is This binning is fine for pp, or we don't require them....
1026 if(fRequestEventPlane){
1027 // Event plane angle (Psi) bins
1029 Double_t* psibins = NULL;
1031 psibins = GetBinning(fBinningString, "eventPlane", nPsiBins);
1033 const Int_t nPsiBins=6;
1034 Double_t psibins[nPsiBins+1]={0.0*TMath::DegToRad(), 30.0*TMath::DegToRad(), 60.0*TMath::DegToRad(), 90.0*TMath::DegToRad(), 120.0*TMath::DegToRad(),150.0*TMath::DegToRad(),180.1*TMath::DegToRad()};
1035 fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins, nPsiBins, psibins);
1036 // if(psibins) delete [] psibins;
1040 const Int_t nPsiBinsd=1;
1041 Double_t psibinsd[nPsiBinsd+1]={0.0, 2000.0};
1042 fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins, nPsiBinsd, psibinsd);
1044 // fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);
1046 fPoolMgr->SetTargetValues(fMaxNofMixingTracks, 0.1, 5);
1051 const Int_t NofCentBins=15;
1052 Double_t CentralityBins[NofCentBins+1]={0., 1., 2., 3., 4., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.1 };
1053 if(fRequestEventPlane){
1054 // Event plane angle (Psi) bins
1056 Double_t* psibins = NULL;
1058 psibins = GetBinning(fBinningString, "eventPlane", nPsiBins);
1060 const Int_t nPsiBins=6;
1061 Double_t psibins[nPsiBins+1]={0.0*TMath::DegToRad(), 30.0*TMath::DegToRad(), 60.0*TMath::DegToRad(), 90.0*TMath::DegToRad(), 120.0*TMath::DegToRad(),150.0*TMath::DegToRad(),180.1*TMath::DegToRad()};
1062 fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins, nPsiBins, psibins);
1063 // if(psibins) delete [] psibins;
1067 const Int_t nPsiBinsd=1;
1068 Double_t psibinsd[nPsiBinsd+1]={0.0, 2000.0};
1069 fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins, nPsiBinsd, psibinsd);
1071 //fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);
1073 fPoolMgr->SetTargetValues(fMaxNofMixingTracks, 0.1, 5);
1078 AliError("Event Mixing required, but Pool Manager not initialized...");
1082 //fminPtComboeff=fminPtTrig;***then this value will be fixed ,even Setter can't change it's value
1083 //fmaxPtComboeff=fmaxPtTrig;
1084 //THnSparses for calculation of efficiency
1086 if((fAnalysisType =="MCAOD") && ffillefficiency) {
1089 effbin[0]=iBinPair[0];
1090 effbin[1]=iBinPair[1];
1091 effbin[2]=nPteffbin;
1093 Int_t effsteps=5;//for each species type::primMCParticles(0),primRecoTracksMatched(1),allRecoTracksMatched(2),primRecoTracksMatchedPID(3),allRecoTracksMatchedPID(4)
1094 for(Int_t jj=0;jj<6;jj++)//PID type binning
1096 if(jj==5) effsteps=3;//for unidentified particles
1097 Histrename="fTrackHistEfficiency";Histrename+=jj;
1098 fTrackHistEfficiency[jj] = new AliTHn(Histrename.Data(), "Tracking efficiency", effsteps, 4, effbin);
1099 fTrackHistEfficiency[jj]->SetBinLimits(0, dBinsPair[0]);
1100 fTrackHistEfficiency[jj]->SetVarTitle(0, "Centrality");
1101 fTrackHistEfficiency[jj]->SetBinLimits(1, dBinsPair[1]);
1102 fTrackHistEfficiency[jj]->SetVarTitle(1, "zvtx");
1103 fTrackHistEfficiency[jj]->SetBinLimits(2, Pteff);
1104 fTrackHistEfficiency[jj]->SetVarTitle(2, "p_{T} (GeV/c)");
1105 fTrackHistEfficiency[jj]->SetBinLimits(3, EtaBin);
1106 fTrackHistEfficiency[jj]->SetVarTitle(3, "#eta");
1107 fOutput->Add(fTrackHistEfficiency[jj]);
1111 //AliThns for Correlation plots(data & MC)
1113 if(ffilltrigassoUNID)
1115 fTHnCorrUNID = new AliTHn("fTHnCorrUNID", title, anaSteps, kTrackVariablesPair, iBinPair);
1116 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1117 fTHnCorrUNID->SetBinLimits(j, dBinsPair[j]);
1118 fTHnCorrUNID->SetVarTitle(j, axisTitlePair[j]);
1120 fOutput->Add(fTHnCorrUNID);
1122 fTHnCorrUNIDmix = new AliTHn("fTHnCorrUNIDmix", title, anaSteps, kTrackVariablesPair, iBinPair);
1123 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1124 fTHnCorrUNIDmix->SetBinLimits(j, dBinsPair[j]);
1125 fTHnCorrUNIDmix->SetVarTitle(j, axisTitlePair[j]);
1127 fOutput->Add(fTHnCorrUNIDmix);
1130 if(ffilltrigIDassoID)
1132 fTHnCorrID = new AliTHn("fTHnCorrID", title, anaSteps, kTrackVariablesPair, iBinPair);
1133 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1134 fTHnCorrID->SetBinLimits(j, dBinsPair[j]);
1135 fTHnCorrID->SetVarTitle(j, axisTitlePair[j]);
1137 fOutput->Add(fTHnCorrID);
1139 fTHnCorrIDmix = new AliTHn("fTHnCorrIDmix", title, anaSteps, kTrackVariablesPair, iBinPair);
1140 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1141 fTHnCorrIDmix->SetBinLimits(j, dBinsPair[j]);
1142 fTHnCorrIDmix->SetVarTitle(j, axisTitlePair[j]);
1144 fOutput->Add(fTHnCorrIDmix);
1147 if(ffilltrigUNIDassoID || ffilltrigIDassoUNID)//***********a bit tricky, be careful
1149 fTHnCorrIDUNID = new AliTHn("fTHnCorrIDUNID", title, anaSteps, kTrackVariablesPair, iBinPair);
1150 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1151 fTHnCorrIDUNID->SetBinLimits(j, dBinsPair[j]);
1152 fTHnCorrIDUNID->SetVarTitle(j, axisTitlePair[j]);
1154 fOutput->Add(fTHnCorrIDUNID);
1157 fTHnCorrIDUNIDmix = new AliTHn("fTHnCorrIDUNIDmix", title, anaSteps, kTrackVariablesPair, iBinPair);
1158 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1159 fTHnCorrIDUNIDmix->SetBinLimits(j, dBinsPair[j]);
1160 fTHnCorrIDUNIDmix->SetVarTitle(j, axisTitlePair[j]);
1162 fOutput->Add(fTHnCorrIDUNIDmix);
1167 //ThnSparse for Correlation plots(truth MC)
1168 if((fAnalysisType == "MCAOD") && ffilltrigIDassoIDMCTRUTH) {//remember that in this case uidentified means other than pions, kaons, protons
1170 fCorrelatonTruthPrimary = new AliTHn("fCorrelatonTruthPrimary", title, anaSteps, kTrackVariablesPair, iBinPair);
1171 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1172 fCorrelatonTruthPrimary->SetBinLimits(j, dBinsPair[j]);
1173 fCorrelatonTruthPrimary->SetVarTitle(j, axisTitlePair[j]);
1175 fOutput->Add(fCorrelatonTruthPrimary);
1178 fCorrelatonTruthPrimarymix = new AliTHn("fCorrelatonTruthPrimarymix", title, anaSteps, kTrackVariablesPair, iBinPair);
1179 for (Int_t j=0; j<kTrackVariablesPair; j++) {
1180 fCorrelatonTruthPrimarymix->SetBinLimits(j, dBinsPair[j]);
1181 fCorrelatonTruthPrimarymix->SetVarTitle(j, axisTitlePair[j]);
1183 fOutput->Add(fCorrelatonTruthPrimarymix);
1186 //binning for trigger no. counting
1189 if(SetChargeAxis==2) ChargeAxis=1;
1192 Int_t dims=3+ChargeAxis+eventplaneaxis;
1193 if(fcontainPIDtrig) dims=4+ChargeAxis+eventplaneaxis;
1194 fBinst= new Int_t[dims];
1195 Double_t* dBinsTrig[dims]; // bins for track variables
1196 TString* axisTitleTrig; // axis titles for track variables
1197 axisTitleTrig=new TString[dims];
1199 for(Int_t i=0; i<3;i++)
1201 fBinst[i]=iBinPair[i];
1202 dBinsTrig[i]=dBinsPair[i];
1203 axisTitleTrig[i]=axisTitlePair[i];
1205 Int_t dim_val_trig=3;
1206 if(fRequestEventPlane){
1207 fBinst[dim_val_trig]=iBinPair[6];//if fRequestEventPlane=TRUE, dim_val already becomes 7.
1208 dBinsTrig[dim_val_trig]=dBinsPair[6];
1209 axisTitleTrig[dim_val_trig]=axisTitlePair[6];
1213 if(!fcontainPIDtrig && !fcontainPIDasso && ChargeAxis==1){
1214 fBinst[dim_val_trig]=iBinPair[dim_val];
1215 dBinsTrig[dim_val_trig]=dBinsPair[dim_val];
1216 axisTitleTrig[dim_val_trig]=axisTitlePair[dim_val];
1219 if(fcontainPIDtrig && !fcontainPIDasso){
1220 fBinst[dim_val_trig]=iBinPair[dim_val];
1221 dBinsTrig[dim_val_trig]=dBinsPair[dim_val];
1222 axisTitleTrig[dim_val_trig]=axisTitlePair[dim_val];
1224 fBinst[dim_val_trig+1]=iBinPair[dim_val+1];
1225 dBinsTrig[dim_val_trig+1]=dBinsPair[dim_val+1];
1226 axisTitleTrig[dim_val_trig+1]=axisTitlePair[dim_val+1];
1230 if(!fcontainPIDtrig && fcontainPIDasso){
1232 fBinst[dim_val_trig]=iBinPair[dim_val+1];
1233 dBinsTrig[dim_val_trig]=dBinsPair[dim_val+1];
1234 axisTitleTrig[dim_val_trig]=axisTitlePair[dim_val+1];
1238 if(fcontainPIDtrig && fcontainPIDasso){
1239 fBinst[dim_val_trig]=iBinPair[dim_val];
1240 dBinsTrig[dim_val_trig]=dBinsPair[dim_val];
1241 axisTitleTrig[dim_val_trig]=axisTitlePair[dim_val];
1243 fBinst[dim_val_trig+1]=iBinPair[dim_val+2];
1244 dBinsTrig[dim_val_trig+1]=dBinsPair[dim_val+2];
1245 axisTitleTrig[dim_val_trig+1]=axisTitlePair[dim_val+2];
1249 //ThSparse for trigger counting(data & reco MC)
1250 if(ffilltrigassoUNID || ffilltrigUNIDassoID || ffilltrigIDassoUNID || ffilltrigIDassoID)
1252 fTHnTrigcount = new AliTHn("fTHnTrigcount", "fTHnTrigcount", 2, dims, fBinst); //2 steps;;;;0->same event;;;;;1->mixed event
1253 for(Int_t i=0; i<dims;i++){
1254 fTHnTrigcount->SetBinLimits(i, dBinsTrig[i]);
1255 fTHnTrigcount->SetVarTitle(i, axisTitleTrig[i]);
1257 fOutput->Add(fTHnTrigcount);
1260 if((fAnalysisType =="MCAOD") && ffilltrigIDassoIDMCTRUTH) {
1261 //AliTHns for trigger counting(truth MC)
1262 fTHnTrigcountMCTruthPrim = new AliTHn("fTHnTrigcountMCTruthPrim", "fTHnTrigcountMCTruthPrim", 2, dims, fBinst); //2 steps;;;;0->same event;;;;;1->mixed event
1263 for(Int_t i=0; i<dims;i++){
1264 fTHnTrigcountMCTruthPrim->SetBinLimits(i, dBinsTrig[i]);
1265 fTHnTrigcountMCTruthPrim->SetVarTitle(i, axisTitleTrig[i]);
1267 fOutput->Add(fTHnTrigcountMCTruthPrim);
1270 if(fAnalysisType=="MCAOD"){
1271 if(ffillhistQATruth)
1273 MCtruthpt=new TH1F ("MCtruthpt","ptdistributiontruthprim",100,0.,10.);
1274 fOutputList->Add(MCtruthpt);
1276 MCtrutheta=new TH1F ("MCtrutheta","etadistributiontruthprim",360,-1.8,1.8);
1277 fOutputList->Add(MCtrutheta);
1279 MCtruthphi=new TH1F ("MCtruthphi","phidisttruthprim",340,0,6.8);
1280 fOutputList->Add(MCtruthphi);
1282 MCtruthpionpt=new TH1F ("MCtruthpionpt","MCtruthpionpt",100,0.,10.);
1283 fOutputList->Add(MCtruthpionpt);
1285 MCtruthpioneta=new TH1F ("MCtruthpioneta","MCtruthpioneta",360,-1.8,1.8);
1286 fOutputList->Add(MCtruthpioneta);
1288 MCtruthpionphi=new TH1F ("MCtruthpionphi","MCtruthpionphi",340,0,6.8);
1289 fOutputList->Add(MCtruthpionphi);
1291 MCtruthkaonpt=new TH1F ("MCtruthkaonpt","MCtruthkaonpt",100,0.,10.);
1292 fOutputList->Add(MCtruthkaonpt);
1294 MCtruthkaoneta=new TH1F ("MCtruthkaoneta","MCtruthkaoneta",360,-1.8,1.8);
1295 fOutputList->Add(MCtruthkaoneta);
1297 MCtruthkaonphi=new TH1F ("MCtruthkaonphi","MCtruthkaonphi",340,0,6.8);
1298 fOutputList->Add(MCtruthkaonphi);
1300 MCtruthprotonpt=new TH1F ("MCtruthprotonpt","MCtruthprotonpt",100,0.,10.);
1301 fOutputList->Add(MCtruthprotonpt);
1303 MCtruthprotoneta=new TH1F ("MCtruthprotoneta","MCtruthprotoneta",360,-1.8,1.8);
1304 fOutputList->Add(MCtruthprotoneta);
1306 MCtruthprotonphi=new TH1F ("MCtruthprotonphi","MCtruthprotonphi",340,0,6.8);
1307 fOutputList->Add(MCtruthprotonphi);
1309 fPioncont=new TH2F("fPioncont", "fPioncont",10,-0.5,9.5,100,0.,10.);
1310 fOutputList->Add(fPioncont);
1312 fKaoncont=new TH2F("fKaoncont","fKaoncont",10,-0.5,9.5,100,0.,10.);
1313 fOutputList->Add(fKaoncont);
1315 fProtoncont=new TH2F("fProtoncont","fProtoncont",10,-0.5,9.5,100,0.,10.);
1316 fOutputList->Add(fProtoncont);
1318 fUNIDcont=new TH2F("fUNIDcont","fUNIDcont",10,-0.5,9.5,100,0.,10.);
1319 fOutputList->Add(fUNIDcont);
1322 fEventno=new TH2F("fEventno","fEventno",iBinPair[0], dBinsPair[0],iBinPair[1],dBinsPair[1]);
1323 fEventno->GetXaxis()->SetTitle("Centrality");
1324 fEventno->GetYaxis()->SetTitle("Z_Vtx");
1325 fOutput->Add(fEventno);
1326 fEventnobaryon=new TH2F("fEventnobaryon","fEventnobaryon",iBinPair[0], dBinsPair[0],iBinPair[1],dBinsPair[1]);
1327 fEventnobaryon->GetXaxis()->SetTitle("Centrality");
1328 fEventnobaryon->GetYaxis()->SetTitle("Z_Vtx");
1329 fOutput->Add(fEventnobaryon);
1330 fEventnomeson=new TH2F("fEventnomeson","fEventnomeson",iBinPair[0], dBinsPair[0],iBinPair[1],dBinsPair[1]);
1331 fEventnomeson->GetXaxis()->SetTitle("Centrality");
1332 fEventnomeson->GetYaxis()->SetTitle("Z_Vtx");
1333 fOutput->Add(fEventnomeson);
1335 fhistJetTrigestimate=new TH2F("fhistJetTrigestimate","fhistJetTrigestimate",iBinPair[0],dBinsPair[0],6,-0.5,5.5);
1336 fOutput->Add(fhistJetTrigestimate);
1338 fTwoTrackDistancePtdip = new TH3F("fTwoTrackDistancePtdip", ";#Delta#eta;#Delta#varphi;#Delta p_{T}", 36, -1.8, 1.8, 72,-TMath::Pi()/2, 3*TMath::Pi()/2, 40, 0, 10);
1339 fOutput->Add(fTwoTrackDistancePtdip);
1341 fTwoTrackDistancePtdipmix = new TH3F("fTwoTrackDistancePtdipmix", ";#Delta#eta;#Delta#varphi;#Delta p_{T}", 36, -1.8, 1.8, 72,-TMath::Pi()/2, 3*TMath::Pi()/2, 40, 0, 10);
1342 fOutput->Add(fTwoTrackDistancePtdipmix);
1344 TString Histttrname;
1345 for(Int_t jj=0;jj<2;jj++)// PID type binning
1347 Histttrname="fTwoTrackDistancePt";Histttrname+=jj;
1348 fTwoTrackDistancePt[jj] = new TH3F(Histttrname.Data(), ";#Delta#eta;#Delta#varphi^{*}_{min};#Delta p_{T}", 100, -0.15, 0.15, 100, -0.05, 0.05, 20, 0, 10);
1349 fOutput->Add(fTwoTrackDistancePt[jj]);
1351 Histttrname="fTwoTrackDistancePtmix";Histttrname+=jj;
1352 fTwoTrackDistancePtmix[jj] = new TH3F(Histttrname.Data(), ";#Delta#eta;#Delta#varphi^{*}_{min};#Delta p_{T}", 100, -0.15, 0.15, 100, -0.05, 0.05, 20, 0, 10);
1353 fOutput->Add(fTwoTrackDistancePtmix[jj]);
1356 //DefineEventPool();
1358 if(fapplyTrigefficiency || fapplyAssoefficiency)
1360 const Int_t nDimt = 4;// cent zvtx pt eta
1361 Int_t fBinsCht[nDimt] = {iBinPair[0], iBinPair[1], nPteffbin ,nEtaBin};//*************change it
1362 Double_t fMinCht[nDimt] = { dBinsPair[0][0],dBinsPair[1][0], Pteff[0], EtaBin[0] };
1363 Double_t fMaxCht[nDimt] = {dBinsPair[0][iBinPair[0]], dBinsPair[1][iBinPair[1]], Pteff[nPteffbin], EtaBin[nEtaBin]};
1365 TString Histrexname;
1366 for(Int_t jj=0;jj<6;jj++)// PID type binning
1368 Histrexname="effcorection";Histrexname+=jj;
1369 effcorection[jj] = new THnSparseF(Histrexname.Data(),"cent:zvtx::Pt:eta", nDimt, fBinsCht, fMinCht, fMaxCht);
1370 effcorection[jj]->Sumw2();
1371 effcorection[jj]->GetAxis(0)->Set(iBinPair[0], dBinsPair[0]);
1372 effcorection[jj]->GetAxis(0)->SetTitle("Centrality");
1373 effcorection[jj]->GetAxis(1)->Set( iBinPair[1],dBinsPair[1]);
1374 effcorection[jj]->GetAxis(1)->SetTitle("zvtx");
1375 effcorection[jj]->GetAxis(2)->Set(nPteffbin, Pteff);
1376 effcorection[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
1377 effcorection[jj]->GetAxis(3)->Set( nEtaBin,EtaBin);
1378 effcorection[jj]->GetAxis(3)->SetTitle("#eta");
1379 fOutput->Add(effcorection[jj]);
1381 // TFile *fsifile = new TFile(fefffilename,"READ");
1383 if (TString(fefffilename).BeginsWith("alien:"))
1384 TGrid::Connect("alien:");
1385 TFile *fileT=TFile::Open(fefffilename);
1387 for(Int_t jj=0;jj<6;jj++)//type binning
1389 Nameg="effmap";Nameg+=jj;
1390 //effcorection[jj] = (THnSparseF*)fsifile->Get(Nameg.Data());
1391 effcorection[jj] = (THnSparseF*)fileT->Get(Nameg.Data());
1393 //effcorection[jj]->SetDirectory(0);//****************************not present in case oh THnF
1400 //*************************************************************EP plots***********************************************//
1401 if(fRequestEventPlane){
1402 // TProfile for resolutions 3 subevents (V0A, V0C, TPC)
1404 fHResTPCv0A2 = new TProfile("hResTPCv0A2","",nCentrBin,0,nCentrBin);
1405 fHResTPCv0C2 = new TProfile("hResTPCv0C2","",nCentrBin,0,nCentrBin);
1406 fHResv0Cv0A2 = new TProfile("hResv0Cv0A2","",nCentrBin,0,nCentrBin);
1408 fList->Add(fHResTPCv0A2);
1409 fList->Add(fHResTPCv0C2);
1410 fList->Add(fHResv0Cv0A2);
1413 fHResTPCv0A3 = new TProfile("hResTPCv0A3","",nCentrBin,0,nCentrBin);
1414 fHResTPCv0C3 = new TProfile("hResTPCv0C3","",nCentrBin,0,nCentrBin);
1415 fHResv0Cv0A3 = new TProfile("hResv0Cv0A3","",nCentrBin,0,nCentrBin);
1417 fList->Add(fHResTPCv0A3);
1418 fList->Add(fHResTPCv0C3);
1419 fList->Add(fHResv0Cv0A3);
1421 // MC as in the dataEP resolution (but using MC tracks)
1422 if(fAnalysisType == "MCAOD" && fV2){
1423 fHResMA2 = new TProfile("hResMA2","",nCentrBin,0,nCentrBin);
1424 fHResMC2 = new TProfile("hResMC2","",nCentrBin,0,nCentrBin);
1425 fHResAC2 = new TProfile("hResAC2","",nCentrBin,0,nCentrBin);
1426 fList->Add(fHResMA2);
1427 fList->Add(fHResMC2);
1428 fList->Add(fHResAC2);
1430 if(fAnalysisType == "MCAOD" && fV3){
1431 fHResMA3 = new TProfile("hResMA3","",nCentrBin,0,nCentrBin);
1432 fHResMC3 = new TProfile("hResMC3","",nCentrBin,0,nCentrBin);
1433 fHResAC3 = new TProfile("hResAC3","",nCentrBin,0,nCentrBin);
1434 fList->Add(fHResMA3);
1435 fList->Add(fHResMC3);
1436 fList->Add(fHResAC3);
1440 // V0A and V0C event plane distributions
1442 fPhiRPTPC = new TH2F("fPhiRPTPCv2","#phi distribution of EP TPC;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/2,TMath::Pi()/2);
1443 fPhiRPTPCv3 = new TH2F("fPhiRPTPCv3","#phi distribution of EP TPC;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/3,TMath::Pi()/3);
1444 fList->Add(fPhiRPTPC);
1445 fList->Add(fPhiRPTPCv3);
1447 fPhiRPv0A = new TH2F("fPhiRPv0Av2","#phi distribution of EP VZERO-A;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/2,TMath::Pi()/2);
1448 fPhiRPv0C = new TH2F("fPhiRPv0Cv2","#phi distribution of EP VZERO-C;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/2,TMath::Pi()/2);
1449 fList->Add(fPhiRPv0A);
1450 fList->Add(fPhiRPv0C);
1453 fPhiRPv0Av3 = new TH2F("fPhiRPv0Av3","#phi distribution of EP VZERO-A;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/3,TMath::Pi()/3);
1454 fPhiRPv0Cv3 = new TH2F("fPhiRPv0Cv3","#phi distribution of EP VZERO-C;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/3,TMath::Pi()/3);
1455 fList->Add(fPhiRPv0Av3);
1456 fList->Add(fPhiRPv0Cv3);
1458 fHistEventPlaneTruth = new TH2F("fHistEventPlaneTruth","#phi distribution of EP MCTRUTHheader;centrality;#phi (rad)",nCentrBin,0,nCentrBin,nPsiTOF,-TMath::Pi()/2,TMath::Pi()/2);
1459 fList->Add(fHistEventPlaneTruth);
1463 //*****************************************************PIDQA histos*****************************************************//
1467 for(Int_t ipart=0;ipart<NSpecies;ipart++){
1468 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
1471 if(ipid==NSigmaTPCTOF){miny=0;maxy=50;}
1472 TH2F *fHistoNSigma=new TH2F(Form("NSigma_%d_%d",ipart,ipid),Form("n#sigma %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]),200,0,10,500,miny,maxy);
1473 fHistoNSigma->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1474 fHistoNSigma->GetYaxis()->SetTitle(Form("n#sigma %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]));
1475 fOutputList->Add(fHistoNSigma);
1480 for(Int_t ipart=0;ipart<NSpecies;ipart++){
1481 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
1484 if(ipid==NSigmaTPCTOF){miny=0;maxy=20;}
1485 TH2F *fHistoNSigma=new TH2F(Form("NSigmaRec_%d_%d",ipart,ipid),
1486 Form("n#sigma for reconstructed %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]),200,0,10,500,miny,maxy);
1487 fHistoNSigma->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1488 fHistoNSigma->GetYaxis()->SetTitle(Form("n#sigma %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]));
1489 fOutputList->Add(fHistoNSigma);
1494 if(fPIDType==Bayes){//use bayesianPID
1495 fPIDCombined = new AliPIDCombined();
1496 fPIDCombined->SetDefaultTPCPriors();//****************************************Need to know about it
1498 for(Int_t ipart=0;ipart<NSpecies;ipart++){
1501 TH2F *fHistoBayes=new TH2F(Form("BayesRec_%d",ipart),
1502 Form("probability for reconstructed %s",kParticleSpeciesName[ipart]),200,0,10,500,miny,maxy);
1503 fHistoBayes->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1504 fHistoBayes->GetYaxis()->SetTitle(Form("Bayes prob %s",kParticleSpeciesName[ipart]));
1505 fOutputList->Add(fHistoBayes);
1508 TH2F *fHistoBayesTPC=new TH2F(Form("probBayes_TPC_%d",ipart),
1509 Form("probability for Tracks as %s",kParticleSpeciesName[ipart]),200,0,10,500,miny,maxy);
1510 fHistoBayesTPC->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1511 fHistoBayesTPC->GetYaxis()->SetTitle(Form("Bayes prob TPC %s",kParticleSpeciesName[ipart]));
1512 fOutputList->Add(fHistoBayesTPC);
1514 TH2F *fHistoBayesTOF=new TH2F(Form("probBayes_TOF_%d",ipart),
1515 Form("probability for Tracks as %s",kParticleSpeciesName[ipart]),200,0,10,500,miny,maxy);
1516 fHistoBayesTOF->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1517 fHistoBayesTOF->GetYaxis()->SetTitle(Form("Bayes prob TOF %s",kParticleSpeciesName[ipart]));
1518 fOutputList->Add(fHistoBayesTOF);
1520 TH2F *fHistoBayesTPCTOF=new TH2F(Form("probBayes_TPCTOF_%d",ipart),
1521 Form("probability for Tracks as %s",kParticleSpeciesName[ipart]),200,0,10,500,miny,maxy);
1522 fHistoBayesTPCTOF->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1523 fHistoBayesTPCTOF->GetYaxis()->SetTitle(Form("Bayes prob TPCTOF %s",kParticleSpeciesName[ipart]));
1524 fOutputList->Add(fHistoBayesTPCTOF);
1528 //nsigma separation power plot
1529 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
1532 TH2F *Pi_Ka_sep=new TH2F(Form("Pi_Ka_sep_%d",ipid),
1533 Form("Pi_Ka separation in %s",kPIDTypeName[ipid]),50,0,10,200,miny,maxy);
1534 Pi_Ka_sep->GetXaxis()->SetTitle("P_{T} (GeV/C)");
1535 Pi_Ka_sep->GetYaxis()->SetTitle(Form("expected seaparation(n#sigma) in %s",kPIDTypeName[ipid]));
1536 fOutputList->Add(Pi_Ka_sep);
1538 TH2F *Pi_Pr_sep=new TH2F(Form("Pi_Pr_sep_%d",ipid),
1539 Form("Pi_Pr separation in %s",kPIDTypeName[ipid]),50,0,10,200,miny,maxy);
1540 Pi_Pr_sep->GetXaxis()->SetTitle("P_{T} (GeV/C)");
1541 Pi_Pr_sep->GetYaxis()->SetTitle(Form("expected seaparation(n#sigma) in %s",kPIDTypeName[ipid]));
1542 fOutputList->Add(Pi_Pr_sep);
1544 TH2F *Ka_Pr_sep=new TH2F(Form("Ka_Pr_sep_%d",ipid),
1545 Form("Ka_Pr separation in %s",kPIDTypeName[ipid]),50,0,10,200,miny,maxy);
1546 Ka_Pr_sep->GetXaxis()->SetTitle("P_{T} (GeV/C)");
1547 Ka_Pr_sep->GetYaxis()->SetTitle(Form("expected seaparation(n#sigma) in %s",kPIDTypeName[ipid]));
1548 fOutputList->Add(Ka_Pr_sep);
1552 for(Int_t ipart=0;ipart<NSpecies;ipart++){
1553 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
1556 if(ipid==NSigmaTPCTOF){miny=0;maxy=20;}
1557 TH2F *fHistoNSigma=new TH2F(Form("NSigmaDC_%d_%d",ipart,ipid),
1558 Form("n#sigma for double counting %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]),200,0,10,500,miny,maxy);
1559 fHistoNSigma->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1560 fHistoNSigma->GetYaxis()->SetTitle(Form("n#sigma %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]));
1561 fOutputList->Add(fHistoNSigma);
1566 if (fAnalysisType == "MCAOD"){
1567 for(Int_t ipart=0;ipart<NSpecies;ipart++){
1568 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
1571 if(ipid==NSigmaTPCTOF){miny=0;maxy=50;}
1572 TH2F *fHistoNSigma=new TH2F(Form("NSigmaMC_%d_%d",ipart,ipid),
1573 Form("n#sigma for MC %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]),200,0,10,500,miny,maxy);
1574 fHistoNSigma->GetXaxis()->SetTitle("P_{T} (GeV / c)");
1575 fHistoNSigma->GetYaxis()->SetTitle(Form("n#sigma %s %s",kParticleSpeciesName[ipart],kPIDTypeName[ipid]));
1576 fOutputList->Add(fHistoNSigma);
1581 for(Int_t idet=0;idet<fNDetectors;idet++){
1582 for(Int_t ipart=0;ipart<NSpecies;ipart++){
1584 if(idet==fTOF)maxy=1.1;
1585 TH2F *fHistoPID=new TH2F(Form("PID_%d_%d",idet,ipart),Form("%s signal - %s",kDetectorName[idet],kParticleSpeciesName[ipart]),200,0,10,500,-maxy,maxy);
1586 fHistoPID->GetXaxis()->SetTitle("P (GeV / c)");
1587 fHistoPID->GetYaxis()->SetTitle(Form("%s signal",kDetectorName[idet]));
1588 fOutputList->Add(fHistoPID);
1591 //PID signal plot, before PID cut
1592 for(Int_t idet=0;idet<fNDetectors;idet++){
1594 if(idet==fTOF)maxy=1.1;
1595 TH2F *fHistoPID=new TH2F(Form("PIDAll_%d",idet),Form("%s signal",kDetectorName[idet]),200,0,10,500,-maxy,maxy);
1596 fHistoPID->GetXaxis()->SetTitle("P (GeV / c)");
1597 fHistoPID->GetYaxis()->SetTitle(Form("%s signal",kDetectorName[idet]));
1598 fOutputList->Add(fHistoPID);
1601 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
1602 PostData(2, fOutputList);
1603 if(fRequestEventPlane) PostData(3, fList);
1604 AliInfo("Finished setting up the Output");
1606 TH1::AddDirectory(oldStatus);
1611 //-------------------------------------------------------------------------------
1612 void AliTwoParticlePIDCorr::UserExec( Option_t * ){
1615 if(fAnalysisType == "AOD") {
1619 }//AOD--analysis-----
1621 else if(fAnalysisType == "MCAOD") {
1630 //-------------------------------------------------------------------------
1631 void AliTwoParticlePIDCorr::doMCAODevent()
1633 AliVEvent *event = InputEvent();
1634 if (!event) { Printf("ERROR: Could not retrieve event"); return; }
1635 AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);
1637 AliError("Cannot get the AOD event");
1641 // count all events(physics triggered)
1642 fEventCounter->Fill(1);
1651 gReactionPlane = 999.;
1653 // get centrality object and check quality(valid for p-Pb and Pb-Pb; coming soon for pp 7 TeV)
1654 Double_t cent_v0=-1.0;
1655 Double_t effcent=1.0;
1656 Double_t refmultReco =0.0;
1658 //check the PIDResponse handler
1661 // get mag. field required for twotrack efficiency cut
1663 bSign = (aod->GetMagneticField() > 0) ? 1 : -1;
1665 //check for TClonesArray(truth track MC information)
1666 fArrayMC = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
1668 AliFatal("Error: MC particles branch not found!\n");
1672 //check for AliAODMCHeader(truth event MC information)
1673 AliAODMCHeader *header=NULL;
1674 header=(AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1676 printf("MC header branch not found!\n");
1680 //Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex
1681 Float_t zVtxmc =header->GetVtxZ();
1682 if(TMath::Abs(zVtxmc)>fzvtxcut) return;
1684 // For productions with injected signals, figure out above which label to skip particles/tracks
1686 if (fInjectedSignals)
1688 AliGenEventHeader* eventHeader = 0;
1693 AliFatal("fInjectedSignals set but no MC header found");
1695 headers = header->GetNCocktailHeaders();
1696 eventHeader = header->GetCocktailHeader(0);
1700 // We avoid AliFatal here, because the AOD productions sometimes have events where the MC header is missing
1701 // (due to unreadable Kinematics) and we don't want to loose the whole job because of a few events
1702 AliError("First event header not found. Skipping this event.");
1703 //fHistos->FillEvent(centrality, AliUEHist::kCFStepAnaTopology);
1706 skipParticlesAbove = eventHeader->NProduced();
1707 AliInfo(Form("Injected signals in this event (%d headers). Keeping events of %s. Will skip particles/tracks above %d.", headers, eventHeader->ClassName(), skipParticlesAbove));
1710 if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL"))
1712 //make the event selection with reco vertex cut and centrality cut and return the value of the centrality
1713 Double_t refmultTruth = GetAcceptedEventMultiplicity(aod,kTRUE); //incase of ref multiplicity it will return the truth MC ref mullt value; need to determine the ref mult value separately for reco Mc case; in case of centrality this is final and fine
1714 refmultReco = GetAcceptedEventMultiplicity(aod,kFALSE);
1715 if(refmultTruth<=0 || refmultReco<=0) return;
1716 cent_v0=refmultTruth;
1719 cent_v0=GetAcceptedEventMultiplicity(aod,kTRUE); //centrality value; 2nd argument has no meaning
1720 if(cent_v0<0.) return;
1723 effcent=cent_v0;// This will be required for efficiency THn filling(specially in case of pp)
1725 //get the event plane in case of PbPb
1726 if(fRequestEventPlane){
1727 gReactionPlane=GetEventPlane(aod,kTRUE,cent_v0);//get the truth event plane
1728 if(gReactionPlane==999.) return;
1732 Double_t nooftrackstruth=0.0;//in case of pp this will give the multiplicity(for truth case) after the track loop(only for unidentified particles that pass kinematic cuts)
1734 //TObjArray* tracksMCtruth=0;
1735 TObjArray* tracksMCtruth=new TObjArray;//for truth MC particles with PID,here unidentified means any particle other than pion, kaon or proton(Basicaly Spundefined of AliHelperPID)******WARNING::different from data and reco MC
1736 tracksMCtruth->SetOwner(kTRUE); //***********************************IMPORTANT!
1740 //There is a small difference between zvtx and zVtxmc??????
1741 //cout<<"***********************************************zVtxmc="<<zVtxmc<<endl;
1742 //cout<<"***********************************************zvtx="<<zvtx<<endl;
1744 //now process the truth particles(for both efficiency & correlation function)
1745 Int_t nMCTrack = fArrayMC->GetEntriesFast();
1747 for (Int_t iMC = 0; iMC < nMCTrack; iMC++)
1748 { //MC truth track loop starts
1750 AliAODMCParticle *partMC = (AliAODMCParticle*) fArrayMC->At(iMC);
1753 AliError(Form("ERROR: Could not retrieve AODMCtrack %d",iMC));
1757 //consider only charged particles
1758 if(partMC->Charge() == 0) continue;
1760 //consider only primary particles; neglect all secondary particles including from weak decays
1761 if(fselectprimaryTruth && !partMC->IsPhysicalPrimary()) continue;
1764 //remove injected signals(primaries above <maxLabel>)
1765 if (fInjectedSignals && partMC->GetLabel() >= skipParticlesAbove) continue;
1768 Bool_t isduplicate=kFALSE;
1769 if (fRemoveDuplicates)
1771 for (Int_t j=iMC+1; j<nMCTrack; ++j)
1772 {//2nd trutuh loop starts
1773 AliAODMCParticle *partMC2 = (AliAODMCParticle*) fArrayMC->At(j);
1775 AliError(Form("ERROR: Could not retrieve AODMCtrack %d",j));
1778 if (partMC->GetLabel() == partMC2->GetLabel())
1783 }//2nd truth loop ends
1785 if(fRemoveDuplicates && isduplicate) continue;//remove duplicates
1787 //give only kinematic cuts at the truth level
1788 if (partMC->Eta() < fmineta || partMC->Eta() > fmaxeta) continue;
1789 if (partMC->Pt() < fminPt || partMC->Pt() > fmaxPt) continue;
1791 if(!partMC) continue;//for safety
1793 //To determine multiplicity in case of PP
1795 //cout<<"**************************************"<<TMath::Abs(partMC->GetLabel())<<endl;
1796 //only physical primary(all/unidentified)
1797 if(ffillhistQATruth)
1799 MCtruthpt->Fill(partMC->Pt());
1800 MCtrutheta->Fill(partMC->Eta());
1801 MCtruthphi->Fill(partMC->Phi());
1804 Int_t pdgtruth=((AliAODMCParticle*)partMC)->GetPdgCode();
1805 Int_t particletypeTruth=-999;
1806 if (TMath::Abs(pdgtruth)==211)
1808 particletypeTruth=SpPion;
1809 if(ffillhistQATruth)
1811 MCtruthpionpt->Fill(partMC->Pt());
1812 MCtruthpioneta->Fill(partMC->Eta());
1813 MCtruthpionphi->Fill(partMC->Phi());
1816 if (TMath::Abs(pdgtruth)==321)
1818 particletypeTruth=SpKaon;
1819 if(ffillhistQATruth)
1821 MCtruthkaonpt->Fill(partMC->Pt());
1822 MCtruthkaoneta->Fill(partMC->Eta());
1823 MCtruthkaonphi->Fill(partMC->Phi());
1826 if(TMath::Abs(pdgtruth)==2212)
1828 particletypeTruth=SpProton;
1829 if(ffillhistQATruth)
1831 MCtruthprotonpt->Fill(partMC->Pt());
1832 MCtruthprotoneta->Fill(partMC->Eta());
1833 MCtruthprotonphi->Fill(partMC->Phi());
1836 if(TMath::Abs(pdgtruth)!=211 && TMath::Abs(pdgtruth)!=321 && TMath::Abs(pdgtruth)!=2212) particletypeTruth=unidentified;//*********************WARNING:: situation is different from reco MC and data case(here we don't have SpUndefined particles,because here unidentified=SpUndefined)
1838 if(fRequestEventPlane){
1839 FillPIDEventPlane(cent_v0,particletypeTruth,partMC->Phi(),gReactionPlane);
1842 // -- Fill THnSparse for efficiency and contamination calculation
1843 if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL")) effcent=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicity i.e. multiplicity intregated out )**************Important
1845 Double_t primmctruth[4] = {effcent, zVtxmc,partMC->Pt(), partMC->Eta()};
1848 fTrackHistEfficiency[5]->Fill(primmctruth,0);//for all primary truth particles(4)
1849 if (TMath::Abs(pdgtruth)==211 || TMath::Abs(pdgtruth)==321) fTrackHistEfficiency[3]->Fill(primmctruth,0);//for primary truth mesons(3)
1850 if (TMath::Abs(pdgtruth)==2212 || TMath::Abs(pdgtruth)==321) fTrackHistEfficiency[4]->Fill(primmctruth,0);//for primary truth kaons+protons(4)
1851 if (TMath::Abs(pdgtruth)==211) fTrackHistEfficiency[0]->Fill(primmctruth,0);//for pions
1852 if (TMath::Abs(pdgtruth)==321) fTrackHistEfficiency[1]->Fill(primmctruth,0);//for kaons
1853 if(TMath::Abs(pdgtruth)==2212) fTrackHistEfficiency[2]->Fill(primmctruth,0);//for protons
1856 Float_t effmatrixtruth=1.0;//In Truth MC, no case of efficiency correction so it should be always 1.0
1857 if((partMC->Pt()>=fminPtAsso && partMC->Pt()<=fmaxPtAsso) || (partMC->Pt()>=fminPtTrig && partMC->Pt()<=fmaxPtTrig))//to reduce memory consumption in pool
1859 Short_t chargeval=0;
1860 if(partMC->Charge()>0) chargeval=1;
1861 if(partMC->Charge()<0) chargeval=-1;
1862 if(chargeval==0) continue;
1863 LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,chargeval,partMC->Pt(),partMC->Eta(), partMC->Phi(),effmatrixtruth);
1864 //copy6->SetUniqueID(eventno * 100000 + TMath::Abs(partMC->GetLabel()));
1865 copy6->SetUniqueID(eventno * 100000 + (Int_t)nooftrackstruth);
1866 tracksMCtruth->Add(copy6);//************** TObjArray used for truth correlation function calculation
1868 }//MC truth track loop ends
1870 //*********************still in event loop
1872 if (fSampleType=="PbPb"){
1873 if (fRandomizeReactionPlane)//only for TRuth MC??
1875 Double_t centralityDigits = cent_v0*1000. - (Int_t)(cent_v0*1000.);
1876 Double_t angle = TMath::TwoPi() * centralityDigits;
1877 AliInfo(Form("Shifting phi of all tracks by %f (digits %f)", angle, centralityDigits));
1878 ShiftTracks(tracksMCtruth, angle);
1882 Float_t weghtval=1.0;
1884 if(nooftrackstruth>0.0 && ffilltrigIDassoIDMCTRUTH)
1886 //Fill Correlations for MC truth particles(same event)
1887 if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)//hadron triggered correlation
1888 Fillcorrelation(gReactionPlane,tracksMCtruth,0,cent_v0,zVtxmc,weghtval,kFALSE,bSign,fPtOrderMCTruth,kFALSE,kFALSE,"trigIDassoIDMCTRUTH");//mixcase=kFALSE for same event case
1891 AliEventPool* pool2 = fPoolMgr->GetEventPool(cent_v0, zVtxmc+200, gReactionPlane);
1892 if (pool2 && pool2->IsReady())
1893 {//start mixing only when pool->IsReady
1894 if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)
1895 {//proceed only when no. of trigger particles >0 in current event
1896 Float_t nmix=(Float_t)pool2->GetCurrentNEvents();
1897 for (Int_t jMix=0; jMix<pool2->GetCurrentNEvents(); jMix++)
1898 { //pool event loop start
1899 TObjArray* bgTracks6 = pool2->GetEvent(jMix);
1900 if(!bgTracks6) continue;
1901 Fillcorrelation(gReactionPlane,tracksMCtruth,bgTracks6,cent_v0,zVtxmc,nmix,(jMix == 0),bSign,fPtOrderMCTruth,kFALSE,kTRUE,"trigIDassoIDMCTRUTH");//mixcase=kTRUE for mixing case
1903 }// pool event loop ends mixing case
1904 }//if(trackstrig && trackstrig->GetEntriesFast()>0) condition ends mixing case
1905 } //if pool->IsReady() condition ends mixing case
1907 //still in main event loop
1910 if(pool2) pool2->UpdatePool(CloneAndReduceTrackList(tracksMCtruth));//ownership of tracksasso is with pool now, don't delete it
1914 //still in main event loop
1916 if(tracksMCtruth) delete tracksMCtruth;
1918 //now deal with reco tracks
1920 //detrmine the ref mult in case of Reco(not required if we get centrality info from AliCentrality)
1921 if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL")) cent_v0=refmultReco;
1922 effcent=cent_v0;// This will be required for efficiency THn filling(specially in case of pp)
1924 if(fRequestEventPlane){
1925 gReactionPlane = GetEventPlane(aod,kFALSE,cent_v0);//get the reconstructed event plane
1926 if(gReactionPlane==999.) return;
1929 //TObjArray* tracksUNID=0;
1930 TObjArray* tracksUNID = new TObjArray;
1931 tracksUNID->SetOwner(kTRUE);
1933 //TObjArray* tracksID=0;
1934 TObjArray* tracksID = new TObjArray;
1935 tracksID->SetOwner(kTRUE);
1938 Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//used for reconstructed track dca cut
1941 Double_t trackscount=0.0;
1942 // loop over reconstructed tracks
1943 for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++)
1944 { // reconstructed track loop starts
1945 AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrk));
1946 if (!track) continue;
1947 //get the corresponding MC track at the truth level (doing reco matching)
1948 AliAODMCParticle* recomatched = static_cast<AliAODMCParticle*>(fArrayMC->At(TMath::Abs(track->GetLabel())));
1949 if(!recomatched) continue;//if a reco track doesn't have corresponding truth track at generated level is a fake track(label==0), ignore it
1951 //remove injected signals
1952 if(fInjectedSignals)
1954 AliAODMCParticle* mother = recomatched;
1956 while (!mother->IsPhysicalPrimary())
1957 {// find the primary mother;the first stable mother is searched and checked if it is <= <maxLabel>
1958 if (mother->GetMother() < 0)
1964 mother =(AliAODMCParticle*) fArrayMC->At(((AliAODMCParticle*)mother)->GetMother());
1970 Printf("WARNING: No mother found for particle %d:", recomatched->GetLabel());
1973 if (mother->GetLabel() >= skipParticlesAbove) continue;//remove injected signals(primaries above <maxLabel>)
1974 }//remove injected signals
1976 if (fRemoveWeakDecays && ((AliAODMCParticle*) recomatched)->IsSecondaryFromWeakDecay()) continue;//remove weak decays
1978 Bool_t isduplicate2=kFALSE;
1979 if (fRemoveDuplicates)
1981 for (Int_t j =itrk+1; j < aod->GetNumberOfTracks(); j++)
1983 AliAODTrack* track2 = dynamic_cast<AliAODTrack*>(aod->GetTrack(j));
1984 if (!track2) continue;
1985 AliAODMCParticle* recomatched2 = static_cast<AliAODMCParticle*>(fArrayMC->At(TMath::Abs(track2->GetLabel())));
1986 if(!recomatched2) continue;
1988 if (track->GetLabel() == track2->GetLabel())
1995 if(fRemoveDuplicates && isduplicate2) continue;//remove duplicates
1997 fHistQA[11]->Fill(track->GetTPCNcls());
1998 Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1,kTRUE);//dcacut=kFALSE,onlyprimary=kFALSE
2000 if(tracktype==0) continue;
2001 if(tracktype==1)//tracks "not" passed AliAODTrack::kPrimary at reconstructed level & have proper TPC PID response(?)
2003 if(!track) continue;//for safety
2004 //accepted all(primaries+secondary) reconstructed tracks(pt 0.2 to 10.0,,eta -0.8 to 0.8)
2007 //check for eta , phi holes
2008 fEtaSpectrasso->Fill(track->Eta(),track->Pt());
2009 fphiSpectraasso->Fill(track->Phi(),track->Pt());
2011 Int_t particletypeMC=-9999;
2013 //tag all particles as unidentified
2014 particletypeMC=unidentified;
2016 Float_t effmatrix=1.;
2018 // -- Fill THnSparse for efficiency calculation
2019 if (fSampleType=="pp" && fCentralityMethod.EndsWith("_MANUAL")) effcent=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicity i.e. multiplicity intregated out )**************Important
2020 //NOTE:: this will be used for fillinfg THnSparse of efficiency & also to get the the track by track eff. factor on the fly(only in case of pp)
2022 //Clone & Reduce track list(TObjArray) for unidentified particles
2023 if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtTrig && track->Pt()<=fmaxPtTrig))//to reduce memory consumption in pool
2025 Short_t chargeval=0;
2026 if(track->Charge()>0) chargeval=1;
2027 if(track->Charge()<0) chargeval=-1;
2028 if(chargeval==0) continue;
2029 if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles
2030 effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletypeMC);
2031 LRCParticlePID* copy = new LRCParticlePID(particletypeMC,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
2032 copy->SetUniqueID(eventno * 100000 +(Int_t)trackscount);
2033 tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)
2036 //get the pdg code of the corresponding truth particle
2037 Int_t pdgCode = ((AliAODMCParticle*)recomatched)->GetPdgCode();
2039 Double_t allrecomatchedpid[4] = {effcent, zVtxmc,recomatched->Pt(), recomatched->Eta()};
2040 if(ffillefficiency) {
2041 fTrackHistEfficiency[5]->Fill(allrecomatchedpid,2);//for allreco matched
2042 if(TMath::Abs(pdgCode)==211 || TMath::Abs(pdgCode)==321) fTrackHistEfficiency[3]->Fill(allrecomatchedpid,2);//for mesons
2043 if(TMath::Abs(pdgCode)==321 || TMath::Abs(pdgCode)==2212) fTrackHistEfficiency[4]->Fill(allrecomatchedpid,2);//for kaons+protons
2044 if(TMath::Abs(pdgCode)==211) fTrackHistEfficiency[0]->Fill(allrecomatchedpid,2);//for pions
2045 if(TMath::Abs(pdgCode)==321) fTrackHistEfficiency[1]->Fill(allrecomatchedpid,2);//for kaons
2046 if(TMath::Abs(pdgCode)==2212) fTrackHistEfficiency[2]->Fill(allrecomatchedpid,2);//for protons
2048 if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary()) {
2049 fTrackHistEfficiency[5]->Fill(allrecomatchedpid,1);//for primreco matched
2050 if(TMath::Abs(pdgCode)==211 || TMath::Abs(pdgCode)==321) fTrackHistEfficiency[3]->Fill(allrecomatchedpid,1);//for mesons
2051 if(TMath::Abs(pdgCode)==321 || TMath::Abs(pdgCode)==2212) fTrackHistEfficiency[4]->Fill(allrecomatchedpid,1);//for kaons+protons
2052 if( TMath::Abs(pdgCode)==211) fTrackHistEfficiency[0]->Fill(allrecomatchedpid,1);//for pions
2053 if( TMath::Abs(pdgCode)==321) fTrackHistEfficiency[1]->Fill(allrecomatchedpid,1);//for kaons
2054 if( TMath::Abs(pdgCode)==2212) fTrackHistEfficiency[2]->Fill(allrecomatchedpid,1);//for protons
2058 //now start the particle identification process:)
2060 Float_t dEdx = track->GetTPCsignal();
2061 fHistoTPCdEdx->Fill(track->Pt(), dEdx);
2063 if(HasTOFPID(track))
2065 Double_t beta = GetBeta(track);
2066 fHistoTOFbeta->Fill(track->Pt(), beta);
2069 //do track identification(nsigma method)
2070 particletypeMC=GetParticle(track,fFIllPIDQAHistos);//******************************problem is here
2071 cout<<particletypeMC<<endl;
2072 switch(TMath::Abs(pdgCode)){
2074 if(fFIllPIDQAHistos){
2075 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
2076 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
2077 TH2F *h=GetHistogram2D(Form("NSigmaMC_%d_%d",SpProton,ipid));
2078 h->Fill(track->Pt(),fnsigmas[SpProton][ipid]);
2083 if(fFIllPIDQAHistos){
2084 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
2085 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
2086 TH2F *h=GetHistogram2D(Form("NSigmaMC_%d_%d",SpKaon,ipid));
2087 h->Fill(track->Pt(),fnsigmas[SpKaon][ipid]);
2092 if(fFIllPIDQAHistos){
2093 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
2094 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
2095 TH2F *h=GetHistogram2D(Form("NSigmaMC_%d_%d",SpPion,ipid));
2096 h->Fill(track->Pt(),fnsigmas[SpPion][ipid]);
2103 //2-d TPCTOF map(for each Pt interval)
2104 if(HasTOFPID(track)){
2105 fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
2106 fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);
2107 fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]);
2110 //Pt, Eta , Phi distribution of the reconstructed identified particles
2113 if (particletypeMC==SpPion)
2115 fPionPt->Fill(track->Pt());
2116 fPionEta->Fill(track->Eta());
2117 fPionPhi->Fill(track->Phi());
2119 if (particletypeMC==SpKaon)
2121 fKaonPt->Fill(track->Pt());
2122 fKaonEta->Fill(track->Eta());
2123 fKaonPhi->Fill(track->Phi());
2125 if (particletypeMC==SpProton)
2127 fProtonPt->Fill(track->Pt());
2128 fProtonEta->Fill(track->Eta());
2129 fProtonPhi->Fill(track->Phi());
2133 //for misidentification fraction calculation(do it with tuneonPID)
2134 if(particletypeMC==SpPion )
2136 if(TMath::Abs(pdgCode)==211) fPioncont->Fill(1.,track->Pt());
2137 if(TMath::Abs(pdgCode)==321) fPioncont->Fill(3.,track->Pt());
2138 if(TMath::Abs(pdgCode)==2212) fPioncont->Fill(5.,track->Pt());
2139 if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fPioncont->Fill(7.,track->Pt());
2141 if(particletypeMC==SpKaon )
2143 if(TMath::Abs(pdgCode)==211) fKaoncont->Fill(1.,track->Pt());
2144 if(TMath::Abs(pdgCode)==321) fKaoncont->Fill(3.,track->Pt());
2145 if(TMath::Abs(pdgCode)==2212) fKaoncont->Fill(5.,track->Pt());
2146 if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fKaoncont->Fill(7.,track->Pt());
2148 if(particletypeMC==SpProton )
2150 if(TMath::Abs(pdgCode)==211) fProtoncont->Fill(1.,track->Pt());
2151 if(TMath::Abs(pdgCode)==321) fProtoncont->Fill(3.,track->Pt());
2152 if(TMath::Abs(pdgCode)==2212) fProtoncont->Fill(5.,track->Pt());
2153 if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fProtoncont->Fill(7.,track->Pt());
2155 if(particletypeMC==SpUndefined )
2157 if(TMath::Abs(pdgCode)==211) fUNIDcont->Fill(1.,track->Pt());
2158 if(TMath::Abs(pdgCode)==321) fUNIDcont->Fill(3.,track->Pt());
2159 if(TMath::Abs(pdgCode)==2212) fUNIDcont->Fill(5.,track->Pt());
2160 if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fUNIDcont->Fill(7.,track->Pt());
2163 if(particletypeMC==SpUndefined) continue;
2165 if(fRequestEventPlane){
2166 FillPIDEventPlane(cent_v0,particletypeMC,track->Phi(),gReactionPlane);
2169 //fill tracking efficiency
2172 if(particletypeMC==SpPion || particletypeMC==SpKaon)
2174 if(TMath::Abs(pdgCode)==211 || TMath::Abs(pdgCode)==321) {
2175 fTrackHistEfficiency[3]->Fill(allrecomatchedpid,4);//for mesons
2176 if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary()) fTrackHistEfficiency[3]->Fill(allrecomatchedpid,3);//for mesons
2179 if(particletypeMC==SpKaon || particletypeMC==SpProton)
2181 if(TMath::Abs(pdgCode)==321 || TMath::Abs(pdgCode)==2212) {
2182 fTrackHistEfficiency[4]->Fill(allrecomatchedpid,4);//for kaons+protons
2183 if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary()) fTrackHistEfficiency[4]->Fill(allrecomatchedpid,3);
2186 if(particletypeMC==SpPion && TMath::Abs(pdgCode)==211) {
2187 fTrackHistEfficiency[0]->Fill(allrecomatchedpid,4);//for pions
2188 if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary()) fTrackHistEfficiency[0]->Fill(allrecomatchedpid,3);
2190 if(particletypeMC==SpKaon && TMath::Abs(pdgCode)==321) {
2191 fTrackHistEfficiency[1]->Fill(allrecomatchedpid,4);//for kaons
2192 if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary()) fTrackHistEfficiency[1]->Fill(allrecomatchedpid,3);
2194 if(particletypeMC==SpProton && TMath::Abs(pdgCode)==2212){
2195 fTrackHistEfficiency[2]->Fill(allrecomatchedpid,4);//for protons
2196 if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary()) fTrackHistEfficiency[2]->Fill(allrecomatchedpid,3);
2200 if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtTrig && track->Pt()<=fmaxPtTrig))//to reduce memory consumption in pool
2202 Short_t chargeval=0;
2203 if(track->Charge()>0) chargeval=1;
2204 if(track->Charge()<0) chargeval=-1;
2205 if(chargeval==0) continue;
2206 if (fapplyTrigefficiency || fapplyAssoefficiency)
2207 effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletypeMC);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles
2208 LRCParticlePID* copy1 = new LRCParticlePID(particletypeMC,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
2209 copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
2210 tracksID->Add(copy1);
2212 }// if(tracktype==1) condition structure ands
2214 }//reco track loop ends
2216 //*************************************************************still in event loop
2221 //fill the centrality/multiplicity distribution of the selected events
2222 fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case
2224 if (fSampleType=="pPb" || fSampleType=="PbPb") fCentralityCorrelation->Fill(cent_v0, trackscount);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
2226 //count selected events having centrality betn 0-100%
2227 fEventCounter->Fill(13);
2229 //***************************************event no. counting
2230 Bool_t isbaryontrig=kFALSE;
2231 Bool_t ismesontrig=kFALSE;
2232 if(tracksUNID && tracksUNID->GetEntriesFast()>0) fEventno->Fill(cent_v0,zvtx);
2234 if(tracksID && tracksID->GetEntriesFast()>0)
2236 for(Int_t i=0;i<tracksID->GetEntriesFast();i++)
2237 { //trigger loop starts
2238 LRCParticlePID *trig=(LRCParticlePID*)(tracksID->UncheckedAt(i));
2240 if(trig->Pt()<fminPtTrig || trig->Pt()>fmaxPtTrig) continue;
2241 Int_t particlepidtrig=trig->getparticle(); //either 1 or 2
2242 if(particlepidtrig==SpProton) isbaryontrig=kTRUE;
2243 if(particlepidtrig==SpPion) ismesontrig=kTRUE;
2245 if (isbaryontrig) fEventnobaryon->Fill(cent_v0,zvtx);
2246 if (ismesontrig) fEventnomeson->Fill(cent_v0,zvtx);
2249 //same event delte-eta, delta-phi plot
2250 if(tracksUNID && tracksUNID->GetEntriesFast()>0)//hadron triggered correlation
2251 {//same event calculation starts
2252 if(ffilltrigassoUNID) Fillcorrelation(gReactionPlane,tracksUNID,0,cent_v0,zvtx,weghtval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigassoUNID");//mixcase=kFALSE (hadron-hadron correlation)
2253 if(tracksID && tracksID->GetEntriesFast()>0 && ffilltrigUNIDassoID) Fillcorrelation(gReactionPlane,tracksUNID,tracksID,cent_v0,zvtx,weghtval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigUNIDassoID");//mixcase=kFALSE (hadron-ID correlation)
2256 if(tracksID && tracksID->GetEntriesFast()>0)//ID triggered correlation
2257 {//same event calculation starts
2258 if(tracksUNID && tracksUNID->GetEntriesFast()>0 && ffilltrigIDassoUNID) Fillcorrelation(gReactionPlane,tracksID,tracksUNID,cent_v0,zvtx,weghtval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigIDassoUNID");//mixcase=kFALSE (ID-hadron correlation)
2259 if(ffilltrigIDassoID) Fillcorrelation(gReactionPlane,tracksID,0,cent_v0,zvtx,weghtval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigIDassoID");//mixcase=kFALSE (ID-ID correlation)
2262 //still in main event loop
2264 if(ffilltrigassoUNID || ffilltrigIDassoUNID){//mixing with unidentified particles
2265 AliEventPool* pool = fPoolMgr->GetEventPool(cent_v0, zvtx,gReactionPlane);//In the pool there is tracksUNID(i.e associateds are unidentified)
2266 if (pool && pool->IsReady())
2267 {//start mixing only when pool->IsReady
2268 Float_t nmix1=(Float_t)pool->GetCurrentNEvents();
2269 for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++)
2270 { //pool event loop start
2271 TObjArray* bgTracks = pool->GetEvent(jMix);
2272 if(!bgTracks) continue;
2273 if(ffilltrigassoUNID && tracksUNID && tracksUNID->GetEntriesFast()>0)//*******************************hadron trggered mixing
2274 Fillcorrelation(gReactionPlane,tracksUNID,bgTracks,cent_v0,zvtx,nmix1,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigassoUNID");//mixcase=kTRUE
2275 if(ffilltrigIDassoUNID && tracksID && tracksID->GetEntriesFast()>0)//***********************************ID trggered mixing
2276 Fillcorrelation(gReactionPlane,tracksID,bgTracks,cent_v0,zvtx,nmix1,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigIDassoUNID");//mixcase=kTRUE
2277 }// pool event loop ends mixing case
2279 } //if pool->IsReady() condition ends mixing case
2282 pool->UpdatePool(CloneAndReduceTrackList(tracksUNID));
2284 }//mixing with unidentified particles
2286 if(ffilltrigUNIDassoID || ffilltrigIDassoID){//mixing with identified particles
2287 AliEventPool* pool1 = fPoolMgr->GetEventPool(cent_v0, zvtx+100,gReactionPlane);//In the pool1 there is tracksID(i.e associateds are identified)
2288 if (pool1 && pool1->IsReady())
2289 {//start mixing only when pool->IsReady
2290 Float_t nmix2=(Float_t)pool1->GetCurrentNEvents();
2291 for (Int_t jMix=0; jMix<pool1->GetCurrentNEvents(); jMix++)
2292 { //pool event loop start
2293 TObjArray* bgTracks2 = pool1->GetEvent(jMix);
2294 if(!bgTracks2) continue;
2295 if(ffilltrigUNIDassoID && tracksUNID && tracksUNID->GetEntriesFast()>0)
2296 Fillcorrelation(gReactionPlane,tracksUNID,bgTracks2,cent_v0,zvtx,nmix2,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigUNIDassoID");//mixcase=kTRUE
2297 if(ffilltrigIDassoID && tracksID && tracksID->GetEntriesFast()>0)
2298 Fillcorrelation(gReactionPlane,tracksID,bgTracks2,cent_v0,zvtx,nmix2,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigIDassoID");//mixcase=kTRUE
2300 }// pool event loop ends mixing case
2301 } //if pool1->IsReady() condition ends mixing case
2305 pool1->UpdatePool(CloneAndReduceTrackList(tracksID));//ownership of tracksasso is with pool now, don't delete it(tracksUNID is with pool)
2307 }//mixing with identified particles
2309 //no. of events analyzed
2310 fEventCounter->Fill(15);
2313 if(tracksUNID) delete tracksUNID;
2315 if(tracksID) delete tracksID;
2318 PostData(1, fOutput);
2321 //________________________________________________________________________
2322 void AliTwoParticlePIDCorr::doAODevent()
2326 AliVEvent *event = InputEvent();
2327 if (!event) { Printf("ERROR: Could not retrieve event"); return; }
2328 AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);
2330 AliError("Cannot get the AOD event");
2335 fEventCounter->Fill(1);
2337 if (!fPID) return;//this should be available with each event even if we don't do PID selection
2345 gReactionPlane = 999.;
2347 Double_t cent_v0= -999.;
2348 Double_t effcent=1.0;
2350 Double_t trackscount=0;//counts particles passed filterbit cuts and kinematic cuts used in this analysis
2353 bSign = (aod->GetMagneticField() > 0) ? 1 : -1;//for two track efficiency cut in correlation function calculation
2354 Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//for dca cut in ClassifyTrack(), i.e in track loop
2357 // check event cuts and fill event histograms and return the centrality or reference multiplicity value
2358 if((cent_v0 = GetAcceptedEventMultiplicity(aod,kFALSE)) < 0){
2362 //get the event plane in case of PbPb
2363 if(fRequestEventPlane){
2364 gReactionPlane = GetEventPlane(aod,kFALSE,cent_v0);
2365 if(gReactionPlane==999.) return;
2368 TObjArray* tracksUNID= new TObjArray;//track info before doing PID
2369 tracksUNID->SetOwner(kTRUE); // IMPORTANT!
2371 TObjArray* tracksID= new TObjArray;//only pions, kaons,protons i.e. after doing the PID selection
2372 tracksID->SetOwner(kTRUE); // IMPORTANT!
2377 Bool_t fTrigPtmin1=kFALSE;
2378 Bool_t fTrigPtmin2=kFALSE;
2379 Bool_t fTrigPtJet=kFALSE;
2381 for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++)
2382 { //track loop starts for TObjArray(containing track and event information) filling; used for correlation function calculation
2383 AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrk));
2384 if (!track) continue;
2385 fHistQA[11]->Fill(track->GetTPCNcls());
2386 Int_t particletype=-9999;//required for PID filling
2387 Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1,kTRUE);//dcacut=kFALSE,onlyprimary=kFALSE
2388 if(tracktype!=1) continue;
2390 if(!track) continue;//for safety
2392 //check for eta , phi holes
2393 fEtaSpectrasso->Fill(track->Eta(),track->Pt());
2394 fphiSpectraasso->Fill(track->Phi(),track->Pt());
2398 //if no applyefficiency , set the eff factor=1.0
2399 Float_t effmatrix=1.0;
2401 //tag all particles as unidentified that passed filterbit & kinematic cuts
2402 particletype=unidentified;
2404 //To count the no. of tracks having an accepted track in a certain PT(e.g. Jet Pt) range
2405 if(track->Pt()>=fminPtTrig) fTrigPtmin1=kTRUE;
2406 if(track->Pt()>=(fminPtTrig+0.5)) fTrigPtmin2=kTRUE;
2407 if(track->Pt()>=fmaxPtTrig) fTrigPtJet=kTRUE;
2410 if (fSampleType=="pp") effcent=15.0;//integrated over multiplicity [i.e each track has multiplicity 15.0](so put any fixed value for each track so that practically means there is only one bin in multiplicityi.e multiplicity intregated out )**************Important for efficiency related issues
2413 //to reduce memory consumption in pool
2414 if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtTrig && track->Pt()<=fmaxPtTrig))
2416 //Clone & Reduce track list(TObjArray) for unidentified particles
2417 Short_t chargeval=0;
2418 if(track->Charge()>0) chargeval=1;
2419 if(track->Charge()<0) chargeval=-1;
2420 if(chargeval==0) continue;
2421 if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles
2422 effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletype);
2423 LRCParticlePID* copy = new LRCParticlePID(particletype,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
2424 copy->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
2425 tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)
2428 //now start the particle identificaion process:)
2430 //track passing filterbit 768 have proper TPC response,or need to be checked explicitly before doing PID????
2432 Float_t dEdx = track->GetTPCsignal();
2433 fHistoTPCdEdx->Fill(track->Pt(), dEdx);
2435 //fill beta vs Pt plots only for tracks having proper TOF response(much less tracks compared to the no. that pass the filterbit & kinematic cuts)
2436 if(HasTOFPID(track))
2438 Double_t beta = GetBeta(track);
2439 fHistoTOFbeta->Fill(track->Pt(), beta);
2443 //track identification(using nsigma method)
2444 particletype=GetParticle(track,fFIllPIDQAHistos);//*******************************change may be required(It should return only pion,kaon, proton and Spundefined; NOT unidentifed***************be careful)
2447 //2-d TPCTOF map(for each Pt interval)
2448 if(HasTOFPID(track)){
2449 fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
2450 fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);
2451 fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]);
2454 //ignore the Spundefined particles as they also contain pion, kaon, proton outside the nsigma cut(also if tracks don't have proper TOF PID in a certain Pt interval) & these tracks are actually counted when we do the the efficiency correction, so considering them as unidentified particles & doing the efficiency correction(i.e defining unidentified=pion+Kaon+proton+SpUndefined is right only without efficiency correction) for them will be two times wrong!!!!!
2455 if (particletype==SpUndefined) continue;//this condition creating a modulated structure in delphi projection in mixed event case(only when we are dealing with identified particles i.e. tracksID)!!!!!!!!!!!
2457 if(fRequestEventPlane){
2458 FillPIDEventPlane(cent_v0,particletype,track->Phi(),gReactionPlane);
2462 //Pt, Eta , Phi distribution of the reconstructed identified particles
2465 if (particletype==SpPion)
2467 fPionPt->Fill(track->Pt());
2468 fPionEta->Fill(track->Eta());
2469 fPionPhi->Fill(track->Phi());
2471 if (particletype==SpKaon)
2473 fKaonPt->Fill(track->Pt());
2474 fKaonEta->Fill(track->Eta());
2475 fKaonPhi->Fill(track->Phi());
2477 if (particletype==SpProton)
2479 fProtonPt->Fill(track->Pt());
2480 fProtonEta->Fill(track->Eta());
2481 fProtonPhi->Fill(track->Phi());
2485 if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtTrig && track->Pt()<=fmaxPtTrig))
2487 Short_t chargeval=0;
2488 if(track->Charge()>0) chargeval=1;
2489 if(track->Charge()<0) chargeval=-1;
2490 if(chargeval==0) continue;
2491 if (fapplyTrigefficiency || fapplyAssoefficiency)
2492 effmatrix=GetTrackbyTrackeffvalue(track,effcent,zvtx,particletype);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles; Bool_t mesoneffrequired=kFALSE
2493 LRCParticlePID* copy1 = new LRCParticlePID(particletype,chargeval,track->Pt(),track->Eta(), track->Phi(),effmatrix);
2494 copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
2495 tracksID->Add(copy1);
2497 } //track loop ends but still in event loop
2499 if(trackscount<1.0){
2500 if(tracksUNID) delete tracksUNID;
2501 if(tracksID) delete tracksID;
2505 if (fTrigPtmin1) fhistJetTrigestimate->Fill(cent_v0,0.0);
2506 if (fTrigPtmin2) fhistJetTrigestimate->Fill(cent_v0,2.0);
2507 if (fTrigPtJet) fhistJetTrigestimate->Fill(cent_v0,4.0);
2509 Float_t weightval=1.0;
2513 //fill the centrality/multiplicity distribution of the selected events
2514 fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case
2516 if(fSampleType=="pPb" || fSampleType=="PbPb") fCentralityCorrelation->Fill(cent_v0, trackscount);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
2518 //count selected events having centrality betn 0-100%
2519 fEventCounter->Fill(13);
2521 //***************************************event no. counting
2522 Bool_t isbaryontrig=kFALSE;
2523 Bool_t ismesontrig=kFALSE;
2524 if(tracksUNID && tracksUNID->GetEntriesFast()>0) fEventno->Fill(cent_v0,zvtx);
2526 if(tracksID && tracksID->GetEntriesFast()>0)
2528 for(Int_t i=0;i<tracksID->GetEntriesFast();i++)
2529 { //trigger loop starts
2530 LRCParticlePID *trig=(LRCParticlePID*)(tracksID->UncheckedAt(i));
2532 if(trig->Pt()<fminPtTrig || trig->Pt()>fmaxPtTrig) continue;
2533 Int_t particlepidtrig=trig->getparticle(); //either 1 or 2
2534 if(particlepidtrig==SpProton) isbaryontrig=kTRUE;
2535 if(particlepidtrig==SpPion) ismesontrig=kTRUE;
2537 if (isbaryontrig) fEventnobaryon->Fill(cent_v0,zvtx);
2538 if (ismesontrig) fEventnomeson->Fill(cent_v0,zvtx);
2542 //same event delta-eta-deltaphi plot
2544 if(tracksUNID && tracksUNID->GetEntriesFast()>0)//hadron triggered correlation
2545 {//same event calculation starts
2546 if(ffilltrigassoUNID) Fillcorrelation(gReactionPlane,tracksUNID,0,cent_v0,zvtx,weightval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigassoUNID");//mixcase=kFALSE (hadron-hadron correlation)
2547 if(tracksID && tracksID->GetEntriesFast()>0 && ffilltrigUNIDassoID) Fillcorrelation(gReactionPlane,tracksUNID,tracksID,cent_v0,zvtx,weightval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigUNIDassoID");//mixcase=kFALSE (hadron-ID correlation)
2550 if(tracksID && tracksID->GetEntriesFast()>0)//ID triggered correlation
2551 {//same event calculation starts
2552 if(tracksUNID && tracksUNID->GetEntriesFast()>0 && ffilltrigIDassoUNID) Fillcorrelation(gReactionPlane,tracksID,tracksUNID,cent_v0,zvtx,weightval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigIDassoUNID");//mixcase=kFALSE (ID-hadron correlation)
2553 if(ffilltrigIDassoID) Fillcorrelation(gReactionPlane,tracksID,0,cent_v0,zvtx,weightval,kFALSE,bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kFALSE,"trigIDassoID");//mixcase=kFALSE (ID-ID correlation)
2556 //still in main event loop
2560 if(ffilltrigassoUNID || ffilltrigIDassoUNID){//mixing with unidentified particles
2561 AliEventPool* pool = fPoolMgr->GetEventPool(cent_v0, zvtx,gReactionPlane);//In the pool there is tracksUNID(i.e associateds are unidentified)
2562 if (pool && pool->IsReady())
2563 {//start mixing only when pool->IsReady
2564 Float_t nmix1=(Float_t)pool->GetCurrentNEvents();
2565 for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++)
2566 { //pool event loop start
2567 TObjArray* bgTracks = pool->GetEvent(jMix);
2568 if(!bgTracks) continue;
2569 if(ffilltrigassoUNID && tracksUNID && tracksUNID->GetEntriesFast()>0)//*******************************hadron trggered mixing
2570 Fillcorrelation(gReactionPlane,tracksUNID,bgTracks,cent_v0,zvtx,nmix1,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigassoUNID");//mixcase=kTRUE
2571 if(ffilltrigIDassoUNID && tracksID && tracksID->GetEntriesFast()>0)//***********************************ID trggered mixing
2572 Fillcorrelation(gReactionPlane,tracksID,bgTracks,cent_v0,zvtx,nmix1,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigIDassoUNID");//mixcase=kTRUE
2573 }// pool event loop ends mixing case
2574 } //if pool->IsReady() condition ends mixing case
2577 pool->UpdatePool(CloneAndReduceTrackList(tracksUNID));
2579 }//mixing with unidentified particles
2582 if(ffilltrigUNIDassoID || ffilltrigIDassoID){//mixing with identified particles
2583 AliEventPool* pool1 = fPoolMgr->GetEventPool(cent_v0, zvtx+100,gReactionPlane);//In the pool1 there is tracksID(i.e associateds are identified)
2584 if (pool1 && pool1->IsReady())
2585 {//start mixing only when pool->IsReady
2586 Float_t nmix2=(Float_t)pool1->GetCurrentNEvents();
2587 for (Int_t jMix=0; jMix<pool1->GetCurrentNEvents(); jMix++)
2588 { //pool event loop start
2589 TObjArray* bgTracks2 = pool1->GetEvent(jMix);
2590 if(!bgTracks2) continue;
2591 if(ffilltrigUNIDassoID && tracksUNID && tracksUNID->GetEntriesFast()>0)
2592 Fillcorrelation(gReactionPlane,tracksUNID,bgTracks2,cent_v0,zvtx,nmix2,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigUNIDassoID");//mixcase=kTRUE
2593 if(ffilltrigIDassoID && tracksID && tracksID->GetEntriesFast()>0)
2594 Fillcorrelation(gReactionPlane,tracksID,bgTracks2,cent_v0,zvtx,nmix2,(jMix == 0),bSign,fPtOrderDataReco,ftwoTrackEfficiencyCutDataReco,kTRUE,"trigIDassoID");//mixcase=kTRUE
2596 }// pool event loop ends mixing case
2597 } //if pool1->IsReady() condition ends mixing case
2601 pool1->UpdatePool(CloneAndReduceTrackList(tracksID));//ownership of tracksasso is with pool now, don't delete it(tracksUNID is with pool)
2603 }//mixing with identified particles
2606 //no. of events analyzed
2607 fEventCounter->Fill(15);
2609 //still in main event loop
2612 if(tracksUNID) delete tracksUNID;
2614 if(tracksID) delete tracksID;
2617 PostData(1, fOutput);
2619 } // *************************event loop ends******************************************//_______________________________________________________________________
2620 TObjArray* AliTwoParticlePIDCorr::CloneAndReduceTrackList(TObjArray* tracks)
2622 // clones a track list by using AliDPhiBasicParticle which uses much less memory (used for event mixing)
2624 TObjArray* tracksClone = new TObjArray;
2625 tracksClone->SetOwner(kTRUE);
2627 for (Int_t i=0; i<tracks->GetEntriesFast(); i++)
2629 LRCParticlePID* particle = (LRCParticlePID*) tracks->UncheckedAt(i);
2630 LRCParticlePID* copy100 = new LRCParticlePID(particle->getparticle(),particle->Charge(), particle->Pt(),particle->Eta(), particle->Phi(), particle->geteffcorrectionval());
2631 copy100->SetUniqueID(particle->GetUniqueID());
2632 tracksClone->Add(copy100);
2638 //--------------------------------------------------------------------------------
2639 void AliTwoParticlePIDCorr::Fillcorrelation(Float_t ReactionPlane,TObjArray *trackstrig,TObjArray *tracksasso,Double_t cent,Float_t vtx,Float_t weight,Bool_t firstTime,Float_t bSign,Bool_t fPtOrder,Bool_t twoTrackEfficiencyCut,Bool_t mixcase,TString fillup)
2642 //before calling this function check that either trackstrig & tracksasso are available
2644 // Eta() is extremely time consuming, therefore cache it for the inner loop here:
2645 TObjArray* input = (tracksasso) ? tracksasso : trackstrig;
2646 TArrayF eta(input->GetEntriesFast());
2647 for (Int_t i=0; i<input->GetEntriesFast(); i++)
2648 eta[i] = ((LRCParticlePID*) input->UncheckedAt(i))->Eta();
2651 Int_t jmax=trackstrig->GetEntriesFast();
2653 jmax=tracksasso->GetEntriesFast();
2655 // identify K, Lambda candidates and flag those particles
2656 // a TObject bit is used for this
2657 const UInt_t kResonanceDaughterFlag = 1 << 14;
2658 if (fRejectResonanceDaughters > 0)
2660 Double_t resonanceMass = -1;
2661 Double_t massDaughter1 = -1;
2662 Double_t massDaughter2 = -1;
2663 const Double_t interval = 0.02;
2664 switch (fRejectResonanceDaughters)
2666 case 1: resonanceMass = 0.9; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // method test
2667 case 2: resonanceMass = 0.4976; massDaughter1 = 0.1396; massDaughter2 = massDaughter1; break; // k0
2668 case 3: resonanceMass = 1.115; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // lambda
2669 default: AliFatal(Form("Invalid setting %d", fRejectResonanceDaughters));
2672 for (Int_t i=0; i<trackstrig->GetEntriesFast(); i++)
2673 trackstrig->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
2674 for (Int_t i=0; tracksasso->GetEntriesFast(); i++)
2675 tracksasso->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
2677 for (Int_t i=0; i<trackstrig->GetEntriesFast(); i++)
2679 LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));
2680 for (Int_t j=0; tracksasso->GetEntriesFast(); j++)
2682 LRCParticlePID *asso=(LRCParticlePID*)(tracksasso->UncheckedAt(j));
2684 // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
2685 if (trig->IsEqual(asso)) continue;
2687 if (trig->Charge() * asso->Charge() > 0) continue;
2689 Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trig->Eta(), trig->Phi(), asso->Pt(), asso->Eta(), asso->Phi(), massDaughter1, massDaughter2);
2691 if (TMath::Abs(mass - resonanceMass*resonanceMass) < interval*5)
2693 mass = GetInvMassSquared(trig->Pt(), trig->Eta(), trig->Phi(), asso->Pt(), asso->Eta(), asso->Phi(), massDaughter1, massDaughter2);
2695 if (mass > (resonanceMass-interval)*(resonanceMass-interval) && mass < (resonanceMass+interval)*(resonanceMass+interval))
2697 trig->SetBit(kResonanceDaughterFlag);
2698 asso->SetBit(kResonanceDaughterFlag);
2700 // Printf("Flagged %d %d %f", i, j, TMath::Sqrt(mass));
2707 //Select the highest Pt trigger particle in an event (within a given Pt trigger range)
2709 Float_t TriggerPtMin=fminPtTrig;
2710 Float_t TriggerPtMax=fmaxPtTrig;
2711 Int_t HighestPtTriggerIndx=-99999;
2712 TH1* triggerWeighting = 0;
2714 if(fSelectHighestPtTrig || fWeightPerEvent)//**************add this data member to the constructor
2716 if (fWeightPerEvent)
2719 if(ffilltrigassoUNID || ffilltrigUNIDassoID || ffilltrigIDassoUNID || ffilltrigIDassoID) axis = fTHnTrigcount->GetGrid(0)->GetGrid()->GetAxis(2);
2720 if((fAnalysisType =="MCAOD") && ffilltrigIDassoIDMCTRUTH) axis = fTHnTrigcountMCTruthPrim->GetGrid(0)->GetGrid()->GetAxis(2);
2721 triggerWeighting = new TH1F("triggerWeighting", "", axis->GetNbins(), axis->GetXbins()->GetArray());
2723 for(Int_t i=0;i<trackstrig->GetEntriesFast();i++)
2724 { //trigger loop starts(highest Pt trigger selection)
2725 LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));
2727 Float_t trigpt=trig->Pt();
2728 //to avoid overflow qnd underflow
2729 if(trigpt<fminPtTrig || trigpt>fmaxPtTrig) continue;
2730 Int_t particlepidtrig=trig->getparticle();
2731 if(fTriggerSpeciesSelection){ if (particlepidtrig!=fTriggerSpecies) continue;}
2733 Float_t trigeta=trig->Eta();
2735 // some optimization
2736 if (fTriggerRestrictEta > 0 && TMath::Abs(trigeta) > fTriggerRestrictEta)
2739 if (fOnlyOneEtaSide != 0)
2741 if (fOnlyOneEtaSide * trigeta < 0)
2744 if (fTriggerSelectCharge != 0)
2745 if (trig->Charge() * fTriggerSelectCharge < 0)
2748 if (fRejectResonanceDaughters > 0)
2749 if (trig->TestBit(kResonanceDaughterFlag)) continue;
2751 if(fSelectHighestPtTrig){
2752 if(trigpt>TriggerPtMin && trigpt<=TriggerPtMax)
2754 HighestPtTriggerIndx=(Int_t)trig->GetUniqueID();
2755 TriggerPtMin=trigpt;
2759 if (fWeightPerEvent) triggerWeighting->Fill(trigpt);
2761 }//trigger loop ends(highest Pt trigger selection)
2763 }//******************(fSelectHighestPtTrig || fWeightPerEvent) condition ends
2766 //two particle correlation filling
2767 for(Int_t i=0;i<trackstrig->GetEntriesFast();i++)
2768 { //trigger loop starts
2769 LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));
2771 Float_t trigpt=trig->Pt();
2772 //to avoid overflow qnd underflow
2773 if(trigpt<fminPtTrig || trigpt>fmaxPtTrig) continue;
2774 Int_t particlepidtrig=trig->getparticle();
2775 if(fTriggerSpeciesSelection){ if (particlepidtrig!=fTriggerSpecies) continue;}
2777 Float_t trigeta=trig->Eta();
2779 // some optimization
2780 if (fTriggerRestrictEta > 0 && TMath::Abs(trigeta) > fTriggerRestrictEta)
2783 if (fOnlyOneEtaSide != 0)
2785 if (fOnlyOneEtaSide * trigeta < 0)
2788 if (fTriggerSelectCharge != 0)
2789 if (trig->Charge() * fTriggerSelectCharge < 0)
2792 if (fRejectResonanceDaughters > 0)
2793 if (trig->TestBit(kResonanceDaughterFlag)) continue;
2795 if(fSelectHighestPtTrig && HighestPtTriggerIndx!=-99999) {
2796 if(trig->GetUniqueID()!=(UInt_t)HighestPtTriggerIndx) continue;
2799 Float_t trigphi=trig->Phi();
2800 Float_t trackefftrig=1.0;
2801 if(fapplyTrigefficiency) trackefftrig=trig->geteffcorrectionval();
2803 // Event plane (determine psi bin)
2804 Double_t gPsiMinusPhi = 0.;
2805 Double_t gPsiMinusPhiBin = -10.;
2806 if(fRequestEventPlane){
2807 gPsiMinusPhi = TMath::Abs(trigphi - ReactionPlane);
2808 //in-plane(Note thet event plane angle has to be defined within 0 to 180 degree(do not use this if event ), otherwise the definition of in plane and out plane particles is wrong)
2809 if((gPsiMinusPhi <= 7.5*TMath::DegToRad())||
2810 (gPsiMinusPhi >= 352.5*TMath::DegToRad())||
2811 ((172.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 187.5*TMath::DegToRad())))
2812 gPsiMinusPhiBin = 0.0;
2814 if((gPsiMinusPhi <= 7.5*TMath::DegToRad())||
2815 ((172.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 187.5*TMath::DegToRad())))
2816 gPsiMinusPhiBin = 0.0;
2819 else if(((37.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 52.5*TMath::DegToRad()))||
2820 ((127.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 142.5*TMath::DegToRad()))||
2821 ((217.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 232.5*TMath::DegToRad()))||
2822 ((307.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 322.5*TMath::DegToRad())))
2823 gPsiMinusPhiBin = 1.0;
2825 else if(((82.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 97.5*TMath::DegToRad()))||
2826 ((262.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 277.5*TMath::DegToRad())))
2827 gPsiMinusPhiBin = 2.0;
2830 gPsiMinusPhiBin = 3.0;
2832 fHistPsiMinusPhi->Fill(gPsiMinusPhiBin,gPsiMinusPhi);
2835 //cout<<"*******************trackefftrig="<<trackefftrig<<endl;
2838 Int_t eventplaneAxis=0;
2839 if(fRequestEventPlane) eventplaneAxis=1;
2840 if(fcontainPIDtrig && SetChargeAxis==0) dim=4+eventplaneAxis;
2841 if(!fcontainPIDtrig && SetChargeAxis==2) dim=4+eventplaneAxis;
2842 if(fcontainPIDtrig && SetChargeAxis==2) dim=5+eventplaneAxis;
2843 trigval= new Double_t[dim];
2846 trigval[2] = trigpt;
2848 if(fRequestEventPlane){
2849 trigval[3] = gPsiMinusPhiBin;
2850 if(fcontainPIDtrig && SetChargeAxis==0) trigval[4] = particlepidtrig;
2851 if(!fcontainPIDtrig && SetChargeAxis==2) trigval[4] = trig->Charge();
2852 if(fcontainPIDtrig && SetChargeAxis==2) {
2853 trigval[4] = particlepidtrig;
2854 trigval[5] = trig->Charge();
2858 if(!fRequestEventPlane){
2859 if(fcontainPIDtrig && SetChargeAxis==0) trigval[3] = particlepidtrig;
2860 if(!fcontainPIDtrig && SetChargeAxis==2) trigval[3] = trig->Charge();
2861 if(fcontainPIDtrig && SetChargeAxis==2) {
2862 trigval[3] = particlepidtrig;
2863 trigval[4] = trig->Charge();
2869 if (fWeightPerEvent)
2871 // leads effectively to a filling of one entry per filled trigger particle pT bin
2872 Int_t weightBin = triggerWeighting->GetXaxis()->FindBin(trigval[2]);
2873 // Printf("Using weight %f", triggerWeighting->GetBinContent(weightBin));
2874 trackefftrig *= triggerWeighting->GetBinContent(weightBin);
2878 //trigger particle counting for both same and mixed event case;;;;;step=0->same event case;;;;;step=1->mixed event case;;;;;;
2879 if(ffilltrigassoUNID==kTRUE && ffilltrigUNIDassoID==kTRUE){
2880 if(fillup=="trigassoUNID" ) {
2881 if(mixcase==kFALSE) fTHnTrigcount->Fill(trigval,0,1.0/trackefftrig);
2882 if(mixcase==kTRUE && firstTime) fTHnTrigcount->Fill(trigval,1,1.0/trackefftrig);
2885 if(ffilltrigassoUNID==kTRUE && ffilltrigUNIDassoID==kFALSE){
2886 if(fillup=="trigassoUNID" )
2888 if(mixcase==kFALSE) fTHnTrigcount->Fill(trigval,0,1.0/trackefftrig);
2889 if(mixcase==kTRUE && firstTime) fTHnTrigcount->Fill(trigval,1,1.0/trackefftrig);
2892 if(ffilltrigassoUNID==kFALSE && ffilltrigUNIDassoID==kTRUE){
2893 if(fillup=="trigUNIDassoID")
2895 if(mixcase==kFALSE) fTHnTrigcount->Fill(trigval,0,1.0/trackefftrig);
2896 if(mixcase==kTRUE && firstTime) fTHnTrigcount->Fill(trigval,1,1.0/trackefftrig);
2899 //ensure that trigIDassoID , trigassoUNID, trigIDassoUNID & trigUNIDassoID case FillCorrelation called only once in the event loop for same event correlation function calculation, otherwise there will be multiple counting of pion, kaon,proton,unidentified
2900 if(ffilltrigIDassoUNID==kTRUE && ffilltrigIDassoID==kTRUE){
2901 if(fillup=="trigIDassoID")
2903 if(mixcase==kFALSE) fTHnTrigcount->Fill(trigval,0,1.0/trackefftrig);
2904 if(mixcase==kTRUE && firstTime) fTHnTrigcount->Fill(trigval,1,1.0/trackefftrig);
2907 if(ffilltrigIDassoUNID==kTRUE && ffilltrigIDassoID==kFALSE){
2908 if(fillup=="trigIDassoUNID" )
2910 if(mixcase==kFALSE) fTHnTrigcount->Fill(trigval,0,1.0/trackefftrig);
2911 if(mixcase==kTRUE && firstTime) fTHnTrigcount->Fill(trigval,1,1.0/trackefftrig);
2914 if(ffilltrigIDassoUNID==kFALSE && ffilltrigIDassoID==kTRUE){
2915 if(fillup=="trigIDassoID")
2917 if(mixcase==kFALSE) fTHnTrigcount->Fill(trigval,0,1.0/trackefftrig);
2918 if(mixcase==kTRUE && firstTime) fTHnTrigcount->Fill(trigval,1,1.0/trackefftrig);
2922 if(fillup=="trigIDassoIDMCTRUTH") { //In truth MC case "Unidentified" means any particle other than pion,kaon or proton and no efficiency correction(default value 1.0)************************be careful!!!!
2923 if(mixcase==kFALSE) fTHnTrigcountMCTruthPrim->Fill(trigval,0,1.0/trackefftrig);
2924 if(mixcase==kTRUE && firstTime) fTHnTrigcountMCTruthPrim->Fill(trigval,1,1.0/trackefftrig);
2927 //asso loop starts within trigger loop
2928 for(Int_t j=0;j<jmax;j++)
2930 LRCParticlePID *asso=0;
2932 asso=(LRCParticlePID*)(trackstrig->UncheckedAt(j));
2934 asso=(LRCParticlePID*)(tracksasso->UncheckedAt(j));
2938 //to avoid overflow and underflow
2939 if(asso->Pt()<fminPtAsso || asso->Pt()>fmaxPtAsso) continue;//***********************Important
2941 //if(fmaxPtAsso==fminPtTrig) {if(asso->Pt()==fminPtTrig) continue;}//******************Think about it!
2943 if(!tracksasso && j==i) continue;
2945 // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event,i.e. both Trig and asso TObjArray belongs to the same Pt range but say Trig is Unidentified but asso is identified then the serial no. wise particles are not same and and j==i doesn't aplly)
2946 // if (tracksasso && trig->IsEqual(asso)) continue;
2948 if (tracksasso && (trig->GetUniqueID()==asso->GetUniqueID())) continue;
2951 if (asso->Pt() >= trig->Pt()) continue;
2953 Int_t particlepidasso=asso->getparticle();
2954 if(fAssociatedSpeciesSelection){ if (particlepidasso!=fAssociatedSpecies) continue;}
2957 if (fAssociatedSelectCharge != 0)
2958 if (asso->Charge() * fAssociatedSelectCharge < 0) continue;
2960 if (fSelectCharge > 0)
2963 if (fSelectCharge == 1 && asso->Charge() * trig->Charge() > 0)
2967 if (fSelectCharge == 2 && asso->Charge() * trig->Charge() < 0)
2973 if (trigeta < 0 && asso->Eta() < trigeta)
2975 if (trigeta > 0 && asso->Eta() > trigeta)
2979 if (fRejectResonanceDaughters > 0)
2980 if (asso->TestBit(kResonanceDaughterFlag))
2982 // Printf("Skipped j=%d", j);
2987 if (fCutConversions && asso->Charge() * trig->Charge() < 0)
2989 Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.510e-3, 0.510e-3);
2993 mass = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.510e-3, 0.510e-3);
2995 fControlConvResoncances->Fill(0.0, mass);
2997 if (mass < 0.04*0.04)
3003 if (fCutResonances && asso->Charge() * trig->Charge() < 0)
3005 Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.1396, 0.1396);
3007 const Float_t kK0smass = 0.4976;
3009 if (TMath::Abs(mass - kK0smass*kK0smass) < 0.1)
3011 mass = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.1396, 0.1396);
3013 fControlConvResoncances->Fill(1, mass - kK0smass*kK0smass);
3015 if (mass > (kK0smass-0.02)*(kK0smass-0.02) && mass < (kK0smass+0.02)*(kK0smass+0.02))
3021 if (fCutResonances && asso->Charge() * trig->Charge() < 0)
3023 Float_t mass1 = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.1396, 0.9383);
3024 Float_t mass2 = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j] , asso->Phi(), 0.9383, 0.1396);
3026 const Float_t kLambdaMass = 1.115;
3028 if (TMath::Abs(mass1 - kLambdaMass*kLambdaMass) < 0.1)
3030 mass1 = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.1396, 0.9383);
3032 fControlConvResoncances->Fill(2, mass1 - kLambdaMass*kLambdaMass);
3034 if (mass1 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass1 < (kLambdaMass+0.02)*(kLambdaMass+0.02))
3037 if (TMath::Abs(mass2 - kLambdaMass*kLambdaMass) < 0.1)
3039 mass2 = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j] , asso->Phi(), 0.9383, 0.1396);
3041 fControlConvResoncances->Fill(2, mass2 - kLambdaMass*kLambdaMass);
3043 if (mass2 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass2 < (kLambdaMass+0.02)*(kLambdaMass+0.02))
3048 if (twoTrackEfficiencyCut)
3050 // the variables & cuthave been developed by the HBT group
3051 // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
3052 Float_t phi1 = trig->Phi();
3053 Float_t pt1 = trig->Pt();
3054 Float_t charge1 = trig->Charge();
3055 Float_t phi2 = asso->Phi();
3056 Float_t pt2 = asso->Pt();
3057 Float_t charge2 = asso->Charge();
3059 Float_t deta= trigeta - eta[j];
3062 if (TMath::Abs(deta) < twoTrackEfficiencyCutValue * 2.5 * 3)
3065 // check first boundaries to see if is worth to loop and find the minimum
3066 Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);
3067 Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
3069 const Float_t kLimit = twoTrackEfficiencyCutValue * 3;
3071 Float_t dphistarminabs = 1e5;
3072 Float_t dphistarmin = 1e5;
3074 if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)
3076 for (Double_t rad=0.8; rad<2.51; rad+=0.01)
3078 Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign);
3080 Float_t dphistarabs = TMath::Abs(dphistar);
3082 if (dphistarabs < dphistarminabs)
3084 dphistarmin = dphistar;
3085 dphistarminabs = dphistarabs;
3088 if(mixcase==kFALSE) fTwoTrackDistancePt[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));//for same event
3089 if(mixcase==kTRUE) fTwoTrackDistancePtmix[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));//for mixed event
3091 if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEfficiencyCutValue)
3093 // Printf("Removed track pair %d %d with %f %f %f %f %f %f %f %f %f", i, j, deta, dphistarminabs, phi1, pt1, charge1, phi2, pt2, charge2, bSign);
3096 if(mixcase==kFALSE) fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));//for same event
3097 if(mixcase==kTRUE) fTwoTrackDistancePtmix[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));//for mixed event
3103 Float_t weightperevent=weight;
3104 Float_t trackeffasso=1.0;
3105 if(fapplyAssoefficiency) trackeffasso=asso->geteffcorrectionval();
3106 //cout<<"*******************trackeffasso="<<trackeffasso<<endl;
3107 Float_t deleta=trigeta-eta[j];
3108 Float_t delphi=PhiRange(trigphi-asso->Phi());
3110 Float_t delpt=trigpt-asso->Pt();
3111 //fill it with/without two track efficiency cut
3112 if(mixcase==kFALSE) fTwoTrackDistancePtdip->Fill(deleta, delphi, TMath::Abs(delpt));//for same event
3113 if(mixcase==kTRUE) fTwoTrackDistancePtdipmix->Fill(deleta, delphi, TMath::Abs(delpt));//for mixed event
3115 //here get the two particle efficiency correction factor
3116 Float_t effweight=trackefftrig*trackeffasso*weightperevent;
3117 // if(mixcase==kFALSE) cout<<"*******************effweight="<<effweight<<endl;
3119 Int_t dimused=kTrackVariablesPair+eventplaneAxis;
3120 vars= new Double_t[dimused];
3129 if(fRequestEventPlane)
3131 vars[6]=gPsiMinusPhiBin;
3135 if(!fcontainPIDtrig && !fcontainPIDasso && SetChargeAxis==2){
3136 vars[dimension]=trig->Charge();
3137 vars[dimension+1]=asso->Charge();
3139 if(fcontainPIDtrig && !fcontainPIDasso){
3140 vars[dimension]=particlepidtrig;
3141 if(SetChargeAxis==2){
3142 vars[dimension+1]=trig->Charge();
3143 vars[dimension+2]=asso->Charge();
3146 if(!fcontainPIDtrig && fcontainPIDasso){
3147 vars[dimension]=particlepidasso;
3148 if(SetChargeAxis==2){
3149 vars[dimension+1]=trig->Charge();
3150 vars[dimension+2]=asso->Charge();
3153 if(fcontainPIDtrig && fcontainPIDasso){
3154 vars[dimension]=particlepidtrig;
3155 vars[dimension+1]=particlepidasso;
3156 if(SetChargeAxis==2){
3157 vars[dimension+2]=trig->Charge();
3158 vars[dimension+3]=asso->Charge();
3162 if (fWeightPerEvent)
3164 Int_t weightBin = triggerWeighting->GetXaxis()->FindBin(vars[2]);
3165 // Printf("Using weight %f", triggerWeighting->GetBinContent(weightBin));
3166 effweight *= triggerWeighting->GetBinContent(weightBin);
3170 //Fill Correlation ThnSparses
3171 if(fillup=="trigassoUNID")
3173 if(mixcase==kFALSE) fTHnCorrUNID->Fill(vars,0,1.0/effweight);
3174 if(mixcase==kTRUE) fTHnCorrUNIDmix->Fill(vars,0,1.0/effweight);
3176 if(fillup=="trigIDassoID")
3178 if(mixcase==kFALSE) fTHnCorrID->Fill(vars,0,1.0/effweight);
3179 if(mixcase==kTRUE) fTHnCorrIDmix->Fill(vars,0,1.0/effweight);
3181 if(fillup=="trigIDassoIDMCTRUTH")//******************************************for TRUTH MC particles
3182 {//in this case effweight should be 1 always
3183 if(mixcase==kFALSE) fCorrelatonTruthPrimary->Fill(vars,0,1.0/effweight);
3184 if(mixcase==kTRUE) fCorrelatonTruthPrimarymix->Fill(vars,0,1.0/effweight);
3186 if(fillup=="trigIDassoUNID" || fillup=="trigUNIDassoID")//****************************be careful
3188 if(mixcase==kFALSE) fTHnCorrIDUNID->Fill(vars,0,1.0/effweight);
3189 if(mixcase==kTRUE) fTHnCorrIDUNIDmix->Fill(vars,0,1.0/effweight);
3195 }//trigger loop ends
3197 if (triggerWeighting)
3199 delete triggerWeighting;
3200 triggerWeighting = 0;
3204 //--------------------------------------------------------------------------------
3205 Float_t AliTwoParticlePIDCorr::GetTrackbyTrackeffvalue(AliAODTrack* track,Double_t cent,Float_t evzvtx, Int_t parpid)
3207 //This function is called only when applyefficiency=kTRUE; also ensure that "track" is present before calling that function
3209 Float_t effvalue=1.;
3211 if(parpid==unidentified)
3213 effVars[0] = effcorection[5]->GetAxis(0)->FindBin(cent);
3214 effVars[1] = effcorection[5]->GetAxis(1)->FindBin(evzvtx);
3215 effVars[2] = effcorection[5]->GetAxis(2)->FindBin(track->Pt());
3216 effVars[3] = effcorection[5]->GetAxis(3)->FindBin(track->Eta());
3217 effvalue=effcorection[5]->GetBinContent(effVars);
3219 if(parpid==SpPion || parpid==SpKaon)
3221 if(fmesoneffrequired && !fkaonprotoneffrequired && track->Pt()>=fminPtComboeff && track->Pt()<=fmaxPtComboeff)
3223 effVars[0] = effcorection[3]->GetAxis(0)->FindBin(cent);
3224 effVars[1] = effcorection[3]->GetAxis(1)->FindBin(evzvtx);
3225 effVars[2] = effcorection[3]->GetAxis(2)->FindBin(track->Pt());
3226 effVars[3] = effcorection[3]->GetAxis(3)->FindBin(track->Eta());
3227 effvalue=effcorection[3]->GetBinContent(effVars);
3232 effVars[0] = effcorection[0]->GetAxis(0)->FindBin(cent);
3233 effVars[1] = effcorection[0]->GetAxis(1)->FindBin(evzvtx);
3234 effVars[2] = effcorection[0]->GetAxis(2)->FindBin(track->Pt());
3235 effVars[3] = effcorection[0]->GetAxis(3)->FindBin(track->Eta());
3236 effvalue=effcorection[0]->GetBinContent(effVars);
3241 effVars[0] = effcorection[1]->GetAxis(0)->FindBin(cent);
3242 effVars[1] = effcorection[1]->GetAxis(1)->FindBin(evzvtx);
3243 effVars[2] = effcorection[1]->GetAxis(2)->FindBin(track->Pt());
3244 effVars[3] = effcorection[1]->GetAxis(3)->FindBin(track->Eta());
3245 effvalue=effcorection[1]->GetBinContent(effVars);
3250 if(parpid==SpProton)
3252 effVars[0] = effcorection[2]->GetAxis(0)->FindBin(cent);
3253 effVars[1] = effcorection[2]->GetAxis(1)->FindBin(evzvtx);
3254 effVars[2] = effcorection[2]->GetAxis(2)->FindBin(track->Pt());
3255 effVars[3] = effcorection[2]->GetAxis(3)->FindBin(track->Eta());
3256 effvalue=effcorection[2]->GetBinContent(effVars);
3259 if(fkaonprotoneffrequired && !fmesoneffrequired && track->Pt()>=fminPtComboeff && track->Pt()<=fmaxPtComboeff)
3261 if(parpid==SpProton || parpid==SpKaon)
3263 effVars[0] = effcorection[4]->GetAxis(0)->FindBin(cent);
3264 effVars[1] = effcorection[4]->GetAxis(1)->FindBin(evzvtx);
3265 effVars[2] = effcorection[4]->GetAxis(2)->FindBin(track->Pt());
3266 effVars[3] = effcorection[4]->GetAxis(3)->FindBin(track->Eta());
3267 effvalue=effcorection[4]->GetBinContent(effVars);
3270 // Printf("%d %d %d %d %f", effVars[0], effVars[1], effVars[2], effVars[3], fEfficiencyCorrectionAssociated->GetBinContent(effVars));
3271 if(effvalue==0.) effvalue=1.;
3276 //---------------------------------------------------------------------------------
3278 Int_t AliTwoParticlePIDCorr::ClassifyTrack(AliAODTrack* track,AliAODVertex* vertex,Float_t magfield, Bool_t fill)
3281 if(!track) return 0;
3282 Bool_t trackOK = track->TestFilterBit(fFilterBit);
3283 if(!trackOK) return 0;
3284 if (fTrackStatus != 0 && !CheckTrack(track)) return 0;
3285 //select only primary traks(for data & reco MC tracks)
3286 if(fonlyprimarydatareco && track->GetType()!=AliAODTrack::kPrimary) return 0;
3287 if(track->Charge()==0) return 0;
3288 if (fill) fHistQA[12]->Fill(track->GetTPCNcls());
3291 dz = track->ZAtDCA();
3292 if (fill) fHistQA[6]->Fill(dxy);
3293 if (fill) fHistQA[7]->Fill(dz);
3294 Float_t chi2ndf = track->Chi2perNDF();
3295 if (fill) fHistQA[13]->Fill(chi2ndf);
3296 // Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
3297 Float_t nCrossedRowsTPC = track->GetTPCNCrossedRows();
3298 if (fill) fHistQA[14]->Fill(nCrossedRowsTPC);
3299 //Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
3300 if (track->GetTPCNclsF()>0) {
3301 Float_t ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
3302 if (fill) fHistQA[15]->Fill(ratioCrossedRowsOverFindableClustersTPC);
3305 Float_t pt=track->Pt();
3306 if(pt< fminPt || pt> fmaxPt) return 0;
3307 if(TMath::Abs(track->Eta())> fmaxeta) return 0;
3308 if(track->Phi()<0. || track->Phi()>2*TMath::Pi()) return 0;
3309 //if (!HasTPCPID(track)) return 0;//trigger & associated particles must have TPC PID,Is it required???
3311 if (fdcacut && fDCAXYCut)
3318 AliAODTrack* clone =(AliAODTrack*) track->Clone();
3319 Bool_t success = clone->PropagateToDCA(vertex, magfield, fdcacutvalue, pos, covar);
3324 // Printf("%f", ((AliAODTrack*)part)->DCA());
3325 // Printf("%f", pos[0]);
3326 if (TMath::Abs(pos[0]) > fDCAXYCut->Eval(track->Pt()))
3330 if (fSharedClusterCut >= 0)
3332 Double_t frac = Double_t(((AliAODTrack*)track)->GetTPCnclsS()) / Double_t(((AliAODTrack*)track)->GetTPCncls());
3333 if (frac > fSharedClusterCut)
3337 // Rejects tracks with shared clusters after filling a control histogram
3338 // This overload is used for primaries
3340 // Get the shared maps
3341 const TBits sharedMap = track->GetTPCSharedMap();
3342 // Fill a control histogram
3343 fPriHistShare->Fill(sharedMap.CountBits());
3345 // Reject shared clusters
3346 if (fSharedTPCmapCut >= 0)
3348 if((sharedMap.CountBits()) >= 1) return 0;// Bad track, has too many shared clusters!
3351 if (fill) fHistQA[8]->Fill(pt);
3352 if (fill) fHistQA[9]->Fill(track->Eta());
3353 if (fill) fHistQA[10]->Fill(track->Phi());
3356 //________________________________________________________________________________
3357 void AliTwoParticlePIDCorr::CalculateNSigmas(AliAODTrack *track, Bool_t FIllQAHistos)
3359 //This function is called within the func GetParticle() for accepted tracks only i.e.after call of Classifytrack() & for those tracks which have proper TPC PID response . combined nsigma(circular) cut only for particles having pt upto 4.0 Gev/c and beyond that use the asymmetric nsigma cut around pion's mean position in TPC ( while filling the TObjArray for trig & asso )
3360 Float_t pt=track->Pt();
3362 //plot the separation power
3364 Double_t bethe[AliPID::kSPECIES]={0.};
3365 Double_t sigma_TPC[AliPID::kSPECIES]={0.};
3367 Double_t Pi_Ka_sep[NSigmaPIDType+1]={0.};
3368 Double_t Pi_Pr_sep[NSigmaPIDType+1]={0.};
3369 Double_t Ka_Pr_sep[NSigmaPIDType+1]={0.};
3372 Double_t ptpc = track->GetTPCmomentum();
3373 Int_t dEdxN = track->GetTPCsignalN();
3374 for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
3375 bethe[ipart] = fPID->GetTPCResponse().GetExpectedSignal(ptpc, (AliPID::EParticleType)ipart);
3376 //Double_t diff = dEdx - bethe;
3377 sigma_TPC[ipart] = fPID->GetTPCResponse().GetExpectedSigma(ptpc, dEdxN, (AliPID::EParticleType)ipart);
3378 //nSigma[ipart] = diff / sigma;
3380 Pi_Ka_sep[NSigmaTPC]=TMath::Abs(bethe[AliPID::kPion]-bethe[AliPID::kKaon])/((sigma_TPC[AliPID::kPion]+sigma_TPC[AliPID::kKaon])/2.0);
3381 Pi_Pr_sep[NSigmaTPC]=TMath::Abs(bethe[AliPID::kPion]-bethe[AliPID::kProton])/((sigma_TPC[AliPID::kPion]+sigma_TPC[AliPID::kProton])/2.0);
3382 Ka_Pr_sep[NSigmaTPC]=TMath::Abs(bethe[AliPID::kKaon]-bethe[AliPID::kProton])/((sigma_TPC[AliPID::kKaon]+sigma_TPC[AliPID::kProton])/2.0);
3385 Double_t sigma_TOF[AliPID::kSPECIES]={0.};
3387 if(HasTOFPID(track) && pt>fPtTOFPIDmin)
3389 Double_t timei[AliPID::kSPECIES];
3390 track->GetIntegratedTimes(timei);
3391 for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) { sigma_TOF[ipart]= fPID->GetTOFResponse().GetExpectedSigma(track->P(), timei[ipart], AliPID::ParticleMass(ipart));}
3392 Pi_Ka_sep[NSigmaTOF]=TMath::Abs(timei[AliPID::kPion]-timei[AliPID::kKaon])/((sigma_TOF[AliPID::kPion]+sigma_TOF[AliPID::kKaon])/2.0);
3393 Pi_Pr_sep[NSigmaTOF]=TMath::Abs(timei[AliPID::kPion]-timei[AliPID::kProton])/((sigma_TOF[AliPID::kPion]+sigma_TOF[AliPID::kProton])/2.0);
3394 Ka_Pr_sep[NSigmaTOF]=TMath::Abs(timei[AliPID::kKaon]-timei[AliPID::kProton])/((sigma_TOF[AliPID::kKaon]+sigma_TOF[AliPID::kProton])/2.0);
3396 Pi_Ka_sep[NSigmaTPCTOF]=TMath::Abs(Pi_Ka_sep[NSigmaTPC]*Pi_Ka_sep[NSigmaTPC]+Pi_Ka_sep[NSigmaTOF]*Pi_Ka_sep[NSigmaTOF]);
3397 Pi_Pr_sep[NSigmaTPCTOF]=TMath::Abs(Pi_Pr_sep[NSigmaTPC]*Pi_Pr_sep[NSigmaTPC]+Pi_Pr_sep[NSigmaTOF]*Pi_Pr_sep[NSigmaTOF]);
3398 Ka_Pr_sep[NSigmaTPCTOF]=TMath::Abs(Ka_Pr_sep[NSigmaTPC]*Ka_Pr_sep[NSigmaTPC]+Ka_Pr_sep[NSigmaTOF]*Ka_Pr_sep[NSigmaTOF]);
3402 //fill separation power histograms
3403 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
3405 TH2F *h=GetHistogram2D(Form("Pi_Ka_sep_%d",ipid));
3406 h->Fill(track->Pt(),Pi_Ka_sep[ipid]);
3407 TH2F *h1=GetHistogram2D(Form("Pi_Pr_sep_%d",ipid));
3408 h1->Fill(track->Pt(),Pi_Pr_sep[ipid]);
3409 TH2F *h2=GetHistogram2D(Form("Ka_Pr_sep_%d",ipid));
3410 h2->Fill(track->Pt(),Ka_Pr_sep[ipid]);
3412 if(HasTOFPID(track) && pt>fPtTOFPIDmin && ipid!=0){
3413 TH2F *h=GetHistogram2D(Form("Pi_Ka_sep_%d",ipid));
3414 h->Fill(track->Pt(),Pi_Ka_sep[ipid]);
3415 TH2F *h1=GetHistogram2D(Form("Pi_Pr_sep_%d",ipid));
3416 h1->Fill(track->Pt(),Pi_Pr_sep[ipid]);
3417 TH2F *h2=GetHistogram2D(Form("Ka_Pr_sep_%d",ipid));
3418 h2->Fill(track->Pt(),Ka_Pr_sep[ipid]);
3423 //it is assumed that every track that passed the filterbit have proper TPC response(!!)
3424 Float_t nsigmaTPCkPion =fPID->NumberOfSigmasTPC(track, AliPID::kPion);
3425 Float_t nsigmaTPCkKaon =fPID->NumberOfSigmasTPC(track, AliPID::kKaon);
3426 Float_t nsigmaTPCkProton =fPID->NumberOfSigmasTPC(track, AliPID::kProton);
3428 Float_t nsigmaTOFkProton=999.,nsigmaTOFkKaon=999.,nsigmaTOFkPion=999.;
3429 Float_t nsigmaTPCTOFkProton=999.,nsigmaTPCTOFkKaon=999.,nsigmaTPCTOFkPion=999.;
3431 if(HasTOFPID(track) && pt>fPtTOFPIDmin)
3434 nsigmaTOFkPion =fPID->NumberOfSigmasTOF(track, AliPID::kPion);
3435 nsigmaTOFkKaon =fPID->NumberOfSigmasTOF(track, AliPID::kKaon);
3436 nsigmaTOFkProton =fPID->NumberOfSigmasTOF(track, AliPID::kProton);
3438 nsigmaTPCTOFkPion = TMath::Sqrt(nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion);
3439 nsigmaTPCTOFkKaon = TMath::Sqrt(nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon);
3440 nsigmaTPCTOFkProton = TMath::Sqrt(nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton);
3446 // if TOF is missing and below fPtTOFPID only the TPC information is used
3447 nsigmaTPCTOFkProton = TMath::Abs(nsigmaTPCkProton);
3448 nsigmaTPCTOFkKaon = TMath::Abs(nsigmaTPCkKaon);
3449 nsigmaTPCTOFkPion = TMath::Abs(nsigmaTPCkPion);
3453 //set data member fnsigmas
3454 fnsigmas[SpPion][NSigmaTPC]=nsigmaTPCkPion;
3455 fnsigmas[SpKaon][NSigmaTPC]=nsigmaTPCkKaon;
3456 fnsigmas[SpProton][NSigmaTPC]=nsigmaTPCkProton;
3458 //for all tracks below fPtTOFPIDmin and also for tracks above fPtTOFPIDmin without proper TOF response these TOF nsigma values will be 999.
3459 fnsigmas[SpPion][NSigmaTOF]=nsigmaTOFkPion;
3460 fnsigmas[SpKaon][NSigmaTOF]=nsigmaTOFkKaon;
3461 fnsigmas[SpProton][NSigmaTOF]=nsigmaTOFkProton;
3463 //for all tracks below fPtTOFPIDmin and also for tracks above fPtTOFPIDmin without proper TOF response these TPCTOF nsigma values will be TMath::Abs(TPC only nsigma)
3464 fnsigmas[SpPion][NSigmaTPCTOF]=nsigmaTPCTOFkPion;
3465 fnsigmas[SpKaon][NSigmaTPCTOF]=nsigmaTPCTOFkKaon;
3466 fnsigmas[SpProton][NSigmaTPCTOF]=nsigmaTPCTOFkProton;
3469 //Fill NSigma SeparationPlot
3470 for(Int_t ipart=0;ipart<NSpecies;ipart++){
3471 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
3472 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
3473 TH2F *h=GetHistogram2D(Form("NSigma_%d_%d",ipart,ipid));
3474 h->Fill(track->Pt(),fnsigmas[ipart][ipid]);
3480 //----------------------------------------------------------------------------
3481 Int_t AliTwoParticlePIDCorr::FindMinNSigma(AliAODTrack *track,Bool_t FillQAHistos)
3483 //this function is always called after calling the function CalculateNSigmas(AliAODTrack *track)
3484 if(fRequestTOFPID && track->Pt()>fPtTOFPIDmin && (!HasTOFPID(track)) )return SpUndefined;//so any track having Pt>0.6 withot having proper TOF response will be defined as SpUndefined
3485 //get the identity of the particle with the minimum Nsigma
3486 Float_t nsigmaPion=999., nsigmaKaon=999., nsigmaProton=999.;
3489 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPC]);
3490 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPC]) ;
3491 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPC]) ;
3494 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTOF]);
3495 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTOF]) ;
3496 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTOF]) ;
3498 case NSigmaTPCTOF://In case of no TOF matching the combined nsigma is the TPC one
3499 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);
3500 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;
3501 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;
3503 case Bayes://the nsigma in the bayesian is used to clean with a very large n-sigma value
3504 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);
3505 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;
3506 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;
3511 if(fdiffPIDcutvalues){
3512 if(track->Pt()<=4) fNSigmaPID=fPIDCutval1;
3513 if(track->Pt()>4 && track->Pt()<=6) fNSigmaPID=fPIDCutval2;
3514 if(track->Pt()>6 && track->Pt()<=8) fNSigmaPID=fPIDCutval3;
3515 if(track->Pt()>8) fNSigmaPID=fPIDCutval4;
3518 // guess the particle based on the smaller nsigma (within fNSigmaPID)
3519 if( ( nsigmaKaon==nsigmaPion ) && ( nsigmaKaon==nsigmaProton )) return SpUndefined;//it is the default value for the three
3521 if( ( nsigmaKaon < nsigmaPion ) && ( nsigmaKaon < nsigmaProton ) && (nsigmaKaon < fNSigmaPID)){
3522 if((fHighPtKaonNSigmaPID>0) && (track->Pt()>fHighPtKaonSigma) && (nsigmaKaon > fHighPtKaonNSigmaPID)) return SpUndefined;//different nsigma cut for kaons above a particular Pt range(within the TPC-TOF PID range)
3524 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
3525 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
3526 TH2F *h=GetHistogram2D(Form("NSigmaRec_%d_%d",SpKaon,ipid));
3527 h->Fill(track->Pt(),fnsigmas[SpKaon][ipid]);
3532 if( ( nsigmaPion < nsigmaKaon ) && ( nsigmaPion < nsigmaProton ) && (nsigmaPion < fNSigmaPID)) {
3534 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
3535 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
3536 TH2F *h=GetHistogram2D(Form("NSigmaRec_%d_%d",SpPion,ipid));
3537 h->Fill(track->Pt(),fnsigmas[SpPion][ipid]);
3542 if( ( nsigmaProton < nsigmaKaon ) && ( nsigmaProton < nsigmaPion ) && (nsigmaProton < fNSigmaPID)) {
3544 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
3545 if((ipid!=NSigmaTPC) && (!HasTOFPID(track)))continue;//not filling TOF and combined if no TOF PID
3546 TH2F *h=GetHistogram2D(Form("NSigmaRec_%d_%d",SpProton,ipid));
3547 h->Fill(track->Pt(),fnsigmas[SpProton][ipid]);
3553 // else, return undefined
3559 //------------------------------------------------------------------------------------------
3560 Bool_t* AliTwoParticlePIDCorr::GetDoubleCounting(AliAODTrack * trk,Bool_t FIllQAHistos){
3561 //this function is always called after calling the function CalculateNSigmas(AliAODTrack *track)
3563 //if a particle has double counting set fHasDoubleCounting[ipart]=kTRUE
3565 for(Int_t ipart=0;ipart<NSpecies;ipart++)fHasDoubleCounting[ipart]=kFALSE;//array with kTRUE for second (or third) identity of the track
3567 Int_t MinNSigma=FindMinNSigma(trk,kFALSE);//not filling the NSigmaRec histos
3570 if(MinNSigma==SpUndefined)return fHasDoubleCounting;//in case of undefined no Double counting
3572 Float_t nsigmaPion=999., nsigmaKaon=999., nsigmaProton=999.;
3575 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPC]);
3576 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPC]) ;
3577 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPC]) ;
3580 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTOF]);
3581 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTOF]) ;
3582 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTOF]) ;
3584 case NSigmaTPCTOF://In case of no TOF matching the combined nsigma is the TPC one
3585 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);
3586 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;
3587 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;
3589 case Bayes://the nsigma in the bayesian is used to clean with a very large n-sigma value
3590 nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);
3591 nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;
3592 nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;
3596 // Actually the tracks in the overlapping region(in TPC-TOF nSigma plane) will be ignored
3598 if(nsigmaPion<fNSigmaPID && MinNSigma!=SpPion)fHasDoubleCounting[SpPion]=kTRUE;
3599 if(nsigmaKaon<fNSigmaPID && MinNSigma!=SpKaon)fHasDoubleCounting[SpKaon]=kTRUE;
3600 if(nsigmaProton<fNSigmaPID && MinNSigma!=SpProton)fHasDoubleCounting[SpProton]=kTRUE;
3605 //fill NSigma distr for double counting
3606 for(Int_t ipart=0;ipart<NSpecies;ipart++){
3607 if(fHasDoubleCounting[ipart]){//this may be kTRUE only for particles having Pt<=4.0 GeV/C, so this histo contains all the particles having Pt<=4.0 GeV/C in the nsigma overlapping region in TPC/TPC-TOF plane
3608 for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++){
3609 if((ipid!=NSigmaTPC) && (!HasTOFPID(trk)))continue;//not filling TOF and combined if no TOF PID
3610 TH2F *h=GetHistogram2D(Form("NSigmaDC_%d_%d",ipart,ipid));
3611 h->Fill(trk->Pt(),fnsigmas[ipart][ipid]);
3618 return fHasDoubleCounting;
3621 //////////////////////////////////////////////////////////////////////////////////////////////////
3623 Bool_t* AliTwoParticlePIDCorr::GetAllCompatibleIdentitiesNSigma(AliAODTrack * trk,Bool_t FIllQAHistos){
3624 //mainly intended to check the probability of the PID of the tracks which are in the overlapping nSigma regions and near about the middle position from the mean position of two ID particle
3625 Bool_t *IDs=GetDoubleCounting(trk,FIllQAHistos);
3626 IDs[FindMinNSigma(trk,FIllQAHistos)]=kTRUE;
3630 //////////////////////////////////////////////////////////////////////////////////////////////////
3632 UInt_t AliTwoParticlePIDCorr::CalcPIDCombined(AliAODTrack *track, Int_t detMask, Double_t* prob) const{
3634 // Bayesian PID calculation
3636 for(Int_t i=0;i<AliPID::kSPECIES;i++)
3640 fPIDCombined->SetDetectorMask(detMask);
3642 return fPIDCombined->ComputeProbabilities((AliAODTrack*)track, fPID, prob);
3645 //////////////////////////////////////////////////////////////////////////////////////////////////
3647 Int_t AliTwoParticlePIDCorr::GetIDBayes(AliAODTrack * trk, Bool_t FIllQAHistos){
3649 Bool_t *IDs=GetAllCompatibleIdentitiesNSigma(trk,FIllQAHistos);
3652 //Filling of Probability histos
3653 Double_t probTPC[AliPID::kSPECIES]={0.};
3654 Double_t probTOF[AliPID::kSPECIES]={0.};
3655 Double_t probTPCTOF[AliPID::kSPECIES]={0.};
3657 UInt_t detUsedTPC = 0;
3658 UInt_t detUsedTOF = 0;
3659 UInt_t detUsedTPCTOF = 0;
3661 //get the TPC probability
3662 fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
3663 detUsedTPC = fPIDCombined->ComputeProbabilities(trk, fPID, probTPC);
3664 if(detUsedTPC == AliPIDResponse::kDetTPC)
3666 for(Int_t ipart=0;ipart<NSpecies;ipart++){
3668 TH2F *h=GetHistogram2D(Form("probBayes_TPC_%d",ipart));
3669 if(ipart==0) h->Fill(trk->Pt(),probTPC[AliPID::kPion]);
3670 if(ipart==1) h->Fill(trk->Pt(),probTPC[AliPID::kKaon]);
3671 if(ipart==2) h->Fill(trk->Pt(),probTPC[AliPID::kProton]);
3675 //get the TOF probability
3676 fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF);
3677 detUsedTOF = fPIDCombined->ComputeProbabilities(trk, fPID, probTOF);
3678 if(detUsedTOF == AliPIDResponse::kDetTOF)
3680 for(Int_t ipart=0;ipart<NSpecies;ipart++){
3681 TH2F *h=GetHistogram2D(Form("probBayes_TOF_%d",ipart));
3682 if(ipart==0) h->Fill(trk->Pt(),probTOF[AliPID::kPion]);
3683 if(ipart==1) h->Fill(trk->Pt(),probTOF[AliPID::kKaon]);
3684 if(ipart==2) h->Fill(trk->Pt(),probTOF[AliPID::kProton]);
3688 //get the TPC-TOF probability
3689 fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);
3690 detUsedTPCTOF = fPIDCombined->ComputeProbabilities(trk, fPID, probTPCTOF);
3691 if(detUsedTPCTOF == (AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC))
3693 for(Int_t ipart=0;ipart<NSpecies;ipart++){
3694 TH2F *h=GetHistogram2D(Form("probBayes_TPCTOF_%d",ipart));
3695 if(ipart==0) h->Fill(trk->Pt(),probTPCTOF[AliPID::kPion]);
3696 if(ipart==1) h->Fill(trk->Pt(),probTPCTOF[AliPID::kKaon]);
3697 if(ipart==2) h->Fill(trk->Pt(),probTPCTOF[AliPID::kProton]);
3702 Double_t probBayes[AliPID::kSPECIES];
3705 if(HasTOFPID(trk) && trk->Pt()>fPtTOFPIDmin){//use TOF information
3706 detUsed = CalcPIDCombined(trk, AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC, probBayes);
3707 if(detUsed != (AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC))return SpUndefined;//check that TPC and TOF are used
3709 detUsed = CalcPIDCombined(trk,AliPIDResponse::kDetTPC, probBayes);
3710 if(detUsed != AliPIDResponse::kDetTPC)return SpUndefined;//check that TPC is used
3713 //the probability has to be normalized to one, we check it
3715 for(Int_t ipart=0;ipart<AliPID::kSPECIES;ipart++)sump+=probBayes[ipart];
3716 if(sump<.99 && sump>1.01){//FIXME precision problem in the sum, workaround
3717 AliFatal("Bayesian probability not normalized to one");
3720 if(fdiffPIDcutvalues){
3721 if(trk->Pt()<=4) fBayesCut=fPIDCutval1;
3722 if(trk->Pt()>4 && trk->Pt()<=6) fBayesCut=fPIDCutval2;
3723 if(trk->Pt()>6 && trk->Pt()<=8) fBayesCut=fPIDCutval3;
3724 if(trk->Pt()>8) fBayesCut=fPIDCutval4;
3728 //probabilities are normalized to one, if the cut is above .5 there is no problem
3729 if(probBayes[AliPID::kPion]>fBayesCut && IDs[SpPion]==1){
3730 TH2F *h=GetHistogram2D(Form("BayesRec_%d",SpPion));
3731 h->Fill(trk->Pt(),probBayes[AliPID::kPion]);
3734 else if(probBayes[AliPID::kKaon]>fBayesCut && IDs[SpKaon]==1){
3735 TH2F *h=GetHistogram2D(Form("BayesRec_%d",SpKaon));
3736 h->Fill(trk->Pt(),probBayes[AliPID::kKaon]);
3739 else if(probBayes[AliPID::kProton]>fBayesCut && IDs[SpProton]==1){
3740 TH2F *h=GetHistogram2D(Form("BayesRec_%d",SpProton));
3741 h->Fill(trk->Pt(),probBayes[AliPID::kProton]);
3750 //////////////////////////////////////////////////////////////////////////////////////////////////
3751 Int_t AliTwoParticlePIDCorr::GetParticle(AliAODTrack * trk, Bool_t FIllQAHistos){
3752 //return the specie according to the minimum nsigma value
3753 //no double counting, this has to be evaluated using CheckDoubleCounting()
3755 Int_t ID=SpUndefined;
3757 CalculateNSigmas(trk,FIllQAHistos);//fill the data member fnsigmas with the nsigmas value [ipart][iPID]
3761 if(fPIDType==Bayes){//use bayesianPID
3764 AliFatal("PIDCombined object has to be set in the steering macro");
3767 ID = GetIDBayes(trk,FIllQAHistos);
3769 }else{ //use nsigma PID
3771 ID=FindMinNSigma(trk,FIllQAHistos);
3772 if(fUseExclusiveNSigma){ //if one particle has double counting and exclusive nsigma is requested ID = kSpUndefined
3774 HasDC=GetDoubleCounting(trk,FIllQAHistos);
3775 for(Int_t ipart=0;ipart<NSpecies;ipart++){
3776 if(HasDC[ipart]==kTRUE) ID = SpUndefined;
3780 //Fill PID signal plot
3781 if(ID != SpUndefined){
3782 for(Int_t idet=0;idet<fNDetectors;idet++){
3783 TH2F *h=GetHistogram2D(Form("PID_%d_%d",idet,ID));
3784 if(idet==fITS)h->Fill(trk->P(),trk->GetITSsignal()*trk->Charge());
3785 if(idet==fTPC)h->Fill(trk->P(),trk->GetTPCsignal()*trk->Charge());
3786 if(idet==fTOF && HasTOFPID(trk))h->Fill(trk->P(),GetBeta(trk)*trk->Charge());
3789 //Fill PID signal plot without cuts
3790 for(Int_t idet=0;idet<fNDetectors;idet++){
3791 TH2F *h=GetHistogram2D(Form("PIDAll_%d",idet));
3792 if(idet==fITS)h->Fill(trk->P(),trk->GetITSsignal()*trk->Charge());
3793 if(idet==fTPC)h->Fill(trk->P(),trk->GetTPCsignal()*trk->Charge());
3794 if(idet==fTOF && HasTOFPID(trk))h->Fill(trk->P(),GetBeta(trk)*trk->Charge());
3800 //-------------------------------------------------------------------------------------
3802 AliTwoParticlePIDCorr::HasTPCPID(AliAODTrack *track) const
3805 AliPIDResponse::EDetPidStatus statustpc = fPID->CheckPIDStatus(AliPIDResponse::kTPC,track);
3806 if(statustpc!=AliPIDResponse::kDetPidOk) return kFALSE;
3807 //ULong_t status=track->GetStatus();
3808 //if (!( (status & AliAODTrack::kTPCpid ) == AliAODTrack::kTPCpid )) return kFALSE;//remove light nuclei
3809 //if (track->GetTPCsignal() <= 0.) return kFALSE;
3810 // if(track->GetTPCsignalN() < 60) return kFALSE;//tracks with TPCsignalN< 60 have questionable dEdx,cutting on TPCsignalN > 70 or > 60 shouldn't make too much difference in statistics,also it is IMO safe to use TPC also for MIPs.
3814 //___________________________________________________________
3817 AliTwoParticlePIDCorr::HasTOFPID(AliAODTrack *track) const
3819 // check TOF matched track
3820 //ULong_t status=track->GetStatus();
3821 //if (!( (status & AliAODTrack::kITSin ) == AliAODTrack::kITSin )) return kFALSE;
3822 AliPIDResponse::EDetPidStatus statustof = fPID->CheckPIDStatus(AliPIDResponse::kTOF,track);
3823 if(statustof!= AliPIDResponse::kDetPidOk) return kFALSE;
3824 if(track->Pt()<=fPtTOFPIDmin) return kFALSE;
3825 //if(!((status & AliAODTrack::kTOFpid ) == AliAODTrack::kTOFpid )) return kFALSE;
3826 //Float_t probMis = fPIDresponse->GetTOFMismatchProbability(track);
3827 // if (probMis > 0.01) return kFALSE;
3828 if(fRemoveTracksT0Fill)
3830 Int_t startTimeMask = fPID->GetTOFResponse().GetStartTimeMask(track->P());
3831 if (startTimeMask < 0)return kFALSE;
3836 //________________________________________________________________________
3837 Double_t AliTwoParticlePIDCorr :: GetBeta(AliAODTrack *track)
3839 //it is called only when TOF PID is available
3840 //TOF beta calculation
3841 Double_t tofTime=track->GetTOFsignal();
3843 Double_t c=TMath::C()*1.E-9;// m/ns
3844 Float_t startTime = fPID->GetTOFResponse().GetStartTime(((AliVTrack*)track)->P());//in ps
3845 Double_t length= fPID->GetTOFResponse().GetExpectedSignal(track,AliPID::kElectron)*1E-3*c;
3846 tofTime -= startTime; // subtract startTime to the signal
3847 Double_t tof= tofTime*1E-3; // ns, average T0 fill subtracted, no info from T0detector
3853 Double_t p = track->P();
3854 Double_t time=track->GetTOFsignal()-fPID->GetTOFResponse().GetStartTime(p);
3856 track->GetIntegratedTimes(timei);
3857 return timei[0]/time;
3860 //------------------------------------------------------------------------------------------------------
3862 Float_t AliTwoParticlePIDCorr::GetInvMassSquared(Float_t pt1, Float_t eta1, Float_t phi1, Float_t pt2, Float_t eta2, Float_t phi2, Float_t m0_1, Float_t m0_2)
3864 // calculate inv mass squared
3865 // same can be achieved, but with more computing time with
3866 /*TLorentzVector photon, p1, p2;
3867 p1.SetPtEtaPhiM(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), 0.510e-3);
3868 p2.SetPtEtaPhiM(particle->Pt(), eta[j], particle->Phi(), 0.510e-3);
3872 Float_t tantheta1 = 1e10;
3874 if (eta1 < -1e-10 || eta1 > 1e-10)
3875 tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1));
3877 Float_t tantheta2 = 1e10;
3878 if (eta2 < -1e-10 || eta2 > 1e-10)
3879 tantheta2 = 2 * TMath::Exp(-eta2) / ( 1 - TMath::Exp(-2*eta2));
3881 Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
3882 Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
3884 Float_t mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( TMath::Cos(phi1 - phi2) + 1.0 / tantheta1 / tantheta2 ) ) );
3888 //---------------------------------------------------------------------------------
3890 Float_t AliTwoParticlePIDCorr::GetInvMassSquaredCheap(Float_t pt1, Float_t eta1, Float_t phi1, Float_t pt2, Float_t eta2, Float_t phi2, Float_t m0_1, Float_t m0_2)
3892 // calculate inv mass squared approximately
3894 Float_t tantheta1 = 1e10;
3896 if (eta1 < -1e-10 || eta1 > 1e-10)
3898 Float_t expTmp = 1.0-eta1+eta1*eta1/2-eta1*eta1*eta1/6+eta1*eta1*eta1*eta1/24;
3899 tantheta1 = 2.0 * expTmp / ( 1.0 - expTmp*expTmp);
3902 Float_t tantheta2 = 1e10;
3903 if (eta2 < -1e-10 || eta2 > 1e-10)
3905 Float_t expTmp = 1.0-eta2+eta2*eta2/2-eta2*eta2*eta2/6+eta2*eta2*eta2*eta2/24;
3906 tantheta2 = 2.0 * expTmp / ( 1.0 - expTmp*expTmp);
3909 Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
3910 Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
3913 Float_t deltaPhi = TMath::Abs(phi1 - phi2);
3914 while (deltaPhi > TMath::TwoPi())
3915 deltaPhi -= TMath::TwoPi();
3916 if (deltaPhi > TMath::Pi())
3917 deltaPhi = TMath::TwoPi() - deltaPhi;
3919 Float_t cosDeltaPhi = 0;
3920 if (deltaPhi < TMath::Pi()/3)
3921 cosDeltaPhi = 1.0 - deltaPhi*deltaPhi/2 + deltaPhi*deltaPhi*deltaPhi*deltaPhi/24;
3922 else if (deltaPhi < 2*TMath::Pi()/3)
3923 cosDeltaPhi = -(deltaPhi - TMath::Pi()/2) + 1.0/6 * TMath::Power((deltaPhi - TMath::Pi()/2), 3);
3925 cosDeltaPhi = -1.0 + 1.0/2.0*(deltaPhi - TMath::Pi())*(deltaPhi - TMath::Pi()) - 1.0/24.0 * TMath::Power(deltaPhi - TMath::Pi(), 4);
3927 Float_t mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( cosDeltaPhi + 1.0 / tantheta1 / tantheta2 ) ) );
3929 // Printf(Form("%f %f %f %f %f %f %f %f %f", pt1, eta1, phi1, pt2, eta2, phi2, m0_1, m0_2, mass2));
3933 //--------------------------------------------------------------------------------
3934 Float_t AliTwoParticlePIDCorr::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign)
3937 // calculates dphistar
3940 Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
3942 static const Double_t kPi = TMath::Pi();
3945 // if (dphistar > 2 * kPi)
3946 // dphistar -= 2 * kPi;
3947 // if (dphistar < -2 * kPi)
3948 // dphistar += 2 * kPi;
3951 dphistar = kPi * 2 - dphistar;
3952 if (dphistar < -kPi)
3953 dphistar = -kPi * 2 - dphistar;
3954 if (dphistar > kPi) // might look funny but is needed
3955 dphistar = kPi * 2 - dphistar;
3959 //_________________________________________________________________________
3961 void AliTwoParticlePIDCorr ::DefineEventPool()
3963 Int_t MaxNofEvents=1000;
3964 const Int_t NofVrtxBins=10+(1+10)*2;
3965 Double_t ZvrtxBins[NofVrtxBins+1]={ -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10,
3966 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110,
3967 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210
3969 //default values are for centrality
3970 Int_t NofCentBins=15;
3971 Double_t CentralityBins[NofCentBins+1]={0., 1., 2., 3., 4., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.1 };
3973 if(fCentralityMethod.EndsWith("_MANUAL"))
3975 Int_t NofCentBins=9;
3976 CentralityBins[NofCentBins+1]={0.,9.,14.,19.,26.,34.,44.,58.,80.,500.};//Is This binning is fine for pp, or we don't require them....
3978 fPoolMgr = new AliEventPoolManager(MaxNofEvents,fMaxNofMixingTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);
3983 fPoolMgr->SetTargetValues(fMaxNofMixingTracks, 0.1, 5);
3985 //if(!fPoolMgr) return kFALSE;
3990 //------------------------------------------------------------------------
3991 Double_t* AliTwoParticlePIDCorr::GetBinning(const char* configuration, const char* tag, Int_t& nBins)
3993 // This method is a copy from AliUEHist::GetBinning
3994 // takes the binning from <configuration> identified by <tag>
3995 // configuration syntax example:
3996 // eta: 2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4
3999 // returns bin edges which have to be deleted by the caller
4001 TString config(configuration);
4002 TObjArray* lines = config.Tokenize("\n");
4003 for (Int_t i=0; i<lines->GetEntriesFast(); i++)
4005 TString line(lines->At(i)->GetName());
4006 if (line.BeginsWith(TString(tag) + ":"))
4008 line.Remove(0, strlen(tag) + 1);
4009 line.ReplaceAll(" ", "");
4010 TObjArray* binning = line.Tokenize(",");
4011 Double_t* bins = new Double_t[binning->GetEntriesFast()];
4012 for (Int_t j=0; j<binning->GetEntriesFast(); j++)
4013 bins[j] = TString(binning->At(j)->GetName()).Atof();
4015 nBins = binning->GetEntriesFast() - 1;
4024 AliFatal(Form("Tag %s not found in %s", tag, configuration));
4028 //____________________________________________________________________
4030 Bool_t AliTwoParticlePIDCorr::CheckTrack(AliAODTrack * part)
4032 // check if the track status flags are set
4034 UInt_t status=((AliAODTrack*)part)->GetStatus();
4035 if ((status & fTrackStatus) == fTrackStatus)
4039 //________________________________________________________________________
4041 Bool_t AliTwoParticlePIDCorr::AcceptEventCentralityWeight(Double_t centrality)
4043 // rejects "randomly" events such that the centrality gets flat
4044 // uses fCentralityWeights histogram
4046 // TODO code taken and adapted from AliRDHFCuts; waiting for general class AliCentralityFlattening
4048 Double_t weight = fCentralityWeights->GetBinContent(fCentralityWeights->FindBin(centrality));
4049 Double_t centralityDigits = centrality*100. - (Int_t)(centrality*100.);
4051 Bool_t result = kFALSE;
4052 if (centralityDigits < weight)
4055 AliInfo(Form("Centrality: %f; Digits: %f; Weight: %f; Result: %d", centrality, centralityDigits, weight, result));
4060 //____________________________________________________________________
4061 void AliTwoParticlePIDCorr::ShiftTracks(TObjArray* tracks, Double_t angle)
4063 // shifts the phi angle of all tracks by angle
4064 // 0 <= angle <= 2pi
4066 for (Int_t i=0; i<tracks->GetEntriesFast(); ++i)
4068 LRCParticlePID *part=(LRCParticlePID*)(tracks->UncheckedAt(i));
4070 Double_t newAngle = part->Phi() + angle;
4071 if (newAngle >= TMath::TwoPi())
4072 newAngle -= TMath::TwoPi();
4074 part->SetPhi(newAngle);
4079 //________________________________________________________________________
4080 void AliTwoParticlePIDCorr::SetVZEROCalibrationFile(const char* filename,const char* lhcPeriod) {
4081 //Function to setup the VZERO gain equalization
4082 //============Get the equilization map============//
4083 TFile *calibrationFile = TFile::Open(filename);
4084 if((!calibrationFile)||(!calibrationFile->IsOpen())) {
4085 Printf("No calibration file found!!!");
4089 TList *list = dynamic_cast<TList *>(calibrationFile->Get(lhcPeriod));
4091 Printf("Calibration TList not found!!!");
4095 fHistVZEROAGainEqualizationMap = dynamic_cast<TH1F *>(list->FindObject("gHistVZEROAGainEqualizationMap"));
4096 if(!fHistVZEROAGainEqualizationMap) {
4097 Printf("VZERO-A calibration object not found!!!");
4100 fHistVZEROCGainEqualizationMap = dynamic_cast<TH1F *>(list->FindObject("gHistVZEROCGainEqualizationMap"));
4101 if(!fHistVZEROCGainEqualizationMap) {
4102 Printf("VZERO-C calibration object not found!!!");
4106 fHistVZEROChannelGainEqualizationMap = dynamic_cast<TH2F *>(list->FindObject("gHistVZEROChannelGainEqualizationMap"));
4107 if(!fHistVZEROChannelGainEqualizationMap) {
4108 Printf("VZERO channel calibration object not found!!!");
4113 //________________________________________________________________________
4114 Double_t AliTwoParticlePIDCorr::GetChannelEqualizationFactor(Int_t run,Int_t channel) {
4116 if(!fHistVZEROAGainEqualizationMap) return 1.0;
4118 for(Int_t iBinX = 1; iBinX <= fHistVZEROChannelGainEqualizationMap->GetNbinsX(); iBinX++) {
4119 Int_t gRunNumber = atoi(fHistVZEROChannelGainEqualizationMap->GetXaxis()->GetBinLabel(iBinX));
4120 if(gRunNumber == run)
4121 return fHistVZEROChannelGainEqualizationMap->GetBinContent(iBinX,channel+1);
4127 //________________________________________________________________________
4128 Double_t AliTwoParticlePIDCorr::GetEqualizationFactor(Int_t run, const char* side) {
4130 if(!fHistVZEROAGainEqualizationMap) return 1.0;
4132 TString gVZEROSide = side;
4133 for(Int_t iBinX = 1; iBinX < fHistVZEROAGainEqualizationMap->GetNbinsX(); iBinX++) {
4134 Int_t gRunNumber = atoi(fHistVZEROAGainEqualizationMap->GetXaxis()->GetBinLabel(iBinX));
4135 //cout<<"Looking for run "<<run<<" - current run: "<<gRunNumber<<endl;
4136 if(gRunNumber == run) {
4137 if(gVZEROSide == "A")
4138 return fHistVZEROAGainEqualizationMap->GetBinContent(iBinX);
4139 else if(gVZEROSide == "C")
4140 return fHistVZEROCGainEqualizationMap->GetBinContent(iBinX);
4146 //________________________________________________________________________
4147 Double_t AliTwoParticlePIDCorr::GetReferenceMultiplicityVZEROFromAOD(AliAODEvent *event){
4148 //Function that returns the reference multiplicity from AODs (data or reco MC, Not for Truth)
4149 //Different ref. mult. implemented: V0M, V0A, V0C, TPC
4150 Double_t gRefMultiplicity = 0., gRefMultiplicityTPC = 0.;
4151 Double_t gRefMultiplicityVZERO = 0., gRefMultiplicityVZEROA = 0., gRefMultiplicityVZEROC = 0.;
4153 AliAODHeader *header = dynamic_cast<AliAODHeader *>(event->GetHeader());
4155 Printf("ERROR: AOD header not available");
4158 Int_t gRunNumber = header->GetRunNumber();
4159 Float_t bSign1=header->GetMagneticField() ;//for dca cut in ClassifyTrack(), i.e in track loop
4162 for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++)
4163 { //track loop starts for TObjArray(containing track and event information) filling; used for correlation function calculation
4164 AliAODTrack* track = dynamic_cast<AliAODTrack*>(event->GetTrack(itrk));
4165 if (!track) continue;
4166 Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1,kFALSE);//don't fill the histos here
4167 if(tracktype!=1) continue;
4169 if(!track) continue;//for safety
4171 gRefMultiplicityTPC += 1.0;
4175 if(fCentralityMethod == "V0A_MANUAL" || fCentralityMethod == "V0M_MANUAL" || fCentralityMethod == "V0C_MANUAL" ){
4176 //VZERO segmentation in two detectors (0-31: VZERO-C, 32-63: VZERO-A)
4177 for(Int_t iChannel = 0; iChannel < 64; iChannel++) {
4178 fHistVZEROSignal->Fill(iChannel,event->GetVZEROEqMultiplicity(iChannel));
4181 gRefMultiplicityVZEROC += event->GetVZEROEqMultiplicity(iChannel);
4182 else if(iChannel >= 32)
4183 gRefMultiplicityVZEROA += event->GetVZEROEqMultiplicity(iChannel);
4186 //Equalization of gain
4187 Double_t gFactorA = GetEqualizationFactor(gRunNumber,"A");
4189 gRefMultiplicityVZEROA /= gFactorA;
4190 Double_t gFactorC = GetEqualizationFactor(gRunNumber,"C");
4192 gRefMultiplicityVZEROC /= gFactorC;
4193 if((gFactorA != 0)&&(gFactorC != 0))
4194 gRefMultiplicityVZERO = (gRefMultiplicityVZEROA/gFactorA)+(gRefMultiplicityVZEROC/gFactorC);
4197 //EQVZERO vs TPC multiplicity
4198 fHistEQVZEROvsTPCmultiplicity->Fill(gRefMultiplicityVZERO,gRefMultiplicityTPC);
4199 fHistEQVZEROAvsTPCmultiplicity->Fill(gRefMultiplicityVZEROA,gRefMultiplicityTPC);
4200 fHistEQVZEROCvsTPCmultiplicity->Fill(gRefMultiplicityVZEROC,gRefMultiplicityTPC);
4202 //EQVZERO vs VZERO multiplicity
4203 fHistVZEROCvsEQVZEROCmultiplicity->Fill(event->GetVZEROData()->GetMTotV0C(),gRefMultiplicityVZEROC);
4204 fHistVZEROAvsEQVZEROAmultiplicity->Fill(event->GetVZEROData()->GetMTotV0A(),gRefMultiplicityVZEROA);
4206 //VZEROC vs VZEROA multiplicity
4207 fHistVZEROCvsVZEROAmultiplicity->Fill(event->GetVZEROData()->GetMTotV0C(),event->GetVZEROData()->GetMTotV0A());
4209 //EQVZEROC vs EQVZEROA multiplicity
4210 fHistEQVZEROCvsEQVZEROAmultiplicity->Fill(gRefMultiplicityVZEROC,gRefMultiplicityVZEROA);
4213 if(fCentralityMethod == "TRACKS_MANUAL") {
4214 gRefMultiplicity = gRefMultiplicityTPC;
4215 fHistRefmult->Fill(3.,gRefMultiplicityTPC);
4217 else if(fCentralityMethod == "V0M_MANUAL"){
4218 gRefMultiplicity = gRefMultiplicityVZERO;
4219 fHistRefmult->Fill(2.,gRefMultiplicityVZERO);
4222 else if(fCentralityMethod == "V0A_MANUAL"){
4223 gRefMultiplicity = gRefMultiplicityVZEROA;
4224 fHistRefmult->Fill(0.,gRefMultiplicityVZEROA);
4227 else if(fCentralityMethod == "V0C_MANUAL"){
4228 gRefMultiplicity = gRefMultiplicityVZEROC;
4229 fHistRefmult->Fill(1.,gRefMultiplicityVZEROC);
4233 return gRefMultiplicity;
4236 //-------------------------------------------------------------------------------------------------------
4237 Double_t AliTwoParticlePIDCorr::GetRefMultiOrCentrality(AliAODEvent *event, Bool_t truth){
4239 if(!event) return -1;
4240 // get centrality object and check quality
4241 Double_t cent_v0=-1;
4242 Double_t nooftrackstruth=0;
4244 if(fCentralityMethod=="V0M" || fCentralityMethod=="V0A" || fCentralityMethod=="V0C" || fCentralityMethod=="CL1" || fCentralityMethod=="ZNA" || fCentralityMethod=="V0AEq" || fCentralityMethod=="V0CEq" || fCentralityMethod=="V0MEq")//for PbPb, pPb, pp7TeV(still to be introduced)//data or RecoMC and also for TRUTH
4246 AliCentrality *centralityObj=0;
4247 AliAODHeader *header = (AliAODHeader*) event->GetHeader();
4248 if(!header) return -1;
4249 centralityObj = header->GetCentralityP();
4250 // if (centrality->GetQuality() != 0) return ;
4254 fHistCentStats->Fill(0.,centralityObj->GetCentralityPercentile("V0A"));
4255 fHistCentStats->Fill(1.,centralityObj->GetCentralityPercentile("V0C"));
4256 fHistCentStats->Fill(2.,centralityObj->GetCentralityPercentile("V0M"));
4257 if(fSampleType=="pp") fHistCentStats->Fill(3.,centralityObj->GetCentralityPercentile("V0AEq"));//only available for LHC10d at present (Quantile info)
4258 if(fSampleType=="pp") fHistCentStats->Fill(4.,centralityObj->GetCentralityPercentile("V0CEq"));//only available for LHC10d at present (Quantile info)
4259 if(fSampleType=="pp") fHistCentStats->Fill(5.,centralityObj->GetCentralityPercentile("V0MEq"));//only available for LHC10d at present (Quantile info)
4261 if(fSampleType=="pPb" || fSampleType=="PbPb") fHistCentStats->Fill(6.,centralityObj->GetCentralityPercentile("CL1"));
4262 if(fSampleType=="pPb" || fSampleType=="PbPb") fHistCentStats->Fill(7.,centralityObj->GetCentralityPercentile("ZNA"));
4264 cent_v0 = centralityObj->GetCentralityPercentile(fCentralityMethod);
4267 }//centralitymethod condition
4269 else if(fCentralityMethod=="V0M_MANUAL" || fCentralityMethod=="V0A_MANUAL" || fCentralityMethod=="V0C_MANUAL" || fCentralityMethod=="TRACKS_MANUAL")//data or RecoMc and also for TRUTH
4271 if(!truth){//for data or RecoMC
4272 cent_v0 = GetReferenceMultiplicityVZEROFromAOD(event);
4273 }//for data or RecoMC
4275 if(truth){//condition for TRUTH case
4276 //check for TClonesArray(truth track MC information)
4277 fArrayMC = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
4279 //AliFatal("Error: MC particles branch not found!\n");
4282 //now process the truth particles(for both efficiency & correlation function)
4283 Int_t nMCTrack = fArrayMC->GetEntriesFast();
4285 for (Int_t iMC = 0; iMC < nMCTrack; iMC++)
4286 {//MC truth track loop starts
4288 AliAODMCParticle *partMC = (AliAODMCParticle*) fArrayMC->At(iMC);
4291 AliError(Form("ERROR: Could not retrieve AODMCtrack %d",iMC));
4295 //consider only charged particles
4296 if(partMC->Charge() == 0) continue;
4298 //consider only primary particles; neglect all secondary particles including from weak decays
4299 if(fselectprimaryTruth && !partMC->IsPhysicalPrimary()) continue;
4302 //remove injected signals(primaries above <maxLabel>)
4303 if (fInjectedSignals && partMC->GetLabel() >= skipParticlesAbove) continue;
4306 Bool_t isduplicate=kFALSE;
4307 if (fRemoveDuplicates)
4309 for (Int_t j=iMC+1; j<nMCTrack; ++j)
4310 {//2nd trutuh loop starts
4311 AliAODMCParticle *partMC2 = (AliAODMCParticle*) fArrayMC->At(j);
4313 AliError(Form("ERROR: Could not retrieve AODMCtrack %d",j));
4316 if (partMC->GetLabel() == partMC2->GetLabel())
4321 }//2nd truth loop ends
4323 if(fRemoveDuplicates && isduplicate) continue;//remove duplicates
4326 if (fCentralityMethod=="V0M_MANUAL") {
4327 if(partMC->Eta() > 5.1 || partMC->Eta() < 2.8) continue;
4328 if (partMC->Eta() < -3.7 || partMC->Eta() > -1.7) continue;
4330 else if (fCentralityMethod=="V0A_MANUAL") {
4331 if(partMC->Eta() > 5.1 || partMC->Eta() < 2.8) continue;}
4332 else if (fCentralityMethod=="V0C_MANUAL") {
4333 if(partMC->Eta() > -1.7 || partMC->Eta() < -3.7) continue;}
4334 else if (fCentralityMethod=="TRACKS_MANUAL") {
4335 if (partMC->Eta() < fmineta || partMC->Eta() > fmaxeta) continue;
4336 if (partMC->Pt() < fminPt || partMC->Pt() > fmaxPt) continue;
4338 else{//basically returns the tracks manual case
4339 //give only kinematic cuts at the truth level
4340 if (partMC->Eta() < fmineta || partMC->Eta() > fmaxeta) continue;
4341 if (partMC->Pt() < fminPt || partMC->Pt() > fmaxPt) continue;
4344 //To determine multiplicity in case of PP
4345 nooftrackstruth+= 1;;
4347 }//truth track loop ends
4348 cent_v0=nooftrackstruth;
4350 }//condition for TRUTH case
4352 }//end of MANUAL method
4354 else if ((fAnalysisType == "MCAOD") && (fCentralityMethod == "MC_b"))//TRUTH MC
4356 AliAODMCHeader* header = (AliAODMCHeader*) event->GetList()->FindObject(AliAODMCHeader::StdBranchName());
4360 AliGenEventHeader* eventHeader = header->GetCocktailHeader(0); // get first MC header from either ESD/AOD (including cocktail header if available)
4363 // We avoid AliFatal here, because the AOD productions sometimes have events where the MC header is missing
4364 // (due to unreadable Kinematics) and we don't want to loose the whole job because of a few events
4365 AliError("Event header not found. Skipping this event.");
4369 AliCollisionGeometry* collGeometry = dynamic_cast<AliCollisionGeometry*> (eventHeader);
4372 if (collGeometry) cent_v0 = collGeometry->ImpactParameter();
4374 }//end of Impact parameter method
4381 //-----------------------------------------------------------------------------------------
4382 Double_t AliTwoParticlePIDCorr::GetAcceptedEventMultiplicity(AliAODEvent *aod,Bool_t truth){
4383 //do the event selection(zvtx, pileup, centrality/multiplicity cut) and then return the value of the centrality of that event
4386 Float_t gRefMultiplicity = -1.;
4388 // check first event in chunk (is not needed for new reconstructions)
4389 if(fCheckFirstEventInChunk){
4390 AliAnalysisUtils ut;
4391 if(ut.IsFirstEventInChunk(aod))
4396 AliAnalysisUtils ut;
4397 ut.SetUseMVPlpSelection(kTRUE);
4398 ut.SetUseOutOfBunchPileUp(kTRUE);
4399 if(ut.IsPileUpEvent(aod))
4403 //count events after pileup selection
4404 fEventCounter->Fill(3);
4406 //vertex selection(is it fine for PP?)
4407 if ( fVertextype==1){//for pPb basically if(!fAnalysisUtils->IsVertexSelected2013pA(aod)) return;
4408 trkVtx = aod->GetPrimaryVertex();
4409 if (!trkVtx || trkVtx->GetNContributors()<=0) return -1;
4410 TString vtxTtl = trkVtx->GetTitle();
4411 if (!vtxTtl.Contains("VertexerTracks")) return -1;
4412 zvtx = trkVtx->GetZ();
4413 const AliAODVertex* spdVtx = aod->GetPrimaryVertexSPD();
4414 if (!spdVtx || spdVtx->GetNContributors()<=0) return -1;
4415 TString vtxTyp = spdVtx->GetTitle();
4416 Double_t cov[6]={0};
4417 spdVtx->GetCovarianceMatrix(cov);
4418 Double_t zRes = TMath::Sqrt(cov[5]);
4419 if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return -1;
4420 if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return -1;
4422 else if(fVertextype==2) {//for pp and pb-pb case , taken from Jan's code
4423 Int_t nVertex = aod->GetNumberOfVertices();
4425 trkVtx = aod->GetPrimaryVertex();
4426 Int_t nTracksPrim = trkVtx->GetNContributors();
4427 zvtx = trkVtx->GetZ();
4428 //if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));
4429 // Reject TPC only vertex
4430 TString name(trkVtx->GetName());
4431 if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return -1;
4433 // Select a quality vertex by number of tracks?
4434 if( nTracksPrim < fnTracksVertex ) {
4435 //if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
4438 // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present
4439 //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)
4441 // if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");
4446 else if(fVertextype==0){//default case
4447 trkVtx = aod->GetPrimaryVertex();
4448 if (!trkVtx || trkVtx->GetNContributors()<=0) return -1;//proper number of contributors
4449 zvtx = trkVtx->GetZ();
4451 trkVtx->GetCovarianceMatrix(fCov);
4452 if(fCov[5] == 0) return -1;//proper vertex resolution
4455 AliInfo("Wrong Vertextype set for Primary-vertex Selection: event REJECTED ...");
4456 return -1;//as there is no proper sample type
4459 fHistQA[0]->Fill((trkVtx->GetX()));fHistQA[1]->Fill((trkVtx->GetY()));fHistQA[2]->Fill((trkVtx->GetZ())); //for trkVtx only before vertex cut |zvtx|<10 cm
4461 //count events having a proper vertex
4462 fEventCounter->Fill(5);
4464 if (TMath::Abs(zvtx) > fzvtxcut) return -1;
4466 //count events after vertex cut
4467 fEventCounter->Fill(7);
4470 //if(!fAnalysisUtils->IsVertexSelected2013pA(aod)) return;
4472 fHistQA[3]->Fill((trkVtx->GetX()));fHistQA[4]->Fill((trkVtx->GetY()));fHistQA[5]->Fill((trkVtx->GetZ()));//after vertex cut,for trkVtx only
4474 //get the centrality or multiplicity
4475 if(truth) {gRefMultiplicity = GetRefMultiOrCentrality(aod,kTRUE);}//kTRUE-->for Truth case(only meaningful in case of ref multiplicity,in case of centrality it has no meaning)
4477 else {gRefMultiplicity = GetRefMultiOrCentrality(aod,kFALSE);}//kFALSE-->for data and RecoMc case(only meaningful in case of ref multiplicity,in case of centrality it has no meaning)
4479 if(gRefMultiplicity<0) return -1;
4481 // take events only within the multiplicity class mentioned in the custom binning
4482 if(gRefMultiplicity < fmincentmult || gRefMultiplicity > fmaxcentmult) return -1;
4484 //count events having proper centrality/ref multiplicity
4485 fEventCounter->Fill(9);
4488 // centrality weighting (optional for 2011 if central and semicentral triggers are used);only for data and recoMC
4489 if (fCentralityWeights && !AcceptEventCentralityWeight(gRefMultiplicity))//**********************
4491 AliInfo(Form("Rejecting event because of centrality weighting: %f", gRefMultiplicity));
4495 //count events after rejection due to centrality weighting
4496 fEventCounter->Fill(11);
4498 return gRefMultiplicity;
4501 //--------------------------------------------------------------------------------------------------------
4502 Float_t AliTwoParticlePIDCorr::GetEventPlane(AliAODEvent *event,Bool_t truth, Double_t v0Centr)
4504 // Get the event plane
4505 //reset Q vector info
4507 Int_t run = event->GetRunNumber();
4510 // Load the calibrations run dependent
4511 if(! fIsAfter2011) OpenInfoCalbration(run);
4517 if (v0Centr < 80){ // analysis only for 0-80% centrality classes
4519 if(v0Centr < 5) iC = 0;
4520 else if(v0Centr < 10) iC = 1;
4521 else if(v0Centr < 20) iC = 2;
4522 else if(v0Centr < 30) iC = 3;
4523 else if(v0Centr < 40) iC = 4;
4524 else if(v0Centr < 50) iC = 5;
4525 else if(v0Centr < 60) iC = 6;
4526 else if(v0Centr < 70) iC = 7;
4532 //reset Q vector info
4533 Double_t Qxa2 = 0, Qya2 = 0;
4534 Double_t Qxc2 = 0, Qyc2 = 0;
4535 Double_t Qxa3 = 0, Qya3 = 0;
4536 Double_t Qxc3 = 0, Qyc3 = 0;
4539 //MC: from reaction plane
4542 AliAODMCHeader* header = (AliAODMCHeader*) event->GetList()->FindObject(AliAODMCHeader::StdBranchName());
4544 evplaneMC = header->GetReactionPlaneAngle();//[0, 360]
4545 //make it within [-pi/2,pi/2] to make it general
4546 if(evplaneMC > TMath::Pi()/2 && evplaneMC <= TMath::Pi()*3/2) evplaneMC-=TMath::Pi();
4547 else if(evplaneMC > TMath::Pi()*3/2) evplaneMC-=2*TMath::Pi();
4548 fHistEventPlaneTruth->Fill(iC,evplaneMC);
4550 AliGenEventHeader* eventHeader = header->GetCocktailHeader(0); // get first MC header from either ESD/AOD (including cocktail header if available)
4554 AliCollisionGeometry* collGeometry = dynamic_cast<AliCollisionGeometry*> (eventHeader);
4556 if (collGeometry){//get the reaction plane from MC header
4557 gReactionPlane = collGeometry->ReactionPlaneAngle();//[0,180]
4561 //taken from vnv0 code(get the TPC, V0A, V0C event plane using truth tracks)
4562 TClonesArray *mcArray = NULL;
4563 mcArray = (TClonesArray*)event->GetList()->FindObject(AliAODMCParticle::StdBranchName());
4565 Float_t QxMCv2[3] = {0,0,0};
4566 Float_t QyMCv2[3] = {0,0,0};
4567 Float_t QxMCv3[3] = {0,0,0};
4568 Float_t QyMCv3[3] = {0,0,0};
4569 Float_t EvPlaneMCV2[3] = {0,0,0};
4570 Float_t EvPlaneMCV3[3] = {0,0,0};
4571 Float_t etaMin[3] = {2.8,-3.6,-0.8}; // A-side, C-side M-barrel
4572 Float_t etaMax[3] = {4.88,-1.8,0.8};
4574 // analysis on MC tracks
4575 Int_t nMCtrack = mcArray->GetEntries() ;
4577 // EP computation with MC tracks
4578 for(Int_t iT=0;iT < nMCtrack;iT++){
4579 AliAODMCParticle *mctr = (AliAODMCParticle*) mcArray->At(iT);
4580 if(!mctr || !(mctr->IsPrimary()) || !(mctr->Charge()) || mctr->Pt() < 0.2) continue;
4582 Float_t eta = mctr->Eta();
4583 for(Int_t iD=0;iD<3;iD++){
4584 if(eta > etaMin[iD] && eta < etaMax[iD]){
4585 Float_t phi = mctr->Phi();
4586 QxMCv2[iD] += TMath::Cos(2*phi);
4587 QyMCv2[iD] += TMath::Sin(2*phi);
4588 QxMCv3[iD] += TMath::Cos(3*phi);
4589 QyMCv3[iD] += TMath::Sin(3*phi);
4594 EvPlaneMCV2[0] = TMath::ATan2(QyMCv2[0],QxMCv2[0])/2.;
4595 EvPlaneMCV2[1] = TMath::ATan2(QyMCv2[1],QxMCv2[1])/2.;
4596 EvPlaneMCV2[2] = TMath::ATan2(QyMCv2[2],QxMCv2[2])/2.;
4597 fHResMA2->Fill(Double_t(iC), TMath::Cos(2*(EvPlaneMCV2[2]-EvPlaneMCV2[0])));
4598 fHResMC2->Fill(Double_t(iC), TMath::Cos(2*(EvPlaneMCV2[2]-EvPlaneMCV2[1])));
4599 fHResAC2->Fill(Double_t(iC), TMath::Cos(2*(EvPlaneMCV2[0]-EvPlaneMCV2[1])));
4600 fgPsi2v0aMC = EvPlaneMCV2[0];
4601 fgPsi2v0cMC = EvPlaneMCV2[1];
4602 fgPsi2tpcMC = EvPlaneMCV2[2];
4605 EvPlaneMCV3[0] = TMath::ATan2(QyMCv3[0],QxMCv3[0])/3.;
4606 EvPlaneMCV3[1] = TMath::ATan2(QyMCv3[1],QxMCv3[1])/3.;
4607 EvPlaneMCV3[2] = TMath::ATan2(QyMCv3[2],QxMCv3[2])/3.;
4608 fHResMA3->Fill(Double_t(iC), TMath::Cos(3*(EvPlaneMCV3[2]-EvPlaneMCV3[0])));
4609 fHResMC3->Fill(Double_t(iC), TMath::Cos(3*(EvPlaneMCV3[2]-EvPlaneMCV3[1])));
4610 fHResAC3->Fill(Double_t(iC), TMath::Cos(3*(EvPlaneMCV3[0]-EvPlaneMCV3[1])));
4611 fgPsi3v0aMC = EvPlaneMCV3[0];
4612 fgPsi3v0cMC = EvPlaneMCV3[1];
4613 fgPsi3tpcMC = EvPlaneMCV3[2];
4620 Int_t nAODTracks = event->GetNumberOfTracks();
4622 // TPC EP needed for resolution studies (TPC subevent)
4623 //AliEventplane * ep = (fAOD->GetHeader())->GetEventplaneP();
4624 //Double_t psiTPC = ep->GetEventplane("Q", fAOD, 2); // in range of [0, pi]
4625 Double_t Qx2 = 0, Qy2 = 0;
4626 Double_t Qx3 = 0, Qy3 = 0;
4628 for(Int_t iT = 0; iT < nAODTracks; iT++) {
4630 AliAODTrack* aodTrack = event->GetTrack(iT);
4636 Bool_t trkFlag = aodTrack->TestFilterBit(1);
4638 if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < fNcluster) || !trkFlag)
4641 Double_t b[2] = {-99., -99.};
4642 Double_t bCov[3] = {-99., -99., -99.};
4645 AliAODTrack param(*aodTrack);
4646 if (!param.PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov)){
4650 if ((TMath::Abs(b[0]) > 3.0) || (TMath::Abs(b[1]) > 2.4))
4653 Qx2 += TMath::Cos(2*aodTrack->Phi());
4654 Qy2 += TMath::Sin(2*aodTrack->Phi());
4655 Qx3 += TMath::Cos(3*aodTrack->Phi());
4656 Qy3 += TMath::Sin(3*aodTrack->Phi());
4660 Float_t evPlAng2 = TMath::ATan2(Qy2, Qx2)/2.;
4661 Float_t evPlAng3 = TMath::ATan2(Qy3, Qx3)/3.;
4663 fgPsi2tpc = evPlAng2;
4664 fgPsi3tpc = evPlAng3;
4666 fPhiRPTPC->Fill(iC,evPlAng2);
4667 fPhiRPTPCv3->Fill(iC,evPlAng3);
4672 AliAODVZERO* aodV0 = event->GetVZEROData();
4674 for (Int_t iv0 = 0; iv0 < 64; iv0++) {
4675 Double_t phiV0 = TMath::PiOver4()*(0.5 + iv0 % 8);
4676 Float_t multv0 = aodV0->GetMultiplicity(iv0);
4679 if(fAnalysisType == "AOD"){//not for reco MC tracks, only for real data
4680 if (iv0 < 32){ // V0C
4681 Qxc2 += TMath::Cos(2*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4682 Qyc2 += TMath::Sin(2*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4683 Qxc3 += TMath::Cos(3*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4684 Qyc3 += TMath::Sin(3*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4686 Qxa2 += TMath::Cos(2*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
4687 Qya2 += TMath::Sin(2*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
4688 Qxa3 += TMath::Cos(3*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
4689 Qya3 += TMath::Sin(3*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
4693 if (iv0 < 32){ // V0C
4694 Qxc2 += TMath::Cos(2*phiV0) * multv0;//*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4695 Qyc2 += TMath::Sin(2*phiV0) * multv0;//*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4696 Qxc3 += TMath::Cos(3*phiV0) * multv0;//*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4697 Qyc3 += TMath::Sin(3*phiV0) * multv0;//*fV0Cpol/fMultV0->GetBinContent(iv0+1);
4699 Qxa2 += TMath::Cos(2*phiV0) * multv0;//*fV0Apol/fMultV0->GetBinContent(iv0+1);
4700 Qya2 += TMath::Sin(2*phiV0) * multv0;//*fV0Apol/fMultV0->GetBinContent(iv0+1);
4701 Qxa3 += TMath::Cos(3*phiV0) * multv0;//*fV0Apol/fMultV0->GetBinContent(iv0+1);
4702 Qya3 += TMath::Sin(3*phiV0) * multv0;//*fV0Apol/fMultV0->GetBinContent(iv0+1);
4707 //grab for each centrality the proper histo with the Qx and Qy to do the recentering
4708 Double_t Qxamean2 = fMeanQ[iCcal][1][0];
4709 Double_t Qxarms2 = fWidthQ[iCcal][1][0];
4710 Double_t Qyamean2 = fMeanQ[iCcal][1][1];
4711 Double_t Qyarms2 = fWidthQ[iCcal][1][1];
4712 Double_t Qxamean3 = fMeanQv3[iCcal][1][0];
4713 Double_t Qxarms3 = fWidthQv3[iCcal][1][0];
4714 Double_t Qyamean3 = fMeanQv3[iCcal][1][1];
4715 Double_t Qyarms3 = fWidthQv3[iCcal][1][1];
4717 Double_t Qxcmean2 = fMeanQ[iCcal][0][0];
4718 Double_t Qxcrms2 = fWidthQ[iCcal][0][0];
4719 Double_t Qycmean2 = fMeanQ[iCcal][0][1];
4720 Double_t Qycrms2 = fWidthQ[iCcal][0][1];
4721 Double_t Qxcmean3 = fMeanQv3[iCcal][0][0];
4722 Double_t Qxcrms3 = fWidthQv3[iCcal][0][0];
4723 Double_t Qycmean3 = fMeanQv3[iCcal][0][1];
4724 Double_t Qycrms3 = fWidthQv3[iCcal][0][1];
4726 Double_t QxaCor2 = (Qxa2 - Qxamean2)/Qxarms2;
4727 Double_t QyaCor2 = (Qya2 - Qyamean2)/Qyarms2;
4728 Double_t QxcCor2 = (Qxc2 - Qxcmean2)/Qxcrms2;
4729 Double_t QycCor2 = (Qyc2 - Qycmean2)/Qycrms2;
4730 Double_t QxaCor3 = (Qxa3 - Qxamean3)/Qxarms3;
4731 Double_t QyaCor3 = (Qya3 - Qyamean3)/Qyarms3;
4732 Double_t QxcCor3 = (Qxc3 - Qxcmean3)/Qxcrms3;
4733 Double_t QycCor3 = (Qyc3 - Qycmean3)/Qycrms3;
4735 //to calculate 2nd order event plane with v0M
4736 Double_t QxCor2 = (Qxa2 - Qxamean2 + Qxc2 - Qxcmean2)
4737 /TMath::Sqrt(Qxarms2*Qxarms2 + Qxcrms2*Qxcrms2);
4738 Double_t QyCor2 = (Qya2 - Qyamean2 + Qyc2 - Qycmean2)
4739 /TMath::Sqrt(Qyarms2*Qyarms2 + Qycrms2*Qycrms2);
4741 //here the calculated event plane is within -Pi to +Pi(delete it , no use here , only for definition)
4742 Double_t psiV0A =(TMath::Pi() + TMath::ATan2(-QyaCor2, -QxaCor2))/2.;
4743 Double_t psiV0C = (TMath::Pi() + TMath::ATan2(-QycCor2, -QxcCor2))/2.;
4744 Double_t psiVZero = (TMath::Pi() + TMath::ATan2(-QyCor2, -QxCor2))/2.;
4748 Float_t evPlAngV0ACor2=999.;
4749 Float_t evPlAngV0CCor2=999.;
4750 Float_t evPlAngV0ACor3=999.;
4751 Float_t evPlAngV0CCor3=999.;
4754 if(fAnalysisType == "AOD"){
4755 evPlAngV0ACor2 = TMath::ATan2(QyaCor2, QxaCor2)/2.;
4756 evPlAngV0CCor2 = TMath::ATan2(QycCor2, QxcCor2)/2.;
4757 evPlAngV0ACor3 = TMath::ATan2(QyaCor3, QxaCor3)/3.;
4758 evPlAngV0CCor3 = TMath::ATan2(QycCor3, QxcCor3)/3.;
4761 evPlAngV0ACor2 = TMath::ATan2(Qya2, Qxa2)/2.;
4762 evPlAngV0CCor2 = TMath::ATan2(Qyc2, Qxc2)/2.;
4763 evPlAngV0ACor3 = TMath::ATan2(Qya3, Qxa3)/3.;
4764 evPlAngV0CCor3 = TMath::ATan2(Qyc3, Qxc3)/3.;
4768 AliEventplane *ep = event->GetEventplane();
4769 evPlAngV0ACor2 = ep->GetEventplane("V0A", event, 2);
4770 evPlAngV0CCor2 = ep->GetEventplane("V0C", event, 2);
4771 evPlAngV0ACor3 = ep->GetEventplane("V0A", event, 3);
4772 evPlAngV0CCor3 = ep->GetEventplane("V0C", event, 3);
4775 fgPsi2v0a = evPlAngV0ACor2;
4776 fgPsi2v0c = evPlAngV0CCor2;
4777 fgPsi3v0a = evPlAngV0ACor3;
4778 fgPsi3v0c = evPlAngV0CCor3;
4780 // Fill EP distribution histograms evPlAng
4782 fPhiRPv0A->Fill(iC,evPlAngV0ACor2);
4783 fPhiRPv0C->Fill(iC,evPlAngV0CCor2);
4785 fPhiRPv0Av3->Fill(iC,evPlAngV0ACor3);
4786 fPhiRPv0Cv3->Fill(iC,evPlAngV0CCor3);
4788 // Fill histograms needed for resolution evaluation
4789 fHResTPCv0A2->Fill(Double_t(iC), TMath::Cos(2*(evPlAng2 - evPlAngV0ACor2)));
4790 fHResTPCv0C2->Fill(Double_t(iC), TMath::Cos(2*(evPlAng2 - evPlAngV0CCor2)));
4791 fHResv0Cv0A2->Fill(Double_t(iC), TMath::Cos(2*(evPlAngV0ACor2 - evPlAngV0CCor2)));
4793 fHResTPCv0A3->Fill(Double_t(iC), TMath::Cos(3*(evPlAng3 - evPlAngV0ACor3)));
4794 fHResTPCv0C3->Fill(Double_t(iC), TMath::Cos(3*(evPlAng3 - evPlAngV0CCor3)));
4795 fHResv0Cv0A3->Fill(Double_t(iC), TMath::Cos(3*(evPlAngV0ACor3 - evPlAngV0CCor3)));
4799 Float_t gVZEROEventPlane = -10.;
4800 Float_t gReactionPlane = -10.;
4801 Double_t qxTot = 0.0, qyTot = 0.0;
4803 AliEventplane *ep = event->GetEventplane();
4805 gVZEROEventPlane = ep->CalculateVZEROEventPlane(event,10,2,qxTot,qyTot);
4806 if(gVZEROEventPlane < 0.) gVZEROEventPlane += TMath::Pi();
4807 //gReactionPlane = gVZEROEventPlane*TMath::RadToDeg();
4808 gReactionPlane = gVZEROEventPlane;
4812 //return gReactionPlane;
4814 //make the final 2nd order event plane within 0 to Pi
4815 //using data and reco tracks only
4816 if(fgPsi2v0a!=999. && fgPsi2v0a < 0.) fgPsi2v0a += TMath::Pi();
4817 if(fgPsi2v0c!=999. && fgPsi2v0c < 0.) fgPsi2v0c += TMath::Pi();
4818 if(fgPsi2tpc!=999. && fgPsi2tpc < 0.) fgPsi2tpc += TMath::Pi();
4819 //using truth tracks only
4820 if(evplaneMC!=999. && evplaneMC < 0.) evplaneMC += TMath::Pi();
4821 if(fgPsi2v0aMC!=999. && fgPsi2v0aMC < 0.) fgPsi2v0aMC += TMath::Pi();
4822 if(fgPsi2v0cMC!=999. && fgPsi2v0cMC < 0.) fgPsi2v0cMC += TMath::Pi();
4823 if(fgPsi2tpcMC!=999. && fgPsi2tpcMC < 0.) fgPsi2tpcMC += TMath::Pi();
4824 //for the time being leave the 3rd order event planes within -pi/3 t0 +pi/3
4826 if(truth){//for truth MC
4827 if(fV2 && fEPdet=="header")gReactionPlane=evplaneMC;
4828 if(fV2 && fEPdet=="V0A")gReactionPlane=fgPsi2v0aMC;
4829 if(fV2 && fEPdet=="V0C")gReactionPlane=fgPsi2v0cMC;
4830 if(fV2 && fEPdet=="TPC")gReactionPlane=fgPsi2tpcMC;
4832 if(fV3 && fEPdet=="V0A")gReactionPlane=fgPsi3v0aMC;
4833 if(fV3 && fEPdet=="V0C")gReactionPlane=fgPsi3v0cMC;
4834 if(fV3 && fEPdet=="TPC")gReactionPlane=fgPsi3tpcMC;
4836 else{//for data and recoMC
4837 if(fV2 && fEPdet=="V0A")gReactionPlane=fgPsi2v0a;
4838 if(fV2 && fEPdet=="V0C")gReactionPlane=fgPsi2v0c;
4839 if(fV2 && fEPdet=="TPC")gReactionPlane=fgPsi2tpc;
4841 if(fV3 && fEPdet=="V0A")gReactionPlane=fgPsi3v0a;
4842 if(fV3 && fEPdet=="V0C")gReactionPlane=fgPsi3v0c;
4843 if(fV3 && fEPdet=="TPC")gReactionPlane=fgPsi3tpc;
4847 } //centrality cut condition
4849 return gReactionPlane;
4851 //------------------------------------------------------------------------------------------------------------------
4852 void AliTwoParticlePIDCorr::OpenInfoCalbration(Int_t run){
4853 TString oadbfilename = "$ALICE_ROOT/OADB/PWGCF/VZERO/VZEROcalibEP.root";
4854 TFile *foadb = TFile::Open(oadbfilename.Data());
4857 printf("OADB file %s cannot be opened\n",oadbfilename.Data());
4861 AliOADBContainer *cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorr");
4863 printf("OADB object hMultV0BefCorr is not available in the file\n");
4867 if(!(cont->GetObject(run))){
4868 printf("OADB object hMultV0BefCorr is not available for run %i (used run 137366)\n",run);
4871 fMultV0 = ((TH2F *) cont->GetObject(run))->ProfileX();
4873 TF1 *fpol0 = new TF1("fpol0","pol0");
4874 fMultV0->Fit(fpol0,"","",0,31);
4875 fV0Cpol = fpol0->GetParameter(0);
4876 fMultV0->Fit(fpol0,"","",32,64);
4877 fV0Apol = fpol0->GetParameter(0);
4879 for(Int_t iside=0;iside<2;iside++){
4880 for(Int_t icoord=0;icoord<2;icoord++){
4881 for(Int_t i=0;i < 9;i++){
4883 if(iside==0 && icoord==0)
4884 snprintf(namecont,100,"hQxc2_%i",i);
4885 else if(iside==1 && icoord==0)
4886 snprintf(namecont,100,"hQxa2_%i",i);
4887 else if(iside==0 && icoord==1)
4888 snprintf(namecont,100,"hQyc2_%i",i);
4889 else if(iside==1 && icoord==1)
4890 snprintf(namecont,100,"hQya2_%i",i);
4892 cont = (AliOADBContainer*) foadb->Get(namecont);
4894 printf("OADB object %s is not available in the file\n",namecont);
4898 if(!(cont->GetObject(run))){
4899 printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
4902 fMeanQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
4903 fWidthQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
4906 if(iside==0 && icoord==0)
4907 snprintf(namecont,100,"hQxc3_%i",i);
4908 else if(iside==1 && icoord==0)
4909 snprintf(namecont,100,"hQxa3_%i",i);
4910 else if(iside==0 && icoord==1)
4911 snprintf(namecont,100,"hQyc3_%i",i);
4912 else if(iside==1 && icoord==1)
4913 snprintf(namecont,100,"hQya3_%i",i);
4915 cont = (AliOADBContainer*) foadb->Get(namecont);
4917 printf("OADB object %s is not available in the file\n",namecont);
4921 if(!(cont->GetObject(run))){
4922 printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
4925 fMeanQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
4926 fWidthQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
4932 //____________________________________________________________________
4933 void AliTwoParticlePIDCorr::FillPIDEventPlane(Double_t centrality,Int_t par,Float_t trigphi,Float_t fReactionPlane)
4936 // Event plane (determine psi bin)
4937 Double_t gPsiMinusPhi = 0.;
4938 Double_t gPsiMinusPhiBin = -10.;
4939 if(fRequestEventPlane){
4940 gPsiMinusPhi = TMath::Abs(trigphi - fReactionPlane);
4942 if((gPsiMinusPhi <= 7.5*TMath::DegToRad())||
4943 (gPsiMinusPhi >= 352.5*TMath::DegToRad())||
4944 ((172.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 187.5*TMath::DegToRad())))
4945 gPsiMinusPhiBin = 0.0;
4947 else if(((37.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 52.5*TMath::DegToRad()))||
4948 ((127.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 142.5*TMath::DegToRad()))||
4949 ((217.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 232.5*TMath::DegToRad()))||
4950 ((307.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 322.5*TMath::DegToRad())))
4951 gPsiMinusPhiBin = 1.0;
4953 else if(((82.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 97.5*TMath::DegToRad()))||
4954 ((262.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 277.5*TMath::DegToRad())))
4955 gPsiMinusPhiBin = 2.0;
4958 gPsiMinusPhiBin = 3.0;
4960 fEventPlanePID->Fill(centrality,gPsiMinusPhiBin,(Float_t)par);
4964 //----------------------------------------------------------
4965 void AliTwoParticlePIDCorr::Terminate(Option_t *)
4967 // Draw result to screen, or perform fitting, normalizations
4968 // Called once at the end of the query
4969 fOutput = dynamic_cast<TList*> (GetOutputData(1));
4970 if(!fOutput) { Printf("ERROR: could not retrieve TList fOutput"); return; }
4974 //------------------------------------------------------------------