-\r
-Bool_t AddTrackCutsLHC10bcde(AliAnalysisTaskESDfilter* esdFilter);\r
-Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdFilter);\r
-Bool_t AddTrackCutsLHC11h(AliAnalysisTaskESDfilter* esdFilter);\r
-Bool_t enableTPCOnlyAODTracksLocalFlag=kFALSE;\r
-\r
-\r
-AliAnalysisTaskESDfilter *AddTaskESDFilter(Bool_t useKineFilter=kTRUE, \r
- Bool_t writeMuonAOD=kFALSE,\r
- Bool_t writeDimuonAOD=kFALSE,\r
- Bool_t usePhysicsSelection=kFALSE,\r
- Bool_t useCentralityTask=kFALSE, /*obsolete*/\r
- Bool_t enableTPCOnlyAODTracks=kFALSE,\r
- Bool_t disableCascades=kFALSE,\r
- Bool_t disableKinks=kFALSE, \r
- Int_t runFlag = 1100,\r
- Int_t muonMCMode = 2, \r
- Bool_t useV0Filter=kTRUE)\r
-{\r
- // Creates a filter task and adds it to the analysis manager.\r
- // Get the pointer to the existing analysis manager via the static access method.\r
- //==============================================================================\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- ::Error("AddTaskESDFilter", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
- \r
- // This task requires an ESD input handler and an AOD output handler.\r
- // Check this using the analysis manager.\r
- //===============================================================================\r
- TString type = mgr->GetInputEventHandler()->GetDataType();\r
- if (!type.Contains("ESD")) {\r
- ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler.");\r
- return NULL;\r
- } \r
- // Check if AOD output handler exist.\r
- AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();\r
- if (!aod_h) {\r
- ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler.");\r
- return NULL;\r
- }\r
- // Check if MC handler is connected in case kine filter requested\r
- AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();\r
- if (!mcH && useKineFilter) {\r
- ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested");\r
- return NULL;\r
- } \r
- \r
- // Create the task, add it to the manager and configure it.\r
- //=========================================================================== \r
- // Barrel tracks filter\r
- AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");\r
- if (disableCascades) esdfilter->DisableCascades();\r
- if (disableKinks) esdfilter->DisableKinks();\r
- \r
- mgr->AddTask(esdfilter);\r
- \r
- // Muons\r
- Bool_t onlyMuon=kTRUE;\r
- Bool_t keepAllEvents=kTRUE;\r
- Int_t mcMode= useKineFilter ? muonMCMode : 0; // use 1 instead of 2 to get all MC information instead of just ancestors of mu tracks\r
- AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter",onlyMuon,keepAllEvents,mcMode);\r
- mgr->AddTask(esdmuonfilter);\r
- if(usePhysicsSelection){\r
- esdfilter->SelectCollisionCandidates(AliVEvent::kAny);\r
- esdmuonfilter->SelectCollisionCandidates(AliVEvent::kAny);\r
- } \r
-\r
- // Filtering of MC particles (decays conversions etc)\r
- // this task has to go AFTER all other filter tasks\r
- // since it fills the AODMC array with all\r
- // selected MC Particles, only this way we have the \r
- // AODMCparticle information available for following tasks\r
- AliAnalysisTaskMCParticleFilter *kinefilter = 0;\r
- if (useKineFilter) {\r
- kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter");\r
- mgr->AddTask(kinefilter);\r
- } \r
-\r
- enableTPCOnlyAODTracksLocalFlag = enableTPCOnlyAODTracks;\r
- if((runFlag/100)==10){\r
- if((runFlag%100)==0) AddTrackCutsLHC10bcde(esdfilter);\r
- else AddTrackCutsLHC10h(esdfilter);\r
- }\r
- else {\r
- // default 11h\r
- AddTrackCutsLHC11h(esdfilter);\r
- }\r
-\r
- // Filter with cuts on V0s\r
- if (useV0Filter) {\r
- AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts");\r
- esdV0Cuts->SetMinRadius(0.2);\r
- esdV0Cuts->SetMaxRadius(200);\r
- esdV0Cuts->SetMinDcaPosToVertex(0.05);\r
- esdV0Cuts->SetMinDcaNegToVertex(0.05);\r
- esdV0Cuts->SetMaxDcaV0Daughters(1.5);\r
- esdV0Cuts->SetMinCosinePointingAngle(0.99);\r
- AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");\r
- v0Filter->AddCuts(esdV0Cuts);\r
-\r
- esdfilter->SetV0Filter(v0Filter);\r
- } \r
-\r
- // Enable writing of Muon AODs\r
- esdmuonfilter->SetWriteMuonAOD(writeMuonAOD);\r
- \r
- // Enable writing of Dimuon AODs\r
- esdmuonfilter->SetWriteDimuonAOD(writeDimuonAOD);\r
- \r
- // Create ONLY the output containers for the data produced by the task.\r
- // Get and connect other common input/output containers via the manager as below\r
- //==============================================================================\r
- mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer());\r
- mgr->ConnectInput (esdmuonfilter, 0, mgr->GetCommonInputContainer());\r
- if (useKineFilter) {\r
- mgr->ConnectInput (kinefilter, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput (kinefilter, 0, mgr->GetCommonOutputContainer());\r
- AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(),\r
- AliAnalysisManager::kOutputContainer,"pyxsec_hists.root");\r
- mgr->ConnectOutput (kinefilter, 1,coutputEx);\r
- } \r
- return esdfilter;\r
-}\r
- \r
-\r
-\r
-\r
-Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdfilter){\r
-\r
- Printf("%s%d: Creating Track Cuts for LHC10h",(char*)__FILE__,__LINE__);\r
-\r
- // Cuts on primary tracks\r
- AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
- \r
- // ITS stand-alone tracks\r
- AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");\r
- esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);\r
- \r
- // Pixel OR necessary for the electrons\r
- AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");\r
- itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
- \r
- \r
- // PID for the electrons\r
- AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");\r
- electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.5);\r
- \r
- // tighter cuts on primary particles for high pT tracks\r
- // take the standard cuts, which include already \r
- // ITSrefit and use only primaries...\r
- \r
- // ITS cuts for new jet analysis \r
- // gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");\r
- // AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWGJE(10001006);\r
-\r
- AliESDtrackCuts *jetCuts1006 = new AliESDtrackCuts("AliESDtrackCuts"); \r
-\r
- TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");\r
- jetCuts1006->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);\r
- jetCuts1006->SetMinNClustersTPC(70);\r
- jetCuts1006->SetMaxChi2PerClusterTPC(4);\r
- jetCuts1006->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1\r
- jetCuts1006->SetAcceptKinkDaughters(kFALSE);\r
- jetCuts1006->SetRequireTPCRefit(kTRUE);\r
- jetCuts1006->SetMaxFractionSharedTPCClusters(0.4);\r
- // ITS\r
- jetCuts1006->SetRequireITSRefit(kTRUE);\r
- //accept secondaries\r
- jetCuts1006->SetMaxDCAToVertexXY(2.4);\r
- jetCuts1006->SetMaxDCAToVertexZ(3.2);\r
- jetCuts1006->SetDCAToVertex2D(kTRUE);\r
- //reject fakes\r
- jetCuts1006->SetMaxChi2PerClusterITS(36);\r
- jetCuts1006->SetMaxChi2TPCConstrainedGlobal(36);\r
-\r
- jetCuts1006->SetRequireSigmaToVertex(kFALSE);\r
-\r
- jetCuts1006->SetEtaRange(-0.9,0.9);\r
- jetCuts1006->SetPtRange(0.15, 1E+15.);\r
-\r
- AliESDtrackCuts* esdTrackCutsHG0 = jetCuts1006->Clone("JetCuts10001006");\r
- esdTrackCutsHG0->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
-\r
-\r
- // throw out tracks with too low number of clusters in\r
- // the first pass (be consistent with TPC only tracks)\r
- // N.B. the number off crossed rows still acts on the tracks after\r
- // all iterations if we require tpc standalone, number of clusters\r
- // and chi2 TPC cuts act on track after the first iteration\r
- // esdTrackCutsH0->SetRequireTPCStandAlone(kTRUE);\r
- // esdTrackCutsH0->SetMinNClustersTPC(80); // <--- first pass\r
- \r
- \r
- // the complement to the one with SPD requirement\r
- // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);\r
- AliESDtrackCuts* esdTrackCutsHG1 = jetCuts1006->Clone("JetCuts10011006");\r
- esdTrackCutsHG1->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);\r
-\r
- // the tracks that must not be taken pass this cut and\r
- // non HGC1 and HG\r
- // AliESDtrackCuts* esdTrackCutsHG2 = CreateTrackCutsPWGJE(10021006);\r
- AliESDtrackCuts* esdTrackCutsHG2 = jetCuts1006->Clone("JetCuts10021006");\r
- esdTrackCutsHG2->SetMaxChi2PerClusterITS(1E10);\r
-\r
-\r
- // standard cuts also used in R_AA analysis\r
- // "Global track RAA analysis QM2011 + Chi2ITS<36";\r
- // AliESDtrackCuts* esdTrackCutsH2 = CreateTrackCutsPWGJE(1000);\r
- AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);\r
- esdTrackCutsH2->SetMinNCrossedRowsTPC(120);\r
- esdTrackCutsH2->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);\r
- esdTrackCutsH2->SetMaxChi2PerClusterITS(36);\r
- esdTrackCutsH2->SetMaxFractionSharedTPCClusters(0.4);\r
- esdTrackCutsH2->SetMaxChi2TPCConstrainedGlobal(36);\r
-\r
- esdTrackCutsH2->SetEtaRange(-0.9,0.9);\r
- esdTrackCutsH2->SetPtRange(0.15, 1e10);\r
-\r
-\r
- // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);\r
- AliESDtrackCuts* esdTrackCutsGCOnly = jetCuts1006->Clone("JetCuts10041006");\r
- esdTrackCutsGCOnly->SetRequireITSRefit(kFALSE);\r
-\r
- // TPC only tracks\r
- AliESDtrackCuts* esdTrackCutsTPCCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
- esdTrackCutsTPCCOnly->SetMinNClustersTPC(70);\r
- \r
- // Compose the filter\r
- AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");\r
- // 1, 1<<0\r
- trackFilter->AddCuts(esdTrackCutsL);\r
- // 2 1<<1\r
- trackFilter->AddCuts(esdTrackCutsITSsa);\r
- // 4 1<<2\r
- trackFilter->AddCuts(itsStrong);\r
- itsStrong->SetFilterMask(1); // AND with Standard track cuts \r
- // 8 1<<3\r
- trackFilter->AddCuts(electronID);\r
- electronID->SetFilterMask(4); // AND with Pixel Cuts\r
- // 16 1<<4\r
- trackFilter->AddCuts(esdTrackCutsHG0);\r
- // 32 1<<5\r
- trackFilter->AddCuts(esdTrackCutsHG1);\r
- // 64 1<<6\r
- trackFilter->AddCuts(esdTrackCutsHG2);\r
- // 128 1<<7\r
- trackFilter->AddCuts(esdTrackCutsTPCCOnly); // add QM TPC only track cuts\r
- if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128);\r
- // 256 1<<8\r
- trackFilter->AddCuts(esdTrackCutsGCOnly);\r
- // 512 1<<9 \r
- AliESDtrackCuts* esdTrackCutsHG1_tmp = new AliESDtrackCuts(*esdTrackCutsHG1); // avoid double delete\r
- trackFilter->AddCuts(esdTrackCutsHG1_tmp); // add once more for tpc only tracks\r
- // 1024 1<<10 \r
- trackFilter->AddCuts(esdTrackCutsH2); // add r_aa cuts\r
-\r
- \r
- \r
- esdfilter->SetGlobalConstrainedFilterMask(1<<8|1<<9); // these tracks are written out as global constrained tracks\r
- esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<4)); // these normal global tracks will be marked as hybrid\r
- esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement\r
- // esdfilter->SetTPCConstrainedFilterMask(1<<11); // these tracks are written out as tpc constrained tracks\r
-\r
- esdfilter->SetTrackFilter(trackFilter);\r
- return kTRUE;\r
- \r
-}\r
-\r
-\r
-Bool_t AddTrackCutsLHC11h(AliAnalysisTaskESDfilter* esdfilter){\r
-\r
-\r
- Printf("%s%d: Creating Track Cuts LHC11h",(char*)__FILE__,__LINE__);\r
-\r
- // Cuts on primary tracks\r
- AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
-\r
- // ITS stand-alone tracks\r
- AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");\r
- esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);\r
-\r
- // Pixel OR necessary for the electrons\r
- AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");\r
- itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
-\r
-\r
- // PID for the electrons\r
- AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");\r
- electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.5);\r
-\r
- // standard cuts with very loose DCA\r
- AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE); \r
- esdTrackCutsH->SetMaxDCAToVertexXY(2.4);\r
- esdTrackCutsH->SetMaxDCAToVertexZ(3.2);\r
- esdTrackCutsH->SetDCAToVertex2D(kTRUE);\r
-\r
- // standard cuts with tight DCA cut\r
- AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();\r
-\r
- // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster\r
- // tracks selected by this cut are exclusive to those selected by the previous cut\r
- AliESDtrackCuts* esdTrackCutsH3 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(); \r
- esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);\r
- esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst);\r
- \r
- // TPC only tracks: Optionally enable the writing of TPConly information\r
- // constrained to SPD vertex in the filter below\r
- AliESDtrackCuts* esdTrackCutsTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
- // The following line is needed for 2010 PbPb reprocessing and pp, but not for 2011 PbPb\r
- //esdTrackCutsTPCOnly->SetMinNClustersTPC(70);\r
-\r
- // Extra cuts for hybrids\r
- // first the global tracks we want to take\r
- AliESDtrackCuts* esdTrackCutsHTG = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE); \r
- esdTrackCutsHTG->SetName("Global Hybrid tracks, loose DCA");\r
- esdTrackCutsHTG->SetMaxDCAToVertexXY(2.4);\r
- esdTrackCutsHTG->SetMaxDCAToVertexZ(3.2);\r
- esdTrackCutsHTG->SetDCAToVertex2D(kTRUE);\r
- esdTrackCutsHTG->SetMaxChi2TPCConstrainedGlobal(36);\r
- esdTrackCutsHTG->SetMaxFractionSharedTPCClusters(0.4);\r
- \r
-\r
- // Than the complementary tracks which will be stored as global\r
- // constraint, complement is done in the ESDFilter task\r
- AliESDtrackCuts* esdTrackCutsHTGC = new AliESDtrackCuts(*esdTrackCutsHTG);\r
- esdTrackCutsHTGC->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement");\r
- esdTrackCutsHTGC->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);\r
- esdTrackCutsHTGC->SetRequireITSRefit(kTRUE);\r
-\r
- // standard cuts with tight DCA cut, using cluster cut instead of crossed rows (a la 2010 default)\r
- AliESDtrackCuts* esdTrackCutsH2Cluster = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE, 0);\r
-\r
- // Compose the filter\r
- AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");\r
- // 1, 1<<0\r
- trackFilter->AddCuts(esdTrackCutsL);\r
- // 2, 1<<1\r
- trackFilter->AddCuts(esdTrackCutsITSsa);\r
- // 4, 1<<2\r
- trackFilter->AddCuts(itsStrong);\r
- itsStrong->SetFilterMask(1); // AND with Standard track cuts \r
- // 8, 1<<3\r
- trackFilter->AddCuts(electronID);\r
- electronID->SetFilterMask(4); // AND with Pixel Cuts\r
- // 16, 1<<4\r
- trackFilter->AddCuts(esdTrackCutsH);\r
- // 32, 1<<5\r
- trackFilter->AddCuts(esdTrackCutsH2);\r
- // 64, 1<<6\r
- trackFilter->AddCuts(esdTrackCutsH3);\r
- // 128 , 1 << 7\r
- trackFilter->AddCuts(esdTrackCutsTPCOnly);\r
- if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128);\r
- // 256, 1 << 8 Global Hybrids\r
- trackFilter->AddCuts(esdTrackCutsHTG);\r
- esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<8)); // these normal global tracks will be marked as hybrid \r
- // 512, 1<< 9 GlobalConstraint Hybrids\r
- trackFilter->AddCuts(esdTrackCutsHTGC);\r
- esdfilter->SetGlobalConstrainedFilterMask(1<<9); // these tracks are written out as global constrained tracks \r
- esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement\r
- // 1024, 1<< 10 // tight DCA cuts\r
- trackFilter->AddCuts(esdTrackCutsH2Cluster);\r
- esdfilter->SetTrackFilter(trackFilter);\r
-\r
- return kTRUE;\r
-\r
-}\r
-\r
-Bool_t AddTrackCutsLHC10bcde(AliAnalysisTaskESDfilter* esdfilter){\r
-\r
-\r
- Printf("%s%d: Creating Track Cuts LHC10bcde",(char*)__FILE__,__LINE__);\r
-\r
- // Cuts on primary tracks\r
- AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
-\r
- // ITS stand-alone tracks\r
- AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");\r
- esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);\r
-\r
- // Pixel OR necessary for the electrons\r
- AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");\r
- itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
-\r
-\r
- // PID for the electrons\r
- AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");\r
- electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.5);\r
-\r
- // standard cuts with very loose DCA\r
- AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE); \r
- esdTrackCutsH->SetMaxDCAToVertexXY(2.4);\r
- esdTrackCutsH->SetMaxDCAToVertexZ(3.2);\r
- esdTrackCutsH->SetDCAToVertex2D(kTRUE);\r
-\r
- // standard cuts with tight DCA cut\r
- AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();\r
-\r
- // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster\r
- // tracks selected by this cut are exclusive to those selected by the previous cut\r
- AliESDtrackCuts* esdTrackCutsH3 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); \r
- esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);\r
- esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst);\r
- \r
- // TPC only tracks: Optionally enable the writing of TPConly information\r
- // constrained to SPD vertex in the filter below\r
- AliESDtrackCuts* esdTrackCutsTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
- // The following line is needed for 2010 PbPb reprocessing and pp, but not for 2011 PbPb\r
- esdTrackCutsTPCOnly->SetMinNClustersTPC(70);\r
-\r
- // Extra cuts for hybrids\r
- // first the global tracks we want to take\r
- // take the HTGs from 10h\r
-\r
- // gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");\r
- // AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWGJE(10001006);\r
-\r
- AliESDtrackCuts *jetCuts1006 = new AliESDtrackCuts("AliESDtrackCuts"); \r
-\r
- TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");\r
- jetCuts1006->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);\r
- jetCuts1006->SetMinNClustersTPC(70);\r
- jetCuts1006->SetMaxChi2PerClusterTPC(4);\r
- jetCuts1006->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1\r
- jetCuts1006->SetAcceptKinkDaughters(kFALSE);\r
- jetCuts1006->SetRequireTPCRefit(kTRUE);\r
- jetCuts1006->SetMaxFractionSharedTPCClusters(0.4);\r
- // ITS\r
- jetCuts1006->SetRequireITSRefit(kTRUE);\r
- //accept secondaries\r
- jetCuts1006->SetMaxDCAToVertexXY(2.4);\r
- jetCuts1006->SetMaxDCAToVertexZ(3.2);\r
- jetCuts1006->SetDCAToVertex2D(kTRUE);\r
- //reject fakes\r
- jetCuts1006->SetMaxChi2PerClusterITS(36);\r
- jetCuts1006->SetMaxChi2TPCConstrainedGlobal(36);\r
-\r
- jetCuts1006->SetRequireSigmaToVertex(kFALSE);\r
- \r
- jetCuts1006->SetEtaRange(-0.9,0.9);\r
- jetCuts1006->SetPtRange(0.15, 1E+15.);\r
- \r
- AliESDtrackCuts* esdTrackCutsHTG = jetCuts1006->Clone("JetCuts10001006");\r
- esdTrackCutsHTG->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
-\r
- // Than the complementary tracks which will be stored as global\r
- // constraint, complement is done in the ESDFilter task\r
- // HGC from 10h\r
-\r
- AliESDtrackCuts* esdTrackCutsHTGC = jetCuts1006->Clone("JetCuts10041006");\r
- esdTrackCutsHTGC->SetRequireITSRefit(kFALSE);\r
-\r
- // standard cuts with tight DCA cut, using cluster cut instead of crossed rows (a la 2010 default)\r
- AliESDtrackCuts* esdTrackCutsH2Cluster = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE, 0);\r
-\r
- // Compose the filter\r
- AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");\r
- // 1, 1<<0\r
- trackFilter->AddCuts(esdTrackCutsL);\r
- // 2, 1<<1\r
- trackFilter->AddCuts(esdTrackCutsITSsa);\r
- // 4, 1<<2\r
- trackFilter->AddCuts(itsStrong);\r
- itsStrong->SetFilterMask(1); // AND with Standard track cuts \r
- // 8, 1<<3\r
- trackFilter->AddCuts(electronID);\r
- electronID->SetFilterMask(4); // AND with Pixel Cuts\r
- // 16, 1<<4\r
- trackFilter->AddCuts(esdTrackCutsH);\r
- // 32, 1<<5\r
- trackFilter->AddCuts(esdTrackCutsH2);\r
- // 64, 1<<6\r
- trackFilter->AddCuts(esdTrackCutsH3);\r
- // 128 , 1 << 7\r
- trackFilter->AddCuts(esdTrackCutsTPCOnly);\r
- if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128);\r
- // 256, 1 << 8 Global Hybrids\r
- trackFilter->AddCuts(esdTrackCutsHTG);\r
- esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<8)); // these normal global tracks will be marked as hybrid \r
- // 512, 1<< 9 GlobalConstraint Hybrids\r
- trackFilter->AddCuts(esdTrackCutsHTGC);\r
- esdfilter->SetGlobalConstrainedFilterMask(1<<9); // these tracks are written out as global constrained tracks \r
- esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement\r
- // 1024, 1<< 10 // tight DCA cuts\r
- trackFilter->AddCuts(esdTrackCutsH2Cluster);\r
- esdfilter->SetTrackFilter(trackFilter);\r
-\r
- return kTRUE;\r
-\r
-}\r
+
+Bool_t AddTrackCutsLHC10bcde(AliAnalysisTaskESDfilter* esdFilter);
+Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdFilter);
+Bool_t AddTrackCutsLHC11h(AliAnalysisTaskESDfilter* esdFilter);
+Bool_t enableTPCOnlyAODTracksLocalFlag=kFALSE;
+
+
+AliAnalysisTaskESDfilter *AddTaskESDFilter(Bool_t useKineFilter=kTRUE,
+ Bool_t writeMuonAOD=kFALSE,
+ Bool_t writeDimuonAOD=kFALSE,
+ Bool_t usePhysicsSelection=kFALSE,
+ Bool_t useCentralityTask=kFALSE, /*obsolete*/
+ Bool_t enableTPCOnlyAODTracks=kFALSE,
+ Bool_t disableCascades=kFALSE,
+ Bool_t disableKinks=kFALSE,
+ Int_t runFlag = 1100,
+ Int_t muonMCMode = 2,
+ Bool_t useV0Filter=kTRUE)
+{
+ // Creates a filter task and adds it to the analysis manager.
+ // Get the pointer to the existing analysis manager via the static access method.
+ //==============================================================================
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error("AddTaskESDFilter", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // This task requires an ESD input handler and an AOD output handler.
+ // Check this using the analysis manager.
+ //===============================================================================
+ TString type = mgr->GetInputEventHandler()->GetDataType();
+ if (!type.Contains("ESD")) {
+ ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler.");
+ return NULL;
+ }
+ // Check if AOD output handler exist.
+ AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
+ if (!aod_h) {
+ ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler.");
+ return NULL;
+ }
+ // Check if MC handler is connected in case kine filter requested
+ AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
+ if (!mcH && useKineFilter) {
+ ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested");
+ return NULL;
+ }
+
+ // Create the task, add it to the manager and configure it.
+ //===========================================================================
+ // Barrel tracks filter
+ AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
+ if (disableCascades) esdfilter->DisableCascades();
+ if (disableKinks) esdfilter->DisableKinks();
+
+ mgr->AddTask(esdfilter);
+
+ // Muons
+ Bool_t onlyMuon=kTRUE;
+ Bool_t keepAllEvents=kTRUE;
+ Int_t mcMode= useKineFilter ? muonMCMode : 0; // use 1 instead of 2 to get all MC information instead of just ancestors of mu tracks
+ AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter",onlyMuon,keepAllEvents,mcMode);
+ mgr->AddTask(esdmuonfilter);
+ if(usePhysicsSelection){
+ esdfilter->SelectCollisionCandidates(AliVEvent::kAny);
+ esdmuonfilter->SelectCollisionCandidates(AliVEvent::kAny);
+ }
+
+ // Filtering of MC particles (decays conversions etc)
+ // this task has to go AFTER all other filter tasks
+ // since it fills the AODMC array with all
+ // selected MC Particles, only this way we have the
+ // AODMCparticle information available for following tasks
+ AliAnalysisTaskMCParticleFilter *kinefilter = 0;
+ if (useKineFilter) {
+ kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter");
+ mgr->AddTask(kinefilter);
+ }
+
+ enableTPCOnlyAODTracksLocalFlag = enableTPCOnlyAODTracks;
+ if((runFlag/100)==10){
+ if((runFlag%100)==0) AddTrackCutsLHC10bcde(esdfilter);
+ else AddTrackCutsLHC10h(esdfilter);
+ }
+ else {
+ // default 11h
+ AddTrackCutsLHC11h(esdfilter);
+ }
+
+ // Filter with cuts on V0s
+ if (useV0Filter) {
+ AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts");
+ esdV0Cuts->SetMinRadius(0.2);
+ esdV0Cuts->SetMaxRadius(200);
+ esdV0Cuts->SetMinDcaPosToVertex(0.05);
+ esdV0Cuts->SetMinDcaNegToVertex(0.05);
+ esdV0Cuts->SetMaxDcaV0Daughters(1.5);
+ esdV0Cuts->SetMinCosinePointingAngle(0.99);
+ AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");
+ v0Filter->AddCuts(esdV0Cuts);
+
+ esdfilter->SetV0Filter(v0Filter);
+ }
+
+ // Enable writing of Muon AODs
+ esdmuonfilter->SetWriteMuonAOD(writeMuonAOD);
+
+ // Enable writing of Dimuon AODs
+ esdmuonfilter->SetWriteDimuonAOD(writeDimuonAOD);
+
+ // Create ONLY the output containers for the data produced by the task.
+ // Get and connect other common input/output containers via the manager as below
+ //==============================================================================
+ mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer());
+ mgr->ConnectInput (esdmuonfilter, 0, mgr->GetCommonInputContainer());
+ if (useKineFilter) {
+ mgr->ConnectInput (kinefilter, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput (kinefilter, 0, mgr->GetCommonOutputContainer());
+ AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(),
+ AliAnalysisManager::kOutputContainer,"pyxsec_hists.root");
+ mgr->ConnectOutput (kinefilter, 1,coutputEx);
+ }
+ return esdfilter;
+}
+
+
+
+
+Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdfilter){
+
+ Printf("%s%d: Creating Track Cuts for LHC10h",(char*)__FILE__,__LINE__);
+
+ // Cuts on primary tracks
+ AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+
+ // ITS stand-alone tracks
+ AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");
+ esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
+
+ // Pixel OR necessary for the electrons
+ AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");
+ itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+
+
+ // PID for the electrons
+ AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");
+ electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.5);
+
+ // tighter cuts on primary particles for high pT tracks
+ // take the standard cuts, which include already
+ // ITSrefit and use only primaries...
+
+ // ITS cuts for new jet analysis
+ // gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
+ // AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWGJE(10001006);
+
+ AliESDtrackCuts *jetCuts1006 = new AliESDtrackCuts("AliESDtrackCuts");
+
+ TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
+ jetCuts1006->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
+ jetCuts1006->SetMinNClustersTPC(70);
+ jetCuts1006->SetMaxChi2PerClusterTPC(4);
+ jetCuts1006->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
+ jetCuts1006->SetAcceptKinkDaughters(kFALSE);
+ jetCuts1006->SetRequireTPCRefit(kTRUE);
+ jetCuts1006->SetMaxFractionSharedTPCClusters(0.4);
+ // ITS
+ jetCuts1006->SetRequireITSRefit(kTRUE);
+ //accept secondaries
+ jetCuts1006->SetMaxDCAToVertexXY(2.4);
+ jetCuts1006->SetMaxDCAToVertexZ(3.2);
+ jetCuts1006->SetDCAToVertex2D(kTRUE);
+ //reject fakes
+ jetCuts1006->SetMaxChi2PerClusterITS(36);
+ jetCuts1006->SetMaxChi2TPCConstrainedGlobal(36);
+
+ jetCuts1006->SetRequireSigmaToVertex(kFALSE);
+
+ jetCuts1006->SetEtaRange(-0.9,0.9);
+ jetCuts1006->SetPtRange(0.15, 1E+15.);
+
+ AliESDtrackCuts* esdTrackCutsHG0 = jetCuts1006->Clone("JetCuts10001006");
+ esdTrackCutsHG0->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+
+
+ // throw out tracks with too low number of clusters in
+ // the first pass (be consistent with TPC only tracks)
+ // N.B. the number off crossed rows still acts on the tracks after
+ // all iterations if we require tpc standalone, number of clusters
+ // and chi2 TPC cuts act on track after the first iteration
+ // esdTrackCutsH0->SetRequireTPCStandAlone(kTRUE);
+ // esdTrackCutsH0->SetMinNClustersTPC(80); // <--- first pass
+
+
+ // the complement to the one with SPD requirement
+ // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);
+ AliESDtrackCuts* esdTrackCutsHG1 = jetCuts1006->Clone("JetCuts10011006");
+ esdTrackCutsHG1->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
+
+ // the tracks that must not be taken pass this cut and
+ // non HGC1 and HG
+ // AliESDtrackCuts* esdTrackCutsHG2 = CreateTrackCutsPWGJE(10021006);
+ AliESDtrackCuts* esdTrackCutsHG2 = jetCuts1006->Clone("JetCuts10021006");
+ esdTrackCutsHG2->SetMaxChi2PerClusterITS(1E10);
+
+
+ // standard cuts also used in R_AA analysis
+ // "Global track RAA analysis QM2011 + Chi2ITS<36";
+ // AliESDtrackCuts* esdTrackCutsH2 = CreateTrackCutsPWGJE(1000);
+ AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
+ esdTrackCutsH2->SetMinNCrossedRowsTPC(120);
+ esdTrackCutsH2->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
+ esdTrackCutsH2->SetMaxChi2PerClusterITS(36);
+ esdTrackCutsH2->SetMaxFractionSharedTPCClusters(0.4);
+ esdTrackCutsH2->SetMaxChi2TPCConstrainedGlobal(36);
+
+ esdTrackCutsH2->SetEtaRange(-0.9,0.9);
+ esdTrackCutsH2->SetPtRange(0.15, 1e10);
+
+
+ // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);
+ AliESDtrackCuts* esdTrackCutsGCOnly = jetCuts1006->Clone("JetCuts10041006");
+ esdTrackCutsGCOnly->SetRequireITSRefit(kFALSE);
+
+ // TPC only tracks
+ AliESDtrackCuts* esdTrackCutsTPCCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+ esdTrackCutsTPCCOnly->SetMinNClustersTPC(70);
+
+ // Compose the filter
+ AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
+ // 1, 1<<0
+ trackFilter->AddCuts(esdTrackCutsL);
+ // 2 1<<1
+ trackFilter->AddCuts(esdTrackCutsITSsa);
+ // 4 1<<2
+ trackFilter->AddCuts(itsStrong);
+ itsStrong->SetFilterMask(1); // AND with Standard track cuts
+ // 8 1<<3
+ trackFilter->AddCuts(electronID);
+ electronID->SetFilterMask(4); // AND with Pixel Cuts
+ // 16 1<<4
+ trackFilter->AddCuts(esdTrackCutsHG0);
+ // 32 1<<5
+ trackFilter->AddCuts(esdTrackCutsHG1);
+ // 64 1<<6
+ trackFilter->AddCuts(esdTrackCutsHG2);
+ // 128 1<<7
+ trackFilter->AddCuts(esdTrackCutsTPCCOnly); // add QM TPC only track cuts
+ if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128);
+ // 256 1<<8
+ trackFilter->AddCuts(esdTrackCutsGCOnly);
+ // 512 1<<9
+ AliESDtrackCuts* esdTrackCutsHG1_tmp = new AliESDtrackCuts(*esdTrackCutsHG1); // avoid double delete
+ trackFilter->AddCuts(esdTrackCutsHG1_tmp); // add once more for tpc only tracks
+ // 1024 1<<10
+ trackFilter->AddCuts(esdTrackCutsH2); // add r_aa cuts
+
+
+
+ esdfilter->SetGlobalConstrainedFilterMask(1<<8|1<<9); // these tracks are written out as global constrained tracks
+ esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<4)); // these normal global tracks will be marked as hybrid
+ esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement
+ // esdfilter->SetTPCConstrainedFilterMask(1<<11); // these tracks are written out as tpc constrained tracks
+
+ esdfilter->SetTrackFilter(trackFilter);
+ return kTRUE;
+
+}
+
+
+Bool_t AddTrackCutsLHC11h(AliAnalysisTaskESDfilter* esdfilter){
+
+
+ Printf("%s%d: Creating Track Cuts LHC11h",(char*)__FILE__,__LINE__);
+
+ // Cuts on primary tracks
+ AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+
+ // ITS stand-alone tracks
+ AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");
+ esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
+
+ // Pixel OR necessary for the electrons
+ AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");
+ itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+
+
+ // PID for the electrons
+ AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");
+ electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.5);
+
+ // standard cuts with very loose DCA
+ AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
+ esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
+ esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
+ esdTrackCutsH->SetDCAToVertex2D(kTRUE);
+
+ // standard cuts with tight DCA cut
+ AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
+
+ // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster
+ // tracks selected by this cut are exclusive to those selected by the previous cut
+ AliESDtrackCuts* esdTrackCutsH3 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
+ esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
+ esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst);
+
+ // TPC only tracks: Optionally enable the writing of TPConly information
+ // constrained to SPD vertex in the filter below
+ AliESDtrackCuts* esdTrackCutsTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+ // The following line is needed for 2010 PbPb reprocessing and pp, but not for 2011 PbPb
+ //esdTrackCutsTPCOnly->SetMinNClustersTPC(70);
+
+ // Extra cuts for hybrids
+ // first the global tracks we want to take
+ AliESDtrackCuts* esdTrackCutsHTG = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
+ esdTrackCutsHTG->SetName("Global Hybrid tracks, loose DCA");
+ esdTrackCutsHTG->SetMaxDCAToVertexXY(2.4);
+ esdTrackCutsHTG->SetMaxDCAToVertexZ(3.2);
+ esdTrackCutsHTG->SetDCAToVertex2D(kTRUE);
+ esdTrackCutsHTG->SetMaxChi2TPCConstrainedGlobal(36);
+ esdTrackCutsHTG->SetMaxFractionSharedTPCClusters(0.4);
+
+
+ // Than the complementary tracks which will be stored as global
+ // constraint, complement is done in the ESDFilter task
+ AliESDtrackCuts* esdTrackCutsHTGC = new AliESDtrackCuts(*esdTrackCutsHTG);
+ esdTrackCutsHTGC->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement");
+ esdTrackCutsHTGC->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);
+ esdTrackCutsHTGC->SetRequireITSRefit(kTRUE);
+
+ // standard cuts with tight DCA cut, using cluster cut instead of crossed rows (a la 2010 default)
+ AliESDtrackCuts* esdTrackCutsH2Cluster = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE, 0);
+
+ // Compose the filter
+ AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
+ // 1, 1<<0
+ trackFilter->AddCuts(esdTrackCutsL);
+ // 2, 1<<1
+ trackFilter->AddCuts(esdTrackCutsITSsa);
+ // 4, 1<<2
+ trackFilter->AddCuts(itsStrong);
+ itsStrong->SetFilterMask(1); // AND with Standard track cuts
+ // 8, 1<<3
+ trackFilter->AddCuts(electronID);
+ electronID->SetFilterMask(4); // AND with Pixel Cuts
+ // 16, 1<<4
+ trackFilter->AddCuts(esdTrackCutsH);
+ // 32, 1<<5
+ trackFilter->AddCuts(esdTrackCutsH2);
+ // 64, 1<<6
+ trackFilter->AddCuts(esdTrackCutsH3);
+ // 128 , 1 << 7
+ trackFilter->AddCuts(esdTrackCutsTPCOnly);
+ if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128);
+ // 256, 1 << 8 Global Hybrids
+ trackFilter->AddCuts(esdTrackCutsHTG);
+ esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<8)); // these normal global tracks will be marked as hybrid
+ // 512, 1<< 9 GlobalConstraint Hybrids
+ trackFilter->AddCuts(esdTrackCutsHTGC);
+ esdfilter->SetGlobalConstrainedFilterMask(1<<9); // these tracks are written out as global constrained tracks
+ esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement
+ // 1024, 1<< 10 // tight DCA cuts
+ trackFilter->AddCuts(esdTrackCutsH2Cluster);
+ esdfilter->SetTrackFilter(trackFilter);
+
+ return kTRUE;
+
+}
+
+Bool_t AddTrackCutsLHC10bcde(AliAnalysisTaskESDfilter* esdfilter){
+
+
+ Printf("%s%d: Creating Track Cuts LHC10bcde",(char*)__FILE__,__LINE__);
+
+ // Cuts on primary tracks
+ AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+
+ // ITS stand-alone tracks
+ AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");
+ esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
+
+ // Pixel OR necessary for the electrons
+ AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");
+ itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+
+
+ // PID for the electrons
+ AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");
+ electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.5);
+
+ // standard cuts with very loose DCA
+ AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);
+ esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
+ esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
+ esdTrackCutsH->SetDCAToVertex2D(kTRUE);
+
+ // standard cuts with tight DCA cut
+ AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
+
+ // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster
+ // tracks selected by this cut are exclusive to those selected by the previous cut
+ AliESDtrackCuts* esdTrackCutsH3 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
+ esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
+ esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst);
+
+ // TPC only tracks: Optionally enable the writing of TPConly information
+ // constrained to SPD vertex in the filter below
+ AliESDtrackCuts* esdTrackCutsTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+ // The following line is needed for 2010 PbPb reprocessing and pp, but not for 2011 PbPb
+ esdTrackCutsTPCOnly->SetMinNClustersTPC(70);
+
+ // Extra cuts for hybrids
+ // first the global tracks we want to take
+ // take the HTGs from 10h
+
+ // gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
+ // AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWGJE(10001006);
+
+ AliESDtrackCuts *jetCuts1006 = new AliESDtrackCuts("AliESDtrackCuts");
+
+ TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
+ jetCuts1006->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
+ jetCuts1006->SetMinNClustersTPC(70);
+ jetCuts1006->SetMaxChi2PerClusterTPC(4);
+ jetCuts1006->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
+ jetCuts1006->SetAcceptKinkDaughters(kFALSE);
+ jetCuts1006->SetRequireTPCRefit(kTRUE);
+ jetCuts1006->SetMaxFractionSharedTPCClusters(0.4);
+ // ITS
+ jetCuts1006->SetRequireITSRefit(kTRUE);
+ //accept secondaries
+ jetCuts1006->SetMaxDCAToVertexXY(2.4);
+ jetCuts1006->SetMaxDCAToVertexZ(3.2);
+ jetCuts1006->SetDCAToVertex2D(kTRUE);
+ //reject fakes
+ jetCuts1006->SetMaxChi2PerClusterITS(36);
+ jetCuts1006->SetMaxChi2TPCConstrainedGlobal(36);
+
+ jetCuts1006->SetRequireSigmaToVertex(kFALSE);
+
+ jetCuts1006->SetEtaRange(-0.9,0.9);
+ jetCuts1006->SetPtRange(0.15, 1E+15.);
+
+ AliESDtrackCuts* esdTrackCutsHTG = jetCuts1006->Clone("JetCuts10001006");
+ esdTrackCutsHTG->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+
+ // Than the complementary tracks which will be stored as global
+ // constraint, complement is done in the ESDFilter task
+ // HGC from 10h
+
+ AliESDtrackCuts* esdTrackCutsHTGC = jetCuts1006->Clone("JetCuts10041006");
+ esdTrackCutsHTGC->SetRequireITSRefit(kFALSE);
+
+ // standard cuts with tight DCA cut, using cluster cut instead of crossed rows (a la 2010 default)
+ AliESDtrackCuts* esdTrackCutsH2Cluster = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE, 0);
+
+ // Compose the filter
+ AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
+ // 1, 1<<0
+ trackFilter->AddCuts(esdTrackCutsL);
+ // 2, 1<<1
+ trackFilter->AddCuts(esdTrackCutsITSsa);
+ // 4, 1<<2
+ trackFilter->AddCuts(itsStrong);
+ itsStrong->SetFilterMask(1); // AND with Standard track cuts
+ // 8, 1<<3
+ trackFilter->AddCuts(electronID);
+ electronID->SetFilterMask(4); // AND with Pixel Cuts
+ // 16, 1<<4
+ trackFilter->AddCuts(esdTrackCutsH);
+ // 32, 1<<5
+ trackFilter->AddCuts(esdTrackCutsH2);
+ // 64, 1<<6
+ trackFilter->AddCuts(esdTrackCutsH3);
+ // 128 , 1 << 7
+ trackFilter->AddCuts(esdTrackCutsTPCOnly);
+ if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128);
+ // 256, 1 << 8 Global Hybrids
+ trackFilter->AddCuts(esdTrackCutsHTG);
+ esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<8)); // these normal global tracks will be marked as hybrid
+ // 512, 1<< 9 GlobalConstraint Hybrids
+ trackFilter->AddCuts(esdTrackCutsHTGC);
+ esdfilter->SetGlobalConstrainedFilterMask(1<<9); // these tracks are written out as global constrained tracks
+ esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement
+ // 1024, 1<< 10 // tight DCA cuts
+ trackFilter->AddCuts(esdTrackCutsH2Cluster);
+ esdfilter->SetTrackFilter(trackFilter);
+
+ return kTRUE;
+
+}
fESD = fTender->GetEvent();
if (!fESD) return;
- if(fNormalizationFactorArray) fNormalizationFactor = GetNormalizationFactor(fESD->GetRunNumber());\r
+ if(fNormalizationFactorArray) fNormalizationFactor = GetNormalizationFactor(fESD->GetRunNumber());
Int_t ntracks=fESD->GetNumberOfTracks();
TVectorD *corrfactor = dynamic_cast<TVectorD *>(fRunByRunCorrection->GetObject(fTender->GetRun()));
if(!corrfactor){
- // No correction available - simply return\r
+ // No correction available - simply return
AliDebug(2, "Couldn't derive gain correction factor from OADB");
return;
}
//_____________________________________________________
Double_t AliTRDTenderSupply::GetNormalizationFactor(Int_t runnumber){
//
- // Load the normalization factor\r
+ // Load the normalization factor
//
Double_t norm = 1.;
if(fNormalizationFactorArray){
-// $Id$\r
-\r
-/**************************************************************************\r
- * This file is property of and copyright by the ALICE HLT Project * \r
- * All rights reserved. *\r
- * *\r
- * Primary Authors: Oystein Djuvsland *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is * \r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
- /** \r
- * @file AliHLTCaloDigitMaker.cxx\r
- * @author Oystein Djuvsland\r
- * @date \r
- * @brief Digit maker for CALO HLT \r
- */\r
- \r
-\r
-// see header file for class documentation\r
-// or\r
-// refer to README to build package\r
-// or\r
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt\r
-\r
-#include "AliHLTCaloDigitMaker.h"\r
-#include "AliHLTCaloConstantsHandler.h"\r
-#include "AliHLTCaloMapper.h"\r
-#include "AliHLTCaloChannelDataStruct.h"\r
-#include "AliHLTCaloChannelDataHeaderStruct.h"\r
-#include "AliHLTCaloDigitDataStruct.h"\r
-#include "AliHLTCaloCoordinate.h"\r
-#include "AliHLTCaloSharedMemoryInterfacev2.h" // added by PTH\r
-//#include "AliPHOSEMCAGeometry.h"\r
-#include "TH2F.h"\r
-#include "AliHLTCaloConstants.h"\r
-#include "AliHLTLogging.h"\r
-\r
-ClassImp(AliHLTCaloDigitMaker);\r
-\r
-//using namespace CaloHLTConst;\r
-\r
-AliHLTCaloDigitMaker::AliHLTCaloDigitMaker(TString det) :\r
- AliHLTCaloConstantsHandler(det),\r
- AliHLTLogging(),\r
- fShmPtr(0),\r
- fDigitStructPtr(0),\r
- fDigitCount(0),\r
- fMapperPtr(0),\r
- fHighGainFactors(0),\r
- fLowGainFactors(0),\r
- fBadChannelMask(0),\r
- fChannelBook(0),\r
- fMaxEnergy(900),\r
- fMinTime(0.0),\r
- fMaxTime(1008.0)\r
-{\r
- // See header file for documentation\r
-\r
- fShmPtr = new AliHLTCaloSharedMemoryInterfacev2(det);\r
-\r
- fHighGainFactors = new Float_t*[fCaloConstants->GetNXCOLUMNSMOD()];\r
- fLowGainFactors = new Float_t*[fCaloConstants->GetNXCOLUMNSMOD()];\r
- \r
- fBadChannelMask = new Bool_t**[fCaloConstants->GetNXCOLUMNSMOD()];\r
- \r
- fChannelBook= new AliHLTCaloDigitDataStruct**[fCaloConstants->GetNXCOLUMNSMOD()];\r
- \r
- for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)\r
- {\r
- fHighGainFactors[x] = new Float_t[fCaloConstants->GetNZROWSMOD()];\r
- fLowGainFactors[x] = new Float_t[fCaloConstants->GetNZROWSMOD()];\r
-\r
- fBadChannelMask[x] = new Bool_t*[fCaloConstants->GetNZROWSMOD()];\r
-\r
- fChannelBook[x] = new AliHLTCaloDigitDataStruct*[fCaloConstants->GetNZROWSMOD()];\r
-\r
- for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)\r
- {\r
-\r
- fHighGainFactors[x][z] = 0.0153;\r
- fLowGainFactors[x][z] = 0.245;\r
- \r
- fBadChannelMask[x][z] = new Bool_t[fCaloConstants->GetNGAINS()];\r
- fBadChannelMask[x][z][fCaloConstants->GetHIGHGAIN()] = false;\r
- fBadChannelMask[x][z][fCaloConstants->GetLOWGAIN()] = false; \r
- \r
- fChannelBook[x][z] = 0;\r
- \r
- }\r
- } \r
-}\r
-\r
-AliHLTCaloDigitMaker::~AliHLTCaloDigitMaker() \r
-{\r
- //See header file for documentation\r
- delete [] fHighGainFactors;\r
- delete [] fLowGainFactors;\r
- delete [] fBadChannelMask; \r
- delete [] fChannelBook;\r
- delete fShmPtr;\r
-\r
-}\r
-\r
-Int_t\r
-AliHLTCaloDigitMaker::MakeDigits(AliHLTCaloChannelDataHeaderStruct* channelDataHeader, AliHLTUInt32_t availableSize)\r
-{\r
- //See header file for documentation\r
- \r
- Reset();\r
-\r
- UInt_t totSize = sizeof(AliHLTCaloDigitDataStruct);\r
- \r
-// Int_t xMod = -1;\r
-// Int_t zMod = -1;\r
- \r
-\r
- AliHLTCaloCoordinate coord;\r
- \r
- \r
- AliHLTCaloChannelDataStruct* currentchannel = 0;\r
- \r
- fShmPtr->SetMemory(channelDataHeader);\r
- currentchannel = fShmPtr->NextChannel();\r
-\r
- while(currentchannel != 0)\r
- {\r
- if(availableSize < totSize) return -1;\r
-\r
- fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);\r
- \r
- // fMapperPtr->GetLocalCoord(currentchannel->fChannelID, locCoord);\r
- if(UseDigit(coord, currentchannel))\r
- {\r
- AddDigit(currentchannel, coord);\r
- // j++; \r
- totSize += sizeof(AliHLTCaloDigitDataStruct);\r
- }\r
- currentchannel = fShmPtr->NextChannel(); // Get the next channel\r
- }\r
-// if(currentchannel)\r
-// {\r
-// fMapperPtr->GetLocalCoord(currentchannel->fChannelID, locCoord);\r
-// if(UseDigit(coord1, currentchannel))\r
-// {\r
-// AddDigit(currentchannel, coord1, locCoord);\r
-// j++; \r
-// totSize += sizeof(AliHLTCaloDigitDataStruct);\r
-// }\r
-// currentchannel = fShmPtr->NextChannel(); // Get the next channel\r
-// }\r
-// }\r
- \r
-// fDigitCount += j;\r
- return fDigitCount; \r
-}\r
-\r
-void \r
-AliHLTCaloDigitMaker::SetGlobalHighGainFactor(Float_t factor)\r
-{\r
- //See header file for documentation\r
- for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)\r
- {\r
- for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)\r
- {\r
- fHighGainFactors[x][z] = factor;\r
- }\r
- }\r
-}\r
-\r
-\r
-void\r
-AliHLTCaloDigitMaker::SetGlobalLowGainFactor(Float_t factor)\r
-{\r
- //See header file for documentation\r
- for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)\r
- {\r
- for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)\r
- {\r
- fLowGainFactors[x][z] = factor;\r
- }\r
- }\r
-}\r
-\r
-\r
-void\r
-AliHLTCaloDigitMaker::SetBadChannelMask(TH2F* badChannelHGHist, TH2F* badChannelLGHist, Float_t qCut)\r
-{\r
- for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)\r
- {\r
- for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)\r
- {\r
- if(badChannelHGHist->GetBinContent(x, z) < qCut && badChannelHGHist->GetBinContent(x, z) > 0)\r
- {\r
- fBadChannelMask[x][z][fCaloConstants->GetHIGHGAIN()] = true;\r
- }\r
- else\r
- {\r
- fBadChannelMask[x][z][fCaloConstants->GetHIGHGAIN()] = false;\r
- }\r
- if(badChannelLGHist->GetBinContent(x, z) < qCut && badChannelLGHist->GetBinContent(x, z) > 0)\r
- {\r
- fBadChannelMask[x][z][fCaloConstants->GetLOWGAIN()] = false;\r
- }\r
- else\r
- {\r
- fBadChannelMask[x][z][fCaloConstants->GetLOWGAIN()] = false;\r
- }\r
- }\r
- }\r
-}\r
-\r
-void\r
-AliHLTCaloDigitMaker::Reset()\r
-{\r
- fDigitCount = 0;\r
- for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)\r
- {\r
- for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)\r
- {\r
- fChannelBook[x][z] = 0;\r
- }\r
- } \r
-\r
-}\r
-\r
-\r
-void AliHLTCaloDigitMaker::AddDigit(AliHLTCaloChannelDataStruct* channelData, AliHLTCaloCoordinate &coord)\r
-{\r
-\r
- // Some book keeping of the pointers\r
- AliHLTCaloDigitDataStruct *tmpDigit = fDigitStructPtr + 1;\r
-\r
- // Check if we already have a digit in this position, and correct the book keeping correspondently\r
- if(fChannelBook[coord.fX][coord.fZ]) \r
- {\r
- tmpDigit = fDigitStructPtr;\r
- fDigitStructPtr = fChannelBook[coord.fX][coord.fZ];\r
- fDigitCount--;\r
- // printf("Going to overwrite digit: x = %d, z = %d, gain = %d, energy = %f\n", fDigitStructPtr->fX, fDigitStructPtr->fZ, fDigitStructPtr->fGain, fDigitStructPtr->fEnergy);\r
- }\r
- \r
- fChannelBook[coord.fX][coord.fZ] = fDigitStructPtr;\r
- \r
- fDigitStructPtr->fX = coord.fX;\r
- fDigitStructPtr->fZ = coord.fZ;\r
- fDigitStructPtr->fGain = coord.fGain;\r
- fDigitStructPtr->fOverflow = false;\r
- fDigitStructPtr->fAssociatedCluster = -1;\r
- \r
- fDigitStructPtr->fID = fDigitStructPtr->fZ * fCaloConstants->GetNXCOLUMNSMOD() + fDigitStructPtr->fX;\r
- \r
- if(coord.fGain == fCaloConstants->GetHIGHGAIN() )\r
- {\r
- fDigitStructPtr->fEnergy = channelData->fEnergy*fHighGainFactors[coord.fX][coord.fZ];\r
- fDigitStructPtr->fHgPresent = true;\r
- if(channelData->fEnergy >= fMaxEnergy)\r
- {\r
- fDigitStructPtr->fOverflow = true;\r
- }\r
- \r
- HLTDebug("HG channel (x = %d, z = %d) with amplitude: %f --> Digit with energy: %f \n", \r
- coord.fX, coord.fZ, channelData->fEnergy, fDigitStructPtr->fEnergy);\r
- }\r
- else\r
- {\r
- fDigitStructPtr->fEnergy = channelData->fEnergy*fLowGainFactors[coord.fX][coord.fZ];\r
- if(channelData->fEnergy >= fMaxEnergy)\r
- {\r
- fDigitStructPtr->fOverflow = true;\r
- }\r
- HLTDebug("LG channel (x = %d, z = %d) with amplitude: %f --> Digit with energy: %f\n", coord.fX, coord.fZ, channelData->fEnergy, fDigitStructPtr->fEnergy); \r
- }\r
- fDigitStructPtr->fTime = channelData->fTime * 0.0000001; //TODO\r
- fDigitStructPtr->fCrazyness = channelData->fCrazyness;\r
- fDigitStructPtr->fModule = coord.fModuleId;\r
- fDigitStructPtr = tmpDigit;\r
- // fDigitStructPtr++;\r
- fDigitCount++;\r
-}\r
-\r
-bool AliHLTCaloDigitMaker::UseDigit(AliHLTCaloCoordinate &channelCoordinates, AliHLTCaloChannelDataStruct *channel) \r
-{\r
- \r
- if(fBadChannelMask[channelCoordinates.fX][channelCoordinates.fZ][0] == true) return false;\r
- if(channel->fTime < fMinTime || channel->fTime > fMaxTime) return false;\r
- \r
- AliHLTCaloDigitDataStruct *tmpDigit = fChannelBook[channelCoordinates.fX][channelCoordinates.fZ];\r
- //printf("UseDigit: Got digit, x: %d, z: %d, gain: %d, amp: %f\n", channelCoordinates.fX, channelCoordinates.fZ, channelCoordinates.fGain, channel->fEnergy);\r
- if(tmpDigit)\r
- {\r
- if(channelCoordinates.fGain == fCaloConstants->GetLOWGAIN())\r
- {\r
- //printf("UseDigit: Already have digit with, x: %d, z: %d, with high gain \n", channelCoordinates.fX, channelCoordinates.fZ);\r
- if(tmpDigit->fOverflow)\r
- {\r
- // printf("But it was in overflow! Let's use this low gain!\n");\r
- return true;\r
- }\r
- return false;\r
- }\r
- else\r
- {\r
- //printf("UseDigit: Already have digit with, x: %d, z: %d, with low gain: %d\n", channelCoordinates.fX, channelCoordinates.fZ);\r
- if(channel->fEnergy > fMaxEnergy )\r
- {\r
- tmpDigit->fHgPresent = true;\r
- return false;\r
- }\r
- return true;\r
- }\r
- }\r
- return true;\r
-}\r
-\r
-void AliHLTCaloDigitMaker::SetBadChannel(Int_t x, Int_t z, Bool_t bad)\r
-{\r
- // See header file for class documentation\r
- fBadChannelMask[x][z][0] = bad;\r
- fBadChannelMask[x][z][1] = bad;\r
-}\r
-\r
-void AliHLTCaloDigitMaker::SetGain(Int_t x, Int_t z, Float_t ratio, Float_t gain)\r
-{\r
- // See header file for class documentation\r
- HLTDebug("Applying gain: %f for channel x: %d, z: %d", gain, x, z); \r
- fHighGainFactors[x][z] = gain;\r
- fLowGainFactors[x][z] = gain * ratio;\r
- \r
-}\r
+// $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
+ * *
+ * Primary Authors: Oystein Djuvsland *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+ /**
+ * @file AliHLTCaloDigitMaker.cxx
+ * @author Oystein Djuvsland
+ * @date
+ * @brief Digit maker for CALO HLT
+ */
+
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTCaloDigitMaker.h"
+#include "AliHLTCaloConstantsHandler.h"
+#include "AliHLTCaloMapper.h"
+#include "AliHLTCaloChannelDataStruct.h"
+#include "AliHLTCaloChannelDataHeaderStruct.h"
+#include "AliHLTCaloDigitDataStruct.h"
+#include "AliHLTCaloCoordinate.h"
+#include "AliHLTCaloSharedMemoryInterfacev2.h" // added by PTH
+//#include "AliPHOSEMCAGeometry.h"
+#include "TH2F.h"
+#include "AliHLTCaloConstants.h"
+#include "AliHLTLogging.h"
+
+ClassImp(AliHLTCaloDigitMaker);
+
+//using namespace CaloHLTConst;
+
+AliHLTCaloDigitMaker::AliHLTCaloDigitMaker(TString det) :
+ AliHLTCaloConstantsHandler(det),
+ AliHLTLogging(),
+ fShmPtr(0),
+ fDigitStructPtr(0),
+ fDigitCount(0),
+ fMapperPtr(0),
+ fHighGainFactors(0),
+ fLowGainFactors(0),
+ fBadChannelMask(0),
+ fChannelBook(0),
+ fMaxEnergy(900),
+ fMinTime(0.0),
+ fMaxTime(1008.0)
+{
+ // See header file for documentation
+
+ fShmPtr = new AliHLTCaloSharedMemoryInterfacev2(det);
+
+ fHighGainFactors = new Float_t*[fCaloConstants->GetNXCOLUMNSMOD()];
+ fLowGainFactors = new Float_t*[fCaloConstants->GetNXCOLUMNSMOD()];
+
+ fBadChannelMask = new Bool_t**[fCaloConstants->GetNXCOLUMNSMOD()];
+
+ fChannelBook= new AliHLTCaloDigitDataStruct**[fCaloConstants->GetNXCOLUMNSMOD()];
+
+ for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)
+ {
+ fHighGainFactors[x] = new Float_t[fCaloConstants->GetNZROWSMOD()];
+ fLowGainFactors[x] = new Float_t[fCaloConstants->GetNZROWSMOD()];
+
+ fBadChannelMask[x] = new Bool_t*[fCaloConstants->GetNZROWSMOD()];
+
+ fChannelBook[x] = new AliHLTCaloDigitDataStruct*[fCaloConstants->GetNZROWSMOD()];
+
+ for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)
+ {
+
+ fHighGainFactors[x][z] = 0.0153;
+ fLowGainFactors[x][z] = 0.245;
+
+ fBadChannelMask[x][z] = new Bool_t[fCaloConstants->GetNGAINS()];
+ fBadChannelMask[x][z][fCaloConstants->GetHIGHGAIN()] = false;
+ fBadChannelMask[x][z][fCaloConstants->GetLOWGAIN()] = false;
+
+ fChannelBook[x][z] = 0;
+
+ }
+ }
+}
+
+AliHLTCaloDigitMaker::~AliHLTCaloDigitMaker()
+{
+ //See header file for documentation
+ delete [] fHighGainFactors;
+ delete [] fLowGainFactors;
+ delete [] fBadChannelMask;
+ delete [] fChannelBook;
+ delete fShmPtr;
+
+}
+
+Int_t
+AliHLTCaloDigitMaker::MakeDigits(AliHLTCaloChannelDataHeaderStruct* channelDataHeader, AliHLTUInt32_t availableSize)
+{
+ //See header file for documentation
+
+ Reset();
+
+ UInt_t totSize = sizeof(AliHLTCaloDigitDataStruct);
+
+// Int_t xMod = -1;
+// Int_t zMod = -1;
+
+
+ AliHLTCaloCoordinate coord;
+
+
+ AliHLTCaloChannelDataStruct* currentchannel = 0;
+
+ fShmPtr->SetMemory(channelDataHeader);
+ currentchannel = fShmPtr->NextChannel();
+
+ while(currentchannel != 0)
+ {
+ if(availableSize < totSize) return -1;
+
+ fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);
+
+ // fMapperPtr->GetLocalCoord(currentchannel->fChannelID, locCoord);
+ if(UseDigit(coord, currentchannel))
+ {
+ AddDigit(currentchannel, coord);
+ // j++;
+ totSize += sizeof(AliHLTCaloDigitDataStruct);
+ }
+ currentchannel = fShmPtr->NextChannel(); // Get the next channel
+ }
+// if(currentchannel)
+// {
+// fMapperPtr->GetLocalCoord(currentchannel->fChannelID, locCoord);
+// if(UseDigit(coord1, currentchannel))
+// {
+// AddDigit(currentchannel, coord1, locCoord);
+// j++;
+// totSize += sizeof(AliHLTCaloDigitDataStruct);
+// }
+// currentchannel = fShmPtr->NextChannel(); // Get the next channel
+// }
+// }
+
+// fDigitCount += j;
+ return fDigitCount;
+}
+
+void
+AliHLTCaloDigitMaker::SetGlobalHighGainFactor(Float_t factor)
+{
+ //See header file for documentation
+ for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)
+ {
+ for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)
+ {
+ fHighGainFactors[x][z] = factor;
+ }
+ }
+}
+
+
+void
+AliHLTCaloDigitMaker::SetGlobalLowGainFactor(Float_t factor)
+{
+ //See header file for documentation
+ for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)
+ {
+ for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)
+ {
+ fLowGainFactors[x][z] = factor;
+ }
+ }
+}
+
+
+void
+AliHLTCaloDigitMaker::SetBadChannelMask(TH2F* badChannelHGHist, TH2F* badChannelLGHist, Float_t qCut)
+{
+ for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)
+ {
+ for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)
+ {
+ if(badChannelHGHist->GetBinContent(x, z) < qCut && badChannelHGHist->GetBinContent(x, z) > 0)
+ {
+ fBadChannelMask[x][z][fCaloConstants->GetHIGHGAIN()] = true;
+ }
+ else
+ {
+ fBadChannelMask[x][z][fCaloConstants->GetHIGHGAIN()] = false;
+ }
+ if(badChannelLGHist->GetBinContent(x, z) < qCut && badChannelLGHist->GetBinContent(x, z) > 0)
+ {
+ fBadChannelMask[x][z][fCaloConstants->GetLOWGAIN()] = false;
+ }
+ else
+ {
+ fBadChannelMask[x][z][fCaloConstants->GetLOWGAIN()] = false;
+ }
+ }
+ }
+}
+
+void
+AliHLTCaloDigitMaker::Reset()
+{
+ fDigitCount = 0;
+ for(int x = 0; x < fCaloConstants->GetNXCOLUMNSMOD(); x++)
+ {
+ for(int z = 0; z < fCaloConstants->GetNZROWSMOD(); z++)
+ {
+ fChannelBook[x][z] = 0;
+ }
+ }
+
+}
+
+
+void AliHLTCaloDigitMaker::AddDigit(AliHLTCaloChannelDataStruct* channelData, AliHLTCaloCoordinate &coord)
+{
+
+ // Some book keeping of the pointers
+ AliHLTCaloDigitDataStruct *tmpDigit = fDigitStructPtr + 1;
+
+ // Check if we already have a digit in this position, and correct the book keeping correspondently
+ if(fChannelBook[coord.fX][coord.fZ])
+ {
+ tmpDigit = fDigitStructPtr;
+ fDigitStructPtr = fChannelBook[coord.fX][coord.fZ];
+ fDigitCount--;
+ // printf("Going to overwrite digit: x = %d, z = %d, gain = %d, energy = %f\n", fDigitStructPtr->fX, fDigitStructPtr->fZ, fDigitStructPtr->fGain, fDigitStructPtr->fEnergy);
+ }
+
+ fChannelBook[coord.fX][coord.fZ] = fDigitStructPtr;
+
+ fDigitStructPtr->fX = coord.fX;
+ fDigitStructPtr->fZ = coord.fZ;
+ fDigitStructPtr->fGain = coord.fGain;
+ fDigitStructPtr->fOverflow = false;
+ fDigitStructPtr->fAssociatedCluster = -1;
+
+ fDigitStructPtr->fID = fDigitStructPtr->fZ * fCaloConstants->GetNXCOLUMNSMOD() + fDigitStructPtr->fX;
+
+ if(coord.fGain == fCaloConstants->GetHIGHGAIN() )
+ {
+ fDigitStructPtr->fEnergy = channelData->fEnergy*fHighGainFactors[coord.fX][coord.fZ];
+ fDigitStructPtr->fHgPresent = true;
+ if(channelData->fEnergy >= fMaxEnergy)
+ {
+ fDigitStructPtr->fOverflow = true;
+ }
+
+ HLTDebug("HG channel (x = %d, z = %d) with amplitude: %f --> Digit with energy: %f \n",
+ coord.fX, coord.fZ, channelData->fEnergy, fDigitStructPtr->fEnergy);
+ }
+ else
+ {
+ fDigitStructPtr->fEnergy = channelData->fEnergy*fLowGainFactors[coord.fX][coord.fZ];
+ if(channelData->fEnergy >= fMaxEnergy)
+ {
+ fDigitStructPtr->fOverflow = true;
+ }
+ HLTDebug("LG channel (x = %d, z = %d) with amplitude: %f --> Digit with energy: %f\n", coord.fX, coord.fZ, channelData->fEnergy, fDigitStructPtr->fEnergy);
+ }
+ fDigitStructPtr->fTime = channelData->fTime * 0.0000001; //TODO
+ fDigitStructPtr->fCrazyness = channelData->fCrazyness;
+ fDigitStructPtr->fModule = coord.fModuleId;
+ fDigitStructPtr = tmpDigit;
+ // fDigitStructPtr++;
+ fDigitCount++;
+}
+
+bool AliHLTCaloDigitMaker::UseDigit(AliHLTCaloCoordinate &channelCoordinates, AliHLTCaloChannelDataStruct *channel)
+{
+
+ if(fBadChannelMask[channelCoordinates.fX][channelCoordinates.fZ][0] == true) return false;
+ if(channel->fTime < fMinTime || channel->fTime > fMaxTime) return false;
+
+ AliHLTCaloDigitDataStruct *tmpDigit = fChannelBook[channelCoordinates.fX][channelCoordinates.fZ];
+ //printf("UseDigit: Got digit, x: %d, z: %d, gain: %d, amp: %f\n", channelCoordinates.fX, channelCoordinates.fZ, channelCoordinates.fGain, channel->fEnergy);
+ if(tmpDigit)
+ {
+ if(channelCoordinates.fGain == fCaloConstants->GetLOWGAIN())
+ {
+ //printf("UseDigit: Already have digit with, x: %d, z: %d, with high gain \n", channelCoordinates.fX, channelCoordinates.fZ);
+ if(tmpDigit->fOverflow)
+ {
+ // printf("But it was in overflow! Let's use this low gain!\n");
+ return true;
+ }
+ return false;
+ }
+ else
+ {
+ //printf("UseDigit: Already have digit with, x: %d, z: %d, with low gain: %d\n", channelCoordinates.fX, channelCoordinates.fZ);
+ if(channel->fEnergy > fMaxEnergy )
+ {
+ tmpDigit->fHgPresent = true;
+ return false;
+ }
+ return true;
+ }
+ }
+ return true;
+}
+
+void AliHLTCaloDigitMaker::SetBadChannel(Int_t x, Int_t z, Bool_t bad)
+{
+ // See header file for class documentation
+ fBadChannelMask[x][z][0] = bad;
+ fBadChannelMask[x][z][1] = bad;
+}
+
+void AliHLTCaloDigitMaker::SetGain(Int_t x, Int_t z, Float_t ratio, Float_t gain)
+{
+ // See header file for class documentation
+ HLTDebug("Applying gain: %f for channel x: %d, z: %d", gain, x, z);
+ fHighGainFactors[x][z] = gain;
+ fLowGainFactors[x][z] = gain * ratio;
+
+}
-#ifndef ALIITSUCLUSTERIZER_H\r
-#define ALIITSUCLUSTERIZER_H\r
-\r
-#include <TClonesArray.h>\r
-\r
-//#define _ClusterTopology_ // uncomment this to produce the tree with cluster topology\r
-\r
-class TTree;\r
-class TObjAray;\r
-class AliITSUSegmentationPix;\r
-class AliITSdigit;\r
-class AliCluster;\r
-class AliITSUClusterPix;\r
-class AliITSURecoParam;\r
-//\r
-#ifdef _ClusterTopology_\r
-#include <TBits.h>\r
-class TFile;\r
-#endif //_ClusterTopology_\r
-\r
-\r
-class AliITSUClusterizer : public TObject \r
-{\r
- //\r
- public:\r
- enum {kDigitChunkSize=1024, kMaxLabels=20,kMaxLabInCluster=3};\r
- //\r
- AliITSUClusterizer(Int_t nrowInit=0);\r
- virtual ~AliITSUClusterizer();\r
- void SetRawData(Bool_t v=kTRUE) {fRawData = v;}\r
- void Clusterize();\r
- void SetSegmentation(const AliITSUSegmentationPix *segm);\r
- void SetRecoParam(const AliITSURecoParam* param) {fRecoParam = param;}\r
- void SetLayerID(Int_t id) {fLayerID = id;}\r
- void SetVolID(Int_t id) {fVolID = id;}\r
- void SetNRow(Int_t nrow);\r
- void SetAllowDiagonalClusterization(Bool_t v) {fAllowDiagonalClusterization = v;}\r
- void PrepareLorentzAngleCorrection(Double_t bz);\r
- //\r
- // interface methods\r
- void MakeRecPointBranch(TTree */*treeR*/) {};\r
- void SetRecPointTreeAddress(TTree */*treeR*/) {};\r
- void DigitsToRecPoints(const TObjArray */*digList*/) {};\r
- \r
- void SetDigits(const TClonesArray *digits) {fInputDigits=digits;fInputDigitsReadIndex=0;}\r
- void SetClusters(TClonesArray *clusters) {fOutputClusters=clusters;}\r
- //\r
- // labeling methods\r
- void AddLabel(int label);\r
- void CheckLabels();\r
- //\r
- protected: // transient data types\r
- struct AliITSUClusterizerClusterDigit {\r
- AliITSUClusterizerClusterDigit *fNext;\r
- AliITSdigit *fDigit;\r
- };\r
- \r
- struct AliITSUClusterizerClusterCand;\r
- struct AliITSUClusterizerClusterPart {\r
- AliITSUClusterizerClusterPart *fNextInRow;\r
- AliITSUClusterizerClusterPart *fPrevInCluster;\r
- AliITSUClusterizerClusterPart *fNextInCluster;\r
- AliITSUClusterizerClusterCand *fParent;\r
- Int_t fUBegin;\r
- Int_t fUEnd;\r
- };\r
- \r
- struct AliITSUClusterizerClusterCand {\r
- AliITSUClusterizerClusterCand *fNext; // only used for memory management\r
- AliITSUClusterizerClusterPart *fFirstPart;\r
- AliITSUClusterizerClusterDigit *fFirstDigit;\r
- AliITSUClusterizerClusterDigit *fLastDigit ;\r
- };\r
-\r
- protected:\r
- //\r
- // allocation and deallocation\r
- AliITSUClusterizerClusterDigit* AllocDigitFreelist();\r
- AliITSUClusterizerClusterCand* AllocCand();\r
- void DeallocCand(AliITSUClusterizerClusterCand *cand);\r
- AliITSUClusterizerClusterPart* AllocPart();\r
- void DeallocPart(AliITSUClusterizerClusterPart *part) {DeallocParts(part,part); }\r
- void DeallocParts(AliITSUClusterizerClusterPart *first,AliITSUClusterizerClusterPart *last);\r
- AliITSUClusterizerClusterDigit* AllocDigit();\r
- void DeallocDigit(AliITSUClusterizerClusterDigit *digit) {DeallocDigits(digit,digit);}\r
- void DeallocDigits(AliITSUClusterizerClusterDigit *first,AliITSUClusterizerClusterDigit *last);\r
-\r
- // input "iterator"\r
- AliITSUClusterizerClusterDigit* NextDigit();\r
- // output "iterator"\r
- AliCluster* NextCluster() {return (AliCluster*)fOutputClusters->New(fOutputClusters->GetEntriesFast());}\r
- \r
- // modifiers\r
- void SetAllowDiagonalClusterization();\r
-\r
- void AttachDigitToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterDigit *digit);\r
- void AttachPartToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part);\r
- void DetachPartFromCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part);\r
- void MergeCands(AliITSUClusterizerClusterCand *a,AliITSUClusterizerClusterCand *b);\r
- void Transform(AliITSUClusterPix *cluster, AliITSUClusterizerClusterCand *cand);\r
- void CloseCand(AliITSUClusterizerClusterCand *cand);\r
- void ClosePart(AliITSUClusterizerClusterPart *part);\r
-\r
- void CloseRemainingParts(AliITSUClusterizerClusterPart *part);\r
- //\r
- protected:\r
- //\r
- Int_t fVolID; // Volume id (module index)\r
- Bool_t fAllowDiagonalClusterization; // allow clusters with pixels having common corners only\r
- const AliITSUSegmentationPix* fSegm; // Segmentation or local coord calc.\r
- const AliITSURecoParam* fRecoParam; // reco params\r
- //\r
- // Digit Input\r
- const TClonesArray *fInputDigits; // supplied digits\r
- Int_t fInputDigitsReadIndex; // digits counter\r
- Int_t fLayerID; // current layer id\r
- //\r
- Int_t fCurrLabels[kMaxLabels]; // labels collected for current cluster\r
- Int_t fNLabels; // number of collected labels\r
- Bool_t fRawData; // is raw data processed?\r
- //\r
- Double_t fLorAngCorrection; // Lorentz Angle correction for current layer\r
- // Cluster Output\r
- TClonesArray *fOutputClusters; // external container to store clusters\r
- //\r
- // temporary variables\r
- AliITSUClusterizerClusterDigit *fDigitFreelist ; //! pool of local digits\r
- AliITSUClusterizerClusterPart *fPartFreelist ; //! pool of unfinished clusters\r
- AliITSUClusterizerClusterCand *fCandFreelist ; //! pool of clusters\r
- AliITSUClusterizerClusterDigit *fDigitFreelistBptrFirst; //! pointer in the pool\r
- AliITSUClusterizerClusterDigit *fDigitFreelistBptrLast ; //! pointer in the pool\r
- AliITSUClusterizerClusterPart *fPartFreelistBptr ; //! pointer in the pool\r
- AliITSUClusterizerClusterCand *fCandFreelistBptr ; //!pointer in the pool\r
- //\r
-#ifdef _ClusterTopology_\r
- TTree* fTreeTopology; // output tree for the cluster topology in the special mode\r
- TFile* fFileTopology; // output file for the cluster topology in the special mode\r
- TBits fTopology; // container for the clusters topology pattern\r
- UShort_t fMinCol; // min col number\r
- UShort_t fMinRow; // min row number\r
- void InitTopologyTree();\r
- void SaveTopologyTree();\r
- void FillClusterTopology(AliITSUClusterizerClusterCand *cand);\r
-#endif //_ClusterTopology_\r
- private:\r
- AliITSUClusterizer(const AliITSUClusterizer&); //Not implemented\r
- AliITSUClusterizer& operator=(const AliITSUClusterizer&); //Not implemented\r
- //\r
- ClassDef(AliITSUClusterizer,0)\r
-};\r
-\r
-\r
-//_______________________________________________________________________________\r
-inline void AliITSUClusterizer::DeallocCand(AliITSUClusterizerClusterCand *cand)\r
-{\r
- // free candidate\r
- cand->fNext=fCandFreelist;\r
- fCandFreelist=cand;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline void AliITSUClusterizer::DeallocParts(AliITSUClusterizerClusterPart *first,AliITSUClusterizerClusterPart *last)\r
-{\r
- // free cluster part\r
- last->fNextInRow=fPartFreelist;\r
- fPartFreelist=first;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline AliITSUClusterizer::AliITSUClusterizerClusterDigit* AliITSUClusterizer::AllocDigit()\r
-{\r
- // allocate digits\r
- if (!fDigitFreelist) fDigitFreelist = AllocDigitFreelist();\r
- AliITSUClusterizerClusterDigit *digit = fDigitFreelist;\r
- fDigitFreelist = fDigitFreelist->fNext;\r
- return digit;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline AliITSUClusterizer::AliITSUClusterizerClusterPart* AliITSUClusterizer::AllocPart()\r
-{\r
- // allocate cluster part\r
- AliITSUClusterizerClusterPart *part=fPartFreelist;\r
- fPartFreelist=fPartFreelist->fNextInRow;\r
- return part;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline AliITSUClusterizer::AliITSUClusterizerClusterCand* AliITSUClusterizer::AllocCand()\r
-{\r
- // allocate cluster \r
- AliITSUClusterizerClusterCand *cand=fCandFreelist;\r
- fCandFreelist=fCandFreelist->fNext;\r
- return cand;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline void AliITSUClusterizer::DeallocDigits(AliITSUClusterizerClusterDigit *first, AliITSUClusterizerClusterDigit *last) \r
-{\r
- // free digit\r
- last->fNext = fDigitFreelist;\r
- fDigitFreelist = first;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline void AliITSUClusterizer::AttachDigitToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterDigit *digit) \r
-{\r
- // attach digit\r
- digit->fNext = cand->fFirstDigit;\r
- cand->fFirstDigit = digit;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-inline void AliITSUClusterizer::DetachPartFromCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part) \r
-{\r
- // remove cluster part \r
- if (part->fPrevInCluster) part->fPrevInCluster->fNextInCluster=part->fNextInCluster;\r
- else cand->fFirstPart=part->fNextInCluster;\r
- if (part->fNextInCluster) part->fNextInCluster->fPrevInCluster=part->fPrevInCluster;\r
-}\r
-\r
-//______________________________________________________________________________\r
-inline void AliITSUClusterizer::AddLabel(int label)\r
-{\r
- // add new label\r
- if (fNLabels==kMaxLabels) return;\r
- for (int i=fNLabels;i--;) if (fCurrLabels[i]==label) return;\r
- fCurrLabels[fNLabels++] = label;\r
-}\r
-\r
-\r
-#endif\r
-\r
+#ifndef ALIITSUCLUSTERIZER_H
+#define ALIITSUCLUSTERIZER_H
+
+#include <TClonesArray.h>
+
+//#define _ClusterTopology_ // uncomment this to produce the tree with cluster topology
+
+class TTree;
+class TObjAray;
+class AliITSUSegmentationPix;
+class AliITSdigit;
+class AliCluster;
+class AliITSUClusterPix;
+class AliITSURecoParam;
+//
+#ifdef _ClusterTopology_
+#include <TBits.h>
+class TFile;
+#endif //_ClusterTopology_
+
+
+class AliITSUClusterizer : public TObject
+{
+ //
+ public:
+ enum {kDigitChunkSize=1024, kMaxLabels=20,kMaxLabInCluster=3};
+ //
+ AliITSUClusterizer(Int_t nrowInit=0);
+ virtual ~AliITSUClusterizer();
+ void SetRawData(Bool_t v=kTRUE) {fRawData = v;}
+ void Clusterize();
+ void SetSegmentation(const AliITSUSegmentationPix *segm);
+ void SetRecoParam(const AliITSURecoParam* param) {fRecoParam = param;}
+ void SetLayerID(Int_t id) {fLayerID = id;}
+ void SetVolID(Int_t id) {fVolID = id;}
+ void SetNRow(Int_t nrow);
+ void SetAllowDiagonalClusterization(Bool_t v) {fAllowDiagonalClusterization = v;}
+ void PrepareLorentzAngleCorrection(Double_t bz);
+ //
+ // interface methods
+ void MakeRecPointBranch(TTree */*treeR*/) {};
+ void SetRecPointTreeAddress(TTree */*treeR*/) {};
+ void DigitsToRecPoints(const TObjArray */*digList*/) {};
+
+ void SetDigits(const TClonesArray *digits) {fInputDigits=digits;fInputDigitsReadIndex=0;}
+ void SetClusters(TClonesArray *clusters) {fOutputClusters=clusters;}
+ //
+ // labeling methods
+ void AddLabel(int label);
+ void CheckLabels();
+ //
+ protected: // transient data types
+ struct AliITSUClusterizerClusterDigit {
+ AliITSUClusterizerClusterDigit *fNext;
+ AliITSdigit *fDigit;
+ };
+
+ struct AliITSUClusterizerClusterCand;
+ struct AliITSUClusterizerClusterPart {
+ AliITSUClusterizerClusterPart *fNextInRow;
+ AliITSUClusterizerClusterPart *fPrevInCluster;
+ AliITSUClusterizerClusterPart *fNextInCluster;
+ AliITSUClusterizerClusterCand *fParent;
+ Int_t fUBegin;
+ Int_t fUEnd;
+ };
+
+ struct AliITSUClusterizerClusterCand {
+ AliITSUClusterizerClusterCand *fNext; // only used for memory management
+ AliITSUClusterizerClusterPart *fFirstPart;
+ AliITSUClusterizerClusterDigit *fFirstDigit;
+ AliITSUClusterizerClusterDigit *fLastDigit ;
+ };
+
+ protected:
+ //
+ // allocation and deallocation
+ AliITSUClusterizerClusterDigit* AllocDigitFreelist();
+ AliITSUClusterizerClusterCand* AllocCand();
+ void DeallocCand(AliITSUClusterizerClusterCand *cand);
+ AliITSUClusterizerClusterPart* AllocPart();
+ void DeallocPart(AliITSUClusterizerClusterPart *part) {DeallocParts(part,part); }
+ void DeallocParts(AliITSUClusterizerClusterPart *first,AliITSUClusterizerClusterPart *last);
+ AliITSUClusterizerClusterDigit* AllocDigit();
+ void DeallocDigit(AliITSUClusterizerClusterDigit *digit) {DeallocDigits(digit,digit);}
+ void DeallocDigits(AliITSUClusterizerClusterDigit *first,AliITSUClusterizerClusterDigit *last);
+
+ // input "iterator"
+ AliITSUClusterizerClusterDigit* NextDigit();
+ // output "iterator"
+ AliCluster* NextCluster() {return (AliCluster*)fOutputClusters->New(fOutputClusters->GetEntriesFast());}
+
+ // modifiers
+ void SetAllowDiagonalClusterization();
+
+ void AttachDigitToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterDigit *digit);
+ void AttachPartToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part);
+ void DetachPartFromCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part);
+ void MergeCands(AliITSUClusterizerClusterCand *a,AliITSUClusterizerClusterCand *b);
+ void Transform(AliITSUClusterPix *cluster, AliITSUClusterizerClusterCand *cand);
+ void CloseCand(AliITSUClusterizerClusterCand *cand);
+ void ClosePart(AliITSUClusterizerClusterPart *part);
+
+ void CloseRemainingParts(AliITSUClusterizerClusterPart *part);
+ //
+ protected:
+ //
+ Int_t fVolID; // Volume id (module index)
+ Bool_t fAllowDiagonalClusterization; // allow clusters with pixels having common corners only
+ const AliITSUSegmentationPix* fSegm; // Segmentation or local coord calc.
+ const AliITSURecoParam* fRecoParam; // reco params
+ //
+ // Digit Input
+ const TClonesArray *fInputDigits; // supplied digits
+ Int_t fInputDigitsReadIndex; // digits counter
+ Int_t fLayerID; // current layer id
+ //
+ Int_t fCurrLabels[kMaxLabels]; // labels collected for current cluster
+ Int_t fNLabels; // number of collected labels
+ Bool_t fRawData; // is raw data processed?
+ //
+ Double_t fLorAngCorrection; // Lorentz Angle correction for current layer
+ // Cluster Output
+ TClonesArray *fOutputClusters; // external container to store clusters
+ //
+ // temporary variables
+ AliITSUClusterizerClusterDigit *fDigitFreelist ; //! pool of local digits
+ AliITSUClusterizerClusterPart *fPartFreelist ; //! pool of unfinished clusters
+ AliITSUClusterizerClusterCand *fCandFreelist ; //! pool of clusters
+ AliITSUClusterizerClusterDigit *fDigitFreelistBptrFirst; //! pointer in the pool
+ AliITSUClusterizerClusterDigit *fDigitFreelistBptrLast ; //! pointer in the pool
+ AliITSUClusterizerClusterPart *fPartFreelistBptr ; //! pointer in the pool
+ AliITSUClusterizerClusterCand *fCandFreelistBptr ; //!pointer in the pool
+ //
+#ifdef _ClusterTopology_
+ TTree* fTreeTopology; // output tree for the cluster topology in the special mode
+ TFile* fFileTopology; // output file for the cluster topology in the special mode
+ TBits fTopology; // container for the clusters topology pattern
+ UShort_t fMinCol; // min col number
+ UShort_t fMinRow; // min row number
+ void InitTopologyTree();
+ void SaveTopologyTree();
+ void FillClusterTopology(AliITSUClusterizerClusterCand *cand);
+#endif //_ClusterTopology_
+ private:
+ AliITSUClusterizer(const AliITSUClusterizer&); //Not implemented
+ AliITSUClusterizer& operator=(const AliITSUClusterizer&); //Not implemented
+ //
+ ClassDef(AliITSUClusterizer,0)
+};
+
+
+//_______________________________________________________________________________
+inline void AliITSUClusterizer::DeallocCand(AliITSUClusterizerClusterCand *cand)
+{
+ // free candidate
+ cand->fNext=fCandFreelist;
+ fCandFreelist=cand;
+}
+
+//_______________________________________________________________________________
+inline void AliITSUClusterizer::DeallocParts(AliITSUClusterizerClusterPart *first,AliITSUClusterizerClusterPart *last)
+{
+ // free cluster part
+ last->fNextInRow=fPartFreelist;
+ fPartFreelist=first;
+}
+
+//_______________________________________________________________________________
+inline AliITSUClusterizer::AliITSUClusterizerClusterDigit* AliITSUClusterizer::AllocDigit()
+{
+ // allocate digits
+ if (!fDigitFreelist) fDigitFreelist = AllocDigitFreelist();
+ AliITSUClusterizerClusterDigit *digit = fDigitFreelist;
+ fDigitFreelist = fDigitFreelist->fNext;
+ return digit;
+}
+
+//_______________________________________________________________________________
+inline AliITSUClusterizer::AliITSUClusterizerClusterPart* AliITSUClusterizer::AllocPart()
+{
+ // allocate cluster part
+ AliITSUClusterizerClusterPart *part=fPartFreelist;
+ fPartFreelist=fPartFreelist->fNextInRow;
+ return part;
+}
+
+//_______________________________________________________________________________
+inline AliITSUClusterizer::AliITSUClusterizerClusterCand* AliITSUClusterizer::AllocCand()
+{
+ // allocate cluster
+ AliITSUClusterizerClusterCand *cand=fCandFreelist;
+ fCandFreelist=fCandFreelist->fNext;
+ return cand;
+}
+
+//_______________________________________________________________________________
+inline void AliITSUClusterizer::DeallocDigits(AliITSUClusterizerClusterDigit *first, AliITSUClusterizerClusterDigit *last)
+{
+ // free digit
+ last->fNext = fDigitFreelist;
+ fDigitFreelist = first;
+}
+
+//_______________________________________________________________________________
+inline void AliITSUClusterizer::AttachDigitToCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterDigit *digit)
+{
+ // attach digit
+ digit->fNext = cand->fFirstDigit;
+ cand->fFirstDigit = digit;
+}
+
+//_______________________________________________________________________________
+inline void AliITSUClusterizer::DetachPartFromCand(AliITSUClusterizerClusterCand *cand,AliITSUClusterizerClusterPart *part)
+{
+ // remove cluster part
+ if (part->fPrevInCluster) part->fPrevInCluster->fNextInCluster=part->fNextInCluster;
+ else cand->fFirstPart=part->fNextInCluster;
+ if (part->fNextInCluster) part->fNextInCluster->fPrevInCluster=part->fPrevInCluster;
+}
+
+//______________________________________________________________________________
+inline void AliITSUClusterizer::AddLabel(int label)
+{
+ // add new label
+ if (fNLabels==kMaxLabels) return;
+ for (int i=fNLabels;i--;) if (fCurrLabels[i]==label) return;
+ fCurrLabels[fNLabels++] = label;
+}
+
+
+#endif
+
-#ifndef AliOADBCentrality_H\r
-#define AliOADBCentrality_H\r
-/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-/* $Id$ */\r
-\r
-//-------------------------------------------------------------------------\r
-// OADB class for run dependent centrality scaling factors and \r
-// data for centrality determination\r
-// Author: Andreas Morsch, CERN\r
-//-------------------------------------------------------------------------\r
-\r
-#include <TNamed.h>\r
-#include <TList.h>\r
-#include <TH1F.h>\r
-#include <TH2F.h>\r
-\r
-\r
-class AliOADBCentrality : public TNamed {\r
-\r
- public :\r
- AliOADBCentrality();\r
- AliOADBCentrality(char* name);\r
- virtual ~AliOADBCentrality();\r
- Float_t V0MScaleFactor() const {return fV0MScaleFactor;}\r
- Float_t SPDScaleFactor() const {return fSPDScaleFactor;}\r
- Float_t TPCScaleFactor() const {return fTPCScaleFactor;}\r
- Float_t V0MScaleFactorMC() const {return fV0MScaleFactorMC;}\r
-\r
- Float_t V0MSPDOutlierPar0() const {return fV0MSPDOutlierPar0 ;}\r
- Float_t V0MSPDOutlierPar1() const {return fV0MSPDOutlierPar1 ;}\r
- Float_t V0MTPCOutlierPar0() const {return fV0MTPCOutlierPar0 ;}\r
- Float_t V0MTPCOutlierPar1() const {return fV0MTPCOutlierPar1 ;}\r
-\r
- Float_t V0MSPDSigmaOutlierPar0() const {return fV0MSPDSigmaOutlierPar0 ;}\r
- Float_t V0MSPDSigmaOutlierPar1() const {return fV0MSPDSigmaOutlierPar1 ;}\r
- Float_t V0MSPDSigmaOutlierPar2() const {return fV0MSPDSigmaOutlierPar2 ;}\r
- Float_t V0MTPCSigmaOutlierPar0() const {return fV0MTPCSigmaOutlierPar0 ;}\r
- Float_t V0MTPCSigmaOutlierPar1() const {return fV0MTPCSigmaOutlierPar1 ;}\r
- Float_t V0MTPCSigmaOutlierPar2() const {return fV0MTPCSigmaOutlierPar2 ;}\r
-\r
- Float_t V0MZDCOutlierPar0() const {return fV0MZDCOutlierPar0 ;}\r
- Float_t V0MZDCOutlierPar1() const {return fV0MZDCOutlierPar1 ;}\r
- Float_t V0MZDCEcalOutlierPar0() const {return fV0MZDCEcalOutlierPar0 ;}\r
- Float_t V0MZDCEcalOutlierPar1() const {return fV0MZDCEcalOutlierPar1 ;}\r
-\r
- Float_t ZVCut() const {return fZVCut;}\r
- Float_t OutliersCut() const {return fOutliersCut;}\r
- Bool_t UseScaling() const {return fUseScaling;}\r
- Bool_t UseCleaning() const {return fUseCleaning;}\r
-\r
- TH1F* V0hist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0M_percentile")));}\r
- TH1F* V0Ahist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0A_percentile")));}\r
- TH1F* V0A123hist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0A123_percentile")));}\r
- TH1F* V0Chist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0C_percentile")));}\r
- TH1F* V0Eqhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MEq_percentile")));}\r
- TH1F* V0AEqhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AEq_percentile")));}\r
- TH1F* V0CEqhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CEq_percentile")));}\r
- TH1F* TPChist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultTRK_percentile")));}\r
- TH1F* CNDhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCND_percentile")));}\r
- TH1F* SPDhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCL1_percentile")));}\r
- TH1F* FMDhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultFMD_percentile")));}\r
- TH1F* ZNAhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNA_percentile")));}\r
- TH1F* ZNChist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNC_percentile")));}\r
- TH1F* ZPAhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPA_percentile")));}\r
- TH1F* ZPChist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPC_percentile")));}\r
- TH2F* ZEMvsZDChist() const {return ((TH2F*) (Hists2D()->FindObject("fHOutMultZEMvsZDC")));}\r
-\r
- TH1F* NPAhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultNPA_percentile")));}\r
- TH1F* NPAhistDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultNPADPM_percentile")));}\r
-\r
- TH1F* V0histtrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0Mtrue_percentile")));}\r
- TH1F* V0Ahisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0Atrue_percentile")));}\r
- TH1F* V0Chisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0Ctrue_percentile")));}\r
- TH1F* V0Eqhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MEqtrue_percentile")));}\r
- TH1F* V0AEqhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AEqtrue_percentile")));}\r
- TH1F* V0CEqhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CEqtrue_percentile")));}\r
- TH1F* TPChisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultTRKtrue_percentile")));}\r
- TH1F* CNDhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCNDtrue_percentile")));}\r
- TH1F* SPDhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCL1true_percentile")));}\r
- TH1F* FMDhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultFMDtrue_percentile")));}\r
- TH1F* ZNAhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNAtrue_percentile")));}\r
- TH1F* ZNChisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNCtrue_percentile")));}\r
- TH1F* ZPAhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPAtrue_percentile")));}\r
- TH1F* ZPChisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPCtrue_percentile")));}\r
- \r
- TH1F* V0histtrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MtrueDPM_percentile")));}\r
- TH1F* V0AhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AtrueDPM_percentile")));}\r
- TH1F* V0ChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CtrueDPM_percentile")));}\r
- TH1F* V0EqhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MEqtrueDPM_percentile")));}\r
- TH1F* V0AEqhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AEqtrueDPM_percentile")));}\r
- TH1F* V0CEqhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CEqtrueDPM_percentile")));}\r
- TH1F* TPChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultTRKtrueDPM_percentile")));}\r
- TH1F* CNDhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCNDtrueDPM_percentile")));}\r
- TH1F* SPDhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCL1trueDPM_percentile")));}\r
- TH1F* FMDhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultFMDtrueDPM_percentile")));}\r
- TH1F* ZNAhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNAtrueDPM_percentile")));}\r
- TH1F* ZNChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNCtrueDPM_percentile")));}\r
- TH1F* ZPAhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPAtrueDPM_percentile")));}\r
- TH1F* ZPChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPCtrueDPM_percentile")));}\r
- TList* Hists1D() const {return f1DHistos;}\r
- TList* Hists2D() const {return f2DHistos;}\r
-\r
- void SetScaleFactors(Float_t v0m, Float_t spd, Float_t tpc, Float_t v0mMC)\r
- {fV0MScaleFactor = v0m; fSPDScaleFactor = spd; fTPCScaleFactor = tpc; fV0MScaleFactorMC = v0mMC;}\r
- \r
- void SetOutlierV0MSPDFactors(Float_t a1, Float_t a2, Float_t a3, Float_t a4, Float_t a5)\r
- {fV0MSPDOutlierPar0=a1;fV0MSPDOutlierPar1=a2;fV0MSPDSigmaOutlierPar0=a3;fV0MSPDSigmaOutlierPar1=a4;fV0MSPDSigmaOutlierPar2=a5;}\r
- \r
- void SetOutlierV0MTPCFactors(Float_t a1, Float_t a2, Float_t a3, Float_t a4, Float_t a5)\r
- {fV0MTPCOutlierPar0=a1;fV0MTPCOutlierPar1=a2;fV0MTPCSigmaOutlierPar0=a3;fV0MTPCSigmaOutlierPar1=a4;fV0MTPCSigmaOutlierPar2=a5;}\r
-\r
- void SetOutlierV0MZDCFactors(Float_t a1, Float_t a2)\r
- {fV0MZDCOutlierPar0=a1;fV0MZDCOutlierPar1=a2;}\r
- \r
- void SetOutlierV0MZDCEcalFactors(Float_t a1, Float_t a2)\r
- {fV0MZDCEcalOutlierPar0=a1;fV0MZDCEcalOutlierPar1=a2;}\r
- \r
- void SetHistReferences(TList* l1, TList* l2)\r
- {f1DHistos = l1; f2DHistos = l2;}\r
-\r
- void SetZVCut(Float_t z)\r
- {fZVCut=z;}\r
-\r
- void SetOutliersCut(Float_t o)\r
- {fOutliersCut=o;}\r
-\r
- void SetUseScaling(Bool_t x)\r
- {fUseScaling=x;}\r
-\r
- void SetUseCleaning(Bool_t x)\r
- {fUseCleaning=x;}\r
-\r
-\r
- private:\r
- AliOADBCentrality(const AliOADBCentrality& cont); \r
- AliOADBCentrality& operator=(const AliOADBCentrality& cont);\r
-\r
- private:\r
- Float_t fV0MScaleFactor; // V0 scale factor\r
- Float_t fSPDScaleFactor; // SPD scale factor\r
- Float_t fTPCScaleFactor; // TPC scale factor\r
- Float_t fV0MScaleFactorMC; // V0 scale factor for MC\r
-\r
- Float_t fV0MSPDOutlierPar0; // V0-SPD outlier parameterisation Par0\r
- Float_t fV0MSPDOutlierPar1; // Par1\r
- Float_t fV0MTPCOutlierPar0; // Par2\r
- Float_t fV0MTPCOutlierPar1; // Par3\r
-\r
- Float_t fV0MSPDSigmaOutlierPar0; // V0-SPD Sigma outlier parameterisation Par0\r
- Float_t fV0MSPDSigmaOutlierPar1; // Par1\r
- Float_t fV0MSPDSigmaOutlierPar2; // Par2\r
- Float_t fV0MTPCSigmaOutlierPar0; // Par3\r
- Float_t fV0MTPCSigmaOutlierPar1; // Par4\r
- Float_t fV0MTPCSigmaOutlierPar2; // Par5\r
-\r
- Float_t fV0MZDCOutlierPar0; // V0-ZDC outlier parameterisation Par0\r
- Float_t fV0MZDCOutlierPar1; // Par1\r
- Float_t fV0MZDCEcalOutlierPar0; // Par2\r
- Float_t fV0MZDCEcalOutlierPar1; // Par3\r
-\r
- Float_t fZVCut; // zV-cut\r
- Float_t fOutliersCut; // outlier cuts\r
- Bool_t fUseScaling; // Flag for scaling\r
- Bool_t fUseCleaning; // Flag for cleaning\r
-\r
- TList* f1DHistos; // Reference to list of 1D Centrality histos \r
- TList* f2DHistos; // Reference to list of 2D Centrality histos\r
- ClassDef(AliOADBCentrality, 3);\r
-};\r
-\r
-#endif\r
+#ifndef AliOADBCentrality_H
+#define AliOADBCentrality_H
+/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+//-------------------------------------------------------------------------
+// OADB class for run dependent centrality scaling factors and
+// data for centrality determination
+// Author: Andreas Morsch, CERN
+//-------------------------------------------------------------------------
+
+#include <TNamed.h>
+#include <TList.h>
+#include <TH1F.h>
+#include <TH2F.h>
+
+
+class AliOADBCentrality : public TNamed {
+
+ public :
+ AliOADBCentrality();
+ AliOADBCentrality(char* name);
+ virtual ~AliOADBCentrality();
+ Float_t V0MScaleFactor() const {return fV0MScaleFactor;}
+ Float_t SPDScaleFactor() const {return fSPDScaleFactor;}
+ Float_t TPCScaleFactor() const {return fTPCScaleFactor;}
+ Float_t V0MScaleFactorMC() const {return fV0MScaleFactorMC;}
+
+ Float_t V0MSPDOutlierPar0() const {return fV0MSPDOutlierPar0 ;}
+ Float_t V0MSPDOutlierPar1() const {return fV0MSPDOutlierPar1 ;}
+ Float_t V0MTPCOutlierPar0() const {return fV0MTPCOutlierPar0 ;}
+ Float_t V0MTPCOutlierPar1() const {return fV0MTPCOutlierPar1 ;}
+
+ Float_t V0MSPDSigmaOutlierPar0() const {return fV0MSPDSigmaOutlierPar0 ;}
+ Float_t V0MSPDSigmaOutlierPar1() const {return fV0MSPDSigmaOutlierPar1 ;}
+ Float_t V0MSPDSigmaOutlierPar2() const {return fV0MSPDSigmaOutlierPar2 ;}
+ Float_t V0MTPCSigmaOutlierPar0() const {return fV0MTPCSigmaOutlierPar0 ;}
+ Float_t V0MTPCSigmaOutlierPar1() const {return fV0MTPCSigmaOutlierPar1 ;}
+ Float_t V0MTPCSigmaOutlierPar2() const {return fV0MTPCSigmaOutlierPar2 ;}
+
+ Float_t V0MZDCOutlierPar0() const {return fV0MZDCOutlierPar0 ;}
+ Float_t V0MZDCOutlierPar1() const {return fV0MZDCOutlierPar1 ;}
+ Float_t V0MZDCEcalOutlierPar0() const {return fV0MZDCEcalOutlierPar0 ;}
+ Float_t V0MZDCEcalOutlierPar1() const {return fV0MZDCEcalOutlierPar1 ;}
+
+ Float_t ZVCut() const {return fZVCut;}
+ Float_t OutliersCut() const {return fOutliersCut;}
+ Bool_t UseScaling() const {return fUseScaling;}
+ Bool_t UseCleaning() const {return fUseCleaning;}
+
+ TH1F* V0hist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0M_percentile")));}
+ TH1F* V0Ahist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0A_percentile")));}
+ TH1F* V0A123hist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0A123_percentile")));}
+ TH1F* V0Chist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0C_percentile")));}
+ TH1F* V0Eqhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MEq_percentile")));}
+ TH1F* V0AEqhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AEq_percentile")));}
+ TH1F* V0CEqhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CEq_percentile")));}
+ TH1F* TPChist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultTRK_percentile")));}
+ TH1F* CNDhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCND_percentile")));}
+ TH1F* SPDhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCL1_percentile")));}
+ TH1F* FMDhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultFMD_percentile")));}
+ TH1F* ZNAhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNA_percentile")));}
+ TH1F* ZNChist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNC_percentile")));}
+ TH1F* ZPAhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPA_percentile")));}
+ TH1F* ZPChist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPC_percentile")));}
+ TH2F* ZEMvsZDChist() const {return ((TH2F*) (Hists2D()->FindObject("fHOutMultZEMvsZDC")));}
+
+ TH1F* NPAhist() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultNPA_percentile")));}
+ TH1F* NPAhistDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultNPADPM_percentile")));}
+
+ TH1F* V0histtrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0Mtrue_percentile")));}
+ TH1F* V0Ahisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0Atrue_percentile")));}
+ TH1F* V0Chisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0Ctrue_percentile")));}
+ TH1F* V0Eqhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MEqtrue_percentile")));}
+ TH1F* V0AEqhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AEqtrue_percentile")));}
+ TH1F* V0CEqhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CEqtrue_percentile")));}
+ TH1F* TPChisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultTRKtrue_percentile")));}
+ TH1F* CNDhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCNDtrue_percentile")));}
+ TH1F* SPDhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCL1true_percentile")));}
+ TH1F* FMDhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultFMDtrue_percentile")));}
+ TH1F* ZNAhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNAtrue_percentile")));}
+ TH1F* ZNChisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNCtrue_percentile")));}
+ TH1F* ZPAhisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPAtrue_percentile")));}
+ TH1F* ZPChisttrue() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPCtrue_percentile")));}
+
+ TH1F* V0histtrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MtrueDPM_percentile")));}
+ TH1F* V0AhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AtrueDPM_percentile")));}
+ TH1F* V0ChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CtrueDPM_percentile")));}
+ TH1F* V0EqhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0MEqtrueDPM_percentile")));}
+ TH1F* V0AEqhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0AEqtrueDPM_percentile")));}
+ TH1F* V0CEqhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultV0CEqtrueDPM_percentile")));}
+ TH1F* TPChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultTRKtrueDPM_percentile")));}
+ TH1F* CNDhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCNDtrueDPM_percentile")));}
+ TH1F* SPDhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultCL1trueDPM_percentile")));}
+ TH1F* FMDhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultFMDtrueDPM_percentile")));}
+ TH1F* ZNAhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNAtrueDPM_percentile")));}
+ TH1F* ZNChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZNCtrueDPM_percentile")));}
+ TH1F* ZPAhisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPAtrueDPM_percentile")));}
+ TH1F* ZPChisttrueDPM() const {return ((TH1F*) (Hists1D()->FindObject("fHOutMultZPCtrueDPM_percentile")));}
+ TList* Hists1D() const {return f1DHistos;}
+ TList* Hists2D() const {return f2DHistos;}
+
+ void SetScaleFactors(Float_t v0m, Float_t spd, Float_t tpc, Float_t v0mMC)
+ {fV0MScaleFactor = v0m; fSPDScaleFactor = spd; fTPCScaleFactor = tpc; fV0MScaleFactorMC = v0mMC;}
+
+ void SetOutlierV0MSPDFactors(Float_t a1, Float_t a2, Float_t a3, Float_t a4, Float_t a5)
+ {fV0MSPDOutlierPar0=a1;fV0MSPDOutlierPar1=a2;fV0MSPDSigmaOutlierPar0=a3;fV0MSPDSigmaOutlierPar1=a4;fV0MSPDSigmaOutlierPar2=a5;}
+
+ void SetOutlierV0MTPCFactors(Float_t a1, Float_t a2, Float_t a3, Float_t a4, Float_t a5)
+ {fV0MTPCOutlierPar0=a1;fV0MTPCOutlierPar1=a2;fV0MTPCSigmaOutlierPar0=a3;fV0MTPCSigmaOutlierPar1=a4;fV0MTPCSigmaOutlierPar2=a5;}
+
+ void SetOutlierV0MZDCFactors(Float_t a1, Float_t a2)
+ {fV0MZDCOutlierPar0=a1;fV0MZDCOutlierPar1=a2;}
+
+ void SetOutlierV0MZDCEcalFactors(Float_t a1, Float_t a2)
+ {fV0MZDCEcalOutlierPar0=a1;fV0MZDCEcalOutlierPar1=a2;}
+
+ void SetHistReferences(TList* l1, TList* l2)
+ {f1DHistos = l1; f2DHistos = l2;}
+
+ void SetZVCut(Float_t z)
+ {fZVCut=z;}
+
+ void SetOutliersCut(Float_t o)
+ {fOutliersCut=o;}
+
+ void SetUseScaling(Bool_t x)
+ {fUseScaling=x;}
+
+ void SetUseCleaning(Bool_t x)
+ {fUseCleaning=x;}
+
+
+ private:
+ AliOADBCentrality(const AliOADBCentrality& cont);
+ AliOADBCentrality& operator=(const AliOADBCentrality& cont);
+
+ private:
+ Float_t fV0MScaleFactor; // V0 scale factor
+ Float_t fSPDScaleFactor; // SPD scale factor
+ Float_t fTPCScaleFactor; // TPC scale factor
+ Float_t fV0MScaleFactorMC; // V0 scale factor for MC
+
+ Float_t fV0MSPDOutlierPar0; // V0-SPD outlier parameterisation Par0
+ Float_t fV0MSPDOutlierPar1; // Par1
+ Float_t fV0MTPCOutlierPar0; // Par2
+ Float_t fV0MTPCOutlierPar1; // Par3
+
+ Float_t fV0MSPDSigmaOutlierPar0; // V0-SPD Sigma outlier parameterisation Par0
+ Float_t fV0MSPDSigmaOutlierPar1; // Par1
+ Float_t fV0MSPDSigmaOutlierPar2; // Par2
+ Float_t fV0MTPCSigmaOutlierPar0; // Par3
+ Float_t fV0MTPCSigmaOutlierPar1; // Par4
+ Float_t fV0MTPCSigmaOutlierPar2; // Par5
+
+ Float_t fV0MZDCOutlierPar0; // V0-ZDC outlier parameterisation Par0
+ Float_t fV0MZDCOutlierPar1; // Par1
+ Float_t fV0MZDCEcalOutlierPar0; // Par2
+ Float_t fV0MZDCEcalOutlierPar1; // Par3
+
+ Float_t fZVCut; // zV-cut
+ Float_t fOutliersCut; // outlier cuts
+ Bool_t fUseScaling; // Flag for scaling
+ Bool_t fUseCleaning; // Flag for cleaning
+
+ TList* f1DHistos; // Reference to list of 1D Centrality histos
+ TList* f2DHistos; // Reference to list of 2D Centrality histos
+ ClassDef(AliOADBCentrality, 3);
+};
+
+#endif
-/**************************************************************************\r
-* Copyright(c) 1998-2008,ALICE Experiment at CERN,All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use,copy,modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee,provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-\r
-/////////////////////////////////////////////////////\r
-// AliAnalysisTaskFlowCascade:\r
-// Analysis task to select Xi and Omega candidates for flow analysis.\r
-//\r
-// Author: Zhong-Bao.Yin@cern.ch\r
-//////////////////////////////////////////////////////\r
-\r
-#include "TChain.h"\r
-#include "TList.h"\r
-#include "TH1D.h"\r
-#include "TH2D.h"\r
-#include "TH3D.h"\r
-#include "TProfile.h"\r
-#include "TVector3.h"\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliAnalysisManager.h"\r
-\r
-#include "AliVParticle.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliESDv0.h"\r
-#include "AliESDcascade.h"\r
-#include "AliESDtrack.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliCentrality.h"\r
-#include "AliVVertex.h"\r
-#include "AliESDVZERO.h"\r
-#include "AliESDUtils.h"\r
-\r
-#include "AliTPCPIDResponse.h"\r
-#include "AliTOFPIDResponse.h"\r
-#include "AliPIDResponse.h"\r
-\r
-#include "AliAODEvent.h"\r
-#include "AliAODInputHandler.h"\r
-#include "AliAODTrack.h"\r
-#include "AliAODVZERO.h"\r
-#include "AliAODcascade.h"\r
-\r
-#include "TMath.h"\r
-#include "TObjArray.h"\r
-#include "AliFlowCandidateTrack.h"\r
-\r
-#include "AliFlowTrackCuts.h"\r
-#include "AliFlowEventCuts.h"\r
-#include "AliFlowEvent.h"\r
-#include "AliFlowCommonConstants.h"\r
-\r
-#include "AliAnalysisTaskFlowCascade.h"\r
-\r
-ClassImp(AliAnalysisTaskFlowCascade)\r
-\r
-//_____________________________________________________________________________\r
- AliAnalysisTaskFlowCascade::AliAnalysisTaskFlowCascade() :\r
- AliAnalysisTaskSE(),\r
- // fMinCent(0), fMaxCent(0),\r
- fSpecie(0),\r
- fMassBins(0),\r
- fMinMass(0.0),\r
- fMaxMass(0.0),\r
- fCutsEvent(NULL),\r
- fCutsRPTPC(NULL),\r
- fCutsRPVZE(NULL),\r
- fCutsPOI(NULL),\r
- fCutsDau(NULL),\r
- fPIDResponse(NULL),\r
- fFlowEventTPC(NULL),\r
- fFlowEventVZE(NULL),\r
- fCandidates(NULL),\r
- fQAList(NULL)\r
-{\r
- //ctor \r
- for (Int_t i=0; i!=8; ++i)\r
- fCascadeCuts[i] = 0;\r
- \r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliAnalysisTaskFlowCascade\r
-::AliAnalysisTaskFlowCascade(const char *name,\r
- AliFlowEventCuts *cutsEvent, \r
- AliFlowTrackCuts *cutsRPTPC,\r
- AliFlowTrackCuts *cutsRPVZE,\r
- /* AliESDtrackCuts */ AliFlowTrackCuts *cutsDau ) :\r
- AliAnalysisTaskSE(name),\r
- //fMinCent(minCent), fMaxCent(maxCent),\r
- fSpecie(0),\r
- fMassBins(0),\r
- fMinMass(0.0),\r
- fMaxMass(0.0),\r
- fCutsEvent(cutsEvent),\r
- fCutsRPTPC(cutsRPTPC),\r
- fCutsRPVZE(cutsRPVZE),\r
- fCutsPOI(NULL),\r
- fCutsDau(cutsDau),\r
- fPIDResponse(NULL),\r
- fFlowEventTPC(NULL),\r
- fFlowEventVZE(NULL),\r
- fCandidates(NULL),\r
- fQAList(NULL)\r
-{\r
- //ctor \r
- for (Int_t i=0; i!=8; ++i)\r
- fCascadeCuts[i] = 0;\r
-\r
- DefineInput( 0,TChain::Class());\r
- DefineOutput(1,AliFlowEventSimple::Class()); // TPC object\r
- DefineOutput(2,AliFlowEventSimple::Class()); // VZE object\r
- DefineOutput(3,TList::Class());\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliAnalysisTaskFlowCascade::~AliAnalysisTaskFlowCascade()\r
-{\r
- if(fQAList) delete fQAList;\r
- if (fFlowEventTPC) delete fFlowEventTPC;\r
- if (fFlowEventVZE) delete fFlowEventVZE;\r
- if (fCandidates) delete fCandidates;\r
- if (fCutsDau) delete fCutsDau;\r
- if (fCutsPOI) delete fCutsPOI;\r
- if (fCutsRPTPC) delete fCutsRPTPC;\r
- if (fCutsRPVZE) delete fCutsRPVZE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::UserCreateOutputObjects()\r
-{\r
-\r
- AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
- AliInputEventHandler* inputHandler\r
- = (AliInputEventHandler*) (man->GetInputEventHandler());\r
- fPIDResponse = inputHandler->GetPIDResponse();\r
- \r
- fQAList = new TList();\r
- fQAList->SetOwner();\r
- AddQAEvents();\r
- AddQACandidates();\r
- // PostData(3,fQAList);\r
-\r
- AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();\r
- cc->SetNbinsMult(1);\r
- cc->SetMultMin(0);\r
- cc->SetMultMax(1);\r
-\r
- cc->SetNbinsPt(20);\r
- cc->SetPtMin(0.0);\r
- cc->SetPtMax(10.0);\r
-\r
- cc->SetNbinsPhi(1);\r
- cc->SetPhiMin(0.0);\r
- cc->SetPhiMax(TMath::TwoPi());\r
-\r
- cc->SetNbinsEta(1);\r
- cc->SetEtaMin(-2.0);\r
- cc->SetEtaMax(+2.0);\r
-\r
- cc->SetNbinsQ(3);\r
- cc->SetQMin(0.0);\r
- cc->SetQMax(3.0);\r
-\r
- cc->SetNbinsMass(fMassBins);\r
- cc->SetMassMin(fMinMass);\r
- cc->SetMassMax(fMaxMass);\r
-\r
- fCutsPOI = new AliFlowTrackCuts("null_cuts");\r
- fCutsPOI->SetParamType(fCutsRPTPC->GetParamType());\r
- fCutsPOI->SetPtRange(+1,-1); // select nothing QUICK \r
- fCutsPOI->SetEtaRange(+1,-1); // select nothing VZERO \r
-\r
- fFlowEventTPC = new AliFlowEvent(3000);\r
- fFlowEventVZE = new AliFlowEvent(1000);\r
- fCandidates = new TObjArray(100);\r
- fCandidates->SetOwner();\r
-\r
- PostData(1,fFlowEventTPC);\r
- PostData(2,fFlowEventVZE);\r
- PostData(3,fQAList);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::AddQAEvents()\r
-{\r
- TList *tQAEvents = new TList();\r
- tQAEvents->SetName("Events");\r
- tQAEvents->SetOwner();\r
- TH1I* tEvent = new TH1I("Event","Number of Events", 3,0,3);\r
- tQAEvents->Add(tEvent);\r
- \r
- TH1D *tTPCRFP = new TH1D("RFPTPC",\r
- "TPC Reference Flow Particles;multiplicity",\r
- 100, 0, 3000); \r
- tQAEvents->Add(tTPCRFP);\r
- TH1D *tVZERFP = new TH1D("RFPVZE", \r
- "VZERO Reference Flow Particles;multiplicity",\r
- 100, 0, 30000); \r
- tQAEvents->Add(tVZERFP);\r
-\r
- TProfile *tCuts = new TProfile("Cuts","Analysis Cuts",10,0,10);\r
- tCuts->Fill(0.5,fCascadeCuts[0],1); \r
- tCuts->GetXaxis()->SetBinLabel(1,"dcaXiDau");\r
- tCuts->Fill(1.5,fCascadeCuts[1],1); \r
- tCuts->GetXaxis()->SetBinLabel(2,"XiCPA");\r
- tCuts->Fill(2.5,fCascadeCuts[2],1); \r
- tCuts->GetXaxis()->SetBinLabel(3,"dcaV0Vtx");\r
- tCuts->Fill(3.5,fCascadeCuts[3],1); \r
- tCuts->GetXaxis()->SetBinLabel(4,"dcaBachVtx");\r
- tCuts->Fill(4.5,fCascadeCuts[4],1); \r
- tCuts->GetXaxis()->SetBinLabel(5,"dcaV0Dau");\r
- tCuts->Fill(5.5,fCascadeCuts[5],1); \r
- tCuts->GetXaxis()->SetBinLabel(6,"V0CPA");\r
- tCuts->Fill(6.5,fCascadeCuts[6],1); \r
- tCuts->GetXaxis()->SetBinLabel(7,"dcaV0DauVtx");\r
- tCuts->Fill(7.5,fCascadeCuts[7],1); \r
- tCuts->GetXaxis()->SetBinLabel(8,"V0Mass");\r
- tQAEvents->Add(tCuts);\r
-\r
- fQAList->Add(tQAEvents);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::AddQACandidates()\r
-{\r
- TList *tQACandidates;\r
- \r
- tQACandidates = new TList();\r
- tQACandidates->SetOwner();\r
- tQACandidates->SetName("Candidates");\r
-\r
- TH1F* tChi2Xi = new TH1F("Chi2Xi", \r
- "Cascade #chi^{2}; #chi^{2}; Number of Cascades", \r
- 160, 0, 160);\r
- tQACandidates->Add(tChi2Xi);\r
-\r
- TH1F* tDCAXiDaughters \r
- = new TH1F( "DcaXiDaughters", \r
- "DCA between Xi Daughters; DCA (cm); Number of Cascades", \r
- 100, 0., 0.5);\r
- tQACandidates->Add(tDCAXiDaughters);\r
-\r
- TH1F * tDCABachToPrimVertex\r
- = new TH1F("DcaBachToPrimVertex", \r
- "DCA of Bach. to Prim. Vertex; DCA (cm);Number of Cascades", \r
- 250, 0., 2.5);\r
- tQACandidates->Add(tDCABachToPrimVertex);\r
- \r
- TH1F * tXiCosOfPointingAngle\r
- = new TH1F("XiCosOfPointingAngle",\r
- "Cos of Xi Pointing Angle; Cos (Xi Point.Angl);Number of Xis", \r
- 200, 0.99, 1.0);\r
- tQACandidates->Add(tXiCosOfPointingAngle);\r
-\r
- TH1F * tXiRadius = new TH1F("XiRadius", \r
- "Casc. decay transv. radius; r (cm); Counts" , \r
- 1050, 0., 105.0 );\r
- tQACandidates->Add(tXiRadius);\r
- \r
- TH1F *tMassLambda \r
- = new TH1F("MassLambdaAsCascDghter",\r
- "#Lambda assoc. to Casc. candidates; Eff. Mass (GeV/c^{2}); Counts", \r
- 300,1.00,1.3);\r
- tQACandidates->Add(tMassLambda);\r
-\r
- TH1F *tV0Chi2 = new TH1F("V0Chi2Xi", \r
- "V0 #chi^{2}, in cascade; #chi^{2};Counts", \r
- 160, 0, 40);\r
- tQACandidates->Add(tV0Chi2);\r
- \r
- TH1F * tV0CosOfPointingAngle \r
- = new TH1F("V0CosOfPointingAngleXi", \r
- "Cos of V0 Pointing Angle, in cascade;Cos(V0 Point. Angl); Counts", \r
- 200, 0.98, 1.0);\r
- tQACandidates->Add(tV0CosOfPointingAngle);\r
-\r
- TH1F *tV0Radius = new TH1F("V0RadiusXi", \r
- "V0 decay radius, in cascade; radius (cm); Counts", \r
- 1050, 0., 105.0);\r
- tQACandidates->Add(tV0Radius);\r
- \r
- TH1F * tDcaV0DaughtersXi \r
- = new TH1F("DcaV0DaughtersXi", \r
- "DCA between V0 daughters, in cascade;DCA (cm);Number of V0s", \r
- 120, 0., 0.6);\r
- tQACandidates->Add(tDcaV0DaughtersXi);\r
-\r
- TH1F * tDcaV0ToPrimVertex \r
- = new TH1F("DcaV0ToPrimVertexXi", \r
- "DCA of V0 to Prim. Vertex, in cascade;DCA (cm);Number of Cascades", 200, 0., 1.);\r
- tQACandidates->Add(tDcaV0ToPrimVertex);\r
-\r
- TH1F * tDCAPosToPrimVertex =\r
- new TH1F("DcaPosToPrimVertexXi", \r
- "DCA of V0 pos daughter to Prim. Vertex;DCA (cm);Counts", \r
- 300, 0, 3);\r
- tQACandidates->Add(tDCAPosToPrimVertex);\r
-\r
- TH1F * tDCANegToPrimVertex \r
- = new TH1F("DcaNegToPrimVertexXi", \r
- "DCA of V0 neg daughter to Prim. Vertex;DCA (cm);Counts", \r
- 300, 0, 3);\r
- tQACandidates->Add(tDCANegToPrimVertex);\r
-\r
- TH1F *tV0toXiCosOfPointingAngle \r
- = new TH1F("V0toXiCosOfPointingAngle", \r
- "Cos. of V0 Ptng Angl Xi vtx; Cos(V0 Point. Angl / Xi vtx); Counts", \r
- 100, 0.99, 1.0);\r
- tQACandidates->Add(tV0toXiCosOfPointingAngle);\r
-\r
- TH2F *th2Armenteros \r
- = new TH2F("Armenteros", \r
- "#alpha_{Arm}(casc. cand.) Vs Pt_{Arm}(casc. cand.); #alpha_{Arm} ; Pt_{Arm} (GeV/c)", \r
- 140, -1.2, 1.2, 300, 0., 0.3);\r
- tQACandidates->Add(th2Armenteros);\r
-\r
- TH2F *th2TPCdEdxOfCascDghters\r
- = new TH2F( "TPCdEdxOfCascDghters",\r
- "TPC dE/dx of the cascade daughters; charge x || #vec{p}_{TPC inner wall}(Casc. daughter) || (GeV/c); TPC signal (ADC) ", \r
- 200, -10.0, 10.0, 450, 0., 900.);\r
- tQACandidates->Add(th2TPCdEdxOfCascDghters);\r
-\r
- TH2F *th2MassVsPtAll \r
- = new TH2F("MassVsPtAll", \r
- "M_{candidates} vs Pt; Pt (GeV/c); M (GeV/c^{2})", \r
- 100, 0., 10., fMassBins, fMinMass, fMaxMass);\r
- tQACandidates->Add(th2MassVsPtAll);\r
-\r
- TH1F *tDistToVtxZAfter \r
- = new TH1F("DistToVtxZAfter", \r
- "Distance to vtx z after propagation to vtx; z [cm]", \r
- 100, -5., 5.);\r
- tQACandidates->Add(tDistToVtxZAfter);\r
-\r
- TH1F * tDistToVtxXYAfter \r
- = new TH1F("DistToVtxXYAfter", \r
- "Distance to vtx xy after propagation to vtx",\r
- 500, 0., 50.);\r
- tQACandidates->Add(tDistToVtxXYAfter);\r
-\r
- TH2F *th2DistToVtxZBeforeVsAfter \r
- = new TH2F("DistToVtxZBeforeVsAfter", \r
- "Distance to vtx z before vs after propagation; Distance before [cm]; Distance after [cm]", \r
- 500, -50., 50., 100, -5., 5.);\r
- tQACandidates->Add(th2DistToVtxZBeforeVsAfter);\r
-\r
- TH2F *th2DistToVtxXYBeforeVsAfter\r
- = new TH2F("DistToVtxXYBeforeVsAfter",\r
- "Distance to vtx xy before vs after propagation; Distance before [cm]; Distance after [cm]", \r
- 500, 0., 50, 500, 0., 50);\r
- tQACandidates->Add(th2DistToVtxXYBeforeVsAfter);\r
-\r
- TH2F * th2PxBeforeVsAfter \r
- = new TH2F("PxBeforeVsAfter", \r
- "Px before vs after propagation; Px [GeV/c]; Px' [GeV/c]", \r
- 200, -10., 10, 200, -10., 10.);\r
- tQACandidates->Add(th2PxBeforeVsAfter);\r
-\r
- TH2F * th2PyBeforeVsAfter\r
- = new TH2F("PyBeforeVsAfter",\r
- "Py before vs after propagation; Py [GeV/c]; Py' [GeV/c]",\r
- 200, -10., 10, 200, -10., 10.);\r
- tQACandidates->Add(th2PyBeforeVsAfter);\r
- \r
- TH2F * th2PhiPosBeforeVsAfter\r
- = new TH2F("PhiPosBeforeVsAfter", \r
- "Phi for positively charged candidates before vs after propagation; #phi; #phi'", \r
- 360, 0., 2.0*TMath::Pi(), 360, 0., 2.0*TMath::Pi());\r
- tQACandidates->Add(th2PhiPosBeforeVsAfter);\r
-\r
- TH2F *th2PhiNegBeforeVsAfter\r
- = new TH2F("PhiNegBeforeVsAfter",\r
- "Phi for negatively charged candidates before vs after propagation; #phi; #phi'",\r
- 360, 0., 2.0*TMath::Pi(), 360, 0., 2.0*TMath::Pi());\r
- tQACandidates->Add(th2PhiNegBeforeVsAfter);\r
-\r
- fQAList->Add(tQACandidates);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::NotifyRun()\r
-{\r
-}\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::UserExec(Option_t *)\r
-{\r
- AliESDEvent *fESD = dynamic_cast<AliESDEvent*>(InputEvent());\r
- AliAODEvent *fAOD = dynamic_cast<AliAODEvent*>(InputEvent());\r
- Bool_t acceptEvent=kFALSE; \r
- fCandidates->SetLast(-1);\r
-\r
- if(fESD) {\r
- // recorrecting VZERO (for pass 1 only)\r
- /*\r
- Float_t *vChCorr = new Float_t[64];\r
- Float_t dummy;\r
- AliESDUtils::GetCorrV0(fESD,dummy,NULL,vChCorr);\r
- AliESDVZERO *vzero = (AliESDVZERO*) fESD->GetVZEROData();\r
- vzero->SetMultiplicity( vChCorr );\r
- delete [] vChCorr;\r
- */\r
- //\r
-\r
- ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(0);\r
- \r
- const AliVVertex *vtxGlb = fESD->GetPrimaryVertexTracks();\r
- const AliVVertex *vtxSPD = fESD->GetPrimaryVertexSPD();\r
- if(!vtxGlb || !vtxSPD) return;\r
- if( fCutsEvent->IsSelected(fESD, 0) && (TMath::Abs(vtxSPD->GetZ()-vtxGlb->GetZ()) <= 0.5) ) {\r
- acceptEvent = kTRUE;\r
- ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(2);\r
- ReadFromESDv0(fESD);\r
- }\r
- } else if(fAOD) {\r
- const AliVVertex *vtxGlb = fAOD->GetPrimaryVertex();\r
- const AliVVertex *vtxSPD = fAOD->GetPrimaryVertexSPD();\r
- if(!vtxGlb || !vtxSPD) return;\r
-\r
- ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(0);\r
- \r
- if(fCutsEvent->IsSelected(fAOD, 0) && (TMath::Abs(vtxSPD->GetZ()-vtxGlb->GetZ()) <= 0.5) ) {\r
- acceptEvent = kTRUE;\r
- ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(2);\r
- ReadFromAODv0(fAOD);\r
- }\r
-\r
- \r
- /*\r
-\r
- AliAODHeader *aodHeader = fAOD->GetHeader();\r
- if(!aodHeader) return;\r
- AliCentrality *centrality = aodHeader->GetCentralityP();\r
- if(!centrality) return;\r
- Double_t cent = centrality->GetCentralityPercentile("V0M" );\r
- Double_t cent1 = centrality->GetCentralityPercentile("TRK" );\r
- if(TMath::Abs(cent-cent1) >= 5.) return;\r
- \r
- if(cent<fMinCent||cent>=fMaxCent) return; //centrality cut\r
- \r
- Double_t zvtx = fAOD->GetPrimaryVertex()->GetZ();\r
- if(TMath::Abs(zvtx)>10.) return; //vertex cut\r
- \r
- ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(2);\r
- ReadFromAODv0(fAOD);\r
- */ \r
- }\r
- \r
- if(!acceptEvent) return;\r
-\r
- ((TH1D*)((TList*)fQAList->FindObject("Events"))->FindObject("RFPTPC"))\r
- ->Fill(fFlowEventTPC->GetNumberOfRPs() );\r
- Double_t mult=0;\r
- for(Int_t i=0; i != fFlowEventVZE->GetNumberOfRPs(); ++i) {\r
- AliFlowTrackSimple *pTrack = fFlowEventVZE->GetTrack(i);\r
- mult += pTrack->Weight();\r
- }\r
- ((TH1D*)((TList*)fQAList->FindObject("Events"))->FindObject("RFPVZE"))\r
- ->Fill( mult );\r
-\r
- // if(fDebug) printf("TPCevent %d | VZEevent %d\n",\r
- // fFlowEventTPC->NumberOfTracks(),\r
- // fFlowEventVZE->NumberOfTracks() );\r
- AddCandidates();\r
-\r
- PostData(1,fFlowEventTPC);\r
- PostData(2,fFlowEventVZE);\r
- PostData(3,fQAList);\r
-\r
- return;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::AddCandidates(){\r
- \r
- // if(fDebug) printf("I received %d candidates\n",\r
- // fCandidates->GetEntriesFast());\r
- for(int iCand=0; iCand!=fCandidates->GetEntriesFast(); ++iCand ) {\r
- AliFlowCandidateTrack *cand \r
- = dynamic_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));\r
- if(!cand) continue;\r
- // if(fDebug) \r
- // printf(" >Checking at candidate %d with %d daughters: mass %f\n",\r
- // iCand, cand->GetNDaughters(), cand->Mass());\r
- \r
- // untagging ===> \r
- for(int iDau=0; iDau != cand->GetNDaughters(); ++iDau) {\r
- // if(fDebug) \r
- // printf(" >Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau));\r
- for(int iRPs=0; iRPs != fFlowEventTPC->NumberOfTracks(); ++iRPs ) {\r
- AliFlowTrack *iRP \r
- = dynamic_cast<AliFlowTrack*>(fFlowEventTPC->GetTrack( iRPs ));\r
- if (!iRP) continue;\r
- if( !iRP->InRPSelection() ) continue;\r
- if( cand->GetIDDaughter(iDau) == iRP->GetID() ) {\r
- //if(fDebug) printf(" was in RP set");\r
- iRP->SetForRPSelection(kFALSE);\r
- fFlowEventTPC->SetNumberOfRPs( fFlowEventTPC->GetNumberOfRPs() -1 );\r
- }\r
- }\r
- //if(fDebug) printf("\n");\r
- }\r
- // <=== untagging\r
- cand->SetForPOISelection(kTRUE);\r
- fFlowEventTPC->InsertTrack( ((AliFlowTrack*) cand) );\r
- fFlowEventVZE->InsertTrack( ((AliFlowTrack*) cand) );\r
- }\r
-\r
- // if(fDebug) printf("TPCevent %d | VZEevent %d\n",\r
- // fFlowEventTPC->NumberOfTracks(),\r
- // fFlowEventVZE->NumberOfTracks() );\r
-\r
-}\r
-\r
-//______________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::ReadFromESDv0(AliESDEvent *fESD)\r
-{\r
- //AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("null_cuts");\r
- //cutsPOI->SetParamType( fCutsRP->GetParamType() );\r
- //cutsPOI->SetParamType( AliFlowTrackCuts::kGlobal );\r
- // cutsPOI->SetPtRange(+1,-1); // select nothing\r
- //cutsPOI->SetEtaRange(+1,-1); // select nothing VZERO\r
-\r
- fCutsRPTPC->SetEvent(fESD,MCEvent());\r
- fCutsRPVZE->SetEvent(fESD,MCEvent());\r
-\r
- fCutsPOI->SetEvent(fESD,MCEvent());\r
-\r
- fFlowEventTPC->Fill(fCutsRPTPC,fCutsPOI);\r
- fFlowEventVZE->Fill(fCutsRPVZE,fCutsPOI);\r
- \r
- Double_t trkPrimaryVtxPos[3] = {-100., -100., -100.};\r
- Double_t bestPrimaryVtxPos[3] = {-100., -100., -100.};\r
- int nCascades=fESD->GetNumberOfCascades();\r
- \r
- const AliESDVertex *primaryTrackingESDVtx = fESD->GetPrimaryVertexTracks();\r
- primaryTrackingESDVtx->GetXYZ(trkPrimaryVtxPos);\r
- \r
- const AliESDVertex *primaryBestESDVtx = fESD->GetPrimaryVertex();\r
- primaryBestESDVtx->GetXYZ(bestPrimaryVtxPos);\r
-\r
- Double_t b = fESD->GetMagneticField();\r
-\r
- for(int i = 0; i != nCascades; ++i) {\r
- \r
- // Double_t trkPrimaryVtxRadius3D = -500.;\r
- // Double_t bestPrimaryVtxRadius3D = -500.;\r
- Double_t effMassXi = 0.;\r
- Double_t chi2Xi = -1.;\r
- Double_t dcaXiDaughters = -1.;\r
- Double_t XiCosOfPointingAngle = -1.;\r
- Double_t posXi[3] = {-1000., -1000., -1000.};\r
- Double_t XiRadius = -1000.;\r
-\r
- // Double_t innerWallMomCascDghters[3] = {-100., -100., -100.};\r
- //Double_t tpcSignalCascDghters[3] = {-100., -100., -100.};\r
-\r
- Double_t invMassLambdaAsCascDghter = 0.;\r
- Double_t V0Chi2Xi = -1.;\r
- Double_t dcaV0DaughtersXi = -1.;\r
- \r
- Double_t dcaBachToPrimaryVtxXi = -1.;\r
- Double_t dcaV0ToPrimaryVtxXi = -1.;\r
- Double_t dcaPosToPrimaryVtxXi = -1.;\r
- Double_t dcaNegToPrimaryVtxXi = -1.;\r
- Double_t V0CosOfPointingAngleXi = -1.;\r
- Double_t posV0Xi[3] = {-1000., -1000., -1000.};\r
- Double_t V0RadiusXi = -1000.;\r
- Double_t V0quality = 0.;\r
-\r
- Double_t invMassXiMinus = 0.;\r
- Double_t invMassXiPlus = 0.;\r
- Double_t invMassOmegaMinus = 0.;\r
- Double_t invMassOmegaPlus = 0.;\r
-\r
- /*\r
- Bool_t isPosInXiProton = kFALSE;\r
- Bool_t isPosInXiPion = kFALSE;\r
- Bool_t isPosInOmegaProton = kFALSE;\r
- Bool_t isPosInOmegaPion = kFALSE;\r
- \r
- Bool_t isNegInXiProton = kFALSE;\r
- Bool_t isNegInXiPion = kFALSE;\r
- Bool_t isNegInOmegaProton = kFALSE;\r
- Bool_t isNegInOmegaPion = kFALSE;\r
-\r
- Bool_t isBachelorKaon = kFALSE;\r
- Bool_t isBachelorPion = kFALSE;\r
- */\r
-\r
- Bool_t isBachelorKaonForTPC = kFALSE;\r
- Bool_t isBachelorPionForTPC = kFALSE;\r
- Bool_t isNegPionForTPC = kFALSE;\r
- Bool_t isPosPionForTPC = kFALSE;\r
- Bool_t isNegProtonForTPC = kFALSE;\r
- Bool_t isPosProtonForTPC = kFALSE;\r
-\r
- Double_t XiPx = 0., XiPy = 0., XiPz = 0.;\r
- Double_t XiPt = 0.;\r
- Double_t XiPtot = 0.;\r
- \r
- Double_t bachPx = 0., bachPy = 0., bachPz = 0.;\r
- Double_t bachPt = 0.;\r
- Double_t bachPtot = 0.;\r
- \r
- //Short_t chargeXi = -2;\r
- Double_t V0toXiCosOfPointingAngle = 0.;\r
- \r
- Double_t rapXi = -20.;\r
- Double_t rapOmega = -20.;\r
- Double_t phi = 6.3;\r
- Double_t alphaXi = -200.;\r
- Double_t ptArmXi = -200.;\r
- // TLorentzVector lv1, lv2, lv3, lv12, lvXi;\r
-\r
- Double_t distToVtxZBefore = -999.;\r
- Double_t distToVtxZAfter = -999.;\r
- Double_t distToVtxXYBefore = -999.;\r
- Double_t distToVtxXYAfter = -999.;\r
- Double_t XiPAfter[3] = {-999., -999., -999.};\r
- Double_t phiAfter = -999.;\r
- \r
- AliESDcascade *xi = fESD->GetCascade(i);\r
- if(!xi) continue;\r
- \r
- if(xi->Charge()<0)\r
- xi->ChangeMassHypothesis(V0quality, 3312); // Xi- hypothesis\r
- else if(xi->Charge() > 0)\r
- xi->ChangeMassHypothesis(V0quality, -3312);\r
- else continue;\r
-\r
- effMassXi = xi->GetEffMassXi();\r
- chi2Xi = xi->GetChi2Xi();\r
- dcaXiDaughters = xi->GetDcaXiDaughters();\r
- XiCosOfPointingAngle \r
- = xi->GetCascadeCosineOfPointingAngle(bestPrimaryVtxPos[0],\r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]);\r
- xi->GetXYZcascade(posXi[0], posXi[1], posXi[2]);\r
- XiRadius = TMath::Sqrt(posXi[0]*posXi[0]\r
- +posXi[1]*posXi[1]\r
- +posXi[2]*posXi[2]);\r
- \r
- UInt_t idxPosXi = (UInt_t)TMath::Abs(xi->GetPindex());\r
- UInt_t idxNegXi = (UInt_t)TMath::Abs(xi->GetNindex());\r
- UInt_t idxBach = (UInt_t)TMath::Abs(xi->GetBindex());\r
-\r
- if(idxBach == idxPosXi || idxBach == idxNegXi) continue;\r
-\r
- AliESDtrack *pTrkXi = fESD->GetTrack(idxPosXi);\r
- AliESDtrack *nTrkXi = fESD->GetTrack(idxNegXi);\r
- AliESDtrack *bTrkXi = fESD->GetTrack(idxBach);\r
-\r
- if( !pTrkXi || !nTrkXi || !bTrkXi ) continue;\r
-\r
- if( !fCutsDau->IsSelected(pTrkXi) \r
- || !fCutsDau->IsSelected(nTrkXi)\r
- || !fCutsDau->IsSelected(bTrkXi) ) continue;\r
-\r
- const AliExternalTrackParam *pExtTrk = pTrkXi->GetInnerParam();\r
- const AliExternalTrackParam *nExtTrk = nTrkXi->GetInnerParam();\r
- const AliExternalTrackParam *bExtTrk = bTrkXi->GetInnerParam();\r
- \r
- if(pExtTrk && pTrkXi->IsOn(AliESDtrack::kTPCin)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(pExtTrk->GetP()*pExtTrk->Charge(), pTrkXi->GetTPCsignal());\r
- }\r
- if(nExtTrk && nTrkXi->IsOn(AliESDtrack::kTPCin)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(nExtTrk->GetP()*nExtTrk->Charge(), nTrkXi->GetTPCsignal());\r
- }\r
- if(bExtTrk && bTrkXi->IsOn(AliESDtrack::kTPCin)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(bExtTrk->GetP()*bExtTrk->Charge(), bTrkXi->GetTPCsignal());\r
- }\r
- \r
- invMassLambdaAsCascDghter = xi->GetEffMass(); // from V0\r
- dcaV0DaughtersXi = xi->GetDcaV0Daughters();\r
- V0Chi2Xi = xi->GetChi2V0();\r
- V0CosOfPointingAngleXi \r
- = xi->GetV0CosineOfPointingAngle(bestPrimaryVtxPos[0],\r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]);\r
- dcaV0ToPrimaryVtxXi = xi->GetD(bestPrimaryVtxPos[0], \r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]);\r
- dcaBachToPrimaryVtxXi = TMath::Abs(bTrkXi->GetD(bestPrimaryVtxPos[0],\r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]));\r
- \r
- //V0\r
- xi->GetXYZ(posV0Xi[0], posV0Xi[1], posV0Xi[2]);\r
- V0RadiusXi = TMath::Sqrt(posV0Xi[0]*posV0Xi[0]\r
- +posV0Xi[1]*posV0Xi[1]\r
- +posV0Xi[2]*posV0Xi[2]);\r
- dcaPosToPrimaryVtxXi = TMath::Abs(pTrkXi->GetD(bestPrimaryVtxPos[0],\r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]));\r
- dcaNegToPrimaryVtxXi = TMath::Abs(nTrkXi->GetD(bestPrimaryVtxPos[0],\r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]));\r
-\r
- //apply cuts\r
- //if(XiRadius < 0.9 || XiRadius > 100.) continue;\r
- //if(dcaXiDaughters > 0.2) continue;\r
- //if(XiCosOfPointingAngle < 0.99) continue;\r
- //if(dcaV0ToPrimaryVtxXi < 0.03) continue;\r
- //if(dcaBachToPrimaryVtxXi < 0.01) continue;\r
- \r
- if(dcaXiDaughters > fCascadeCuts[0]) continue;\r
- if(XiCosOfPointingAngle < fCascadeCuts[1]) continue;\r
- if(dcaV0ToPrimaryVtxXi < fCascadeCuts[2]) continue;\r
- if(dcaBachToPrimaryVtxXi < fCascadeCuts[3]) continue;\r
-\r
- //V0 mass cut?\r
- // if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > 0.01) continue;\r
- if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > fCascadeCuts[7]) \r
- continue;\r
- \r
- //if(dcaV0DaughtersXi > 1.) continue;\r
- //if(V0CosOfPointingAngleXi > 0.9999) continue;\r
- //if(dcaPosToPrimaryVtxXi < 0.1) continue;\r
- //if(dcaNegToPrimaryVtxXi < 0.1) continue;\r
-\r
- if(dcaV0DaughtersXi > fCascadeCuts[4]) continue;\r
- if(V0CosOfPointingAngleXi > fCascadeCuts[5]) continue;\r
- if(dcaPosToPrimaryVtxXi < fCascadeCuts[6]) continue;\r
- if(dcaNegToPrimaryVtxXi < fCascadeCuts[6]) continue;\r
-\r
- //if(V0RadiusXi < 1.0 || V0RadiusXi > 100) continue;\r
- \r
- //other cuts?\r
- // change mass hypothesis to cover all the possibilities\r
- if(bTrkXi->Charge()<0){\r
- V0quality = 0.;\r
- xi->ChangeMassHypothesis(V0quality, 3312); //Xi- hyp.\r
- invMassXiMinus = xi->GetEffMassXi();\r
-\r
- V0quality = 0.;\r
- xi->ChangeMassHypothesis(V0quality, 3334); //Omega- hyp.\r
- invMassOmegaMinus = xi->GetEffMassXi();\r
-\r
- V0quality = 0.;\r
- xi->ChangeMassHypothesis(V0quality, 3312); //back to default hyp.\r
- }\r
-\r
- if(bTrkXi->Charge() > 0){\r
- V0quality = 0.;\r
- xi->ChangeMassHypothesis(V0quality, -3312); //anti-Xi- hyp.\r
- invMassXiPlus = xi->GetEffMassXi();\r
-\r
- V0quality = 0.;\r
- xi->ChangeMassHypothesis(V0quality, -3334); //anti-Omega- hyp.\r
- invMassOmegaPlus = xi->GetEffMassXi();\r
-\r
- V0quality = 0.;\r
- xi->ChangeMassHypothesis(V0quality, -3312); //back to default hyp.\r
- }\r
-\r
- //PID on the daughter tracks\r
- /*\r
- //A - Combined PID\r
- //Resonable guess the priors for the cascade track sample\r
- //(e, mu, pi, K, p)\r
- Double_t priorsGuessXi[5] = {0, 0, 2, 0, 1};\r
- Double_t priorsGuessOmega[5] = {0, 0, 1, 1, 1};\r
-\r
- //Combined bachelor-daughter PID\r
- AliPID pidXi;\r
- pidXi.SetPriors(priorsGuessXi);\r
- AliPID pidOmega;\r
- pidOmega.SetPriors(priorsGuessOmega);\r
-\r
- if(pTrkXi->IsOn(AliESDtrack::kESDpid)){// combined PID exists\r
- Double_t r[10] = {0.};\r
- pTrkXi->GetESDpid(r);\r
- pidXi.SetProbabilities(r);\r
- pidOmega.SetProbabilities(r);\r
-\r
- //Check if the V0 postive track is proton (case for Xi-)\r
- Double_t pProton = pidXi.GetProbability(AliPID::kProton);\r
- if(pProton > pidXi.GetProbability(AliPID::kElectron)\r
- && pProton > pidXi.GetProbability(AliPID::kMuon)\r
- && pProton > pidXi.GetProbability(AliPID::kPion)\r
- && pProton > pidXi.GetProbability(AliPID::kKaon))\r
- isPosInXiProton = kTRUE;\r
- \r
- //Check if the V0 postive track is a pi+ (case for Xi+)\r
- Double_t pPion = pidXi.GetProbability(AliPID::kPion);\r
- if(pPion > pidXi.GetProbability(AliPID::kElectron)\r
- && pPion > pidXi.GetProbability(AliPID::kMuon)\r
- && pPion > pidXi.GetProbability(AliPID::kKaon)\r
- && pPion > pidXi.GetProbability(AliPID::kProton))\r
- isPosInXiPion = kTRUE;\r
- // Check if the V0 positive track is a proton (case for Omega-)\r
- pProton = pidOmega.GetProbability(AliPID::kProton);\r
- if(pProton > pidOmega.GetProbability(AliPID::kElectron)\r
- && pProton > pidOmega.GetProbability(AliPID::kMuon)\r
- && pProton > pidOmega.GetProbability(AliPID::kPion)\r
- && pProton > pidOmega.GetProbability(AliPID::kKaon))\r
- isPosInOmegaProton = kTRUE;\r
- \r
- // Check if the V0 positive track is a pi+ (case for Omega+)\r
- pPion = pidOmega.GetProbability(AliPID::kPion);\r
- if(pPion > pidOmega.GetProbability(AliPID::kElectron)\r
- && pPion > pidOmega.GetProbability(AliPID::kMuon)\r
- && pPion > pidOmega.GetProbability(AliPID::kKaon)\r
- && pPion > pidOmega.GetProbability(AliPID::kProton))\r
- isPosInOmegaPion = kTRUE;\r
- }\r
-\r
- //Combined V0-negative-daughter PID\r
- pidXi.SetPriors(priorsGuessXi);\r
- pidOmega.SetPriors(priorsGuessOmega);\r
- if(nTrkXi->IsOn(AliESDtrack::kESDpid)){\r
- Double_t r[10] = {0.};\r
- nTrkXi->GetESDpid(r);\r
- pidXi.SetProbabilities(r);\r
- pidOmega.SetProbabilities(r);\r
- \r
- // Check if the V0 negative track is a pi- (case for Xi-)\r
- Double_t pPion = pidXi.GetProbability(AliPID::kPion);\r
- if(pPion > pidXi.GetProbability(AliPID::kElectron)\r
- && pPion > pidXi.GetProbability(AliPID::kMuon)\r
- && pPion > pidXi.GetProbability(AliPID::kKaon)\r
- && pPion > pidXi.GetProbability(AliPID::kProton))\r
- isNegInXiPion = kTRUE;\r
-\r
- // Check if the V0 negative track is an anti-proton (case for Xi+)\r
- Double_t pProton = pidXi.GetProbability(AliPID::kProton);\r
- if(pProton > pidXi.GetProbability(AliPID::kElectron)\r
- && pProton > pidXi.GetProbability(AliPID::kMuon)\r
- && pProton > pidXi.GetProbability(AliPID::kPion) \r
- && pProton > pidXi.GetProbability(AliPID::kKaon))\r
- isNegInXiProton = kTRUE;\r
- \r
- // Check if the V0 negative track is a pi- (case for Omega-)\r
- pPion = pidOmega.GetProbability(AliPID::kPion);\r
- if(pPion > pidOmega.GetProbability(AliPID::kElectron)\r
- && pPion > pidOmega.GetProbability(AliPID::kMuon)\r
- && pPion > pidOmega.GetProbability(AliPID::kKaon)\r
- && pPion > pidOmega.GetProbability(AliPID::kProton))\r
- isNegInOmegaPion = kTRUE;\r
- \r
- // Check if the V0 negative track is an anti-proton (case for Omega+) \r
- pProton = pidOmega.GetProbability(AliPID::kProton);\r
- if(pProton > pidOmega.GetProbability(AliPID::kElectron)\r
- && pProton > pidOmega.GetProbability(AliPID::kMuon)\r
- && pProton > pidOmega.GetProbability(AliPID::kPion)\r
- && pProton > pidOmega.GetProbability(AliPID::kKaon))\r
- isNegInOmegaProton = kTRUE;\r
- \r
- }\r
-\r
- // Combined bachelor PID\r
- pidXi.SetPriors(priorsGuessXi);\r
- pidOmega.SetPriors(priorsGuessOmega);\r
- if(bTrkXi->IsOn(AliESDtrack::kESDpid)){//Combined PID exists\r
- Double_t r[10] = {0.};\r
- bTrkXi->GetESDpid(r);\r
- pidXi.SetProbabilities(r);\r
- pidOmega.SetProbabilities(r);\r
- \r
- //Check if the bachelor track is a pion\r
- Double_t pPion = pidXi.GetProbability(AliPID::kPion);\r
- if(pPion > pidXi.GetProbability(AliPID::kElectron)\r
- && pPion > pidXi.GetProbability(AliPID::kMuon)\r
- && pPion > pidXi.GetProbability(AliPID::kKaon)\r
- && pPion > pidXi.GetProbability(AliPID::kProton))\r
- isBachelorPion = kTRUE;\r
- \r
- // Check if the bachelor track is a kaon\r
- Double_t pKaon = pidOmega.GetProbability(AliPID::kKaon);\r
- if(pKaon > pidOmega.GetProbability(AliPID::kElectron)\r
- && pKaon > pidOmega.GetProbability(AliPID::kMuon)\r
- && pKaon > pidOmega.GetProbability(AliPID::kPion)\r
- && pKaon > pidOmega.GetProbability(AliPID::kProton))\r
- isBachelorKaon = kTRUE;\r
- }\r
- */\r
-\r
-\r
- //B - TPC PID: 3-sigma bands on Bethe-Bloch curve\r
- //Bachelor\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kKaon))<3.)\r
- isBachelorKaonForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kPion))<3.)\r
- isBachelorPionForTPC = kTRUE;\r
-\r
- //Negative V0 daughter\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kPion))<3.)\r
- isNegPionForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kProton))<3.)\r
- isNegProtonForTPC = kTRUE;\r
- \r
- //Positive V0 daughter\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kPion))<3.)\r
- isPosPionForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kProton))<3.)\r
- isPosProtonForTPC = kTRUE;\r
- \r
- \r
- //Extra QA information\r
- xi->GetPxPyPz(XiPx, XiPy, XiPz);\r
- XiPt = TMath::Sqrt(XiPx*XiPx + XiPy*XiPy);\r
- XiPtot= TMath::Sqrt(XiPx*XiPx + XiPy*XiPy + XiPz*XiPz);\r
- \r
- XiPAfter[0] = XiPx;\r
- XiPAfter[1] = XiPy;\r
- XiPAfter[2] = XiPz;\r
-\r
- xi->GetBPxPyPz(bachPx, bachPy, bachPz);\r
- bachPt = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy);\r
- bachPtot = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy + bachPz*bachPz);\r
-\r
- //chargeXi = xi->Charge();\r
- \r
- V0toXiCosOfPointingAngle \r
- = xi->GetV0CosineOfPointingAngle(posXi[0], posXi[1], posXi[2]);\r
- rapXi = xi->RapXi();\r
- rapOmega = xi->RapOmega();\r
- phi = xi->Phi();\r
- alphaXi = xi->AlphaXi();\r
- ptArmXi = xi->PtArmXi();\r
-\r
- distToVtxZBefore = posXi[2]-bestPrimaryVtxPos[2];\r
- distToVtxXYBefore \r
- = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])\r
- *(posXi[0] - bestPrimaryVtxPos[0])\r
- +(posXi[1] - bestPrimaryVtxPos[1])\r
- *(posXi[1] - bestPrimaryVtxPos[1]));\r
- \r
- //propagation to the best primary vertex to determine the momentum\r
- Propagate(bestPrimaryVtxPos, posXi, XiPAfter, b, xi->Charge());\r
- distToVtxZAfter = posXi[2] - bestPrimaryVtxPos[2];\r
- distToVtxXYAfter = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])\r
- *(posXi[0] - bestPrimaryVtxPos[0])\r
- +(posXi[1] - bestPrimaryVtxPos[1])\r
- *(posXi[1] - bestPrimaryVtxPos[1]));\r
- phiAfter = TMath::Pi() + TMath::ATan2(-XiPAfter[1],-XiPAfter[0]);\r
- \r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZAfter"))->Fill(distToVtxZAfter);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYAfter"))->Fill(distToVtxXYAfter);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZBeforeVsAfter"))->Fill(distToVtxZBefore, distToVtxZAfter);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYBeforeVsAfter"))->Fill(distToVtxXYBefore, distToVtxXYAfter);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PxBeforeVsAfter"))->Fill(XiPx, XiPAfter[0]);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PyBeforeVsAfter"))->Fill(XiPy, XiPAfter[1]);\r
- if(xi->Charge()>0)\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiPosBeforeVsAfter"))->Fill(phi, phiAfter);\r
- else if(xi->Charge()<0)\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiNegBeforeVsAfter"))->Fill(phi, phiAfter);\r
-\r
- \r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Chi2Xi"))->Fill(chi2Xi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaXiDaughters"))->Fill(dcaXiDaughters);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaBachToPrimVertex"))->Fill(dcaBachToPrimaryVtxXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiCosOfPointingAngle"))->Fill(XiCosOfPointingAngle);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiRadius"))->Fill(XiRadius);\r
- \r
- //V0\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassLambdaAsCascDghter"))->Fill(invMassLambdaAsCascDghter);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0Chi2Xi"))->Fill(V0Chi2Xi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0DaughtersXi"))->Fill(dcaV0DaughtersXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0CosOfPointingAngleXi"))->Fill(V0CosOfPointingAngleXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0RadiusXi"))->Fill(V0RadiusXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0ToPrimVertexXi"))->Fill(dcaV0ToPrimaryVtxXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaPosToPrimVertexXi"))->Fill(dcaPosToPrimaryVtxXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaNegToPrimVertexXi"))->Fill(dcaNegToPrimaryVtxXi);\r
- \r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0toXiCosOfPointingAngle"))->Fill(V0toXiCosOfPointingAngle);\r
- \r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Armenteros"))->Fill(alphaXi, ptArmXi);\r
- \r
- //PID cuts with TPC cuts\r
- if(xi->Charge() < 0){\r
- if(isPosProtonForTPC\r
- && isNegPionForTPC){\r
- \r
- switch(fSpecie) {\r
- case 0:\r
- if(isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiMinus);\r
- \r
- //candidate inserting\r
- MakeTrack(invMassXiMinus, XiPt, /*xi->Phi()*/\r
- phiAfter, xi->Eta(), pTrkXi->GetID(),\r
- nTrkXi->GetID(), bTrkXi->GetID());\r
- }\r
- break;\r
- \r
- case 1:\r
- if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaMinus);\r
- MakeTrack(invMassOmegaMinus, XiPt, /*xi->Phi()*/\r
- phiAfter, xi->Eta(),\r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }\r
- break;\r
- }\r
- }\r
- }\r
-\r
- if(xi->Charge() > 0){\r
- if(isNegProtonForTPC\r
- && isPosPionForTPC){\r
- \r
- switch (fSpecie){\r
- case 0:\r
- if(isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiPlus);\r
- \r
- //candidate inserting \r
- MakeTrack(invMassXiPlus, XiPt, /*xi->Phi()*/\r
- phiAfter, xi->Eta(),\r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }\r
- break;\r
-\r
- case 1:\r
- if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaPlus);\r
- MakeTrack(invMassOmegaPlus, XiPt, /*xi->Phi()*/\r
- phiAfter, xi->Eta(),\r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }\r
- break;\r
- }\r
- }\r
- }\r
- \r
- }\r
-\r
- return;\r
-}\r
-\r
-//______________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::ReadFromAODv0(AliAODEvent *fAOD)\r
-{\r
- \r
- fCutsRPTPC->SetEvent(fAOD, MCEvent());\r
- fCutsRPVZE->SetEvent(fAOD, MCEvent());\r
- fCutsPOI->SetEvent(fAOD, MCEvent());\r
- fFlowEventTPC->Fill(fCutsRPTPC, fCutsPOI);\r
- fFlowEventVZE->Fill(fCutsRPVZE, fCutsPOI);\r
-\r
- // Double_t trkPrimaryVtxPos[3] = {-100., -100., -100.};\r
- Double_t bestPrimaryVtxPos[3] = {-100., -100., -100.};\r
-\r
- Double_t b = fAOD->GetMagneticField();\r
-\r
- int nCascades=fAOD->GetNumberOfCascades();\r
- const AliAODVertex *primaryBestAODVtx = fAOD->GetPrimaryVertex();\r
- primaryBestAODVtx->GetXYZ(bestPrimaryVtxPos);\r
- \r
- // calculation part dedicated to Xi vertices\r
- for(Int_t iXi = 0; iXi < nCascades; iXi++){\r
- Double_t effMassXi = 0.;\r
- Double_t chi2Xi = -1.;\r
- Double_t dcaXiDaughters = -1.;\r
- Double_t XiCosOfPointingAngle = -1.;\r
- Double_t posXi[3] = {-1000., -1000., -1000.};\r
- Double_t XiRadius = -1000.;\r
- \r
- Double_t invMassLambdaAsCascDghter = 0.;\r
- Double_t V0Chi2Xi = -1.;\r
- Double_t dcaV0DaughtersXi = -1.;\r
- \r
- Double_t dcaBachToPrimaryVtxXi = -1.;\r
- Double_t dcaV0ToPrimaryVtxXi = -1.;\r
- Double_t dcaPosToPrimaryVtxXi = -1.;\r
- Double_t dcaNegToPrimaryVtxXi = -1.;\r
- Double_t V0CosOfPointingAngleXi = -1.;\r
- Double_t posV0Xi[3] = {-1000., -1000., -1000.};\r
- Double_t V0RadiusXi = -1000.;\r
- // Double_t V0quality = 0.;\r
-\r
- Double_t invMassXiMinus = 0.;\r
- Double_t invMassXiPlus = 0.;\r
- Double_t invMassOmegaMinus = 0.;\r
- Double_t invMassOmegaPlus = 0.;\r
- \r
- /*\r
- Bool_t isPosInXiProton = kFALSE;\r
- Bool_t isPosInXiPion = kFALSE;\r
- Bool_t isPosInOmegaProton = kFALSE;\r
- Bool_t isPosInOmegaPion = kFALSE;\r
- \r
- Bool_t isNegInXiProton = kFALSE;\r
- Bool_t isNegInXiPion = kFALSE;\r
- Bool_t isNegInOmegaProton = kFALSE;\r
- Bool_t isNegInOmegaPion = kFALSE;\r
-\r
- Bool_t isBachelorKaon = kFALSE;\r
- Bool_t isBachelorPion = kFALSE;\r
- */\r
-\r
-\r
- Bool_t isBachelorKaonForTPC = kFALSE;\r
- Bool_t isBachelorPionForTPC = kFALSE;\r
- Bool_t isNegPionForTPC = kFALSE;\r
- Bool_t isPosPionForTPC = kFALSE;\r
- Bool_t isNegProtonForTPC = kFALSE;\r
- Bool_t isPosProtonForTPC = kFALSE;\r
- \r
- Double_t XiPx = 0., XiPy = 0., XiPz = 0.;\r
- Double_t XiPt = 0.;\r
- Double_t XiPtot = 0.;\r
- \r
- Double_t bachPx = 0., bachPy = 0., bachPz = 0.;\r
- Double_t bachPt = 0.;\r
- Double_t bachPtot = 0.;\r
- \r
- //Short_t chargeXi = -2;\r
- Double_t V0toXiCosOfPointingAngle = 0.;\r
- \r
- Double_t rapXi = -20.;\r
- Double_t rapOmega = -20.;\r
- Double_t phi = 6.3;\r
- Double_t alphaXi = -200.;\r
- Double_t ptArmXi = -200.;\r
-\r
- Double_t distToVtxZBefore = -999.;\r
- Double_t distToVtxZAfter = -999.;\r
- Double_t distToVtxXYBefore = -999.;\r
- Double_t distToVtxXYAfter = -999.;\r
- Double_t XiPAfter[3] = {-999., -999., -999.};\r
- Double_t phiAfter = -999.;\r
-\r
- const AliAODcascade *xi = fAOD->GetCascade(iXi);\r
- if (!xi) continue;\r
-\r
- effMassXi = xi->MassXi(); //default working hypothesis: Xi- decay\r
- chi2Xi = xi->Chi2Xi();\r
- dcaXiDaughters = xi->DcaXiDaughters();\r
- XiCosOfPointingAngle = xi->CosPointingAngleXi(bestPrimaryVtxPos[0],\r
- bestPrimaryVtxPos[1],\r
- bestPrimaryVtxPos[2]);\r
- posXi[0] = xi->DecayVertexXiX();\r
- posXi[1] = xi->DecayVertexXiY();\r
- posXi[2] = xi->DecayVertexXiZ();\r
- XiRadius = TMath::Sqrt(posXi[0]*posXi[0]\r
- +posXi[1]*posXi[1]\r
- +posXi[2]*posXi[2]);\r
-\r
- AliAODTrack *pTrkXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );\r
- AliAODTrack *nTrkXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );\r
- AliAODTrack *bTrkXi \r
- = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );\r
-\r
- if(!pTrkXi || !nTrkXi || !bTrkXi) continue;\r
-\r
- UInt_t idxPosXi = (UInt_t) TMath::Abs( pTrkXi->GetID() );\r
- UInt_t idxNegXi = (UInt_t) TMath::Abs( nTrkXi->GetID() );\r
- UInt_t idxBach = (UInt_t) TMath::Abs( bTrkXi->GetID() );\r
-\r
- if(idxBach == idxNegXi || idxBach == idxPosXi) continue;\r
-\r
- if( !fCutsDau->IsSelected(pTrkXi) \r
- || !fCutsDau->IsSelected(nTrkXi)\r
- || !fCutsDau->IsSelected(bTrkXi) ) continue;\r
-\r
- \r
- if(pTrkXi->IsOn(AliESDtrack::kTPCin)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(pTrkXi->P()*pTrkXi->Charge(), pTrkXi->GetTPCsignal());\r
- }\r
- if( nTrkXi->IsOn(AliESDtrack::kTPCin) ){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(nTrkXi->P()*nTrkXi->Charge(), nTrkXi->GetTPCsignal());\r
- }\r
- if(bTrkXi->IsOn(AliESDtrack::kTPCin)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(bTrkXi->P()*bTrkXi->Charge(), bTrkXi->GetTPCsignal());\r
- }\r
- \r
- if(xi->ChargeXi() < 0)\r
- invMassLambdaAsCascDghter = xi->MassLambda();\r
- else\r
- invMassLambdaAsCascDghter = xi->MassAntiLambda();\r
- \r
- dcaV0DaughtersXi = xi->DcaV0Daughters();\r
- V0Chi2Xi = xi->Chi2V0();\r
- V0CosOfPointingAngleXi \r
- = xi->CosPointingAngle(bestPrimaryVtxPos);\r
- dcaV0ToPrimaryVtxXi = xi->DcaV0ToPrimVertex();\r
- dcaBachToPrimaryVtxXi = xi->DcaBachToPrimVertex();\r
- \r
- //V0\r
- posV0Xi[0] = xi->DecayVertexV0X();\r
- posV0Xi[1] = xi->DecayVertexV0Y();\r
- posV0Xi[2] = xi->DecayVertexV0Z();\r
- V0RadiusXi = TMath::Sqrt(posV0Xi[0]*posV0Xi[0]\r
- +posV0Xi[1]*posV0Xi[1]\r
- +posV0Xi[2]*posV0Xi[2]);\r
- dcaPosToPrimaryVtxXi = xi->DcaPosToPrimVertex();\r
- dcaNegToPrimaryVtxXi = xi->DcaNegToPrimVertex();\r
-\r
- //apply cuts ?\r
- // if(XiRadius < 1. || XiRadius > 100.) continue;\r
- //if(dcaXiDaughters > 0.1) continue;\r
- //if(XiCosOfPointingAngle < 0.999) continue;\r
- //if(dcaV0ToPrimaryVtxXi < 0.05) continue;\r
- //if(dcaBachToPrimaryVtxXi < 0.03) continue;\r
-\r
- if(dcaXiDaughters > fCascadeCuts[0]) continue;\r
- if(XiCosOfPointingAngle < fCascadeCuts[1]) continue;\r
- if(dcaV0ToPrimaryVtxXi < fCascadeCuts[2]) continue;\r
- if(dcaBachToPrimaryVtxXi < fCascadeCuts[3]) continue;\r
- \r
- //V0 mass cut?\r
- //if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > 0.006) continue;\r
- if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > fCascadeCuts[7]) \r
- continue;\r
-\r
- //if(dcaV0DaughtersXi > 1.) continue;\r
- //if(V0CosOfPointingAngleXi > 0.9999) continue;\r
- //if(dcaPosToPrimaryVtxXi < 0.1) continue;\r
- //if(dcaNegToPrimaryVtxXi < 0.1) continue;\r
- if(dcaV0DaughtersXi > fCascadeCuts[4]) continue;\r
- if(V0CosOfPointingAngleXi > fCascadeCuts[5]) continue;\r
- if(dcaPosToPrimaryVtxXi < fCascadeCuts[6]) continue;\r
- if(dcaNegToPrimaryVtxXi < fCascadeCuts[6]) continue;\r
- \r
- // if(V0RadiusXi < 1.0 || V0RadiusXi > 100) continue;\r
- \r
- //other cuts?\r
-\r
-\r
- //???\r
- if(xi->ChargeXi()<0){\r
- invMassXiMinus = xi->MassXi();\r
- invMassOmegaMinus = xi->MassOmega();\r
- }else{\r
- invMassXiPlus = xi->MassXi();\r
- invMassOmegaPlus = xi->MassOmega();\r
- }\r
-\r
- /*\r
- if(pTrkXi->GetMostProbablePID() == AliAODTrack::kProton) {\r
- isPosInXiProton = kTRUE;\r
- isPosInOmegaProton = kTRUE;\r
- }\r
- if(pTrkXi->GetMostProbablePID() == AliAODTrack::kPion){\r
- isPosInXiPion = kTRUE;\r
- isPosInOmegaPion = kTRUE;\r
- }\r
- \r
- if(nTrkXi->GetMostProbablePID() == AliAODTrack::kPion){\r
- isNegInXiPion = kTRUE;\r
- isNegInOmegaPion = kTRUE;\r
- }\r
- if(nTrkXi->GetMostProbablePID() == AliAODTrack::kProton){\r
- isNegInXiProton = kTRUE;\r
- isNegInOmegaProton = kTRUE;\r
- }\r
-\r
- if(bTrkXi->GetMostProbablePID() == AliAODTrack::kPion)\r
- isBachelorPion = kTRUE;\r
- if(bTrkXi->GetMostProbablePID() == AliAODTrack::kKaon)\r
- isBachelorKaon = kTRUE;\r
- */\r
-\r
- //PID with TPC only: \r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kKaon))<3.)\r
- isBachelorKaonForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kPion))<3.)\r
- isBachelorPionForTPC = kTRUE;\r
-\r
- //Negative V0 daughter\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kPion))<3.)\r
- isNegPionForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kProton))<3.)\r
- isNegProtonForTPC = kTRUE;\r
- \r
- //Positive V0 daughter\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kPion))<3.)\r
- isPosPionForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kProton))<3.)\r
- isPosProtonForTPC = kTRUE;\r
-\r
- //Extra QA information\r
- XiPx = xi->MomXiX();\r
- XiPy = xi->MomXiY();\r
- XiPz = xi->MomXiZ();\r
- XiPt = TMath::Sqrt(XiPx*XiPx + XiPy*XiPy);\r
- XiPtot= TMath::Sqrt(XiPx*XiPx + XiPy*XiPy + XiPz*XiPz);\r
- \r
- bachPx = xi->MomBachX();\r
- bachPy = xi->MomBachY();\r
- bachPz = xi->MomBachZ();\r
- \r
- bachPt = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy);\r
- bachPtot = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy + bachPz*bachPz);\r
- \r
- V0toXiCosOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );\r
- \r
- rapXi = xi->RapXi();\r
- rapOmega = xi->RapOmega();\r
- phi = xi->Phi();\r
- alphaXi = xi->AlphaXi();\r
- ptArmXi = xi->PtArmXi();\r
-\r
- distToVtxZBefore = posXi[2]-bestPrimaryVtxPos[2];\r
- distToVtxXYBefore\r
- = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])\r
- *(posXi[0] - bestPrimaryVtxPos[0])\r
- +(posXi[1] - bestPrimaryVtxPos[1])\r
- *(posXi[1] - bestPrimaryVtxPos[1]));\r
-\r
-\r
- XiPAfter[0] = XiPx;\r
- XiPAfter[1] = XiPy;\r
- XiPAfter[2] = XiPz;\r
- //propagation to the best primary vertex to determine the momentum\r
- Propagate(bestPrimaryVtxPos, posXi, XiPAfter, b, xi->ChargeXi());\r
- distToVtxZAfter = posXi[2] - bestPrimaryVtxPos[2];\r
- distToVtxXYAfter = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])\r
- *(posXi[0] - bestPrimaryVtxPos[0])\r
- +(posXi[1] - bestPrimaryVtxPos[1])\r
- *(posXi[1] - bestPrimaryVtxPos[1]));\r
- phiAfter = TMath::Pi() + TMath::ATan2(-XiPAfter[1],-XiPAfter[0]);\r
-\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZAfter"))->Fill(distToVtxZAfter);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYAfter"))->Fill(distToVtxXYAfter);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZBeforeVsAfter"))->Fill(distToVtxZBefore, distToVtxZAfter);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYBeforeVsAfter"))->Fill(distToVtxXYBefore, distToVtxXYAfter);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PxBeforeVsAfter"))->Fill(XiPx, XiPAfter[0]);\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PyBeforeVsAfter"))->Fill(XiPy, XiPAfter[1]);\r
- if(xi->ChargeXi()>0)\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiPosBeforeVsAfter"))->Fill(phi, phiAfter);\r
- else if(xi->ChargeXi()<0)\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiNegBeforeVsAfter"))->Fill(phi, phiAfter);\r
- \r
- //for default hypothesis\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Chi2Xi"))->Fill(chi2Xi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaXiDaughters"))->Fill(dcaXiDaughters);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaBachToPrimVertex"))->Fill(dcaBachToPrimaryVtxXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiCosOfPointingAngle"))->Fill(XiCosOfPointingAngle);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiRadius"))->Fill(XiRadius);\r
- \r
- //V0\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassLambdaAsCascDghter"))->Fill(invMassLambdaAsCascDghter);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0Chi2Xi"))->Fill(V0Chi2Xi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0DaughtersXi"))->Fill(dcaV0DaughtersXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0CosOfPointingAngleXi"))->Fill(V0CosOfPointingAngleXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0RadiusXi"))->Fill(V0RadiusXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0ToPrimVertexXi"))->Fill(dcaV0ToPrimaryVtxXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaPosToPrimVertexXi"))->Fill(dcaPosToPrimaryVtxXi);\r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaNegToPrimVertexXi"))->Fill(dcaNegToPrimaryVtxXi);\r
- \r
- ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0toXiCosOfPointingAngle"))->Fill(V0toXiCosOfPointingAngle);\r
- \r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Armenteros"))->Fill(alphaXi, ptArmXi);\r
- \r
- //with PID cuts\r
- if(xi->ChargeXi()<0){\r
- if(isPosProtonForTPC && isNegPionForTPC){\r
- switch (fSpecie){\r
- case 0:\r
- if( isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiMinus);\r
- MakeTrack(invMassXiMinus, XiPt, /*xi->Phi(),*/\r
- phiAfter, xi->Eta(), \r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }// endif\r
- \r
- break;\r
-\r
- case 1:\r
- if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8\r
- && (invMassXiMinus > 1.32486 || invMassXiMinus < 1.30486)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaMinus); \r
- \r
- MakeTrack(invMassOmegaMinus, XiPt, /* xi->Phi(),*/\r
- phiAfter, xi->Eta(),\r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }//endif\r
- break;\r
- }\r
- }\r
- }//end if ChargeXi()<0\r
- \r
- if(xi->ChargeXi() > 0){\r
- if(isNegProtonForTPC && isPosPionForTPC){ \r
- switch(fSpecie){\r
- case 0:\r
- if (isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiPlus);\r
- \r
- //candidate inserting \r
- MakeTrack(invMassXiPlus, XiPt, /* xi->Phi(),*/\r
- phiAfter, xi->Eta(),\r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }//endif particle id\r
- break;\r
- \r
- case 1:\r
- if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8\r
- && (invMassXiPlus > 1.32486 || invMassXiPlus < 1.30486)){\r
- ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaPlus);\r
- MakeTrack(invMassOmegaPlus, XiPt, /* xi->Phi(),*/\r
- phiAfter, xi->Eta(),\r
- pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());\r
- }//endif particle id\r
- }\r
- }\r
- }//endif ChargeXi()>0 \r
- }//for Xi candidate loop\r
-\r
- return;\r
-\r
-}\r
-\r
-\r
-void AliAnalysisTaskFlowCascade::MakeTrack( double mass, \r
- double pt, \r
- double phi, \r
- double eta, \r
- int iid, \r
- int jid,\r
- int kid) {\r
- // create track for flow tasks \r
- if(fCandidates->GetLast()+1>=fCandidates->GetSize()) {\r
- fCandidates->Expand( 2*fCandidates->GetSize() );\r
- }\r
- Bool_t overwrite = kTRUE;\r
-\r
- AliFlowCandidateTrack *sTrack \r
- = (static_cast<AliFlowCandidateTrack*> (fCandidates->At( fCandidates->GetLast()+1 )));\r
- if( !sTrack ) { // creates new\r
- sTrack = new AliFlowCandidateTrack();\r
- overwrite = kFALSE;\r
- } else { // overwrites\r
- sTrack->ClearMe();\r
- }\r
-\r
-\r
- sTrack->SetMass(mass);\r
- sTrack->SetPt(pt);\r
- sTrack->SetPhi(phi);\r
- sTrack->SetEta(eta);\r
- sTrack->AddDaughter(iid);\r
- sTrack->AddDaughter(jid);\r
- sTrack->AddDaughter(kid);\r
- sTrack->SetForPOISelection(kTRUE);\r
- sTrack->SetForRPSelection(kFALSE);\r
- \r
- if(overwrite) {\r
- fCandidates->SetLast( fCandidates->GetLast()+1 );\r
- } else {\r
- fCandidates->AddLast(sTrack);\r
- }\r
- \r
- return;\r
-}\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFlowCascade::Terminate(Option_t *)\r
-{\r
-\r
-}\r
-\r
-void AliAnalysisTaskFlowCascade::Propagate(Double_t vv[3], \r
- Double_t x[3], \r
- Double_t p[3], \r
- Double_t bz, \r
- Short_t sign){\r
- //Propagation to the primary vertex to determine the px and py\r
- //x, p are the position and momentum as input and output\r
- //bz is the magnetic field along z direction\r
- //sign is the charge of particle for propagation\r
-\r
- Double_t pp = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);\r
- Double_t len = (vv[2]-x[2])*pp/p[2];\r
- Double_t a = -kB2C*bz*sign; \r
-\r
- Double_t rho = a/pp;\r
- x[0] += p[0]*TMath::Sin(rho*len)/a - p[1]*(1-TMath::Cos(rho*len))/a;\r
- x[1] += p[1]*TMath::Sin(rho*len)/a + p[0]*(1-TMath::Cos(rho*len))/a;\r
- x[2] += p[2]*len/pp;\r
-\r
- Double_t p0=p[0];\r
- p[0] = p0 *TMath::Cos(rho*len) - p[1]*TMath::Sin(rho*len);\r
- p[1] = p[1]*TMath::Cos(rho*len) + p0 *TMath::Sin(rho*len);\r
-}\r
-\r
-\r
-//===================================================================== \r
-void AliAnalysisTaskFlowCascade::SetCommonConstants(Int_t massBins, \r
- Double_t minMass, \r
- Double_t maxMass)\r
-{\r
- // setter for mass bins \r
- \r
- fMassBins = massBins;\r
- fMinMass = minMass;\r
- fMaxMass = maxMass;\r
-}\r
-\r
-\r
-//==================================================================== \r
-void AliAnalysisTaskFlowCascade::SetCuts2010(int set) {\r
-\r
- // fCascadeCuts[0]: DcaXiDaughter; fCascadeCuts[1]: XiCosOfPointingAngle\r
- // fCascadeCuts[2]: DcaV0ToPrimaryVtxXi; fCascadeCuts[3]: DcaBachToPrimaryVtxXi\r
- // fCascadeCuts[4]: DcaV0DaughersXi; fCascadeCuts[5]: V0CosOfPointingAngleXi\r
- // fCascadeCuts[6]: DcaV0DaughterToPrimaryVtxXi; fCascadeCuts[7]: V0MassWidth\r
- \r
- switch(set){\r
- \r
- case 0: //tighter\r
- fCascadeCuts[0] = 0.2; fCascadeCuts[1] = 0.999;\r
- fCascadeCuts[2] = 0.03; fCascadeCuts[3] = 0.05;\r
- fCascadeCuts[4] = .5; fCascadeCuts[5] = 0.9998;\r
- fCascadeCuts[6] = 0.1; fCascadeCuts[7] = 0.006;\r
- break;\r
- \r
- case 1: //middle\r
- fCascadeCuts[0] = 0.3; fCascadeCuts[1] = 0.99;\r
- fCascadeCuts[2] = 0.01; fCascadeCuts[3] = 0.03;\r
- fCascadeCuts[4] = .6; fCascadeCuts[5] = 0.9999;\r
- fCascadeCuts[6] = 0.1; fCascadeCuts[7] = 0.008;\r
- break;\r
-\r
- case 2: //looser\r
- fCascadeCuts[0] = 0.3; fCascadeCuts[1] = 0.99;\r
- fCascadeCuts[2] = 0.01; fCascadeCuts[3] = 0.03;\r
- fCascadeCuts[4] = 1.; fCascadeCuts[5] = 1.;\r
- fCascadeCuts[6] = 0.1; fCascadeCuts[7] = 0.01;\r
- break;\r
- }\r
- \r
-}\r
+/**************************************************************************
+* Copyright(c) 1998-2008,ALICE Experiment at CERN,All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use,copy,modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee,provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+/////////////////////////////////////////////////////
+// AliAnalysisTaskFlowCascade:
+// Analysis task to select Xi and Omega candidates for flow analysis.
+//
+// Author: Zhong-Bao.Yin@cern.ch
+//////////////////////////////////////////////////////
+
+#include "TChain.h"
+#include "TList.h"
+#include "TH1D.h"
+#include "TH2D.h"
+#include "TH3D.h"
+#include "TProfile.h"
+#include "TVector3.h"
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisManager.h"
+
+#include "AliVParticle.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliESDv0.h"
+#include "AliESDcascade.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliCentrality.h"
+#include "AliVVertex.h"
+#include "AliESDVZERO.h"
+#include "AliESDUtils.h"
+
+#include "AliTPCPIDResponse.h"
+#include "AliTOFPIDResponse.h"
+#include "AliPIDResponse.h"
+
+#include "AliAODEvent.h"
+#include "AliAODInputHandler.h"
+#include "AliAODTrack.h"
+#include "AliAODVZERO.h"
+#include "AliAODcascade.h"
+
+#include "TMath.h"
+#include "TObjArray.h"
+#include "AliFlowCandidateTrack.h"
+
+#include "AliFlowTrackCuts.h"
+#include "AliFlowEventCuts.h"
+#include "AliFlowEvent.h"
+#include "AliFlowCommonConstants.h"
+
+#include "AliAnalysisTaskFlowCascade.h"
+
+ClassImp(AliAnalysisTaskFlowCascade)
+
+//_____________________________________________________________________________
+ AliAnalysisTaskFlowCascade::AliAnalysisTaskFlowCascade() :
+ AliAnalysisTaskSE(),
+ // fMinCent(0), fMaxCent(0),
+ fSpecie(0),
+ fMassBins(0),
+ fMinMass(0.0),
+ fMaxMass(0.0),
+ fCutsEvent(NULL),
+ fCutsRPTPC(NULL),
+ fCutsRPVZE(NULL),
+ fCutsPOI(NULL),
+ fCutsDau(NULL),
+ fPIDResponse(NULL),
+ fFlowEventTPC(NULL),
+ fFlowEventVZE(NULL),
+ fCandidates(NULL),
+ fQAList(NULL)
+{
+ //ctor
+ for (Int_t i=0; i!=8; ++i)
+ fCascadeCuts[i] = 0;
+
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskFlowCascade
+::AliAnalysisTaskFlowCascade(const char *name,
+ AliFlowEventCuts *cutsEvent,
+ AliFlowTrackCuts *cutsRPTPC,
+ AliFlowTrackCuts *cutsRPVZE,
+ /* AliESDtrackCuts */ AliFlowTrackCuts *cutsDau ) :
+ AliAnalysisTaskSE(name),
+ //fMinCent(minCent), fMaxCent(maxCent),
+ fSpecie(0),
+ fMassBins(0),
+ fMinMass(0.0),
+ fMaxMass(0.0),
+ fCutsEvent(cutsEvent),
+ fCutsRPTPC(cutsRPTPC),
+ fCutsRPVZE(cutsRPVZE),
+ fCutsPOI(NULL),
+ fCutsDau(cutsDau),
+ fPIDResponse(NULL),
+ fFlowEventTPC(NULL),
+ fFlowEventVZE(NULL),
+ fCandidates(NULL),
+ fQAList(NULL)
+{
+ //ctor
+ for (Int_t i=0; i!=8; ++i)
+ fCascadeCuts[i] = 0;
+
+ DefineInput( 0,TChain::Class());
+ DefineOutput(1,AliFlowEventSimple::Class()); // TPC object
+ DefineOutput(2,AliFlowEventSimple::Class()); // VZE object
+ DefineOutput(3,TList::Class());
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskFlowCascade::~AliAnalysisTaskFlowCascade()
+{
+ if(fQAList) delete fQAList;
+ if (fFlowEventTPC) delete fFlowEventTPC;
+ if (fFlowEventVZE) delete fFlowEventVZE;
+ if (fCandidates) delete fCandidates;
+ if (fCutsDau) delete fCutsDau;
+ if (fCutsPOI) delete fCutsPOI;
+ if (fCutsRPTPC) delete fCutsRPTPC;
+ if (fCutsRPVZE) delete fCutsRPVZE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::UserCreateOutputObjects()
+{
+
+ AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler* inputHandler
+ = (AliInputEventHandler*) (man->GetInputEventHandler());
+ fPIDResponse = inputHandler->GetPIDResponse();
+
+ fQAList = new TList();
+ fQAList->SetOwner();
+ AddQAEvents();
+ AddQACandidates();
+ // PostData(3,fQAList);
+
+ AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
+ cc->SetNbinsMult(1);
+ cc->SetMultMin(0);
+ cc->SetMultMax(1);
+
+ cc->SetNbinsPt(20);
+ cc->SetPtMin(0.0);
+ cc->SetPtMax(10.0);
+
+ cc->SetNbinsPhi(1);
+ cc->SetPhiMin(0.0);
+ cc->SetPhiMax(TMath::TwoPi());
+
+ cc->SetNbinsEta(1);
+ cc->SetEtaMin(-2.0);
+ cc->SetEtaMax(+2.0);
+
+ cc->SetNbinsQ(3);
+ cc->SetQMin(0.0);
+ cc->SetQMax(3.0);
+
+ cc->SetNbinsMass(fMassBins);
+ cc->SetMassMin(fMinMass);
+ cc->SetMassMax(fMaxMass);
+
+ fCutsPOI = new AliFlowTrackCuts("null_cuts");
+ fCutsPOI->SetParamType(fCutsRPTPC->GetParamType());
+ fCutsPOI->SetPtRange(+1,-1); // select nothing QUICK
+ fCutsPOI->SetEtaRange(+1,-1); // select nothing VZERO
+
+ fFlowEventTPC = new AliFlowEvent(3000);
+ fFlowEventVZE = new AliFlowEvent(1000);
+ fCandidates = new TObjArray(100);
+ fCandidates->SetOwner();
+
+ PostData(1,fFlowEventTPC);
+ PostData(2,fFlowEventVZE);
+ PostData(3,fQAList);
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::AddQAEvents()
+{
+ TList *tQAEvents = new TList();
+ tQAEvents->SetName("Events");
+ tQAEvents->SetOwner();
+ TH1I* tEvent = new TH1I("Event","Number of Events", 3,0,3);
+ tQAEvents->Add(tEvent);
+
+ TH1D *tTPCRFP = new TH1D("RFPTPC",
+ "TPC Reference Flow Particles;multiplicity",
+ 100, 0, 3000);
+ tQAEvents->Add(tTPCRFP);
+ TH1D *tVZERFP = new TH1D("RFPVZE",
+ "VZERO Reference Flow Particles;multiplicity",
+ 100, 0, 30000);
+ tQAEvents->Add(tVZERFP);
+
+ TProfile *tCuts = new TProfile("Cuts","Analysis Cuts",10,0,10);
+ tCuts->Fill(0.5,fCascadeCuts[0],1);
+ tCuts->GetXaxis()->SetBinLabel(1,"dcaXiDau");
+ tCuts->Fill(1.5,fCascadeCuts[1],1);
+ tCuts->GetXaxis()->SetBinLabel(2,"XiCPA");
+ tCuts->Fill(2.5,fCascadeCuts[2],1);
+ tCuts->GetXaxis()->SetBinLabel(3,"dcaV0Vtx");
+ tCuts->Fill(3.5,fCascadeCuts[3],1);
+ tCuts->GetXaxis()->SetBinLabel(4,"dcaBachVtx");
+ tCuts->Fill(4.5,fCascadeCuts[4],1);
+ tCuts->GetXaxis()->SetBinLabel(5,"dcaV0Dau");
+ tCuts->Fill(5.5,fCascadeCuts[5],1);
+ tCuts->GetXaxis()->SetBinLabel(6,"V0CPA");
+ tCuts->Fill(6.5,fCascadeCuts[6],1);
+ tCuts->GetXaxis()->SetBinLabel(7,"dcaV0DauVtx");
+ tCuts->Fill(7.5,fCascadeCuts[7],1);
+ tCuts->GetXaxis()->SetBinLabel(8,"V0Mass");
+ tQAEvents->Add(tCuts);
+
+ fQAList->Add(tQAEvents);
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::AddQACandidates()
+{
+ TList *tQACandidates;
+
+ tQACandidates = new TList();
+ tQACandidates->SetOwner();
+ tQACandidates->SetName("Candidates");
+
+ TH1F* tChi2Xi = new TH1F("Chi2Xi",
+ "Cascade #chi^{2}; #chi^{2}; Number of Cascades",
+ 160, 0, 160);
+ tQACandidates->Add(tChi2Xi);
+
+ TH1F* tDCAXiDaughters
+ = new TH1F( "DcaXiDaughters",
+ "DCA between Xi Daughters; DCA (cm); Number of Cascades",
+ 100, 0., 0.5);
+ tQACandidates->Add(tDCAXiDaughters);
+
+ TH1F * tDCABachToPrimVertex
+ = new TH1F("DcaBachToPrimVertex",
+ "DCA of Bach. to Prim. Vertex; DCA (cm);Number of Cascades",
+ 250, 0., 2.5);
+ tQACandidates->Add(tDCABachToPrimVertex);
+
+ TH1F * tXiCosOfPointingAngle
+ = new TH1F("XiCosOfPointingAngle",
+ "Cos of Xi Pointing Angle; Cos (Xi Point.Angl);Number of Xis",
+ 200, 0.99, 1.0);
+ tQACandidates->Add(tXiCosOfPointingAngle);
+
+ TH1F * tXiRadius = new TH1F("XiRadius",
+ "Casc. decay transv. radius; r (cm); Counts" ,
+ 1050, 0., 105.0 );
+ tQACandidates->Add(tXiRadius);
+
+ TH1F *tMassLambda
+ = new TH1F("MassLambdaAsCascDghter",
+ "#Lambda assoc. to Casc. candidates; Eff. Mass (GeV/c^{2}); Counts",
+ 300,1.00,1.3);
+ tQACandidates->Add(tMassLambda);
+
+ TH1F *tV0Chi2 = new TH1F("V0Chi2Xi",
+ "V0 #chi^{2}, in cascade; #chi^{2};Counts",
+ 160, 0, 40);
+ tQACandidates->Add(tV0Chi2);
+
+ TH1F * tV0CosOfPointingAngle
+ = new TH1F("V0CosOfPointingAngleXi",
+ "Cos of V0 Pointing Angle, in cascade;Cos(V0 Point. Angl); Counts",
+ 200, 0.98, 1.0);
+ tQACandidates->Add(tV0CosOfPointingAngle);
+
+ TH1F *tV0Radius = new TH1F("V0RadiusXi",
+ "V0 decay radius, in cascade; radius (cm); Counts",
+ 1050, 0., 105.0);
+ tQACandidates->Add(tV0Radius);
+
+ TH1F * tDcaV0DaughtersXi
+ = new TH1F("DcaV0DaughtersXi",
+ "DCA between V0 daughters, in cascade;DCA (cm);Number of V0s",
+ 120, 0., 0.6);
+ tQACandidates->Add(tDcaV0DaughtersXi);
+
+ TH1F * tDcaV0ToPrimVertex
+ = new TH1F("DcaV0ToPrimVertexXi",
+ "DCA of V0 to Prim. Vertex, in cascade;DCA (cm);Number of Cascades", 200, 0., 1.);
+ tQACandidates->Add(tDcaV0ToPrimVertex);
+
+ TH1F * tDCAPosToPrimVertex =
+ new TH1F("DcaPosToPrimVertexXi",
+ "DCA of V0 pos daughter to Prim. Vertex;DCA (cm);Counts",
+ 300, 0, 3);
+ tQACandidates->Add(tDCAPosToPrimVertex);
+
+ TH1F * tDCANegToPrimVertex
+ = new TH1F("DcaNegToPrimVertexXi",
+ "DCA of V0 neg daughter to Prim. Vertex;DCA (cm);Counts",
+ 300, 0, 3);
+ tQACandidates->Add(tDCANegToPrimVertex);
+
+ TH1F *tV0toXiCosOfPointingAngle
+ = new TH1F("V0toXiCosOfPointingAngle",
+ "Cos. of V0 Ptng Angl Xi vtx; Cos(V0 Point. Angl / Xi vtx); Counts",
+ 100, 0.99, 1.0);
+ tQACandidates->Add(tV0toXiCosOfPointingAngle);
+
+ TH2F *th2Armenteros
+ = new TH2F("Armenteros",
+ "#alpha_{Arm}(casc. cand.) Vs Pt_{Arm}(casc. cand.); #alpha_{Arm} ; Pt_{Arm} (GeV/c)",
+ 140, -1.2, 1.2, 300, 0., 0.3);
+ tQACandidates->Add(th2Armenteros);
+
+ TH2F *th2TPCdEdxOfCascDghters
+ = new TH2F( "TPCdEdxOfCascDghters",
+ "TPC dE/dx of the cascade daughters; charge x || #vec{p}_{TPC inner wall}(Casc. daughter) || (GeV/c); TPC signal (ADC) ",
+ 200, -10.0, 10.0, 450, 0., 900.);
+ tQACandidates->Add(th2TPCdEdxOfCascDghters);
+
+ TH2F *th2MassVsPtAll
+ = new TH2F("MassVsPtAll",
+ "M_{candidates} vs Pt; Pt (GeV/c); M (GeV/c^{2})",
+ 100, 0., 10., fMassBins, fMinMass, fMaxMass);
+ tQACandidates->Add(th2MassVsPtAll);
+
+ TH1F *tDistToVtxZAfter
+ = new TH1F("DistToVtxZAfter",
+ "Distance to vtx z after propagation to vtx; z [cm]",
+ 100, -5., 5.);
+ tQACandidates->Add(tDistToVtxZAfter);
+
+ TH1F * tDistToVtxXYAfter
+ = new TH1F("DistToVtxXYAfter",
+ "Distance to vtx xy after propagation to vtx",
+ 500, 0., 50.);
+ tQACandidates->Add(tDistToVtxXYAfter);
+
+ TH2F *th2DistToVtxZBeforeVsAfter
+ = new TH2F("DistToVtxZBeforeVsAfter",
+ "Distance to vtx z before vs after propagation; Distance before [cm]; Distance after [cm]",
+ 500, -50., 50., 100, -5., 5.);
+ tQACandidates->Add(th2DistToVtxZBeforeVsAfter);
+
+ TH2F *th2DistToVtxXYBeforeVsAfter
+ = new TH2F("DistToVtxXYBeforeVsAfter",
+ "Distance to vtx xy before vs after propagation; Distance before [cm]; Distance after [cm]",
+ 500, 0., 50, 500, 0., 50);
+ tQACandidates->Add(th2DistToVtxXYBeforeVsAfter);
+
+ TH2F * th2PxBeforeVsAfter
+ = new TH2F("PxBeforeVsAfter",
+ "Px before vs after propagation; Px [GeV/c]; Px' [GeV/c]",
+ 200, -10., 10, 200, -10., 10.);
+ tQACandidates->Add(th2PxBeforeVsAfter);
+
+ TH2F * th2PyBeforeVsAfter
+ = new TH2F("PyBeforeVsAfter",
+ "Py before vs after propagation; Py [GeV/c]; Py' [GeV/c]",
+ 200, -10., 10, 200, -10., 10.);
+ tQACandidates->Add(th2PyBeforeVsAfter);
+
+ TH2F * th2PhiPosBeforeVsAfter
+ = new TH2F("PhiPosBeforeVsAfter",
+ "Phi for positively charged candidates before vs after propagation; #phi; #phi'",
+ 360, 0., 2.0*TMath::Pi(), 360, 0., 2.0*TMath::Pi());
+ tQACandidates->Add(th2PhiPosBeforeVsAfter);
+
+ TH2F *th2PhiNegBeforeVsAfter
+ = new TH2F("PhiNegBeforeVsAfter",
+ "Phi for negatively charged candidates before vs after propagation; #phi; #phi'",
+ 360, 0., 2.0*TMath::Pi(), 360, 0., 2.0*TMath::Pi());
+ tQACandidates->Add(th2PhiNegBeforeVsAfter);
+
+ fQAList->Add(tQACandidates);
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::NotifyRun()
+{
+}
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::UserExec(Option_t *)
+{
+ AliESDEvent *fESD = dynamic_cast<AliESDEvent*>(InputEvent());
+ AliAODEvent *fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
+ Bool_t acceptEvent=kFALSE;
+ fCandidates->SetLast(-1);
+
+ if(fESD) {
+ // recorrecting VZERO (for pass 1 only)
+ /*
+ Float_t *vChCorr = new Float_t[64];
+ Float_t dummy;
+ AliESDUtils::GetCorrV0(fESD,dummy,NULL,vChCorr);
+ AliESDVZERO *vzero = (AliESDVZERO*) fESD->GetVZEROData();
+ vzero->SetMultiplicity( vChCorr );
+ delete [] vChCorr;
+ */
+ //
+
+ ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(0);
+
+ const AliVVertex *vtxGlb = fESD->GetPrimaryVertexTracks();
+ const AliVVertex *vtxSPD = fESD->GetPrimaryVertexSPD();
+ if(!vtxGlb || !vtxSPD) return;
+ if( fCutsEvent->IsSelected(fESD, 0) && (TMath::Abs(vtxSPD->GetZ()-vtxGlb->GetZ()) <= 0.5) ) {
+ acceptEvent = kTRUE;
+ ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(2);
+ ReadFromESDv0(fESD);
+ }
+ } else if(fAOD) {
+ const AliVVertex *vtxGlb = fAOD->GetPrimaryVertex();
+ const AliVVertex *vtxSPD = fAOD->GetPrimaryVertexSPD();
+ if(!vtxGlb || !vtxSPD) return;
+
+ ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(0);
+
+ if(fCutsEvent->IsSelected(fAOD, 0) && (TMath::Abs(vtxSPD->GetZ()-vtxGlb->GetZ()) <= 0.5) ) {
+ acceptEvent = kTRUE;
+ ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(2);
+ ReadFromAODv0(fAOD);
+ }
+
+
+ /*
+
+ AliAODHeader *aodHeader = fAOD->GetHeader();
+ if(!aodHeader) return;
+ AliCentrality *centrality = aodHeader->GetCentralityP();
+ if(!centrality) return;
+ Double_t cent = centrality->GetCentralityPercentile("V0M" );
+ Double_t cent1 = centrality->GetCentralityPercentile("TRK" );
+ if(TMath::Abs(cent-cent1) >= 5.) return;
+
+ if(cent<fMinCent||cent>=fMaxCent) return; //centrality cut
+
+ Double_t zvtx = fAOD->GetPrimaryVertex()->GetZ();
+ if(TMath::Abs(zvtx)>10.) return; //vertex cut
+
+ ((TH1I*)((TList*)fQAList->FindObject("Events"))->FindObject("Event"))->Fill(2);
+ ReadFromAODv0(fAOD);
+ */
+ }
+
+ if(!acceptEvent) return;
+
+ ((TH1D*)((TList*)fQAList->FindObject("Events"))->FindObject("RFPTPC"))
+ ->Fill(fFlowEventTPC->GetNumberOfRPs() );
+ Double_t mult=0;
+ for(Int_t i=0; i != fFlowEventVZE->GetNumberOfRPs(); ++i) {
+ AliFlowTrackSimple *pTrack = fFlowEventVZE->GetTrack(i);
+ mult += pTrack->Weight();
+ }
+ ((TH1D*)((TList*)fQAList->FindObject("Events"))->FindObject("RFPVZE"))
+ ->Fill( mult );
+
+ // if(fDebug) printf("TPCevent %d | VZEevent %d\n",
+ // fFlowEventTPC->NumberOfTracks(),
+ // fFlowEventVZE->NumberOfTracks() );
+ AddCandidates();
+
+ PostData(1,fFlowEventTPC);
+ PostData(2,fFlowEventVZE);
+ PostData(3,fQAList);
+
+ return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::AddCandidates(){
+
+ // if(fDebug) printf("I received %d candidates\n",
+ // fCandidates->GetEntriesFast());
+ for(int iCand=0; iCand!=fCandidates->GetEntriesFast(); ++iCand ) {
+ AliFlowCandidateTrack *cand
+ = dynamic_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));
+ if(!cand) continue;
+ // if(fDebug)
+ // printf(" >Checking at candidate %d with %d daughters: mass %f\n",
+ // iCand, cand->GetNDaughters(), cand->Mass());
+
+ // untagging ===>
+ for(int iDau=0; iDau != cand->GetNDaughters(); ++iDau) {
+ // if(fDebug)
+ // printf(" >Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau));
+ for(int iRPs=0; iRPs != fFlowEventTPC->NumberOfTracks(); ++iRPs ) {
+ AliFlowTrack *iRP
+ = dynamic_cast<AliFlowTrack*>(fFlowEventTPC->GetTrack( iRPs ));
+ if (!iRP) continue;
+ if( !iRP->InRPSelection() ) continue;
+ if( cand->GetIDDaughter(iDau) == iRP->GetID() ) {
+ //if(fDebug) printf(" was in RP set");
+ iRP->SetForRPSelection(kFALSE);
+ fFlowEventTPC->SetNumberOfRPs( fFlowEventTPC->GetNumberOfRPs() -1 );
+ }
+ }
+ //if(fDebug) printf("\n");
+ }
+ // <=== untagging
+ cand->SetForPOISelection(kTRUE);
+ fFlowEventTPC->InsertTrack( ((AliFlowTrack*) cand) );
+ fFlowEventVZE->InsertTrack( ((AliFlowTrack*) cand) );
+ }
+
+ // if(fDebug) printf("TPCevent %d | VZEevent %d\n",
+ // fFlowEventTPC->NumberOfTracks(),
+ // fFlowEventVZE->NumberOfTracks() );
+
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskFlowCascade::ReadFromESDv0(AliESDEvent *fESD)
+{
+ //AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("null_cuts");
+ //cutsPOI->SetParamType( fCutsRP->GetParamType() );
+ //cutsPOI->SetParamType( AliFlowTrackCuts::kGlobal );
+ // cutsPOI->SetPtRange(+1,-1); // select nothing
+ //cutsPOI->SetEtaRange(+1,-1); // select nothing VZERO
+
+ fCutsRPTPC->SetEvent(fESD,MCEvent());
+ fCutsRPVZE->SetEvent(fESD,MCEvent());
+
+ fCutsPOI->SetEvent(fESD,MCEvent());
+
+ fFlowEventTPC->Fill(fCutsRPTPC,fCutsPOI);
+ fFlowEventVZE->Fill(fCutsRPVZE,fCutsPOI);
+
+ Double_t trkPrimaryVtxPos[3] = {-100., -100., -100.};
+ Double_t bestPrimaryVtxPos[3] = {-100., -100., -100.};
+ int nCascades=fESD->GetNumberOfCascades();
+
+ const AliESDVertex *primaryTrackingESDVtx = fESD->GetPrimaryVertexTracks();
+ primaryTrackingESDVtx->GetXYZ(trkPrimaryVtxPos);
+
+ const AliESDVertex *primaryBestESDVtx = fESD->GetPrimaryVertex();
+ primaryBestESDVtx->GetXYZ(bestPrimaryVtxPos);
+
+ Double_t b = fESD->GetMagneticField();
+
+ for(int i = 0; i != nCascades; ++i) {
+
+ // Double_t trkPrimaryVtxRadius3D = -500.;
+ // Double_t bestPrimaryVtxRadius3D = -500.;
+ Double_t effMassXi = 0.;
+ Double_t chi2Xi = -1.;
+ Double_t dcaXiDaughters = -1.;
+ Double_t XiCosOfPointingAngle = -1.;
+ Double_t posXi[3] = {-1000., -1000., -1000.};
+ Double_t XiRadius = -1000.;
+
+ // Double_t innerWallMomCascDghters[3] = {-100., -100., -100.};
+ //Double_t tpcSignalCascDghters[3] = {-100., -100., -100.};
+
+ Double_t invMassLambdaAsCascDghter = 0.;
+ Double_t V0Chi2Xi = -1.;
+ Double_t dcaV0DaughtersXi = -1.;
+
+ Double_t dcaBachToPrimaryVtxXi = -1.;
+ Double_t dcaV0ToPrimaryVtxXi = -1.;
+ Double_t dcaPosToPrimaryVtxXi = -1.;
+ Double_t dcaNegToPrimaryVtxXi = -1.;
+ Double_t V0CosOfPointingAngleXi = -1.;
+ Double_t posV0Xi[3] = {-1000., -1000., -1000.};
+ Double_t V0RadiusXi = -1000.;
+ Double_t V0quality = 0.;
+
+ Double_t invMassXiMinus = 0.;
+ Double_t invMassXiPlus = 0.;
+ Double_t invMassOmegaMinus = 0.;
+ Double_t invMassOmegaPlus = 0.;
+
+ /*
+ Bool_t isPosInXiProton = kFALSE;
+ Bool_t isPosInXiPion = kFALSE;
+ Bool_t isPosInOmegaProton = kFALSE;
+ Bool_t isPosInOmegaPion = kFALSE;
+
+ Bool_t isNegInXiProton = kFALSE;
+ Bool_t isNegInXiPion = kFALSE;
+ Bool_t isNegInOmegaProton = kFALSE;
+ Bool_t isNegInOmegaPion = kFALSE;
+
+ Bool_t isBachelorKaon = kFALSE;
+ Bool_t isBachelorPion = kFALSE;
+ */
+
+ Bool_t isBachelorKaonForTPC = kFALSE;
+ Bool_t isBachelorPionForTPC = kFALSE;
+ Bool_t isNegPionForTPC = kFALSE;
+ Bool_t isPosPionForTPC = kFALSE;
+ Bool_t isNegProtonForTPC = kFALSE;
+ Bool_t isPosProtonForTPC = kFALSE;
+
+ Double_t XiPx = 0., XiPy = 0., XiPz = 0.;
+ Double_t XiPt = 0.;
+ Double_t XiPtot = 0.;
+
+ Double_t bachPx = 0., bachPy = 0., bachPz = 0.;
+ Double_t bachPt = 0.;
+ Double_t bachPtot = 0.;
+
+ //Short_t chargeXi = -2;
+ Double_t V0toXiCosOfPointingAngle = 0.;
+
+ Double_t rapXi = -20.;
+ Double_t rapOmega = -20.;
+ Double_t phi = 6.3;
+ Double_t alphaXi = -200.;
+ Double_t ptArmXi = -200.;
+ // TLorentzVector lv1, lv2, lv3, lv12, lvXi;
+
+ Double_t distToVtxZBefore = -999.;
+ Double_t distToVtxZAfter = -999.;
+ Double_t distToVtxXYBefore = -999.;
+ Double_t distToVtxXYAfter = -999.;
+ Double_t XiPAfter[3] = {-999., -999., -999.};
+ Double_t phiAfter = -999.;
+
+ AliESDcascade *xi = fESD->GetCascade(i);
+ if(!xi) continue;
+
+ if(xi->Charge()<0)
+ xi->ChangeMassHypothesis(V0quality, 3312); // Xi- hypothesis
+ else if(xi->Charge() > 0)
+ xi->ChangeMassHypothesis(V0quality, -3312);
+ else continue;
+
+ effMassXi = xi->GetEffMassXi();
+ chi2Xi = xi->GetChi2Xi();
+ dcaXiDaughters = xi->GetDcaXiDaughters();
+ XiCosOfPointingAngle
+ = xi->GetCascadeCosineOfPointingAngle(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]);
+ xi->GetXYZcascade(posXi[0], posXi[1], posXi[2]);
+ XiRadius = TMath::Sqrt(posXi[0]*posXi[0]
+ +posXi[1]*posXi[1]
+ +posXi[2]*posXi[2]);
+
+ UInt_t idxPosXi = (UInt_t)TMath::Abs(xi->GetPindex());
+ UInt_t idxNegXi = (UInt_t)TMath::Abs(xi->GetNindex());
+ UInt_t idxBach = (UInt_t)TMath::Abs(xi->GetBindex());
+
+ if(idxBach == idxPosXi || idxBach == idxNegXi) continue;
+
+ AliESDtrack *pTrkXi = fESD->GetTrack(idxPosXi);
+ AliESDtrack *nTrkXi = fESD->GetTrack(idxNegXi);
+ AliESDtrack *bTrkXi = fESD->GetTrack(idxBach);
+
+ if( !pTrkXi || !nTrkXi || !bTrkXi ) continue;
+
+ if( !fCutsDau->IsSelected(pTrkXi)
+ || !fCutsDau->IsSelected(nTrkXi)
+ || !fCutsDau->IsSelected(bTrkXi) ) continue;
+
+ const AliExternalTrackParam *pExtTrk = pTrkXi->GetInnerParam();
+ const AliExternalTrackParam *nExtTrk = nTrkXi->GetInnerParam();
+ const AliExternalTrackParam *bExtTrk = bTrkXi->GetInnerParam();
+
+ if(pExtTrk && pTrkXi->IsOn(AliESDtrack::kTPCin)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(pExtTrk->GetP()*pExtTrk->Charge(), pTrkXi->GetTPCsignal());
+ }
+ if(nExtTrk && nTrkXi->IsOn(AliESDtrack::kTPCin)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(nExtTrk->GetP()*nExtTrk->Charge(), nTrkXi->GetTPCsignal());
+ }
+ if(bExtTrk && bTrkXi->IsOn(AliESDtrack::kTPCin)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(bExtTrk->GetP()*bExtTrk->Charge(), bTrkXi->GetTPCsignal());
+ }
+
+ invMassLambdaAsCascDghter = xi->GetEffMass(); // from V0
+ dcaV0DaughtersXi = xi->GetDcaV0Daughters();
+ V0Chi2Xi = xi->GetChi2V0();
+ V0CosOfPointingAngleXi
+ = xi->GetV0CosineOfPointingAngle(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]);
+ dcaV0ToPrimaryVtxXi = xi->GetD(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]);
+ dcaBachToPrimaryVtxXi = TMath::Abs(bTrkXi->GetD(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]));
+
+ //V0
+ xi->GetXYZ(posV0Xi[0], posV0Xi[1], posV0Xi[2]);
+ V0RadiusXi = TMath::Sqrt(posV0Xi[0]*posV0Xi[0]
+ +posV0Xi[1]*posV0Xi[1]
+ +posV0Xi[2]*posV0Xi[2]);
+ dcaPosToPrimaryVtxXi = TMath::Abs(pTrkXi->GetD(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]));
+ dcaNegToPrimaryVtxXi = TMath::Abs(nTrkXi->GetD(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]));
+
+ //apply cuts
+ //if(XiRadius < 0.9 || XiRadius > 100.) continue;
+ //if(dcaXiDaughters > 0.2) continue;
+ //if(XiCosOfPointingAngle < 0.99) continue;
+ //if(dcaV0ToPrimaryVtxXi < 0.03) continue;
+ //if(dcaBachToPrimaryVtxXi < 0.01) continue;
+
+ if(dcaXiDaughters > fCascadeCuts[0]) continue;
+ if(XiCosOfPointingAngle < fCascadeCuts[1]) continue;
+ if(dcaV0ToPrimaryVtxXi < fCascadeCuts[2]) continue;
+ if(dcaBachToPrimaryVtxXi < fCascadeCuts[3]) continue;
+
+ //V0 mass cut?
+ // if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > 0.01) continue;
+ if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > fCascadeCuts[7])
+ continue;
+
+ //if(dcaV0DaughtersXi > 1.) continue;
+ //if(V0CosOfPointingAngleXi > 0.9999) continue;
+ //if(dcaPosToPrimaryVtxXi < 0.1) continue;
+ //if(dcaNegToPrimaryVtxXi < 0.1) continue;
+
+ if(dcaV0DaughtersXi > fCascadeCuts[4]) continue;
+ if(V0CosOfPointingAngleXi > fCascadeCuts[5]) continue;
+ if(dcaPosToPrimaryVtxXi < fCascadeCuts[6]) continue;
+ if(dcaNegToPrimaryVtxXi < fCascadeCuts[6]) continue;
+
+ //if(V0RadiusXi < 1.0 || V0RadiusXi > 100) continue;
+
+ //other cuts?
+ // change mass hypothesis to cover all the possibilities
+ if(bTrkXi->Charge()<0){
+ V0quality = 0.;
+ xi->ChangeMassHypothesis(V0quality, 3312); //Xi- hyp.
+ invMassXiMinus = xi->GetEffMassXi();
+
+ V0quality = 0.;
+ xi->ChangeMassHypothesis(V0quality, 3334); //Omega- hyp.
+ invMassOmegaMinus = xi->GetEffMassXi();
+
+ V0quality = 0.;
+ xi->ChangeMassHypothesis(V0quality, 3312); //back to default hyp.
+ }
+
+ if(bTrkXi->Charge() > 0){
+ V0quality = 0.;
+ xi->ChangeMassHypothesis(V0quality, -3312); //anti-Xi- hyp.
+ invMassXiPlus = xi->GetEffMassXi();
+
+ V0quality = 0.;
+ xi->ChangeMassHypothesis(V0quality, -3334); //anti-Omega- hyp.
+ invMassOmegaPlus = xi->GetEffMassXi();
+
+ V0quality = 0.;
+ xi->ChangeMassHypothesis(V0quality, -3312); //back to default hyp.
+ }
+
+ //PID on the daughter tracks
+ /*
+ //A - Combined PID
+ //Resonable guess the priors for the cascade track sample
+ //(e, mu, pi, K, p)
+ Double_t priorsGuessXi[5] = {0, 0, 2, 0, 1};
+ Double_t priorsGuessOmega[5] = {0, 0, 1, 1, 1};
+
+ //Combined bachelor-daughter PID
+ AliPID pidXi;
+ pidXi.SetPriors(priorsGuessXi);
+ AliPID pidOmega;
+ pidOmega.SetPriors(priorsGuessOmega);
+
+ if(pTrkXi->IsOn(AliESDtrack::kESDpid)){// combined PID exists
+ Double_t r[10] = {0.};
+ pTrkXi->GetESDpid(r);
+ pidXi.SetProbabilities(r);
+ pidOmega.SetProbabilities(r);
+
+ //Check if the V0 postive track is proton (case for Xi-)
+ Double_t pProton = pidXi.GetProbability(AliPID::kProton);
+ if(pProton > pidXi.GetProbability(AliPID::kElectron)
+ && pProton > pidXi.GetProbability(AliPID::kMuon)
+ && pProton > pidXi.GetProbability(AliPID::kPion)
+ && pProton > pidXi.GetProbability(AliPID::kKaon))
+ isPosInXiProton = kTRUE;
+
+ //Check if the V0 postive track is a pi+ (case for Xi+)
+ Double_t pPion = pidXi.GetProbability(AliPID::kPion);
+ if(pPion > pidXi.GetProbability(AliPID::kElectron)
+ && pPion > pidXi.GetProbability(AliPID::kMuon)
+ && pPion > pidXi.GetProbability(AliPID::kKaon)
+ && pPion > pidXi.GetProbability(AliPID::kProton))
+ isPosInXiPion = kTRUE;
+ // Check if the V0 positive track is a proton (case for Omega-)
+ pProton = pidOmega.GetProbability(AliPID::kProton);
+ if(pProton > pidOmega.GetProbability(AliPID::kElectron)
+ && pProton > pidOmega.GetProbability(AliPID::kMuon)
+ && pProton > pidOmega.GetProbability(AliPID::kPion)
+ && pProton > pidOmega.GetProbability(AliPID::kKaon))
+ isPosInOmegaProton = kTRUE;
+
+ // Check if the V0 positive track is a pi+ (case for Omega+)
+ pPion = pidOmega.GetProbability(AliPID::kPion);
+ if(pPion > pidOmega.GetProbability(AliPID::kElectron)
+ && pPion > pidOmega.GetProbability(AliPID::kMuon)
+ && pPion > pidOmega.GetProbability(AliPID::kKaon)
+ && pPion > pidOmega.GetProbability(AliPID::kProton))
+ isPosInOmegaPion = kTRUE;
+ }
+
+ //Combined V0-negative-daughter PID
+ pidXi.SetPriors(priorsGuessXi);
+ pidOmega.SetPriors(priorsGuessOmega);
+ if(nTrkXi->IsOn(AliESDtrack::kESDpid)){
+ Double_t r[10] = {0.};
+ nTrkXi->GetESDpid(r);
+ pidXi.SetProbabilities(r);
+ pidOmega.SetProbabilities(r);
+
+ // Check if the V0 negative track is a pi- (case for Xi-)
+ Double_t pPion = pidXi.GetProbability(AliPID::kPion);
+ if(pPion > pidXi.GetProbability(AliPID::kElectron)
+ && pPion > pidXi.GetProbability(AliPID::kMuon)
+ && pPion > pidXi.GetProbability(AliPID::kKaon)
+ && pPion > pidXi.GetProbability(AliPID::kProton))
+ isNegInXiPion = kTRUE;
+
+ // Check if the V0 negative track is an anti-proton (case for Xi+)
+ Double_t pProton = pidXi.GetProbability(AliPID::kProton);
+ if(pProton > pidXi.GetProbability(AliPID::kElectron)
+ && pProton > pidXi.GetProbability(AliPID::kMuon)
+ && pProton > pidXi.GetProbability(AliPID::kPion)
+ && pProton > pidXi.GetProbability(AliPID::kKaon))
+ isNegInXiProton = kTRUE;
+
+ // Check if the V0 negative track is a pi- (case for Omega-)
+ pPion = pidOmega.GetProbability(AliPID::kPion);
+ if(pPion > pidOmega.GetProbability(AliPID::kElectron)
+ && pPion > pidOmega.GetProbability(AliPID::kMuon)
+ && pPion > pidOmega.GetProbability(AliPID::kKaon)
+ && pPion > pidOmega.GetProbability(AliPID::kProton))
+ isNegInOmegaPion = kTRUE;
+
+ // Check if the V0 negative track is an anti-proton (case for Omega+)
+ pProton = pidOmega.GetProbability(AliPID::kProton);
+ if(pProton > pidOmega.GetProbability(AliPID::kElectron)
+ && pProton > pidOmega.GetProbability(AliPID::kMuon)
+ && pProton > pidOmega.GetProbability(AliPID::kPion)
+ && pProton > pidOmega.GetProbability(AliPID::kKaon))
+ isNegInOmegaProton = kTRUE;
+
+ }
+
+ // Combined bachelor PID
+ pidXi.SetPriors(priorsGuessXi);
+ pidOmega.SetPriors(priorsGuessOmega);
+ if(bTrkXi->IsOn(AliESDtrack::kESDpid)){//Combined PID exists
+ Double_t r[10] = {0.};
+ bTrkXi->GetESDpid(r);
+ pidXi.SetProbabilities(r);
+ pidOmega.SetProbabilities(r);
+
+ //Check if the bachelor track is a pion
+ Double_t pPion = pidXi.GetProbability(AliPID::kPion);
+ if(pPion > pidXi.GetProbability(AliPID::kElectron)
+ && pPion > pidXi.GetProbability(AliPID::kMuon)
+ && pPion > pidXi.GetProbability(AliPID::kKaon)
+ && pPion > pidXi.GetProbability(AliPID::kProton))
+ isBachelorPion = kTRUE;
+
+ // Check if the bachelor track is a kaon
+ Double_t pKaon = pidOmega.GetProbability(AliPID::kKaon);
+ if(pKaon > pidOmega.GetProbability(AliPID::kElectron)
+ && pKaon > pidOmega.GetProbability(AliPID::kMuon)
+ && pKaon > pidOmega.GetProbability(AliPID::kPion)
+ && pKaon > pidOmega.GetProbability(AliPID::kProton))
+ isBachelorKaon = kTRUE;
+ }
+ */
+
+
+ //B - TPC PID: 3-sigma bands on Bethe-Bloch curve
+ //Bachelor
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kKaon))<3.)
+ isBachelorKaonForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kPion))<3.)
+ isBachelorPionForTPC = kTRUE;
+
+ //Negative V0 daughter
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kPion))<3.)
+ isNegPionForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kProton))<3.)
+ isNegProtonForTPC = kTRUE;
+
+ //Positive V0 daughter
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kPion))<3.)
+ isPosPionForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kProton))<3.)
+ isPosProtonForTPC = kTRUE;
+
+
+ //Extra QA information
+ xi->GetPxPyPz(XiPx, XiPy, XiPz);
+ XiPt = TMath::Sqrt(XiPx*XiPx + XiPy*XiPy);
+ XiPtot= TMath::Sqrt(XiPx*XiPx + XiPy*XiPy + XiPz*XiPz);
+
+ XiPAfter[0] = XiPx;
+ XiPAfter[1] = XiPy;
+ XiPAfter[2] = XiPz;
+
+ xi->GetBPxPyPz(bachPx, bachPy, bachPz);
+ bachPt = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy);
+ bachPtot = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy + bachPz*bachPz);
+
+ //chargeXi = xi->Charge();
+
+ V0toXiCosOfPointingAngle
+ = xi->GetV0CosineOfPointingAngle(posXi[0], posXi[1], posXi[2]);
+ rapXi = xi->RapXi();
+ rapOmega = xi->RapOmega();
+ phi = xi->Phi();
+ alphaXi = xi->AlphaXi();
+ ptArmXi = xi->PtArmXi();
+
+ distToVtxZBefore = posXi[2]-bestPrimaryVtxPos[2];
+ distToVtxXYBefore
+ = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])
+ *(posXi[0] - bestPrimaryVtxPos[0])
+ +(posXi[1] - bestPrimaryVtxPos[1])
+ *(posXi[1] - bestPrimaryVtxPos[1]));
+
+ //propagation to the best primary vertex to determine the momentum
+ Propagate(bestPrimaryVtxPos, posXi, XiPAfter, b, xi->Charge());
+ distToVtxZAfter = posXi[2] - bestPrimaryVtxPos[2];
+ distToVtxXYAfter = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])
+ *(posXi[0] - bestPrimaryVtxPos[0])
+ +(posXi[1] - bestPrimaryVtxPos[1])
+ *(posXi[1] - bestPrimaryVtxPos[1]));
+ phiAfter = TMath::Pi() + TMath::ATan2(-XiPAfter[1],-XiPAfter[0]);
+
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZAfter"))->Fill(distToVtxZAfter);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYAfter"))->Fill(distToVtxXYAfter);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZBeforeVsAfter"))->Fill(distToVtxZBefore, distToVtxZAfter);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYBeforeVsAfter"))->Fill(distToVtxXYBefore, distToVtxXYAfter);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PxBeforeVsAfter"))->Fill(XiPx, XiPAfter[0]);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PyBeforeVsAfter"))->Fill(XiPy, XiPAfter[1]);
+ if(xi->Charge()>0)
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiPosBeforeVsAfter"))->Fill(phi, phiAfter);
+ else if(xi->Charge()<0)
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiNegBeforeVsAfter"))->Fill(phi, phiAfter);
+
+
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Chi2Xi"))->Fill(chi2Xi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaXiDaughters"))->Fill(dcaXiDaughters);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaBachToPrimVertex"))->Fill(dcaBachToPrimaryVtxXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiCosOfPointingAngle"))->Fill(XiCosOfPointingAngle);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiRadius"))->Fill(XiRadius);
+
+ //V0
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassLambdaAsCascDghter"))->Fill(invMassLambdaAsCascDghter);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0Chi2Xi"))->Fill(V0Chi2Xi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0DaughtersXi"))->Fill(dcaV0DaughtersXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0CosOfPointingAngleXi"))->Fill(V0CosOfPointingAngleXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0RadiusXi"))->Fill(V0RadiusXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0ToPrimVertexXi"))->Fill(dcaV0ToPrimaryVtxXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaPosToPrimVertexXi"))->Fill(dcaPosToPrimaryVtxXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaNegToPrimVertexXi"))->Fill(dcaNegToPrimaryVtxXi);
+
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0toXiCosOfPointingAngle"))->Fill(V0toXiCosOfPointingAngle);
+
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Armenteros"))->Fill(alphaXi, ptArmXi);
+
+ //PID cuts with TPC cuts
+ if(xi->Charge() < 0){
+ if(isPosProtonForTPC
+ && isNegPionForTPC){
+
+ switch(fSpecie) {
+ case 0:
+ if(isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiMinus);
+
+ //candidate inserting
+ MakeTrack(invMassXiMinus, XiPt, /*xi->Phi()*/
+ phiAfter, xi->Eta(), pTrkXi->GetID(),
+ nTrkXi->GetID(), bTrkXi->GetID());
+ }
+ break;
+
+ case 1:
+ if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaMinus);
+ MakeTrack(invMassOmegaMinus, XiPt, /*xi->Phi()*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }
+ break;
+ }
+ }
+ }
+
+ if(xi->Charge() > 0){
+ if(isNegProtonForTPC
+ && isPosPionForTPC){
+
+ switch (fSpecie){
+ case 0:
+ if(isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiPlus);
+
+ //candidate inserting
+ MakeTrack(invMassXiPlus, XiPt, /*xi->Phi()*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }
+ break;
+
+ case 1:
+ if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaPlus);
+ MakeTrack(invMassOmegaPlus, XiPt, /*xi->Phi()*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }
+ break;
+ }
+ }
+ }
+
+ }
+
+ return;
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskFlowCascade::ReadFromAODv0(AliAODEvent *fAOD)
+{
+
+ fCutsRPTPC->SetEvent(fAOD, MCEvent());
+ fCutsRPVZE->SetEvent(fAOD, MCEvent());
+ fCutsPOI->SetEvent(fAOD, MCEvent());
+ fFlowEventTPC->Fill(fCutsRPTPC, fCutsPOI);
+ fFlowEventVZE->Fill(fCutsRPVZE, fCutsPOI);
+
+ // Double_t trkPrimaryVtxPos[3] = {-100., -100., -100.};
+ Double_t bestPrimaryVtxPos[3] = {-100., -100., -100.};
+
+ Double_t b = fAOD->GetMagneticField();
+
+ int nCascades=fAOD->GetNumberOfCascades();
+ const AliAODVertex *primaryBestAODVtx = fAOD->GetPrimaryVertex();
+ primaryBestAODVtx->GetXYZ(bestPrimaryVtxPos);
+
+ // calculation part dedicated to Xi vertices
+ for(Int_t iXi = 0; iXi < nCascades; iXi++){
+ Double_t effMassXi = 0.;
+ Double_t chi2Xi = -1.;
+ Double_t dcaXiDaughters = -1.;
+ Double_t XiCosOfPointingAngle = -1.;
+ Double_t posXi[3] = {-1000., -1000., -1000.};
+ Double_t XiRadius = -1000.;
+
+ Double_t invMassLambdaAsCascDghter = 0.;
+ Double_t V0Chi2Xi = -1.;
+ Double_t dcaV0DaughtersXi = -1.;
+
+ Double_t dcaBachToPrimaryVtxXi = -1.;
+ Double_t dcaV0ToPrimaryVtxXi = -1.;
+ Double_t dcaPosToPrimaryVtxXi = -1.;
+ Double_t dcaNegToPrimaryVtxXi = -1.;
+ Double_t V0CosOfPointingAngleXi = -1.;
+ Double_t posV0Xi[3] = {-1000., -1000., -1000.};
+ Double_t V0RadiusXi = -1000.;
+ // Double_t V0quality = 0.;
+
+ Double_t invMassXiMinus = 0.;
+ Double_t invMassXiPlus = 0.;
+ Double_t invMassOmegaMinus = 0.;
+ Double_t invMassOmegaPlus = 0.;
+
+ /*
+ Bool_t isPosInXiProton = kFALSE;
+ Bool_t isPosInXiPion = kFALSE;
+ Bool_t isPosInOmegaProton = kFALSE;
+ Bool_t isPosInOmegaPion = kFALSE;
+
+ Bool_t isNegInXiProton = kFALSE;
+ Bool_t isNegInXiPion = kFALSE;
+ Bool_t isNegInOmegaProton = kFALSE;
+ Bool_t isNegInOmegaPion = kFALSE;
+
+ Bool_t isBachelorKaon = kFALSE;
+ Bool_t isBachelorPion = kFALSE;
+ */
+
+
+ Bool_t isBachelorKaonForTPC = kFALSE;
+ Bool_t isBachelorPionForTPC = kFALSE;
+ Bool_t isNegPionForTPC = kFALSE;
+ Bool_t isPosPionForTPC = kFALSE;
+ Bool_t isNegProtonForTPC = kFALSE;
+ Bool_t isPosProtonForTPC = kFALSE;
+
+ Double_t XiPx = 0., XiPy = 0., XiPz = 0.;
+ Double_t XiPt = 0.;
+ Double_t XiPtot = 0.;
+
+ Double_t bachPx = 0., bachPy = 0., bachPz = 0.;
+ Double_t bachPt = 0.;
+ Double_t bachPtot = 0.;
+
+ //Short_t chargeXi = -2;
+ Double_t V0toXiCosOfPointingAngle = 0.;
+
+ Double_t rapXi = -20.;
+ Double_t rapOmega = -20.;
+ Double_t phi = 6.3;
+ Double_t alphaXi = -200.;
+ Double_t ptArmXi = -200.;
+
+ Double_t distToVtxZBefore = -999.;
+ Double_t distToVtxZAfter = -999.;
+ Double_t distToVtxXYBefore = -999.;
+ Double_t distToVtxXYAfter = -999.;
+ Double_t XiPAfter[3] = {-999., -999., -999.};
+ Double_t phiAfter = -999.;
+
+ const AliAODcascade *xi = fAOD->GetCascade(iXi);
+ if (!xi) continue;
+
+ effMassXi = xi->MassXi(); //default working hypothesis: Xi- decay
+ chi2Xi = xi->Chi2Xi();
+ dcaXiDaughters = xi->DcaXiDaughters();
+ XiCosOfPointingAngle = xi->CosPointingAngleXi(bestPrimaryVtxPos[0],
+ bestPrimaryVtxPos[1],
+ bestPrimaryVtxPos[2]);
+ posXi[0] = xi->DecayVertexXiX();
+ posXi[1] = xi->DecayVertexXiY();
+ posXi[2] = xi->DecayVertexXiZ();
+ XiRadius = TMath::Sqrt(posXi[0]*posXi[0]
+ +posXi[1]*posXi[1]
+ +posXi[2]*posXi[2]);
+
+ AliAODTrack *pTrkXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );
+ AliAODTrack *nTrkXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );
+ AliAODTrack *bTrkXi
+ = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );
+
+ if(!pTrkXi || !nTrkXi || !bTrkXi) continue;
+
+ UInt_t idxPosXi = (UInt_t) TMath::Abs( pTrkXi->GetID() );
+ UInt_t idxNegXi = (UInt_t) TMath::Abs( nTrkXi->GetID() );
+ UInt_t idxBach = (UInt_t) TMath::Abs( bTrkXi->GetID() );
+
+ if(idxBach == idxNegXi || idxBach == idxPosXi) continue;
+
+ if( !fCutsDau->IsSelected(pTrkXi)
+ || !fCutsDau->IsSelected(nTrkXi)
+ || !fCutsDau->IsSelected(bTrkXi) ) continue;
+
+
+ if(pTrkXi->IsOn(AliESDtrack::kTPCin)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(pTrkXi->P()*pTrkXi->Charge(), pTrkXi->GetTPCsignal());
+ }
+ if( nTrkXi->IsOn(AliESDtrack::kTPCin) ){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(nTrkXi->P()*nTrkXi->Charge(), nTrkXi->GetTPCsignal());
+ }
+ if(bTrkXi->IsOn(AliESDtrack::kTPCin)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("TPCdEdxOfCascDghters"))->Fill(bTrkXi->P()*bTrkXi->Charge(), bTrkXi->GetTPCsignal());
+ }
+
+ if(xi->ChargeXi() < 0)
+ invMassLambdaAsCascDghter = xi->MassLambda();
+ else
+ invMassLambdaAsCascDghter = xi->MassAntiLambda();
+
+ dcaV0DaughtersXi = xi->DcaV0Daughters();
+ V0Chi2Xi = xi->Chi2V0();
+ V0CosOfPointingAngleXi
+ = xi->CosPointingAngle(bestPrimaryVtxPos);
+ dcaV0ToPrimaryVtxXi = xi->DcaV0ToPrimVertex();
+ dcaBachToPrimaryVtxXi = xi->DcaBachToPrimVertex();
+
+ //V0
+ posV0Xi[0] = xi->DecayVertexV0X();
+ posV0Xi[1] = xi->DecayVertexV0Y();
+ posV0Xi[2] = xi->DecayVertexV0Z();
+ V0RadiusXi = TMath::Sqrt(posV0Xi[0]*posV0Xi[0]
+ +posV0Xi[1]*posV0Xi[1]
+ +posV0Xi[2]*posV0Xi[2]);
+ dcaPosToPrimaryVtxXi = xi->DcaPosToPrimVertex();
+ dcaNegToPrimaryVtxXi = xi->DcaNegToPrimVertex();
+
+ //apply cuts ?
+ // if(XiRadius < 1. || XiRadius > 100.) continue;
+ //if(dcaXiDaughters > 0.1) continue;
+ //if(XiCosOfPointingAngle < 0.999) continue;
+ //if(dcaV0ToPrimaryVtxXi < 0.05) continue;
+ //if(dcaBachToPrimaryVtxXi < 0.03) continue;
+
+ if(dcaXiDaughters > fCascadeCuts[0]) continue;
+ if(XiCosOfPointingAngle < fCascadeCuts[1]) continue;
+ if(dcaV0ToPrimaryVtxXi < fCascadeCuts[2]) continue;
+ if(dcaBachToPrimaryVtxXi < fCascadeCuts[3]) continue;
+
+ //V0 mass cut?
+ //if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > 0.006) continue;
+ if(TMath::Abs(invMassLambdaAsCascDghter-1.11568) > fCascadeCuts[7])
+ continue;
+
+ //if(dcaV0DaughtersXi > 1.) continue;
+ //if(V0CosOfPointingAngleXi > 0.9999) continue;
+ //if(dcaPosToPrimaryVtxXi < 0.1) continue;
+ //if(dcaNegToPrimaryVtxXi < 0.1) continue;
+ if(dcaV0DaughtersXi > fCascadeCuts[4]) continue;
+ if(V0CosOfPointingAngleXi > fCascadeCuts[5]) continue;
+ if(dcaPosToPrimaryVtxXi < fCascadeCuts[6]) continue;
+ if(dcaNegToPrimaryVtxXi < fCascadeCuts[6]) continue;
+
+ // if(V0RadiusXi < 1.0 || V0RadiusXi > 100) continue;
+
+ //other cuts?
+
+
+ //???
+ if(xi->ChargeXi()<0){
+ invMassXiMinus = xi->MassXi();
+ invMassOmegaMinus = xi->MassOmega();
+ }else{
+ invMassXiPlus = xi->MassXi();
+ invMassOmegaPlus = xi->MassOmega();
+ }
+
+ /*
+ if(pTrkXi->GetMostProbablePID() == AliAODTrack::kProton) {
+ isPosInXiProton = kTRUE;
+ isPosInOmegaProton = kTRUE;
+ }
+ if(pTrkXi->GetMostProbablePID() == AliAODTrack::kPion){
+ isPosInXiPion = kTRUE;
+ isPosInOmegaPion = kTRUE;
+ }
+
+ if(nTrkXi->GetMostProbablePID() == AliAODTrack::kPion){
+ isNegInXiPion = kTRUE;
+ isNegInOmegaPion = kTRUE;
+ }
+ if(nTrkXi->GetMostProbablePID() == AliAODTrack::kProton){
+ isNegInXiProton = kTRUE;
+ isNegInOmegaProton = kTRUE;
+ }
+
+ if(bTrkXi->GetMostProbablePID() == AliAODTrack::kPion)
+ isBachelorPion = kTRUE;
+ if(bTrkXi->GetMostProbablePID() == AliAODTrack::kKaon)
+ isBachelorKaon = kTRUE;
+ */
+
+ //PID with TPC only:
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kKaon))<3.)
+ isBachelorKaonForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(bTrkXi, AliPID::kPion))<3.)
+ isBachelorPionForTPC = kTRUE;
+
+ //Negative V0 daughter
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kPion))<3.)
+ isNegPionForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(nTrkXi, AliPID::kProton))<3.)
+ isNegProtonForTPC = kTRUE;
+
+ //Positive V0 daughter
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kPion))<3.)
+ isPosPionForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC(pTrkXi, AliPID::kProton))<3.)
+ isPosProtonForTPC = kTRUE;
+
+ //Extra QA information
+ XiPx = xi->MomXiX();
+ XiPy = xi->MomXiY();
+ XiPz = xi->MomXiZ();
+ XiPt = TMath::Sqrt(XiPx*XiPx + XiPy*XiPy);
+ XiPtot= TMath::Sqrt(XiPx*XiPx + XiPy*XiPy + XiPz*XiPz);
+
+ bachPx = xi->MomBachX();
+ bachPy = xi->MomBachY();
+ bachPz = xi->MomBachZ();
+
+ bachPt = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy);
+ bachPtot = TMath::Sqrt(bachPx*bachPx + bachPy*bachPy + bachPz*bachPz);
+
+ V0toXiCosOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );
+
+ rapXi = xi->RapXi();
+ rapOmega = xi->RapOmega();
+ phi = xi->Phi();
+ alphaXi = xi->AlphaXi();
+ ptArmXi = xi->PtArmXi();
+
+ distToVtxZBefore = posXi[2]-bestPrimaryVtxPos[2];
+ distToVtxXYBefore
+ = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])
+ *(posXi[0] - bestPrimaryVtxPos[0])
+ +(posXi[1] - bestPrimaryVtxPos[1])
+ *(posXi[1] - bestPrimaryVtxPos[1]));
+
+
+ XiPAfter[0] = XiPx;
+ XiPAfter[1] = XiPy;
+ XiPAfter[2] = XiPz;
+ //propagation to the best primary vertex to determine the momentum
+ Propagate(bestPrimaryVtxPos, posXi, XiPAfter, b, xi->ChargeXi());
+ distToVtxZAfter = posXi[2] - bestPrimaryVtxPos[2];
+ distToVtxXYAfter = TMath::Sqrt((posXi[0] - bestPrimaryVtxPos[0])
+ *(posXi[0] - bestPrimaryVtxPos[0])
+ +(posXi[1] - bestPrimaryVtxPos[1])
+ *(posXi[1] - bestPrimaryVtxPos[1]));
+ phiAfter = TMath::Pi() + TMath::ATan2(-XiPAfter[1],-XiPAfter[0]);
+
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZAfter"))->Fill(distToVtxZAfter);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYAfter"))->Fill(distToVtxXYAfter);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxZBeforeVsAfter"))->Fill(distToVtxZBefore, distToVtxZAfter);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DistToVtxXYBeforeVsAfter"))->Fill(distToVtxXYBefore, distToVtxXYAfter);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PxBeforeVsAfter"))->Fill(XiPx, XiPAfter[0]);
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PyBeforeVsAfter"))->Fill(XiPy, XiPAfter[1]);
+ if(xi->ChargeXi()>0)
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiPosBeforeVsAfter"))->Fill(phi, phiAfter);
+ else if(xi->ChargeXi()<0)
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("PhiNegBeforeVsAfter"))->Fill(phi, phiAfter);
+
+ //for default hypothesis
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Chi2Xi"))->Fill(chi2Xi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaXiDaughters"))->Fill(dcaXiDaughters);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaBachToPrimVertex"))->Fill(dcaBachToPrimaryVtxXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiCosOfPointingAngle"))->Fill(XiCosOfPointingAngle);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("XiRadius"))->Fill(XiRadius);
+
+ //V0
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassLambdaAsCascDghter"))->Fill(invMassLambdaAsCascDghter);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0Chi2Xi"))->Fill(V0Chi2Xi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0DaughtersXi"))->Fill(dcaV0DaughtersXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0CosOfPointingAngleXi"))->Fill(V0CosOfPointingAngleXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0RadiusXi"))->Fill(V0RadiusXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaV0ToPrimVertexXi"))->Fill(dcaV0ToPrimaryVtxXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaPosToPrimVertexXi"))->Fill(dcaPosToPrimaryVtxXi);
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("DcaNegToPrimVertexXi"))->Fill(dcaNegToPrimaryVtxXi);
+
+ ((TH1F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0toXiCosOfPointingAngle"))->Fill(V0toXiCosOfPointingAngle);
+
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("Armenteros"))->Fill(alphaXi, ptArmXi);
+
+ //with PID cuts
+ if(xi->ChargeXi()<0){
+ if(isPosProtonForTPC && isNegPionForTPC){
+ switch (fSpecie){
+ case 0:
+ if( isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiMinus);
+ MakeTrack(invMassXiMinus, XiPt, /*xi->Phi(),*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }// endif
+
+ break;
+
+ case 1:
+ if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8
+ && (invMassXiMinus > 1.32486 || invMassXiMinus < 1.30486)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaMinus);
+
+ MakeTrack(invMassOmegaMinus, XiPt, /* xi->Phi(),*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }//endif
+ break;
+ }
+ }
+ }//end if ChargeXi()<0
+
+ if(xi->ChargeXi() > 0){
+ if(isNegProtonForTPC && isPosPionForTPC){
+ switch(fSpecie){
+ case 0:
+ if (isBachelorPionForTPC && TMath::Abs(rapXi) < 0.8){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassXiPlus);
+
+ //candidate inserting
+ MakeTrack(invMassXiPlus, XiPt, /* xi->Phi(),*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }//endif particle id
+ break;
+
+ case 1:
+ if(isBachelorKaonForTPC && TMath::Abs(rapOmega) < 0.8
+ && (invMassXiPlus > 1.32486 || invMassXiPlus < 1.30486)){
+ ((TH2F*)((TList*)fQAList->FindObject("Candidates"))->FindObject("MassVsPtAll"))->Fill(XiPt, invMassOmegaPlus);
+ MakeTrack(invMassOmegaPlus, XiPt, /* xi->Phi(),*/
+ phiAfter, xi->Eta(),
+ pTrkXi->GetID(), nTrkXi->GetID(), bTrkXi->GetID());
+ }//endif particle id
+ }
+ }
+ }//endif ChargeXi()>0
+ }//for Xi candidate loop
+
+ return;
+
+}
+
+
+void AliAnalysisTaskFlowCascade::MakeTrack( double mass,
+ double pt,
+ double phi,
+ double eta,
+ int iid,
+ int jid,
+ int kid) {
+ // create track for flow tasks
+ if(fCandidates->GetLast()+1>=fCandidates->GetSize()) {
+ fCandidates->Expand( 2*fCandidates->GetSize() );
+ }
+ Bool_t overwrite = kTRUE;
+
+ AliFlowCandidateTrack *sTrack
+ = (static_cast<AliFlowCandidateTrack*> (fCandidates->At( fCandidates->GetLast()+1 )));
+ if( !sTrack ) { // creates new
+ sTrack = new AliFlowCandidateTrack();
+ overwrite = kFALSE;
+ } else { // overwrites
+ sTrack->ClearMe();
+ }
+
+
+ sTrack->SetMass(mass);
+ sTrack->SetPt(pt);
+ sTrack->SetPhi(phi);
+ sTrack->SetEta(eta);
+ sTrack->AddDaughter(iid);
+ sTrack->AddDaughter(jid);
+ sTrack->AddDaughter(kid);
+ sTrack->SetForPOISelection(kTRUE);
+ sTrack->SetForRPSelection(kFALSE);
+
+ if(overwrite) {
+ fCandidates->SetLast( fCandidates->GetLast()+1 );
+ } else {
+ fCandidates->AddLast(sTrack);
+ }
+
+ return;
+}
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowCascade::Terminate(Option_t *)
+{
+
+}
+
+void AliAnalysisTaskFlowCascade::Propagate(Double_t vv[3],
+ Double_t x[3],
+ Double_t p[3],
+ Double_t bz,
+ Short_t sign){
+ //Propagation to the primary vertex to determine the px and py
+ //x, p are the position and momentum as input and output
+ //bz is the magnetic field along z direction
+ //sign is the charge of particle for propagation
+
+ Double_t pp = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
+ Double_t len = (vv[2]-x[2])*pp/p[2];
+ Double_t a = -kB2C*bz*sign;
+
+ Double_t rho = a/pp;
+ x[0] += p[0]*TMath::Sin(rho*len)/a - p[1]*(1-TMath::Cos(rho*len))/a;
+ x[1] += p[1]*TMath::Sin(rho*len)/a + p[0]*(1-TMath::Cos(rho*len))/a;
+ x[2] += p[2]*len/pp;
+
+ Double_t p0=p[0];
+ p[0] = p0 *TMath::Cos(rho*len) - p[1]*TMath::Sin(rho*len);
+ p[1] = p[1]*TMath::Cos(rho*len) + p0 *TMath::Sin(rho*len);
+}
+
+
+//=====================================================================
+void AliAnalysisTaskFlowCascade::SetCommonConstants(Int_t massBins,
+ Double_t minMass,
+ Double_t maxMass)
+{
+ // setter for mass bins
+
+ fMassBins = massBins;
+ fMinMass = minMass;
+ fMaxMass = maxMass;
+}
+
+
+//====================================================================
+void AliAnalysisTaskFlowCascade::SetCuts2010(int set) {
+
+ // fCascadeCuts[0]: DcaXiDaughter; fCascadeCuts[1]: XiCosOfPointingAngle
+ // fCascadeCuts[2]: DcaV0ToPrimaryVtxXi; fCascadeCuts[3]: DcaBachToPrimaryVtxXi
+ // fCascadeCuts[4]: DcaV0DaughersXi; fCascadeCuts[5]: V0CosOfPointingAngleXi
+ // fCascadeCuts[6]: DcaV0DaughterToPrimaryVtxXi; fCascadeCuts[7]: V0MassWidth
+
+ switch(set){
+
+ case 0: //tighter
+ fCascadeCuts[0] = 0.2; fCascadeCuts[1] = 0.999;
+ fCascadeCuts[2] = 0.03; fCascadeCuts[3] = 0.05;
+ fCascadeCuts[4] = .5; fCascadeCuts[5] = 0.9998;
+ fCascadeCuts[6] = 0.1; fCascadeCuts[7] = 0.006;
+ break;
+
+ case 1: //middle
+ fCascadeCuts[0] = 0.3; fCascadeCuts[1] = 0.99;
+ fCascadeCuts[2] = 0.01; fCascadeCuts[3] = 0.03;
+ fCascadeCuts[4] = .6; fCascadeCuts[5] = 0.9999;
+ fCascadeCuts[6] = 0.1; fCascadeCuts[7] = 0.008;
+ break;
+
+ case 2: //looser
+ fCascadeCuts[0] = 0.3; fCascadeCuts[1] = 0.99;
+ fCascadeCuts[2] = 0.01; fCascadeCuts[3] = 0.03;
+ fCascadeCuts[4] = 1.; fCascadeCuts[5] = 1.;
+ fCascadeCuts[6] = 0.1; fCascadeCuts[7] = 0.01;
+ break;
+ }
+
+}
-/////////////////////////////////////////////////////\r
-// AliAnalysisTaskFlowCascade:\r
-// Analysis task to select Xi and Omega candidates for flow analysis.\r
-// Author: \r
-//////////////////////////////////////////////////////\r
-\r
-/* Copyright(c) 1998-1999, ALICExperiment at CERN, All rights reserved. *\r
-* See cxx source for full Copyright notice */\r
-/* $Id: $ */\r
-\r
-#ifndef AliAnalysisTaskFlowCascade_H\r
-#define AliAnalysisTaskFlowCascade_H\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-\r
-class AliESDtrackCuts;\r
-class AliFlowEventCuts;\r
-class TList;\r
-class TH1D;\r
-class TH2D;\r
-class TH3D;\r
-class AliFlowCandidateTrack;\r
-class TVector3;\r
-class AliPIDResponse;\r
-class AliFlowEvent;\r
-class AliAnalysisTaskFlowCascade : public AliAnalysisTaskSE {\r
- private:\r
- AliAnalysisTaskFlowCascade(const AliAnalysisTaskFlowCascade& analysisTask);\r
- AliAnalysisTaskFlowCascade& \r
- operator=(const AliAnalysisTaskFlowCascade& analysisTask);\r
-\r
- //Progate to the primary vertex\r
- void Propagate(Double_t vv[3], Double_t x[3], Double_t p[3], Double_t bz, \r
- Short_t sign);\r
-\r
- void AddQAEvents();\r
- void AddQACandidates();\r
- void ReadFromESDv0(AliESDEvent *fESD);\r
- void ReadFromAODv0(AliAODEvent *fAOD);\r
-\r
- void AddCandidates();\r
-\r
- void MakeTrack( double mass, double pt, \r
- double phi, double eta, \r
- int iid, int jid, int kid );\r
- \r
- // double fMinCent, fMaxCent; //\r
- Int_t fSpecie; //0 for Xi and 1 for Omega\r
- Double_t fCascadeCuts[8]; // cuts for cascade selection\r
- Int_t fMassBins; // to configure FLOWCOMMON \r
- Double_t fMinMass; // to configure FLOWCOMMON \r
- Double_t fMaxMass; // to configure FLOWCOMMON\r
- \r
- AliFlowEventCuts *fCutsEvent; // event cuts \r
- AliFlowTrackCuts *fCutsRPTPC; // cuts for RPs\r
- AliFlowTrackCuts *fCutsRPVZE; // cuts for RPs\r
- AliFlowTrackCuts *fCutsPOI; // null cuts for POI\r
- AliFlowTrackCuts *fCutsDau; // cuts for daughters\r
- AliPIDResponse *fPIDResponse;\r
- AliFlowEvent *fFlowEventTPC; //flow event TPC \r
- AliFlowEvent *fFlowEventVZE; //flow event VZE \r
- TObjArray *fCandidates; // Array of selected candidates\r
- TList *fQAList; //! list for QA histos\r
-\r
- public:\r
- AliAnalysisTaskFlowCascade();\r
- AliAnalysisTaskFlowCascade(const char *name, \r
- AliFlowEventCuts *cutsEvent, \r
- AliFlowTrackCuts *cutsRPTPC,\r
- AliFlowTrackCuts *cutsRPVZE,\r
- /* AliESDtrackCuts */AliFlowTrackCuts *cutsDau);\r
- //void SetDebug() {fDebug = true;}\r
- void SetSpecie(int specie){fSpecie = specie;}\r
- void SetCommonConstants(Int_t massBins, Double_t minMass, Double_t maxMass);\r
- void SetCuts2010(int setOfCuts);\r
- virtual ~AliAnalysisTaskFlowCascade();\r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *);\r
- virtual void Terminate(Option_t *);\r
- virtual void NotifyRun();\r
- \r
- ClassDef(AliAnalysisTaskFlowCascade, 2);\r
-};\r
-\r
-#endif\r
+/////////////////////////////////////////////////////
+// AliAnalysisTaskFlowCascade:
+// Analysis task to select Xi and Omega candidates for flow analysis.
+// Author:
+//////////////////////////////////////////////////////
+
+/* Copyright(c) 1998-1999, ALICExperiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+/* $Id: $ */
+
+#ifndef AliAnalysisTaskFlowCascade_H
+#define AliAnalysisTaskFlowCascade_H
+
+#include "AliAnalysisTaskSE.h"
+
+class AliESDtrackCuts;
+class AliFlowEventCuts;
+class TList;
+class TH1D;
+class TH2D;
+class TH3D;
+class AliFlowCandidateTrack;
+class TVector3;
+class AliPIDResponse;
+class AliFlowEvent;
+class AliAnalysisTaskFlowCascade : public AliAnalysisTaskSE {
+ private:
+ AliAnalysisTaskFlowCascade(const AliAnalysisTaskFlowCascade& analysisTask);
+ AliAnalysisTaskFlowCascade&
+ operator=(const AliAnalysisTaskFlowCascade& analysisTask);
+
+ //Progate to the primary vertex
+ void Propagate(Double_t vv[3], Double_t x[3], Double_t p[3], Double_t bz,
+ Short_t sign);
+
+ void AddQAEvents();
+ void AddQACandidates();
+ void ReadFromESDv0(AliESDEvent *fESD);
+ void ReadFromAODv0(AliAODEvent *fAOD);
+
+ void AddCandidates();
+
+ void MakeTrack( double mass, double pt,
+ double phi, double eta,
+ int iid, int jid, int kid );
+
+ // double fMinCent, fMaxCent; //
+ Int_t fSpecie; //0 for Xi and 1 for Omega
+ Double_t fCascadeCuts[8]; // cuts for cascade selection
+ Int_t fMassBins; // to configure FLOWCOMMON
+ Double_t fMinMass; // to configure FLOWCOMMON
+ Double_t fMaxMass; // to configure FLOWCOMMON
+
+ AliFlowEventCuts *fCutsEvent; // event cuts
+ AliFlowTrackCuts *fCutsRPTPC; // cuts for RPs
+ AliFlowTrackCuts *fCutsRPVZE; // cuts for RPs
+ AliFlowTrackCuts *fCutsPOI; // null cuts for POI
+ AliFlowTrackCuts *fCutsDau; // cuts for daughters
+ AliPIDResponse *fPIDResponse;
+ AliFlowEvent *fFlowEventTPC; //flow event TPC
+ AliFlowEvent *fFlowEventVZE; //flow event VZE
+ TObjArray *fCandidates; // Array of selected candidates
+ TList *fQAList; //! list for QA histos
+
+ public:
+ AliAnalysisTaskFlowCascade();
+ AliAnalysisTaskFlowCascade(const char *name,
+ AliFlowEventCuts *cutsEvent,
+ AliFlowTrackCuts *cutsRPTPC,
+ AliFlowTrackCuts *cutsRPVZE,
+ /* AliESDtrackCuts */AliFlowTrackCuts *cutsDau);
+ //void SetDebug() {fDebug = true;}
+ void SetSpecie(int specie){fSpecie = specie;}
+ void SetCommonConstants(Int_t massBins, Double_t minMass, Double_t maxMass);
+ void SetCuts2010(int setOfCuts);
+ virtual ~AliAnalysisTaskFlowCascade();
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *);
+ virtual void Terminate(Option_t *);
+ virtual void NotifyRun();
+
+ ClassDef(AliAnalysisTaskFlowCascade, 2);
+};
+
+#endif
-#ifndef ALIANALYSISTASKESDMUONFILTER_H\r
-#define ALIANALYSISTASKESDMUONFILTER_H\r
- \r
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-/* $Id$ */ \r
-\r
-///\r
-/// \brief Add the muon tracks to the generic AOD track branch during the\r
-/// filtering of the ESD.\r
-///\r
-/// \author R. Arnaldi 5/5/08 and L. Aphecetche January 2011\r
-\r
-#ifndef ALIANALYSISTASKSE_H\r
-# include "AliAnalysisTaskSE.h"\r
-#endif\r
-\r
-class AliAnalysisFilter;\r
-\r
-class AliAnalysisTaskESDMuonFilter : public AliAnalysisTaskSE\r
-{\r
-public:\r
- AliAnalysisTaskESDMuonFilter(Bool_t onlyMuon=kTRUE, Bool_t keepAllEvents=kTRUE, Int_t mcMode=0, Bool_t withSPDtracklets=kFALSE);\r
- AliAnalysisTaskESDMuonFilter(const char* name, Bool_t onlyMuon=kTRUE, Bool_t keepAllEvents=kTRUE, Int_t mcMode=0, Bool_t withSPDtracklets=kFALSE);\r
- virtual ~AliAnalysisTaskESDMuonFilter() {;}\r
- \r
- virtual void UserCreateOutputObjects();\r
- virtual void Init();\r
- virtual void LocalInit() {Init();}\r
- virtual void UserExec(Option_t *option);\r
- \r
- virtual void ConvertESDtoAOD();\r
- \r
- virtual void SetTrackFilter(AliAnalysisFilter* trackF) {fTrackFilter = trackF;}\r
- void SetWriteMuonAOD(Bool_t enableMuonAOD){fEnableMuonAOD = enableMuonAOD;}\r
- void SetWriteDimuonAOD(Bool_t enableDimuonAOD){fEnableDimuonAOD = enableDimuonAOD;}\r
- \r
- void PrintTask(Option_t *option="", Int_t indent=0) const;\r
- \r
-private:\r
- AliAnalysisTaskESDMuonFilter(const AliAnalysisTaskESDMuonFilter&);\r
- AliAnalysisTaskESDMuonFilter& operator=(const AliAnalysisTaskESDMuonFilter&);\r
- void AddFilteredAOD(const char* aodfilename, const char* title);\r
- \r
- AliAnalysisFilter* fTrackFilter; ///< Track Filter\r
- Bool_t fEnableMuonAOD; ///< flag for enabling Muon AOD production\r
- Bool_t fEnableDimuonAOD; ///< flag for enabling Dimuon AOD production\r
- Bool_t fOnlyMuon; ///< flag for disabling branches irrelevant for (most) muon analyses\r
- Bool_t fKeepAllEvents; ///< keep even events where there's no muons (to get e.g. unbiased vertex distribution)\r
- Int_t fMCMode; ///< whether and how we're filtering MC data\r
- Bool_t fWithSPDTracklets; ///< whether or not we keep SPD tracklets\r
- \r
- ClassDef(AliAnalysisTaskESDMuonFilter, 6); // Analysis task for standard ESD filtering\r
-};\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKESDMUONFILTER_H
+#define ALIANALYSISTASKESDMUONFILTER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+///
+/// \brief Add the muon tracks to the generic AOD track branch during the
+/// filtering of the ESD.
+///
+/// \author R. Arnaldi 5/5/08 and L. Aphecetche January 2011
+
+#ifndef ALIANALYSISTASKSE_H
+# include "AliAnalysisTaskSE.h"
+#endif
+
+class AliAnalysisFilter;
+
+class AliAnalysisTaskESDMuonFilter : public AliAnalysisTaskSE
+{
+public:
+ AliAnalysisTaskESDMuonFilter(Bool_t onlyMuon=kTRUE, Bool_t keepAllEvents=kTRUE, Int_t mcMode=0, Bool_t withSPDtracklets=kFALSE);
+ AliAnalysisTaskESDMuonFilter(const char* name, Bool_t onlyMuon=kTRUE, Bool_t keepAllEvents=kTRUE, Int_t mcMode=0, Bool_t withSPDtracklets=kFALSE);
+ virtual ~AliAnalysisTaskESDMuonFilter() {;}
+
+ virtual void UserCreateOutputObjects();
+ virtual void Init();
+ virtual void LocalInit() {Init();}
+ virtual void UserExec(Option_t *option);
+
+ virtual void ConvertESDtoAOD();
+
+ virtual void SetTrackFilter(AliAnalysisFilter* trackF) {fTrackFilter = trackF;}
+ void SetWriteMuonAOD(Bool_t enableMuonAOD){fEnableMuonAOD = enableMuonAOD;}
+ void SetWriteDimuonAOD(Bool_t enableDimuonAOD){fEnableDimuonAOD = enableDimuonAOD;}
+
+ void PrintTask(Option_t *option="", Int_t indent=0) const;
+
+private:
+ AliAnalysisTaskESDMuonFilter(const AliAnalysisTaskESDMuonFilter&);
+ AliAnalysisTaskESDMuonFilter& operator=(const AliAnalysisTaskESDMuonFilter&);
+ void AddFilteredAOD(const char* aodfilename, const char* title);
+
+ AliAnalysisFilter* fTrackFilter; ///< Track Filter
+ Bool_t fEnableMuonAOD; ///< flag for enabling Muon AOD production
+ Bool_t fEnableDimuonAOD; ///< flag for enabling Dimuon AOD production
+ Bool_t fOnlyMuon; ///< flag for disabling branches irrelevant for (most) muon analyses
+ Bool_t fKeepAllEvents; ///< keep even events where there's no muons (to get e.g. unbiased vertex distribution)
+ Int_t fMCMode; ///< whether and how we're filtering MC data
+ Bool_t fWithSPDTracklets; ///< whether or not we keep SPD tracklets
+
+ ClassDef(AliAnalysisTaskESDMuonFilter, 6); // Analysis task for standard ESD filtering
+};
+
+#endif
-/**************************************************************************\r
- * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-/* $Id: AliUtilityMuonAncestor.cxx 47782 2011-02-24 18:37:31Z martinez $ */\r
-\r
-//-----------------------------------------------------------------------------\r
-/// \class AliUtilityMuonAncestor\r
-/// Static utilities to get the muon ancestor in MC\r
-///\r
-/// \author Diego Stocco\r
-//-----------------------------------------------------------------------------\r
-\r
-#include "AliUtilityMuonAncestor.h"\r
-\r
-// ROOT includes\r
-#include "TDatabasePDG.h"\r
-#include "TParticlePDG.h"\r
-#include "TPDGCode.h"\r
-#include "TMCProcess.h"\r
-#include "TMath.h"\r
-\r
-// STEER includes\r
-#include "AliMCEvent.h"\r
-#include "AliVParticle.h"\r
-#include "AliMCParticle.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliLog.h"\r
-\r
-// PWGmuon includes\r
-#include "AliAnalysisMuonUtility.h"\r
-\r
-/// \cond CLASSIMP\r
-ClassImp(AliUtilityMuonAncestor) // Class implementation in ROOT context\r
-/// \endcond\r
-\r
-//_________________________________________________________\r
-AliUtilityMuonAncestor::AliUtilityMuonAncestor() :\r
-TObject(),\r
-fPx(0.),\r
-fPy(0.),\r
-fPz(0.),\r
-fMask(0),\r
-fAncestor(-999)\r
-{\r
- /// Default constructor\r
-}\r
-\r
-\r
-//_________________________________________________________\r
-AliUtilityMuonAncestor::~AliUtilityMuonAncestor()\r
-{\r
- /// Default destructor\r
-}\r
-\r
-//_________________________________________________________\r
-AliUtilityMuonAncestor::AliUtilityMuonAncestor(const AliUtilityMuonAncestor& obj) :\r
-TObject(obj),\r
-fPx(obj.fPx),\r
-fPy(obj.fPy),\r
-fPz(obj.fPz),\r
-fMask(obj.fMask),\r
-fAncestor(obj.fAncestor)\r
-{\r
- /// Copy constructor\r
-}\r
-\r
-//_________________________________________________________\r
-AliUtilityMuonAncestor& AliUtilityMuonAncestor::operator=(const AliUtilityMuonAncestor& obj)\r
-{\r
- /// Copy operator\r
- if ( this != &obj ) {\r
- TObject::operator=(obj);\r
- fPx = obj.fPx;\r
- fPy = obj.fPy;\r
- fPz = obj.fPz;\r
- fMask = obj.fMask;\r
- fAncestor = obj.fAncestor;\r
- }\r
- return *this;\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::BuildAncestor ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Build ancestor\r
- \r
- // If track is the same as the one in memory, do not re-build the track ancestor\r
- if ( track->Px() == fPx && track->Py() == fPy && track->Pz() == fPz ) return kTRUE;\r
- fPx = track->Px();\r
- fPy = track->Py();\r
- fPz = track->Pz();\r
- fMask = 0;\r
- fAncestor = -999;\r
- if ( ! mcEvent ) return kFALSE;\r
- \r
- AliVParticle* mcParticle = 0x0;\r
- \r
- if ( AliAnalysisMuonUtility::IsMCTrack(track) ) mcParticle = track;\r
- else {\r
- Int_t trackLabel = track->GetLabel();\r
- if ( trackLabel < 0 ) return kFALSE;\r
- mcParticle = mcEvent->GetTrack(trackLabel);\r
- }\r
- \r
- // Track is MC (or matches a MC track)\r
- SETBIT(fMask,kIsID);\r
- \r
- Int_t recoPdg = mcParticle->PdgCode();\r
- \r
- // Track is not a muon\r
- if ( TMath::Abs(recoPdg) == 13 ) SETBIT(fMask,kIsMuon);\r
- \r
- Int_t imother = AliAnalysisMuonUtility::GetMotherIndex(mcParticle);\r
-\r
- while ( imother >= 0 ) {\r
- AliVParticle* part = mcEvent->GetTrack(imother);\r
- \r
- Int_t absPdg = TMath::Abs(part->PdgCode());\r
- \r
- // This is a quark\r
- if ( absPdg < 10 ) return kTRUE;\r
- \r
- fAncestor = imother;\r
- Bool_t isPrimary = AliAnalysisMuonUtility::IsPrimary(part, mcEvent);\r
- \r
- if ( isPrimary ) {\r
- Int_t mpdg = absPdg%100000;\r
- if ( mpdg >= 100 && mpdg < 10000 ) {\r
- Int_t flv = Int_t ( mpdg / TMath::Power(10, Int_t(TMath::Log10(mpdg) )));\r
- if ( flv < 4 ) SETBIT(fMask,kHasLightParent);\r
- else if ( flv >= 6 ) continue;\r
- else {\r
- TParticlePDG* partPdg = TDatabasePDG::Instance()->GetParticle(part->PdgCode());\r
- if ( partPdg && ! partPdg->AntiParticle() ) SETBIT(fMask,kHasQuarkoniumParent);\r
- else if ( flv == 4 ) SETBIT(fMask,kHasCharmParent);\r
- else SETBIT(fMask,kHasBeautyParent);\r
- }\r
- } // absPdg within 100 and 10000\r
- } // is primary\r
- else {\r
- UInt_t mcProcess = AliAnalysisMuonUtility::GetMCProcess(part);\r
- if ( mcProcess == kPHadronic ||\r
- ( mcProcess == 0 && part->Zv() < -90. ) ) {\r
- // The MC process is not well computed in the AODs of old MC productions\r
- // In this case, declare the particle as "secondary" if it is produced inside the front absorber\r
- SETBIT(fMask,kIsSecondary);\r
-// return kTRUE;\r
- }\r
- } // is secondary\r
- \r
- imother = AliAnalysisMuonUtility::GetMotherIndex(part);\r
- \r
- } // loop on mothers\r
- return kTRUE;\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::CheckAncestor ( AliVParticle* track, const AliMCEvent* mcEvent, Int_t ancestorPdg, Bool_t matchAbsPdg )\r
-{\r
- /// Check ancestor\r
- Int_t pdgCode = GetAncestorPdg(track, mcEvent);\r
- if ( matchAbsPdg ) {\r
- pdgCode = TMath::Abs(pdgCode);\r
- ancestorPdg = TMath::Abs(ancestorPdg);\r
- }\r
- return ( pdgCode == ancestorPdg );\r
-}\r
-\r
-//_________________________________________________________\r
-Int_t AliUtilityMuonAncestor::GetAncestor ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Return ancestor (compute it if necessary)\r
- BuildAncestor(track,mcEvent);\r
- return fAncestor;\r
-}\r
-\r
-//_________________________________________________________\r
-Int_t AliUtilityMuonAncestor::GetAncestorPdg ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Return ancestor Pdg\r
- if ( BuildAncestor(track,mcEvent) ) {\r
- if ( fAncestor >= 0 ) return mcEvent->GetTrack(fAncestor)->PdgCode();\r
- }\r
- return 0;\r
-}\r
-\r
-//_________________________________________________________\r
-Long64_t AliUtilityMuonAncestor::GetMask ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Return mask\r
- BuildAncestor(track,mcEvent);\r
- return fMask;\r
-}\r
-\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsBeautyMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon from beauty decays\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasBeautyParent) & ! TESTBIT(mask,kHasLightParent) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsBJpsiMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon B->J/psi decays\r
- if ( IsBeautyMu(track,mcEvent) ) {\r
- Int_t imother = AliAnalysisMuonUtility::GetMotherIndex(track);\r
- if ( imother >= 0 ) return ( mcEvent->GetTrack(imother)->PdgCode() == 443 );\r
- }\r
- return kFALSE;\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsCharmMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon from charm decays\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasCharmParent) && ! TESTBIT(mask,kHasBeautyParent) && ! TESTBIT(mask,kHasLightParent) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsDecayMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon from light hadron decays\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasLightParent) && ! TESTBIT(mask,kIsSecondary) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsHadron ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Reconstructed hadron\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && ! TESTBIT(mask,kIsMuon) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsMuon ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Track is muon\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsQuarkoniumMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Mu from quarkonium decay\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasQuarkoniumParent) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsSecondaryMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon from secondary decays in absorber\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kIsSecondary) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsUnidentified ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Unidentified muon\r
- Long64_t mask = GetMask(track,mcEvent);\r
- return ( ! TESTBIT(mask,kIsID) );\r
-}\r
-\r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsWBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon from W boson decays\r
- return ( IsMuon(track,mcEvent) && CheckAncestor(track,mcEvent,24) );\r
-}\r
- \r
-//_________________________________________________________\r
-Bool_t AliUtilityMuonAncestor::IsZBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent )\r
-{\r
- /// Muon from Z boson decays\r
- return ( IsMuon(track,mcEvent) && CheckAncestor(track,mcEvent,kZ0) );\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id: AliUtilityMuonAncestor.cxx 47782 2011-02-24 18:37:31Z martinez $ */
+
+//-----------------------------------------------------------------------------
+/// \class AliUtilityMuonAncestor
+/// Static utilities to get the muon ancestor in MC
+///
+/// \author Diego Stocco
+//-----------------------------------------------------------------------------
+
+#include "AliUtilityMuonAncestor.h"
+
+// ROOT includes
+#include "TDatabasePDG.h"
+#include "TParticlePDG.h"
+#include "TPDGCode.h"
+#include "TMCProcess.h"
+#include "TMath.h"
+
+// STEER includes
+#include "AliMCEvent.h"
+#include "AliVParticle.h"
+#include "AliMCParticle.h"
+#include "AliAODMCParticle.h"
+#include "AliLog.h"
+
+// PWGmuon includes
+#include "AliAnalysisMuonUtility.h"
+
+/// \cond CLASSIMP
+ClassImp(AliUtilityMuonAncestor) // Class implementation in ROOT context
+/// \endcond
+
+//_________________________________________________________
+AliUtilityMuonAncestor::AliUtilityMuonAncestor() :
+TObject(),
+fPx(0.),
+fPy(0.),
+fPz(0.),
+fMask(0),
+fAncestor(-999)
+{
+ /// Default constructor
+}
+
+
+//_________________________________________________________
+AliUtilityMuonAncestor::~AliUtilityMuonAncestor()
+{
+ /// Default destructor
+}
+
+//_________________________________________________________
+AliUtilityMuonAncestor::AliUtilityMuonAncestor(const AliUtilityMuonAncestor& obj) :
+TObject(obj),
+fPx(obj.fPx),
+fPy(obj.fPy),
+fPz(obj.fPz),
+fMask(obj.fMask),
+fAncestor(obj.fAncestor)
+{
+ /// Copy constructor
+}
+
+//_________________________________________________________
+AliUtilityMuonAncestor& AliUtilityMuonAncestor::operator=(const AliUtilityMuonAncestor& obj)
+{
+ /// Copy operator
+ if ( this != &obj ) {
+ TObject::operator=(obj);
+ fPx = obj.fPx;
+ fPy = obj.fPy;
+ fPz = obj.fPz;
+ fMask = obj.fMask;
+ fAncestor = obj.fAncestor;
+ }
+ return *this;
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::BuildAncestor ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Build ancestor
+
+ // If track is the same as the one in memory, do not re-build the track ancestor
+ if ( track->Px() == fPx && track->Py() == fPy && track->Pz() == fPz ) return kTRUE;
+ fPx = track->Px();
+ fPy = track->Py();
+ fPz = track->Pz();
+ fMask = 0;
+ fAncestor = -999;
+ if ( ! mcEvent ) return kFALSE;
+
+ AliVParticle* mcParticle = 0x0;
+
+ if ( AliAnalysisMuonUtility::IsMCTrack(track) ) mcParticle = track;
+ else {
+ Int_t trackLabel = track->GetLabel();
+ if ( trackLabel < 0 ) return kFALSE;
+ mcParticle = mcEvent->GetTrack(trackLabel);
+ }
+
+ // Track is MC (or matches a MC track)
+ SETBIT(fMask,kIsID);
+
+ Int_t recoPdg = mcParticle->PdgCode();
+
+ // Track is not a muon
+ if ( TMath::Abs(recoPdg) == 13 ) SETBIT(fMask,kIsMuon);
+
+ Int_t imother = AliAnalysisMuonUtility::GetMotherIndex(mcParticle);
+
+ while ( imother >= 0 ) {
+ AliVParticle* part = mcEvent->GetTrack(imother);
+
+ Int_t absPdg = TMath::Abs(part->PdgCode());
+
+ // This is a quark
+ if ( absPdg < 10 ) return kTRUE;
+
+ fAncestor = imother;
+ Bool_t isPrimary = AliAnalysisMuonUtility::IsPrimary(part, mcEvent);
+
+ if ( isPrimary ) {
+ Int_t mpdg = absPdg%100000;
+ if ( mpdg >= 100 && mpdg < 10000 ) {
+ Int_t flv = Int_t ( mpdg / TMath::Power(10, Int_t(TMath::Log10(mpdg) )));
+ if ( flv < 4 ) SETBIT(fMask,kHasLightParent);
+ else if ( flv >= 6 ) continue;
+ else {
+ TParticlePDG* partPdg = TDatabasePDG::Instance()->GetParticle(part->PdgCode());
+ if ( partPdg && ! partPdg->AntiParticle() ) SETBIT(fMask,kHasQuarkoniumParent);
+ else if ( flv == 4 ) SETBIT(fMask,kHasCharmParent);
+ else SETBIT(fMask,kHasBeautyParent);
+ }
+ } // absPdg within 100 and 10000
+ } // is primary
+ else {
+ UInt_t mcProcess = AliAnalysisMuonUtility::GetMCProcess(part);
+ if ( mcProcess == kPHadronic ||
+ ( mcProcess == 0 && part->Zv() < -90. ) ) {
+ // The MC process is not well computed in the AODs of old MC productions
+ // In this case, declare the particle as "secondary" if it is produced inside the front absorber
+ SETBIT(fMask,kIsSecondary);
+// return kTRUE;
+ }
+ } // is secondary
+
+ imother = AliAnalysisMuonUtility::GetMotherIndex(part);
+
+ } // loop on mothers
+ return kTRUE;
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::CheckAncestor ( AliVParticle* track, const AliMCEvent* mcEvent, Int_t ancestorPdg, Bool_t matchAbsPdg )
+{
+ /// Check ancestor
+ Int_t pdgCode = GetAncestorPdg(track, mcEvent);
+ if ( matchAbsPdg ) {
+ pdgCode = TMath::Abs(pdgCode);
+ ancestorPdg = TMath::Abs(ancestorPdg);
+ }
+ return ( pdgCode == ancestorPdg );
+}
+
+//_________________________________________________________
+Int_t AliUtilityMuonAncestor::GetAncestor ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Return ancestor (compute it if necessary)
+ BuildAncestor(track,mcEvent);
+ return fAncestor;
+}
+
+//_________________________________________________________
+Int_t AliUtilityMuonAncestor::GetAncestorPdg ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Return ancestor Pdg
+ if ( BuildAncestor(track,mcEvent) ) {
+ if ( fAncestor >= 0 ) return mcEvent->GetTrack(fAncestor)->PdgCode();
+ }
+ return 0;
+}
+
+//_________________________________________________________
+Long64_t AliUtilityMuonAncestor::GetMask ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Return mask
+ BuildAncestor(track,mcEvent);
+ return fMask;
+}
+
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsBeautyMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon from beauty decays
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasBeautyParent) & ! TESTBIT(mask,kHasLightParent) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsBJpsiMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon B->J/psi decays
+ if ( IsBeautyMu(track,mcEvent) ) {
+ Int_t imother = AliAnalysisMuonUtility::GetMotherIndex(track);
+ if ( imother >= 0 ) return ( mcEvent->GetTrack(imother)->PdgCode() == 443 );
+ }
+ return kFALSE;
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsCharmMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon from charm decays
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasCharmParent) && ! TESTBIT(mask,kHasBeautyParent) && ! TESTBIT(mask,kHasLightParent) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsDecayMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon from light hadron decays
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasLightParent) && ! TESTBIT(mask,kIsSecondary) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsHadron ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Reconstructed hadron
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && ! TESTBIT(mask,kIsMuon) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsMuon ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Track is muon
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsQuarkoniumMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Mu from quarkonium decay
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kHasQuarkoniumParent) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsSecondaryMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon from secondary decays in absorber
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( TESTBIT(mask,kIsID) && TESTBIT(mask,kIsMuon) && TESTBIT(mask,kIsSecondary) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsUnidentified ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Unidentified muon
+ Long64_t mask = GetMask(track,mcEvent);
+ return ( ! TESTBIT(mask,kIsID) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsWBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon from W boson decays
+ return ( IsMuon(track,mcEvent) && CheckAncestor(track,mcEvent,24) );
+}
+
+//_________________________________________________________
+Bool_t AliUtilityMuonAncestor::IsZBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent )
+{
+ /// Muon from Z boson decays
+ return ( IsMuon(track,mcEvent) && CheckAncestor(track,mcEvent,kZ0) );
+}
-#ifndef ALIUTILITYMUONANCESTOR_H\r
-#define ALIUTILITYMUONANCESTOR_H\r
-\r
-/* $Id: AliUtilityMuonAncestor.h 47782 2011-02-24 18:37:31Z martinez $ */ \r
-\r
-//\r
-// MC utility to classify single muons\r
-//\r
-// Author: Diego Stocco\r
-//\r
-\r
-#include "TObject.h"\r
-\r
-class AliMCEvent;\r
-class AliVParticle;\r
-\r
-class AliUtilityMuonAncestor : public TObject {\r
-public:\r
- \r
- AliUtilityMuonAncestor();\r
- ~AliUtilityMuonAncestor();\r
- AliUtilityMuonAncestor(const AliUtilityMuonAncestor& obj);\r
- AliUtilityMuonAncestor& operator=(const AliUtilityMuonAncestor& obj);\r
- \r
- enum {\r
- kIsID,\r
- kIsMuon,\r
- kIsSecondary,\r
- kHasLightParent,\r
- kHasCharmParent,\r
- kHasBeautyParent,\r
- kHasQuarkoniumParent\r
- };\r
- \r
- Bool_t CheckAncestor ( AliVParticle* track, const AliMCEvent* mcEvent, Int_t ancestorPdg, Bool_t matchAbsPdg = kTRUE );\r
- \r
- Int_t GetAncestor ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Int_t GetAncestorPdg ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Long64_t GetMask ( AliVParticle* track, const AliMCEvent* mcEvent );\r
-\r
- Bool_t IsBeautyMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsBJpsiMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsCharmMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsDecayMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsHadron ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsMuon ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsQuarkoniumMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsSecondaryMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsUnidentified ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsWBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- Bool_t IsZBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent );\r
-\r
- \r
-private:\r
- Bool_t BuildAncestor ( AliVParticle* track, const AliMCEvent* mcEvent );\r
- \r
- \r
- \r
- Double_t fPx; ///< Particle px\r
- Double_t fPy; ///< Particle py\r
- Double_t fPz; ///< Particle pz\r
- Long64_t fMask; ///< Mask\r
- Int_t fAncestor; ///< Ancestor position in stack\r
- \r
- ClassDef(AliUtilityMuonAncestor, 0);\r
-};\r
-\r
-#endif\r
+#ifndef ALIUTILITYMUONANCESTOR_H
+#define ALIUTILITYMUONANCESTOR_H
+
+/* $Id: AliUtilityMuonAncestor.h 47782 2011-02-24 18:37:31Z martinez $ */
+
+//
+// MC utility to classify single muons
+//
+// Author: Diego Stocco
+//
+
+#include "TObject.h"
+
+class AliMCEvent;
+class AliVParticle;
+
+class AliUtilityMuonAncestor : public TObject {
+public:
+
+ AliUtilityMuonAncestor();
+ ~AliUtilityMuonAncestor();
+ AliUtilityMuonAncestor(const AliUtilityMuonAncestor& obj);
+ AliUtilityMuonAncestor& operator=(const AliUtilityMuonAncestor& obj);
+
+ enum {
+ kIsID,
+ kIsMuon,
+ kIsSecondary,
+ kHasLightParent,
+ kHasCharmParent,
+ kHasBeautyParent,
+ kHasQuarkoniumParent
+ };
+
+ Bool_t CheckAncestor ( AliVParticle* track, const AliMCEvent* mcEvent, Int_t ancestorPdg, Bool_t matchAbsPdg = kTRUE );
+
+ Int_t GetAncestor ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Int_t GetAncestorPdg ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Long64_t GetMask ( AliVParticle* track, const AliMCEvent* mcEvent );
+
+ Bool_t IsBeautyMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsBJpsiMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsCharmMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsDecayMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsHadron ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsMuon ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsQuarkoniumMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsSecondaryMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsUnidentified ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsWBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+ Bool_t IsZBosonMu ( AliVParticle* track, const AliMCEvent* mcEvent );
+
+
+private:
+ Bool_t BuildAncestor ( AliVParticle* track, const AliMCEvent* mcEvent );
+
+
+
+ Double_t fPx; ///< Particle px
+ Double_t fPy; ///< Particle py
+ Double_t fPz; ///< Particle pz
+ Long64_t fMask; ///< Mask
+ Int_t fAncestor; ///< Ancestor position in stack
+
+ ClassDef(AliUtilityMuonAncestor, 0);
+};
+
+#endif
-#ifndef ALIANALYSISTASKMINIJET_H\r
-#define ALIANALYSISTASKMINIJET_H\r
-\r
-// Two-particle correlations using all particles over pt threshold\r
-// Extract mini-jet yield and fragmentation properties via Delta-Phi histograms\r
-// Can use ESD or AOD, reconstructed and Monte Carlo data as input\r
-// Author: eva.sicking@cern.ch\r
-\r
-class TList;\r
-class TH1F;\r
-class TH2F;\r
-class TProfile;\r
-class THnSparse;\r
-class AliESDtrackCuts;\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include <vector>\r
-\r
-class AliAnalysisTaskMinijet : public AliAnalysisTaskSE {\r
- public:\r
- AliAnalysisTaskMinijet(const char *name="<default name>");\r
- virtual ~AliAnalysisTaskMinijet();\r
- \r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t* option);\r
- virtual void Terminate(Option_t *);\r
- virtual void SetCuts(AliESDtrackCuts* cuts){fCuts = cuts;}\r
- \r
- void SetUseMC(Bool_t useMC=kTRUE, Bool_t mcOnly=kFALSE) {fUseMC = useMC; fMcOnly=mcOnly;}\r
- void SetAnalyseOnlyPrimaries(Bool_t analysePrimOnly) {fAnalysePrimOnly = analysePrimOnly;} // not used anymore\r
- void SetPtRange(Float_t ptMin, Float_t ptMax) {fPtMin = ptMin; fPtMax = ptMax; }\r
- void SetTriggerPtCut(Float_t triggerPtCut) {fTriggerPtCut = triggerPtCut;} \r
- void SetAssociatePtCut(Float_t associatePtCut) {fAssociatePtCut = associatePtCut;} \r
- void SetModeEsdAod(Int_t mode) {fMode = mode;}\r
- void SetTriggerMask(Int_t triggerType) {fTriggerType = triggerType;}\r
- void SetFilterBit(Int_t filterBit) {fFilterBit = filterBit;}\r
- void SetMaxVertexZ(Float_t vertexZCut) {fVertexZCut = vertexZCut;}\r
- void SetMaxEta(Float_t etaCut) {fEtaCut = etaCut;}\r
- void SetMaxEtaSeed(Float_t etaCutSeed) {fEtaCutSeed = etaCutSeed;}\r
- void SetSelectParticles(Int_t selectParticles) {fSelectParticles = selectParticles;}\r
- void SetSelectParticlesAssoc(Int_t selectParticlesAssoc) {fSelectParticlesAssoc = selectParticlesAssoc;}\r
- void SetCheckSDD(Bool_t checkSDD, Int_t selOption) {fCheckSDD = checkSDD; fSelOption = selOption;}\r
- void SetCorrStrangeness(Bool_t corrStrangeness) {fCorrStrangeness = corrStrangeness;}\r
- void SetThreeParticleCorrelation(Bool_t threeParticleCorr) {fThreeParticleCorr = threeParticleCorr;}\r
- void SetRejectCorrupted(Bool_t rejectChunks, Int_t nTPC) {fRejectChunks = rejectChunks; fNTPC = nTPC;}\r
-\r
- void SetCentralityMethod(TString centralityMethod) {fCentralityMethod = centralityMethod;}\r
- \r
- \r
- private:\r
-\r
- Double_t ReadEventESD (std::vector<Float_t> &pt, std::vector<Float_t> &eta,\r
- std::vector<Float_t> &phi, std::vector<Short_t> &charge,\r
- std::vector<Float_t> &strangnessWeight,\r
- std::vector<Double_t> &nTracksTracklets, const Int_t step);\r
- Double_t ReadEventESDRecMcProp(std::vector<Float_t> &pt, std::vector<Float_t> &eta,\r
- std::vector<Float_t> &phi, std::vector<Short_t> &charge,\r
- std::vector<Float_t> &strangnessWeight,\r
- std::vector<Double_t> &nTracksTracklets, const Int_t step);\r
- Double_t ReadEventESDMC (std::vector<Float_t> &pt, std::vector<Float_t> &eta,\r
- std::vector<Float_t> &phi, std::vector<Short_t> &charge,\r
- std::vector<Float_t> &strangnessWeight,\r
- std::vector<Double_t> &nTracksTracklets, const Int_t step);\r
- \r
- Double_t ReadEventAOD (std::vector<Float_t> &pt, std::vector<Float_t> &eta,\r
- std::vector<Float_t> &phi, std::vector<Short_t> &charge,\r
- std::vector<Float_t> &strangnessWeight,\r
- std::vector<Double_t> &nTracksTracklets, const Int_t step);\r
- Double_t ReadEventAODRecMcProp(std::vector<Float_t> &pt, std::vector<Float_t> &eta,\r
- std::vector<Float_t> &phi, std::vector<Short_t> &charge,\r
- std::vector<Float_t> &strangnessWeight,\r
- std::vector<Double_t> &nTracksTracklets, const Int_t step);\r
- Double_t ReadEventAODMC (std::vector<Float_t> &pt, std::vector<Float_t> &eta,\r
- std::vector<Float_t> &phi, std::vector<Short_t> &charge,\r
- std::vector<Float_t> &strangnessWeight,\r
- std::vector<Double_t> &nTracksTracklets, const Int_t step);\r
- \r
- void Analyse (const std::vector<Float_t> &pt, \r
- const std::vector<Float_t> &eta, \r
- const std::vector<Float_t> &phi, \r
- const std::vector<Short_t> &charge, \r
- const std::vector<Float_t> &strangnessWeight,\r
- const Double_t ntacks, const Int_t ntacklets=0,\r
- const Int_t nAll=0, const Int_t step=0);\r
- \r
- Bool_t SelectParticlePlusCharged(const Short_t charge, const Int_t pdg, const Bool_t prim);\r
- Bool_t SelectParticle(const Short_t charge, const Int_t pdg, const Bool_t prim);\r
- Bool_t CheckEvent(const Bool_t recVertex);\r
- const Double_t* CreateLogAxis(const Int_t nbins, const Double_t xmin, const Double_t xmax); \r
- Bool_t CheckLikeSign(const Short_t chargeEventAxis, const Short_t chargeOthers);\r
-\r
-\r
- Bool_t fUseMC; // flag for Monte Carlo usages\r
- Bool_t fMcOnly; // flag defines, if only MC data is used in analysis or also reconstructed data\r
- Double_t fBSign; // magnetic field\r
- Bool_t fAnalysePrimOnly; // flag for analysis of primaries only (also in reconstructed data)\r
- Float_t fPtMin; // set lower limit for pt acceptance for mutliplicity defintion\r
- Float_t fPtMax; // set upper limit for pt acceptance for mutliplicity defintion\r
- AliESDtrackCuts* fCuts; // List of cuts for ESDs\r
- Float_t fTriggerPtCut; // cut on particle pt used as event axis\r
- Float_t fAssociatePtCut; // cut on particle pt used for correlations\r
- Int_t fMode; // ESD(=0) of AOD(=1) reading \r
- Int_t fTriggerType; // sets trigger -> AliVEvent::kMB, AliVEvent::kHighMult\r
- Int_t fFilterBit; // Filter bit written in ESD filter, select track type\r
- Float_t fVertexZCut; // vertex cut\r
- Float_t fEtaCut; // eta acceptance cut\r
- Float_t fEtaCutSeed; // eta acceptance cut for seed\r
- Int_t fSelectParticles; // only in cas of MC: use also neutral particles or not \r
- Int_t fSelectParticlesAssoc; // only in cas of MC: use also neutral particles or not \r
- Bool_t fCheckSDD; // check if SDD was in read out partition (needed for LHC11a)\r
- Int_t fSelOption; // 0 = use hit in SDD for event selection, 1 = use trigger for event selection\r
- Bool_t fCorrStrangeness; // for data correction -> Pythia simulations underestimate contamination from strangness\r
- Bool_t fThreeParticleCorr; // perform three particle correlation\r
- Bool_t fRejectChunks; // rejection of chunks in which no ITS tracks are reconstructed\r
- Int_t fNTPC; // track number limit for rejection decision.\r
-\r
- AliESDEvent *fESDEvent; //! esd event\r
- AliAODEvent *fAODEvent; //! aod event\r
- Double_t fNMcPrimAccept; // global variable for mc multiplucity\r
- Double_t fNRecAccept; // global variable for rec multiplucity\r
- Float_t fNRecAcceptStrangeCorr; // global variable for rec multiplucity\r
- Double_t fNMcPrimAcceptTracklet; // global variable for mc multiplucity\r
- Double_t fNRecAcceptTracklet; // global variable for rec multiplucity\r
- Float_t fVzEvent; // global variable for rec vertex position\r
- Double_t fMeanPtRec; // global variable for rec mean pt\r
- Double_t fLeadingPtRec; // global variable for rec mean pt\r
-\r
- TList *fHists; // output list\r
- TH1F *fStep; // how many events have passed which correction step\r
- TH1F *fEventStat; // how many events are accepted by trigger, vertex selection, 1 track in acceptance (for real data)\r
- TH1F *fHistPt; // Pt spectrum ESD\r
- TH1F *fHistPtMC; // Pt spectrum MC\r
- TH2F *fNContrNtracklets; // control histogram for vertex->nContributers and number of tracklets\r
- TH2F *fNContrNtracks; // control histogram for vertex->nContributers and number of tracks\r
- TH2F *fCorruptedChunks; // control histogram: TPC tracks versus ITS-TPC-tracks\r
- TH2F *fCorruptedChunksAfter; // control histogram: TPC tracks versus ITS-TPC-tracks\r
-\r
- TH2F *fNmcNch; // N mc - N ch rec\r
- TProfile *fPNmcNch; // N mc - N ch rec\r
- TH2F *fNmcNchVtx; // N mc - N ch rec for events with reconstructed vertex\r
- TH2F *fNmcNchVtxStrangeCorr; // N mc - N ch rec for events with reconstructed vertex + strangeness correction\r
- TProfile *fPNmcNchVtx; // N mc - N ch rec for events with reconstructed vertex\r
- TH2F *fNmcNchTracklet; // N mc - N ch rec\r
- TProfile *fPNmcNchTracklet; // N mc - N ch rec\r
- TH2F *fNmcNchVtxTracklet; // N mc - N ch rec for events with reconstructed vertex\r
- TProfile *fPNmcNchVtxTracklet; // N mc - N ch rec for events with reconstructed vertex\r
- TH2F *fChargedPi0; // charged versus charged+Pi0\r
- TH1F *fVertexCheck; // check which fraction of events has vtx_rec but no good vtx_mc\r
- TH1F *fPropagateDca; // check of AliAODtrack::PropagateToDca\r
-\r
- THnSparse *fMapSingleTrig[8]; //! multi-dim histo for trigger track properties\r
- THnSparse *fMapPair[8]; //! multi-dim histo for pair properties\r
- THnSparse *fMapEvent[8]; //! multi-dim histo for event properties\r
- THnSparse *fMapAll[8]; //! multi-dim histo for properties of all analysed tracks\r
- THnSparse *fMapThree[8]; //! multi-dim histo for properties of three particle correlations\r
- \r
- TH1F * fVertexZ[8]; // z of vertex\r
- TH1F * fNcharge[8]; // pt\r
- TH1F * fPt[8]; // pt\r
- TH1F * fEta[8]; // eta\r
- TH1F * fPhi[8]; // phi\r
- TH1F * fDcaXY[8]; // dca xy direction\r
- TH1F * fDcaZ[8]; // dca z direction\r
-\r
- TH1F * fPtSeed[8]; // pt of seed (event axis)\r
- TH1F * fEtaSeed[8]; // eta of seed \r
- TH1F * fPhiSeed[8]; // phi of seed\r
-\r
- TH1F * fPtOthers[8]; // pt of all other particels used in dEtadPhi\r
- TH1F * fEtaOthers[8]; // eta of all other particels used in dEtadPhi\r
- TH1F * fPhiOthers[8]; // phi of all other particels used in dEtadPhi\r
- TH2F * fPtEtaOthers[8]; // pt-eta of all other particels used in dEtadPhi\r
-\r
-\r
- TH2F * fPhiEta[8]; // eta - phi\r
- TH2F * fDPhiDEtaEventAxis[8]; // correlation dEta-dPhi towards event axis\r
- TH2F * fDPhiDEtaEventAxisSeeds[8]; // correlation dEta-dPhi towards event axis of trigger particles\r
- TH1F * fTriggerNch[8]; // number of triggers with accepted-track number\r
- TH2F * fTriggerNchSeeds[8]; // number of triggers with accepted-track number\r
- TH1F * fTriggerTracklet[8]; // number of triggers with accepted-tracklet number\r
- TH2F * fNch07Nch[8]; // nCharged with pT>fTriggerPtCut vs nCharged\r
- TProfile * fPNch07Nch[8]; // nCharged with pT>fTriggerPtCut vs nCharged\r
- \r
- TH2F * fNch07Tracklet[8]; // nCharged with pT>fTriggerPtCut vs nTracklet\r
- TH2F * fNchTracklet[8]; // nCharged vs nTracklet\r
- TProfile * fPNch07Tracklet[8]; // nCharged with pT>fTriggerPtCut vs nTracklet\r
-\r
- TH1F * fDPhiEventAxis[8]; // delta phi of associate tracks to event axis\r
- TH2F * fDPhi1DPhi2[8]; // dPhi1 versus dPhi2: three particle correlation test\r
- \r
- TString fCentralityMethod; //centrality pA\r
- \r
- AliAnalysisTaskMinijet(const AliAnalysisTaskMinijet&); // not implemented\r
- AliAnalysisTaskMinijet& operator=(const AliAnalysisTaskMinijet&); // not implemented\r
- \r
- ClassDef(AliAnalysisTaskMinijet, 2); // mini jet analysis with two particle correlations\r
-};\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKMINIJET_H
+#define ALIANALYSISTASKMINIJET_H
+
+// Two-particle correlations using all particles over pt threshold
+// Extract mini-jet yield and fragmentation properties via Delta-Phi histograms
+// Can use ESD or AOD, reconstructed and Monte Carlo data as input
+// Author: eva.sicking@cern.ch
+
+class TList;
+class TH1F;
+class TH2F;
+class TProfile;
+class THnSparse;
+class AliESDtrackCuts;
+
+#include "AliAnalysisTaskSE.h"
+#include <vector>
+
+class AliAnalysisTaskMinijet : public AliAnalysisTaskSE {
+ public:
+ AliAnalysisTaskMinijet(const char *name="<default name>");
+ virtual ~AliAnalysisTaskMinijet();
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t* option);
+ virtual void Terminate(Option_t *);
+ virtual void SetCuts(AliESDtrackCuts* cuts){fCuts = cuts;}
+
+ void SetUseMC(Bool_t useMC=kTRUE, Bool_t mcOnly=kFALSE) {fUseMC = useMC; fMcOnly=mcOnly;}
+ void SetAnalyseOnlyPrimaries(Bool_t analysePrimOnly) {fAnalysePrimOnly = analysePrimOnly;} // not used anymore
+ void SetPtRange(Float_t ptMin, Float_t ptMax) {fPtMin = ptMin; fPtMax = ptMax; }
+ void SetTriggerPtCut(Float_t triggerPtCut) {fTriggerPtCut = triggerPtCut;}
+ void SetAssociatePtCut(Float_t associatePtCut) {fAssociatePtCut = associatePtCut;}
+ void SetModeEsdAod(Int_t mode) {fMode = mode;}
+ void SetTriggerMask(Int_t triggerType) {fTriggerType = triggerType;}
+ void SetFilterBit(Int_t filterBit) {fFilterBit = filterBit;}
+ void SetMaxVertexZ(Float_t vertexZCut) {fVertexZCut = vertexZCut;}
+ void SetMaxEta(Float_t etaCut) {fEtaCut = etaCut;}
+ void SetMaxEtaSeed(Float_t etaCutSeed) {fEtaCutSeed = etaCutSeed;}
+ void SetSelectParticles(Int_t selectParticles) {fSelectParticles = selectParticles;}
+ void SetSelectParticlesAssoc(Int_t selectParticlesAssoc) {fSelectParticlesAssoc = selectParticlesAssoc;}
+ void SetCheckSDD(Bool_t checkSDD, Int_t selOption) {fCheckSDD = checkSDD; fSelOption = selOption;}
+ void SetCorrStrangeness(Bool_t corrStrangeness) {fCorrStrangeness = corrStrangeness;}
+ void SetThreeParticleCorrelation(Bool_t threeParticleCorr) {fThreeParticleCorr = threeParticleCorr;}
+ void SetRejectCorrupted(Bool_t rejectChunks, Int_t nTPC) {fRejectChunks = rejectChunks; fNTPC = nTPC;}
+
+ void SetCentralityMethod(TString centralityMethod) {fCentralityMethod = centralityMethod;}
+
+
+ private:
+
+ Double_t ReadEventESD (std::vector<Float_t> &pt, std::vector<Float_t> &eta,
+ std::vector<Float_t> &phi, std::vector<Short_t> &charge,
+ std::vector<Float_t> &strangnessWeight,
+ std::vector<Double_t> &nTracksTracklets, const Int_t step);
+ Double_t ReadEventESDRecMcProp(std::vector<Float_t> &pt, std::vector<Float_t> &eta,
+ std::vector<Float_t> &phi, std::vector<Short_t> &charge,
+ std::vector<Float_t> &strangnessWeight,
+ std::vector<Double_t> &nTracksTracklets, const Int_t step);
+ Double_t ReadEventESDMC (std::vector<Float_t> &pt, std::vector<Float_t> &eta,
+ std::vector<Float_t> &phi, std::vector<Short_t> &charge,
+ std::vector<Float_t> &strangnessWeight,
+ std::vector<Double_t> &nTracksTracklets, const Int_t step);
+
+ Double_t ReadEventAOD (std::vector<Float_t> &pt, std::vector<Float_t> &eta,
+ std::vector<Float_t> &phi, std::vector<Short_t> &charge,
+ std::vector<Float_t> &strangnessWeight,
+ std::vector<Double_t> &nTracksTracklets, const Int_t step);
+ Double_t ReadEventAODRecMcProp(std::vector<Float_t> &pt, std::vector<Float_t> &eta,
+ std::vector<Float_t> &phi, std::vector<Short_t> &charge,
+ std::vector<Float_t> &strangnessWeight,
+ std::vector<Double_t> &nTracksTracklets, const Int_t step);
+ Double_t ReadEventAODMC (std::vector<Float_t> &pt, std::vector<Float_t> &eta,
+ std::vector<Float_t> &phi, std::vector<Short_t> &charge,
+ std::vector<Float_t> &strangnessWeight,
+ std::vector<Double_t> &nTracksTracklets, const Int_t step);
+
+ void Analyse (const std::vector<Float_t> &pt,
+ const std::vector<Float_t> &eta,
+ const std::vector<Float_t> &phi,
+ const std::vector<Short_t> &charge,
+ const std::vector<Float_t> &strangnessWeight,
+ const Double_t ntacks, const Int_t ntacklets=0,
+ const Int_t nAll=0, const Int_t step=0);
+
+ Bool_t SelectParticlePlusCharged(const Short_t charge, const Int_t pdg, const Bool_t prim);
+ Bool_t SelectParticle(const Short_t charge, const Int_t pdg, const Bool_t prim);
+ Bool_t CheckEvent(const Bool_t recVertex);
+ const Double_t* CreateLogAxis(const Int_t nbins, const Double_t xmin, const Double_t xmax);
+ Bool_t CheckLikeSign(const Short_t chargeEventAxis, const Short_t chargeOthers);
+
+
+ Bool_t fUseMC; // flag for Monte Carlo usages
+ Bool_t fMcOnly; // flag defines, if only MC data is used in analysis or also reconstructed data
+ Double_t fBSign; // magnetic field
+ Bool_t fAnalysePrimOnly; // flag for analysis of primaries only (also in reconstructed data)
+ Float_t fPtMin; // set lower limit for pt acceptance for mutliplicity defintion
+ Float_t fPtMax; // set upper limit for pt acceptance for mutliplicity defintion
+ AliESDtrackCuts* fCuts; // List of cuts for ESDs
+ Float_t fTriggerPtCut; // cut on particle pt used as event axis
+ Float_t fAssociatePtCut; // cut on particle pt used for correlations
+ Int_t fMode; // ESD(=0) of AOD(=1) reading
+ Int_t fTriggerType; // sets trigger -> AliVEvent::kMB, AliVEvent::kHighMult
+ Int_t fFilterBit; // Filter bit written in ESD filter, select track type
+ Float_t fVertexZCut; // vertex cut
+ Float_t fEtaCut; // eta acceptance cut
+ Float_t fEtaCutSeed; // eta acceptance cut for seed
+ Int_t fSelectParticles; // only in cas of MC: use also neutral particles or not
+ Int_t fSelectParticlesAssoc; // only in cas of MC: use also neutral particles or not
+ Bool_t fCheckSDD; // check if SDD was in read out partition (needed for LHC11a)
+ Int_t fSelOption; // 0 = use hit in SDD for event selection, 1 = use trigger for event selection
+ Bool_t fCorrStrangeness; // for data correction -> Pythia simulations underestimate contamination from strangness
+ Bool_t fThreeParticleCorr; // perform three particle correlation
+ Bool_t fRejectChunks; // rejection of chunks in which no ITS tracks are reconstructed
+ Int_t fNTPC; // track number limit for rejection decision.
+
+ AliESDEvent *fESDEvent; //! esd event
+ AliAODEvent *fAODEvent; //! aod event
+ Double_t fNMcPrimAccept; // global variable for mc multiplucity
+ Double_t fNRecAccept; // global variable for rec multiplucity
+ Float_t fNRecAcceptStrangeCorr; // global variable for rec multiplucity
+ Double_t fNMcPrimAcceptTracklet; // global variable for mc multiplucity
+ Double_t fNRecAcceptTracklet; // global variable for rec multiplucity
+ Float_t fVzEvent; // global variable for rec vertex position
+ Double_t fMeanPtRec; // global variable for rec mean pt
+ Double_t fLeadingPtRec; // global variable for rec mean pt
+
+ TList *fHists; // output list
+ TH1F *fStep; // how many events have passed which correction step
+ TH1F *fEventStat; // how many events are accepted by trigger, vertex selection, 1 track in acceptance (for real data)
+ TH1F *fHistPt; // Pt spectrum ESD
+ TH1F *fHistPtMC; // Pt spectrum MC
+ TH2F *fNContrNtracklets; // control histogram for vertex->nContributers and number of tracklets
+ TH2F *fNContrNtracks; // control histogram for vertex->nContributers and number of tracks
+ TH2F *fCorruptedChunks; // control histogram: TPC tracks versus ITS-TPC-tracks
+ TH2F *fCorruptedChunksAfter; // control histogram: TPC tracks versus ITS-TPC-tracks
+
+ TH2F *fNmcNch; // N mc - N ch rec
+ TProfile *fPNmcNch; // N mc - N ch rec
+ TH2F *fNmcNchVtx; // N mc - N ch rec for events with reconstructed vertex
+ TH2F *fNmcNchVtxStrangeCorr; // N mc - N ch rec for events with reconstructed vertex + strangeness correction
+ TProfile *fPNmcNchVtx; // N mc - N ch rec for events with reconstructed vertex
+ TH2F *fNmcNchTracklet; // N mc - N ch rec
+ TProfile *fPNmcNchTracklet; // N mc - N ch rec
+ TH2F *fNmcNchVtxTracklet; // N mc - N ch rec for events with reconstructed vertex
+ TProfile *fPNmcNchVtxTracklet; // N mc - N ch rec for events with reconstructed vertex
+ TH2F *fChargedPi0; // charged versus charged+Pi0
+ TH1F *fVertexCheck; // check which fraction of events has vtx_rec but no good vtx_mc
+ TH1F *fPropagateDca; // check of AliAODtrack::PropagateToDca
+
+ THnSparse *fMapSingleTrig[8]; //! multi-dim histo for trigger track properties
+ THnSparse *fMapPair[8]; //! multi-dim histo for pair properties
+ THnSparse *fMapEvent[8]; //! multi-dim histo for event properties
+ THnSparse *fMapAll[8]; //! multi-dim histo for properties of all analysed tracks
+ THnSparse *fMapThree[8]; //! multi-dim histo for properties of three particle correlations
+
+ TH1F * fVertexZ[8]; // z of vertex
+ TH1F * fNcharge[8]; // pt
+ TH1F * fPt[8]; // pt
+ TH1F * fEta[8]; // eta
+ TH1F * fPhi[8]; // phi
+ TH1F * fDcaXY[8]; // dca xy direction
+ TH1F * fDcaZ[8]; // dca z direction
+
+ TH1F * fPtSeed[8]; // pt of seed (event axis)
+ TH1F * fEtaSeed[8]; // eta of seed
+ TH1F * fPhiSeed[8]; // phi of seed
+
+ TH1F * fPtOthers[8]; // pt of all other particels used in dEtadPhi
+ TH1F * fEtaOthers[8]; // eta of all other particels used in dEtadPhi
+ TH1F * fPhiOthers[8]; // phi of all other particels used in dEtadPhi
+ TH2F * fPtEtaOthers[8]; // pt-eta of all other particels used in dEtadPhi
+
+
+ TH2F * fPhiEta[8]; // eta - phi
+ TH2F * fDPhiDEtaEventAxis[8]; // correlation dEta-dPhi towards event axis
+ TH2F * fDPhiDEtaEventAxisSeeds[8]; // correlation dEta-dPhi towards event axis of trigger particles
+ TH1F * fTriggerNch[8]; // number of triggers with accepted-track number
+ TH2F * fTriggerNchSeeds[8]; // number of triggers with accepted-track number
+ TH1F * fTriggerTracklet[8]; // number of triggers with accepted-tracklet number
+ TH2F * fNch07Nch[8]; // nCharged with pT>fTriggerPtCut vs nCharged
+ TProfile * fPNch07Nch[8]; // nCharged with pT>fTriggerPtCut vs nCharged
+
+ TH2F * fNch07Tracklet[8]; // nCharged with pT>fTriggerPtCut vs nTracklet
+ TH2F * fNchTracklet[8]; // nCharged vs nTracklet
+ TProfile * fPNch07Tracklet[8]; // nCharged with pT>fTriggerPtCut vs nTracklet
+
+ TH1F * fDPhiEventAxis[8]; // delta phi of associate tracks to event axis
+ TH2F * fDPhi1DPhi2[8]; // dPhi1 versus dPhi2: three particle correlation test
+
+ TString fCentralityMethod; //centrality pA
+
+ AliAnalysisTaskMinijet(const AliAnalysisTaskMinijet&); // not implemented
+ AliAnalysisTaskMinijet& operator=(const AliAnalysisTaskMinijet&); // not implemented
+
+ ClassDef(AliAnalysisTaskMinijet, 2); // mini jet analysis with two particle correlations
+};
+
+#endif
ClassDef( AliPIDCorrParticle, 1); // class which contains only quantities requires for this analysis to reduce memory consumption for event mixing
};
-\r
+
#endif
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-#include "AliTwoParticlePIDCorr.h"\r
-#include "AliVParticle.h"\r
-#include "TFormula.h"\r
-#include "TAxis.h"\r
-#include "TChain.h"\r
-#include "TTree.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h"\r
-#include "TList.h"\r
-#include "TFile.h"\r
-\r
-#include "AliCentrality.h"\r
-#include "Riostream.h"\r
-\r
-#include <TSpline.h>\r
-#include <AliPID.h>\r
-#include "AliESDpid.h"\r
-#include "AliAODpidUtil.h"\r
-#include <AliPIDResponse.h>\r
-\r
-#include <AliAnalysisManager.h>\r
-#include <AliInputEventHandler.h>\r
-#include "AliAODInputHandler.h"\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliCentrality.h"\r
-\r
-#include "AliVEvent.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODTrack.h"\r
-#include "AliVTrack.h"\r
-\r
-#include "THnSparse.h"\r
-\r
-#include "AliAODMCHeader.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliMCEvent.h"\r
-#include "AliMCParticle.h"\r
-#include "TParticle.h"\r
-#include <TDatabasePDG.h>\r
-#include <TParticlePDG.h>\r
-\r
-#include "AliGenCocktailEventHeader.h"\r
-#include "AliGenEventHeader.h"\r
-\r
-#include "AliEventPoolManager.h"\r
-//#include "AliAnalysisUtils.h"\r
-using namespace AliPIDNameSpace;\r
-using namespace std;\r
-\r
-ClassImp(AliTwoParticlePIDCorr)\r
-ClassImp(LRCParticlePID)\r
-//________________________________________________________________________\r
-AliTwoParticlePIDCorr::AliTwoParticlePIDCorr() // All data members should be initialised here\r
-:AliAnalysisTaskSE(),\r
- fOutput(0),\r
- fCentralityMethod("V0A"),\r
- fSampleType("pPb"),\r
-fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)\r
- trkVtx(0),\r
- zvtx(0),\r
- fFilterBit(768),\r
- fzvtxcut(10.0),\r
- ffilltrigassoUNID(kFALSE),\r
- ffilltrigUNIDassoID(kFALSE),\r
- ffilltrigIDassoUNID(kTRUE),\r
- ffilltrigIDassoID(kFALSE),\r
- ffilltrigIDassoIDMCTRUTH(kFALSE),\r
- fPtOrderMCTruth(kFALSE),\r
- fTriggerSpeciesSelection(kFALSE),\r
- fAssociatedSpeciesSelection(kFALSE),\r
- fTriggerSpecies(SpPion),\r
- fAssociatedSpecies(SpPion),\r
- fCustomBinning(""),\r
- fBinningString(""),\r
- fcontainPIDtrig(kTRUE),\r
- fcontainPIDasso(kFALSE),\r
-//frejectPileUp(kFALSE),\r
- fminPt(0.2),\r
- fmaxPt(10.0),\r
- fmineta(-0.8),\r
- fmaxeta(0.8),\r
- fminprotonsigmacut(-6.0),\r
- fmaxprotonsigmacut(-3.0),\r
- fminpionsigmacut(0.0),\r
- fmaxpionsigmacut(4.0),\r
- fselectprimaryTruth(kTRUE),\r
- fonlyprimarydatareco(kFALSE),\r
- fdcacut(kFALSE),\r
- fdcacutvalue(3.0),\r
- ffillhistQAReco(kFALSE),\r
- ffillhistQATruth(kFALSE),\r
- kTrackVariablesPair(0),\r
- fminPtTrig(0),\r
- fmaxPtTrig(0),\r
- fminPtComboeff(2.0),\r
- fmaxPtComboeff(4.0), \r
- fminPtAsso(0),\r
- fmaxPtAsso(0), \r
- fhistcentrality(0),\r
- fEventCounter(0),\r
- fEtaSpectrasso(0),\r
- fphiSpectraasso(0),\r
- MCtruthpt(0),\r
- MCtrutheta(0),\r
- MCtruthphi(0),\r
- MCtruthpionpt(0),\r
- MCtruthpioneta(0),\r
- MCtruthpionphi(0),\r
- MCtruthkaonpt(0),\r
- MCtruthkaoneta(0),\r
- MCtruthkaonphi(0),\r
- MCtruthprotonpt(0),\r
- MCtruthprotoneta(0),\r
- MCtruthprotonphi(0),\r
- fPioncont(0),\r
- fKaoncont(0),\r
- fProtoncont(0),\r
- fCentralityCorrelation(0x0),\r
- fHistoTPCdEdx(0x0),\r
- fHistoTOFbeta(0x0),\r
- fTPCTOFPion3d(0),\r
- fTPCTOFKaon3d(0),\r
- fTPCTOFProton3d(0),\r
- fPionPt(0),\r
- fPionEta(0),\r
- fPionPhi(0),\r
- fKaonPt(0),\r
- fKaonEta(0),\r
- fKaonPhi(0),\r
- fProtonPt(0),\r
- fProtonEta(0),\r
- fProtonPhi(0),\r
- fCorrelatonTruthPrimary(0),\r
- fCorrelatonTruthPrimarymix(0),\r
- fTHnCorrUNID(0),\r
- fTHnCorrUNIDmix(0),\r
- fTHnCorrID(0),\r
- fTHnCorrIDmix(0),\r
- fTHnCorrIDUNID(0),\r
- fTHnCorrIDUNIDmix(0),\r
- fTHnTrigcount(0),\r
- fTHnTrigcountMCTruthPrim(0),\r
- fPoolMgr(0x0),\r
- fArrayMC(0),\r
- fAnalysisType("MCAOD"), \r
- fefffilename(""),\r
- twoTrackEfficiencyCutValue(0.02),\r
-//fControlConvResoncances(0),\r
- fPID(NULL),\r
- eventno(0),\r
- fPtTOFPIDmin(0.6),\r
- fPtTOFPIDmax(4.0),\r
- fRequestTOFPID(kTRUE),\r
- fPIDType(NSigmaTPCTOF),\r
- fNSigmaPID(3),\r
- fUseExclusiveNSigma(kFALSE),\r
- fRemoveTracksT0Fill(kFALSE),\r
-fSelectCharge(0),\r
-fTriggerSelectCharge(0),\r
-fAssociatedSelectCharge(0),\r
-fTriggerRestrictEta(-1),\r
-fEtaOrdering(kFALSE),\r
-fCutConversions(kFALSE),\r
-fCutResonances(kFALSE),\r
-fRejectResonanceDaughters(-1),\r
- fOnlyOneEtaSide(0),\r
-fInjectedSignals(kFALSE),\r
- fRemoveWeakDecays(kFALSE),\r
-fRemoveDuplicates(kFALSE),\r
- fapplyTrigefficiency(kFALSE),\r
- fapplyAssoefficiency(kFALSE),\r
- ffillefficiency(kFALSE),\r
- fmesoneffrequired(kFALSE),\r
- fkaonprotoneffrequired(kFALSE),\r
-//fAnalysisUtils(0x0),\r
- fDCAXYCut(0) \r
-\r
-{ \r
- for ( Int_t i = 0; i < 16; i++) { \r
- fHistQA[i] = NULL;\r
- }\r
-\r
- for ( Int_t i = 0; i < 6; i++ ){\r
- fTHnrecomatchedallPid[i] = NULL;\r
- fTHngenprimPidTruth[i] = NULL;\r
- effcorection[i]=NULL;\r
- //effmap[i]=NULL;\r
-\r
- }\r
-\r
- for(Int_t ipart=0;ipart<NSpecies;ipart++)\r
- for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++)\r
- fnsigmas[ipart][ipid]=999.;\r
-\r
- for(Int_t ipart=0;ipart<NSpecies;ipart++) {fHasDoubleCounting[ipart]=kFALSE;}\r
-\r
- }\r
-//________________________________________________________________________\r
-AliTwoParticlePIDCorr::AliTwoParticlePIDCorr(const char *name) // All data members should be initialised here\r
- :AliAnalysisTaskSE(name),\r
- fOutput(0),\r
- fCentralityMethod("V0A"),\r
- fSampleType("pPb"),\r
- fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)\r
- trkVtx(0),\r
- zvtx(0),\r
- fFilterBit(768),\r
- fzvtxcut(10.0),\r
- ffilltrigassoUNID(kFALSE),\r
- ffilltrigUNIDassoID(kFALSE),\r
- ffilltrigIDassoUNID(kTRUE),\r
- ffilltrigIDassoID(kFALSE),\r
- ffilltrigIDassoIDMCTRUTH(kFALSE),\r
- fPtOrderMCTruth(kFALSE),\r
- fTriggerSpeciesSelection(kFALSE),\r
- fAssociatedSpeciesSelection(kFALSE),\r
- fTriggerSpecies(SpPion),\r
- fAssociatedSpecies(SpPion),\r
- fCustomBinning(""),\r
- fBinningString(""),\r
- fcontainPIDtrig(kTRUE),\r
- fcontainPIDasso(kFALSE),\r
- // frejectPileUp(kFALSE),\r
- fminPt(0.2),\r
- fmaxPt(10.0),\r
- fmineta(-0.8),\r
- fmaxeta(0.8),\r
- fminprotonsigmacut(-6.0),\r
- fmaxprotonsigmacut(-3.0),\r
- fminpionsigmacut(0.0),\r
- fmaxpionsigmacut(4.0),\r
- fselectprimaryTruth(kTRUE),\r
- fonlyprimarydatareco(kFALSE),\r
- fdcacut(kFALSE),\r
- fdcacutvalue(3.0),\r
- ffillhistQAReco(kFALSE),\r
- ffillhistQATruth(kFALSE),\r
- kTrackVariablesPair(0),\r
- fminPtTrig(0),\r
- fmaxPtTrig(0),\r
- fminPtComboeff(2.0),\r
- fmaxPtComboeff(4.0), \r
- fminPtAsso(0),\r
- fmaxPtAsso(0), \r
- fhistcentrality(0),\r
- fEventCounter(0),\r
- fEtaSpectrasso(0),\r
- fphiSpectraasso(0),\r
- MCtruthpt(0),\r
- MCtrutheta(0),\r
- MCtruthphi(0),\r
- MCtruthpionpt(0),\r
- MCtruthpioneta(0),\r
- MCtruthpionphi(0),\r
- MCtruthkaonpt(0),\r
- MCtruthkaoneta(0),\r
- MCtruthkaonphi(0),\r
- MCtruthprotonpt(0),\r
- MCtruthprotoneta(0),\r
- MCtruthprotonphi(0),\r
- fPioncont(0),\r
- fKaoncont(0),\r
- fProtoncont(0),\r
- fCentralityCorrelation(0x0),\r
- fHistoTPCdEdx(0x0),\r
- fHistoTOFbeta(0x0),\r
- fTPCTOFPion3d(0),\r
- fTPCTOFKaon3d(0),\r
- fTPCTOFProton3d(0),\r
- fPionPt(0),\r
- fPionEta(0),\r
- fPionPhi(0),\r
- fKaonPt(0),\r
- fKaonEta(0),\r
- fKaonPhi(0),\r
- fProtonPt(0),\r
- fProtonEta(0),\r
- fProtonPhi(0),\r
- fCorrelatonTruthPrimary(0),\r
- fCorrelatonTruthPrimarymix(0),\r
- fTHnCorrUNID(0),\r
- fTHnCorrUNIDmix(0),\r
- fTHnCorrID(0),\r
- fTHnCorrIDmix(0),\r
- fTHnCorrIDUNID(0),\r
- fTHnCorrIDUNIDmix(0),\r
- fTHnTrigcount(0),\r
- fTHnTrigcountMCTruthPrim(0),\r
- fPoolMgr(0x0),\r
- fArrayMC(0),\r
- fAnalysisType("MCAOD"),\r
- fefffilename(""), \r
- twoTrackEfficiencyCutValue(0.02),\r
-//fControlConvResoncances(0),\r
- fPID(NULL),\r
- eventno(0),\r
- fPtTOFPIDmin(0.6),\r
- fPtTOFPIDmax(4.0),\r
- fRequestTOFPID(kTRUE),\r
- fPIDType(NSigmaTPCTOF),\r
- fNSigmaPID(3),\r
- fUseExclusiveNSigma(kFALSE),\r
- fRemoveTracksT0Fill(kFALSE),\r
-fSelectCharge(0),\r
-fTriggerSelectCharge(0),\r
-fAssociatedSelectCharge(0),\r
-fTriggerRestrictEta(-1),\r
-fEtaOrdering(kFALSE),\r
-fCutConversions(kFALSE),\r
-fCutResonances(kFALSE),\r
-fRejectResonanceDaughters(-1),\r
- fOnlyOneEtaSide(0),\r
-fInjectedSignals(kFALSE),\r
- fRemoveWeakDecays(kFALSE),\r
-fRemoveDuplicates(kFALSE),\r
- fapplyTrigefficiency(kFALSE),\r
- fapplyAssoefficiency(kFALSE),\r
- ffillefficiency(kFALSE),\r
- fmesoneffrequired(kFALSE),\r
- fkaonprotoneffrequired(kFALSE),\r
- //fAnalysisUtils(0x0),\r
- fDCAXYCut(0) \r
-{\r
- \r
- for ( Int_t i = 0; i < 16; i++) { \r
- fHistQA[i] = NULL;\r
- }\r
- \r
-for ( Int_t i = 0; i < 6; i++ ){\r
- fTHnrecomatchedallPid[i] = NULL;\r
- fTHngenprimPidTruth[i] = NULL;\r
- effcorection[i]=NULL;\r
- //effmap[i]=NULL;\r
-\r
- }\r
-\r
- for(Int_t ipart=0;ipart<NSpecies;ipart++)\r
- for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++)\r
- fnsigmas[ipart][ipid]=999.;\r
-\r
- for(Int_t ipart=0;ipart<NSpecies;ipart++) {fHasDoubleCounting[ipart]=kFALSE;}\r
-\r
- // The last in the above list should not have a comma after it\r
- \r
- // Constructor\r
- // Define input and output slots here (never in the dummy constructor)\r
- // Input slot #0 works with a TChain - it is connected to the default input container\r
- // Output slot #1 writes into a TH1 container\r
- \r
- DefineOutput(1, TList::Class()); // for output list\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-AliTwoParticlePIDCorr::~AliTwoParticlePIDCorr()\r
-{\r
- // Destructor. Clean-up the output list, but not the histograms that are put inside\r
- // (the list is owner and will clean-up these histograms). Protect in PROOF case.\r
- if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {\r
- delete fOutput;\r
-\r
- }\r
- if (fPID) delete fPID;\r
- \r
- }\r
-//________________________________________________________________________\r
-Float_t AliTwoParticlePIDCorr::PhiRange(Float_t DPhi)\r
-\r
-{\r
- //\r
- // Puts the argument in the range [-pi/2,3 pi/2].\r
- //\r
- \r
- if (DPhi < -TMath::Pi()/2) DPhi += 2*TMath::Pi();\r
- if (DPhi > 3*TMath::Pi()/2) DPhi -= 2*TMath::Pi(); \r
-\r
- return DPhi;\r
- \r
-}\r
-//________________________________________________________________________\r
-void AliTwoParticlePIDCorr::UserCreateOutputObjects()\r
-{\r
- // Create histograms\r
- // Called once (on the worker node)\r
- AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());\r
- fPID = inputHandler->GetPIDResponse();\r
-\r
- //AliAnalysisUtils *fUtils = new AliAnalysisUtils();\r
-\r
-//get the efficiency correction map\r
-\r
-\r
- fOutput = new TList();\r
- fOutput->SetOwner(); // IMPORTANT! \r
-\r
- Int_t centmultbins=10;\r
- Double_t centmultmin=0.0;\r
- Double_t centmultmax=100.0;\r
- if(fSampleType=="pPb" || fSampleType=="PbPb")\r
- {\r
- centmultbins=10;\r
- centmultmin=0.0;\r
- centmultmax=100.0;\r
- }\r
- if(fSampleType=="pp")\r
- {\r
- centmultbins=10;\r
- centmultmin=0.0;\r
- centmultmax=200.0;\r
- }\r
-\r
-fhistcentrality=new TH1F("fhistcentrality","fhistcentrality",centmultbins*4,centmultmin,centmultmax);\r
-fOutput->Add(fhistcentrality);\r
-\r
- fEventCounter = new TH1F("fEventCounter","EventCounter", 10, 0.5,10.5);\r
- fEventCounter->GetXaxis()->SetBinLabel(1,"Event Accesed");\r
- fEventCounter->GetXaxis()->SetBinLabel(2,"Have a vertex");\r
- fEventCounter->GetXaxis()->SetBinLabel(5,"After vertex Cut");\r
- fEventCounter->GetXaxis()->SetBinLabel(6,"Within 0-100% centrality");\r
- fEventCounter->GetXaxis()->SetBinLabel(7,"Event Analyzed");\r
- //fEventCounter->GetXaxis()->SetBinLabel(8,"Event Analysis finished");\r
- fOutput->Add(fEventCounter);\r
- \r
-fEtaSpectrasso=new TH2F("fEtaSpectraasso","fEtaSpectraasso",180,-0.9,0.9,100,0.,20. );\r
-fOutput->Add(fEtaSpectrasso);\r
-\r
-fphiSpectraasso=new TH2F("fphiSpectraasso","fphiSpectraasso",72,0,2*TMath::Pi(),100,0.,20.);\r
-fOutput->Add(fphiSpectraasso);\r
-\r
-\r
- if(fSampleType=="pPb" || fSampleType=="PbPb"){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 20000, 0,40000);\r
- fOutput->Add(fCentralityCorrelation);\r
- }\r
-\r
-fHistoTPCdEdx = new TH2F("hHistoTPCdEdx", ";p_{T} (GeV/c);dE/dx (au.)",200,0.0,10.0,500, 0., 500.);\r
-fOutput->Add(fHistoTPCdEdx);\r
-fHistoTOFbeta = new TH2F(Form("hHistoTOFbeta"), ";p_{T} (GeV/c);v/c",70, 0., 7., 500, 0.1, 1.1);\r
- fOutput->Add(fHistoTOFbeta);\r
- \r
- fTPCTOFPion3d=new TH3F ("fTPCTOFpion3d", "fTPCTOFpion3d",100,0., 10., 120,-60.,60.,120,-60.,60);\r
- fOutput->Add(fTPCTOFPion3d);\r
- \r
- fTPCTOFKaon3d=new TH3F ("fTPCTOFKaon3d", "fTPCTOFKaon3d",100,0., 10., 120,-60.,60.,120,-60.,60);\r
- fOutput->Add(fTPCTOFKaon3d);\r
-\r
- fTPCTOFProton3d=new TH3F ("fTPCTOFProton3d", "fTPCTOFProton3d",100,0., 10., 120,-60.,60.,120,-60.,60);\r
- fOutput->Add(fTPCTOFProton3d);\r
-\r
-if(ffillhistQAReco)\r
- {\r
- fPionPt = new TH1F("fHistQAPionPt","p_{T} distribution",200,0.,10.);\r
- fOutput->Add(fPionPt);\r
- fPionEta= new TH1F("fHistQAPionEta","#eta distribution",360,-1.8,1.8);\r
- fOutput->Add(fPionEta);\r
- fPionPhi = new TH1F("fHistQAPionPhi","#phi distribution",340,0,6.8);\r
- fOutput->Add(fPionPhi);\r
- \r
- fKaonPt = new TH1F("fHistQAKaonPt","p_{T} distribution",200,0.,10.);\r
- fOutput->Add(fKaonPt);\r
- fKaonEta= new TH1F("fHistQAKaonEta","#eta distribution",360,-1.8,1.8);\r
- fOutput->Add(fKaonEta);\r
- fKaonPhi = new TH1F("fHistQAKaonPhi","#phi distribution",340,0,6.8);\r
- fOutput->Add(fKaonPhi);\r
- \r
- fProtonPt = new TH1F("fHistQAProtonPt","p_{T} distribution",200,0.,10.);\r
- fOutput->Add(fProtonPt);\r
- fProtonEta= new TH1F("fHistQAProtonEta","#eta distribution",360,-1.8,1.8);\r
- fOutput->Add(fProtonEta);\r
- fProtonPhi= new TH1F("fHistQAProtonPhi","#phi distribution",340,0,6.8);\r
- fOutput->Add(fProtonPhi);\r
- }\r
-\r
- fHistQA[0] = new TH1F("fHistQAvx", "Histo Vx All ", 50, -5., 5.);\r
- fHistQA[1] = new TH1F("fHistQAvy", "Histo Vy All", 50, -5., 5.);\r
- fHistQA[2] = new TH1F("fHistQAvz", "Histo Vz All", 50, -25., 25.); \r
- fHistQA[3] = new TH1F("fHistQAvxA", "Histo Vx After Cut ", 50, -5., 5.);\r
- fHistQA[4] = new TH1F("fHistQAvyA", "Histo Vy After Cut", 50, -5., 5.);\r
- fHistQA[5] = new TH1F("fHistQAvzA", "Histo Vz After Cut", 50, -25., 25.);\r
- fHistQA[6] = new TH1F("fHistQADcaXyC", "Histo DCAxy after cut", 50, -5., 5.);\r
- fHistQA[7] = new TH1F("fHistQADcaZC", "Histo DCAz after cut", 50, -5., 5.); \r
- fHistQA[8] = new TH1F("fHistQAPt","p_{T} distribution",200,0.,10.);\r
- fHistQA[9] = new TH1F("fHistQAEta","#eta distribution",360,-1.8,1.8);\r
- fHistQA[10] = new TH1F("fHistQAPhi","#phi distribution",340,0,6.8);\r
- fHistQA[11] = new TH1F("fHistQANCls","Number of TPC cluster",200,0,200);\r
- fHistQA[13] = new TH1F("fHistQAChi2","Chi2 per NDF",100,0,10);\r
- fHistQA[12] = new TH1F("fHistQANCls1","Number of TPC cluster1",200,0,200);\r
- fHistQA[14] = new TH1F("nCrossedRowsTPC","Number of TPC ccrossed rows",200,0,200);\r
- fHistQA[15] = new TH1F("ratioCrossedRowsOverFindableClustersTPC","Number of TPC ccrossed rows find clusters",200,0,2);\r
-\r
-for(Int_t i = 0; i < 16; i++)\r
- {\r
- fOutput->Add(fHistQA[i]);\r
- }\r
-\r
- kTrackVariablesPair=6 ;\r
-\r
- if(fcontainPIDtrig && !fcontainPIDasso) kTrackVariablesPair=7;\r
- \r
- if(!fcontainPIDtrig && fcontainPIDasso) kTrackVariablesPair=7;\r
- \r
- if(fcontainPIDtrig && fcontainPIDasso) kTrackVariablesPair=8;\r
- \r
- \r
-// two particle histograms\r
- Int_t iBinPair[kTrackVariablesPair]; // binning for track variables\r
- Double_t* dBinsPair[kTrackVariablesPair]; // bins for track variables \r
- TString* axisTitlePair; // axis titles for track variables\r
- axisTitlePair=new TString[kTrackVariablesPair];\r
-\r
- TString defaultBinningStr;\r
- 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"\r
- "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"\r
- "p_t_leading_course: 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0,10.0\n"\r
- "p_t_eff: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"\r
- "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"\r
- "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 \r
- "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"\r
- "multiplicity: 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1\n";\r
-\r
- if(fcontainPIDtrig){\r
- defaultBinningStr += "PIDTrig: -0.5,0.5,1.5,2.5,3.5\n"; // course\r
- }\r
- if(fcontainPIDasso){\r
- defaultBinningStr += "PIDAsso: -0.5,0.5,1.5,2.5,3.5\n"; // course\r
- }\r
- // =========================================================\r
- // Customization (adopted from AliUEHistograms)\r
- // =========================================================\r
-\r
- TObjArray* lines = defaultBinningStr.Tokenize("\n");\r
- for (Int_t i=0; i<lines->GetEntriesFast(); i++)\r
- {\r
- TString line(lines->At(i)->GetName());\r
- TString tag = line(0, line.Index(":")+1);\r
- if (!fCustomBinning.BeginsWith(tag) && !fCustomBinning.Contains(TString("\n") + tag))\r
- fBinningString += line + "\n";\r
- else\r
- AliInfo(Form("Using custom binning for %s", tag.Data()));\r
- }\r
- delete lines;\r
- fBinningString += fCustomBinning;\r
- \r
- AliInfo(Form("Used THn Binning:\n%s",fBinningString.Data()));\r
-\r
- // =========================================================\r
- // Now set the bins\r
- // =========================================================\r
-\r
- dBinsPair[0] = GetBinning(fBinningString, "multiplicity", iBinPair[0]);\r
- axisTitlePair[0] = " multiplicity";\r
-\r
- dBinsPair[1] = GetBinning(fBinningString, "vertex", iBinPair[1]);\r
- axisTitlePair[1] = "v_{Z} (cm)"; \r
-\r
- dBinsPair[2] = GetBinning(fBinningString, "p_t_leading_course", iBinPair[2]);\r
- axisTitlePair[2] = "p_{T,trig.} (GeV/c)"; \r
-\r
- dBinsPair[3] = GetBinning(fBinningString, "p_t_assoc", iBinPair[3]);\r
- axisTitlePair[3] = "p_{T,assoc.} (GeV/c)";\r
-\r
- dBinsPair[4] = GetBinning(fBinningString, "delta_eta", iBinPair[4]);\r
- axisTitlePair[4] = "#Delta#eta"; \r
-\r
- dBinsPair[5] = GetBinning(fBinningString, "delta_phi", iBinPair[5]);\r
- axisTitlePair[5] = "#Delta#varphi (rad)"; \r
-\r
- if(fcontainPIDtrig && !fcontainPIDasso){\r
- dBinsPair[6] = GetBinning(fBinningString, "PIDTrig", iBinPair[6]);\r
- axisTitlePair[6] = "PIDTrig"; \r
- }\r
-\r
- if(!fcontainPIDtrig && fcontainPIDasso){\r
- dBinsPair[6] = GetBinning(fBinningString, "PIDAsso", iBinPair[6]);\r
- axisTitlePair[6] = "PIDAsso"; \r
- }\r
-\r
-if(fcontainPIDtrig && fcontainPIDasso){\r
-\r
- dBinsPair[6] = GetBinning(fBinningString, "PIDTrig", iBinPair[6]);\r
- axisTitlePair[6] = "PIDTrig";\r
-\r
- dBinsPair[7] = GetBinning(fBinningString, "PIDAsso", iBinPair[7]);\r
- axisTitlePair[7] = "PIDAsso"; \r
- }\r
- \r
- Int_t nEtaBin = -1;\r
- Double_t* EtaBin = GetBinning(fBinningString, "eta", nEtaBin);\r
- \r
- Int_t nPteffbin = -1;\r
- Double_t* Pteff = GetBinning(fBinningString, "p_t_eff", nPteffbin);\r
-\r
-\r
- fminPtTrig=dBinsPair[2][0];\r
- fmaxPtTrig=dBinsPair[2][iBinPair[2]];\r
- fminPtAsso=dBinsPair[3][0];\r
- fmaxPtAsso=dBinsPair[3][iBinPair[3]];\r
-\r
- //fminPtComboeff=fminPtTrig;***then this value will be fixed ,even Setter can't change it's value\r
- //fmaxPtComboeff=fmaxPtTrig;\r
-//THnSparses for calculation of efficiency\r
-\r
- if((fAnalysisType =="MCAOD") && ffillefficiency) {\r
- const Int_t nDim = 4;// cent zvtx pt eta\r
- Int_t fBinsCh[nDim] = {iBinPair[0], iBinPair[1], nPteffbin ,nEtaBin};//**********************change it\r
- Double_t fMinCh[nDim] = { dBinsPair[0][0],dBinsPair[1][0], Pteff[0], EtaBin[0] };\r
- Double_t fMaxCh[nDim] = { dBinsPair[0][iBinPair[0]], dBinsPair[1][iBinPair[1]], Pteff[nPteffbin], EtaBin[nEtaBin]};\r
-\r
-TString Histrename;\r
-for(Int_t jj=0;jj<6;jj++)//PID type binning\r
- {\r
- Histrename="fTHnrecomatchedallPid";Histrename+=jj;\r
- fTHnrecomatchedallPid[jj] = new THnSparseF(Histrename.Data(),"cent:zvtx::Pt:eta", nDim, fBinsCh, fMinCh, fMaxCh); \r
- fTHnrecomatchedallPid[jj]->Sumw2(); \r
- fTHnrecomatchedallPid[jj]->GetAxis(0)->Set(iBinPair[0], dBinsPair[0]);\r
- fTHnrecomatchedallPid[jj]->GetAxis(0)->SetTitle("Centrality");\r
- fTHnrecomatchedallPid[jj]->GetAxis(1)->Set(iBinPair[1],dBinsPair[1]);\r
- fTHnrecomatchedallPid[jj]->GetAxis(1)->SetTitle("zvtx"); \r
- fTHnrecomatchedallPid[jj]->GetAxis(2)->Set(nPteffbin, Pteff); \r
- fTHnrecomatchedallPid[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");\r
- fTHnrecomatchedallPid[jj]->GetAxis(3)->Set(nEtaBin,EtaBin);\r
- fTHnrecomatchedallPid[jj]->GetAxis(3)->SetTitle("#eta");\r
- fOutput->Add(fTHnrecomatchedallPid[jj]);\r
-\r
-Histrename="fTHngenprimPidTruth";Histrename+=jj;\r
- fTHngenprimPidTruth[jj] = new THnSparseF(Histrename.Data(),"cent:zvtx::Pt:eta", nDim, fBinsCh, fMinCh, fMaxCh);\r
- fTHngenprimPidTruth[jj]->Sumw2(); \r
- fTHngenprimPidTruth[jj]->GetAxis(0)->Set(iBinPair[0],dBinsPair[0]);\r
- fTHngenprimPidTruth[jj]->GetAxis(0)->SetTitle("Centrality");\r
- fTHngenprimPidTruth[jj]->GetAxis(1)->Set(iBinPair[1], dBinsPair[1]);\r
- fTHngenprimPidTruth[jj]->GetAxis(1)->SetTitle("zvtx"); \r
- fTHngenprimPidTruth[jj]->GetAxis(2)->Set(nPteffbin, Pteff); \r
- fTHngenprimPidTruth[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");\r
- fTHngenprimPidTruth[jj]->GetAxis(3)->Set(nEtaBin, EtaBin);\r
- fTHngenprimPidTruth[jj]->GetAxis(3)->SetTitle("#eta");\r
- fOutput->Add(fTHngenprimPidTruth[jj]);\r
- }\r
- }\r
-\r
- Int_t fBins[kTrackVariablesPair];\r
- Double_t fMin[kTrackVariablesPair];\r
- Double_t fMax[kTrackVariablesPair];\r
-\r
-//ThnSparses for Correlation plots(data & MC)\r
- for(Int_t i=0;i<kTrackVariablesPair;i++)\r
- {\r
- fBins[i] =iBinPair[i];\r
- fMin[i]= dBinsPair[i][0];\r
- fMax[i] = dBinsPair[i][iBinPair[i]];\r
- }\r
- if(ffilltrigassoUNID)\r
- {\r
- fTHnCorrUNID = new THnSparseF("fTHnCorrUNID","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fTHnCorrUNID->Sumw2();\r
- for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fTHnCorrUNID,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fTHnCorrUNID);\r
- \r
-fTHnCorrUNIDmix = new THnSparseF("fTHnCorrUNIDmix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fTHnCorrUNIDmix->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fTHnCorrUNIDmix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fTHnCorrUNIDmix);\r
- }\r
-\r
- if(ffilltrigIDassoID)\r
- {\r
- fTHnCorrID = new THnSparseF("fTHnCorrID","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fTHnCorrID->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fTHnCorrID,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fTHnCorrID);\r
-\r
-fTHnCorrIDmix = new THnSparseF("fTHnCorrIDmix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fTHnCorrIDmix->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fTHnCorrIDmix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fTHnCorrIDmix);\r
- }\r
-\r
- if(ffilltrigUNIDassoID || ffilltrigIDassoUNID)//***********a bit tricky, be careful\r
- {\r
- fTHnCorrIDUNID = new THnSparseF("fTHnCorrIDUNID","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fTHnCorrIDUNID->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fTHnCorrIDUNID,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fTHnCorrIDUNID);\r
-\r
- fTHnCorrIDUNIDmix = new THnSparseF("fTHnCorrIDUNIDmix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fTHnCorrIDUNIDmix->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fTHnCorrIDUNIDmix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fTHnCorrIDUNIDmix);\r
- }\r
-\r
-\r
-\r
- //ThnSparse for Correlation plots(truth MC)\r
- if((fAnalysisType == "MCAOD") && ffilltrigIDassoIDMCTRUTH) {//remember that in this case uidentified means other than pions, kaons, protons\r
- fCorrelatonTruthPrimary = new THnSparseF("fCorrelatonTruthPrimary","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fCorrelatonTruthPrimary->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fCorrelatonTruthPrimary,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fCorrelatonTruthPrimary);\r
-\r
- fCorrelatonTruthPrimarymix = new THnSparseF("fCorrelatonTruthPrimarymix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax); \r
- fCorrelatonTruthPrimarymix->Sumw2();\r
-for(Int_t i=0; i<kTrackVariablesPair;i++){\r
- SetAsymmetricBin(fCorrelatonTruthPrimarymix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- fOutput->Add(fCorrelatonTruthPrimarymix);\r
- }\r
-\r
-\r
- //binning for trigger no. counting\r
-\r
- Double_t* fMint;\r
- Double_t* fMaxt;\r
- Int_t* fBinst;\r
- Int_t dims=3;\r
- if(fcontainPIDtrig) dims=4;\r
- fMint= new Double_t[dims];\r
- fMaxt= new Double_t[dims];\r
- fBinst= new Int_t[dims];\r
- for(Int_t i=0; i<3;i++)\r
- {\r
- fBinst[i]=iBinPair[i];\r
- fMint[i]=dBinsPair[i][0];\r
- fMaxt[i]=dBinsPair[i][iBinPair[i]];\r
- }\r
- if(fcontainPIDtrig){\r
- fBinst[3]=iBinPair[6];\r
- fMint[3]=dBinsPair[6][0];\r
- fMaxt[3]=dBinsPair[6][iBinPair[6]];\r
- }\r
-\r
- //ThSparse for trigger counting(data & reco MC)\r
- if(ffilltrigassoUNID || ffilltrigUNIDassoID || ffilltrigIDassoUNID || ffilltrigIDassoID)\r
- {\r
- fTHnTrigcount = new THnSparseF("fTHnTrigcount","cent:zvtx:pt", dims, fBinst, fMint, fMaxt); \r
- fTHnTrigcount->Sumw2();\r
-for(Int_t i=0; i<3;i++){\r
- SetAsymmetricBin(fTHnTrigcount,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
- if(fcontainPIDtrig) SetAsymmetricBin(fTHnTrigcount,3,dBinsPair[6],iBinPair[6],axisTitlePair[6]);\r
- fOutput->Add(fTHnTrigcount);\r
- }\r
- \r
- if((fAnalysisType =="MCAOD") && ffilltrigIDassoIDMCTRUTH) {\r
- //ThSparse for trigger counting(truth MC)\r
-fTHnTrigcountMCTruthPrim = new THnSparseF("fTHnTrigcountMCTruthPrim","cent:zvtx:pt", dims, fBinst, fMint, fMaxt); \r
- fTHnTrigcountMCTruthPrim->Sumw2();\r
-for(Int_t i=0; i<3;i++){\r
- SetAsymmetricBin(fTHnTrigcountMCTruthPrim,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);\r
- }\r
-if(fcontainPIDtrig) SetAsymmetricBin(fTHnTrigcountMCTruthPrim,3,dBinsPair[6],iBinPair[6],axisTitlePair[6]);\r
- fOutput->Add(fTHnTrigcountMCTruthPrim);\r
- }\r
-\r
-if(fAnalysisType=="MCAOD"){\r
- if(ffillhistQATruth)\r
- {\r
- MCtruthpt=new TH1F ("MCtruthpt","ptdistributiontruthprim",100,0.,10.);\r
- fOutput->Add(MCtruthpt);\r
-\r
- MCtrutheta=new TH1F ("MCtrutheta","etadistributiontruthprim",360,-1.8,1.8);\r
- fOutput->Add(MCtrutheta);\r
-\r
- MCtruthphi=new TH1F ("MCtruthphi","phidisttruthprim",340,0,6.8);\r
- fOutput->Add(MCtruthphi);\r
-\r
- MCtruthpionpt=new TH1F ("MCtruthpionpt","MCtruthpionpt",100,0.,10.);\r
- fOutput->Add(MCtruthpionpt);\r
-\r
- MCtruthpioneta=new TH1F ("MCtruthpioneta","MCtruthpioneta",360,-1.8,1.8);\r
- fOutput->Add(MCtruthpioneta);\r
-\r
- MCtruthpionphi=new TH1F ("MCtruthpionphi","MCtruthpionphi",340,0,6.8);\r
- fOutput->Add(MCtruthpionphi);\r
-\r
- MCtruthkaonpt=new TH1F ("MCtruthkaonpt","MCtruthkaonpt",100,0.,10.);\r
- fOutput->Add(MCtruthkaonpt);\r
-\r
- MCtruthkaoneta=new TH1F ("MCtruthkaoneta","MCtruthkaoneta",360,-1.8,1.8);\r
- fOutput->Add(MCtruthkaoneta);\r
-\r
- MCtruthkaonphi=new TH1F ("MCtruthkaonphi","MCtruthkaonphi",340,0,6.8);\r
- fOutput->Add(MCtruthkaonphi);\r
-\r
- MCtruthprotonpt=new TH1F ("MCtruthprotonpt","MCtruthprotonpt",100,0.,10.);\r
- fOutput->Add(MCtruthprotonpt);\r
-\r
- MCtruthprotoneta=new TH1F ("MCtruthprotoneta","MCtruthprotoneta",360,-1.8,1.8);\r
- fOutput->Add(MCtruthprotoneta);\r
-\r
- MCtruthprotonphi=new TH1F ("MCtruthprotonphi","MCtruthprotonphi",340,0,6.8);\r
- fOutput->Add(MCtruthprotonphi);\r
- }\r
- fPioncont=new TH2F("fPioncont", "fPioncont",10,-0.5,9.5,100,0.,10.);\r
- fOutput->Add(fPioncont);\r
-\r
- fKaoncont=new TH2F("fKaoncont","fKaoncont",10,-0.5,9.5,100,0.,10.);\r
- fOutput->Add(fKaoncont);\r
-\r
- fProtoncont=new TH2F("fProtoncont","fProtoncont",10,-0.5,9.5,100,0.,10.);\r
- fOutput->Add(fProtoncont);\r
- }\r
-\r
-//Mixing\r
-DefineEventPool();\r
-\r
- if(fapplyTrigefficiency || fapplyAssoefficiency)\r
- {\r
- const Int_t nDimt = 4;// cent zvtx pt eta\r
- Int_t fBinsCht[nDimt] = {iBinPair[0], iBinPair[1], nPteffbin ,nEtaBin};//*************change it\r
- Double_t fMinCht[nDimt] = { dBinsPair[0][0],dBinsPair[1][0], Pteff[0], EtaBin[0] };\r
- Double_t fMaxCht[nDimt] = {dBinsPair[0][iBinPair[0]], dBinsPair[1][iBinPair[1]], Pteff[nPteffbin], EtaBin[nEtaBin]};\r
-\r
- TString Histrexname;\r
-for(Int_t jj=0;jj<6;jj++)// PID type binning\r
- {\r
- Histrexname="effcorection";Histrexname+=jj;\r
- effcorection[jj] = new THnSparseF(Histrexname.Data(),"cent:zvtx::Pt:eta", nDimt, fBinsCht, fMinCht, fMaxCht);\r
- effcorection[jj]->Sumw2(); \r
- effcorection[jj]->GetAxis(0)->Set(iBinPair[0], dBinsPair[0]);\r
- effcorection[jj]->GetAxis(0)->SetTitle("Centrality");\r
- effcorection[jj]->GetAxis(1)->Set( iBinPair[1],dBinsPair[1]);\r
- effcorection[jj]->GetAxis(1)->SetTitle("zvtx"); \r
- effcorection[jj]->GetAxis(2)->Set(nPteffbin, Pteff); \r
- effcorection[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");\r
- effcorection[jj]->GetAxis(3)->Set( nEtaBin,EtaBin);\r
- effcorection[jj]->GetAxis(3)->SetTitle("#eta");\r
- fOutput->Add(effcorection[jj]);\r
- }\r
-// TFile *fsifile = new TFile(fefffilename,"READ");\r
- TFile *fileT=TFile::Open(fefffilename);\r
- TString Nameg;\r
-for(Int_t jj=0;jj<6;jj++)//type binning\r
- {\r
-Nameg="effmap";Nameg+=jj;\r
-//effcorection[jj] = (THnSparseF*)fsifile->Get(Nameg.Data());\r
-effcorection[jj] = (THnSparseF*)fileT->Get(Nameg.Data());\r
-\r
-//effcorection[jj]->SetDirectory(0);//****************************not present in case oh THnF\r
- }\r
-//fsifile->Close();\r
-fileT->Close();\r
-\r
- }\r
- \r
-//fControlConvResoncances = new TH2F("fControlConvResoncances", ";id;delta mass", 3, -0.5, 2.5, 100, -0.1, 0.1);\r
-// fOutput->Add(fControlConvResoncances);\r
-\r
- \r
- PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram\r
-}\r
-//-------------------------------------------------------------------------------\r
-void AliTwoParticlePIDCorr::UserExec( Option_t * ){\r
-\r
- \r
- if(fAnalysisType == "AOD") {\r
-\r
- doAODevent();\r
- \r
- }//AOD--analysis-----\r
-\r
- else if(fAnalysisType == "MCAOD") {\r
- \r
- doMCAODevent();\r
- \r
- }\r
- \r
- else return;\r
- \r
-}\r
-//-------------------------------------------------------------------------\r
-void AliTwoParticlePIDCorr::doMCAODevent() \r
-{\r
- AliVEvent *event = InputEvent();\r
- if (!event) { Printf("ERROR: Could not retrieve event"); return; }\r
- AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);\r
- if (!aod) {\r
- AliError("Cannot get the AOD event");\r
- return;\r
- }\r
- \r
-// count all events(physics triggered) \r
- fEventCounter->Fill(1);\r
-\r
- // get centrality object and check quality(valid for p-Pb and Pb-Pb)\r
- Double_t cent_v0=0.0;\r
-\r
- if(fSampleType=="pPb" || fSampleType=="PbPb")\r
- {\r
- AliCentrality *centrality=0;\r
- if(aod) \r
- centrality = aod->GetHeader()->GetCentralityP();\r
- // if (centrality->GetQuality() != 0) return ;\r
-\r
- if(centrality)\r
- { \r
- cent_v0 = centrality->GetCentralityPercentile(fCentralityMethod);\r
- }\r
- else\r
- {\r
- cent_v0= -1;\r
- }\r
- }\r
-\r
-//check the PIDResponse handler\r
- if (!fPID) return;\r
-\r
-// get mag. field required for twotrack efficiency cut\r
- Float_t bSign = 0;\r
- bSign = (aod->GetMagneticField() > 0) ? 1 : -1;\r
-\r
- //check for TClonesArray(truth track MC information)\r
-fArrayMC = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));\r
- if (!fArrayMC) {\r
- AliFatal("Error: MC particles branch not found!\n");\r
- return;\r
- }\r
- \r
- //check for AliAODMCHeader(truth event MC information)\r
- AliAODMCHeader *header=NULL;\r
- header=(AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); \r
- if(!header) {\r
- printf("MC header branch not found!\n");\r
- return;\r
- }\r
- \r
-//Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex\r
-Float_t zVtxmc =header->GetVtxZ();\r
- if(TMath::Abs(zVtxmc)>fzvtxcut) return;\r
-\r
- // For productions with injected signals, figure out above which label to skip particles/tracks\r
- Int_t skipParticlesAbove = 0;\r
-\r
- if (fInjectedSignals)\r
- {\r
- AliGenEventHeader* eventHeader = 0;\r
- Int_t headers = 0;\r
-\r
-// AOD\r
- if (!header)\r
- AliFatal("fInjectedSignals set but no MC header found");\r
- \r
- headers = header->GetNCocktailHeaders();\r
- eventHeader = header->GetCocktailHeader(0);\r
-\r
- if (!eventHeader)\r
- {\r
- // We avoid AliFatal here, because the AOD productions sometimes have events where the MC header is missing \r
- // (due to unreadable Kinematics) and we don't want to loose the whole job because of a few events\r
- AliError("First event header not found. Skipping this event.");\r
- //fHistos->FillEvent(centrality, AliUEHist::kCFStepAnaTopology);\r
- return;\r
- }\r
-skipParticlesAbove = eventHeader->NProduced();\r
- AliInfo(Form("Injected signals in this event (%d headers). Keeping events of %s. Will skip particles/tracks above %d.", headers, eventHeader->ClassName(), skipParticlesAbove));\r
- }\r
-\r
- //vertex selection(is it fine for PP?)\r
- if ( fSampleType=="pPb"){\r
- trkVtx = aod->GetPrimaryVertex();\r
- if (!trkVtx || trkVtx->GetNContributors()<=0) return;\r
- TString vtxTtl = trkVtx->GetTitle();\r
- if (!vtxTtl.Contains("VertexerTracks")) return;\r
- zvtx = trkVtx->GetZ();\r
- const AliAODVertex* spdVtx = aod->GetPrimaryVertexSPD();\r
- if (!spdVtx || spdVtx->GetNContributors()<=0) return;\r
- TString vtxTyp = spdVtx->GetTitle();\r
- Double_t cov[6]={0};\r
- spdVtx->GetCovarianceMatrix(cov);\r
- Double_t zRes = TMath::Sqrt(cov[5]);\r
- if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;\r
- if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;\r
- }\r
- else if(fSampleType=="PbPb" || fSampleType=="pp") {//for pp and pb-pb case\r
- Int_t nVertex = aod->GetNumberOfVertices();\r
- if( nVertex > 0 ) { \r
- trkVtx = aod->GetPrimaryVertex();\r
- Int_t nTracksPrim = trkVtx->GetNContributors();\r
- zvtx = trkVtx->GetZ();\r
- //if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));\r
- // Reject TPC only vertex\r
- TString name(trkVtx->GetName());\r
- if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return;\r
-\r
- // Select a quality vertex by number of tracks?\r
- if( nTracksPrim < fnTracksVertex ) {\r
- //if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");\r
- return ;\r
- }\r
- // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present\r
- //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)\r
- // return kFALSE;\r
- // if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");\r
- }\r
- else return;\r
-\r
- }\r
- else return;//as there is no proper sample type\r
-\r
-\r
- fHistQA[0]->Fill((trkVtx->GetX()));fHistQA[1]->Fill((trkVtx->GetY()));fHistQA[2]->Fill((trkVtx->GetZ())); //for trkVtx only before vertex cut |zvtx|<10 cm\r
-\r
- //count events having a proper vertex\r
- fEventCounter->Fill(2);\r
-\r
- if (TMath::Abs(zvtx) > fzvtxcut) return;\r
-\r
-fHistQA[3]->Fill((trkVtx->GetX()));fHistQA[4]->Fill((trkVtx->GetY()));fHistQA[5]->Fill((trkVtx->GetZ()));//after vertex cut for trkVtx only\r
-\r
-//now we have events passed physics trigger, centrality,eventzvtx cut \r
-\r
-//count events after vertex cut\r
- fEventCounter->Fill(5);\r
- \r
-if(!aod) return; //for safety\r
-\r
-if (fSampleType=="pPb" || fSampleType=="PbPb") if (cent_v0 < 0) return;//for pp case it is the multiplicity\r
-\r
- 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)\r
-\r
- Double_t cent_v0_truth=0.0;\r
-\r
- //TObjArray* tracksMCtruth=0;\r
-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\r
- tracksMCtruth->SetOwner(kTRUE); //***********************************IMPORTANT!\r
-\r
- eventno++;\r
-\r
- //There is a small difference between zvtx and zVtxmc?????? \r
- //cout<<"***********************************************zVtxmc="<<zVtxmc<<endl;\r
- //cout<<"***********************************************zvtx="<<zvtx<<endl;\r
- \r
-//now process the truth particles(for both efficiency & correlation function)\r
-Int_t nMCTrack = fArrayMC->GetEntriesFast();\r
- \r
-for (Int_t iMC = 0; iMC < nMCTrack; iMC++) \r
-{ //MC truth track loop starts\r
- \r
-AliAODMCParticle *partMC = (AliAODMCParticle*) fArrayMC->At(iMC);\r
- \r
- if(!partMC){\r
- AliError(Form("ERROR: Could not retrieve AODMCtrack %d",iMC));\r
- continue;\r
- }\r
-\r
-//consider only charged particles\r
- if(partMC->Charge() == 0) continue;\r
-\r
-//consider only primary particles; neglect all secondary particles including from weak decays\r
- if(fselectprimaryTruth && !partMC->IsPhysicalPrimary()) continue;\r
-\r
-\r
-//remove injected signals(primaries above <maxLabel>)\r
- if (fInjectedSignals && partMC->GetLabel() >= skipParticlesAbove) continue;\r
-\r
-//remove duplicates\r
- Bool_t isduplicate=kFALSE;\r
- if (fRemoveDuplicates)\r
- { \r
- for (Int_t j=iMC+1; j<nMCTrack; ++j) \r
- {//2nd trutuh loop starts\r
-AliAODMCParticle *partMC2 = (AliAODMCParticle*) fArrayMC->At(j);\r
- if(!partMC2){\r
- AliError(Form("ERROR: Could not retrieve AODMCtrack %d",j));\r
- continue;\r
- } \r
- if (partMC->GetLabel() == partMC2->GetLabel())\r
- {\r
-isduplicate=kTRUE;\r
- break; \r
- } \r
- }//2nd truth loop ends\r
- }\r
- if(fRemoveDuplicates && isduplicate) continue;//remove duplicates\r
-\r
-//give only kinematic cuts at the truth level \r
- if (partMC->Eta() < fmineta || partMC->Eta() > fmaxeta) continue;\r
- if (partMC->Pt() < fminPt || partMC->Pt() > fmaxPt) continue;\r
-\r
- if(!partMC) continue;//for safety\r
-\r
- //To determine multiplicity in case of PP\r
- nooftrackstruth++;\r
- //cout<<"**************************************"<<TMath::Abs(partMC->GetLabel())<<endl;\r
-//only physical primary(all/unidentified) \r
-if(ffillhistQATruth)\r
- {\r
- MCtruthpt->Fill(partMC->Pt());\r
- MCtrutheta->Fill(partMC->Eta());\r
- MCtruthphi->Fill(partMC->Phi());\r
- }\r
- //get particle ID\r
-Int_t pdgtruth=((AliAODMCParticle*)partMC)->GetPdgCode();\r
-Int_t particletypeTruth=-999;\r
- if (TMath::Abs(pdgtruth)==211)\r
- {\r
- particletypeTruth=SpPion;\r
-if(ffillhistQATruth)\r
- {\r
- MCtruthpionpt->Fill(partMC->Pt());\r
- MCtruthpioneta->Fill(partMC->Eta());\r
- MCtruthpionphi->Fill(partMC->Phi());\r
- }\r
- }\r
- if (TMath::Abs(pdgtruth)==321)\r
- {\r
- particletypeTruth=SpKaon;\r
-if(ffillhistQATruth)\r
- {\r
- MCtruthkaonpt->Fill(partMC->Pt());\r
- MCtruthkaoneta->Fill(partMC->Eta());\r
- MCtruthkaonphi->Fill(partMC->Phi());\r
- }\r
- }\r
-if(TMath::Abs(pdgtruth)==2212)\r
- {\r
- particletypeTruth=SpProton;\r
-if(ffillhistQATruth)\r
- {\r
- MCtruthprotonpt->Fill(partMC->Pt());\r
- MCtruthprotoneta->Fill(partMC->Eta());\r
- MCtruthprotonphi->Fill(partMC->Phi());\r
- }\r
- }\r
- 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)\r
-\r
- // -- Fill THnSparse for efficiency and contamination calculation\r
- if (fSampleType=="pp") cent_v0=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\r
-\r
- Double_t primmctruth[4] = {cent_v0, zVtxmc,partMC->Pt(), partMC->Eta()};\r
- if(ffillefficiency)\r
- {\r
- fTHngenprimPidTruth[5]->Fill(primmctruth);//for all primary truth particles(4)\r
-if (TMath::Abs(pdgtruth)==211 || TMath::Abs(pdgtruth)==321) fTHngenprimPidTruth[3]->Fill(primmctruth);//for primary truth mesons(3)\r
-if (TMath::Abs(pdgtruth)==2212 || TMath::Abs(pdgtruth)==321) fTHngenprimPidTruth[4]->Fill(primmctruth);//for primary truth kaons+protons(4)\r
- if (TMath::Abs(pdgtruth)==211) fTHngenprimPidTruth[0]->Fill(primmctruth);//for pions\r
- if (TMath::Abs(pdgtruth)==321) fTHngenprimPidTruth[1]->Fill(primmctruth);//for kaons\r
- if(TMath::Abs(pdgtruth)==2212) fTHngenprimPidTruth[2]->Fill(primmctruth);//for protons\r
- }\r
- \r
- Float_t effmatrixtruth=1.0;//In Truth MC, no case of efficiency correction so it should be always 1.0\r
-if(partMC->Pt()>=fminPtAsso || partMC->Pt()<=fmaxPtTrig)//to reduce memory consumption in pool\r
- {\r
-LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,partMC->Charge(),partMC->Pt(),partMC->Eta(), partMC->Phi(),effmatrixtruth);\r
-//copy6->SetUniqueID(eventno * 100000 + TMath::Abs(partMC->GetLabel()));\r
- copy6->SetUniqueID(eventno * 100000 + (Int_t)nooftrackstruth);\r
- tracksMCtruth->Add(copy6);//************** TObjArray used for truth correlation function calculation\r
- }\r
- }//MC truth track loop ends\r
-\r
-//*********************still in event loop\r
-\r
- if (fSampleType=="pp") cent_v0_truth=nooftrackstruth;\r
- else cent_v0_truth=cent_v0;//the notation cent_v0 is reserved for reco/data case\r
-\r
- //now cent_v0_truth should be used for all correlation function calculation\r
-\r
-if(nooftrackstruth>0.0 && ffilltrigIDassoIDMCTRUTH)\r
- {\r
- //Fill Correlations for MC truth particles(same event)\r
-if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)//hadron triggered correlation\r
- Fillcorrelation(tracksMCtruth,0,cent_v0_truth,zVtxmc,bSign,fPtOrderMCTruth,kFALSE,kFALSE,"trigIDassoIDMCTRUTH");//mixcase=kFALSE for same event case\r
-\r
-//start mixing\r
-AliEventPool* pool2 = fPoolMgr->GetEventPool(cent_v0_truth, zVtxmc+200);\r
-if (pool2 && pool2->IsReady())\r
- {//start mixing only when pool->IsReady\r
-if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)\r
- {//proceed only when no. of trigger particles >0 in current event\r
-for (Int_t jMix=0; jMix<pool2->GetCurrentNEvents(); jMix++) \r
- { //pool event loop start\r
- TObjArray* bgTracks6 = pool2->GetEvent(jMix);\r
- if(!bgTracks6) continue;\r
- Fillcorrelation(tracksMCtruth,bgTracks6,cent_v0_truth,zVtxmc,bSign,fPtOrderMCTruth,kFALSE,kTRUE,"trigIDassoIDMCTRUTH");//mixcase=kTRUE for mixing case\r
- \r
- }// pool event loop ends mixing case\r
- }//if(trackstrig && trackstrig->GetEntriesFast()>0) condition ends mixing case\r
-} //if pool->IsReady() condition ends mixing case\r
-\r
- //still in main event loop\r
-\r
- if(tracksMCtruth){\r
-if(pool2) pool2->UpdatePool(CloneAndReduceTrackList(tracksMCtruth));//ownership of tracksasso is with pool now, don't delete it\r
- }\r
- }\r
-\r
- //still in main event loop\r
-\r
-if(tracksMCtruth) delete tracksMCtruth;\r
-\r
-//now deal with reco tracks\r
- //TObjArray* tracksUNID=0;\r
- TObjArray* tracksUNID = new TObjArray;\r
- tracksUNID->SetOwner(kTRUE);\r
-\r
- //TObjArray* tracksID=0;\r
- TObjArray* tracksID = new TObjArray;\r
- tracksID->SetOwner(kTRUE);\r
-\r
-\r
- Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//used for reconstructed track dca cut\r
-\r
- Double_t trackscount=0.0;\r
-\r
-// loop over reconstructed tracks \r
- for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++) \r
-{ // reconstructed track loop starts\r
- AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrk));\r
- if (!track) continue;\r
- //get the corresponding MC track at the truth level (doing reco matching)\r
- AliAODMCParticle* recomatched = static_cast<AliAODMCParticle*>(fArrayMC->At(TMath::Abs(track->GetLabel())));\r
- if(!recomatched) continue;//if a reco track doesn't have corresponding truth track at generated level is a fake track(label==0), ignore it\r
-\r
-//remove injected signals \r
- if(fInjectedSignals)\r
- {\r
- AliAODMCParticle* mother = recomatched;\r
-\r
- while (!mother->IsPhysicalPrimary())\r
- {// find the primary mother;the first stable mother is searched and checked if it is <= <maxLabel>\r
- if (mother->GetMother() < 0)\r
- {\r
- mother = 0;\r
- break;\r
- }\r
- \r
- mother =(AliAODMCParticle*) fArrayMC->At(((AliAODMCParticle*)mother)->GetMother());\r
- if (!mother)\r
- break;\r
- }\r
- if (!mother)\r
- {\r
- Printf("WARNING: No mother found for particle %d:", recomatched->GetLabel());\r
- continue;\r
- }\r
- if (mother->GetLabel() >= skipParticlesAbove) continue;//remove injected signals(primaries above <maxLabel>)\r
- }//remove injected signals\r
-\r
- if (fRemoveWeakDecays && ((AliAODMCParticle*) recomatched)->IsSecondaryFromWeakDecay()) continue;//remove weak decays\r
- \r
- Bool_t isduplicate2=kFALSE;\r
-if (fRemoveDuplicates)\r
- {\r
- for (Int_t j =itrk+1; j < aod->GetNumberOfTracks(); j++) \r
- {//2nd loop starts\r
- AliAODTrack* track2 = dynamic_cast<AliAODTrack*>(aod->GetTrack(j));\r
- if (!track2) continue;\r
- AliAODMCParticle* recomatched2 = static_cast<AliAODMCParticle*>(fArrayMC->At(TMath::Abs(track2->GetLabel())));\r
-if(!recomatched2) continue;\r
-\r
-if (track->GetLabel() == track2->GetLabel())\r
- {\r
-isduplicate2=kTRUE;\r
- break; \r
- }\r
- }//2nd loop ends\r
- }\r
- if(fRemoveDuplicates && isduplicate2) continue;//remove duplicates\r
- \r
- fHistQA[11]->Fill(track->GetTPCNcls());\r
- Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1);//dcacut=kFALSE,onlyprimary=kFALSE\r
-\r
- if(tracktype==0) continue; \r
- if(tracktype==1)//tracks "not" passed AliAODTrack::kPrimary at reconstructed level & have proper TPC PID response(?)\r
-{\r
- if(!track) continue;//for safety\r
- //accepted all(primaries+secondary) reconstructed tracks(pt 0.2 to 10.0,,eta -0.8 to 0.8)\r
- trackscount++;\r
-\r
-//check for eta , phi holes\r
- fEtaSpectrasso->Fill(track->Eta(),track->Pt());\r
- fphiSpectraasso->Fill(track->Phi(),track->Pt());\r
-\r
- Int_t particletypeMC=-9999;\r
-\r
-//tag all particles as unidentified\r
- particletypeMC=unidentified;\r
-\r
- Float_t effmatrix=1.;\r
-\r
-// -- Fill THnSparse for efficiency calculation\r
- if (fSampleType=="pp") cent_v0=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicityi.e multiplicity intregated out )**************Important\r
- //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)\r
-\r
- //Clone & Reduce track list(TObjArray) for unidentified particles\r
-if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig)//to reduce memory consumption in pool\r
- {\r
- if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles\r
- effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletypeMC);\r
- LRCParticlePID* copy = new LRCParticlePID(particletypeMC,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);\r
- copy->SetUniqueID(eventno * 100000 +(Int_t)trackscount);\r
- tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)\r
- }\r
- Double_t allrecomatchedpid[4] = {cent_v0, zVtxmc,recomatched->Pt(), recomatched->Eta()};\r
-if(ffillefficiency) fTHnrecomatchedallPid[5]->Fill(allrecomatchedpid);//for all\r
-\r
- //now start the particle identification process:)\r
-\r
-//get the pdg code of the corresponding truth particle\r
- Int_t pdgCode = ((AliAODMCParticle*)recomatched)->GetPdgCode();\r
-\r
-Float_t dEdx = track->GetTPCsignal();\r
- fHistoTPCdEdx->Fill(track->Pt(), dEdx);\r
-\r
- if(HasTOFPID(track))\r
-{\r
-Float_t beta = GetBeta(track);\r
-fHistoTOFbeta->Fill(track->Pt(), beta);\r
- }\r
-\r
- //do track identification(nsigma method)\r
- particletypeMC=GetParticle(track);//******************************problem is here\r
-\r
-//2-d TPCTOF map(for each Pt interval)\r
- if(HasTOFPID(track)){\r
- fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);\r
- fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);\r
- fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]); \r
- }\r
- if(particletypeMC==SpUndefined) continue;\r
-\r
- //Pt, Eta , Phi distribution of the reconstructed identified particles\r
-if(ffillhistQAReco)\r
- {\r
-if (particletypeMC==SpPion)\r
- {\r
- fPionPt->Fill(track->Pt());\r
- fPionEta->Fill(track->Eta());\r
- fPionPhi->Fill(track->Phi());\r
- }\r
-if (particletypeMC==SpKaon)\r
- {\r
- fKaonPt->Fill(track->Pt());\r
- fKaonEta->Fill(track->Eta());\r
- fKaonPhi->Fill(track->Phi());\r
- }\r
-if (particletypeMC==SpProton)\r
- {\r
- fProtonPt->Fill(track->Pt());\r
- fProtonEta->Fill(track->Eta());\r
- fProtonPhi->Fill(track->Phi());\r
- }\r
- }\r
-\r
- //for misidentification fraction calculation(do it with tuneonPID)\r
- if(particletypeMC==SpPion )\r
- {\r
- if(TMath::Abs(pdgCode)==211) fPioncont->Fill(1.,track->Pt());\r
- if(TMath::Abs(pdgCode)==321) fPioncont->Fill(3.,track->Pt());\r
- if(TMath::Abs(pdgCode)==2212) fPioncont->Fill(5.,track->Pt());\r
- if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fPioncont->Fill(7.,track->Pt());\r
- }\r
-if(particletypeMC==SpKaon )\r
- {\r
- if(TMath::Abs(pdgCode)==211) fKaoncont->Fill(1.,track->Pt());\r
- if(TMath::Abs(pdgCode)==321) fKaoncont->Fill(3.,track->Pt());\r
- if(TMath::Abs(pdgCode)==2212) fKaoncont->Fill(5.,track->Pt());\r
- if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fKaoncont->Fill(7.,track->Pt());\r
- }\r
- if(particletypeMC==SpProton )\r
- {\r
- if(TMath::Abs(pdgCode)==211) fProtoncont->Fill(1.,track->Pt());\r
- if(TMath::Abs(pdgCode)==321) fProtoncont->Fill(3.,track->Pt());\r
- if(TMath::Abs(pdgCode)==2212) fProtoncont->Fill(5.,track->Pt());\r
- if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fProtoncont->Fill(7.,track->Pt());\r
- }\r
-\r
- //fill tracking efficiency\r
- if(ffillefficiency)\r
- {\r
- if(particletypeMC==SpPion || particletypeMC==SpKaon)\r
- {\r
-if(TMath::Abs(pdgCode)==211 || TMath::Abs(pdgCode)==321) fTHnrecomatchedallPid[3]->Fill(allrecomatchedpid);//for mesons\r
- }\r
- if(particletypeMC==SpKaon || particletypeMC==SpProton)\r
- {\r
-if(TMath::Abs(pdgCode)==321 || TMath::Abs(pdgCode)==2212) fTHnrecomatchedallPid[4]->Fill(allrecomatchedpid);//for kaons+protons\r
- }\r
- if(particletypeMC==SpPion && TMath::Abs(pdgCode)==211) fTHnrecomatchedallPid[0]->Fill(allrecomatchedpid);//for pions \r
- if(particletypeMC==SpKaon && TMath::Abs(pdgCode)==321) fTHnrecomatchedallPid[1]->Fill(allrecomatchedpid);//for kaons\r
- if(particletypeMC==SpProton && TMath::Abs(pdgCode)==2212) fTHnrecomatchedallPid[2]->Fill(allrecomatchedpid);//for protons\r
- }\r
-\r
-if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig)//to reduce memory consumption in pool\r
- {\r
-if (fapplyTrigefficiency || fapplyAssoefficiency)\r
- effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletypeMC);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles \r
- LRCParticlePID* copy1 = new LRCParticlePID(particletypeMC,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);\r
- copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);\r
- tracksID->Add(copy1);\r
- }\r
- }// if(tracktype==1) condition structure ands\r
-\r
-}//reco track loop ends\r
-\r
- //*************************************************************still in event loop\r
- \r
-//same event delta-eta-deltaphi plot \r
-if(fSampleType=="pp") cent_v0=trackscount;//multiplicity\r
-\r
-if(trackscount>0.0)\r
- { \r
-//fill the centrality/multiplicity distribution of the selected events\r
- fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case\r
-\r
- 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??????\r
-\r
-//count selected events having centrality betn 0-100%\r
- fEventCounter->Fill(6);\r
-\r
- //same event delte-eta, delta-phi plot\r
-if(tracksUNID && tracksUNID->GetEntriesFast()>0)//hadron triggered correlation\r
- {//same event calculation starts\r
- if(ffilltrigassoUNID) Fillcorrelation(tracksUNID,0,cent_v0,zvtx,bSign,kTRUE,kTRUE,kFALSE,"trigassoUNID");//mixcase=kFALSE (hadron-hadron correlation)\r
- if(tracksID && tracksID->GetEntriesFast()>0 && ffilltrigUNIDassoID) Fillcorrelation(tracksUNID,tracksID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigUNIDassoID");//mixcase=kFALSE (hadron-ID correlation)\r
- }\r
-\r
-if(tracksID && tracksID->GetEntriesFast()>0)//ID triggered correlation\r
- {//same event calculation starts\r
- if(tracksUNID && tracksUNID->GetEntriesFast()>0 && ffilltrigIDassoUNID) Fillcorrelation(tracksID,tracksUNID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoUNID");//mixcase=kFALSE (ID-hadron correlation)\r
- if(ffilltrigIDassoID) Fillcorrelation(tracksID,0,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoID");//mixcase=kFALSE (ID-ID correlation)\r
- }\r
-\r
-//still in main event loop\r
-//start mixing\r
- if(ffilltrigassoUNID || ffilltrigIDassoUNID){//mixing with unidentified particles\r
-AliEventPool* pool = fPoolMgr->GetEventPool(cent_v0, zvtx);//In the pool there is tracksUNID(i.e associateds are unidentified)\r
-if (pool && pool->IsReady())\r
- {//start mixing only when pool->IsReady\r
- for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) \r
- { //pool event loop start\r
- TObjArray* bgTracks = pool->GetEvent(jMix);\r
- if(!bgTracks) continue;\r
- if(ffilltrigassoUNID && tracksUNID && tracksUNID->GetEntriesFast()>0)//*******************************hadron trggered mixing\r
- Fillcorrelation(tracksUNID,bgTracks,cent_v0,zvtx,bSign,kTRUE,kTRUE,kTRUE,"trigassoUNID");//mixcase=kTRUE\r
- if(ffilltrigIDassoUNID && tracksID && tracksID->GetEntriesFast()>0)//***********************************ID trggered mixing\r
- Fillcorrelation(tracksID,bgTracks,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoUNID");//mixcase=kTRUE \r
- }// pool event loop ends mixing case\r
-\r
-} //if pool->IsReady() condition ends mixing case\r
- if(tracksUNID) {\r
-if(pool)\r
- pool->UpdatePool(CloneAndReduceTrackList(tracksUNID));\r
- }\r
- }//mixing with unidentified particles\r
-\r
- if(ffilltrigUNIDassoID || ffilltrigIDassoID){//mixing with identified particles\r
-AliEventPool* pool1 = fPoolMgr->GetEventPool(cent_v0, zvtx+100);//In the pool1 there is tracksID(i.e associateds are identified)\r
-if (pool1 && pool1->IsReady())\r
- {//start mixing only when pool->IsReady\r
-for (Int_t jMix=0; jMix<pool1->GetCurrentNEvents(); jMix++) \r
- { //pool event loop start\r
- TObjArray* bgTracks2 = pool1->GetEvent(jMix);\r
- if(!bgTracks2) continue;\r
-if(ffilltrigUNIDassoID && tracksUNID && tracksUNID->GetEntriesFast()>0)\r
- Fillcorrelation(tracksUNID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigUNIDassoID");//mixcase=kTRUE \r
-if(ffilltrigIDassoID && tracksID && tracksID->GetEntriesFast()>0)\r
- Fillcorrelation(tracksID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoID");//mixcase=kTRUE\r
-\r
- }// pool event loop ends mixing case\r
-} //if pool1->IsReady() condition ends mixing case\r
-\r
-if(tracksID) {\r
-if(pool1) \r
- pool1->UpdatePool(CloneAndReduceTrackList(tracksID));//ownership of tracksasso is with pool now, don't delete it(tracksUNID is with pool)\r
- }\r
- }//mixing with identified particles\r
-\r
- //no. of events analyzed\r
-fEventCounter->Fill(7);\r
- }\r
-\r
-if(tracksUNID) delete tracksUNID;\r
-\r
-if(tracksID) delete tracksID;\r
-\r
-\r
-PostData(1, fOutput);\r
-\r
-}\r
-//________________________________________________________________________\r
-void AliTwoParticlePIDCorr::doAODevent() \r
-{\r
-\r
- //get AOD\r
- AliVEvent *event = InputEvent();\r
- if (!event) { Printf("ERROR: Could not retrieve event"); return; }\r
- AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);\r
- if (!aod) {\r
- AliError("Cannot get the AOD event");\r
- return;\r
- }\r
-\r
-// count all events \r
- fEventCounter->Fill(1);\r
-\r
- // get centrality object and check quality\r
- Double_t cent_v0=0;\r
-\r
- if(fSampleType=="pPb" || fSampleType=="PbPb")\r
- {\r
- AliCentrality *centrality=0;\r
- if(aod) \r
- centrality = aod->GetHeader()->GetCentralityP();\r
- // if (centrality->GetQuality() != 0) return ;\r
-\r
- if(centrality)\r
- { \r
- cent_v0 = centrality->GetCentralityPercentile(fCentralityMethod);\r
- }\r
- else\r
- {\r
- cent_v0= -1;\r
- }\r
- }\r
-\r
- Float_t bSign = (aod->GetMagneticField() > 0) ? 1 : -1;//for two track efficiency cut in correlation function calculation\r
- Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//for dca cut in ClassifyTrack(), i.e in track loop\r
-\r
-// Pileup selection ************************************************\r
-// if(frejectPileUp) //applicable only for TPC only tracks,not for hybrid tracks?.\r
- // {\r
- //if (fAnalysisUtils && fAnalysisUtils->IsPileUpEvent(aod)) return;\r
- // }\r
-\r
- if (!fPID) return;//this should be available with each event even if we don't do PID selection\r
- \r
- //vertex selection(is it fine for PP?)\r
- if ( fSampleType=="pPb"){\r
- trkVtx = aod->GetPrimaryVertex();\r
- if (!trkVtx || trkVtx->GetNContributors()<=0) return;\r
- TString vtxTtl = trkVtx->GetTitle();\r
- if (!vtxTtl.Contains("VertexerTracks")) return;\r
- zvtx = trkVtx->GetZ();\r
- const AliAODVertex* spdVtx = aod->GetPrimaryVertexSPD();\r
- if (!spdVtx || spdVtx->GetNContributors()<=0) return;\r
- TString vtxTyp = spdVtx->GetTitle();\r
- Double_t cov[6]={0};\r
- spdVtx->GetCovarianceMatrix(cov);\r
- Double_t zRes = TMath::Sqrt(cov[5]);\r
- if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;\r
- if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;\r
- }\r
- else if(fSampleType=="PbPb" || fSampleType=="pp") {//for pp and pb-pb case\r
- Int_t nVertex = aod->GetNumberOfVertices();\r
- if( nVertex > 0 ) { \r
- trkVtx = aod->GetPrimaryVertex();\r
- Int_t nTracksPrim = trkVtx->GetNContributors();\r
- zvtx = trkVtx->GetZ();\r
- //if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));\r
- // Reject TPC only vertex\r
- TString name(trkVtx->GetName());\r
- if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return;\r
-\r
- // Select a quality vertex by number of tracks?\r
- if( nTracksPrim < fnTracksVertex ) {\r
- //if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");\r
- return ;\r
- }\r
- // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present\r
- //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)\r
- // return kFALSE;\r
- // if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");\r
- }\r
- else return;\r
-\r
- }\r
- else return;//as there is no proper sample type\r
-\r
-\r
- fHistQA[0]->Fill((trkVtx->GetX()));fHistQA[1]->Fill((trkVtx->GetY()));fHistQA[2]->Fill((trkVtx->GetZ())); //for trkVtx only before vertex cut |zvtx|<10 cm\r
-\r
-//count events having a proper vertex\r
- fEventCounter->Fill(2);\r
-\r
- if (TMath::Abs(zvtx) > fzvtxcut) return;\r
-\r
-//count events after vertex cut\r
- fEventCounter->Fill(5);\r
-\r
-\r
- //if(!fAnalysisUtils->IsVertexSelected2013pA(aod)) return;\r
- \r
- fHistQA[3]->Fill((trkVtx->GetX()));fHistQA[4]->Fill((trkVtx->GetY()));fHistQA[5]->Fill((trkVtx->GetZ()));//after vertex cut,for trkVtx only\r
-\r
-\r
- if(!aod) return; //for safety\r
- \r
-if(fSampleType=="pPb" || fSampleType=="PbPb") if (cent_v0 < 0) return;//for pp case it is the multiplicity\r
-\r
- TObjArray* tracksUNID= new TObjArray;//track info before doing PID\r
- tracksUNID->SetOwner(kTRUE); // IMPORTANT!\r
-\r
- TObjArray* tracksID= new TObjArray;//only pions, kaons,protonsi.e. after doing the PID selection\r
- tracksID->SetOwner(kTRUE); // IMPORTANT!\r
- \r
- Double_t trackscount=0.0;//in case of pp this will give the multiplicity after the track loop(only for unidentified particles that pass the filterbit and kinematic cuts)\r
-\r
- eventno++;\r
-\r
- for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++) \r
-{ //track loop starts for TObjArray(containing track and event information) filling; used for correlation function calculation \r
- AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrk));\r
- if (!track) continue;\r
- fHistQA[11]->Fill(track->GetTPCNcls());\r
- Int_t particletype=-9999;//required for PID filling\r
- Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1);//dcacut=kFALSE,onlyprimary=kFALSE\r
- if(tracktype!=1) continue; \r
-\r
- if(!track) continue;//for safety\r
-\r
-//check for eta , phi holes\r
- fEtaSpectrasso->Fill(track->Eta(),track->Pt());\r
- fphiSpectraasso->Fill(track->Phi(),track->Pt());\r
-\r
- trackscount++;\r
-\r
- //if no applyefficiency , set the eff factor=1.0\r
- Float_t effmatrix=1.0;\r
-\r
- //tag all particles as unidentified that passed filterbit & kinematic cuts \r
- particletype=unidentified;\r
-\r
-\r
- if (fSampleType=="pp") cent_v0=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\r
-\r
-\r
- //to reduce memory consumption in pool\r
- if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig) \r
- {\r
- //Clone & Reduce track list(TObjArray) for unidentified particles\r
- if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles\r
- effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletype);\r
- LRCParticlePID* copy = new LRCParticlePID(particletype,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);\r
- copy->SetUniqueID(eventno * 100000 + (Int_t)trackscount);\r
- tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)\r
- }\r
-\r
-//now start the particle identificaion process:) \r
-\r
-//track passing filterbit 768 have proper TPC response,or need to be checked explicitly before doing PID????\r
-\r
- Float_t dEdx = track->GetTPCsignal();\r
- fHistoTPCdEdx->Fill(track->Pt(), dEdx);\r
-\r
- //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)\r
- if(HasTOFPID(track))\r
-{\r
- Float_t beta = GetBeta(track);\r
- fHistoTOFbeta->Fill(track->Pt(), beta);\r
- }\r
-\r
-\r
-//track identification(using nsigma method)\r
- particletype=GetParticle(track);//*******************************change may be required(It should return only pion,kaon, proton and Spundefined; NOT unidentifed***************be careful)\r
-\r
-\r
-//2-d TPCTOF map(for each Pt interval)\r
- if(HasTOFPID(track)){\r
- fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);\r
- fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);\r
- fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]); \r
- }\r
-\r
-//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!!!!! \r
- 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)!!!!!!!!!!!\r
-\r
- //Pt, Eta , Phi distribution of the reconstructed identified particles\r
-if(ffillhistQAReco)\r
- {\r
-if (particletype==SpPion)\r
- {\r
- fPionPt->Fill(track->Pt());\r
- fPionEta->Fill(track->Eta());\r
- fPionPhi->Fill(track->Phi());\r
- }\r
-if (particletype==SpKaon)\r
- {\r
- fKaonPt->Fill(track->Pt());\r
- fKaonEta->Fill(track->Eta());\r
- fKaonPhi->Fill(track->Phi());\r
- }\r
-if (particletype==SpProton)\r
- {\r
- fProtonPt->Fill(track->Pt());\r
- fProtonEta->Fill(track->Eta());\r
- fProtonPhi->Fill(track->Phi());\r
- }\r
- }\r
- \r
-if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig) \r
- {\r
-if (fapplyTrigefficiency || fapplyAssoefficiency)\r
- effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletype);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles; Bool_t mesoneffrequired=kFALSE\r
- LRCParticlePID* copy1 = new LRCParticlePID(particletype,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);\r
- copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);\r
- tracksID->Add(copy1);\r
- }\r
-} //track loop ends but still in event loop\r
-\r
-if(trackscount<1.0){\r
- if(tracksUNID) delete tracksUNID;\r
- if(tracksID) delete tracksID;\r
- return;\r
- }\r
-\r
-// cout<<fminPtAsso<<"***"<<fmaxPtAsso<<"*********************"<<fminPtTrig<<"***"<<fmaxPtTrig<<"*****************"<<kTrackVariablesPair<<endl;\r
-if(fSampleType=="pp") cent_v0=trackscount;//multiplicity\r
- \r
-//fill the centrality/multiplicity distribution of the selected events\r
- fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case\r
-\r
-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??????\r
-\r
-//count selected events having centrality betn 0-100%\r
- fEventCounter->Fill(6);\r
-\r
-//same event delta-eta-deltaphi plot \r
-\r
-if(tracksUNID && tracksUNID->GetEntriesFast()>0)//hadron triggered correlation\r
- {//same event calculation starts\r
- if(ffilltrigassoUNID) Fillcorrelation(tracksUNID,0,cent_v0,zvtx,bSign,kTRUE,kTRUE,kFALSE,"trigassoUNID");//mixcase=kFALSE (hadron-hadron correlation)\r
- if(tracksID && tracksID->GetEntriesFast()>0 && ffilltrigUNIDassoID) Fillcorrelation(tracksUNID,tracksID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigUNIDassoID");//mixcase=kFALSE (hadron-ID correlation)\r
- }\r
-\r
-if(tracksID && tracksID->GetEntriesFast()>0)//ID triggered correlation\r
- {//same event calculation starts\r
- if(tracksUNID && tracksUNID->GetEntriesFast()>0 && ffilltrigIDassoUNID) Fillcorrelation(tracksID,tracksUNID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoUNID");//mixcase=kFALSE (ID-hadron correlation)\r
- if(ffilltrigIDassoID) Fillcorrelation(tracksID,0,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoID");//mixcase=kFALSE (ID-ID correlation)\r
- }\r
-\r
-//still in main event loop\r
-\r
-\r
-//start mixing\r
- if(ffilltrigassoUNID || ffilltrigIDassoUNID){//mixing with unidentified particles\r
-AliEventPool* pool = fPoolMgr->GetEventPool(cent_v0, zvtx);//In the pool there is tracksUNID(i.e associateds are unidentified)\r
-if (pool && pool->IsReady())\r
- {//start mixing only when pool->IsReady\r
- for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) \r
- { //pool event loop start\r
- TObjArray* bgTracks = pool->GetEvent(jMix);\r
- if(!bgTracks) continue;\r
- if(ffilltrigassoUNID && tracksUNID && tracksUNID->GetEntriesFast()>0)//*******************************hadron trggered mixing\r
- Fillcorrelation(tracksUNID,bgTracks,cent_v0,zvtx,bSign,kTRUE,kTRUE,kTRUE,"trigassoUNID");//mixcase=kTRUE\r
- if(ffilltrigIDassoUNID && tracksID && tracksID->GetEntriesFast()>0)//***********************************ID trggered mixing\r
- Fillcorrelation(tracksID,bgTracks,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoUNID");//mixcase=kTRUE \r
- }// pool event loop ends mixing case\r
-\r
-} //if pool->IsReady() condition ends mixing case\r
- if(tracksUNID) {\r
-if(pool)\r
- pool->UpdatePool(CloneAndReduceTrackList(tracksUNID));\r
- }\r
- }//mixing with unidentified particles\r
-\r
-\r
- if(ffilltrigUNIDassoID || ffilltrigIDassoID){//mixing with identified particles\r
-AliEventPool* pool1 = fPoolMgr->GetEventPool(cent_v0, zvtx+100);//In the pool1 there is tracksID(i.e associateds are identified)\r
-if (pool1 && pool1->IsReady())\r
- {//start mixing only when pool->IsReady\r
-for (Int_t jMix=0; jMix<pool1->GetCurrentNEvents(); jMix++) \r
- { //pool event loop start\r
- TObjArray* bgTracks2 = pool1->GetEvent(jMix);\r
- if(!bgTracks2) continue;\r
-if(ffilltrigUNIDassoID && tracksUNID && tracksUNID->GetEntriesFast()>0)\r
- Fillcorrelation(tracksUNID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigUNIDassoID");//mixcase=kTRUE \r
-if(ffilltrigIDassoID && tracksID && tracksID->GetEntriesFast()>0)\r
- Fillcorrelation(tracksID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoID");//mixcase=kTRUE\r
-\r
- }// pool event loop ends mixing case\r
-} //if pool1->IsReady() condition ends mixing case\r
-\r
-if(tracksID) {\r
-if(pool1) \r
- pool1->UpdatePool(CloneAndReduceTrackList(tracksID));//ownership of tracksasso is with pool now, don't delete it(tracksUNID is with pool)\r
- }\r
- }//mixing with identified particles\r
-\r
-\r
- //no. of events analyzed\r
-fEventCounter->Fill(7);\r
- \r
-//still in main event loop\r
-\r
-\r
-if(tracksUNID) delete tracksUNID;\r
-\r
-if(tracksID) delete tracksID;\r
-\r
-\r
-PostData(1, fOutput);\r
-\r
-} // *************************event loop ends******************************************//_______________________________________________________________________\r
-TObjArray* AliTwoParticlePIDCorr::CloneAndReduceTrackList(TObjArray* tracks)\r
-{\r
- // clones a track list by using AliDPhiBasicParticle which uses much less memory (used for event mixing)\r
- \r
- TObjArray* tracksClone = new TObjArray;\r
- tracksClone->SetOwner(kTRUE);\r
- \r
- for (Int_t i=0; i<tracks->GetEntriesFast(); i++)\r
- {\r
- LRCParticlePID* particle = (LRCParticlePID*) tracks->UncheckedAt(i);\r
- LRCParticlePID* copy100 = new LRCParticlePID(particle->getparticle(),particle->Charge(), particle->Pt(),particle->Eta(), particle->Phi(), particle->geteffcorrectionval());\r
- copy100->SetUniqueID(particle->GetUniqueID());\r
- tracksClone->Add(copy100);\r
- }\r
- \r
- return tracksClone;\r
-}\r
-\r
-//--------------------------------------------------------------------------------\r
-void AliTwoParticlePIDCorr::Fillcorrelation(TObjArray *trackstrig,TObjArray *tracksasso,Double_t cent,Float_t vtx,Float_t bSign,Bool_t fPtOrder,Bool_t twoTrackEfficiencyCut,Bool_t mixcase,TString fillup)\r
-{\r
-\r
- //before calling this function check that either trackstrig & tracksasso are available \r
-\r
- // Eta() is extremely time consuming, therefore cache it for the inner loop here:\r
- TObjArray* input = (tracksasso) ? tracksasso : trackstrig;\r
- TArrayF eta(input->GetEntriesFast());\r
- for (Int_t i=0; i<input->GetEntriesFast(); i++)\r
- eta[i] = ((LRCParticlePID*) input->UncheckedAt(i))->Eta();\r
-\r
- //if(trackstrig)\r
- Int_t jmax=trackstrig->GetEntriesFast();\r
- if(tracksasso)\r
- jmax=tracksasso->GetEntriesFast();\r
-\r
-// identify K, Lambda candidates and flag those particles\r
- // a TObject bit is used for this\r
-const UInt_t kResonanceDaughterFlag = 1 << 14;\r
- if (fRejectResonanceDaughters > 0)\r
- {\r
- Double_t resonanceMass = -1;\r
- Double_t massDaughter1 = -1;\r
- Double_t massDaughter2 = -1;\r
- const Double_t interval = 0.02;\r
- switch (fRejectResonanceDaughters)\r
- {\r
- case 1: resonanceMass = 0.9; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // method test\r
- case 2: resonanceMass = 0.4976; massDaughter1 = 0.1396; massDaughter2 = massDaughter1; break; // k0\r
- case 3: resonanceMass = 1.115; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // lambda\r
- default: AliFatal(Form("Invalid setting %d", fRejectResonanceDaughters));\r
- } \r
-\r
-for (Int_t i=0; i<trackstrig->GetEntriesFast(); i++)\r
- trackstrig->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);\r
- for (Int_t i=0; tracksasso->GetEntriesFast(); i++)\r
- tracksasso->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);\r
-\r
- for (Int_t i=0; i<trackstrig->GetEntriesFast(); i++)\r
- {\r
- LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));\r
-for (Int_t j=0; tracksasso->GetEntriesFast(); j++)\r
- {\r
- LRCParticlePID *asso=(LRCParticlePID*)(tracksasso->UncheckedAt(j));\r
-\r
- // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)\r
-if (trig->IsEqual(asso)) continue;\r
-\r
-if (trig->Charge() * asso->Charge() > 0) continue;\r
-\r
- Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trig->Eta(), trig->Phi(), asso->Pt(), asso->Eta(), asso->Phi(), massDaughter1, massDaughter2);\r
- \r
-if (TMath::Abs(mass - resonanceMass*resonanceMass) < interval*5)\r
- {\r
- mass = GetInvMassSquared(trig->Pt(), trig->Eta(), trig->Phi(), asso->Pt(), asso->Eta(), asso->Phi(), massDaughter1, massDaughter2);\r
-\r
- if (mass > (resonanceMass-interval)*(resonanceMass-interval) && mass < (resonanceMass+interval)*(resonanceMass+interval))\r
- {\r
- trig->SetBit(kResonanceDaughterFlag);\r
- asso->SetBit(kResonanceDaughterFlag);\r
- \r
-// Printf("Flagged %d %d %f", i, j, TMath::Sqrt(mass));\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- //two particle correlation filling\r
-\r
-for(Int_t i=0;i<trackstrig->GetEntriesFast();i++)\r
- { //trigger loop starts\r
- LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));\r
- if(!trig) continue;\r
- Float_t trigpt=trig->Pt();\r
- //to avoid overflow qnd underflow\r
- if(trigpt<fminPtTrig || trigpt>fmaxPtTrig) continue;\r
- Int_t particlepidtrig=trig->getparticle();\r
- if(fTriggerSpeciesSelection){ if (particlepidtrig!=fTriggerSpecies) continue;}\r
-\r
- Float_t trigeta=trig->Eta();\r
-\r
- // some optimization\r
- if (fTriggerRestrictEta > 0 && TMath::Abs(trigeta) > fTriggerRestrictEta)\r
- continue;\r
-\r
-if (fOnlyOneEtaSide != 0)\r
- {\r
- if (fOnlyOneEtaSide * trigeta < 0)\r
- continue;\r
- }\r
- if (fTriggerSelectCharge != 0)\r
- if (trig->Charge() * fTriggerSelectCharge < 0)\r
- continue;\r
- \r
- if (fRejectResonanceDaughters > 0)\r
- if (trig->TestBit(kResonanceDaughterFlag)) continue;\r
-\r
- Float_t trigphi=trig->Phi();\r
- Float_t trackefftrig=1.0;\r
- if(fapplyTrigefficiency) trackefftrig=trig->geteffcorrectionval();\r
- // cout<<"*******************trackefftrig="<<trackefftrig<<endl;\r
- Double_t* trigval;\r
- Int_t dim=3;\r
- if(fcontainPIDtrig) dim=4;\r
- trigval= new Double_t[dim];\r
- trigval[0] = cent;\r
- trigval[1] = vtx;\r
- trigval[2] = trigpt;\r
-if(fcontainPIDtrig) trigval[3] = particlepidtrig;\r
-\r
- //filling only for same event case(mixcase=kFALSE)\r
-\r
- //trigger particle counting only when mixcase=kFALSE i.e for same event correlation function calculation\r
-if(mixcase==kFALSE) \r
- {\r
- if(ffilltrigassoUNID==kTRUE && ffilltrigUNIDassoID==kTRUE){\r
- if(fillup=="trigassoUNID" ) fTHnTrigcount->Fill(trigval,1.0/trackefftrig); \r
- }\r
- if(ffilltrigassoUNID==kTRUE && ffilltrigUNIDassoID==kFALSE){\r
- if(fillup=="trigassoUNID" ) fTHnTrigcount->Fill(trigval,1.0/trackefftrig); \r
- }\r
-if(ffilltrigassoUNID==kFALSE && ffilltrigUNIDassoID==kTRUE){\r
- if(fillup=="trigUNIDassoID") fTHnTrigcount->Fill(trigval,1.0/trackefftrig); \r
- }\r
- //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\r
-if(ffilltrigIDassoUNID==kTRUE && ffilltrigIDassoID==kTRUE){\r
- if(fillup=="trigIDassoID") fTHnTrigcount->Fill(trigval,1.0/trackefftrig); \r
- }\r
- if(ffilltrigIDassoUNID==kTRUE && ffilltrigIDassoID==kFALSE){\r
- if(fillup=="trigIDassoUNID" ) fTHnTrigcount->Fill(trigval,1.0/trackefftrig); \r
- }\r
-if(ffilltrigIDassoUNID==kFALSE && ffilltrigIDassoID==kTRUE){\r
- if(fillup=="trigIDassoID") fTHnTrigcount->Fill(trigval,1.0/trackefftrig); \r
- }\r
-\r
- if(fillup=="trigIDassoIDMCTRUTH") fTHnTrigcountMCTruthPrim->Fill(trigval,1.0/trackefftrig); //In truth MC case "Unidentified" means any particle other than pion,kaon or proton and no efficiency correction(default value 1.0)************************be careful!!!! \r
- }\r
-\r
- //asso loop starts within trigger loop\r
- for(Int_t j=0;j<jmax;j++)\r
- {\r
- LRCParticlePID *asso=0;\r
- if(!tracksasso)\r
- asso=(LRCParticlePID*)(trackstrig->UncheckedAt(j));\r
- else\r
- asso=(LRCParticlePID*)(tracksasso->UncheckedAt(j));\r
-\r
- if(!asso) continue;\r
-\r
- //to avoid overflow qnd underflow\r
- if(asso->Pt()<fminPtAsso || asso->Pt()>fmaxPtAsso) continue;//***********************Important\r
-\r
- if(fmaxPtAsso==fminPtTrig) {if(asso->Pt()==fminPtTrig) continue;}//******************Think about it!\r
-\r
- if(!tracksasso && i==j) continue;\r
-\r
- // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)\r
- // if (tracksasso && trig->IsEqual(asso)) continue;\r
-\r
- if (tracksasso && (trig->GetUniqueID()==asso->GetUniqueID())) continue;\r
- \r
- if (fPtOrder)\r
- if (asso->Pt() >= trig->Pt()) continue;\r
-\r
- Int_t particlepidasso=asso->getparticle(); \r
- if(fAssociatedSpeciesSelection){ if (particlepidasso!=fAssociatedSpecies) continue;}\r
- \r
-\r
-if (fAssociatedSelectCharge != 0)\r
-if (asso->Charge() * fAssociatedSelectCharge < 0) continue;\r
- \r
- if (fSelectCharge > 0)\r
- {\r
- // skip like sign\r
- if (fSelectCharge == 1 && asso->Charge() * trig->Charge() > 0)\r
- continue;\r
- \r
- // skip unlike sign\r
- if (fSelectCharge == 2 && asso->Charge() * trig->Charge() < 0)\r
- continue;\r
- }\r
-\r
-if (fEtaOrdering)\r
- {\r
- if (trigeta < 0 && asso->Eta() < trigeta)\r
- continue;\r
- if (trigeta > 0 && asso->Eta() > trigeta)\r
- continue;\r
- }\r
-\r
-if (fRejectResonanceDaughters > 0)\r
- if (asso->TestBit(kResonanceDaughterFlag))\r
- {\r
-// Printf("Skipped j=%d", j);\r
- continue;\r
- }\r
-\r
- // conversions\r
- if (fCutConversions && asso->Charge() * trig->Charge() < 0)\r
- {\r
- Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.510e-3, 0.510e-3);\r
- \r
- if (mass < 0.1)\r
- {\r
- mass = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.510e-3, 0.510e-3);\r
- \r
- //fControlConvResoncances->Fill(0.0, mass);\r
-\r
- if (mass < 0.04*0.04) \r
- continue;\r
- }\r
- }\r
-\r
- // K0s\r
- if (fCutResonances && asso->Charge() * trig->Charge() < 0)\r
- {\r
- Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.1396, 0.1396);\r
- \r
- const Float_t kK0smass = 0.4976;\r
- \r
- if (TMath::Abs(mass - kK0smass*kK0smass) < 0.1)\r
- {\r
- mass = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.1396, 0.1396);\r
- \r
- //fControlConvResoncances->Fill(1, mass - kK0smass*kK0smass);\r
-\r
- if (mass > (kK0smass-0.02)*(kK0smass-0.02) && mass < (kK0smass+0.02)*(kK0smass+0.02))\r
- continue;\r
- }\r
- }\r
- \r
- // Lambda\r
- if (fCutResonances && asso->Charge() * trig->Charge() < 0)\r
- {\r
- Float_t mass1 = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.1396, 0.9383);\r
- Float_t mass2 = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j] , asso->Phi(), 0.9383, 0.1396);\r
- \r
- const Float_t kLambdaMass = 1.115;\r
-\r
- if (TMath::Abs(mass1 - kLambdaMass*kLambdaMass) < 0.1)\r
- {\r
- mass1 = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.1396, 0.9383);\r
-\r
- //fControlConvResoncances->Fill(2, mass1 - kLambdaMass*kLambdaMass);\r
- \r
- if (mass1 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass1 < (kLambdaMass+0.02)*(kLambdaMass+0.02))\r
- continue;\r
- }\r
- if (TMath::Abs(mass2 - kLambdaMass*kLambdaMass) < 0.1)\r
- {\r
- mass2 = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j] , asso->Phi(), 0.9383, 0.1396);\r
-\r
- //fControlConvResoncances->Fill(2, mass2 - kLambdaMass*kLambdaMass);\r
-\r
- if (mass2 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass2 < (kLambdaMass+0.02)*(kLambdaMass+0.02))\r
- continue;\r
- }\r
- }\r
-\r
- if (twoTrackEfficiencyCut)\r
- {\r
- // the variables & cuthave been developed by the HBT group \r
- // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700\r
- Float_t phi1 = trig->Phi();\r
- Float_t pt1 = trig->Pt();\r
- Float_t charge1 = trig->Charge();\r
- Float_t phi2 = asso->Phi();\r
- Float_t pt2 = asso->Pt();\r
- Float_t charge2 = asso->Charge();\r
-\r
- Float_t deta= trigeta - eta[j]; \r
- \r
- // optimization\r
- if (TMath::Abs(deta) < twoTrackEfficiencyCutValue * 2.5 * 3)\r
- {\r
-\r
- // check first boundaries to see if is worth to loop and find the minimum\r
- Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);\r
- Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);\r
-\r
- const Float_t kLimit = twoTrackEfficiencyCutValue * 3;\r
-\r
- Float_t dphistarminabs = 1e5;\r
- Float_t dphistarmin = 1e5;\r
-\r
- if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)\r
- {\r
- for (Double_t rad=0.8; rad<2.51; rad+=0.01) \r
- {\r
- Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign);\r
-\r
- Float_t dphistarabs = TMath::Abs(dphistar);\r
-\r
- if (dphistarabs < dphistarminabs)\r
- {\r
- dphistarmin = dphistar;\r
- dphistarminabs = dphistarabs;\r
- }\r
- }\r
-\r
-if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEfficiencyCutValue)\r
- {\r
-// 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);\r
- continue;\r
- }\r
-//fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));\r
-\r
- }\r
- }\r
- }\r
-\r
- Float_t trackeffasso=1.0;\r
- if(fapplyAssoefficiency) trackeffasso=asso->geteffcorrectionval();\r
- //cout<<"*******************trackeffasso="<<trackeffasso<<endl;\r
- Float_t deleta=trigeta-eta[j];\r
- Float_t delphi=PhiRange(trigphi-asso->Phi()); \r
-\r
- //here get the two particle efficiency correction factor\r
- Float_t effweight=trackefftrig*trackeffasso;\r
- //cout<<"*******************effweight="<<effweight<<endl;\r
- Double_t* vars;\r
- vars= new Double_t[kTrackVariablesPair];\r
- vars[0]=cent;\r
- vars[1]=vtx;\r
- vars[2]=trigpt;\r
- vars[3]=asso->Pt();\r
- vars[4]=deleta;\r
- vars[5]=delphi;\r
-if(fcontainPIDtrig && !fcontainPIDasso) vars[6]=particlepidtrig;\r
-if(!fcontainPIDtrig && fcontainPIDasso) vars[6]=particlepidasso;\r
- if(fcontainPIDtrig && fcontainPIDasso){\r
- vars[6]=particlepidtrig;\r
- vars[7]=particlepidasso;\r
- }\r
-\r
- //Fill Correlation ThnSparses\r
- if(fillup=="trigassoUNID")\r
- {\r
- if(mixcase==kFALSE) fTHnCorrUNID->Fill(vars,1.0/effweight);\r
- if(mixcase==kTRUE) fTHnCorrUNIDmix->Fill(vars,1.0/effweight);\r
- }\r
- if(fillup=="trigIDassoID")\r
- {\r
- if(mixcase==kFALSE) fTHnCorrID->Fill(vars,1.0/effweight);\r
- if(mixcase==kTRUE) fTHnCorrIDmix->Fill(vars,1.0/effweight);\r
- }\r
- if(fillup=="trigIDassoIDMCTRUTH")//******************************************for TRUTH MC particles\r
- {//in this case effweight should be 1 always \r
- if(mixcase==kFALSE) fCorrelatonTruthPrimary->Fill(vars,1.0/effweight); \r
- if(mixcase==kTRUE) fCorrelatonTruthPrimarymix->Fill(vars,1.0/effweight);\r
- } \r
- if(fillup=="trigIDassoUNID" || fillup=="trigUNIDassoID")//****************************be careful\r
- {\r
- if(mixcase==kFALSE) fTHnCorrIDUNID->Fill(vars,1.0/effweight);\r
- if(mixcase==kTRUE) fTHnCorrIDUNIDmix->Fill(vars,1.0/effweight);\r
- }\r
- \r
-delete[] vars;\r
- }//asso loop ends \r
-delete[] trigval;\r
- }//trigger loop ends \r
-\r
-}\r
-\r
-//--------------------------------------------------------------------------------\r
-Float_t AliTwoParticlePIDCorr::GetTrackbyTrackeffvalue(AliAODTrack* track,Double_t cent,Float_t evzvtx, Int_t parpid)\r
-{\r
- //This function is called only when applyefficiency=kTRUE; also ensure that "track" is present before calling that function\r
- Int_t effVars[4];\r
- Float_t effvalue=1.; \r
-\r
- if(parpid==unidentified)\r
- {\r
- effVars[0] = effcorection[5]->GetAxis(0)->FindBin(cent);\r
- effVars[1] = effcorection[5]->GetAxis(1)->FindBin(evzvtx); \r
- effVars[2] = effcorection[5]->GetAxis(2)->FindBin(track->Pt()); \r
- effVars[3] = effcorection[5]->GetAxis(3)->FindBin(track->Eta()); \r
- effvalue=effcorection[5]->GetBinContent(effVars);\r
- }\r
-if(parpid==SpPion || parpid==SpKaon)\r
- {\r
- if(fmesoneffrequired && !fkaonprotoneffrequired && track->Pt()>=fminPtComboeff && track->Pt()<=fmaxPtComboeff)\r
- {\r
- effVars[0] = effcorection[3]->GetAxis(0)->FindBin(cent);\r
- effVars[1] = effcorection[3]->GetAxis(1)->FindBin(evzvtx); \r
- effVars[2] = effcorection[3]->GetAxis(2)->FindBin(track->Pt()); \r
- effVars[3] = effcorection[3]->GetAxis(3)->FindBin(track->Eta());\r
- effvalue=effcorection[3]->GetBinContent(effVars);\r
- }\r
- else{\r
- if(parpid==SpPion)\r
- {\r
- effVars[0] = effcorection[0]->GetAxis(0)->FindBin(cent);\r
- effVars[1] = effcorection[0]->GetAxis(1)->FindBin(evzvtx); \r
- effVars[2] = effcorection[0]->GetAxis(2)->FindBin(track->Pt()); \r
- effVars[3] = effcorection[0]->GetAxis(3)->FindBin(track->Eta()); \r
- effvalue=effcorection[0]->GetBinContent(effVars);\r
- }\r
- \r
- if(parpid==SpKaon)\r
- {\r
- effVars[0] = effcorection[1]->GetAxis(0)->FindBin(cent);\r
- effVars[1] = effcorection[1]->GetAxis(1)->FindBin(evzvtx); \r
- effVars[2] = effcorection[1]->GetAxis(2)->FindBin(track->Pt()); \r
- effVars[3] = effcorection[1]->GetAxis(3)->FindBin(track->Eta()); \r
- effvalue=effcorection[1]->GetBinContent(effVars);\r
- }\r
- }\r
- } \r
- \r
- if(parpid==SpProton)\r
- {\r
- effVars[0] = effcorection[2]->GetAxis(0)->FindBin(cent);\r
- effVars[1] = effcorection[2]->GetAxis(1)->FindBin(evzvtx); \r
- effVars[2] = effcorection[2]->GetAxis(2)->FindBin(track->Pt()); \r
- effVars[3] = effcorection[2]->GetAxis(3)->FindBin(track->Eta()); \r
- effvalue=effcorection[2]->GetBinContent(effVars);\r
- }\r
-\r
- if(fkaonprotoneffrequired && !fmesoneffrequired && track->Pt()>=fminPtComboeff && track->Pt()<=fmaxPtComboeff)\r
- {\r
- if(parpid==SpProton || parpid==SpKaon)\r
- {\r
- effVars[0] = effcorection[4]->GetAxis(0)->FindBin(cent);\r
- effVars[1] = effcorection[4]->GetAxis(1)->FindBin(evzvtx); \r
- effVars[2] = effcorection[4]->GetAxis(2)->FindBin(track->Pt()); \r
- effVars[3] = effcorection[4]->GetAxis(3)->FindBin(track->Eta());\r
- effvalue=effcorection[4]->GetBinContent(effVars);\r
- }\r
- } \r
- // Printf("%d %d %d %d %f", effVars[0], effVars[1], effVars[2], effVars[3], fEfficiencyCorrectionAssociated->GetBinContent(effVars));\r
- if(effvalue==0.) effvalue=1.;\r
-\r
- return effvalue; \r
-\r
-}\r
-//-----------------------------------------------------------------------\r
-\r
-Int_t AliTwoParticlePIDCorr::ClassifyTrack(AliAODTrack* track,AliAODVertex* vertex,Float_t magfield)\r
-{ \r
- \r
- if(!track) return 0;\r
- Bool_t trackOK = track->TestFilterBit(fFilterBit);\r
- if(!trackOK) return 0;\r
- //select only primary traks(for data & reco MC tracks) \r
- if(fonlyprimarydatareco && track->GetType()!=AliAODTrack::kPrimary) return 0;\r
- if(track->Charge()==0) return 0;\r
- fHistQA[12]->Fill(track->GetTPCNcls()); \r
- Float_t dxy, dz; \r
- dxy = track->DCA();\r
- dz = track->ZAtDCA();\r
- fHistQA[6]->Fill(dxy);\r
- fHistQA[7]->Fill(dz);\r
- Float_t chi2ndf = track->Chi2perNDF();\r
- fHistQA[13]->Fill(chi2ndf); \r
- Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
- fHistQA[14]->Fill(nCrossedRowsTPC); \r
- //Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
- if (track->GetTPCNclsF()>0) {\r
- Float_t ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
- fHistQA[15]->Fill(ratioCrossedRowsOverFindableClustersTPC);\r
- }\r
-//accepted tracks \r
- Float_t pt=track->Pt();\r
- if(pt< fminPt || pt> fmaxPt) return 0;\r
- if(TMath::Abs(track->Eta())> fmaxeta) return 0;\r
- if(track->Phi()<0. || track->Phi()>2*TMath::Pi()) return 0;\r
- //if (!HasTPCPID(track)) return 0;//trigger & associated particles must have TPC PID,Is it required\r
-// DCA XY\r
- if (fdcacut && fDCAXYCut)\r
- {\r
- if (!vertex)\r
- return 0;\r
- \r
- Double_t pos[2];\r
- Double_t covar[3];\r
- AliAODTrack* clone =(AliAODTrack*) track->Clone();\r
- Bool_t success = clone->PropagateToDCA(vertex, magfield, fdcacutvalue, pos, covar);\r
- delete clone;\r
- if (!success)\r
- return 0;\r
-\r
-// Printf("%f", ((AliAODTrack*)part)->DCA());\r
-// Printf("%f", pos[0]);\r
- if (TMath::Abs(pos[0]) > fDCAXYCut->Eval(track->Pt()))\r
- return 0;\r
- }\r
-\r
- fHistQA[8]->Fill(pt);\r
- fHistQA[9]->Fill(track->Eta());\r
- fHistQA[10]->Fill(track->Phi());\r
- return 1;\r
- }\r
- //________________________________________________________________________________\r
-void AliTwoParticlePIDCorr::CalculateNSigmas(AliAODTrack *track) \r
-{\r
-//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 )\r
-Float_t pt=track->Pt();\r
-\r
-//it is assumed that every track that passed the filterbit have proper TPC response(!!)\r
-Float_t nsigmaTPCkPion =fPID->NumberOfSigmasTPC(track, AliPID::kPion);\r
-Float_t nsigmaTPCkKaon =fPID->NumberOfSigmasTPC(track, AliPID::kKaon);\r
-Float_t nsigmaTPCkProton =fPID->NumberOfSigmasTPC(track, AliPID::kProton);\r
-\r
-Float_t nsigmaTOFkProton=999.,nsigmaTOFkKaon=999.,nsigmaTOFkPion=999.;\r
-Float_t nsigmaTPCTOFkProton=999.,nsigmaTPCTOFkKaon=999.,nsigmaTPCTOFkPion=999.;\r
-\r
- if(HasTOFPID(track) && pt>fPtTOFPIDmin)\r
- {\r
-\r
-nsigmaTOFkPion =fPID->NumberOfSigmasTOF(track, AliPID::kPion);\r
-nsigmaTOFkKaon =fPID->NumberOfSigmasTOF(track, AliPID::kKaon);\r
-nsigmaTOFkProton =fPID->NumberOfSigmasTOF(track, AliPID::kProton);\r
-//---combined\r
-nsigmaTPCTOFkPion = TMath::Sqrt(nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion);\r
-nsigmaTPCTOFkKaon = TMath::Sqrt(nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon);\r
-nsigmaTPCTOFkProton = TMath::Sqrt(nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton);\r
-\r
-\r
- }\r
-else{\r
- // --- combined\r
- // if TOF is missing and below fPtTOFPID only the TPC information is used\r
- nsigmaTPCTOFkProton = TMath::Abs(nsigmaTPCkProton);\r
- nsigmaTPCTOFkKaon = TMath::Abs(nsigmaTPCkKaon);\r
- nsigmaTPCTOFkPion = TMath::Abs(nsigmaTPCkPion);\r
-\r
- }\r
-\r
-//set data member fnsigmas\r
- fnsigmas[SpPion][NSigmaTPC]=nsigmaTPCkPion;\r
- fnsigmas[SpKaon][NSigmaTPC]=nsigmaTPCkKaon;\r
- fnsigmas[SpProton][NSigmaTPC]=nsigmaTPCkProton;\r
-\r
- //for all tracks below fPtTOFPIDmin and also for tracks above fPtTOFPIDmin without proper TOF response these TOF nsigma values will be 999.\r
- fnsigmas[SpPion][NSigmaTOF]=nsigmaTOFkPion;\r
- fnsigmas[SpKaon][NSigmaTOF]=nsigmaTOFkKaon;\r
- fnsigmas[SpProton][NSigmaTOF]=nsigmaTOFkProton;\r
-\r
- //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)\r
- fnsigmas[SpPion][NSigmaTPCTOF]=nsigmaTPCTOFkPion;\r
- fnsigmas[SpKaon][NSigmaTPCTOF]=nsigmaTPCTOFkKaon;\r
- fnsigmas[SpProton][NSigmaTPCTOF]=nsigmaTPCTOFkProton;\r
-\r
-\r
-}\r
-//----------------------------------------------------------------------------\r
-Int_t AliTwoParticlePIDCorr::FindMinNSigma(AliAODTrack *track) \r
-{\r
- //this function is always called after calling the function CalculateNSigmas(AliAODTrack *track)\r
-if(fRequestTOFPID && track->Pt()>fPtTOFPIDmin && track->Pt()<=fPtTOFPIDmax && (!HasTOFPID(track)) )return SpUndefined;//so any track having Pt>0.6 && Pt<=4.0 Gev withot having proper TOF response will be defined as SpUndefined\r
-//get the identity of the particle with the minimum Nsigma\r
- Float_t nsigmaPion=999., nsigmaKaon=999., nsigmaProton=999.;\r
- switch (fPIDType){\r
- case NSigmaTPC:\r
- nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPC]);\r
- nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPC]) ;\r
- nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPC]) ;\r
- break;\r
- case NSigmaTOF:\r
- nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTOF]);\r
- nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTOF]) ;\r
- nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTOF]) ;\r
- break;\r
- case NSigmaTPCTOF://In case of no TOF matching the combined nsigma is the TPC one\r
- nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);\r
- nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;\r
- nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;\r
- break;\r
- }\r
-\r
- if(track->Pt()<=fPtTOFPIDmax) {\r
- // guess the particle based on the smaller nsigma (within fNSigmaPID)\r
- if( ( nsigmaKaon==nsigmaPion ) && ( nsigmaKaon==nsigmaProton )) return SpUndefined;//it is the default value for the three\r
-if( ( nsigmaKaon < nsigmaPion ) && ( nsigmaKaon < nsigmaProton ) && (nsigmaKaon < fNSigmaPID)) return SpKaon;\r
-if( ( nsigmaPion < nsigmaKaon ) && ( nsigmaPion < nsigmaProton ) && (nsigmaPion < fNSigmaPID)) return SpPion;\r
-if( ( nsigmaProton < nsigmaKaon ) && ( nsigmaProton < nsigmaPion ) && (nsigmaProton < fNSigmaPID)) return SpProton;\r
-\r
-// else, return undefined\r
- return SpUndefined;\r
- }\r
- else {//asymmetric nsigma cut around pion's mean position for tracks having Pt>4.0 Gev\r
- if(fminprotonsigmacut<fnsigmas[SpPion][NSigmaTPC] && fnsigmas[SpPion][NSigmaTPC]<fmaxprotonsigmacut) return SpProton;\r
- if(fminpionsigmacut<fnsigmas[SpPion][NSigmaTPC] && fnsigmas[SpPion][NSigmaTPC]<fmaxpionsigmacut) return SpPion;\r
-// else, return undefined(here we don't detect kaons)\r
- return SpUndefined;\r
- }\r
-\r
-}\r
-\r
-//------------------------------------------------------------------------------------------\r
-Bool_t* AliTwoParticlePIDCorr::GetDoubleCounting(AliAODTrack * trk){ \r
- //this function is always called after calling the function CalculateNSigmas(AliAODTrack *track)\r
-\r
- //if a particle has double counting set fHasDoubleCounting[ipart]=kTRUE\r
- //fill DC histos\r
- for(Int_t ipart=0;ipart<NSpecies;ipart++)fHasDoubleCounting[ipart]=kFALSE;//array with kTRUE for second (or third) identity of the track\r
- \r
- Int_t MinNSigma=FindMinNSigma(trk);//not filling the NSigmaRec histos\r
- \r
- \r
- if(MinNSigma==SpUndefined)return fHasDoubleCounting;//in case of undefined no Double counting\r
- \r
- Float_t nsigmaPion=999., nsigmaKaon=999., nsigmaProton=999.;\r
- switch (fPIDType) {\r
- case NSigmaTPC:\r
- nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPC]);\r
- nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPC]) ;\r
- nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPC]) ;\r
- break;\r
- case NSigmaTOF:\r
- nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTOF]);\r
- nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTOF]) ;\r
- nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTOF]) ;\r
- break;\r
- case NSigmaTPCTOF://In case of no TOF matching the combined nsigma is the TPC one\r
- nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);\r
- nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;\r
- nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;\r
- break;\r
- }\r
-\r
- //there is chance of overlapping only for particles having pt below 4.0 GEv\r
- if(trk->Pt()<=4.0){\r
- if(nsigmaPion<fNSigmaPID && MinNSigma!=SpPion)fHasDoubleCounting[SpPion]=kTRUE;\r
- if(nsigmaKaon<fNSigmaPID && MinNSigma!=SpKaon)fHasDoubleCounting[SpKaon]=kTRUE;\r
- if(nsigmaProton<fNSigmaPID && MinNSigma!=SpProton)fHasDoubleCounting[SpProton]=kTRUE;\r
- \r
- }\r
-\r
- \r
- return fHasDoubleCounting;\r
-}\r
-\r
-//////////////////////////////////////////////////////////////////////////////////////////////////\r
-Int_t AliTwoParticlePIDCorr::GetParticle(AliAODTrack * trk){ \r
- //return the specie according to the minimum nsigma value\r
- //no double counting, this has to be evaluated using CheckDoubleCounting()\r
- //Printf("fPtTOFPID %.1f, fRequestTOFPID %d, fNSigmaPID %.1f, fPIDType %d",fPtTOFPID,fRequestTOFPID,fNSigmaPID,fPIDType);\r
- \r
- CalculateNSigmas(trk);//fill the data member fnsigmas with the nsigmas value [ipart][iPID]\r
- \r
- if(fUseExclusiveNSigma){\r
- Bool_t *HasDC;\r
- HasDC=GetDoubleCounting(trk);\r
- for(Int_t ipart=0;ipart<NSpecies;ipart++){\r
- if(HasDC[ipart]==kTRUE) return SpUndefined;\r
- }\r
- return FindMinNSigma(trk);//NSigmaRec distr filled here\r
- }\r
- else return FindMinNSigma(trk);//NSigmaRec distr filled here\r
- \r
-}\r
-\r
-//-------------------------------------------------------------------------------------\r
-Bool_t\r
-AliTwoParticlePIDCorr::HasTPCPID(AliAODTrack *track) const\r
-{ \r
- // check PID signal \r
- AliPIDResponse::EDetPidStatus statustpc = fPID->CheckPIDStatus(AliPIDResponse::kTPC,track);\r
- if(statustpc!=AliPIDResponse::kDetPidOk) return kFALSE;\r
- //ULong_t status=track->GetStatus();\r
- //if (!( (status & AliAODTrack::kTPCpid ) == AliAODTrack::kTPCpid )) return kFALSE;//remove light nuclei\r
- //if (track->GetTPCsignal() <= 0.) return kFALSE;\r
- // 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.\r
- \r
- return kTRUE; \r
-}\r
-//___________________________________________________________\r
-\r
-Bool_t\r
-AliTwoParticlePIDCorr::HasTOFPID(AliAODTrack *track) const\r
-{\r
- // check TOF matched track \r
- //ULong_t status=track->GetStatus();\r
- //if (!( (status & AliAODTrack::kITSin ) == AliAODTrack::kITSin )) return kFALSE;\r
- AliPIDResponse::EDetPidStatus statustof = fPID->CheckPIDStatus(AliPIDResponse::kTOF,track);\r
- if(statustof!= AliPIDResponse::kDetPidOk) return kFALSE;\r
- if(track->Pt()<=fPtTOFPIDmin) return kFALSE;\r
- //if(!((status & AliAODTrack::kTOFpid ) == AliAODTrack::kTOFpid )) return kFALSE;\r
- //Float_t probMis = fPIDresponse->GetTOFMismatchProbability(track);\r
- // if (probMis > 0.01) return kFALSE;\r
-if(fRemoveTracksT0Fill)\r
- {\r
-Int_t startTimeMask = fPID->GetTOFResponse().GetStartTimeMask(track->P());\r
- if (startTimeMask < 0)return kFALSE; \r
- }\r
- return kTRUE;\r
-}\r
-\r
-//________________________________________________________________________\r
-Float_t AliTwoParticlePIDCorr :: GetBeta(AliAODTrack *track)\r
-{\r
- //it is called only when TOF PID is available\r
- Double_t p = track->P();\r
- Double_t time=track->GetTOFsignal()-fPID->GetTOFResponse().GetStartTime(p);\r
- Double_t timei[5];\r
- track->GetIntegratedTimes(timei);\r
- return timei[0]/time;\r
-}\r
-//------------------------------------------------------------------------------------------------------\r
-\r
-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)\r
-{\r
- // calculate inv mass squared\r
- // same can be achieved, but with more computing time with\r
- /*TLorentzVector photon, p1, p2;\r
- p1.SetPtEtaPhiM(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), 0.510e-3);\r
- p2.SetPtEtaPhiM(particle->Pt(), eta[j], particle->Phi(), 0.510e-3);\r
- photon = p1+p2;\r
- photon.M()*/\r
- \r
- Float_t tantheta1 = 1e10;\r
- \r
- if (eta1 < -1e-10 || eta1 > 1e-10)\r
- tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1));\r
- \r
- Float_t tantheta2 = 1e10;\r
- if (eta2 < -1e-10 || eta2 > 1e-10)\r
- tantheta2 = 2 * TMath::Exp(-eta2) / ( 1 - TMath::Exp(-2*eta2));\r
- \r
- Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);\r
- Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);\r
- \r
- 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 ) ) );\r
- \r
- return mass2;\r
-}\r
-//---------------------------------------------------------------------------------\r
-\r
-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)\r
-{\r
- // calculate inv mass squared approximately\r
- \r
- Float_t tantheta1 = 1e10;\r
- \r
- if (eta1 < -1e-10 || eta1 > 1e-10)\r
- {\r
- Float_t expTmp = 1.0-eta1+eta1*eta1/2-eta1*eta1*eta1/6+eta1*eta1*eta1*eta1/24;\r
- tantheta1 = 2.0 * expTmp / ( 1.0 - expTmp*expTmp);\r
- }\r
- \r
- Float_t tantheta2 = 1e10;\r
- if (eta2 < -1e-10 || eta2 > 1e-10)\r
- {\r
- Float_t expTmp = 1.0-eta2+eta2*eta2/2-eta2*eta2*eta2/6+eta2*eta2*eta2*eta2/24;\r
- tantheta2 = 2.0 * expTmp / ( 1.0 - expTmp*expTmp);\r
- }\r
- \r
- Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);\r
- Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);\r
- \r
- // fold onto 0...pi\r
- Float_t deltaPhi = TMath::Abs(phi1 - phi2);\r
- while (deltaPhi > TMath::TwoPi())\r
- deltaPhi -= TMath::TwoPi();\r
- if (deltaPhi > TMath::Pi())\r
- deltaPhi = TMath::TwoPi() - deltaPhi;\r
- \r
- Float_t cosDeltaPhi = 0;\r
- if (deltaPhi < TMath::Pi()/3)\r
- cosDeltaPhi = 1.0 - deltaPhi*deltaPhi/2 + deltaPhi*deltaPhi*deltaPhi*deltaPhi/24;\r
- else if (deltaPhi < 2*TMath::Pi()/3)\r
- cosDeltaPhi = -(deltaPhi - TMath::Pi()/2) + 1.0/6 * TMath::Power((deltaPhi - TMath::Pi()/2), 3);\r
- else\r
- cosDeltaPhi = -1.0 + 1.0/2.0*(deltaPhi - TMath::Pi())*(deltaPhi - TMath::Pi()) - 1.0/24.0 * TMath::Power(deltaPhi - TMath::Pi(), 4);\r
- \r
- Float_t mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( cosDeltaPhi + 1.0 / tantheta1 / tantheta2 ) ) );\r
- \r
-// Printf(Form("%f %f %f %f %f %f %f %f %f", pt1, eta1, phi1, pt2, eta2, phi2, m0_1, m0_2, mass2));\r
- \r
- return mass2;\r
-}\r
-//--------------------------------------------------------------------------------\r
-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)\r
-{ \r
- //\r
- // calculates dphistar\r
- //\r
- \r
- Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);\r
- \r
- static const Double_t kPi = TMath::Pi();\r
- \r
- // circularity\r
-// if (dphistar > 2 * kPi)\r
-// dphistar -= 2 * kPi;\r
-// if (dphistar < -2 * kPi)\r
-// dphistar += 2 * kPi;\r
- \r
- if (dphistar > kPi)\r
- dphistar = kPi * 2 - dphistar;\r
- if (dphistar < -kPi)\r
- dphistar = -kPi * 2 - dphistar;\r
- if (dphistar > kPi) // might look funny but is needed\r
- dphistar = kPi * 2 - dphistar;\r
- \r
- return dphistar;\r
-}\r
-//_________________________________________________________________________\r
-void AliTwoParticlePIDCorr ::DefineEventPool()\r
-{\r
-const Int_t MaxNofEvents=1000;\r
-const Int_t MaxNofTracks=50000;\r
-const Int_t NofVrtxBins=10+(1+10)*2;\r
-Double_t ZvrtxBins[NofVrtxBins+1]={ -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10, \r
- 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, \r
- 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210 \r
- };\r
- if (fSampleType=="pp"){\r
-const Int_t NofCentBins=5;\r
-Double_t CentralityBins[NofCentBins+1]={0.,10., 20., 40.,80.,200.1};\r
-fPoolMgr = new AliEventPoolManager(MaxNofEvents,MaxNofTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);\r
- }\r
-if (fSampleType=="pPb" || fSampleType=="PbPb")\r
- {\r
-const Int_t NofCentBins=15;\r
-Double_t CentralityBins[NofCentBins+1]={0., 1., 2., 3., 4., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.1 };\r
-fPoolMgr = new AliEventPoolManager(MaxNofEvents,MaxNofTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);\r
- }\r
-fPoolMgr->SetTargetValues(MaxNofTracks, 0.1, 5);\r
-\r
-//if(!fPoolMgr) return kFALSE;\r
-//return kTRUE;\r
-\r
-}\r
-//------------------------------------------------------------------------\r
-Double_t* AliTwoParticlePIDCorr::GetBinning(const char* configuration, const char* tag, Int_t& nBins)\r
-{\r
- // This method is a copy from AliUEHist::GetBinning\r
- // takes the binning from <configuration> identified by <tag>\r
- // configuration syntax example:\r
- // 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\r
- // phi: .....\r
- //\r
- // returns bin edges which have to be deleted by the caller\r
- \r
- TString config(configuration);\r
- TObjArray* lines = config.Tokenize("\n");\r
- for (Int_t i=0; i<lines->GetEntriesFast(); i++)\r
- {\r
- TString line(lines->At(i)->GetName());\r
- if (line.BeginsWith(TString(tag) + ":"))\r
- {\r
- line.Remove(0, strlen(tag) + 1);\r
- line.ReplaceAll(" ", "");\r
- TObjArray* binning = line.Tokenize(",");\r
- Double_t* bins = new Double_t[binning->GetEntriesFast()];\r
- for (Int_t j=0; j<binning->GetEntriesFast(); j++)\r
- bins[j] = TString(binning->At(j)->GetName()).Atof();\r
- \r
- nBins = binning->GetEntriesFast() - 1;\r
-\r
- delete binning;\r
- delete lines;\r
- return bins;\r
- }\r
- }\r
- \r
- delete lines;\r
- AliFatal(Form("Tag %s not found in %s", tag, configuration));\r
- return 0;\r
-}\r
-//_______________________________________________________________________________\r
-void AliTwoParticlePIDCorr::SetAsymmetricBin(THnSparse *h,Int_t dim,Double_t *arraybin,Int_t arraybinsize,TString axisTitle) \r
-{\r
- TAxis *axis = 0x0;\r
- axis = h->GetAxis(dim);\r
- axis->Set(arraybinsize,arraybin);\r
- axis->SetTitle(axisTitle);\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliTwoParticlePIDCorr::Terminate(Option_t *) \r
-{\r
- // Draw result to screen, or perform fitting, normalizations\r
- // Called once at the end of the query\r
- fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
- if(!fOutput) { Printf("ERROR: could not retrieve TList fOutput"); return; }\r
- \r
- \r
-}\r
-//------------------------------------------------------------------ \r
- \r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+#include "AliTwoParticlePIDCorr.h"
+#include "AliVParticle.h"
+#include "TFormula.h"
+#include "TAxis.h"
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TList.h"
+#include "TFile.h"
+
+#include "AliCentrality.h"
+#include "Riostream.h"
+
+#include <TSpline.h>
+#include <AliPID.h>
+#include "AliESDpid.h"
+#include "AliAODpidUtil.h"
+#include <AliPIDResponse.h>
+
+#include <AliAnalysisManager.h>
+#include <AliInputEventHandler.h>
+#include "AliAODInputHandler.h"
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisManager.h"
+#include "AliCentrality.h"
+
+#include "AliVEvent.h"
+#include "AliAODEvent.h"
+#include "AliAODTrack.h"
+#include "AliVTrack.h"
+
+#include "THnSparse.h"
+
+#include "AliAODMCHeader.h"
+#include "AliAODMCParticle.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliMCParticle.h"
+#include "TParticle.h"
+#include <TDatabasePDG.h>
+#include <TParticlePDG.h>
+
+#include "AliGenCocktailEventHeader.h"
+#include "AliGenEventHeader.h"
+
+#include "AliEventPoolManager.h"
+//#include "AliAnalysisUtils.h"
+using namespace AliPIDNameSpace;
+using namespace std;
+
+ClassImp(AliTwoParticlePIDCorr)
+ClassImp(LRCParticlePID)
+//________________________________________________________________________
+AliTwoParticlePIDCorr::AliTwoParticlePIDCorr() // All data members should be initialised here
+:AliAnalysisTaskSE(),
+ fOutput(0),
+ fCentralityMethod("V0A"),
+ fSampleType("pPb"),
+fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)
+ trkVtx(0),
+ zvtx(0),
+ fFilterBit(768),
+ fzvtxcut(10.0),
+ ffilltrigassoUNID(kFALSE),
+ ffilltrigUNIDassoID(kFALSE),
+ ffilltrigIDassoUNID(kTRUE),
+ ffilltrigIDassoID(kFALSE),
+ ffilltrigIDassoIDMCTRUTH(kFALSE),
+ fPtOrderMCTruth(kFALSE),
+ fTriggerSpeciesSelection(kFALSE),
+ fAssociatedSpeciesSelection(kFALSE),
+ fTriggerSpecies(SpPion),
+ fAssociatedSpecies(SpPion),
+ fCustomBinning(""),
+ fBinningString(""),
+ fcontainPIDtrig(kTRUE),
+ fcontainPIDasso(kFALSE),
+//frejectPileUp(kFALSE),
+ fminPt(0.2),
+ fmaxPt(10.0),
+ fmineta(-0.8),
+ fmaxeta(0.8),
+ fminprotonsigmacut(-6.0),
+ fmaxprotonsigmacut(-3.0),
+ fminpionsigmacut(0.0),
+ fmaxpionsigmacut(4.0),
+ fselectprimaryTruth(kTRUE),
+ fonlyprimarydatareco(kFALSE),
+ fdcacut(kFALSE),
+ fdcacutvalue(3.0),
+ ffillhistQAReco(kFALSE),
+ ffillhistQATruth(kFALSE),
+ kTrackVariablesPair(0),
+ fminPtTrig(0),
+ fmaxPtTrig(0),
+ fminPtComboeff(2.0),
+ fmaxPtComboeff(4.0),
+ fminPtAsso(0),
+ fmaxPtAsso(0),
+ fhistcentrality(0),
+ fEventCounter(0),
+ fEtaSpectrasso(0),
+ fphiSpectraasso(0),
+ MCtruthpt(0),
+ MCtrutheta(0),
+ MCtruthphi(0),
+ MCtruthpionpt(0),
+ MCtruthpioneta(0),
+ MCtruthpionphi(0),
+ MCtruthkaonpt(0),
+ MCtruthkaoneta(0),
+ MCtruthkaonphi(0),
+ MCtruthprotonpt(0),
+ MCtruthprotoneta(0),
+ MCtruthprotonphi(0),
+ fPioncont(0),
+ fKaoncont(0),
+ fProtoncont(0),
+ fCentralityCorrelation(0x0),
+ fHistoTPCdEdx(0x0),
+ fHistoTOFbeta(0x0),
+ fTPCTOFPion3d(0),
+ fTPCTOFKaon3d(0),
+ fTPCTOFProton3d(0),
+ fPionPt(0),
+ fPionEta(0),
+ fPionPhi(0),
+ fKaonPt(0),
+ fKaonEta(0),
+ fKaonPhi(0),
+ fProtonPt(0),
+ fProtonEta(0),
+ fProtonPhi(0),
+ fCorrelatonTruthPrimary(0),
+ fCorrelatonTruthPrimarymix(0),
+ fTHnCorrUNID(0),
+ fTHnCorrUNIDmix(0),
+ fTHnCorrID(0),
+ fTHnCorrIDmix(0),
+ fTHnCorrIDUNID(0),
+ fTHnCorrIDUNIDmix(0),
+ fTHnTrigcount(0),
+ fTHnTrigcountMCTruthPrim(0),
+ fPoolMgr(0x0),
+ fArrayMC(0),
+ fAnalysisType("MCAOD"),
+ fefffilename(""),
+ twoTrackEfficiencyCutValue(0.02),
+//fControlConvResoncances(0),
+ fPID(NULL),
+ eventno(0),
+ fPtTOFPIDmin(0.6),
+ fPtTOFPIDmax(4.0),
+ fRequestTOFPID(kTRUE),
+ fPIDType(NSigmaTPCTOF),
+ fNSigmaPID(3),
+ fUseExclusiveNSigma(kFALSE),
+ fRemoveTracksT0Fill(kFALSE),
+fSelectCharge(0),
+fTriggerSelectCharge(0),
+fAssociatedSelectCharge(0),
+fTriggerRestrictEta(-1),
+fEtaOrdering(kFALSE),
+fCutConversions(kFALSE),
+fCutResonances(kFALSE),
+fRejectResonanceDaughters(-1),
+ fOnlyOneEtaSide(0),
+fInjectedSignals(kFALSE),
+ fRemoveWeakDecays(kFALSE),
+fRemoveDuplicates(kFALSE),
+ fapplyTrigefficiency(kFALSE),
+ fapplyAssoefficiency(kFALSE),
+ ffillefficiency(kFALSE),
+ fmesoneffrequired(kFALSE),
+ fkaonprotoneffrequired(kFALSE),
+//fAnalysisUtils(0x0),
+ fDCAXYCut(0)
+
+{
+ for ( Int_t i = 0; i < 16; i++) {
+ fHistQA[i] = NULL;
+ }
+
+ for ( Int_t i = 0; i < 6; i++ ){
+ fTHnrecomatchedallPid[i] = NULL;
+ fTHngenprimPidTruth[i] = NULL;
+ effcorection[i]=NULL;
+ //effmap[i]=NULL;
+
+ }
+
+ for(Int_t ipart=0;ipart<NSpecies;ipart++)
+ for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++)
+ fnsigmas[ipart][ipid]=999.;
+
+ for(Int_t ipart=0;ipart<NSpecies;ipart++) {fHasDoubleCounting[ipart]=kFALSE;}
+
+ }
+//________________________________________________________________________
+AliTwoParticlePIDCorr::AliTwoParticlePIDCorr(const char *name) // All data members should be initialised here
+ :AliAnalysisTaskSE(name),
+ fOutput(0),
+ fCentralityMethod("V0A"),
+ fSampleType("pPb"),
+ fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default)
+ trkVtx(0),
+ zvtx(0),
+ fFilterBit(768),
+ fzvtxcut(10.0),
+ ffilltrigassoUNID(kFALSE),
+ ffilltrigUNIDassoID(kFALSE),
+ ffilltrigIDassoUNID(kTRUE),
+ ffilltrigIDassoID(kFALSE),
+ ffilltrigIDassoIDMCTRUTH(kFALSE),
+ fPtOrderMCTruth(kFALSE),
+ fTriggerSpeciesSelection(kFALSE),
+ fAssociatedSpeciesSelection(kFALSE),
+ fTriggerSpecies(SpPion),
+ fAssociatedSpecies(SpPion),
+ fCustomBinning(""),
+ fBinningString(""),
+ fcontainPIDtrig(kTRUE),
+ fcontainPIDasso(kFALSE),
+ // frejectPileUp(kFALSE),
+ fminPt(0.2),
+ fmaxPt(10.0),
+ fmineta(-0.8),
+ fmaxeta(0.8),
+ fminprotonsigmacut(-6.0),
+ fmaxprotonsigmacut(-3.0),
+ fminpionsigmacut(0.0),
+ fmaxpionsigmacut(4.0),
+ fselectprimaryTruth(kTRUE),
+ fonlyprimarydatareco(kFALSE),
+ fdcacut(kFALSE),
+ fdcacutvalue(3.0),
+ ffillhistQAReco(kFALSE),
+ ffillhistQATruth(kFALSE),
+ kTrackVariablesPair(0),
+ fminPtTrig(0),
+ fmaxPtTrig(0),
+ fminPtComboeff(2.0),
+ fmaxPtComboeff(4.0),
+ fminPtAsso(0),
+ fmaxPtAsso(0),
+ fhistcentrality(0),
+ fEventCounter(0),
+ fEtaSpectrasso(0),
+ fphiSpectraasso(0),
+ MCtruthpt(0),
+ MCtrutheta(0),
+ MCtruthphi(0),
+ MCtruthpionpt(0),
+ MCtruthpioneta(0),
+ MCtruthpionphi(0),
+ MCtruthkaonpt(0),
+ MCtruthkaoneta(0),
+ MCtruthkaonphi(0),
+ MCtruthprotonpt(0),
+ MCtruthprotoneta(0),
+ MCtruthprotonphi(0),
+ fPioncont(0),
+ fKaoncont(0),
+ fProtoncont(0),
+ fCentralityCorrelation(0x0),
+ fHistoTPCdEdx(0x0),
+ fHistoTOFbeta(0x0),
+ fTPCTOFPion3d(0),
+ fTPCTOFKaon3d(0),
+ fTPCTOFProton3d(0),
+ fPionPt(0),
+ fPionEta(0),
+ fPionPhi(0),
+ fKaonPt(0),
+ fKaonEta(0),
+ fKaonPhi(0),
+ fProtonPt(0),
+ fProtonEta(0),
+ fProtonPhi(0),
+ fCorrelatonTruthPrimary(0),
+ fCorrelatonTruthPrimarymix(0),
+ fTHnCorrUNID(0),
+ fTHnCorrUNIDmix(0),
+ fTHnCorrID(0),
+ fTHnCorrIDmix(0),
+ fTHnCorrIDUNID(0),
+ fTHnCorrIDUNIDmix(0),
+ fTHnTrigcount(0),
+ fTHnTrigcountMCTruthPrim(0),
+ fPoolMgr(0x0),
+ fArrayMC(0),
+ fAnalysisType("MCAOD"),
+ fefffilename(""),
+ twoTrackEfficiencyCutValue(0.02),
+//fControlConvResoncances(0),
+ fPID(NULL),
+ eventno(0),
+ fPtTOFPIDmin(0.6),
+ fPtTOFPIDmax(4.0),
+ fRequestTOFPID(kTRUE),
+ fPIDType(NSigmaTPCTOF),
+ fNSigmaPID(3),
+ fUseExclusiveNSigma(kFALSE),
+ fRemoveTracksT0Fill(kFALSE),
+fSelectCharge(0),
+fTriggerSelectCharge(0),
+fAssociatedSelectCharge(0),
+fTriggerRestrictEta(-1),
+fEtaOrdering(kFALSE),
+fCutConversions(kFALSE),
+fCutResonances(kFALSE),
+fRejectResonanceDaughters(-1),
+ fOnlyOneEtaSide(0),
+fInjectedSignals(kFALSE),
+ fRemoveWeakDecays(kFALSE),
+fRemoveDuplicates(kFALSE),
+ fapplyTrigefficiency(kFALSE),
+ fapplyAssoefficiency(kFALSE),
+ ffillefficiency(kFALSE),
+ fmesoneffrequired(kFALSE),
+ fkaonprotoneffrequired(kFALSE),
+ //fAnalysisUtils(0x0),
+ fDCAXYCut(0)
+{
+
+ for ( Int_t i = 0; i < 16; i++) {
+ fHistQA[i] = NULL;
+ }
+
+for ( Int_t i = 0; i < 6; i++ ){
+ fTHnrecomatchedallPid[i] = NULL;
+ fTHngenprimPidTruth[i] = NULL;
+ effcorection[i]=NULL;
+ //effmap[i]=NULL;
+
+ }
+
+ for(Int_t ipart=0;ipart<NSpecies;ipart++)
+ for(Int_t ipid=0;ipid<=NSigmaPIDType;ipid++)
+ fnsigmas[ipart][ipid]=999.;
+
+ for(Int_t ipart=0;ipart<NSpecies;ipart++) {fHasDoubleCounting[ipart]=kFALSE;}
+
+ // The last in the above list should not have a comma after it
+
+ // Constructor
+ // Define input and output slots here (never in the dummy constructor)
+ // Input slot #0 works with a TChain - it is connected to the default input container
+ // Output slot #1 writes into a TH1 container
+
+ DefineOutput(1, TList::Class()); // for output list
+
+}
+
+//________________________________________________________________________
+AliTwoParticlePIDCorr::~AliTwoParticlePIDCorr()
+{
+ // Destructor. Clean-up the output list, but not the histograms that are put inside
+ // (the list is owner and will clean-up these histograms). Protect in PROOF case.
+ if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
+ delete fOutput;
+
+ }
+ if (fPID) delete fPID;
+
+ }
+//________________________________________________________________________
+Float_t AliTwoParticlePIDCorr::PhiRange(Float_t DPhi)
+
+{
+ //
+ // Puts the argument in the range [-pi/2,3 pi/2].
+ //
+
+ if (DPhi < -TMath::Pi()/2) DPhi += 2*TMath::Pi();
+ if (DPhi > 3*TMath::Pi()/2) DPhi -= 2*TMath::Pi();
+
+ return DPhi;
+
+}
+//________________________________________________________________________
+void AliTwoParticlePIDCorr::UserCreateOutputObjects()
+{
+ // Create histograms
+ // Called once (on the worker node)
+ AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+ fPID = inputHandler->GetPIDResponse();
+
+ //AliAnalysisUtils *fUtils = new AliAnalysisUtils();
+
+//get the efficiency correction map
+
+
+ fOutput = new TList();
+ fOutput->SetOwner(); // IMPORTANT!
+
+ Int_t centmultbins=10;
+ Double_t centmultmin=0.0;
+ Double_t centmultmax=100.0;
+ if(fSampleType=="pPb" || fSampleType=="PbPb")
+ {
+ centmultbins=10;
+ centmultmin=0.0;
+ centmultmax=100.0;
+ }
+ if(fSampleType=="pp")
+ {
+ centmultbins=10;
+ centmultmin=0.0;
+ centmultmax=200.0;
+ }
+
+fhistcentrality=new TH1F("fhistcentrality","fhistcentrality",centmultbins*4,centmultmin,centmultmax);
+fOutput->Add(fhistcentrality);
+
+ fEventCounter = new TH1F("fEventCounter","EventCounter", 10, 0.5,10.5);
+ fEventCounter->GetXaxis()->SetBinLabel(1,"Event Accesed");
+ fEventCounter->GetXaxis()->SetBinLabel(2,"Have a vertex");
+ fEventCounter->GetXaxis()->SetBinLabel(5,"After vertex Cut");
+ fEventCounter->GetXaxis()->SetBinLabel(6,"Within 0-100% centrality");
+ fEventCounter->GetXaxis()->SetBinLabel(7,"Event Analyzed");
+ //fEventCounter->GetXaxis()->SetBinLabel(8,"Event Analysis finished");
+ fOutput->Add(fEventCounter);
+
+fEtaSpectrasso=new TH2F("fEtaSpectraasso","fEtaSpectraasso",180,-0.9,0.9,100,0.,20. );
+fOutput->Add(fEtaSpectrasso);
+
+fphiSpectraasso=new TH2F("fphiSpectraasso","fphiSpectraasso",72,0,2*TMath::Pi(),100,0.,20.);
+fOutput->Add(fphiSpectraasso);
+
+
+ if(fSampleType=="pPb" || fSampleType=="PbPb"){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 20000, 0,40000);
+ fOutput->Add(fCentralityCorrelation);
+ }
+
+fHistoTPCdEdx = new TH2F("hHistoTPCdEdx", ";p_{T} (GeV/c);dE/dx (au.)",200,0.0,10.0,500, 0., 500.);
+fOutput->Add(fHistoTPCdEdx);
+fHistoTOFbeta = new TH2F(Form("hHistoTOFbeta"), ";p_{T} (GeV/c);v/c",70, 0., 7., 500, 0.1, 1.1);
+ fOutput->Add(fHistoTOFbeta);
+
+ fTPCTOFPion3d=new TH3F ("fTPCTOFpion3d", "fTPCTOFpion3d",100,0., 10., 120,-60.,60.,120,-60.,60);
+ fOutput->Add(fTPCTOFPion3d);
+
+ fTPCTOFKaon3d=new TH3F ("fTPCTOFKaon3d", "fTPCTOFKaon3d",100,0., 10., 120,-60.,60.,120,-60.,60);
+ fOutput->Add(fTPCTOFKaon3d);
+
+ fTPCTOFProton3d=new TH3F ("fTPCTOFProton3d", "fTPCTOFProton3d",100,0., 10., 120,-60.,60.,120,-60.,60);
+ fOutput->Add(fTPCTOFProton3d);
+
+if(ffillhistQAReco)
+ {
+ fPionPt = new TH1F("fHistQAPionPt","p_{T} distribution",200,0.,10.);
+ fOutput->Add(fPionPt);
+ fPionEta= new TH1F("fHistQAPionEta","#eta distribution",360,-1.8,1.8);
+ fOutput->Add(fPionEta);
+ fPionPhi = new TH1F("fHistQAPionPhi","#phi distribution",340,0,6.8);
+ fOutput->Add(fPionPhi);
+
+ fKaonPt = new TH1F("fHistQAKaonPt","p_{T} distribution",200,0.,10.);
+ fOutput->Add(fKaonPt);
+ fKaonEta= new TH1F("fHistQAKaonEta","#eta distribution",360,-1.8,1.8);
+ fOutput->Add(fKaonEta);
+ fKaonPhi = new TH1F("fHistQAKaonPhi","#phi distribution",340,0,6.8);
+ fOutput->Add(fKaonPhi);
+
+ fProtonPt = new TH1F("fHistQAProtonPt","p_{T} distribution",200,0.,10.);
+ fOutput->Add(fProtonPt);
+ fProtonEta= new TH1F("fHistQAProtonEta","#eta distribution",360,-1.8,1.8);
+ fOutput->Add(fProtonEta);
+ fProtonPhi= new TH1F("fHistQAProtonPhi","#phi distribution",340,0,6.8);
+ fOutput->Add(fProtonPhi);
+ }
+
+ fHistQA[0] = new TH1F("fHistQAvx", "Histo Vx All ", 50, -5., 5.);
+ fHistQA[1] = new TH1F("fHistQAvy", "Histo Vy All", 50, -5., 5.);
+ fHistQA[2] = new TH1F("fHistQAvz", "Histo Vz All", 50, -25., 25.);
+ fHistQA[3] = new TH1F("fHistQAvxA", "Histo Vx After Cut ", 50, -5., 5.);
+ fHistQA[4] = new TH1F("fHistQAvyA", "Histo Vy After Cut", 50, -5., 5.);
+ fHistQA[5] = new TH1F("fHistQAvzA", "Histo Vz After Cut", 50, -25., 25.);
+ fHistQA[6] = new TH1F("fHistQADcaXyC", "Histo DCAxy after cut", 50, -5., 5.);
+ fHistQA[7] = new TH1F("fHistQADcaZC", "Histo DCAz after cut", 50, -5., 5.);
+ fHistQA[8] = new TH1F("fHistQAPt","p_{T} distribution",200,0.,10.);
+ fHistQA[9] = new TH1F("fHistQAEta","#eta distribution",360,-1.8,1.8);
+ fHistQA[10] = new TH1F("fHistQAPhi","#phi distribution",340,0,6.8);
+ fHistQA[11] = new TH1F("fHistQANCls","Number of TPC cluster",200,0,200);
+ fHistQA[13] = new TH1F("fHistQAChi2","Chi2 per NDF",100,0,10);
+ fHistQA[12] = new TH1F("fHistQANCls1","Number of TPC cluster1",200,0,200);
+ fHistQA[14] = new TH1F("nCrossedRowsTPC","Number of TPC ccrossed rows",200,0,200);
+ fHistQA[15] = new TH1F("ratioCrossedRowsOverFindableClustersTPC","Number of TPC ccrossed rows find clusters",200,0,2);
+
+for(Int_t i = 0; i < 16; i++)
+ {
+ fOutput->Add(fHistQA[i]);
+ }
+
+ kTrackVariablesPair=6 ;
+
+ if(fcontainPIDtrig && !fcontainPIDasso) kTrackVariablesPair=7;
+
+ if(!fcontainPIDtrig && fcontainPIDasso) kTrackVariablesPair=7;
+
+ if(fcontainPIDtrig && fcontainPIDasso) kTrackVariablesPair=8;
+
+
+// two particle histograms
+ Int_t iBinPair[kTrackVariablesPair]; // binning for track variables
+ Double_t* dBinsPair[kTrackVariablesPair]; // bins for track variables
+ TString* axisTitlePair; // axis titles for track variables
+ axisTitlePair=new TString[kTrackVariablesPair];
+
+ TString defaultBinningStr;
+ 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"
+ "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"
+ "p_t_leading_course: 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0,10.0\n"
+ "p_t_eff: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"
+ "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"
+ "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
+ "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"
+ "multiplicity: 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1\n";
+
+ if(fcontainPIDtrig){
+ defaultBinningStr += "PIDTrig: -0.5,0.5,1.5,2.5,3.5\n"; // course
+ }
+ if(fcontainPIDasso){
+ defaultBinningStr += "PIDAsso: -0.5,0.5,1.5,2.5,3.5\n"; // course
+ }
+ // =========================================================
+ // Customization (adopted from AliUEHistograms)
+ // =========================================================
+
+ TObjArray* lines = defaultBinningStr.Tokenize("\n");
+ for (Int_t i=0; i<lines->GetEntriesFast(); i++)
+ {
+ TString line(lines->At(i)->GetName());
+ TString tag = line(0, line.Index(":")+1);
+ if (!fCustomBinning.BeginsWith(tag) && !fCustomBinning.Contains(TString("\n") + tag))
+ fBinningString += line + "\n";
+ else
+ AliInfo(Form("Using custom binning for %s", tag.Data()));
+ }
+ delete lines;
+ fBinningString += fCustomBinning;
+
+ AliInfo(Form("Used THn Binning:\n%s",fBinningString.Data()));
+
+ // =========================================================
+ // Now set the bins
+ // =========================================================
+
+ dBinsPair[0] = GetBinning(fBinningString, "multiplicity", iBinPair[0]);
+ axisTitlePair[0] = " multiplicity";
+
+ dBinsPair[1] = GetBinning(fBinningString, "vertex", iBinPair[1]);
+ axisTitlePair[1] = "v_{Z} (cm)";
+
+ dBinsPair[2] = GetBinning(fBinningString, "p_t_leading_course", iBinPair[2]);
+ axisTitlePair[2] = "p_{T,trig.} (GeV/c)";
+
+ dBinsPair[3] = GetBinning(fBinningString, "p_t_assoc", iBinPair[3]);
+ axisTitlePair[3] = "p_{T,assoc.} (GeV/c)";
+
+ dBinsPair[4] = GetBinning(fBinningString, "delta_eta", iBinPair[4]);
+ axisTitlePair[4] = "#Delta#eta";
+
+ dBinsPair[5] = GetBinning(fBinningString, "delta_phi", iBinPair[5]);
+ axisTitlePair[5] = "#Delta#varphi (rad)";
+
+ if(fcontainPIDtrig && !fcontainPIDasso){
+ dBinsPair[6] = GetBinning(fBinningString, "PIDTrig", iBinPair[6]);
+ axisTitlePair[6] = "PIDTrig";
+ }
+
+ if(!fcontainPIDtrig && fcontainPIDasso){
+ dBinsPair[6] = GetBinning(fBinningString, "PIDAsso", iBinPair[6]);
+ axisTitlePair[6] = "PIDAsso";
+ }
+
+if(fcontainPIDtrig && fcontainPIDasso){
+
+ dBinsPair[6] = GetBinning(fBinningString, "PIDTrig", iBinPair[6]);
+ axisTitlePair[6] = "PIDTrig";
+
+ dBinsPair[7] = GetBinning(fBinningString, "PIDAsso", iBinPair[7]);
+ axisTitlePair[7] = "PIDAsso";
+ }
+
+ Int_t nEtaBin = -1;
+ Double_t* EtaBin = GetBinning(fBinningString, "eta", nEtaBin);
+
+ Int_t nPteffbin = -1;
+ Double_t* Pteff = GetBinning(fBinningString, "p_t_eff", nPteffbin);
+
+
+ fminPtTrig=dBinsPair[2][0];
+ fmaxPtTrig=dBinsPair[2][iBinPair[2]];
+ fminPtAsso=dBinsPair[3][0];
+ fmaxPtAsso=dBinsPair[3][iBinPair[3]];
+
+ //fminPtComboeff=fminPtTrig;***then this value will be fixed ,even Setter can't change it's value
+ //fmaxPtComboeff=fmaxPtTrig;
+//THnSparses for calculation of efficiency
+
+ if((fAnalysisType =="MCAOD") && ffillefficiency) {
+ const Int_t nDim = 4;// cent zvtx pt eta
+ Int_t fBinsCh[nDim] = {iBinPair[0], iBinPair[1], nPteffbin ,nEtaBin};//**********************change it
+ Double_t fMinCh[nDim] = { dBinsPair[0][0],dBinsPair[1][0], Pteff[0], EtaBin[0] };
+ Double_t fMaxCh[nDim] = { dBinsPair[0][iBinPair[0]], dBinsPair[1][iBinPair[1]], Pteff[nPteffbin], EtaBin[nEtaBin]};
+
+TString Histrename;
+for(Int_t jj=0;jj<6;jj++)//PID type binning
+ {
+ Histrename="fTHnrecomatchedallPid";Histrename+=jj;
+ fTHnrecomatchedallPid[jj] = new THnSparseF(Histrename.Data(),"cent:zvtx::Pt:eta", nDim, fBinsCh, fMinCh, fMaxCh);
+ fTHnrecomatchedallPid[jj]->Sumw2();
+ fTHnrecomatchedallPid[jj]->GetAxis(0)->Set(iBinPair[0], dBinsPair[0]);
+ fTHnrecomatchedallPid[jj]->GetAxis(0)->SetTitle("Centrality");
+ fTHnrecomatchedallPid[jj]->GetAxis(1)->Set(iBinPair[1],dBinsPair[1]);
+ fTHnrecomatchedallPid[jj]->GetAxis(1)->SetTitle("zvtx");
+ fTHnrecomatchedallPid[jj]->GetAxis(2)->Set(nPteffbin, Pteff);
+ fTHnrecomatchedallPid[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
+ fTHnrecomatchedallPid[jj]->GetAxis(3)->Set(nEtaBin,EtaBin);
+ fTHnrecomatchedallPid[jj]->GetAxis(3)->SetTitle("#eta");
+ fOutput->Add(fTHnrecomatchedallPid[jj]);
+
+Histrename="fTHngenprimPidTruth";Histrename+=jj;
+ fTHngenprimPidTruth[jj] = new THnSparseF(Histrename.Data(),"cent:zvtx::Pt:eta", nDim, fBinsCh, fMinCh, fMaxCh);
+ fTHngenprimPidTruth[jj]->Sumw2();
+ fTHngenprimPidTruth[jj]->GetAxis(0)->Set(iBinPair[0],dBinsPair[0]);
+ fTHngenprimPidTruth[jj]->GetAxis(0)->SetTitle("Centrality");
+ fTHngenprimPidTruth[jj]->GetAxis(1)->Set(iBinPair[1], dBinsPair[1]);
+ fTHngenprimPidTruth[jj]->GetAxis(1)->SetTitle("zvtx");
+ fTHngenprimPidTruth[jj]->GetAxis(2)->Set(nPteffbin, Pteff);
+ fTHngenprimPidTruth[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
+ fTHngenprimPidTruth[jj]->GetAxis(3)->Set(nEtaBin, EtaBin);
+ fTHngenprimPidTruth[jj]->GetAxis(3)->SetTitle("#eta");
+ fOutput->Add(fTHngenprimPidTruth[jj]);
+ }
+ }
+
+ Int_t fBins[kTrackVariablesPair];
+ Double_t fMin[kTrackVariablesPair];
+ Double_t fMax[kTrackVariablesPair];
+
+//ThnSparses for Correlation plots(data & MC)
+ for(Int_t i=0;i<kTrackVariablesPair;i++)
+ {
+ fBins[i] =iBinPair[i];
+ fMin[i]= dBinsPair[i][0];
+ fMax[i] = dBinsPair[i][iBinPair[i]];
+ }
+ if(ffilltrigassoUNID)
+ {
+ fTHnCorrUNID = new THnSparseF("fTHnCorrUNID","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fTHnCorrUNID->Sumw2();
+ for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fTHnCorrUNID,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fTHnCorrUNID);
+
+fTHnCorrUNIDmix = new THnSparseF("fTHnCorrUNIDmix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fTHnCorrUNIDmix->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fTHnCorrUNIDmix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fTHnCorrUNIDmix);
+ }
+
+ if(ffilltrigIDassoID)
+ {
+ fTHnCorrID = new THnSparseF("fTHnCorrID","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fTHnCorrID->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fTHnCorrID,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fTHnCorrID);
+
+fTHnCorrIDmix = new THnSparseF("fTHnCorrIDmix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fTHnCorrIDmix->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fTHnCorrIDmix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fTHnCorrIDmix);
+ }
+
+ if(ffilltrigUNIDassoID || ffilltrigIDassoUNID)//***********a bit tricky, be careful
+ {
+ fTHnCorrIDUNID = new THnSparseF("fTHnCorrIDUNID","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fTHnCorrIDUNID->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fTHnCorrIDUNID,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fTHnCorrIDUNID);
+
+ fTHnCorrIDUNIDmix = new THnSparseF("fTHnCorrIDUNIDmix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fTHnCorrIDUNIDmix->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fTHnCorrIDUNIDmix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fTHnCorrIDUNIDmix);
+ }
+
+
+
+ //ThnSparse for Correlation plots(truth MC)
+ if((fAnalysisType == "MCAOD") && ffilltrigIDassoIDMCTRUTH) {//remember that in this case uidentified means other than pions, kaons, protons
+ fCorrelatonTruthPrimary = new THnSparseF("fCorrelatonTruthPrimary","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fCorrelatonTruthPrimary->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fCorrelatonTruthPrimary,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fCorrelatonTruthPrimary);
+
+ fCorrelatonTruthPrimarymix = new THnSparseF("fCorrelatonTruthPrimarymix","cent:zvtx:pttrig:ptasso:deltaeta:deltaphi", kTrackVariablesPair, fBins, fMin, fMax);
+ fCorrelatonTruthPrimarymix->Sumw2();
+for(Int_t i=0; i<kTrackVariablesPair;i++){
+ SetAsymmetricBin(fCorrelatonTruthPrimarymix,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ fOutput->Add(fCorrelatonTruthPrimarymix);
+ }
+
+
+ //binning for trigger no. counting
+
+ Double_t* fMint;
+ Double_t* fMaxt;
+ Int_t* fBinst;
+ Int_t dims=3;
+ if(fcontainPIDtrig) dims=4;
+ fMint= new Double_t[dims];
+ fMaxt= new Double_t[dims];
+ fBinst= new Int_t[dims];
+ for(Int_t i=0; i<3;i++)
+ {
+ fBinst[i]=iBinPair[i];
+ fMint[i]=dBinsPair[i][0];
+ fMaxt[i]=dBinsPair[i][iBinPair[i]];
+ }
+ if(fcontainPIDtrig){
+ fBinst[3]=iBinPair[6];
+ fMint[3]=dBinsPair[6][0];
+ fMaxt[3]=dBinsPair[6][iBinPair[6]];
+ }
+
+ //ThSparse for trigger counting(data & reco MC)
+ if(ffilltrigassoUNID || ffilltrigUNIDassoID || ffilltrigIDassoUNID || ffilltrigIDassoID)
+ {
+ fTHnTrigcount = new THnSparseF("fTHnTrigcount","cent:zvtx:pt", dims, fBinst, fMint, fMaxt);
+ fTHnTrigcount->Sumw2();
+for(Int_t i=0; i<3;i++){
+ SetAsymmetricBin(fTHnTrigcount,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+ if(fcontainPIDtrig) SetAsymmetricBin(fTHnTrigcount,3,dBinsPair[6],iBinPair[6],axisTitlePair[6]);
+ fOutput->Add(fTHnTrigcount);
+ }
+
+ if((fAnalysisType =="MCAOD") && ffilltrigIDassoIDMCTRUTH) {
+ //ThSparse for trigger counting(truth MC)
+fTHnTrigcountMCTruthPrim = new THnSparseF("fTHnTrigcountMCTruthPrim","cent:zvtx:pt", dims, fBinst, fMint, fMaxt);
+ fTHnTrigcountMCTruthPrim->Sumw2();
+for(Int_t i=0; i<3;i++){
+ SetAsymmetricBin(fTHnTrigcountMCTruthPrim,i,dBinsPair[i],iBinPair[i],axisTitlePair[i]);
+ }
+if(fcontainPIDtrig) SetAsymmetricBin(fTHnTrigcountMCTruthPrim,3,dBinsPair[6],iBinPair[6],axisTitlePair[6]);
+ fOutput->Add(fTHnTrigcountMCTruthPrim);
+ }
+
+if(fAnalysisType=="MCAOD"){
+ if(ffillhistQATruth)
+ {
+ MCtruthpt=new TH1F ("MCtruthpt","ptdistributiontruthprim",100,0.,10.);
+ fOutput->Add(MCtruthpt);
+
+ MCtrutheta=new TH1F ("MCtrutheta","etadistributiontruthprim",360,-1.8,1.8);
+ fOutput->Add(MCtrutheta);
+
+ MCtruthphi=new TH1F ("MCtruthphi","phidisttruthprim",340,0,6.8);
+ fOutput->Add(MCtruthphi);
+
+ MCtruthpionpt=new TH1F ("MCtruthpionpt","MCtruthpionpt",100,0.,10.);
+ fOutput->Add(MCtruthpionpt);
+
+ MCtruthpioneta=new TH1F ("MCtruthpioneta","MCtruthpioneta",360,-1.8,1.8);
+ fOutput->Add(MCtruthpioneta);
+
+ MCtruthpionphi=new TH1F ("MCtruthpionphi","MCtruthpionphi",340,0,6.8);
+ fOutput->Add(MCtruthpionphi);
+
+ MCtruthkaonpt=new TH1F ("MCtruthkaonpt","MCtruthkaonpt",100,0.,10.);
+ fOutput->Add(MCtruthkaonpt);
+
+ MCtruthkaoneta=new TH1F ("MCtruthkaoneta","MCtruthkaoneta",360,-1.8,1.8);
+ fOutput->Add(MCtruthkaoneta);
+
+ MCtruthkaonphi=new TH1F ("MCtruthkaonphi","MCtruthkaonphi",340,0,6.8);
+ fOutput->Add(MCtruthkaonphi);
+
+ MCtruthprotonpt=new TH1F ("MCtruthprotonpt","MCtruthprotonpt",100,0.,10.);
+ fOutput->Add(MCtruthprotonpt);
+
+ MCtruthprotoneta=new TH1F ("MCtruthprotoneta","MCtruthprotoneta",360,-1.8,1.8);
+ fOutput->Add(MCtruthprotoneta);
+
+ MCtruthprotonphi=new TH1F ("MCtruthprotonphi","MCtruthprotonphi",340,0,6.8);
+ fOutput->Add(MCtruthprotonphi);
+ }
+ fPioncont=new TH2F("fPioncont", "fPioncont",10,-0.5,9.5,100,0.,10.);
+ fOutput->Add(fPioncont);
+
+ fKaoncont=new TH2F("fKaoncont","fKaoncont",10,-0.5,9.5,100,0.,10.);
+ fOutput->Add(fKaoncont);
+
+ fProtoncont=new TH2F("fProtoncont","fProtoncont",10,-0.5,9.5,100,0.,10.);
+ fOutput->Add(fProtoncont);
+ }
+
+//Mixing
+DefineEventPool();
+
+ if(fapplyTrigefficiency || fapplyAssoefficiency)
+ {
+ const Int_t nDimt = 4;// cent zvtx pt eta
+ Int_t fBinsCht[nDimt] = {iBinPair[0], iBinPair[1], nPteffbin ,nEtaBin};//*************change it
+ Double_t fMinCht[nDimt] = { dBinsPair[0][0],dBinsPair[1][0], Pteff[0], EtaBin[0] };
+ Double_t fMaxCht[nDimt] = {dBinsPair[0][iBinPair[0]], dBinsPair[1][iBinPair[1]], Pteff[nPteffbin], EtaBin[nEtaBin]};
+
+ TString Histrexname;
+for(Int_t jj=0;jj<6;jj++)// PID type binning
+ {
+ Histrexname="effcorection";Histrexname+=jj;
+ effcorection[jj] = new THnSparseF(Histrexname.Data(),"cent:zvtx::Pt:eta", nDimt, fBinsCht, fMinCht, fMaxCht);
+ effcorection[jj]->Sumw2();
+ effcorection[jj]->GetAxis(0)->Set(iBinPair[0], dBinsPair[0]);
+ effcorection[jj]->GetAxis(0)->SetTitle("Centrality");
+ effcorection[jj]->GetAxis(1)->Set( iBinPair[1],dBinsPair[1]);
+ effcorection[jj]->GetAxis(1)->SetTitle("zvtx");
+ effcorection[jj]->GetAxis(2)->Set(nPteffbin, Pteff);
+ effcorection[jj]->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
+ effcorection[jj]->GetAxis(3)->Set( nEtaBin,EtaBin);
+ effcorection[jj]->GetAxis(3)->SetTitle("#eta");
+ fOutput->Add(effcorection[jj]);
+ }
+// TFile *fsifile = new TFile(fefffilename,"READ");
+ TFile *fileT=TFile::Open(fefffilename);
+ TString Nameg;
+for(Int_t jj=0;jj<6;jj++)//type binning
+ {
+Nameg="effmap";Nameg+=jj;
+//effcorection[jj] = (THnSparseF*)fsifile->Get(Nameg.Data());
+effcorection[jj] = (THnSparseF*)fileT->Get(Nameg.Data());
+
+//effcorection[jj]->SetDirectory(0);//****************************not present in case oh THnF
+ }
+//fsifile->Close();
+fileT->Close();
+
+ }
+
+//fControlConvResoncances = new TH2F("fControlConvResoncances", ";id;delta mass", 3, -0.5, 2.5, 100, -0.1, 0.1);
+// fOutput->Add(fControlConvResoncances);
+
+
+ PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
+}
+//-------------------------------------------------------------------------------
+void AliTwoParticlePIDCorr::UserExec( Option_t * ){
+
+
+ if(fAnalysisType == "AOD") {
+
+ doAODevent();
+
+ }//AOD--analysis-----
+
+ else if(fAnalysisType == "MCAOD") {
+
+ doMCAODevent();
+
+ }
+
+ else return;
+
+}
+//-------------------------------------------------------------------------
+void AliTwoParticlePIDCorr::doMCAODevent()
+{
+ AliVEvent *event = InputEvent();
+ if (!event) { Printf("ERROR: Could not retrieve event"); return; }
+ AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);
+ if (!aod) {
+ AliError("Cannot get the AOD event");
+ return;
+ }
+
+// count all events(physics triggered)
+ fEventCounter->Fill(1);
+
+ // get centrality object and check quality(valid for p-Pb and Pb-Pb)
+ Double_t cent_v0=0.0;
+
+ if(fSampleType=="pPb" || fSampleType=="PbPb")
+ {
+ AliCentrality *centrality=0;
+ if(aod)
+ centrality = aod->GetHeader()->GetCentralityP();
+ // if (centrality->GetQuality() != 0) return ;
+
+ if(centrality)
+ {
+ cent_v0 = centrality->GetCentralityPercentile(fCentralityMethod);
+ }
+ else
+ {
+ cent_v0= -1;
+ }
+ }
+
+//check the PIDResponse handler
+ if (!fPID) return;
+
+// get mag. field required for twotrack efficiency cut
+ Float_t bSign = 0;
+ bSign = (aod->GetMagneticField() > 0) ? 1 : -1;
+
+ //check for TClonesArray(truth track MC information)
+fArrayMC = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
+ if (!fArrayMC) {
+ AliFatal("Error: MC particles branch not found!\n");
+ return;
+ }
+
+ //check for AliAODMCHeader(truth event MC information)
+ AliAODMCHeader *header=NULL;
+ header=(AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
+ if(!header) {
+ printf("MC header branch not found!\n");
+ return;
+ }
+
+//Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex
+Float_t zVtxmc =header->GetVtxZ();
+ if(TMath::Abs(zVtxmc)>fzvtxcut) return;
+
+ // For productions with injected signals, figure out above which label to skip particles/tracks
+ Int_t skipParticlesAbove = 0;
+
+ if (fInjectedSignals)
+ {
+ AliGenEventHeader* eventHeader = 0;
+ Int_t headers = 0;
+
+// AOD
+ if (!header)
+ AliFatal("fInjectedSignals set but no MC header found");
+
+ headers = header->GetNCocktailHeaders();
+ eventHeader = header->GetCocktailHeader(0);
+
+ if (!eventHeader)
+ {
+ // We avoid AliFatal here, because the AOD productions sometimes have events where the MC header is missing
+ // (due to unreadable Kinematics) and we don't want to loose the whole job because of a few events
+ AliError("First event header not found. Skipping this event.");
+ //fHistos->FillEvent(centrality, AliUEHist::kCFStepAnaTopology);
+ return;
+ }
+skipParticlesAbove = eventHeader->NProduced();
+ AliInfo(Form("Injected signals in this event (%d headers). Keeping events of %s. Will skip particles/tracks above %d.", headers, eventHeader->ClassName(), skipParticlesAbove));
+ }
+
+ //vertex selection(is it fine for PP?)
+ if ( fSampleType=="pPb"){
+ trkVtx = aod->GetPrimaryVertex();
+ if (!trkVtx || trkVtx->GetNContributors()<=0) return;
+ TString vtxTtl = trkVtx->GetTitle();
+ if (!vtxTtl.Contains("VertexerTracks")) return;
+ zvtx = trkVtx->GetZ();
+ const AliAODVertex* spdVtx = aod->GetPrimaryVertexSPD();
+ if (!spdVtx || spdVtx->GetNContributors()<=0) return;
+ TString vtxTyp = spdVtx->GetTitle();
+ Double_t cov[6]={0};
+ spdVtx->GetCovarianceMatrix(cov);
+ Double_t zRes = TMath::Sqrt(cov[5]);
+ if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;
+ if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;
+ }
+ else if(fSampleType=="PbPb" || fSampleType=="pp") {//for pp and pb-pb case
+ Int_t nVertex = aod->GetNumberOfVertices();
+ if( nVertex > 0 ) {
+ trkVtx = aod->GetPrimaryVertex();
+ Int_t nTracksPrim = trkVtx->GetNContributors();
+ zvtx = trkVtx->GetZ();
+ //if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));
+ // Reject TPC only vertex
+ TString name(trkVtx->GetName());
+ if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return;
+
+ // Select a quality vertex by number of tracks?
+ if( nTracksPrim < fnTracksVertex ) {
+ //if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
+ return ;
+ }
+ // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present
+ //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)
+ // return kFALSE;
+ // if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");
+ }
+ else return;
+
+ }
+ else return;//as there is no proper sample type
+
+
+ fHistQA[0]->Fill((trkVtx->GetX()));fHistQA[1]->Fill((trkVtx->GetY()));fHistQA[2]->Fill((trkVtx->GetZ())); //for trkVtx only before vertex cut |zvtx|<10 cm
+
+ //count events having a proper vertex
+ fEventCounter->Fill(2);
+
+ if (TMath::Abs(zvtx) > fzvtxcut) return;
+
+fHistQA[3]->Fill((trkVtx->GetX()));fHistQA[4]->Fill((trkVtx->GetY()));fHistQA[5]->Fill((trkVtx->GetZ()));//after vertex cut for trkVtx only
+
+//now we have events passed physics trigger, centrality,eventzvtx cut
+
+//count events after vertex cut
+ fEventCounter->Fill(5);
+
+if(!aod) return; //for safety
+
+if (fSampleType=="pPb" || fSampleType=="PbPb") if (cent_v0 < 0) return;//for pp case it is the multiplicity
+
+ 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)
+
+ Double_t cent_v0_truth=0.0;
+
+ //TObjArray* tracksMCtruth=0;
+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
+ tracksMCtruth->SetOwner(kTRUE); //***********************************IMPORTANT!
+
+ eventno++;
+
+ //There is a small difference between zvtx and zVtxmc??????
+ //cout<<"***********************************************zVtxmc="<<zVtxmc<<endl;
+ //cout<<"***********************************************zvtx="<<zvtx<<endl;
+
+//now process the truth particles(for both efficiency & correlation function)
+Int_t nMCTrack = fArrayMC->GetEntriesFast();
+
+for (Int_t iMC = 0; iMC < nMCTrack; iMC++)
+{ //MC truth track loop starts
+
+AliAODMCParticle *partMC = (AliAODMCParticle*) fArrayMC->At(iMC);
+
+ if(!partMC){
+ AliError(Form("ERROR: Could not retrieve AODMCtrack %d",iMC));
+ continue;
+ }
+
+//consider only charged particles
+ if(partMC->Charge() == 0) continue;
+
+//consider only primary particles; neglect all secondary particles including from weak decays
+ if(fselectprimaryTruth && !partMC->IsPhysicalPrimary()) continue;
+
+
+//remove injected signals(primaries above <maxLabel>)
+ if (fInjectedSignals && partMC->GetLabel() >= skipParticlesAbove) continue;
+
+//remove duplicates
+ Bool_t isduplicate=kFALSE;
+ if (fRemoveDuplicates)
+ {
+ for (Int_t j=iMC+1; j<nMCTrack; ++j)
+ {//2nd trutuh loop starts
+AliAODMCParticle *partMC2 = (AliAODMCParticle*) fArrayMC->At(j);
+ if(!partMC2){
+ AliError(Form("ERROR: Could not retrieve AODMCtrack %d",j));
+ continue;
+ }
+ if (partMC->GetLabel() == partMC2->GetLabel())
+ {
+isduplicate=kTRUE;
+ break;
+ }
+ }//2nd truth loop ends
+ }
+ if(fRemoveDuplicates && isduplicate) continue;//remove duplicates
+
+//give only kinematic cuts at the truth level
+ if (partMC->Eta() < fmineta || partMC->Eta() > fmaxeta) continue;
+ if (partMC->Pt() < fminPt || partMC->Pt() > fmaxPt) continue;
+
+ if(!partMC) continue;//for safety
+
+ //To determine multiplicity in case of PP
+ nooftrackstruth++;
+ //cout<<"**************************************"<<TMath::Abs(partMC->GetLabel())<<endl;
+//only physical primary(all/unidentified)
+if(ffillhistQATruth)
+ {
+ MCtruthpt->Fill(partMC->Pt());
+ MCtrutheta->Fill(partMC->Eta());
+ MCtruthphi->Fill(partMC->Phi());
+ }
+ //get particle ID
+Int_t pdgtruth=((AliAODMCParticle*)partMC)->GetPdgCode();
+Int_t particletypeTruth=-999;
+ if (TMath::Abs(pdgtruth)==211)
+ {
+ particletypeTruth=SpPion;
+if(ffillhistQATruth)
+ {
+ MCtruthpionpt->Fill(partMC->Pt());
+ MCtruthpioneta->Fill(partMC->Eta());
+ MCtruthpionphi->Fill(partMC->Phi());
+ }
+ }
+ if (TMath::Abs(pdgtruth)==321)
+ {
+ particletypeTruth=SpKaon;
+if(ffillhistQATruth)
+ {
+ MCtruthkaonpt->Fill(partMC->Pt());
+ MCtruthkaoneta->Fill(partMC->Eta());
+ MCtruthkaonphi->Fill(partMC->Phi());
+ }
+ }
+if(TMath::Abs(pdgtruth)==2212)
+ {
+ particletypeTruth=SpProton;
+if(ffillhistQATruth)
+ {
+ MCtruthprotonpt->Fill(partMC->Pt());
+ MCtruthprotoneta->Fill(partMC->Eta());
+ MCtruthprotonphi->Fill(partMC->Phi());
+ }
+ }
+ 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)
+
+ // -- Fill THnSparse for efficiency and contamination calculation
+ if (fSampleType=="pp") cent_v0=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
+
+ Double_t primmctruth[4] = {cent_v0, zVtxmc,partMC->Pt(), partMC->Eta()};
+ if(ffillefficiency)
+ {
+ fTHngenprimPidTruth[5]->Fill(primmctruth);//for all primary truth particles(4)
+if (TMath::Abs(pdgtruth)==211 || TMath::Abs(pdgtruth)==321) fTHngenprimPidTruth[3]->Fill(primmctruth);//for primary truth mesons(3)
+if (TMath::Abs(pdgtruth)==2212 || TMath::Abs(pdgtruth)==321) fTHngenprimPidTruth[4]->Fill(primmctruth);//for primary truth kaons+protons(4)
+ if (TMath::Abs(pdgtruth)==211) fTHngenprimPidTruth[0]->Fill(primmctruth);//for pions
+ if (TMath::Abs(pdgtruth)==321) fTHngenprimPidTruth[1]->Fill(primmctruth);//for kaons
+ if(TMath::Abs(pdgtruth)==2212) fTHngenprimPidTruth[2]->Fill(primmctruth);//for protons
+ }
+
+ Float_t effmatrixtruth=1.0;//In Truth MC, no case of efficiency correction so it should be always 1.0
+if(partMC->Pt()>=fminPtAsso || partMC->Pt()<=fmaxPtTrig)//to reduce memory consumption in pool
+ {
+LRCParticlePID* copy6 = new LRCParticlePID(particletypeTruth,partMC->Charge(),partMC->Pt(),partMC->Eta(), partMC->Phi(),effmatrixtruth);
+//copy6->SetUniqueID(eventno * 100000 + TMath::Abs(partMC->GetLabel()));
+ copy6->SetUniqueID(eventno * 100000 + (Int_t)nooftrackstruth);
+ tracksMCtruth->Add(copy6);//************** TObjArray used for truth correlation function calculation
+ }
+ }//MC truth track loop ends
+
+//*********************still in event loop
+
+ if (fSampleType=="pp") cent_v0_truth=nooftrackstruth;
+ else cent_v0_truth=cent_v0;//the notation cent_v0 is reserved for reco/data case
+
+ //now cent_v0_truth should be used for all correlation function calculation
+
+if(nooftrackstruth>0.0 && ffilltrigIDassoIDMCTRUTH)
+ {
+ //Fill Correlations for MC truth particles(same event)
+if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)//hadron triggered correlation
+ Fillcorrelation(tracksMCtruth,0,cent_v0_truth,zVtxmc,bSign,fPtOrderMCTruth,kFALSE,kFALSE,"trigIDassoIDMCTRUTH");//mixcase=kFALSE for same event case
+
+//start mixing
+AliEventPool* pool2 = fPoolMgr->GetEventPool(cent_v0_truth, zVtxmc+200);
+if (pool2 && pool2->IsReady())
+ {//start mixing only when pool->IsReady
+if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)
+ {//proceed only when no. of trigger particles >0 in current event
+for (Int_t jMix=0; jMix<pool2->GetCurrentNEvents(); jMix++)
+ { //pool event loop start
+ TObjArray* bgTracks6 = pool2->GetEvent(jMix);
+ if(!bgTracks6) continue;
+ Fillcorrelation(tracksMCtruth,bgTracks6,cent_v0_truth,zVtxmc,bSign,fPtOrderMCTruth,kFALSE,kTRUE,"trigIDassoIDMCTRUTH");//mixcase=kTRUE for mixing case
+
+ }// pool event loop ends mixing case
+ }//if(trackstrig && trackstrig->GetEntriesFast()>0) condition ends mixing case
+} //if pool->IsReady() condition ends mixing case
+
+ //still in main event loop
+
+ if(tracksMCtruth){
+if(pool2) pool2->UpdatePool(CloneAndReduceTrackList(tracksMCtruth));//ownership of tracksasso is with pool now, don't delete it
+ }
+ }
+
+ //still in main event loop
+
+if(tracksMCtruth) delete tracksMCtruth;
+
+//now deal with reco tracks
+ //TObjArray* tracksUNID=0;
+ TObjArray* tracksUNID = new TObjArray;
+ tracksUNID->SetOwner(kTRUE);
+
+ //TObjArray* tracksID=0;
+ TObjArray* tracksID = new TObjArray;
+ tracksID->SetOwner(kTRUE);
+
+
+ Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//used for reconstructed track dca cut
+
+ Double_t trackscount=0.0;
+
+// loop over reconstructed tracks
+ for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++)
+{ // reconstructed track loop starts
+ AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrk));
+ if (!track) continue;
+ //get the corresponding MC track at the truth level (doing reco matching)
+ AliAODMCParticle* recomatched = static_cast<AliAODMCParticle*>(fArrayMC->At(TMath::Abs(track->GetLabel())));
+ if(!recomatched) continue;//if a reco track doesn't have corresponding truth track at generated level is a fake track(label==0), ignore it
+
+//remove injected signals
+ if(fInjectedSignals)
+ {
+ AliAODMCParticle* mother = recomatched;
+
+ while (!mother->IsPhysicalPrimary())
+ {// find the primary mother;the first stable mother is searched and checked if it is <= <maxLabel>
+ if (mother->GetMother() < 0)
+ {
+ mother = 0;
+ break;
+ }
+
+ mother =(AliAODMCParticle*) fArrayMC->At(((AliAODMCParticle*)mother)->GetMother());
+ if (!mother)
+ break;
+ }
+ if (!mother)
+ {
+ Printf("WARNING: No mother found for particle %d:", recomatched->GetLabel());
+ continue;
+ }
+ if (mother->GetLabel() >= skipParticlesAbove) continue;//remove injected signals(primaries above <maxLabel>)
+ }//remove injected signals
+
+ if (fRemoveWeakDecays && ((AliAODMCParticle*) recomatched)->IsSecondaryFromWeakDecay()) continue;//remove weak decays
+
+ Bool_t isduplicate2=kFALSE;
+if (fRemoveDuplicates)
+ {
+ for (Int_t j =itrk+1; j < aod->GetNumberOfTracks(); j++)
+ {//2nd loop starts
+ AliAODTrack* track2 = dynamic_cast<AliAODTrack*>(aod->GetTrack(j));
+ if (!track2) continue;
+ AliAODMCParticle* recomatched2 = static_cast<AliAODMCParticle*>(fArrayMC->At(TMath::Abs(track2->GetLabel())));
+if(!recomatched2) continue;
+
+if (track->GetLabel() == track2->GetLabel())
+ {
+isduplicate2=kTRUE;
+ break;
+ }
+ }//2nd loop ends
+ }
+ if(fRemoveDuplicates && isduplicate2) continue;//remove duplicates
+
+ fHistQA[11]->Fill(track->GetTPCNcls());
+ Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1);//dcacut=kFALSE,onlyprimary=kFALSE
+
+ if(tracktype==0) continue;
+ if(tracktype==1)//tracks "not" passed AliAODTrack::kPrimary at reconstructed level & have proper TPC PID response(?)
+{
+ if(!track) continue;//for safety
+ //accepted all(primaries+secondary) reconstructed tracks(pt 0.2 to 10.0,,eta -0.8 to 0.8)
+ trackscount++;
+
+//check for eta , phi holes
+ fEtaSpectrasso->Fill(track->Eta(),track->Pt());
+ fphiSpectraasso->Fill(track->Phi(),track->Pt());
+
+ Int_t particletypeMC=-9999;
+
+//tag all particles as unidentified
+ particletypeMC=unidentified;
+
+ Float_t effmatrix=1.;
+
+// -- Fill THnSparse for efficiency calculation
+ if (fSampleType=="pp") cent_v0=15.0;//integrated over multiplicity(so put any fixed value for each track so that practically means there is only one bin in multiplicityi.e multiplicity intregated out )**************Important
+ //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)
+
+ //Clone & Reduce track list(TObjArray) for unidentified particles
+if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig)//to reduce memory consumption in pool
+ {
+ if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles
+ effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletypeMC);
+ LRCParticlePID* copy = new LRCParticlePID(particletypeMC,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);
+ copy->SetUniqueID(eventno * 100000 +(Int_t)trackscount);
+ tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)
+ }
+ Double_t allrecomatchedpid[4] = {cent_v0, zVtxmc,recomatched->Pt(), recomatched->Eta()};
+if(ffillefficiency) fTHnrecomatchedallPid[5]->Fill(allrecomatchedpid);//for all
+
+ //now start the particle identification process:)
+
+//get the pdg code of the corresponding truth particle
+ Int_t pdgCode = ((AliAODMCParticle*)recomatched)->GetPdgCode();
+
+Float_t dEdx = track->GetTPCsignal();
+ fHistoTPCdEdx->Fill(track->Pt(), dEdx);
+
+ if(HasTOFPID(track))
+{
+Float_t beta = GetBeta(track);
+fHistoTOFbeta->Fill(track->Pt(), beta);
+ }
+
+ //do track identification(nsigma method)
+ particletypeMC=GetParticle(track);//******************************problem is here
+
+//2-d TPCTOF map(for each Pt interval)
+ if(HasTOFPID(track)){
+ fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
+ fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);
+ fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]);
+ }
+ if(particletypeMC==SpUndefined) continue;
+
+ //Pt, Eta , Phi distribution of the reconstructed identified particles
+if(ffillhistQAReco)
+ {
+if (particletypeMC==SpPion)
+ {
+ fPionPt->Fill(track->Pt());
+ fPionEta->Fill(track->Eta());
+ fPionPhi->Fill(track->Phi());
+ }
+if (particletypeMC==SpKaon)
+ {
+ fKaonPt->Fill(track->Pt());
+ fKaonEta->Fill(track->Eta());
+ fKaonPhi->Fill(track->Phi());
+ }
+if (particletypeMC==SpProton)
+ {
+ fProtonPt->Fill(track->Pt());
+ fProtonEta->Fill(track->Eta());
+ fProtonPhi->Fill(track->Phi());
+ }
+ }
+
+ //for misidentification fraction calculation(do it with tuneonPID)
+ if(particletypeMC==SpPion )
+ {
+ if(TMath::Abs(pdgCode)==211) fPioncont->Fill(1.,track->Pt());
+ if(TMath::Abs(pdgCode)==321) fPioncont->Fill(3.,track->Pt());
+ if(TMath::Abs(pdgCode)==2212) fPioncont->Fill(5.,track->Pt());
+ if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fPioncont->Fill(7.,track->Pt());
+ }
+if(particletypeMC==SpKaon )
+ {
+ if(TMath::Abs(pdgCode)==211) fKaoncont->Fill(1.,track->Pt());
+ if(TMath::Abs(pdgCode)==321) fKaoncont->Fill(3.,track->Pt());
+ if(TMath::Abs(pdgCode)==2212) fKaoncont->Fill(5.,track->Pt());
+ if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fKaoncont->Fill(7.,track->Pt());
+ }
+ if(particletypeMC==SpProton )
+ {
+ if(TMath::Abs(pdgCode)==211) fProtoncont->Fill(1.,track->Pt());
+ if(TMath::Abs(pdgCode)==321) fProtoncont->Fill(3.,track->Pt());
+ if(TMath::Abs(pdgCode)==2212) fProtoncont->Fill(5.,track->Pt());
+ if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fProtoncont->Fill(7.,track->Pt());
+ }
+
+ //fill tracking efficiency
+ if(ffillefficiency)
+ {
+ if(particletypeMC==SpPion || particletypeMC==SpKaon)
+ {
+if(TMath::Abs(pdgCode)==211 || TMath::Abs(pdgCode)==321) fTHnrecomatchedallPid[3]->Fill(allrecomatchedpid);//for mesons
+ }
+ if(particletypeMC==SpKaon || particletypeMC==SpProton)
+ {
+if(TMath::Abs(pdgCode)==321 || TMath::Abs(pdgCode)==2212) fTHnrecomatchedallPid[4]->Fill(allrecomatchedpid);//for kaons+protons
+ }
+ if(particletypeMC==SpPion && TMath::Abs(pdgCode)==211) fTHnrecomatchedallPid[0]->Fill(allrecomatchedpid);//for pions
+ if(particletypeMC==SpKaon && TMath::Abs(pdgCode)==321) fTHnrecomatchedallPid[1]->Fill(allrecomatchedpid);//for kaons
+ if(particletypeMC==SpProton && TMath::Abs(pdgCode)==2212) fTHnrecomatchedallPid[2]->Fill(allrecomatchedpid);//for protons
+ }
+
+if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig)//to reduce memory consumption in pool
+ {
+if (fapplyTrigefficiency || fapplyAssoefficiency)
+ effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletypeMC);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles
+ LRCParticlePID* copy1 = new LRCParticlePID(particletypeMC,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);
+ copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
+ tracksID->Add(copy1);
+ }
+ }// if(tracktype==1) condition structure ands
+
+}//reco track loop ends
+
+ //*************************************************************still in event loop
+
+//same event delta-eta-deltaphi plot
+if(fSampleType=="pp") cent_v0=trackscount;//multiplicity
+
+if(trackscount>0.0)
+ {
+//fill the centrality/multiplicity distribution of the selected events
+ fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case
+
+ 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??????
+
+//count selected events having centrality betn 0-100%
+ fEventCounter->Fill(6);
+
+ //same event delte-eta, delta-phi plot
+if(tracksUNID && tracksUNID->GetEntriesFast()>0)//hadron triggered correlation
+ {//same event calculation starts
+ if(ffilltrigassoUNID) Fillcorrelation(tracksUNID,0,cent_v0,zvtx,bSign,kTRUE,kTRUE,kFALSE,"trigassoUNID");//mixcase=kFALSE (hadron-hadron correlation)
+ if(tracksID && tracksID->GetEntriesFast()>0 && ffilltrigUNIDassoID) Fillcorrelation(tracksUNID,tracksID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigUNIDassoID");//mixcase=kFALSE (hadron-ID correlation)
+ }
+
+if(tracksID && tracksID->GetEntriesFast()>0)//ID triggered correlation
+ {//same event calculation starts
+ if(tracksUNID && tracksUNID->GetEntriesFast()>0 && ffilltrigIDassoUNID) Fillcorrelation(tracksID,tracksUNID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoUNID");//mixcase=kFALSE (ID-hadron correlation)
+ if(ffilltrigIDassoID) Fillcorrelation(tracksID,0,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoID");//mixcase=kFALSE (ID-ID correlation)
+ }
+
+//still in main event loop
+//start mixing
+ if(ffilltrigassoUNID || ffilltrigIDassoUNID){//mixing with unidentified particles
+AliEventPool* pool = fPoolMgr->GetEventPool(cent_v0, zvtx);//In the pool there is tracksUNID(i.e associateds are unidentified)
+if (pool && pool->IsReady())
+ {//start mixing only when pool->IsReady
+ for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++)
+ { //pool event loop start
+ TObjArray* bgTracks = pool->GetEvent(jMix);
+ if(!bgTracks) continue;
+ if(ffilltrigassoUNID && tracksUNID && tracksUNID->GetEntriesFast()>0)//*******************************hadron trggered mixing
+ Fillcorrelation(tracksUNID,bgTracks,cent_v0,zvtx,bSign,kTRUE,kTRUE,kTRUE,"trigassoUNID");//mixcase=kTRUE
+ if(ffilltrigIDassoUNID && tracksID && tracksID->GetEntriesFast()>0)//***********************************ID trggered mixing
+ Fillcorrelation(tracksID,bgTracks,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoUNID");//mixcase=kTRUE
+ }// pool event loop ends mixing case
+
+} //if pool->IsReady() condition ends mixing case
+ if(tracksUNID) {
+if(pool)
+ pool->UpdatePool(CloneAndReduceTrackList(tracksUNID));
+ }
+ }//mixing with unidentified particles
+
+ if(ffilltrigUNIDassoID || ffilltrigIDassoID){//mixing with identified particles
+AliEventPool* pool1 = fPoolMgr->GetEventPool(cent_v0, zvtx+100);//In the pool1 there is tracksID(i.e associateds are identified)
+if (pool1 && pool1->IsReady())
+ {//start mixing only when pool->IsReady
+for (Int_t jMix=0; jMix<pool1->GetCurrentNEvents(); jMix++)
+ { //pool event loop start
+ TObjArray* bgTracks2 = pool1->GetEvent(jMix);
+ if(!bgTracks2) continue;
+if(ffilltrigUNIDassoID && tracksUNID && tracksUNID->GetEntriesFast()>0)
+ Fillcorrelation(tracksUNID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigUNIDassoID");//mixcase=kTRUE
+if(ffilltrigIDassoID && tracksID && tracksID->GetEntriesFast()>0)
+ Fillcorrelation(tracksID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoID");//mixcase=kTRUE
+
+ }// pool event loop ends mixing case
+} //if pool1->IsReady() condition ends mixing case
+
+if(tracksID) {
+if(pool1)
+ pool1->UpdatePool(CloneAndReduceTrackList(tracksID));//ownership of tracksasso is with pool now, don't delete it(tracksUNID is with pool)
+ }
+ }//mixing with identified particles
+
+ //no. of events analyzed
+fEventCounter->Fill(7);
+ }
+
+if(tracksUNID) delete tracksUNID;
+
+if(tracksID) delete tracksID;
+
+
+PostData(1, fOutput);
+
+}
+//________________________________________________________________________
+void AliTwoParticlePIDCorr::doAODevent()
+{
+
+ //get AOD
+ AliVEvent *event = InputEvent();
+ if (!event) { Printf("ERROR: Could not retrieve event"); return; }
+ AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);
+ if (!aod) {
+ AliError("Cannot get the AOD event");
+ return;
+ }
+
+// count all events
+ fEventCounter->Fill(1);
+
+ // get centrality object and check quality
+ Double_t cent_v0=0;
+
+ if(fSampleType=="pPb" || fSampleType=="PbPb")
+ {
+ AliCentrality *centrality=0;
+ if(aod)
+ centrality = aod->GetHeader()->GetCentralityP();
+ // if (centrality->GetQuality() != 0) return ;
+
+ if(centrality)
+ {
+ cent_v0 = centrality->GetCentralityPercentile(fCentralityMethod);
+ }
+ else
+ {
+ cent_v0= -1;
+ }
+ }
+
+ Float_t bSign = (aod->GetMagneticField() > 0) ? 1 : -1;//for two track efficiency cut in correlation function calculation
+ Float_t bSign1=aod->GetHeader()->GetMagneticField() ;//for dca cut in ClassifyTrack(), i.e in track loop
+
+// Pileup selection ************************************************
+// if(frejectPileUp) //applicable only for TPC only tracks,not for hybrid tracks?.
+ // {
+ //if (fAnalysisUtils && fAnalysisUtils->IsPileUpEvent(aod)) return;
+ // }
+
+ if (!fPID) return;//this should be available with each event even if we don't do PID selection
+
+ //vertex selection(is it fine for PP?)
+ if ( fSampleType=="pPb"){
+ trkVtx = aod->GetPrimaryVertex();
+ if (!trkVtx || trkVtx->GetNContributors()<=0) return;
+ TString vtxTtl = trkVtx->GetTitle();
+ if (!vtxTtl.Contains("VertexerTracks")) return;
+ zvtx = trkVtx->GetZ();
+ const AliAODVertex* spdVtx = aod->GetPrimaryVertexSPD();
+ if (!spdVtx || spdVtx->GetNContributors()<=0) return;
+ TString vtxTyp = spdVtx->GetTitle();
+ Double_t cov[6]={0};
+ spdVtx->GetCovarianceMatrix(cov);
+ Double_t zRes = TMath::Sqrt(cov[5]);
+ if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;
+ if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;
+ }
+ else if(fSampleType=="PbPb" || fSampleType=="pp") {//for pp and pb-pb case
+ Int_t nVertex = aod->GetNumberOfVertices();
+ if( nVertex > 0 ) {
+ trkVtx = aod->GetPrimaryVertex();
+ Int_t nTracksPrim = trkVtx->GetNContributors();
+ zvtx = trkVtx->GetZ();
+ //if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));
+ // Reject TPC only vertex
+ TString name(trkVtx->GetName());
+ if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return;
+
+ // Select a quality vertex by number of tracks?
+ if( nTracksPrim < fnTracksVertex ) {
+ //if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
+ return ;
+ }
+ // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present
+ //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)
+ // return kFALSE;
+ // if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");
+ }
+ else return;
+
+ }
+ else return;//as there is no proper sample type
+
+
+ fHistQA[0]->Fill((trkVtx->GetX()));fHistQA[1]->Fill((trkVtx->GetY()));fHistQA[2]->Fill((trkVtx->GetZ())); //for trkVtx only before vertex cut |zvtx|<10 cm
+
+//count events having a proper vertex
+ fEventCounter->Fill(2);
+
+ if (TMath::Abs(zvtx) > fzvtxcut) return;
+
+//count events after vertex cut
+ fEventCounter->Fill(5);
+
+
+ //if(!fAnalysisUtils->IsVertexSelected2013pA(aod)) return;
+
+ fHistQA[3]->Fill((trkVtx->GetX()));fHistQA[4]->Fill((trkVtx->GetY()));fHistQA[5]->Fill((trkVtx->GetZ()));//after vertex cut,for trkVtx only
+
+
+ if(!aod) return; //for safety
+
+if(fSampleType=="pPb" || fSampleType=="PbPb") if (cent_v0 < 0) return;//for pp case it is the multiplicity
+
+ TObjArray* tracksUNID= new TObjArray;//track info before doing PID
+ tracksUNID->SetOwner(kTRUE); // IMPORTANT!
+
+ TObjArray* tracksID= new TObjArray;//only pions, kaons,protonsi.e. after doing the PID selection
+ tracksID->SetOwner(kTRUE); // IMPORTANT!
+
+ Double_t trackscount=0.0;//in case of pp this will give the multiplicity after the track loop(only for unidentified particles that pass the filterbit and kinematic cuts)
+
+ eventno++;
+
+ for (Int_t itrk = 0; itrk < aod->GetNumberOfTracks(); itrk++)
+{ //track loop starts for TObjArray(containing track and event information) filling; used for correlation function calculation
+ AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrk));
+ if (!track) continue;
+ fHistQA[11]->Fill(track->GetTPCNcls());
+ Int_t particletype=-9999;//required for PID filling
+ Int_t tracktype=ClassifyTrack(track,trkVtx,bSign1);//dcacut=kFALSE,onlyprimary=kFALSE
+ if(tracktype!=1) continue;
+
+ if(!track) continue;//for safety
+
+//check for eta , phi holes
+ fEtaSpectrasso->Fill(track->Eta(),track->Pt());
+ fphiSpectraasso->Fill(track->Phi(),track->Pt());
+
+ trackscount++;
+
+ //if no applyefficiency , set the eff factor=1.0
+ Float_t effmatrix=1.0;
+
+ //tag all particles as unidentified that passed filterbit & kinematic cuts
+ particletype=unidentified;
+
+
+ if (fSampleType=="pp") cent_v0=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
+
+
+ //to reduce memory consumption in pool
+ if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig)
+ {
+ //Clone & Reduce track list(TObjArray) for unidentified particles
+ if (fapplyTrigefficiency || fapplyAssoefficiency)//get the trackingefficiency x contamination factor for unidentified particles
+ effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletype);
+ LRCParticlePID* copy = new LRCParticlePID(particletype,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);
+ copy->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
+ tracksUNID->Add(copy);//track information Storage for UNID correlation function(tracks that pass the filterbit & kinematic cuts only)
+ }
+
+//now start the particle identificaion process:)
+
+//track passing filterbit 768 have proper TPC response,or need to be checked explicitly before doing PID????
+
+ Float_t dEdx = track->GetTPCsignal();
+ fHistoTPCdEdx->Fill(track->Pt(), dEdx);
+
+ //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)
+ if(HasTOFPID(track))
+{
+ Float_t beta = GetBeta(track);
+ fHistoTOFbeta->Fill(track->Pt(), beta);
+ }
+
+
+//track identification(using nsigma method)
+ particletype=GetParticle(track);//*******************************change may be required(It should return only pion,kaon, proton and Spundefined; NOT unidentifed***************be careful)
+
+
+//2-d TPCTOF map(for each Pt interval)
+ if(HasTOFPID(track)){
+ fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
+ fTPCTOFKaon3d->Fill(track->Pt(),fnsigmas[SpKaon][NSigmaTOF],fnsigmas[SpKaon][NSigmaTPC]);
+ fTPCTOFProton3d->Fill(track->Pt(),fnsigmas[SpProton][NSigmaTOF],fnsigmas[SpProton][NSigmaTPC]);
+ }
+
+//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!!!!!
+ 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)!!!!!!!!!!!
+
+ //Pt, Eta , Phi distribution of the reconstructed identified particles
+if(ffillhistQAReco)
+ {
+if (particletype==SpPion)
+ {
+ fPionPt->Fill(track->Pt());
+ fPionEta->Fill(track->Eta());
+ fPionPhi->Fill(track->Phi());
+ }
+if (particletype==SpKaon)
+ {
+ fKaonPt->Fill(track->Pt());
+ fKaonEta->Fill(track->Eta());
+ fKaonPhi->Fill(track->Phi());
+ }
+if (particletype==SpProton)
+ {
+ fProtonPt->Fill(track->Pt());
+ fProtonEta->Fill(track->Eta());
+ fProtonPhi->Fill(track->Phi());
+ }
+ }
+
+if(track->Pt()>=fminPtAsso || track->Pt()<=fmaxPtTrig)
+ {
+if (fapplyTrigefficiency || fapplyAssoefficiency)
+ effmatrix=GetTrackbyTrackeffvalue(track,cent_v0,zvtx,particletype);//get the tracking eff x TOF matching eff x PID eff x contamination factor for identified particles; Bool_t mesoneffrequired=kFALSE
+ LRCParticlePID* copy1 = new LRCParticlePID(particletype,track->Charge(),track->Pt(),track->Eta(), track->Phi(),effmatrix);
+ copy1->SetUniqueID(eventno * 100000 + (Int_t)trackscount);
+ tracksID->Add(copy1);
+ }
+} //track loop ends but still in event loop
+
+if(trackscount<1.0){
+ if(tracksUNID) delete tracksUNID;
+ if(tracksID) delete tracksID;
+ return;
+ }
+
+// cout<<fminPtAsso<<"***"<<fmaxPtAsso<<"*********************"<<fminPtTrig<<"***"<<fmaxPtTrig<<"*****************"<<kTrackVariablesPair<<endl;
+if(fSampleType=="pp") cent_v0=trackscount;//multiplicity
+
+//fill the centrality/multiplicity distribution of the selected events
+ fhistcentrality->Fill(cent_v0);//*********************************WARNING::binning of cent_v0 is different for pp and pPb/PbPb case
+
+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??????
+
+//count selected events having centrality betn 0-100%
+ fEventCounter->Fill(6);
+
+//same event delta-eta-deltaphi plot
+
+if(tracksUNID && tracksUNID->GetEntriesFast()>0)//hadron triggered correlation
+ {//same event calculation starts
+ if(ffilltrigassoUNID) Fillcorrelation(tracksUNID,0,cent_v0,zvtx,bSign,kTRUE,kTRUE,kFALSE,"trigassoUNID");//mixcase=kFALSE (hadron-hadron correlation)
+ if(tracksID && tracksID->GetEntriesFast()>0 && ffilltrigUNIDassoID) Fillcorrelation(tracksUNID,tracksID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigUNIDassoID");//mixcase=kFALSE (hadron-ID correlation)
+ }
+
+if(tracksID && tracksID->GetEntriesFast()>0)//ID triggered correlation
+ {//same event calculation starts
+ if(tracksUNID && tracksUNID->GetEntriesFast()>0 && ffilltrigIDassoUNID) Fillcorrelation(tracksID,tracksUNID,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoUNID");//mixcase=kFALSE (ID-hadron correlation)
+ if(ffilltrigIDassoID) Fillcorrelation(tracksID,0,cent_v0,zvtx,bSign,kFALSE,kTRUE,kFALSE,"trigIDassoID");//mixcase=kFALSE (ID-ID correlation)
+ }
+
+//still in main event loop
+
+
+//start mixing
+ if(ffilltrigassoUNID || ffilltrigIDassoUNID){//mixing with unidentified particles
+AliEventPool* pool = fPoolMgr->GetEventPool(cent_v0, zvtx);//In the pool there is tracksUNID(i.e associateds are unidentified)
+if (pool && pool->IsReady())
+ {//start mixing only when pool->IsReady
+ for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++)
+ { //pool event loop start
+ TObjArray* bgTracks = pool->GetEvent(jMix);
+ if(!bgTracks) continue;
+ if(ffilltrigassoUNID && tracksUNID && tracksUNID->GetEntriesFast()>0)//*******************************hadron trggered mixing
+ Fillcorrelation(tracksUNID,bgTracks,cent_v0,zvtx,bSign,kTRUE,kTRUE,kTRUE,"trigassoUNID");//mixcase=kTRUE
+ if(ffilltrigIDassoUNID && tracksID && tracksID->GetEntriesFast()>0)//***********************************ID trggered mixing
+ Fillcorrelation(tracksID,bgTracks,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoUNID");//mixcase=kTRUE
+ }// pool event loop ends mixing case
+
+} //if pool->IsReady() condition ends mixing case
+ if(tracksUNID) {
+if(pool)
+ pool->UpdatePool(CloneAndReduceTrackList(tracksUNID));
+ }
+ }//mixing with unidentified particles
+
+
+ if(ffilltrigUNIDassoID || ffilltrigIDassoID){//mixing with identified particles
+AliEventPool* pool1 = fPoolMgr->GetEventPool(cent_v0, zvtx+100);//In the pool1 there is tracksID(i.e associateds are identified)
+if (pool1 && pool1->IsReady())
+ {//start mixing only when pool->IsReady
+for (Int_t jMix=0; jMix<pool1->GetCurrentNEvents(); jMix++)
+ { //pool event loop start
+ TObjArray* bgTracks2 = pool1->GetEvent(jMix);
+ if(!bgTracks2) continue;
+if(ffilltrigUNIDassoID && tracksUNID && tracksUNID->GetEntriesFast()>0)
+ Fillcorrelation(tracksUNID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigUNIDassoID");//mixcase=kTRUE
+if(ffilltrigIDassoID && tracksID && tracksID->GetEntriesFast()>0)
+ Fillcorrelation(tracksID,bgTracks2,cent_v0,zvtx,bSign,kFALSE,kTRUE,kTRUE,"trigIDassoID");//mixcase=kTRUE
+
+ }// pool event loop ends mixing case
+} //if pool1->IsReady() condition ends mixing case
+
+if(tracksID) {
+if(pool1)
+ pool1->UpdatePool(CloneAndReduceTrackList(tracksID));//ownership of tracksasso is with pool now, don't delete it(tracksUNID is with pool)
+ }
+ }//mixing with identified particles
+
+
+ //no. of events analyzed
+fEventCounter->Fill(7);
+
+//still in main event loop
+
+
+if(tracksUNID) delete tracksUNID;
+
+if(tracksID) delete tracksID;
+
+
+PostData(1, fOutput);
+
+} // *************************event loop ends******************************************//_______________________________________________________________________
+TObjArray* AliTwoParticlePIDCorr::CloneAndReduceTrackList(TObjArray* tracks)
+{
+ // clones a track list by using AliDPhiBasicParticle which uses much less memory (used for event mixing)
+
+ TObjArray* tracksClone = new TObjArray;
+ tracksClone->SetOwner(kTRUE);
+
+ for (Int_t i=0; i<tracks->GetEntriesFast(); i++)
+ {
+ LRCParticlePID* particle = (LRCParticlePID*) tracks->UncheckedAt(i);
+ LRCParticlePID* copy100 = new LRCParticlePID(particle->getparticle(),particle->Charge(), particle->Pt(),particle->Eta(), particle->Phi(), particle->geteffcorrectionval());
+ copy100->SetUniqueID(particle->GetUniqueID());
+ tracksClone->Add(copy100);
+ }
+
+ return tracksClone;
+}
+
+//--------------------------------------------------------------------------------
+void AliTwoParticlePIDCorr::Fillcorrelation(TObjArray *trackstrig,TObjArray *tracksasso,Double_t cent,Float_t vtx,Float_t bSign,Bool_t fPtOrder,Bool_t twoTrackEfficiencyCut,Bool_t mixcase,TString fillup)
+{
+
+ //before calling this function check that either trackstrig & tracksasso are available
+
+ // Eta() is extremely time consuming, therefore cache it for the inner loop here:
+ TObjArray* input = (tracksasso) ? tracksasso : trackstrig;
+ TArrayF eta(input->GetEntriesFast());
+ for (Int_t i=0; i<input->GetEntriesFast(); i++)
+ eta[i] = ((LRCParticlePID*) input->UncheckedAt(i))->Eta();
+
+ //if(trackstrig)
+ Int_t jmax=trackstrig->GetEntriesFast();
+ if(tracksasso)
+ jmax=tracksasso->GetEntriesFast();
+
+// identify K, Lambda candidates and flag those particles
+ // a TObject bit is used for this
+const UInt_t kResonanceDaughterFlag = 1 << 14;
+ if (fRejectResonanceDaughters > 0)
+ {
+ Double_t resonanceMass = -1;
+ Double_t massDaughter1 = -1;
+ Double_t massDaughter2 = -1;
+ const Double_t interval = 0.02;
+ switch (fRejectResonanceDaughters)
+ {
+ case 1: resonanceMass = 0.9; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // method test
+ case 2: resonanceMass = 0.4976; massDaughter1 = 0.1396; massDaughter2 = massDaughter1; break; // k0
+ case 3: resonanceMass = 1.115; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // lambda
+ default: AliFatal(Form("Invalid setting %d", fRejectResonanceDaughters));
+ }
+
+for (Int_t i=0; i<trackstrig->GetEntriesFast(); i++)
+ trackstrig->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
+ for (Int_t i=0; tracksasso->GetEntriesFast(); i++)
+ tracksasso->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
+
+ for (Int_t i=0; i<trackstrig->GetEntriesFast(); i++)
+ {
+ LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));
+for (Int_t j=0; tracksasso->GetEntriesFast(); j++)
+ {
+ LRCParticlePID *asso=(LRCParticlePID*)(tracksasso->UncheckedAt(j));
+
+ // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
+if (trig->IsEqual(asso)) continue;
+
+if (trig->Charge() * asso->Charge() > 0) continue;
+
+ Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trig->Eta(), trig->Phi(), asso->Pt(), asso->Eta(), asso->Phi(), massDaughter1, massDaughter2);
+
+if (TMath::Abs(mass - resonanceMass*resonanceMass) < interval*5)
+ {
+ mass = GetInvMassSquared(trig->Pt(), trig->Eta(), trig->Phi(), asso->Pt(), asso->Eta(), asso->Phi(), massDaughter1, massDaughter2);
+
+ if (mass > (resonanceMass-interval)*(resonanceMass-interval) && mass < (resonanceMass+interval)*(resonanceMass+interval))
+ {
+ trig->SetBit(kResonanceDaughterFlag);
+ asso->SetBit(kResonanceDaughterFlag);
+
+// Printf("Flagged %d %d %f", i, j, TMath::Sqrt(mass));
+ }
+ }
+ }
+ }
+ }
+
+ //two particle correlation filling
+
+for(Int_t i=0;i<trackstrig->GetEntriesFast();i++)
+ { //trigger loop starts
+ LRCParticlePID *trig=(LRCParticlePID*)(trackstrig->UncheckedAt(i));
+ if(!trig) continue;
+ Float_t trigpt=trig->Pt();
+ //to avoid overflow qnd underflow
+ if(trigpt<fminPtTrig || trigpt>fmaxPtTrig) continue;
+ Int_t particlepidtrig=trig->getparticle();
+ if(fTriggerSpeciesSelection){ if (particlepidtrig!=fTriggerSpecies) continue;}
+
+ Float_t trigeta=trig->Eta();
+
+ // some optimization
+ if (fTriggerRestrictEta > 0 && TMath::Abs(trigeta) > fTriggerRestrictEta)
+ continue;
+
+if (fOnlyOneEtaSide != 0)
+ {
+ if (fOnlyOneEtaSide * trigeta < 0)
+ continue;
+ }
+ if (fTriggerSelectCharge != 0)
+ if (trig->Charge() * fTriggerSelectCharge < 0)
+ continue;
+
+ if (fRejectResonanceDaughters > 0)
+ if (trig->TestBit(kResonanceDaughterFlag)) continue;
+
+ Float_t trigphi=trig->Phi();
+ Float_t trackefftrig=1.0;
+ if(fapplyTrigefficiency) trackefftrig=trig->geteffcorrectionval();
+ // cout<<"*******************trackefftrig="<<trackefftrig<<endl;
+ Double_t* trigval;
+ Int_t dim=3;
+ if(fcontainPIDtrig) dim=4;
+ trigval= new Double_t[dim];
+ trigval[0] = cent;
+ trigval[1] = vtx;
+ trigval[2] = trigpt;
+if(fcontainPIDtrig) trigval[3] = particlepidtrig;
+
+ //filling only for same event case(mixcase=kFALSE)
+
+ //trigger particle counting only when mixcase=kFALSE i.e for same event correlation function calculation
+if(mixcase==kFALSE)
+ {
+ if(ffilltrigassoUNID==kTRUE && ffilltrigUNIDassoID==kTRUE){
+ if(fillup=="trigassoUNID" ) fTHnTrigcount->Fill(trigval,1.0/trackefftrig);
+ }
+ if(ffilltrigassoUNID==kTRUE && ffilltrigUNIDassoID==kFALSE){
+ if(fillup=="trigassoUNID" ) fTHnTrigcount->Fill(trigval,1.0/trackefftrig);
+ }
+if(ffilltrigassoUNID==kFALSE && ffilltrigUNIDassoID==kTRUE){
+ if(fillup=="trigUNIDassoID") fTHnTrigcount->Fill(trigval,1.0/trackefftrig);
+ }
+ //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
+if(ffilltrigIDassoUNID==kTRUE && ffilltrigIDassoID==kTRUE){
+ if(fillup=="trigIDassoID") fTHnTrigcount->Fill(trigval,1.0/trackefftrig);
+ }
+ if(ffilltrigIDassoUNID==kTRUE && ffilltrigIDassoID==kFALSE){
+ if(fillup=="trigIDassoUNID" ) fTHnTrigcount->Fill(trigval,1.0/trackefftrig);
+ }
+if(ffilltrigIDassoUNID==kFALSE && ffilltrigIDassoID==kTRUE){
+ if(fillup=="trigIDassoID") fTHnTrigcount->Fill(trigval,1.0/trackefftrig);
+ }
+
+ if(fillup=="trigIDassoIDMCTRUTH") fTHnTrigcountMCTruthPrim->Fill(trigval,1.0/trackefftrig); //In truth MC case "Unidentified" means any particle other than pion,kaon or proton and no efficiency correction(default value 1.0)************************be careful!!!!
+ }
+
+ //asso loop starts within trigger loop
+ for(Int_t j=0;j<jmax;j++)
+ {
+ LRCParticlePID *asso=0;
+ if(!tracksasso)
+ asso=(LRCParticlePID*)(trackstrig->UncheckedAt(j));
+ else
+ asso=(LRCParticlePID*)(tracksasso->UncheckedAt(j));
+
+ if(!asso) continue;
+
+ //to avoid overflow qnd underflow
+ if(asso->Pt()<fminPtAsso || asso->Pt()>fmaxPtAsso) continue;//***********************Important
+
+ if(fmaxPtAsso==fminPtTrig) {if(asso->Pt()==fminPtTrig) continue;}//******************Think about it!
+
+ if(!tracksasso && i==j) continue;
+
+ // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
+ // if (tracksasso && trig->IsEqual(asso)) continue;
+
+ if (tracksasso && (trig->GetUniqueID()==asso->GetUniqueID())) continue;
+
+ if (fPtOrder)
+ if (asso->Pt() >= trig->Pt()) continue;
+
+ Int_t particlepidasso=asso->getparticle();
+ if(fAssociatedSpeciesSelection){ if (particlepidasso!=fAssociatedSpecies) continue;}
+
+
+if (fAssociatedSelectCharge != 0)
+if (asso->Charge() * fAssociatedSelectCharge < 0) continue;
+
+ if (fSelectCharge > 0)
+ {
+ // skip like sign
+ if (fSelectCharge == 1 && asso->Charge() * trig->Charge() > 0)
+ continue;
+
+ // skip unlike sign
+ if (fSelectCharge == 2 && asso->Charge() * trig->Charge() < 0)
+ continue;
+ }
+
+if (fEtaOrdering)
+ {
+ if (trigeta < 0 && asso->Eta() < trigeta)
+ continue;
+ if (trigeta > 0 && asso->Eta() > trigeta)
+ continue;
+ }
+
+if (fRejectResonanceDaughters > 0)
+ if (asso->TestBit(kResonanceDaughterFlag))
+ {
+// Printf("Skipped j=%d", j);
+ continue;
+ }
+
+ // conversions
+ if (fCutConversions && asso->Charge() * trig->Charge() < 0)
+ {
+ Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.510e-3, 0.510e-3);
+
+ if (mass < 0.1)
+ {
+ mass = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.510e-3, 0.510e-3);
+
+ //fControlConvResoncances->Fill(0.0, mass);
+
+ if (mass < 0.04*0.04)
+ continue;
+ }
+ }
+
+ // K0s
+ if (fCutResonances && asso->Charge() * trig->Charge() < 0)
+ {
+ Float_t mass = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.1396, 0.1396);
+
+ const Float_t kK0smass = 0.4976;
+
+ if (TMath::Abs(mass - kK0smass*kK0smass) < 0.1)
+ {
+ mass = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.1396, 0.1396);
+
+ //fControlConvResoncances->Fill(1, mass - kK0smass*kK0smass);
+
+ if (mass > (kK0smass-0.02)*(kK0smass-0.02) && mass < (kK0smass+0.02)*(kK0smass+0.02))
+ continue;
+ }
+ }
+
+ // Lambda
+ if (fCutResonances && asso->Charge() * trig->Charge() < 0)
+ {
+ Float_t mass1 = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(), eta[j], asso->Phi(), 0.1396, 0.9383);
+ Float_t mass2 = GetInvMassSquaredCheap(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j] , asso->Phi(), 0.9383, 0.1396);
+
+ const Float_t kLambdaMass = 1.115;
+
+ if (TMath::Abs(mass1 - kLambdaMass*kLambdaMass) < 0.1)
+ {
+ mass1 = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j], asso->Phi(), 0.1396, 0.9383);
+
+ //fControlConvResoncances->Fill(2, mass1 - kLambdaMass*kLambdaMass);
+
+ if (mass1 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass1 < (kLambdaMass+0.02)*(kLambdaMass+0.02))
+ continue;
+ }
+ if (TMath::Abs(mass2 - kLambdaMass*kLambdaMass) < 0.1)
+ {
+ mass2 = GetInvMassSquared(trig->Pt(), trigeta, trig->Phi(), asso->Pt(),eta[j] , asso->Phi(), 0.9383, 0.1396);
+
+ //fControlConvResoncances->Fill(2, mass2 - kLambdaMass*kLambdaMass);
+
+ if (mass2 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass2 < (kLambdaMass+0.02)*(kLambdaMass+0.02))
+ continue;
+ }
+ }
+
+ if (twoTrackEfficiencyCut)
+ {
+ // the variables & cuthave been developed by the HBT group
+ // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
+ Float_t phi1 = trig->Phi();
+ Float_t pt1 = trig->Pt();
+ Float_t charge1 = trig->Charge();
+ Float_t phi2 = asso->Phi();
+ Float_t pt2 = asso->Pt();
+ Float_t charge2 = asso->Charge();
+
+ Float_t deta= trigeta - eta[j];
+
+ // optimization
+ if (TMath::Abs(deta) < twoTrackEfficiencyCutValue * 2.5 * 3)
+ {
+
+ // check first boundaries to see if is worth to loop and find the minimum
+ Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);
+ Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
+
+ const Float_t kLimit = twoTrackEfficiencyCutValue * 3;
+
+ Float_t dphistarminabs = 1e5;
+ Float_t dphistarmin = 1e5;
+
+ if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)
+ {
+ for (Double_t rad=0.8; rad<2.51; rad+=0.01)
+ {
+ Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign);
+
+ Float_t dphistarabs = TMath::Abs(dphistar);
+
+ if (dphistarabs < dphistarminabs)
+ {
+ dphistarmin = dphistar;
+ dphistarminabs = dphistarabs;
+ }
+ }
+
+if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEfficiencyCutValue)
+ {
+// 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);
+ continue;
+ }
+//fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
+
+ }
+ }
+ }
+
+ Float_t trackeffasso=1.0;
+ if(fapplyAssoefficiency) trackeffasso=asso->geteffcorrectionval();
+ //cout<<"*******************trackeffasso="<<trackeffasso<<endl;
+ Float_t deleta=trigeta-eta[j];
+ Float_t delphi=PhiRange(trigphi-asso->Phi());
+
+ //here get the two particle efficiency correction factor
+ Float_t effweight=trackefftrig*trackeffasso;
+ //cout<<"*******************effweight="<<effweight<<endl;
+ Double_t* vars;
+ vars= new Double_t[kTrackVariablesPair];
+ vars[0]=cent;
+ vars[1]=vtx;
+ vars[2]=trigpt;
+ vars[3]=asso->Pt();
+ vars[4]=deleta;
+ vars[5]=delphi;
+if(fcontainPIDtrig && !fcontainPIDasso) vars[6]=particlepidtrig;
+if(!fcontainPIDtrig && fcontainPIDasso) vars[6]=particlepidasso;
+ if(fcontainPIDtrig && fcontainPIDasso){
+ vars[6]=particlepidtrig;
+ vars[7]=particlepidasso;
+ }
+
+ //Fill Correlation ThnSparses
+ if(fillup=="trigassoUNID")
+ {
+ if(mixcase==kFALSE) fTHnCorrUNID->Fill(vars,1.0/effweight);
+ if(mixcase==kTRUE) fTHnCorrUNIDmix->Fill(vars,1.0/effweight);
+ }
+ if(fillup=="trigIDassoID")
+ {
+ if(mixcase==kFALSE) fTHnCorrID->Fill(vars,1.0/effweight);
+ if(mixcase==kTRUE) fTHnCorrIDmix->Fill(vars,1.0/effweight);
+ }
+ if(fillup=="trigIDassoIDMCTRUTH")//******************************************for TRUTH MC particles
+ {//in this case effweight should be 1 always
+ if(mixcase==kFALSE) fCorrelatonTruthPrimary->Fill(vars,1.0/effweight);
+ if(mixcase==kTRUE) fCorrelatonTruthPrimarymix->Fill(vars,1.0/effweight);
+ }
+ if(fillup=="trigIDassoUNID" || fillup=="trigUNIDassoID")//****************************be careful
+ {
+ if(mixcase==kFALSE) fTHnCorrIDUNID->Fill(vars,1.0/effweight);
+ if(mixcase==kTRUE) fTHnCorrIDUNIDmix->Fill(vars,1.0/effweight);
+ }
+
+delete[] vars;
+ }//asso loop ends
+delete[] trigval;
+ }//trigger loop ends
+
+}
+
+//--------------------------------------------------------------------------------
+Float_t AliTwoParticlePIDCorr::GetTrackbyTrackeffvalue(AliAODTrack* track,Double_t cent,Float_t evzvtx, Int_t parpid)
+{
+ //This function is called only when applyefficiency=kTRUE; also ensure that "track" is present before calling that function
+ Int_t effVars[4];
+ Float_t effvalue=1.;
+
+ if(parpid==unidentified)
+ {
+ effVars[0] = effcorection[5]->GetAxis(0)->FindBin(cent);
+ effVars[1] = effcorection[5]->GetAxis(1)->FindBin(evzvtx);
+ effVars[2] = effcorection[5]->GetAxis(2)->FindBin(track->Pt());
+ effVars[3] = effcorection[5]->GetAxis(3)->FindBin(track->Eta());
+ effvalue=effcorection[5]->GetBinContent(effVars);
+ }
+if(parpid==SpPion || parpid==SpKaon)
+ {
+ if(fmesoneffrequired && !fkaonprotoneffrequired && track->Pt()>=fminPtComboeff && track->Pt()<=fmaxPtComboeff)
+ {
+ effVars[0] = effcorection[3]->GetAxis(0)->FindBin(cent);
+ effVars[1] = effcorection[3]->GetAxis(1)->FindBin(evzvtx);
+ effVars[2] = effcorection[3]->GetAxis(2)->FindBin(track->Pt());
+ effVars[3] = effcorection[3]->GetAxis(3)->FindBin(track->Eta());
+ effvalue=effcorection[3]->GetBinContent(effVars);
+ }
+ else{
+ if(parpid==SpPion)
+ {
+ effVars[0] = effcorection[0]->GetAxis(0)->FindBin(cent);
+ effVars[1] = effcorection[0]->GetAxis(1)->FindBin(evzvtx);
+ effVars[2] = effcorection[0]->GetAxis(2)->FindBin(track->Pt());
+ effVars[3] = effcorection[0]->GetAxis(3)->FindBin(track->Eta());
+ effvalue=effcorection[0]->GetBinContent(effVars);
+ }
+
+ if(parpid==SpKaon)
+ {
+ effVars[0] = effcorection[1]->GetAxis(0)->FindBin(cent);
+ effVars[1] = effcorection[1]->GetAxis(1)->FindBin(evzvtx);
+ effVars[2] = effcorection[1]->GetAxis(2)->FindBin(track->Pt());
+ effVars[3] = effcorection[1]->GetAxis(3)->FindBin(track->Eta());
+ effvalue=effcorection[1]->GetBinContent(effVars);
+ }
+ }
+ }
+
+ if(parpid==SpProton)
+ {
+ effVars[0] = effcorection[2]->GetAxis(0)->FindBin(cent);
+ effVars[1] = effcorection[2]->GetAxis(1)->FindBin(evzvtx);
+ effVars[2] = effcorection[2]->GetAxis(2)->FindBin(track->Pt());
+ effVars[3] = effcorection[2]->GetAxis(3)->FindBin(track->Eta());
+ effvalue=effcorection[2]->GetBinContent(effVars);
+ }
+
+ if(fkaonprotoneffrequired && !fmesoneffrequired && track->Pt()>=fminPtComboeff && track->Pt()<=fmaxPtComboeff)
+ {
+ if(parpid==SpProton || parpid==SpKaon)
+ {
+ effVars[0] = effcorection[4]->GetAxis(0)->FindBin(cent);
+ effVars[1] = effcorection[4]->GetAxis(1)->FindBin(evzvtx);
+ effVars[2] = effcorection[4]->GetAxis(2)->FindBin(track->Pt());
+ effVars[3] = effcorection[4]->GetAxis(3)->FindBin(track->Eta());
+ effvalue=effcorection[4]->GetBinContent(effVars);
+ }
+ }
+ // Printf("%d %d %d %d %f", effVars[0], effVars[1], effVars[2], effVars[3], fEfficiencyCorrectionAssociated->GetBinContent(effVars));
+ if(effvalue==0.) effvalue=1.;
+
+ return effvalue;
+
+}
+//-----------------------------------------------------------------------
+
+Int_t AliTwoParticlePIDCorr::ClassifyTrack(AliAODTrack* track,AliAODVertex* vertex,Float_t magfield)
+{
+
+ if(!track) return 0;
+ Bool_t trackOK = track->TestFilterBit(fFilterBit);
+ if(!trackOK) return 0;
+ //select only primary traks(for data & reco MC tracks)
+ if(fonlyprimarydatareco && track->GetType()!=AliAODTrack::kPrimary) return 0;
+ if(track->Charge()==0) return 0;
+ fHistQA[12]->Fill(track->GetTPCNcls());
+ Float_t dxy, dz;
+ dxy = track->DCA();
+ dz = track->ZAtDCA();
+ fHistQA[6]->Fill(dxy);
+ fHistQA[7]->Fill(dz);
+ Float_t chi2ndf = track->Chi2perNDF();
+ fHistQA[13]->Fill(chi2ndf);
+ Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
+ fHistQA[14]->Fill(nCrossedRowsTPC);
+ //Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
+ if (track->GetTPCNclsF()>0) {
+ Float_t ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
+ fHistQA[15]->Fill(ratioCrossedRowsOverFindableClustersTPC);
+ }
+//accepted tracks
+ Float_t pt=track->Pt();
+ if(pt< fminPt || pt> fmaxPt) return 0;
+ if(TMath::Abs(track->Eta())> fmaxeta) return 0;
+ if(track->Phi()<0. || track->Phi()>2*TMath::Pi()) return 0;
+ //if (!HasTPCPID(track)) return 0;//trigger & associated particles must have TPC PID,Is it required
+// DCA XY
+ if (fdcacut && fDCAXYCut)
+ {
+ if (!vertex)
+ return 0;
+
+ Double_t pos[2];
+ Double_t covar[3];
+ AliAODTrack* clone =(AliAODTrack*) track->Clone();
+ Bool_t success = clone->PropagateToDCA(vertex, magfield, fdcacutvalue, pos, covar);
+ delete clone;
+ if (!success)
+ return 0;
+
+// Printf("%f", ((AliAODTrack*)part)->DCA());
+// Printf("%f", pos[0]);
+ if (TMath::Abs(pos[0]) > fDCAXYCut->Eval(track->Pt()))
+ return 0;
+ }
+
+ fHistQA[8]->Fill(pt);
+ fHistQA[9]->Fill(track->Eta());
+ fHistQA[10]->Fill(track->Phi());
+ return 1;
+ }
+ //________________________________________________________________________________
+void AliTwoParticlePIDCorr::CalculateNSigmas(AliAODTrack *track)
+{
+//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 )
+Float_t pt=track->Pt();
+
+//it is assumed that every track that passed the filterbit have proper TPC response(!!)
+Float_t nsigmaTPCkPion =fPID->NumberOfSigmasTPC(track, AliPID::kPion);
+Float_t nsigmaTPCkKaon =fPID->NumberOfSigmasTPC(track, AliPID::kKaon);
+Float_t nsigmaTPCkProton =fPID->NumberOfSigmasTPC(track, AliPID::kProton);
+
+Float_t nsigmaTOFkProton=999.,nsigmaTOFkKaon=999.,nsigmaTOFkPion=999.;
+Float_t nsigmaTPCTOFkProton=999.,nsigmaTPCTOFkKaon=999.,nsigmaTPCTOFkPion=999.;
+
+ if(HasTOFPID(track) && pt>fPtTOFPIDmin)
+ {
+
+nsigmaTOFkPion =fPID->NumberOfSigmasTOF(track, AliPID::kPion);
+nsigmaTOFkKaon =fPID->NumberOfSigmasTOF(track, AliPID::kKaon);
+nsigmaTOFkProton =fPID->NumberOfSigmasTOF(track, AliPID::kProton);
+//---combined
+nsigmaTPCTOFkPion = TMath::Sqrt(nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion);
+nsigmaTPCTOFkKaon = TMath::Sqrt(nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon);
+nsigmaTPCTOFkProton = TMath::Sqrt(nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton);
+
+
+ }
+else{
+ // --- combined
+ // if TOF is missing and below fPtTOFPID only the TPC information is used
+ nsigmaTPCTOFkProton = TMath::Abs(nsigmaTPCkProton);
+ nsigmaTPCTOFkKaon = TMath::Abs(nsigmaTPCkKaon);
+ nsigmaTPCTOFkPion = TMath::Abs(nsigmaTPCkPion);
+
+ }
+
+//set data member fnsigmas
+ fnsigmas[SpPion][NSigmaTPC]=nsigmaTPCkPion;
+ fnsigmas[SpKaon][NSigmaTPC]=nsigmaTPCkKaon;
+ fnsigmas[SpProton][NSigmaTPC]=nsigmaTPCkProton;
+
+ //for all tracks below fPtTOFPIDmin and also for tracks above fPtTOFPIDmin without proper TOF response these TOF nsigma values will be 999.
+ fnsigmas[SpPion][NSigmaTOF]=nsigmaTOFkPion;
+ fnsigmas[SpKaon][NSigmaTOF]=nsigmaTOFkKaon;
+ fnsigmas[SpProton][NSigmaTOF]=nsigmaTOFkProton;
+
+ //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)
+ fnsigmas[SpPion][NSigmaTPCTOF]=nsigmaTPCTOFkPion;
+ fnsigmas[SpKaon][NSigmaTPCTOF]=nsigmaTPCTOFkKaon;
+ fnsigmas[SpProton][NSigmaTPCTOF]=nsigmaTPCTOFkProton;
+
+
+}
+//----------------------------------------------------------------------------
+Int_t AliTwoParticlePIDCorr::FindMinNSigma(AliAODTrack *track)
+{
+ //this function is always called after calling the function CalculateNSigmas(AliAODTrack *track)
+if(fRequestTOFPID && track->Pt()>fPtTOFPIDmin && track->Pt()<=fPtTOFPIDmax && (!HasTOFPID(track)) )return SpUndefined;//so any track having Pt>0.6 && Pt<=4.0 Gev withot having proper TOF response will be defined as SpUndefined
+//get the identity of the particle with the minimum Nsigma
+ Float_t nsigmaPion=999., nsigmaKaon=999., nsigmaProton=999.;
+ switch (fPIDType){
+ case NSigmaTPC:
+ nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPC]);
+ nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPC]) ;
+ nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPC]) ;
+ break;
+ case NSigmaTOF:
+ nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTOF]);
+ nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTOF]) ;
+ nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTOF]) ;
+ break;
+ case NSigmaTPCTOF://In case of no TOF matching the combined nsigma is the TPC one
+ nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);
+ nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;
+ nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;
+ break;
+ }
+
+ if(track->Pt()<=fPtTOFPIDmax) {
+ // guess the particle based on the smaller nsigma (within fNSigmaPID)
+ if( ( nsigmaKaon==nsigmaPion ) && ( nsigmaKaon==nsigmaProton )) return SpUndefined;//it is the default value for the three
+if( ( nsigmaKaon < nsigmaPion ) && ( nsigmaKaon < nsigmaProton ) && (nsigmaKaon < fNSigmaPID)) return SpKaon;
+if( ( nsigmaPion < nsigmaKaon ) && ( nsigmaPion < nsigmaProton ) && (nsigmaPion < fNSigmaPID)) return SpPion;
+if( ( nsigmaProton < nsigmaKaon ) && ( nsigmaProton < nsigmaPion ) && (nsigmaProton < fNSigmaPID)) return SpProton;
+
+// else, return undefined
+ return SpUndefined;
+ }
+ else {//asymmetric nsigma cut around pion's mean position for tracks having Pt>4.0 Gev
+ if(fminprotonsigmacut<fnsigmas[SpPion][NSigmaTPC] && fnsigmas[SpPion][NSigmaTPC]<fmaxprotonsigmacut) return SpProton;
+ if(fminpionsigmacut<fnsigmas[SpPion][NSigmaTPC] && fnsigmas[SpPion][NSigmaTPC]<fmaxpionsigmacut) return SpPion;
+// else, return undefined(here we don't detect kaons)
+ return SpUndefined;
+ }
+
+}
+
+//------------------------------------------------------------------------------------------
+Bool_t* AliTwoParticlePIDCorr::GetDoubleCounting(AliAODTrack * trk){
+ //this function is always called after calling the function CalculateNSigmas(AliAODTrack *track)
+
+ //if a particle has double counting set fHasDoubleCounting[ipart]=kTRUE
+ //fill DC histos
+ for(Int_t ipart=0;ipart<NSpecies;ipart++)fHasDoubleCounting[ipart]=kFALSE;//array with kTRUE for second (or third) identity of the track
+
+ Int_t MinNSigma=FindMinNSigma(trk);//not filling the NSigmaRec histos
+
+
+ if(MinNSigma==SpUndefined)return fHasDoubleCounting;//in case of undefined no Double counting
+
+ Float_t nsigmaPion=999., nsigmaKaon=999., nsigmaProton=999.;
+ switch (fPIDType) {
+ case NSigmaTPC:
+ nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPC]);
+ nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPC]) ;
+ nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPC]) ;
+ break;
+ case NSigmaTOF:
+ nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTOF]);
+ nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTOF]) ;
+ nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTOF]) ;
+ break;
+ case NSigmaTPCTOF://In case of no TOF matching the combined nsigma is the TPC one
+ nsigmaProton = TMath::Abs(fnsigmas[SpProton][NSigmaTPCTOF]);
+ nsigmaKaon = TMath::Abs(fnsigmas[SpKaon][NSigmaTPCTOF]) ;
+ nsigmaPion = TMath::Abs(fnsigmas[SpPion][NSigmaTPCTOF]) ;
+ break;
+ }
+
+ //there is chance of overlapping only for particles having pt below 4.0 GEv
+ if(trk->Pt()<=4.0){
+ if(nsigmaPion<fNSigmaPID && MinNSigma!=SpPion)fHasDoubleCounting[SpPion]=kTRUE;
+ if(nsigmaKaon<fNSigmaPID && MinNSigma!=SpKaon)fHasDoubleCounting[SpKaon]=kTRUE;
+ if(nsigmaProton<fNSigmaPID && MinNSigma!=SpProton)fHasDoubleCounting[SpProton]=kTRUE;
+
+ }
+
+
+ return fHasDoubleCounting;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+Int_t AliTwoParticlePIDCorr::GetParticle(AliAODTrack * trk){
+ //return the specie according to the minimum nsigma value
+ //no double counting, this has to be evaluated using CheckDoubleCounting()
+ //Printf("fPtTOFPID %.1f, fRequestTOFPID %d, fNSigmaPID %.1f, fPIDType %d",fPtTOFPID,fRequestTOFPID,fNSigmaPID,fPIDType);
+
+ CalculateNSigmas(trk);//fill the data member fnsigmas with the nsigmas value [ipart][iPID]
+
+ if(fUseExclusiveNSigma){
+ Bool_t *HasDC;
+ HasDC=GetDoubleCounting(trk);
+ for(Int_t ipart=0;ipart<NSpecies;ipart++){
+ if(HasDC[ipart]==kTRUE) return SpUndefined;
+ }
+ return FindMinNSigma(trk);//NSigmaRec distr filled here
+ }
+ else return FindMinNSigma(trk);//NSigmaRec distr filled here
+
+}
+
+//-------------------------------------------------------------------------------------
+Bool_t
+AliTwoParticlePIDCorr::HasTPCPID(AliAODTrack *track) const
+{
+ // check PID signal
+ AliPIDResponse::EDetPidStatus statustpc = fPID->CheckPIDStatus(AliPIDResponse::kTPC,track);
+ if(statustpc!=AliPIDResponse::kDetPidOk) return kFALSE;
+ //ULong_t status=track->GetStatus();
+ //if (!( (status & AliAODTrack::kTPCpid ) == AliAODTrack::kTPCpid )) return kFALSE;//remove light nuclei
+ //if (track->GetTPCsignal() <= 0.) return kFALSE;
+ // 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.
+
+ return kTRUE;
+}
+//___________________________________________________________
+
+Bool_t
+AliTwoParticlePIDCorr::HasTOFPID(AliAODTrack *track) const
+{
+ // check TOF matched track
+ //ULong_t status=track->GetStatus();
+ //if (!( (status & AliAODTrack::kITSin ) == AliAODTrack::kITSin )) return kFALSE;
+ AliPIDResponse::EDetPidStatus statustof = fPID->CheckPIDStatus(AliPIDResponse::kTOF,track);
+ if(statustof!= AliPIDResponse::kDetPidOk) return kFALSE;
+ if(track->Pt()<=fPtTOFPIDmin) return kFALSE;
+ //if(!((status & AliAODTrack::kTOFpid ) == AliAODTrack::kTOFpid )) return kFALSE;
+ //Float_t probMis = fPIDresponse->GetTOFMismatchProbability(track);
+ // if (probMis > 0.01) return kFALSE;
+if(fRemoveTracksT0Fill)
+ {
+Int_t startTimeMask = fPID->GetTOFResponse().GetStartTimeMask(track->P());
+ if (startTimeMask < 0)return kFALSE;
+ }
+ return kTRUE;
+}
+
+//________________________________________________________________________
+Float_t AliTwoParticlePIDCorr :: GetBeta(AliAODTrack *track)
+{
+ //it is called only when TOF PID is available
+ Double_t p = track->P();
+ Double_t time=track->GetTOFsignal()-fPID->GetTOFResponse().GetStartTime(p);
+ Double_t timei[5];
+ track->GetIntegratedTimes(timei);
+ return timei[0]/time;
+}
+//------------------------------------------------------------------------------------------------------
+
+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)
+{
+ // calculate inv mass squared
+ // same can be achieved, but with more computing time with
+ /*TLorentzVector photon, p1, p2;
+ p1.SetPtEtaPhiM(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), 0.510e-3);
+ p2.SetPtEtaPhiM(particle->Pt(), eta[j], particle->Phi(), 0.510e-3);
+ photon = p1+p2;
+ photon.M()*/
+
+ Float_t tantheta1 = 1e10;
+
+ if (eta1 < -1e-10 || eta1 > 1e-10)
+ tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1));
+
+ Float_t tantheta2 = 1e10;
+ if (eta2 < -1e-10 || eta2 > 1e-10)
+ tantheta2 = 2 * TMath::Exp(-eta2) / ( 1 - TMath::Exp(-2*eta2));
+
+ Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
+ Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
+
+ 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 ) ) );
+
+ return mass2;
+}
+//---------------------------------------------------------------------------------
+
+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)
+{
+ // calculate inv mass squared approximately
+
+ Float_t tantheta1 = 1e10;
+
+ if (eta1 < -1e-10 || eta1 > 1e-10)
+ {
+ Float_t expTmp = 1.0-eta1+eta1*eta1/2-eta1*eta1*eta1/6+eta1*eta1*eta1*eta1/24;
+ tantheta1 = 2.0 * expTmp / ( 1.0 - expTmp*expTmp);
+ }
+
+ Float_t tantheta2 = 1e10;
+ if (eta2 < -1e-10 || eta2 > 1e-10)
+ {
+ Float_t expTmp = 1.0-eta2+eta2*eta2/2-eta2*eta2*eta2/6+eta2*eta2*eta2*eta2/24;
+ tantheta2 = 2.0 * expTmp / ( 1.0 - expTmp*expTmp);
+ }
+
+ Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
+ Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
+
+ // fold onto 0...pi
+ Float_t deltaPhi = TMath::Abs(phi1 - phi2);
+ while (deltaPhi > TMath::TwoPi())
+ deltaPhi -= TMath::TwoPi();
+ if (deltaPhi > TMath::Pi())
+ deltaPhi = TMath::TwoPi() - deltaPhi;
+
+ Float_t cosDeltaPhi = 0;
+ if (deltaPhi < TMath::Pi()/3)
+ cosDeltaPhi = 1.0 - deltaPhi*deltaPhi/2 + deltaPhi*deltaPhi*deltaPhi*deltaPhi/24;
+ else if (deltaPhi < 2*TMath::Pi()/3)
+ cosDeltaPhi = -(deltaPhi - TMath::Pi()/2) + 1.0/6 * TMath::Power((deltaPhi - TMath::Pi()/2), 3);
+ else
+ cosDeltaPhi = -1.0 + 1.0/2.0*(deltaPhi - TMath::Pi())*(deltaPhi - TMath::Pi()) - 1.0/24.0 * TMath::Power(deltaPhi - TMath::Pi(), 4);
+
+ Float_t mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( cosDeltaPhi + 1.0 / tantheta1 / tantheta2 ) ) );
+
+// Printf(Form("%f %f %f %f %f %f %f %f %f", pt1, eta1, phi1, pt2, eta2, phi2, m0_1, m0_2, mass2));
+
+ return mass2;
+}
+//--------------------------------------------------------------------------------
+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)
+{
+ //
+ // calculates dphistar
+ //
+
+ Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
+
+ static const Double_t kPi = TMath::Pi();
+
+ // circularity
+// if (dphistar > 2 * kPi)
+// dphistar -= 2 * kPi;
+// if (dphistar < -2 * kPi)
+// dphistar += 2 * kPi;
+
+ if (dphistar > kPi)
+ dphistar = kPi * 2 - dphistar;
+ if (dphistar < -kPi)
+ dphistar = -kPi * 2 - dphistar;
+ if (dphistar > kPi) // might look funny but is needed
+ dphistar = kPi * 2 - dphistar;
+
+ return dphistar;
+}
+//_________________________________________________________________________
+void AliTwoParticlePIDCorr ::DefineEventPool()
+{
+const Int_t MaxNofEvents=1000;
+const Int_t MaxNofTracks=50000;
+const Int_t NofVrtxBins=10+(1+10)*2;
+Double_t ZvrtxBins[NofVrtxBins+1]={ -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10,
+ 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110,
+ 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210
+ };
+ if (fSampleType=="pp"){
+const Int_t NofCentBins=5;
+Double_t CentralityBins[NofCentBins+1]={0.,10., 20., 40.,80.,200.1};
+fPoolMgr = new AliEventPoolManager(MaxNofEvents,MaxNofTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);
+ }
+if (fSampleType=="pPb" || fSampleType=="PbPb")
+ {
+const Int_t NofCentBins=15;
+Double_t CentralityBins[NofCentBins+1]={0., 1., 2., 3., 4., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.1 };
+fPoolMgr = new AliEventPoolManager(MaxNofEvents,MaxNofTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins);
+ }
+fPoolMgr->SetTargetValues(MaxNofTracks, 0.1, 5);
+
+//if(!fPoolMgr) return kFALSE;
+//return kTRUE;
+
+}
+//------------------------------------------------------------------------
+Double_t* AliTwoParticlePIDCorr::GetBinning(const char* configuration, const char* tag, Int_t& nBins)
+{
+ // This method is a copy from AliUEHist::GetBinning
+ // takes the binning from <configuration> identified by <tag>
+ // configuration syntax example:
+ // 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
+ // phi: .....
+ //
+ // returns bin edges which have to be deleted by the caller
+
+ TString config(configuration);
+ TObjArray* lines = config.Tokenize("\n");
+ for (Int_t i=0; i<lines->GetEntriesFast(); i++)
+ {
+ TString line(lines->At(i)->GetName());
+ if (line.BeginsWith(TString(tag) + ":"))
+ {
+ line.Remove(0, strlen(tag) + 1);
+ line.ReplaceAll(" ", "");
+ TObjArray* binning = line.Tokenize(",");
+ Double_t* bins = new Double_t[binning->GetEntriesFast()];
+ for (Int_t j=0; j<binning->GetEntriesFast(); j++)
+ bins[j] = TString(binning->At(j)->GetName()).Atof();
+
+ nBins = binning->GetEntriesFast() - 1;
+
+ delete binning;
+ delete lines;
+ return bins;
+ }
+ }
+
+ delete lines;
+ AliFatal(Form("Tag %s not found in %s", tag, configuration));
+ return 0;
+}
+//_______________________________________________________________________________
+void AliTwoParticlePIDCorr::SetAsymmetricBin(THnSparse *h,Int_t dim,Double_t *arraybin,Int_t arraybinsize,TString axisTitle)
+{
+ TAxis *axis = 0x0;
+ axis = h->GetAxis(dim);
+ axis->Set(arraybinsize,arraybin);
+ axis->SetTitle(axisTitle);
+}
+
+//________________________________________________________________________
+void AliTwoParticlePIDCorr::Terminate(Option_t *)
+{
+ // Draw result to screen, or perform fitting, normalizations
+ // Called once at the end of the query
+ fOutput = dynamic_cast<TList*> (GetOutputData(1));
+ if(!fOutput) { Printf("ERROR: could not retrieve TList fOutput"); return; }
+
+
+}
+//------------------------------------------------------------------
+
-using namespace AliHelperPIDNameSpace;\r
- \r
-AliAnalysisTaskContMC* AddTaskContMC(Bool_t mc=kFALSE){\r
- \r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) \r
- {\r
- ::Error("AddAliAnalysisTaskContMC", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
- \r
- // Check the analysis type using the event handlers connected to the analysis manager.\r
- //==============================================================================\r
- if (!mgr->GetInputEventHandler()) \r
- {\r
- ::Error("AddTaskITSsaTracks", "This task requires an input event handler");\r
- return NULL;\r
- } \r
- \r
- TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
- if(type.Contains("ESD"))\r
- {\r
- ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");\r
- return NULL;\r
- }\r
- \r
- \r
- AliAnalysisTaskContMC *task = new AliAnalysisTaskContMC("ContMC");\r
- task->SetIsMC(mc);\r
- mgr->AddTask(task);\r
- \r
- TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
- cout<<"-------------- outputFileName: "<<outputFileName<<endl;\r
- \r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); \r
- AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("fOutput", TList::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- \r
- //connect containers\r
- mgr->ConnectInput(task, 0, cinput);\r
- mgr->ConnectOutput(task, 1, coutputpt2);\r
- return task;\r
-}\r
+using namespace AliHelperPIDNameSpace;
+
+AliAnalysisTaskContMC* AddTaskContMC(Bool_t mc=kFALSE){
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr)
+ {
+ ::Error("AddAliAnalysisTaskContMC", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis manager.
+ //==============================================================================
+ if (!mgr->GetInputEventHandler())
+ {
+ ::Error("AddTaskITSsaTracks", "This task requires an input event handler");
+ return NULL;
+ }
+
+ TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+ if(type.Contains("ESD"))
+ {
+ ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");
+ return NULL;
+ }
+
+
+ AliAnalysisTaskContMC *task = new AliAnalysisTaskContMC("ContMC");
+ task->SetIsMC(mc);
+ mgr->AddTask(task);
+
+ TString outputFileName = AliAnalysisManager::GetCommonFileName();
+ cout<<"-------------- outputFileName: "<<outputFileName<<endl;
+
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+ AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("fOutput", TList::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+
+ //connect containers
+ mgr->ConnectInput(task, 0, cinput);
+ mgr->ConnectOutput(task, 1, coutputpt2);
+ return task;
+}
-// $Id$\r
-\r
-void AddTaskPicoTracksDhc(\r
- TString chNOutTracks = "PicoTracks",\r
- TString period = "LHC11h"\r
-)\r
-{\r
- // Get the analysis manager\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTaskPicoTracksDhc", "No analysis manager found.");\r
- return;\r
- }\r
- gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C");\r
- \r
- // ESD or AOD? Create track cuts with pico track maker\r
- AliEmcalPicoTrackMaker *pTrackTask = 0x0;\r
- TString chIsESD("ESD");\r
- \r
- if (chIsESD.EqualTo(mgr->GetInputEventHandler()->GetDataType())) {\r
- TString cuts("Hybrid_");\r
- cuts += period;\r
- Info("AddTaskPicoTracksDhc","adding ESD track selection task ...");\r
- // ESD Track Cuts\r
- gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalEsdTpcTrack.C");\r
- AliEmcalEsdTpcTrackTask *hybTask = AddTaskEmcalEsdTpcTrack("HybridTracks", cuts.Data());\r
- hybTask->SelectCollisionCandidates(AliVEvent::kAny);\r
- // Pico Tracks\r
- pTrackTask = AddTaskEmcalPicoTrackMaker(chNOutTracks.Data(), "HybridTracks", period);\r
- pTrackTask->SelectCollisionCandidates(AliVEvent::kAny);\r
- } else {\r
- Info("AddTaskPicoTracksDhc","AOD analysis, adding PicoTrack maker ...");\r
- pTrackTask = AddTaskEmcalPicoTrackMaker(chNOutTracks.Data(),"tracks", period);\r
- pTrackTask->SelectCollisionCandidates(AliVEvent::kAny);\r
- }\r
-}\r
+// $Id$
+
+void AddTaskPicoTracksDhc(
+ TString chNOutTracks = "PicoTracks",
+ TString period = "LHC11h"
+)
+{
+ // Get the analysis manager
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTaskPicoTracksDhc", "No analysis manager found.");
+ return;
+ }
+ gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C");
+
+ // ESD or AOD? Create track cuts with pico track maker
+ AliEmcalPicoTrackMaker *pTrackTask = 0x0;
+ TString chIsESD("ESD");
+
+ if (chIsESD.EqualTo(mgr->GetInputEventHandler()->GetDataType())) {
+ TString cuts("Hybrid_");
+ cuts += period;
+ Info("AddTaskPicoTracksDhc","adding ESD track selection task ...");
+ // ESD Track Cuts
+ gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalEsdTpcTrack.C");
+ AliEmcalEsdTpcTrackTask *hybTask = AddTaskEmcalEsdTpcTrack("HybridTracks", cuts.Data());
+ hybTask->SelectCollisionCandidates(AliVEvent::kAny);
+ // Pico Tracks
+ pTrackTask = AddTaskEmcalPicoTrackMaker(chNOutTracks.Data(), "HybridTracks", period);
+ pTrackTask->SelectCollisionCandidates(AliVEvent::kAny);
+ } else {
+ Info("AddTaskPicoTracksDhc","AOD analysis, adding PicoTrack maker ...");
+ pTrackTask = AddTaskEmcalPicoTrackMaker(chNOutTracks.Data(),"tracks", period);
+ pTrackTask->SelectCollisionCandidates(AliVEvent::kAny);
+ }
+}
-/* $Id: $ */\r
-//--------------------------------------------------\r
-//\r
-// macro to do the final analysis step \r
-// uses input of analysis class AliAnalysisTaskPhiCorrelation\r
-//\r
-// Author : Emilia Leogrande (University of Utrecht)\r
-//\r
-//-------------------------------------------------\r
-\r
-#include <TChain.h>\r
-#include <TList.h>\r
-#include <TTree.h>\r
-#include <TH1F.h>\r
-#include <TH2F.h>\r
-#include <TH3F.h>\r
-#include <THnSparse.h>\r
-#include <TProfile.h>\r
-#include <TCanvas.h>\r
-#include "TRandom.h"\r
-#include "TGraphErrors.h"\r
-#include "TFile.h"\r
-#include "TF1.h"\r
-#include "TMath.h"\r
-#include "TDirectory.h"\r
-#include "TStyle.h" \r
-#include "TROOT.h"\r
-#include "TColor.h"\r
-\r
-#include <iostream>\r
-using namespace std;\r
-\r
-void analyseEmy2(Bool_t zyam = kTRUE); // if zyam = kFALSE, fit is used\r
-Double_t fitFunction(Double_t *x ,Double_t *par); // fit function using constant + 3 gaussians\r
-Double_t fitFunction2Gaus(Double_t *x ,Double_t *par); // fit function using constant + 2 gaussians\r
-\r
-//input file and mixed event removed file\r
-TFile *fileData=0x0;\r
-TFile *fileDataEMremoved = 0x0;\r
-\r
-const int multclass = 20;\r
-\r
-TH1D *fDeltaPhiNch[multclass];\r
-TH1D *fDeltaEtaNch[multclass];\r
-TH1D *fSignalDPhi[multclass];\r
-TH1D *fSignalNSDPhi[multclass];\r
-TH1D *fSignalASDPhi[multclass];\r
-TH1D *fRidge1DPhi[multclass];\r
-TH1D *fRidge2DPhi[multclass];\r
-TH1D *fRidgeDPhi[multclass];\r
-TH1D *fSymmRidgeNotScaled[multclass];\r
-TH1D *fSymmRidge[multclass];\r
-TH1D *fFinal1DPhi[multclass];\r
-TH1D *fFinalDPhi[multclass];\r
-\r
-TString flag = "R";\r
-TF1 *fTotal2Gaus[multclass]; // fit with 2 gaussians + const\r
-TF1 *fTotal[multclass]; // fit with 3 gaussians + const\r
-\r
-//properties of histogram\r
-const int bins = 72; //\r
-Double_t binWidth=2*TMath::Pi()/bins;\r
-\r
-const int binsDeta = 48;\r
-\r
-\r
-Double_t max_bin_for_etagap = 1.2;\r
-Double_t min_bin_for_etagap = -1.2;\r
-Double_t max_eta = 1.8;\r
-Double_t min_eta = -1.8;\r
-\r
-//________________________________________________________________________________________________________________\r
-//\r
-Double_t fitFunction(Double_t *x ,Double_t *par)\r
-{\r
- // fit function for 3 gaus + constant \r
- \r
- // parameters for Gaussian\r
- Double_t A1 = par[0];\r
- Double_t sigma1 = par[1];\r
- Double_t A2 = par[2];\r
- Double_t sigma2 = par[3];\r
- Double_t A3 = par[4];\r
- Double_t sigma3 = par[5];\r
- Double_t integral = par[6];\r
-\r
- Double_t constante = (integral-\r
- TMath::Sqrt(TMath::Pi()*2)/ binWidth*\r
- (A1 * sigma1 + A2 * sigma2 + A3*sigma3))/bins;\r
- Double_t q = x[0];\r
- \r
- //fit value\r
- Double_t fitval = constante +\r
- (q>-0.5*TMath::Pi()&&q<0.5*TMath::Pi())*(\r
- A1 * exp(- q * q / (2 * sigma1 *sigma1)) +\r
- A1 * exp(-((q - TMath::TwoPi())) * ((q - TMath::TwoPi())) / ( 2 * sigma1 * sigma1))\r
- )\r
- +\r
- (q>-0.2*TMath::Pi()&&q<0.2*TMath::Pi())*(\r
- A2 * exp(- q * q / (2 * sigma2 *sigma2)) +\r
- A2 * exp(-((q - TMath::TwoPi())) * ((q - TMath::TwoPi())) / ( 2 * sigma2 * sigma2))\r
- )\r
- +\r
- (q>0.5*TMath::Pi()&&q<1.5*TMath::Pi())*(\r
- A3 * exp(-((q - TMath::Pi())) * ((q - TMath::Pi())) / ( 2 * sigma3 * sigma3)) +\r
- A3 * exp(-((q + TMath::Pi())) * ((q + TMath::Pi())) / (2 * sigma3 * sigma3))\r
- );\r
- return fitval;\r
-}\r
-\r
-//________________________________________________________________________________________________________________\r
-//\r
-Double_t fitFunction2Gaus(Double_t *x ,Double_t *par)\r
-{\r
- // fit function for 2 gaus + constant \r
-\r
- // parameters for Gaussian\r
- Double_t A1 = par[0];\r
- Double_t sigma1 = par[1];\r
- Double_t A3 = par[2];\r
- Double_t sigma3 = par[3];\r
- Double_t integral = par[4];\r
-\r
- Double_t constante = (integral -\r
- TMath::Sqrt(TMath::Pi()*2)/ binWidth*\r
- (A1 * sigma1 + A3*sigma3))/bins;\r
- Double_t q = x[0];\r
- \r
- //fit value\r
- Double_t fitval = constante +\r
- (q>-0.5*TMath::Pi()&&q<0.5*TMath::Pi())*(\r
- A1 * exp(- q * q / (2 * sigma1 *sigma1)) +\r
- A1 * exp(-((q - TMath::TwoPi())) * ((q - TMath::TwoPi())) / ( 2 * sigma1 * sigma1)) \r
- )\r
- +\r
- (q>0.5*TMath::Pi()&&q<1.5*TMath::Pi())*(\r
- A3 * exp(-((q - TMath::Pi())) * ((q - TMath::Pi())) / ( 2 * sigma3 * sigma3)) +\r
- A3 * exp(-((q + TMath::Pi())) * ((q + TMath::Pi())) / (2 * sigma3 * sigma3))\r
- );\r
- return fitval;\r
-}\r
-\r
-//_______________________________________________________________________________________________________________\r
-//\r
-Double_t fline(Double_t *x, Double_t *par){\r
- \r
- if(x[0]>-1.8 && x[0]<=0){\r
- return par[0]+par[1]*x[0];\r
- }\r
- else if(x[0]>0 && x[0]<1.8){\r
- return par[2]+par[3]*x[0];\r
- }\r
- else\r
- return 0;\r
-}\r
-\r
-\r
-//________________________________________________________________________________________________________________\r
-//\r
-void analyseEmy2(Bool_t zyam){\r
-\r
-\r
- // plot style\r
- gStyle->SetOptStat(0);\r
- const Int_t NRGBs = 5;\r
- const Int_t NCont = 500;\r
- Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };\r
- Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };\r
- Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };\r
- Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };\r
- TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);\r
- gStyle->SetNumberContours(NCont);\r
- \r
- //style\r
- gROOT->SetStyle("Plain");\r
- gStyle->SetOptStat(0);\r
- gStyle->SetPalette(1);\r
- \r
- //-------------- TRIGGERS AND EVENTS\r
- \r
- TH2D *dphideta[multclass];\r
- TH1D * trigger = 0x0;\r
- TH1D * event = 0x0;\r
- \r
- fileData = TFile::Open("dphi_corr.root");\r
- trigger = (TH1D*)fileData->Get("triggers_0");\r
- event = (TH1D*)fileData->Get("events");\r
- \r
- // get average trigger particles per event\r
- TProfile *p0 = (TProfile*)trigger->Clone();\r
- TProfile *p1 = (TProfile*)event->Clone();\r
- p0->Sumw2();\r
- p1->Sumw2();\r
- p0->Divide(p0,p1,1,1,"B");\r
- \r
- // copy triggers and events in the new dphi_corr with the Mixed Event removed\r
- TH1D *triggerCopy = 0x0;\r
- TH1D *eventCopy = 0x0;\r
- \r
- triggerCopy = (TH1D*)trigger->Clone();\r
- eventCopy = (TH1D*)event->Clone();\r
- \r
- fileDataEMremoved = TFile::Open("dphi_corr_MEremoved.root","RECREATE");\r
- triggerCopy->SetName("triggers_0");\r
- triggerCopy->Write();\r
- eventCopy->SetName("events");\r
- eventCopy->Write();\r
- fileDataEMremoved->Close();\r
- \r
- \r
- //-------------- MIXED EVENT REMOVAL: restores the right number of particles in the detector acceptance but keeps the detector azimuthal unefficiencies corrections and cures the dip in (0,0) from two-trak cuts\r
- // Removing the event mixing: S/M (from dphi_corr) * M (from the triangle)\r
- \r
- Double_t triangle_factor[binsDeta]={0};\r
-\r
- TH2D *s_over_m[multclass];\r
- TH1D *s_m_deta[multclass];\r
- TH2D *s_over_m_x_m[multclass];\r
- \r
- for(Int_t i=0;i<multclass;i++){\r
- s_over_m[i] = (TH2D*)fileData->Get(Form("dphi_0_0_%d",i));\r
- s_m_deta[i] = (TH1D*)s_over_m[i]->ProjectionY()->Clone();\r
- s_over_m_x_m[i] = (TH2D*)s_over_m[i]->Clone();\r
- s_over_m_x_m[i]->Reset();\r
- }\r
- \r
- \r
- TF1 *f2 = new TF1("f2",fline,min_eta,max_eta,4);\r
- \r
- f2->FixParameter(0,1);\r
- f2->FixParameter(1,1/max_eta);\r
- f2->FixParameter(2,1);\r
- f2->FixParameter(3,-1/max_eta);\r
- \r
- for(Int_t i=0;i<binsDeta;i++){\r
- \r
- triangle_factor[i] = f2->Eval(s_m_deta[0]->GetBinCenter(i+1));\r
-\r
- }\r
- \r
-\r
-\r
- //--scale each deta bin of the old TH2 with the triangle_factor[deta]\r
- \r
- for(Int_t i=0;i<multclass;i++){\r
- for(Int_t j=0;j<binsDeta;j++){\r
- for(Int_t k=0;k<bins;k++){\r
- s_over_m_x_m[i] -> SetBinContent(k+1,j+1,(s_over_m[i]->GetBinContent(k+1,j+1))*triangle_factor[j]);\r
- s_over_m_x_m[i]->SetBinError(k+1,j+1,(s_over_m[i]->GetBinError(k+1,j+1))*triangle_factor[j]);\r
- }\r
- }\r
- }\r
- \r
- fileDataEMremoved = TFile::Open("dphi_corr_MEremoved.root","UPDATE");\r
- \r
- for(Int_t i=0;i<multclass;i++){\r
- \r
- s_over_m_x_m[i]->SetName(Form("dphiNoMixed_%d",i));\r
- s_over_m_x_m[i]->Write();\r
- \r
- }\r
- \r
- \r
-\r
- //-------------- DOUBLE RIDGE SUBTRACTION: gets rid of no-jet related components (v3 is still kept => effect added to the systematics) \r
- \r
- // the ridge, estimated via an etagap, has to be scaled since it sits on the triangle \r
- Double_t scale_for_ridge_NS = 0, scale_for_ridge_AS = 0;\r
- \r
- \r
- scale_for_ridge_NS = f2->Integral(min_bin_for_etagap,max_bin_for_etagap)/(f2->Integral(min_eta,min_bin_for_etagap)+f2->Integral(max_bin_for_etagap,max_eta)); //there is etagap in the NS\r
- cout<<"scaling NS:"<<scale_for_ridge_NS<<endl;\r
- \r
- scale_for_ridge_AS = f2->Integral(min_eta,max_eta)/(f2->Integral(min_eta,min_bin_for_etagap)+f2->Integral(max_bin_for_etagap,max_eta)); // there is no etagap in the AS\r
- cout<<"scaling AS:"<<scale_for_ridge_AS<<endl;\r
- \r
- // Double ridge subtraction\r
- \r
- TCanvas *c = new TCanvas();\r
- c->Divide(5,4);\r
- \r
- for(Int_t i=0;i<multclass;i++){\r
- c->cd(i+1);\r
- \r
- \r
- dphideta[i] = (TH2D*)fileDataEMremoved->Get(Form("dphiNoMixed_%d",i));\r
-\r
- \r
- // phi and eta projections\r
- fDeltaPhiNch[i] = (TH1D*)dphideta[i]->ProjectionX()->Clone();\r
- if(!zyam)\r
- fDeltaPhiNch[i]->Scale(binWidth); //gaussians include the binwidth, so when using the fit, the histograms must be scaled first\r
- fDeltaPhiNch[i]->Draw();\r
- \r
- fDeltaEtaNch[i] = (TH1D*)dphideta[i]->ProjectionY()->Clone();\r
- \r
- // signal NS: |DEta|<max_bin_for_etagap; signal AS: |DEta|<max_eta\r
- fSignalNSDPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("|DEta|<%f",max_bin_for_etagap),fDeltaEtaNch[i]->FindBin(min_bin_for_etagap+0.0001),fDeltaEtaNch[i]->FindBin(max_bin_for_etagap-0.0001))->Clone();\r
- fSignalASDPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("|DEta|<%f",max_eta))->Clone();\r
- \r
- fSignalDPhi[i] = (TH1D*)fSignalASDPhi[i]->Clone();\r
- fSignalDPhi[i]->Reset();\r
- fSignalDPhi[i]->Sumw2();\r
- \r
- for(Int_t k=0;k<bins/2;k++){\r
- fSignalDPhi[i]->SetBinContent(k+1,fSignalNSDPhi[i]->GetBinContent(k+1));\r
- fSignalDPhi[i]->SetBinError(k+1, fSignalNSDPhi[i]->GetBinError(k+1));\r
- }\r
- for(Int_t k=bins/2;k<bins;k++){\r
- fSignalDPhi[i]->SetBinContent(k+1,fSignalASDPhi[i]->GetBinContent(k+1));\r
- fSignalDPhi[i]->SetBinError(k+1, fSignalASDPhi[i]->GetBinError(k+1));\r
- }\r
- if(!zyam)\r
- fSignalDPhi[i]->Scale(binWidth);\r
- \r
- // ridge1 DEta<min_bin_for_etagap\r
- fRidge1DPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("DEta<%f",min_bin_for_etagap),1,fDeltaEtaNch[i]->FindBin(min_bin_for_etagap-0.0001))->Clone();\r
- if(!zyam)\r
- fRidge1DPhi[i]->Scale(binWidth);\r
- fRidge1DPhi[i]->SetMarkerColor(kRed);\r
-\r
- // ridge2 DEta>max_bin_for_etagap\r
- fRidge2DPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("DEta>%f",max_bin_for_etagap),fDeltaEtaNch[i]->FindBin(max_bin_for_etagap+0.0001),fDeltaEtaNch[i]->GetNbinsX())->Clone();\r
- if(!zyam)\r
- fRidge2DPhi[i]->Scale(binWidth);\r
- fRidge2DPhi[i]->SetMarkerColor(kBlue);\r
-\r
- // ridge = ridge1 + ridge2\r
- fRidgeDPhi[i] = (TH1D*)fRidge1DPhi[i]->Clone("fRidge");\r
- fRidgeDPhi[i]->Reset();\r
- fRidgeDPhi[i]->Sumw2();\r
- fRidgeDPhi[i]->Add(fRidge1DPhi[i],fRidge2DPhi[i],1,1);\r
- //fRidgeDPhi[i]->Scale(scale_for_ridge);\r
-\r
- // symmetrize NS ridge in the AS\r
- fSymmRidgeNotScaled[i] = (TH1D*)fRidgeDPhi[i]->Clone("fSymmRidgeNotScaled");\r
- \r
- for(Int_t k=fSymmRidgeNotScaled[i]->GetNbinsX()/2+1;k<=fSymmRidgeNotScaled[i]->GetNbinsX();k++){\r
- \r
- fSymmRidgeNotScaled[i]->SetBinContent(k,fSymmRidgeNotScaled[i]->GetBinContent(fSymmRidgeNotScaled[i]->GetNbinsX()+1-k));\r
-\r
- }\r
- \r
- // scale the symmetrized ridge according to NS or AS\r
- fSymmRidge[i] = (TH1D*)fSymmRidgeNotScaled[i]->Clone("fSymmRidge");\r
-\r
- for(Int_t k=0;k<bins/2;k++){\r
- fSymmRidge[i]->SetBinContent(k+1,(fSymmRidgeNotScaled[i]->GetBinContent(k+1))*scale_for_ridge_NS);\r
- }\r
- for(Int_t k=bins/2;k<bins;k++){\r
- fSymmRidge[i]->SetBinContent(k+1,(fSymmRidgeNotScaled[i]->GetBinContent(k+1))*scale_for_ridge_AS);\r
- }\r
-\r
- \r
- // signal - symmetric ridge\r
- \r
- if(zyam){\r
- fFinal1DPhi[i] = new TH1D(Form("fFinal1DPhi[%d]",i),Form("fFinal1DPhi[%d]",i),bins,-0.5*TMath::Pi(),1.5*TMath::Pi());\r
- fFinal1DPhi[i]->Add(fSignalDPhi[i],fSymmRidge[i],1,-1);\r
- fFinal1DPhi[i]->Sumw2();\r
- fFinalDPhi[i] = (TH1D*)fFinal1DPhi[i]->Clone("fFinal"); // zyam: average between the two min values => sum first half of NS in the second half and second half of AS in the first half, so zyam = min/2\r
- fFinalDPhi[i]->Reset();\r
- fFinalDPhi[i]->Sumw2();\r
- \r
- for(Int_t k=1;k<=bins/4;k++){\r
- fFinalDPhi[i]->SetBinContent(k,0.);\r
- fFinalDPhi[i]->SetBinContent(k+bins/4,fFinal1DPhi[i]->GetBinContent(k+bins/4)+fFinal1DPhi[i]->GetBinContent(bins/4+1-k));\r
- fFinalDPhi[i]->SetBinError(k+bins/4,TMath::Sqrt(pow(fFinal1DPhi[i]->GetBinError(k+bins/4),2)+pow(fFinal1DPhi[i]->GetBinError(bins/4+1-k),2)));\r
- fFinalDPhi[i]->SetBinContent(k+bins/2,fFinal1DPhi[i]->GetBinContent(k+bins/2)+fFinal1DPhi[i]->GetBinContent(bins+1-k));\r
- fFinalDPhi[i]->SetBinError(k+bins/2,TMath::Sqrt(pow(fFinal1DPhi[i]->GetBinError(k+bins/2),2)+pow(fFinal1DPhi[i]->GetBinError(bins+1-k),2)));\r
- fFinalDPhi[i]->SetBinContent(k+bins/4*3,0.);\r
- \r
- }\r
- }\r
- \r
- else{\r
-\r
- fFinalDPhi[i] = (TH1D*)fSignalDPhi[i]->Clone();\r
- fFinalDPhi[i]->Reset();\r
- fFinalDPhi[i]->Sumw2();\r
- fFinalDPhi[i]->Add(fSignalDPhi[i],fSymmRidge[i],1,-1);\r
- }\r
- \r
- }\r
-\r
- // store the pair yields in a file (the yields are *not* normalized to the Ntriggers)\r
- \r
- TFile* file_yields = 0x0;\r
- if(zyam)\r
- file_yields = TFile::Open("PairYields_zyam.root","RECREATE");\r
- else\r
- file_yields = TFile::Open("PairYields_fit.root","RECREATE");\r
-\r
-\r
- for(Int_t i=0;i<multclass;i++){\r
- fDeltaEtaNch[i]->SetName(Form("DeltaEta_0_0_%d",i));\r
- fDeltaEtaNch[i]->Write();\r
- fDeltaPhiNch[i]->SetName(Form("Correlation bin %d in dphi",i));\r
- fDeltaPhiNch[i]->Write();\r
- fSignalDPhi[i]->SetName(Form("Signal_0_0_%d",i));\r
- fSignalDPhi[i]->Write();\r
- fRidgeDPhi[i]->SetName(Form("Ridge_0_0_%d",i));\r
- fRidgeDPhi[i]->Write();\r
- fSymmRidgeNotScaled[i]->SetName(Form("Symmetric_Ridge_NotScaled_0_0_%d",i));\r
- fSymmRidgeNotScaled[i]->Write();\r
- fSymmRidge[i]->SetName(Form("Symmetric_Ridge_0_0_%d",i));\r
- fSymmRidge[i]->Write();\r
- fFinalDPhi[i]->SetName(Form("Pure_Signal_0_0_%d",i));\r
- fFinalDPhi[i]->Write();\r
- }\r
- file_yields->Close();\r
-\r
- //-------------- CORRELATION OBSERVABLES: per-trigger yields, triggers and uncorrelated seeds\r
- \r
- Float_t baseline[multclass]={0};\r
- \r
- TGraphErrors *fNearSideIntegral = new TGraphErrors();\r
- fNearSideIntegral->SetName("fNearSideIntegral");\r
- fNearSideIntegral->SetMarkerColor(kGreen+2);\r
- fNearSideIntegral->SetLineColor(kGreen+2);\r
- fNearSideIntegral->SetLineWidth(1);\r
- fNearSideIntegral->SetMarkerStyle(4);\r
-\r
- TGraphErrors *fAwaySideIntegral = new TGraphErrors();\r
- fAwaySideIntegral->SetName("fAwaySideIntegral");\r
- fAwaySideIntegral->SetMarkerColor(kBlue);\r
- fAwaySideIntegral->SetLineColor(kBlue);\r
- fAwaySideIntegral->SetLineWidth(1);\r
- fAwaySideIntegral->SetMarkerStyle(4);\r
-\r
- TGraphErrors *fBothSideIntegral = new TGraphErrors();\r
- fBothSideIntegral->SetName("fBothSideIntegral");\r
- fBothSideIntegral->SetMarkerColor(kMagenta);\r
- fBothSideIntegral->SetLineColor(kMagenta);\r
- fBothSideIntegral->SetLineWidth(1);\r
- fBothSideIntegral->SetMarkerStyle(4);\r
-\r
- \r
- TGraphErrors *fNjets = new TGraphErrors();\r
- fNjets->SetName("fNjets");\r
- fNjets->SetMarkerColor(kCyan+2);\r
- fNjets->SetLineColor(kCyan+2);\r
- fNjets->SetLineWidth(1);\r
- fNjets->SetMarkerStyle(4);\r
-\r
- TGraphErrors *fTriggerAverage = new TGraphErrors();\r
- fTriggerAverage->SetName("fTriggerAverage");\r
- fTriggerAverage->SetMarkerColor(kBlack);\r
- fTriggerAverage->SetLineColor(kBlack);\r
- fTriggerAverage->SetLineWidth(1);\r
- fTriggerAverage->SetMarkerStyle(4);\r
-\r
- Int_t points=0;\r
- Double_t minbin[multclass] = {0};\r
- \r
- // extract information out of dphi histograms\r
- TCanvas * cYields= new TCanvas("cYields", "cYields", 150, 150, 820, 620);\r
- cYields->Divide(5,4);\r
- \r
- for(Int_t i=0;i<multclass;i++){\r
- cYields->cd(i+1);\r
- \r
-\r
- if(zyam) {\r
- \r
- if(fFinalDPhi[i]->Integral()>0){\r
- fFinalDPhi[i]->GetXaxis()->SetRange(bins/4+1,bins/4*3);\r
- baseline[i]=fFinalDPhi[i]->GetMinimum()/2;\r
- minbin[i] = fFinalDPhi[i]->GetMinimumBin();\r
- fFinalDPhi[i]->GetXaxis()->UnZoom();\r
- \r
- for(Int_t k=0;k<bins;k++){\r
- if(fFinalDPhi[i]->GetBinContent(k+1)!=0)\r
- fFinalDPhi[i]->SetBinContent(k+1,fFinalDPhi[i]->GetBinContent(k+1)-baseline[i]);\r
- else\r
- fFinalDPhi[i]->SetBinContent(k+1,0.);\r
- }\r
- \r
- fFinalDPhi[i]->DrawClone("");\r
- \r
- fFinalDPhi[i]->SetTitle(Form("0.7<p_{T,trig}<5.0 - 0.7<p_{T,assoc}<5.0 - %d-%d %",i*5,(i+1)*5));\r
- fFinalDPhi[i]->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#varphi (rad^{-1})"); \r
- //-\r
- Double_t errorNS = 0;\r
- Double_t nearSideResult = (fFinalDPhi[i]->IntegralAndError(0,minbin[i],errorNS,"width"))/trigger->GetBinContent(i+1);\r
- Double_t nearSideError = errorNS/trigger->GetBinContent(i+1); \r
- fNearSideIntegral->SetPoint(points,i, nearSideResult);\r
- fNearSideIntegral->SetPointError(points,0.5,errorNS/trigger->GetBinContent(i+1));\r
- //-\r
- \r
- //--\r
- Double_t errorAS = 0;\r
- Double_t awaySideResult = (fFinalDPhi[i]->IntegralAndError(minbin[i],bins,errorAS,"width"))/trigger->GetBinContent(i+1);\r
- Double_t awaySideError = errorAS/trigger->GetBinContent(i+1); \r
- fAwaySideIntegral->SetPoint(points,i, awaySideResult );\r
- fAwaySideIntegral->SetPointError(points,0.5, errorAS/trigger->GetBinContent(i+1));\r
- //--\r
- \r
- //---\r
- Double_t bothSideResult = nearSideResult + awaySideResult;\r
- Double_t bothSideError = bothSideResult * TMath::Sqrt(pow(errorNS,2)+pow(errorAS,2))/trigger->GetBinContent(i+1);\r
- fBothSideIntegral->SetPoint(points,i, bothSideResult );\r
- fBothSideIntegral->SetPointError(points,0.5, bothSideError ); \r
- //---\r
- \r
-\r
- \r
- }\r
- else{\r
- fNearSideIntegral->SetPoint(points,i, 0);\r
- fAwaySideIntegral->SetPoint(points,i, 0);\r
- fBothSideIntegral->SetPoint(points,i,0);\r
- }\r
- Double_t p0BinContent=p0->GetBinContent(i+1);\r
- Double_t p0BinError=p0->GetBinError(i+1);\r
- \r
- //--------\r
- Double_t njets = p0BinContent/(1+bothSideResult); \r
- Double_t njetsError = njets*TMath::Sqrt(bothSideError*bothSideError/(1+bothSideResult)/(1+bothSideResult)+p0BinError*p0BinError/p0BinContent/p0BinContent);\r
- fNjets->SetPoint(points,i, njets );\r
- fNjets->SetPointError(points,0.5,njetsError );\r
- \r
- //-------\r
- \r
- fTriggerAverage->SetPoint(points,i, p0BinContent);\r
- fTriggerAverage->SetPointError(points,0.5, p0BinError);\r
- \r
- }\r
- \r
- else if (!zyam){ \r
-\r
- if(fFinalDPhi[i]->Integral()>0){\r
-\r
- //first fit function: 2 gauss + const\r
- fTotal2Gaus[i] = new TF1(Form("gaus3and2_%d",i), fitFunction2Gaus , -0.5*TMath::Pi(), 1.5*TMath::Pi(), 5);\r
- fTotal2Gaus[i]->SetName(Form("gaus3_%d",i));\r
- fTotal2Gaus[i]->SetParNames ("A1","sigma1","A3", "sigma3");\r
- fTotal2Gaus[i]->SetLineColor(kRed);\r
- fTotal2Gaus[i]->SetLineWidth(2);\r
- \r
- baseline[i]=fFinalDPhi[i]->GetMinimum();\r
- Double_t integr_for_const_2 = fFinalDPhi[i]->Integral();\r
- \r
- fTotal2Gaus[i]->FixParameter(4,integr_for_const_2);\r
- fTotal2Gaus[i]->SetParameters( fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0)) - baseline[i] , 0.6 , fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(TMath::Pi()))-baseline[i] , 0.6);\r
- \r
- fTotal2Gaus[i]->SetParLimits(0, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0))-baseline[i])*2);\r
- fTotal2Gaus[i]->SetParLimits(1, 0.01, 10);\r
- fTotal2Gaus[i]->SetParLimits(2, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(TMath::Pi()))-baseline[i])*2);\r
- fTotal2Gaus[i]->SetParLimits(3, 0.01, 10);\r
- \r
- fTotal2Gaus[i]->SetLineColor(kRed);\r
- fTotal2Gaus[i]->SetLineWidth(2);\r
-\r
- fFinalDPhi[i]->Fit(fTotal2Gaus[i],flag);\r
- fFinalDPhi[i]->SetMinimum(0);\r
- fFinalDPhi[i]->DrawClone("");\r
- fTotal2Gaus[i] ->DrawClone("same");\r
- \r
- Double_t A11 = fTotal2Gaus[i]->GetParameter(0);\r
- Double_t sigma11 = fTotal2Gaus[i]->GetParameter(1);\r
- Double_t A31 = fTotal2Gaus[i]->GetParameter(2);\r
- Double_t sigma31 = fTotal2Gaus[i]->GetParameter(3);\r
-\r
- Double_t a1e1 = fTotal2Gaus[i]->GetParError(0);\r
- Double_t s1e1 = fTotal2Gaus[i]->GetParError(1);\r
- Double_t a3e1 = fTotal2Gaus[i]->GetParError(2);\r
- Double_t s3e1 = fTotal2Gaus[i]->GetParError(3);\r
- \r
- \r
- Double_t T11 = A11*sigma11; \r
- Double_t T31 = A31*sigma31;\r
- Double_t t11 = T11*TMath::Sqrt(a1e1*a1e1/A11/A11 + s1e1*s1e1/sigma11/sigma11); \r
- Double_t t31 = T31*TMath::Sqrt(a3e1*a3e1/A31/A31 + s3e1*s3e1/sigma31/sigma31);\r
- \r
-\r
- //second fit: 3 gauss + const\r
- fTotal[i] = new TF1(Form("gaus3_%d",i), fitFunction , -0.5*TMath::Pi(), 1.5*TMath::Pi(), 7);\r
- fTotal[i]->SetName(Form("gaus3_%d",i));\r
- fTotal[i]->SetParNames ("A1","sigma1","A2","sigma2", "A3", "sigma3","integral");\r
- fTotal[i]->SetLineColor(kRed);\r
- fTotal[i]->SetLineWidth(2);\r
- \r
- Double_t integr_for_const = fFinalDPhi[i]->Integral();\r
- \r
- \r
- fTotal[i]->FixParameter(0,A11);\r
- fTotal[i]->FixParameter(1,sigma11*1.2);\r
- fTotal[i]->FixParameter(2,A11);\r
- fTotal[i]->FixParameter(3,sigma11*0.7);\r
- fTotal[i]->FixParameter(4,A31);\r
- fTotal[i]->FixParameter(5,sigma31);\r
- fTotal[i]->FixParameter(6,integr_for_const);\r
-\r
- fTotal[i]->SetParLimits(0, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0))-baseline[i])*2);\r
- fTotal[i]->SetParLimits(1, 0.3, 10); \r
- fTotal[i]->SetParLimits(2, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0))-baseline[i])*2);\r
- fTotal[i]->SetParLimits(3, 0.12, 0.4);\r
- fTotal[i]->SetParLimits(4, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->\r
- GetXaxis()->FindFixBin(TMath::Pi()))-baseline[i])*2);\r
- fTotal[i]->SetParLimits(5, 0.01, 10);\r
- \r
- fTotal[i]->SetLineColor(kRed);\r
- fTotal[i]->SetLineWidth(2);\r
-\r
-\r
- fFinalDPhi[i]->Fit(fTotal[i],flag);\r
- fFinalDPhi[i]->SetMinimum(0);\r
- fFinalDPhi[i]->DrawClone("");\r
- fFinalDPhi[i]->SetTitle(Form("0.7<p_{T,trig}<5.0 - 0.7<p_{T,assoc}<5.0 - %d-%d %",i*5,(i+1)*5));\r
- fFinalDPhi[i]->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#varphi (rad^{-1})");\r
- fTotal[i]->DrawClone("same");\r
- \r
- Double_t A1 = fTotal[i]->GetParameter(0);\r
- Double_t sigma1 = fTotal[i]->GetParameter(1);\r
- Double_t A2 = fTotal[i]->GetParameter(2);\r
- Double_t sigma2 = fTotal[i]->GetParameter(3);\r
- Double_t A3 = fTotal[i]->GetParameter(4);\r
- Double_t sigma3 = fTotal[i]->GetParameter(5);\r
-\r
- \r
- //define each gaussian and constant to be drawn with different colors on top of each other\r
- \r
- TF1 * fConstant = new TF1("konst", "pol0(0)",-0.5*TMath::Pi(), 1.5*TMath::Pi());\r
- fConstant->SetParameter(0,(integr_for_const - TMath::Sqrt(TMath::Pi()*2)/binWidth*(A1*sigma1+A2*sigma2+A3*sigma3))/bins);\r
- fConstant->SetLineColor(kBlue);\r
- fConstant->Draw("same");\r
- \r
- //gaus 1 NS\r
- TF1 * fGaussian1 = new TF1("fGaussian1", "[0]*exp(-x*x/(2*[1]*[1])) +[0] * exp(-(x-TMath::TwoPi())*(x-TMath::TwoPi())/(2*[1]*[1]))",-0.5*TMath::Pi(), 1.5*TMath::Pi());\r
- fGaussian1->SetParameters(fTotal[i]->GetParameter(0),fTotal[i]->GetParameter(1));\r
- fGaussian1->SetLineColor(kMagenta);\r
- fGaussian1->SetLineStyle(1);\r
- fGaussian1->Draw("same");\r
- \r
- //gaus 2 NS\r
- TF1 * fGaussian2 = new TF1("fGaussian2", "[0]*exp(-x*x/(2*[1]*[1])) +[0] * exp(-(x-TMath::TwoPi())*(x-TMath::TwoPi())/(2*[1]*[1]))",-0.5*TMath::Pi(), 1.5*TMath::Pi());\r
- fGaussian2->SetLineColor(kGreen+2);\r
- fGaussian2->SetParameters(fTotal[i]->GetParameter(2),fTotal[i]->GetParameter(3));\r
- fGaussian2->Draw("same");\r
- \r
- //gaus 3 AS\r
- TF1 * fGaussian3 = new TF1("fGaussian3", "[0] * exp(-((x-TMath::Pi()))*((x-TMath::Pi()))/(2*[1]*[1]))+[0] * exp(-((x+TMath::Pi()))*((x+TMath::Pi()))/(2*[1]*[1]))",-0.5*TMath::Pi(), 1.5*TMath::Pi());\r
- fGaussian3->SetLineColor(kCyan);\r
- fGaussian3->SetParameters(fTotal[i]->GetParameter(4), fTotal[i]->GetParameter(5));\r
- fGaussian3->Draw("same");\r
- \r
- \r
- Double_t a1e = fTotal[i]->GetParError(0);\r
- Double_t s1e = fTotal[i]->GetParError(1);\r
- Double_t a2e = fTotal[i]->GetParError(2);\r
- Double_t s2e = fTotal[i]->GetParError(3);\r
- Double_t a3e = fTotal[i]->GetParError(4);\r
- Double_t s3e = fTotal[i]->GetParError(5);\r
-\r
- Double_t T1 = A1*sigma1;\r
- Double_t T2 = A2*sigma2;\r
- Double_t T3 = A3*sigma3;\r
- Double_t t1 = T1*TMath::Sqrt(a1e*a1e/A1/A1 + s1e*s1e/sigma1/sigma1);\r
- Double_t t2 = T2*TMath::Sqrt(a2e*a2e/A2/A2 + s2e*s2e/sigma2/sigma2);\r
- Double_t t3 = T3*TMath::Sqrt(a3e*a3e/A3/A3 + s3e*s3e/sigma3/sigma3);\r
- \r
- //-\r
- Double_t nearSideResult = TMath::Sqrt(TMath::Pi()*2)/ binWidth* (A1 * sigma1 + A2 * sigma2)/trigger->GetBinContent(i+1);\r
- Double_t nearSideError = nearSideResult * TMath::Sqrt((t1*t1 + t2*t2)/(T1+T2)/(T1+T2)+ 1./trigger->GetBinContent(i+1));\r
- fNearSideIntegral->SetPoint(points,i, nearSideResult);\r
- fNearSideIntegral->SetPointError(points,0.5,nearSideError);\r
- \r
- //-\r
-\r
- //--\r
- Double_t awaySideResult = TMath::Sqrt(TMath::Pi()*2)/ binWidth* \r
- (A3 * sigma3)/trigger->GetBinContent(i+1);\r
- Double_t awaySideError = awaySideResult*TMath::Sqrt(a3e*a3e/A3/A3 + s3e*s3e/sigma3/sigma3 + 1/trigger->GetBinContent(i+1));\r
- fAwaySideIntegral->SetPoint(points,i, awaySideResult );\r
- fAwaySideIntegral->SetPointError(points,0.5, awaySideError ); \r
- //--\r
-\r
- //---\r
- bothSideResult = TMath::Sqrt(TMath::Pi()*2)/ binWidth* (A1 * sigma1 + A2 * sigma2 + A3 * sigma3 )/trigger->GetBinContent(i+1); \r
- bothSideError = nearSideResult * TMath::Sqrt((t1*t1 + t2*t2 + t3*t3)/(T1+T2+T3)/(T1+T2+T3)+ 1./trigger->GetBinContent(i+1));\r
- fBothSideIntegral->SetPoint(points,i, bothSideResult );\r
- fBothSideIntegral->SetPointError(points,0.5, bothSideError ); \r
- //---\r
- \r
- }\r
- else{\r
- \r
- fNearSideIntegral->SetPoint(points,i, 0);\r
- fAwaySideIntegral->SetPoint(points,i, 0);\r
- fBothSideIntegral->SetPoint(points,i,0);\r
- \r
- }\r
- Double_t p0BinContent=p0->GetBinContent(i+1);\r
- Double_t p0BinError=p0->GetBinError(i+1);\r
- \r
- //--------\r
- Double_t njets = p0BinContent/(1+bothSideResult); \r
- Double_t njetsError = njets*TMath::Sqrt(bothSideError*bothSideError/(1+bothSideResult)/(1+bothSideResult) + p0BinError*p0BinError/p0BinContent/p0BinContent);\r
- fNjets->SetPoint(points,i, njets );\r
- fNjets->SetPointError(points,0.5,njetsError );\r
- //-------\r
- \r
- fTriggerAverage->SetPoint(points,i, p0BinContent);\r
- fTriggerAverage->SetPointError(points,0.5, p0BinError);\r
- \r
- \r
- }\r
- points++;\r
- }\r
-\r
-\r
- TFile* file = 0x0;\r
- if(zyam)\r
- file = TFile::Open("njet_zyam.root","RECREATE");\r
- else\r
- file = TFile::Open("njet_fit.root","RECREATE");\r
-\r
- fNearSideIntegral->Write();\r
- fAwaySideIntegral->Write();\r
- fBothSideIntegral->Write();\r
- fNjets->Write();\r
- fTriggerAverage->Write();\r
-\r
- file->Close();\r
-\r
-\r
-\r
-}\r
-\r
-\r
+/* $Id: $ */
+//--------------------------------------------------
+//
+// macro to do the final analysis step
+// uses input of analysis class AliAnalysisTaskPhiCorrelation
+//
+// Author : Emilia Leogrande (University of Utrecht)
+//
+//-------------------------------------------------
+
+#include <TChain.h>
+#include <TList.h>
+#include <TTree.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TH3F.h>
+#include <THnSparse.h>
+#include <TProfile.h>
+#include <TCanvas.h>
+#include "TRandom.h"
+#include "TGraphErrors.h"
+#include "TFile.h"
+#include "TF1.h"
+#include "TMath.h"
+#include "TDirectory.h"
+#include "TStyle.h"
+#include "TROOT.h"
+#include "TColor.h"
+
+#include <iostream>
+using namespace std;
+
+void analyseEmy2(Bool_t zyam = kTRUE); // if zyam = kFALSE, fit is used
+Double_t fitFunction(Double_t *x ,Double_t *par); // fit function using constant + 3 gaussians
+Double_t fitFunction2Gaus(Double_t *x ,Double_t *par); // fit function using constant + 2 gaussians
+
+//input file and mixed event removed file
+TFile *fileData=0x0;
+TFile *fileDataEMremoved = 0x0;
+
+const int multclass = 20;
+
+TH1D *fDeltaPhiNch[multclass];
+TH1D *fDeltaEtaNch[multclass];
+TH1D *fSignalDPhi[multclass];
+TH1D *fSignalNSDPhi[multclass];
+TH1D *fSignalASDPhi[multclass];
+TH1D *fRidge1DPhi[multclass];
+TH1D *fRidge2DPhi[multclass];
+TH1D *fRidgeDPhi[multclass];
+TH1D *fSymmRidgeNotScaled[multclass];
+TH1D *fSymmRidge[multclass];
+TH1D *fFinal1DPhi[multclass];
+TH1D *fFinalDPhi[multclass];
+
+TString flag = "R";
+TF1 *fTotal2Gaus[multclass]; // fit with 2 gaussians + const
+TF1 *fTotal[multclass]; // fit with 3 gaussians + const
+
+//properties of histogram
+const int bins = 72; //
+Double_t binWidth=2*TMath::Pi()/bins;
+
+const int binsDeta = 48;
+
+
+Double_t max_bin_for_etagap = 1.2;
+Double_t min_bin_for_etagap = -1.2;
+Double_t max_eta = 1.8;
+Double_t min_eta = -1.8;
+
+//________________________________________________________________________________________________________________
+//
+Double_t fitFunction(Double_t *x ,Double_t *par)
+{
+ // fit function for 3 gaus + constant
+
+ // parameters for Gaussian
+ Double_t A1 = par[0];
+ Double_t sigma1 = par[1];
+ Double_t A2 = par[2];
+ Double_t sigma2 = par[3];
+ Double_t A3 = par[4];
+ Double_t sigma3 = par[5];
+ Double_t integral = par[6];
+
+ Double_t constante = (integral-
+ TMath::Sqrt(TMath::Pi()*2)/ binWidth*
+ (A1 * sigma1 + A2 * sigma2 + A3*sigma3))/bins;
+ Double_t q = x[0];
+
+ //fit value
+ Double_t fitval = constante +
+ (q>-0.5*TMath::Pi()&&q<0.5*TMath::Pi())*(
+ A1 * exp(- q * q / (2 * sigma1 *sigma1)) +
+ A1 * exp(-((q - TMath::TwoPi())) * ((q - TMath::TwoPi())) / ( 2 * sigma1 * sigma1))
+ )
+ +
+ (q>-0.2*TMath::Pi()&&q<0.2*TMath::Pi())*(
+ A2 * exp(- q * q / (2 * sigma2 *sigma2)) +
+ A2 * exp(-((q - TMath::TwoPi())) * ((q - TMath::TwoPi())) / ( 2 * sigma2 * sigma2))
+ )
+ +
+ (q>0.5*TMath::Pi()&&q<1.5*TMath::Pi())*(
+ A3 * exp(-((q - TMath::Pi())) * ((q - TMath::Pi())) / ( 2 * sigma3 * sigma3)) +
+ A3 * exp(-((q + TMath::Pi())) * ((q + TMath::Pi())) / (2 * sigma3 * sigma3))
+ );
+ return fitval;
+}
+
+//________________________________________________________________________________________________________________
+//
+Double_t fitFunction2Gaus(Double_t *x ,Double_t *par)
+{
+ // fit function for 2 gaus + constant
+
+ // parameters for Gaussian
+ Double_t A1 = par[0];
+ Double_t sigma1 = par[1];
+ Double_t A3 = par[2];
+ Double_t sigma3 = par[3];
+ Double_t integral = par[4];
+
+ Double_t constante = (integral -
+ TMath::Sqrt(TMath::Pi()*2)/ binWidth*
+ (A1 * sigma1 + A3*sigma3))/bins;
+ Double_t q = x[0];
+
+ //fit value
+ Double_t fitval = constante +
+ (q>-0.5*TMath::Pi()&&q<0.5*TMath::Pi())*(
+ A1 * exp(- q * q / (2 * sigma1 *sigma1)) +
+ A1 * exp(-((q - TMath::TwoPi())) * ((q - TMath::TwoPi())) / ( 2 * sigma1 * sigma1))
+ )
+ +
+ (q>0.5*TMath::Pi()&&q<1.5*TMath::Pi())*(
+ A3 * exp(-((q - TMath::Pi())) * ((q - TMath::Pi())) / ( 2 * sigma3 * sigma3)) +
+ A3 * exp(-((q + TMath::Pi())) * ((q + TMath::Pi())) / (2 * sigma3 * sigma3))
+ );
+ return fitval;
+}
+
+//_______________________________________________________________________________________________________________
+//
+Double_t fline(Double_t *x, Double_t *par){
+
+ if(x[0]>-1.8 && x[0]<=0){
+ return par[0]+par[1]*x[0];
+ }
+ else if(x[0]>0 && x[0]<1.8){
+ return par[2]+par[3]*x[0];
+ }
+ else
+ return 0;
+}
+
+
+//________________________________________________________________________________________________________________
+//
+void analyseEmy2(Bool_t zyam){
+
+
+ // plot style
+ gStyle->SetOptStat(0);
+ const Int_t NRGBs = 5;
+ const Int_t NCont = 500;
+ Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
+ Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
+ Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
+ Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
+ TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
+ gStyle->SetNumberContours(NCont);
+
+ //style
+ gROOT->SetStyle("Plain");
+ gStyle->SetOptStat(0);
+ gStyle->SetPalette(1);
+
+ //-------------- TRIGGERS AND EVENTS
+
+ TH2D *dphideta[multclass];
+ TH1D * trigger = 0x0;
+ TH1D * event = 0x0;
+
+ fileData = TFile::Open("dphi_corr.root");
+ trigger = (TH1D*)fileData->Get("triggers_0");
+ event = (TH1D*)fileData->Get("events");
+
+ // get average trigger particles per event
+ TProfile *p0 = (TProfile*)trigger->Clone();
+ TProfile *p1 = (TProfile*)event->Clone();
+ p0->Sumw2();
+ p1->Sumw2();
+ p0->Divide(p0,p1,1,1,"B");
+
+ // copy triggers and events in the new dphi_corr with the Mixed Event removed
+ TH1D *triggerCopy = 0x0;
+ TH1D *eventCopy = 0x0;
+
+ triggerCopy = (TH1D*)trigger->Clone();
+ eventCopy = (TH1D*)event->Clone();
+
+ fileDataEMremoved = TFile::Open("dphi_corr_MEremoved.root","RECREATE");
+ triggerCopy->SetName("triggers_0");
+ triggerCopy->Write();
+ eventCopy->SetName("events");
+ eventCopy->Write();
+ fileDataEMremoved->Close();
+
+
+ //-------------- MIXED EVENT REMOVAL: restores the right number of particles in the detector acceptance but keeps the detector azimuthal unefficiencies corrections and cures the dip in (0,0) from two-trak cuts
+ // Removing the event mixing: S/M (from dphi_corr) * M (from the triangle)
+
+ Double_t triangle_factor[binsDeta]={0};
+
+ TH2D *s_over_m[multclass];
+ TH1D *s_m_deta[multclass];
+ TH2D *s_over_m_x_m[multclass];
+
+ for(Int_t i=0;i<multclass;i++){
+ s_over_m[i] = (TH2D*)fileData->Get(Form("dphi_0_0_%d",i));
+ s_m_deta[i] = (TH1D*)s_over_m[i]->ProjectionY()->Clone();
+ s_over_m_x_m[i] = (TH2D*)s_over_m[i]->Clone();
+ s_over_m_x_m[i]->Reset();
+ }
+
+
+ TF1 *f2 = new TF1("f2",fline,min_eta,max_eta,4);
+
+ f2->FixParameter(0,1);
+ f2->FixParameter(1,1/max_eta);
+ f2->FixParameter(2,1);
+ f2->FixParameter(3,-1/max_eta);
+
+ for(Int_t i=0;i<binsDeta;i++){
+
+ triangle_factor[i] = f2->Eval(s_m_deta[0]->GetBinCenter(i+1));
+
+ }
+
+
+
+ //--scale each deta bin of the old TH2 with the triangle_factor[deta]
+
+ for(Int_t i=0;i<multclass;i++){
+ for(Int_t j=0;j<binsDeta;j++){
+ for(Int_t k=0;k<bins;k++){
+ s_over_m_x_m[i] -> SetBinContent(k+1,j+1,(s_over_m[i]->GetBinContent(k+1,j+1))*triangle_factor[j]);
+ s_over_m_x_m[i]->SetBinError(k+1,j+1,(s_over_m[i]->GetBinError(k+1,j+1))*triangle_factor[j]);
+ }
+ }
+ }
+
+ fileDataEMremoved = TFile::Open("dphi_corr_MEremoved.root","UPDATE");
+
+ for(Int_t i=0;i<multclass;i++){
+
+ s_over_m_x_m[i]->SetName(Form("dphiNoMixed_%d",i));
+ s_over_m_x_m[i]->Write();
+
+ }
+
+
+
+ //-------------- DOUBLE RIDGE SUBTRACTION: gets rid of no-jet related components (v3 is still kept => effect added to the systematics)
+
+ // the ridge, estimated via an etagap, has to be scaled since it sits on the triangle
+ Double_t scale_for_ridge_NS = 0, scale_for_ridge_AS = 0;
+
+
+ scale_for_ridge_NS = f2->Integral(min_bin_for_etagap,max_bin_for_etagap)/(f2->Integral(min_eta,min_bin_for_etagap)+f2->Integral(max_bin_for_etagap,max_eta)); //there is etagap in the NS
+ cout<<"scaling NS:"<<scale_for_ridge_NS<<endl;
+
+ scale_for_ridge_AS = f2->Integral(min_eta,max_eta)/(f2->Integral(min_eta,min_bin_for_etagap)+f2->Integral(max_bin_for_etagap,max_eta)); // there is no etagap in the AS
+ cout<<"scaling AS:"<<scale_for_ridge_AS<<endl;
+
+ // Double ridge subtraction
+
+ TCanvas *c = new TCanvas();
+ c->Divide(5,4);
+
+ for(Int_t i=0;i<multclass;i++){
+ c->cd(i+1);
+
+
+ dphideta[i] = (TH2D*)fileDataEMremoved->Get(Form("dphiNoMixed_%d",i));
+
+
+ // phi and eta projections
+ fDeltaPhiNch[i] = (TH1D*)dphideta[i]->ProjectionX()->Clone();
+ if(!zyam)
+ fDeltaPhiNch[i]->Scale(binWidth); //gaussians include the binwidth, so when using the fit, the histograms must be scaled first
+ fDeltaPhiNch[i]->Draw();
+
+ fDeltaEtaNch[i] = (TH1D*)dphideta[i]->ProjectionY()->Clone();
+
+ // signal NS: |DEta|<max_bin_for_etagap; signal AS: |DEta|<max_eta
+ fSignalNSDPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("|DEta|<%f",max_bin_for_etagap),fDeltaEtaNch[i]->FindBin(min_bin_for_etagap+0.0001),fDeltaEtaNch[i]->FindBin(max_bin_for_etagap-0.0001))->Clone();
+ fSignalASDPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("|DEta|<%f",max_eta))->Clone();
+
+ fSignalDPhi[i] = (TH1D*)fSignalASDPhi[i]->Clone();
+ fSignalDPhi[i]->Reset();
+ fSignalDPhi[i]->Sumw2();
+
+ for(Int_t k=0;k<bins/2;k++){
+ fSignalDPhi[i]->SetBinContent(k+1,fSignalNSDPhi[i]->GetBinContent(k+1));
+ fSignalDPhi[i]->SetBinError(k+1, fSignalNSDPhi[i]->GetBinError(k+1));
+ }
+ for(Int_t k=bins/2;k<bins;k++){
+ fSignalDPhi[i]->SetBinContent(k+1,fSignalASDPhi[i]->GetBinContent(k+1));
+ fSignalDPhi[i]->SetBinError(k+1, fSignalASDPhi[i]->GetBinError(k+1));
+ }
+ if(!zyam)
+ fSignalDPhi[i]->Scale(binWidth);
+
+ // ridge1 DEta<min_bin_for_etagap
+ fRidge1DPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("DEta<%f",min_bin_for_etagap),1,fDeltaEtaNch[i]->FindBin(min_bin_for_etagap-0.0001))->Clone();
+ if(!zyam)
+ fRidge1DPhi[i]->Scale(binWidth);
+ fRidge1DPhi[i]->SetMarkerColor(kRed);
+
+ // ridge2 DEta>max_bin_for_etagap
+ fRidge2DPhi[i] = (TH1D*)dphideta[i]->ProjectionX(Form("DEta>%f",max_bin_for_etagap),fDeltaEtaNch[i]->FindBin(max_bin_for_etagap+0.0001),fDeltaEtaNch[i]->GetNbinsX())->Clone();
+ if(!zyam)
+ fRidge2DPhi[i]->Scale(binWidth);
+ fRidge2DPhi[i]->SetMarkerColor(kBlue);
+
+ // ridge = ridge1 + ridge2
+ fRidgeDPhi[i] = (TH1D*)fRidge1DPhi[i]->Clone("fRidge");
+ fRidgeDPhi[i]->Reset();
+ fRidgeDPhi[i]->Sumw2();
+ fRidgeDPhi[i]->Add(fRidge1DPhi[i],fRidge2DPhi[i],1,1);
+ //fRidgeDPhi[i]->Scale(scale_for_ridge);
+
+ // symmetrize NS ridge in the AS
+ fSymmRidgeNotScaled[i] = (TH1D*)fRidgeDPhi[i]->Clone("fSymmRidgeNotScaled");
+
+ for(Int_t k=fSymmRidgeNotScaled[i]->GetNbinsX()/2+1;k<=fSymmRidgeNotScaled[i]->GetNbinsX();k++){
+
+ fSymmRidgeNotScaled[i]->SetBinContent(k,fSymmRidgeNotScaled[i]->GetBinContent(fSymmRidgeNotScaled[i]->GetNbinsX()+1-k));
+
+ }
+
+ // scale the symmetrized ridge according to NS or AS
+ fSymmRidge[i] = (TH1D*)fSymmRidgeNotScaled[i]->Clone("fSymmRidge");
+
+ for(Int_t k=0;k<bins/2;k++){
+ fSymmRidge[i]->SetBinContent(k+1,(fSymmRidgeNotScaled[i]->GetBinContent(k+1))*scale_for_ridge_NS);
+ }
+ for(Int_t k=bins/2;k<bins;k++){
+ fSymmRidge[i]->SetBinContent(k+1,(fSymmRidgeNotScaled[i]->GetBinContent(k+1))*scale_for_ridge_AS);
+ }
+
+
+ // signal - symmetric ridge
+
+ if(zyam){
+ fFinal1DPhi[i] = new TH1D(Form("fFinal1DPhi[%d]",i),Form("fFinal1DPhi[%d]",i),bins,-0.5*TMath::Pi(),1.5*TMath::Pi());
+ fFinal1DPhi[i]->Add(fSignalDPhi[i],fSymmRidge[i],1,-1);
+ fFinal1DPhi[i]->Sumw2();
+ fFinalDPhi[i] = (TH1D*)fFinal1DPhi[i]->Clone("fFinal"); // zyam: average between the two min values => sum first half of NS in the second half and second half of AS in the first half, so zyam = min/2
+ fFinalDPhi[i]->Reset();
+ fFinalDPhi[i]->Sumw2();
+
+ for(Int_t k=1;k<=bins/4;k++){
+ fFinalDPhi[i]->SetBinContent(k,0.);
+ fFinalDPhi[i]->SetBinContent(k+bins/4,fFinal1DPhi[i]->GetBinContent(k+bins/4)+fFinal1DPhi[i]->GetBinContent(bins/4+1-k));
+ fFinalDPhi[i]->SetBinError(k+bins/4,TMath::Sqrt(pow(fFinal1DPhi[i]->GetBinError(k+bins/4),2)+pow(fFinal1DPhi[i]->GetBinError(bins/4+1-k),2)));
+ fFinalDPhi[i]->SetBinContent(k+bins/2,fFinal1DPhi[i]->GetBinContent(k+bins/2)+fFinal1DPhi[i]->GetBinContent(bins+1-k));
+ fFinalDPhi[i]->SetBinError(k+bins/2,TMath::Sqrt(pow(fFinal1DPhi[i]->GetBinError(k+bins/2),2)+pow(fFinal1DPhi[i]->GetBinError(bins+1-k),2)));
+ fFinalDPhi[i]->SetBinContent(k+bins/4*3,0.);
+
+ }
+ }
+
+ else{
+
+ fFinalDPhi[i] = (TH1D*)fSignalDPhi[i]->Clone();
+ fFinalDPhi[i]->Reset();
+ fFinalDPhi[i]->Sumw2();
+ fFinalDPhi[i]->Add(fSignalDPhi[i],fSymmRidge[i],1,-1);
+ }
+
+ }
+
+ // store the pair yields in a file (the yields are *not* normalized to the Ntriggers)
+
+ TFile* file_yields = 0x0;
+ if(zyam)
+ file_yields = TFile::Open("PairYields_zyam.root","RECREATE");
+ else
+ file_yields = TFile::Open("PairYields_fit.root","RECREATE");
+
+
+ for(Int_t i=0;i<multclass;i++){
+ fDeltaEtaNch[i]->SetName(Form("DeltaEta_0_0_%d",i));
+ fDeltaEtaNch[i]->Write();
+ fDeltaPhiNch[i]->SetName(Form("Correlation bin %d in dphi",i));
+ fDeltaPhiNch[i]->Write();
+ fSignalDPhi[i]->SetName(Form("Signal_0_0_%d",i));
+ fSignalDPhi[i]->Write();
+ fRidgeDPhi[i]->SetName(Form("Ridge_0_0_%d",i));
+ fRidgeDPhi[i]->Write();
+ fSymmRidgeNotScaled[i]->SetName(Form("Symmetric_Ridge_NotScaled_0_0_%d",i));
+ fSymmRidgeNotScaled[i]->Write();
+ fSymmRidge[i]->SetName(Form("Symmetric_Ridge_0_0_%d",i));
+ fSymmRidge[i]->Write();
+ fFinalDPhi[i]->SetName(Form("Pure_Signal_0_0_%d",i));
+ fFinalDPhi[i]->Write();
+ }
+ file_yields->Close();
+
+ //-------------- CORRELATION OBSERVABLES: per-trigger yields, triggers and uncorrelated seeds
+
+ Float_t baseline[multclass]={0};
+
+ TGraphErrors *fNearSideIntegral = new TGraphErrors();
+ fNearSideIntegral->SetName("fNearSideIntegral");
+ fNearSideIntegral->SetMarkerColor(kGreen+2);
+ fNearSideIntegral->SetLineColor(kGreen+2);
+ fNearSideIntegral->SetLineWidth(1);
+ fNearSideIntegral->SetMarkerStyle(4);
+
+ TGraphErrors *fAwaySideIntegral = new TGraphErrors();
+ fAwaySideIntegral->SetName("fAwaySideIntegral");
+ fAwaySideIntegral->SetMarkerColor(kBlue);
+ fAwaySideIntegral->SetLineColor(kBlue);
+ fAwaySideIntegral->SetLineWidth(1);
+ fAwaySideIntegral->SetMarkerStyle(4);
+
+ TGraphErrors *fBothSideIntegral = new TGraphErrors();
+ fBothSideIntegral->SetName("fBothSideIntegral");
+ fBothSideIntegral->SetMarkerColor(kMagenta);
+ fBothSideIntegral->SetLineColor(kMagenta);
+ fBothSideIntegral->SetLineWidth(1);
+ fBothSideIntegral->SetMarkerStyle(4);
+
+
+ TGraphErrors *fNjets = new TGraphErrors();
+ fNjets->SetName("fNjets");
+ fNjets->SetMarkerColor(kCyan+2);
+ fNjets->SetLineColor(kCyan+2);
+ fNjets->SetLineWidth(1);
+ fNjets->SetMarkerStyle(4);
+
+ TGraphErrors *fTriggerAverage = new TGraphErrors();
+ fTriggerAverage->SetName("fTriggerAverage");
+ fTriggerAverage->SetMarkerColor(kBlack);
+ fTriggerAverage->SetLineColor(kBlack);
+ fTriggerAverage->SetLineWidth(1);
+ fTriggerAverage->SetMarkerStyle(4);
+
+ Int_t points=0;
+ Double_t minbin[multclass] = {0};
+
+ // extract information out of dphi histograms
+ TCanvas * cYields= new TCanvas("cYields", "cYields", 150, 150, 820, 620);
+ cYields->Divide(5,4);
+
+ for(Int_t i=0;i<multclass;i++){
+ cYields->cd(i+1);
+
+
+ if(zyam) {
+
+ if(fFinalDPhi[i]->Integral()>0){
+ fFinalDPhi[i]->GetXaxis()->SetRange(bins/4+1,bins/4*3);
+ baseline[i]=fFinalDPhi[i]->GetMinimum()/2;
+ minbin[i] = fFinalDPhi[i]->GetMinimumBin();
+ fFinalDPhi[i]->GetXaxis()->UnZoom();
+
+ for(Int_t k=0;k<bins;k++){
+ if(fFinalDPhi[i]->GetBinContent(k+1)!=0)
+ fFinalDPhi[i]->SetBinContent(k+1,fFinalDPhi[i]->GetBinContent(k+1)-baseline[i]);
+ else
+ fFinalDPhi[i]->SetBinContent(k+1,0.);
+ }
+
+ fFinalDPhi[i]->DrawClone("");
+
+ fFinalDPhi[i]->SetTitle(Form("0.7<p_{T,trig}<5.0 - 0.7<p_{T,assoc}<5.0 - %d-%d %",i*5,(i+1)*5));
+ fFinalDPhi[i]->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#varphi (rad^{-1})");
+ //-
+ Double_t errorNS = 0;
+ Double_t nearSideResult = (fFinalDPhi[i]->IntegralAndError(0,minbin[i],errorNS,"width"))/trigger->GetBinContent(i+1);
+ Double_t nearSideError = errorNS/trigger->GetBinContent(i+1);
+ fNearSideIntegral->SetPoint(points,i, nearSideResult);
+ fNearSideIntegral->SetPointError(points,0.5,errorNS/trigger->GetBinContent(i+1));
+ //-
+
+ //--
+ Double_t errorAS = 0;
+ Double_t awaySideResult = (fFinalDPhi[i]->IntegralAndError(minbin[i],bins,errorAS,"width"))/trigger->GetBinContent(i+1);
+ Double_t awaySideError = errorAS/trigger->GetBinContent(i+1);
+ fAwaySideIntegral->SetPoint(points,i, awaySideResult );
+ fAwaySideIntegral->SetPointError(points,0.5, errorAS/trigger->GetBinContent(i+1));
+ //--
+
+ //---
+ Double_t bothSideResult = nearSideResult + awaySideResult;
+ Double_t bothSideError = bothSideResult * TMath::Sqrt(pow(errorNS,2)+pow(errorAS,2))/trigger->GetBinContent(i+1);
+ fBothSideIntegral->SetPoint(points,i, bothSideResult );
+ fBothSideIntegral->SetPointError(points,0.5, bothSideError );
+ //---
+
+
+
+ }
+ else{
+ fNearSideIntegral->SetPoint(points,i, 0);
+ fAwaySideIntegral->SetPoint(points,i, 0);
+ fBothSideIntegral->SetPoint(points,i,0);
+ }
+ Double_t p0BinContent=p0->GetBinContent(i+1);
+ Double_t p0BinError=p0->GetBinError(i+1);
+
+ //--------
+ Double_t njets = p0BinContent/(1+bothSideResult);
+ Double_t njetsError = njets*TMath::Sqrt(bothSideError*bothSideError/(1+bothSideResult)/(1+bothSideResult)+p0BinError*p0BinError/p0BinContent/p0BinContent);
+ fNjets->SetPoint(points,i, njets );
+ fNjets->SetPointError(points,0.5,njetsError );
+
+ //-------
+
+ fTriggerAverage->SetPoint(points,i, p0BinContent);
+ fTriggerAverage->SetPointError(points,0.5, p0BinError);
+
+ }
+
+ else if (!zyam){
+
+ if(fFinalDPhi[i]->Integral()>0){
+
+ //first fit function: 2 gauss + const
+ fTotal2Gaus[i] = new TF1(Form("gaus3and2_%d",i), fitFunction2Gaus , -0.5*TMath::Pi(), 1.5*TMath::Pi(), 5);
+ fTotal2Gaus[i]->SetName(Form("gaus3_%d",i));
+ fTotal2Gaus[i]->SetParNames ("A1","sigma1","A3", "sigma3");
+ fTotal2Gaus[i]->SetLineColor(kRed);
+ fTotal2Gaus[i]->SetLineWidth(2);
+
+ baseline[i]=fFinalDPhi[i]->GetMinimum();
+ Double_t integr_for_const_2 = fFinalDPhi[i]->Integral();
+
+ fTotal2Gaus[i]->FixParameter(4,integr_for_const_2);
+ fTotal2Gaus[i]->SetParameters( fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0)) - baseline[i] , 0.6 , fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(TMath::Pi()))-baseline[i] , 0.6);
+
+ fTotal2Gaus[i]->SetParLimits(0, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0))-baseline[i])*2);
+ fTotal2Gaus[i]->SetParLimits(1, 0.01, 10);
+ fTotal2Gaus[i]->SetParLimits(2, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(TMath::Pi()))-baseline[i])*2);
+ fTotal2Gaus[i]->SetParLimits(3, 0.01, 10);
+
+ fTotal2Gaus[i]->SetLineColor(kRed);
+ fTotal2Gaus[i]->SetLineWidth(2);
+
+ fFinalDPhi[i]->Fit(fTotal2Gaus[i],flag);
+ fFinalDPhi[i]->SetMinimum(0);
+ fFinalDPhi[i]->DrawClone("");
+ fTotal2Gaus[i] ->DrawClone("same");
+
+ Double_t A11 = fTotal2Gaus[i]->GetParameter(0);
+ Double_t sigma11 = fTotal2Gaus[i]->GetParameter(1);
+ Double_t A31 = fTotal2Gaus[i]->GetParameter(2);
+ Double_t sigma31 = fTotal2Gaus[i]->GetParameter(3);
+
+ Double_t a1e1 = fTotal2Gaus[i]->GetParError(0);
+ Double_t s1e1 = fTotal2Gaus[i]->GetParError(1);
+ Double_t a3e1 = fTotal2Gaus[i]->GetParError(2);
+ Double_t s3e1 = fTotal2Gaus[i]->GetParError(3);
+
+
+ Double_t T11 = A11*sigma11;
+ Double_t T31 = A31*sigma31;
+ Double_t t11 = T11*TMath::Sqrt(a1e1*a1e1/A11/A11 + s1e1*s1e1/sigma11/sigma11);
+ Double_t t31 = T31*TMath::Sqrt(a3e1*a3e1/A31/A31 + s3e1*s3e1/sigma31/sigma31);
+
+
+ //second fit: 3 gauss + const
+ fTotal[i] = new TF1(Form("gaus3_%d",i), fitFunction , -0.5*TMath::Pi(), 1.5*TMath::Pi(), 7);
+ fTotal[i]->SetName(Form("gaus3_%d",i));
+ fTotal[i]->SetParNames ("A1","sigma1","A2","sigma2", "A3", "sigma3","integral");
+ fTotal[i]->SetLineColor(kRed);
+ fTotal[i]->SetLineWidth(2);
+
+ Double_t integr_for_const = fFinalDPhi[i]->Integral();
+
+
+ fTotal[i]->FixParameter(0,A11);
+ fTotal[i]->FixParameter(1,sigma11*1.2);
+ fTotal[i]->FixParameter(2,A11);
+ fTotal[i]->FixParameter(3,sigma11*0.7);
+ fTotal[i]->FixParameter(4,A31);
+ fTotal[i]->FixParameter(5,sigma31);
+ fTotal[i]->FixParameter(6,integr_for_const);
+
+ fTotal[i]->SetParLimits(0, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0))-baseline[i])*2);
+ fTotal[i]->SetParLimits(1, 0.3, 10);
+ fTotal[i]->SetParLimits(2, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->GetXaxis()->FindFixBin(0))-baseline[i])*2);
+ fTotal[i]->SetParLimits(3, 0.12, 0.4);
+ fTotal[i]->SetParLimits(4, 0, (fFinalDPhi[i]->GetBinContent(fFinalDPhi[i]->
+ GetXaxis()->FindFixBin(TMath::Pi()))-baseline[i])*2);
+ fTotal[i]->SetParLimits(5, 0.01, 10);
+
+ fTotal[i]->SetLineColor(kRed);
+ fTotal[i]->SetLineWidth(2);
+
+
+ fFinalDPhi[i]->Fit(fTotal[i],flag);
+ fFinalDPhi[i]->SetMinimum(0);
+ fFinalDPhi[i]->DrawClone("");
+ fFinalDPhi[i]->SetTitle(Form("0.7<p_{T,trig}<5.0 - 0.7<p_{T,assoc}<5.0 - %d-%d %",i*5,(i+1)*5));
+ fFinalDPhi[i]->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#varphi (rad^{-1})");
+ fTotal[i]->DrawClone("same");
+
+ Double_t A1 = fTotal[i]->GetParameter(0);
+ Double_t sigma1 = fTotal[i]->GetParameter(1);
+ Double_t A2 = fTotal[i]->GetParameter(2);
+ Double_t sigma2 = fTotal[i]->GetParameter(3);
+ Double_t A3 = fTotal[i]->GetParameter(4);
+ Double_t sigma3 = fTotal[i]->GetParameter(5);
+
+
+ //define each gaussian and constant to be drawn with different colors on top of each other
+
+ TF1 * fConstant = new TF1("konst", "pol0(0)",-0.5*TMath::Pi(), 1.5*TMath::Pi());
+ fConstant->SetParameter(0,(integr_for_const - TMath::Sqrt(TMath::Pi()*2)/binWidth*(A1*sigma1+A2*sigma2+A3*sigma3))/bins);
+ fConstant->SetLineColor(kBlue);
+ fConstant->Draw("same");
+
+ //gaus 1 NS
+ TF1 * fGaussian1 = new TF1("fGaussian1", "[0]*exp(-x*x/(2*[1]*[1])) +[0] * exp(-(x-TMath::TwoPi())*(x-TMath::TwoPi())/(2*[1]*[1]))",-0.5*TMath::Pi(), 1.5*TMath::Pi());
+ fGaussian1->SetParameters(fTotal[i]->GetParameter(0),fTotal[i]->GetParameter(1));
+ fGaussian1->SetLineColor(kMagenta);
+ fGaussian1->SetLineStyle(1);
+ fGaussian1->Draw("same");
+
+ //gaus 2 NS
+ TF1 * fGaussian2 = new TF1("fGaussian2", "[0]*exp(-x*x/(2*[1]*[1])) +[0] * exp(-(x-TMath::TwoPi())*(x-TMath::TwoPi())/(2*[1]*[1]))",-0.5*TMath::Pi(), 1.5*TMath::Pi());
+ fGaussian2->SetLineColor(kGreen+2);
+ fGaussian2->SetParameters(fTotal[i]->GetParameter(2),fTotal[i]->GetParameter(3));
+ fGaussian2->Draw("same");
+
+ //gaus 3 AS
+ TF1 * fGaussian3 = new TF1("fGaussian3", "[0] * exp(-((x-TMath::Pi()))*((x-TMath::Pi()))/(2*[1]*[1]))+[0] * exp(-((x+TMath::Pi()))*((x+TMath::Pi()))/(2*[1]*[1]))",-0.5*TMath::Pi(), 1.5*TMath::Pi());
+ fGaussian3->SetLineColor(kCyan);
+ fGaussian3->SetParameters(fTotal[i]->GetParameter(4), fTotal[i]->GetParameter(5));
+ fGaussian3->Draw("same");
+
+
+ Double_t a1e = fTotal[i]->GetParError(0);
+ Double_t s1e = fTotal[i]->GetParError(1);
+ Double_t a2e = fTotal[i]->GetParError(2);
+ Double_t s2e = fTotal[i]->GetParError(3);
+ Double_t a3e = fTotal[i]->GetParError(4);
+ Double_t s3e = fTotal[i]->GetParError(5);
+
+ Double_t T1 = A1*sigma1;
+ Double_t T2 = A2*sigma2;
+ Double_t T3 = A3*sigma3;
+ Double_t t1 = T1*TMath::Sqrt(a1e*a1e/A1/A1 + s1e*s1e/sigma1/sigma1);
+ Double_t t2 = T2*TMath::Sqrt(a2e*a2e/A2/A2 + s2e*s2e/sigma2/sigma2);
+ Double_t t3 = T3*TMath::Sqrt(a3e*a3e/A3/A3 + s3e*s3e/sigma3/sigma3);
+
+ //-
+ Double_t nearSideResult = TMath::Sqrt(TMath::Pi()*2)/ binWidth* (A1 * sigma1 + A2 * sigma2)/trigger->GetBinContent(i+1);
+ Double_t nearSideError = nearSideResult * TMath::Sqrt((t1*t1 + t2*t2)/(T1+T2)/(T1+T2)+ 1./trigger->GetBinContent(i+1));
+ fNearSideIntegral->SetPoint(points,i, nearSideResult);
+ fNearSideIntegral->SetPointError(points,0.5,nearSideError);
+
+ //-
+
+ //--
+ Double_t awaySideResult = TMath::Sqrt(TMath::Pi()*2)/ binWidth*
+ (A3 * sigma3)/trigger->GetBinContent(i+1);
+ Double_t awaySideError = awaySideResult*TMath::Sqrt(a3e*a3e/A3/A3 + s3e*s3e/sigma3/sigma3 + 1/trigger->GetBinContent(i+1));
+ fAwaySideIntegral->SetPoint(points,i, awaySideResult );
+ fAwaySideIntegral->SetPointError(points,0.5, awaySideError );
+ //--
+
+ //---
+ bothSideResult = TMath::Sqrt(TMath::Pi()*2)/ binWidth* (A1 * sigma1 + A2 * sigma2 + A3 * sigma3 )/trigger->GetBinContent(i+1);
+ bothSideError = nearSideResult * TMath::Sqrt((t1*t1 + t2*t2 + t3*t3)/(T1+T2+T3)/(T1+T2+T3)+ 1./trigger->GetBinContent(i+1));
+ fBothSideIntegral->SetPoint(points,i, bothSideResult );
+ fBothSideIntegral->SetPointError(points,0.5, bothSideError );
+ //---
+
+ }
+ else{
+
+ fNearSideIntegral->SetPoint(points,i, 0);
+ fAwaySideIntegral->SetPoint(points,i, 0);
+ fBothSideIntegral->SetPoint(points,i,0);
+
+ }
+ Double_t p0BinContent=p0->GetBinContent(i+1);
+ Double_t p0BinError=p0->GetBinError(i+1);
+
+ //--------
+ Double_t njets = p0BinContent/(1+bothSideResult);
+ Double_t njetsError = njets*TMath::Sqrt(bothSideError*bothSideError/(1+bothSideResult)/(1+bothSideResult) + p0BinError*p0BinError/p0BinContent/p0BinContent);
+ fNjets->SetPoint(points,i, njets );
+ fNjets->SetPointError(points,0.5,njetsError );
+ //-------
+
+ fTriggerAverage->SetPoint(points,i, p0BinContent);
+ fTriggerAverage->SetPointError(points,0.5, p0BinError);
+
+
+ }
+ points++;
+ }
+
+
+ TFile* file = 0x0;
+ if(zyam)
+ file = TFile::Open("njet_zyam.root","RECREATE");
+ else
+ file = TFile::Open("njet_fit.root","RECREATE");
+
+ fNearSideIntegral->Write();
+ fAwaySideIntegral->Write();
+ fBothSideIntegral->Write();
+ fNjets->Write();
+ fTriggerAverage->Write();
+
+ file->Close();
+
+
+
+}
+
+
-#include "TChain.h"\r
-#include "TList.h"\r
-#include "TCanvas.h"\r
-#include "TLorentzVector.h"\r
-#include "TGraphErrors.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h" \r
-#include "TH2D.h" \r
-#include "TH3D.h"\r
-#include "TArrayF.h"\r
-#include "TF1.h"\r
-#include "TRandom.h"\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliAnalysisManager.h"\r
-\r
-#include "AliESDVertex.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODTrack.h"\r
-#include "AliAODInputHandler.h"\r
-#include "AliAODMCParticle.h" \r
-#include "AliCollisionGeometry.h"\r
-#include "AliGenEventHeader.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliMCEvent.h"\r
-#include "AliStack.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliEventplane.h"\r
-#include "AliTHn.h" \r
-#include "AliLog.h"\r
-#include "AliAnalysisUtils.h"\r
-\r
-#include "AliEventPoolManager.h" \r
-\r
-#include "AliPID.h" \r
-#include "AliPIDResponse.h" \r
-#include "AliPIDCombined.h" \r
-\r
-#include "AliAnalysisTaskBFPsi.h"\r
-#include "AliBalancePsi.h"\r
-#include "AliAnalysisTaskTriggeredBF.h"\r
-\r
-\r
-// Analysis task for the BF vs Psi code\r
-// Authors: Panos.Christakoglou@nikhef.nl\r
-\r
-using std::cout;\r
-using std::endl;\r
-\r
-ClassImp(AliAnalysisTaskBFPsi)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskBFPsi::AliAnalysisTaskBFPsi(const char *name) \r
-: AliAnalysisTaskSE(name),\r
- fDebugLevel(kFALSE),\r
- fArrayMC(0), //+++++++++++++\r
- fBalance(0),\r
- fRunShuffling(kFALSE),\r
- fShuffledBalance(0),\r
- fRunMixing(kFALSE),\r
- fRunMixingEventPlane(kFALSE),\r
- fMixingTracks(50000),\r
- fMixedBalance(0),\r
- fPoolMgr(0),\r
- fList(0),\r
- fListBF(0),\r
- fListBFS(0),\r
- fListBFM(0),\r
- fHistListPIDQA(0),\r
- fHistEventStats(0),\r
- fHistCentStats(0),\r
- fHistCentStatsUsed(0),\r
- fHistTriggerStats(0),\r
- fHistTrackStats(0),\r
- fHistVx(0),\r
- fHistVy(0),\r
- fHistVz(0),\r
- fHistTPCvsVZEROMultiplicity(0),\r
- fHistVZEROSignal(0),\r
- fHistEventPlane(0),\r
- fHistClus(0),\r
- fHistDCA(0),\r
- fHistChi2(0),\r
- fHistPt(0),\r
- fHistEta(0),\r
- fHistRapidity(0),\r
- fHistPhi(0),\r
- fHistEtaPhiPos(0), \r
- fHistEtaPhiNeg(0), \r
- fHistPhiBefore(0),\r
- fHistPhiAfter(0),\r
- fHistPhiPos(0),\r
- fHistPhiNeg(0),\r
- fHistV0M(0),\r
- fHistRefTracks(0),\r
- fHistdEdxVsPTPCbeforePID(NULL),\r
- fHistBetavsPTOFbeforePID(NULL), \r
- fHistProbTPCvsPtbeforePID(NULL), \r
- fHistProbTOFvsPtbeforePID(NULL), \r
- fHistProbTPCTOFvsPtbeforePID(NULL),\r
- fHistNSigmaTPCvsPtbeforePID(NULL), \r
- fHistNSigmaTOFvsPtbeforePID(NULL), \r
- fHistBetaVsdEdXbeforePID(NULL), //+++++++ \r
- fHistNSigmaTPCTOFvsPtbeforePID(NULL), //++++++\r
- fHistdEdxVsPTPCafterPID(NULL),\r
- fHistBetavsPTOFafterPID(NULL), \r
- fHistProbTPCvsPtafterPID(NULL), \r
- fHistProbTOFvsPtafterPID(NULL), \r
- fHistProbTPCTOFvsPtafterPID(NULL),\r
- fHistNSigmaTPCvsPtafterPID(NULL), \r
- fHistNSigmaTOFvsPtafterPID(NULL), \r
- fHistBetaVsdEdXafterPID(NULL), //+++++++ \r
- fHistNSigmaTPCTOFvsPtafterPID(NULL), //+++++++\r
- fHistdEdxVsPTPCbeforePIDelectron(NULL), //+++++++\r
- fHistNSigmaTPCvsPtbeforePIDelectron(NULL), //+++++++\r
- fHistdEdxVsPTPCafterPIDelectron(NULL), //+++++++\r
- fHistNSigmaTPCvsPtafterPIDelectron(NULL), //+++++++\r
- fCentralityArrayBinsForCorrections(kCENTRALITY),\r
- fCentralityWeights(0x0),\r
- fPIDResponse(0x0),\r
- fPIDCombined(0x0),\r
- fParticleOfInterest(kPion),\r
- fPidDetectorConfig(kTPCTOF),\r
- fUsePID(kFALSE),\r
- fUsePIDnSigma(kTRUE),\r
- fUsePIDPropabilities(kFALSE), \r
- fPIDNSigma(3.),\r
- fMinAcceptedPIDProbability(0.8),\r
- fElectronRejection(kFALSE),\r
- fElectronOnlyRejection(kFALSE),\r
- fElectronRejectionNSigma(-1.),\r
- fElectronRejectionMinPt(0.),\r
- fElectronRejectionMaxPt(1000.),\r
- fESDtrackCuts(0),\r
- fCentralityEstimator("V0M"),\r
- fUseCentrality(kFALSE),\r
- fCentralityPercentileMin(0.), \r
- fCentralityPercentileMax(5.),\r
- fImpactParameterMin(0.),\r
- fImpactParameterMax(20.),\r
- fMultiplicityEstimator("V0A"),\r
- fUseMultiplicity(kFALSE),\r
- fNumberOfAcceptedTracksMin(0),\r
- fNumberOfAcceptedTracksMax(10000),\r
- fHistNumberOfAcceptedTracks(0),\r
- fHistMultiplicity(0),\r
- fUseOfflineTrigger(kFALSE),\r
- fCheckFirstEventInChunk(kFALSE),\r
- fCheckPileUp(kFALSE),\r
- fCheckPrimaryFlagAOD(kFALSE),\r
- fUseMCforKinematics(kFALSE),\r
- fVxMax(0.3),\r
- fVyMax(0.3),\r
- fVzMax(10.),\r
- fnAODtrackCutBit(128),\r
- fPtMin(0.3),\r
- fPtMax(1.5),\r
- fPtMinForCorrections(0.3),//=================================correction\r
- fPtMaxForCorrections(1.5),//=================================correction\r
- fPtBinForCorrections(36), //=================================correction\r
- fEtaMin(-0.8),\r
- fEtaMax(-0.8),\r
- fEtaMinForCorrections(-0.8),//=================================correction\r
- fEtaMaxForCorrections(0.8),//=================================correction\r
- fEtaBinForCorrections(16), //=================================correction\r
- fPhiMin(0.),\r
- fPhiMax(360.),\r
- fPhiMinForCorrections(0.),//=================================correction\r
- fPhiMaxForCorrections(360.),//=================================correction\r
- fPhiBinForCorrections(100), //=================================correction\r
- fDCAxyCut(-1),\r
- fDCAzCut(-1),\r
- fTPCchi2Cut(-1),\r
- fNClustersTPCCut(-1),\r
- fAcceptanceParameterization(0),\r
- fDifferentialV2(0),\r
- fUseFlowAfterBurner(kFALSE),\r
- fExcludeResonancesInMC(kFALSE),\r
- fExcludeElectronsInMC(kFALSE),\r
- fUseMCPdgCode(kFALSE),\r
- fPDGCodeToBeAnalyzed(-1),\r
- fEventClass("EventPlane"), \r
- fCustomBinning(""),\r
- fHistVZEROAGainEqualizationMap(0),\r
- fHistVZEROCGainEqualizationMap(0),\r
- fHistVZEROChannelGainEqualizationMap(0) {\r
- // Constructor\r
- // Define input and output slots here\r
- // Input slot #0 works with a TChain\r
-\r
- //======================================================correction\r
- for (Int_t i=0; i<kCENTRALITY; i++){\r
- fHistCorrectionPlus[i] = NULL; \r
- fHistCorrectionMinus[i] = NULL; \r
- fCentralityArrayForCorrections[i] = -1.;\r
- }\r
- //=====================================================correction\r
-\r
- DefineInput(0, TChain::Class());\r
- // Output slot #0 writes into a TH1 container\r
- DefineOutput(1, TList::Class());\r
- DefineOutput(2, TList::Class());\r
- DefineOutput(3, TList::Class());\r
- DefineOutput(4, TList::Class());\r
- DefineOutput(5, TList::Class());\r
-}\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskBFPsi::~AliAnalysisTaskBFPsi() {\r
-\r
- // delete fBalance; \r
- // delete fShuffledBalance; \r
- // delete fList;\r
- // delete fListBF; \r
- // delete fListBFS;\r
-\r
- // delete fHistEventStats; \r
- // delete fHistTrackStats; \r
- // delete fHistVx; \r
- // delete fHistVy; \r
- // delete fHistVz; \r
-\r
- // delete fHistClus;\r
- // delete fHistDCA;\r
- // delete fHistChi2;\r
- // delete fHistPt;\r
- // delete fHistEta;\r
- // delete fHistPhi;\r
- // delete fHistEtaPhiPos; \r
- // delete fHistEtaPhiNeg;\r
- // delete fHistV0M;\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskBFPsi::UserCreateOutputObjects() {\r
- // Create histograms\r
- // Called once\r
-\r
- // global switch disabling the reference \r
- // (to avoid "Replacing existing TH1" if several wagons are created in train)\r
- Bool_t oldStatus = TH1::AddDirectoryStatus();\r
- TH1::AddDirectory(kFALSE);\r
-\r
- if(!fBalance) {\r
- fBalance = new AliBalancePsi();\r
- fBalance->SetAnalysisLevel("ESD");\r
- fBalance->SetEventClass(fEventClass);\r
- //fBalance->SetNumberOfBins(-1,16);\r
- //fBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6,15.);\r
- }\r
- if(fRunShuffling) {\r
- if(!fShuffledBalance) {\r
- fShuffledBalance = new AliBalancePsi();\r
- fShuffledBalance->SetAnalysisLevel("ESD");\r
- fShuffledBalance->SetEventClass(fEventClass);\r
- //fShuffledBalance->SetNumberOfBins(-1,16);\r
- //fShuffledBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6,15.);\r
- }\r
- }\r
- if(fRunMixing) {\r
- if(!fMixedBalance) {\r
- fMixedBalance = new AliBalancePsi();\r
- fMixedBalance->SetAnalysisLevel("ESD");\r
- fMixedBalance->SetEventClass(fEventClass);\r
- }\r
- }\r
-\r
- //QA list\r
- fList = new TList();\r
- fList->SetName("listQA");\r
- fList->SetOwner();\r
-\r
- //Balance Function list\r
- fListBF = new TList();\r
- fListBF->SetName("listBF");\r
- fListBF->SetOwner();\r
-\r
- if(fRunShuffling) {\r
- fListBFS = new TList();\r
- fListBFS->SetName("listBFShuffled");\r
- fListBFS->SetOwner();\r
- }\r
-\r
- if(fRunMixing) {\r
- fListBFM = new TList();\r
- fListBFM->SetName("listTriggeredBFMixed");\r
- fListBFM->SetOwner();\r
- }\r
-\r
- //PID QA list\r
- if(fUsePID || fElectronRejection) {\r
- fHistListPIDQA = new TList();\r
- fHistListPIDQA->SetName("listQAPID");\r
- fHistListPIDQA->SetOwner();\r
- }\r
-\r
- //Event stats.\r
- TString gCutName[7] = {"Total","Offline trigger",\r
- "Vertex","Analyzed","sel. Centrality","Not1stEvInChunk","No Pile-Up"};\r
- fHistEventStats = new TH2F("fHistEventStats",\r
- "Event statistics;;Centrality percentile;N_{events}",\r
- 7,0.5,7.5,220,-5,105);\r
- for(Int_t i = 1; i <= 7; i++)\r
- fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1].Data());\r
- fList->Add(fHistEventStats);\r
-\r
- TString gCentName[13] = {"V0M","V0A","V0C","FMD","TRK","TKL","CL0","CL1","ZNA","ZPA","V0MvsFMD","TKLvsV0M","ZEMvsZDC"};\r
- fHistCentStats = new TH2F("fHistCentStats",\r
- "Centrality statistics;;Cent percentile",\r
- 13,-0.5,12.5,220,-5,105);\r
- for(Int_t i = 1; i <= 13; i++){\r
- fHistCentStats->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());\r
- //fHistCentStatsUsed->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());\r
- }\r
- fList->Add(fHistCentStats);\r
-\r
- fHistCentStatsUsed = new TH2F("fHistCentStatsUsed","Centrality statistics;;Cent percentile", 1,-0.5,0.5,220,-5,105);\r
- fHistCentStatsUsed->GetXaxis()->SetBinLabel(1,fCentralityEstimator.Data());\r
- fList->Add(fHistCentStatsUsed);\r
-\r
- fHistTriggerStats = new TH1F("fHistTriggerStats","Trigger statistics;TriggerBit;N_{events}",1025,0,1025);\r
- fList->Add(fHistTriggerStats);\r
-\r
- fHistTrackStats = new TH1F("fHistTrackStats","Event statistics;TrackFilterBit;N_{events}",16,0,16);\r
- fList->Add(fHistTrackStats);\r
-\r
- fHistNumberOfAcceptedTracks = new TH2F("fHistNumberOfAcceptedTracks",";N_{acc.};Centrality percentile;Entries",4001,-0.5,4000.5,220,-5,105);\r
- fList->Add(fHistNumberOfAcceptedTracks);\r
-\r
- fHistMultiplicity = new TH1F("fHistMultiplicity",";N_{ch.};Entries",30001,-0.5,30000.5);\r
- fList->Add(fHistMultiplicity);\r
-\r
- // Vertex distributions\r
- fHistVx = new TH1F("fHistVx","Primary vertex distribution - x coordinate;V_{x} (cm);Entries",100,-0.5,0.5);\r
- fList->Add(fHistVx);\r
- fHistVy = new TH1F("fHistVy","Primary vertex distribution - y coordinate;V_{y} (cm);Entries",100,-0.5,0.5);\r
- fList->Add(fHistVy);\r
- fHistVz = new TH2F("fHistVz","Primary vertex distribution - z coordinate;V_{z} (cm);Centrality percentile;Entries",100,-20.,20.,220,-5,105);\r
- fList->Add(fHistVz);\r
-\r
- //TPC vs VZERO multiplicity\r
- fHistTPCvsVZEROMultiplicity = new TH2F("fHistTPCvsVZEROMultiplicity","VZERO vs TPC multiplicity",10001,-0.5,10000.5,4001,-0.5,4000.5);\r
- if(fMultiplicityEstimator == "V0A") \r
- fHistTPCvsVZEROMultiplicity->GetXaxis()->SetTitle("VZERO-A multiplicity (a.u.)");\r
- else if(fMultiplicityEstimator == "V0C") \r
- fHistTPCvsVZEROMultiplicity->GetXaxis()->SetTitle("VZERO-C multiplicity (a.u.)");\r
- else \r
- fHistTPCvsVZEROMultiplicity->GetXaxis()->SetTitle("VZERO multiplicity (a.u.)");\r
- fList->Add(fHistTPCvsVZEROMultiplicity);\r
-\r
- fHistVZEROSignal = new TH2F("fHistVZEROSignal","VZERO signal vs VZERO channel;VZERO channel; Signal (a.u.)",64,0.5,64.5,3001,-0.5,30000.5);\r
- fList->Add(fHistVZEROSignal);\r
-\r
- //Event plane\r
- fHistEventPlane = new TH2F("fHistEventPlane",";#Psi_{2} [deg.];Centrality percentile;Counts",100,0,360.,220,-5,105);\r
- fList->Add(fHistEventPlane);\r
-\r
- // QA histograms\r
- fHistClus = new TH2F("fHistClus","# Cluster (TPC vs. ITS)",10,0,10,200,0,200);\r
- fList->Add(fHistClus);\r
- fHistChi2 = new TH2F("fHistChi2","Chi2/NDF distribution;#chi^{2}/ndf;Centrality percentile",200,0,10,220,-5,105);\r
- fList->Add(fHistChi2);\r
- fHistDCA = new TH2F("fHistDCA","DCA (xy vs. z)",400,-5,5,400,-5,5); \r
- fList->Add(fHistDCA);\r
- fHistPt = new TH2F("fHistPt","p_{T} distribution;p_{T} (GeV/c);Centrality percentile",200,0,10,220,-5,105);\r
- fList->Add(fHistPt);\r
- fHistEta = new TH2F("fHistEta","#eta distribution;#eta;Centrality percentile",200,-2,2,220,-5,105);\r
- fList->Add(fHistEta);\r
- fHistRapidity = new TH2F("fHistRapidity","y distribution;y;Centrality percentile",200,-2,2,220,-5,105);\r
- fList->Add(fHistRapidity);\r
- fHistPhi = new TH2F("fHistPhi","#phi distribution;#phi (rad);Centrality percentile",200,0.0,2.*TMath::Pi(),220,-5,105);\r
- fList->Add(fHistPhi);\r
- fHistEtaPhiPos = new TH3F("fHistEtaPhiPos","#eta-#phi distribution (+);#eta;#phi (rad);Centrality percentile",80,-2,2,72,0.0,2.*TMath::Pi(),220,-5,105); \r
- fList->Add(fHistEtaPhiPos); \r
- fHistEtaPhiNeg = new TH3F("fHistEtaPhiNeg","#eta-#phi distribution (-);#eta;#phi (rad);Centrality percentile",80,-2,2,72,0.0,2.*TMath::Pi(),220,-5,105); \r
- fList->Add(fHistEtaPhiNeg);\r
- fHistPhiBefore = new TH2F("fHistPhiBefore","#phi distribution;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);\r
- fList->Add(fHistPhiBefore);\r
- fHistPhiAfter = new TH2F("fHistPhiAfter","#phi distribution;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);\r
- fList->Add(fHistPhiAfter);\r
- fHistPhiPos = new TH2F("fHistPhiPos","#phi distribution for positive particles;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);\r
- fList->Add(fHistPhiPos);\r
- fHistPhiNeg = new TH2F("fHistPhiNeg","#phi distribution for negative particles;#phi;Centrality percentile",200,0.,2.*TMath::Pi(),220,-5,105);\r
- fList->Add(fHistPhiNeg);\r
- fHistV0M = new TH2F("fHistV0M","V0 Multiplicity C vs. A",500, 0, 20000, 500, 0, 20000);\r
- fList->Add(fHistV0M);\r
- TString gRefTrackName[6] = {"tracks","tracksPos","tracksNeg","tracksTPConly","clusITS0","clusITS1"};\r
- fHistRefTracks = new TH2F("fHistRefTracks","Nr of Ref tracks/event vs. ref track estimator;;Nr of tracks",6, 0, 6, 400, 0, 20000);\r
- for(Int_t i = 1; i <= 6; i++)\r
- fHistRefTracks->GetXaxis()->SetBinLabel(i,gRefTrackName[i-1].Data());\r
- fList->Add(fHistRefTracks);\r
-\r
- // Balance function histograms\r
- // Initialize histograms if not done yet (including the custom binning)\r
- if(!fBalance->GetHistNp()){\r
- AliInfo("Histograms not yet initialized! --> Will be done now");\r
- fBalance->SetCustomBinning(fCustomBinning);\r
- fBalance->InitHistograms();\r
- }\r
-\r
- if(fRunShuffling) {\r
- if(!fShuffledBalance->GetHistNp()) {\r
- AliInfo("Histograms (shuffling) not yet initialized! --> Will be done now");\r
- fShuffledBalance->SetCustomBinning(fCustomBinning);\r
- fShuffledBalance->InitHistograms();\r
- }\r
- }\r
-\r
- if(fRunMixing) {\r
- if(!fMixedBalance->GetHistNp()) {\r
- AliInfo("Histograms (mixing) not yet initialized! --> Will be done now");\r
- fMixedBalance->SetCustomBinning(fCustomBinning);\r
- fMixedBalance->InitHistograms();\r
- }\r
- }\r
-\r
- // QA histograms for different cuts\r
- fList->Add(fBalance->GetQAHistHBTbefore());\r
- fList->Add(fBalance->GetQAHistHBTafter());\r
- fList->Add(fBalance->GetQAHistConversionbefore());\r
- fList->Add(fBalance->GetQAHistConversionafter());\r
- fList->Add(fBalance->GetQAHistPsiMinusPhi());\r
- fList->Add(fBalance->GetQAHistResonancesBefore());\r
- fList->Add(fBalance->GetQAHistResonancesRho());\r
- fList->Add(fBalance->GetQAHistResonancesK0());\r
- fList->Add(fBalance->GetQAHistResonancesLambda());\r
- fList->Add(fBalance->GetQAHistQbefore());\r
- fList->Add(fBalance->GetQAHistQafter());\r
-\r
- //for(Int_t a = 0; a < ANALYSIS_TYPES; a++){\r
- fListBF->Add(fBalance->GetHistNp());\r
- fListBF->Add(fBalance->GetHistNn());\r
- fListBF->Add(fBalance->GetHistNpn());\r
- fListBF->Add(fBalance->GetHistNnn());\r
- fListBF->Add(fBalance->GetHistNpp());\r
- fListBF->Add(fBalance->GetHistNnp());\r
-\r
- if(fRunShuffling) {\r
- fListBFS->Add(fShuffledBalance->GetHistNp());\r
- fListBFS->Add(fShuffledBalance->GetHistNn());\r
- fListBFS->Add(fShuffledBalance->GetHistNpn());\r
- fListBFS->Add(fShuffledBalance->GetHistNnn());\r
- fListBFS->Add(fShuffledBalance->GetHistNpp());\r
- fListBFS->Add(fShuffledBalance->GetHistNnp());\r
- } \r
-\r
- if(fRunMixing) {\r
- fListBFM->Add(fMixedBalance->GetHistNp());\r
- fListBFM->Add(fMixedBalance->GetHistNn());\r
- fListBFM->Add(fMixedBalance->GetHistNpn());\r
- fListBFM->Add(fMixedBalance->GetHistNnn());\r
- fListBFM->Add(fMixedBalance->GetHistNpp());\r
- fListBFM->Add(fMixedBalance->GetHistNnp());\r
- }\r
- //}\r
-\r
-\r
- // Event Mixing\r
- if(fRunMixing){\r
- Int_t trackDepth = fMixingTracks; \r
- Int_t poolsize = 1000; // Maximum number of events, ignored in the present implemented of AliEventPoolManager\r
- \r
- // centrality bins\r
- Double_t* centbins = NULL;\r
- Int_t nCentralityBins;\r
- if(fBalance->IsUseVertexBinning()){\r
- centbins = fBalance->GetBinning(fBalance->GetBinningString(), "centralityVertex", nCentralityBins);\r
- }\r
- else{\r
- centbins = fBalance->GetBinning(fBalance->GetBinningString(), "centrality", nCentralityBins);\r
- }\r
- \r
- // multiplicity bins\r
- Double_t* multbins = NULL;\r
- Int_t nMultiplicityBins;\r
- multbins = fBalance->GetBinning(fBalance->GetBinningString(), "multiplicity", nMultiplicityBins);\r
- \r
- // Zvtx bins\r
- Double_t* vtxbins = NULL; \r
- Int_t nVertexBins;\r
- if(fBalance->IsUseVertexBinning()){\r
- vtxbins = fBalance->GetBinning(fBalance->GetBinningString(), "vertexVertex", nVertexBins);\r
- }\r
- else{\r
- vtxbins = fBalance->GetBinning(fBalance->GetBinningString(), "vertex", nVertexBins);\r
- }\r
-\r
- // Event plane angle (Psi) bins\r
- Double_t* psibins = NULL;\r
- Int_t nPsiBins; \r
- psibins = fBalance->GetBinning(fBalance->GetBinningString(), "eventPlane", nPsiBins);\r
-\r
- \r
- // run the event mixing also in bins of event plane (statistics!)\r
- if(fRunMixingEventPlane){\r
- if(fEventClass=="Multiplicity"){\r
- if(multbins && vtxbins && psibins){\r
- fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nMultiplicityBins, multbins, nVertexBins, vtxbins, nPsiBins, psibins);\r
- }\r
- }\r
- else{\r
- if(centbins && vtxbins && psibins){\r
- fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins, nPsiBins, psibins);\r
- }\r
- }\r
- }\r
- else{\r
- if(fEventClass=="Multiplicity"){\r
- if(multbins && vtxbins){\r
- fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nMultiplicityBins, multbins, nVertexBins, vtxbins);\r
- }\r
- }\r
- else{\r
- if(centbins && vtxbins){\r
- fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins);\r
- }\r
- }\r
- }\r
-\r
- // check pool manager\r
- if(!fPoolMgr){\r
- AliError("Event Mixing required, but Pool Manager not initialized...");\r
- return;\r
- }\r
- }\r
- \r
- if(fESDtrackCuts) fList->Add(fESDtrackCuts);\r
-\r
- //====================PID========================//\r
- if(fUsePID) {\r
- fPIDCombined = new AliPIDCombined();\r
- fPIDCombined->SetDefaultTPCPriors();\r
-\r
- fHistdEdxVsPTPCbeforePID = new TH2D ("dEdxVsPTPCbefore","dEdxVsPTPCbefore", 1000, -10.0, 10.0, 1000, 0, 1000); \r
- fHistListPIDQA->Add(fHistdEdxVsPTPCbeforePID);\r
- \r
- fHistBetavsPTOFbeforePID = new TH2D ("BetavsPTOFbefore","BetavsPTOFbefore", 1000, -10.0, 10., 1000, 0, 1.2); \r
- fHistListPIDQA->Add(fHistBetavsPTOFbeforePID); \r
- \r
- fHistProbTPCvsPtbeforePID = new TH2D ("ProbTPCvsPtbefore","ProbTPCvsPtbefore", 1000, -10.0,10.0, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTPCvsPtbeforePID); \r
- \r
- fHistProbTOFvsPtbeforePID = new TH2D ("ProbTOFvsPtbefore","ProbTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTOFvsPtbeforePID);\r
-\r
- fHistProbTPCTOFvsPtbeforePID =new TH2D ("ProbTPCTOFvsPtbefore","ProbTPCTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTPCTOFvsPtbeforePID);\r
- \r
- fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePID);\r
- \r
- fHistNSigmaTOFvsPtbeforePID = new TH2D ("NSigmaTOFvsPtbefore","NSigmaTOFvsPtbefore", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTOFvsPtbeforePID); \r
-\r
- fHistBetaVsdEdXbeforePID = new TH2D ("BetaVsdEdXbefore","BetaVsdEdXbefore", 1000, 0., 1000, 1000, 0, 1.2); \r
- fHistListPIDQA->Add(fHistBetaVsdEdXbeforePID); //++++++++\r
- \r
- fHistNSigmaTPCTOFvsPtbeforePID = new TH2D ("NSigmaTPCTOFvsPtbefore","NSigmaTPCTOFvsPtbefore", 1000, -10., 10., 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtbeforePID); //++++++++\r
- \r
- fHistdEdxVsPTPCafterPID = new TH2D ("dEdxVsPTPCafter","dEdxVsPTPCafter", 1000, -10, 10, 1000, 0, 1000); \r
- fHistListPIDQA->Add(fHistdEdxVsPTPCafterPID);\r
- \r
- fHistBetavsPTOFafterPID = new TH2D ("BetavsPTOFafter","BetavsPTOFafter", 1000, -10, 10, 1000, 0, 1.2); \r
- fHistListPIDQA->Add(fHistBetavsPTOFafterPID); \r
- \r
- fHistProbTPCvsPtafterPID = new TH2D ("ProbTPCvsPtafter","ProbTPCvsPtafter", 1000, -10, 10, 1000, 0, 2); \r
- fHistListPIDQA->Add(fHistProbTPCvsPtafterPID);\r
- \r
- fHistProbTOFvsPtafterPID = new TH2D ("ProbTOFvsPtafter","ProbTOFvsPtafter", 1000, -10, 10, 1000, 0, 2); \r
- fHistListPIDQA->Add(fHistProbTOFvsPtafterPID); \r
- \r
- fHistProbTPCTOFvsPtafterPID =new TH2D ("ProbTPCTOFvsPtafter","ProbTPCTOFvsPtafter", 1000, -50, 50, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTPCTOFvsPtafterPID);\r
-\r
- fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPID);\r
- \r
- fHistNSigmaTOFvsPtafterPID = new TH2D ("NSigmaTOFvsPtafter","NSigmaTOFvsPtafter", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTOFvsPtafterPID);\r
-\r
- fHistBetaVsdEdXafterPID = new TH2D ("BetaVsdEdXafter","BetaVsdEdXafter", 1000, 0., 1000, 1000, 0, 1.2); \r
- fHistListPIDQA->Add(fHistBetaVsdEdXafterPID); //++++++++\r
-\r
- fHistNSigmaTPCTOFvsPtafterPID = new TH2D ("NSigmaTPCTOFvsPtafter","NSigmaTPCTOFvsPtafter", 1000, -10., 10., 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtafterPID); //++++++++\r
- }\r
-\r
- // for electron rejection only TPC nsigma histograms\r
- if(fElectronRejection) {\r
- \r
- fHistdEdxVsPTPCbeforePIDelectron = new TH2D ("dEdxVsPTPCbeforeelectron","dEdxVsPTPCbeforeelectron", 1000, -10.0, 10.0, 1000, 0, 1000); \r
- fHistListPIDQA->Add(fHistdEdxVsPTPCbeforePIDelectron);\r
- \r
- fHistNSigmaTPCvsPtbeforePIDelectron = new TH2D ("NSigmaTPCvsPtbeforeelectron","NSigmaTPCvsPtbeforeelectron", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePIDelectron);\r
- \r
- fHistdEdxVsPTPCafterPIDelectron = new TH2D ("dEdxVsPTPCafterelectron","dEdxVsPTPCafterelectron", 1000, -10, 10, 1000, 0, 1000); \r
- fHistListPIDQA->Add(fHistdEdxVsPTPCafterPIDelectron);\r
-\r
- fHistNSigmaTPCvsPtafterPIDelectron = new TH2D ("NSigmaTPCvsPtafterelectron","NSigmaTPCvsPtafterelectron", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPIDelectron); \r
- }\r
- //====================PID========================//\r
-\r
- // Post output data.\r
- PostData(1, fList);\r
- PostData(2, fListBF);\r
- if(fRunShuffling) PostData(3, fListBFS);\r
- if(fRunMixing) PostData(4, fListBFM);\r
- if(fUsePID || fElectronRejection) PostData(5, fHistListPIDQA); //PID\r
-\r
- AliInfo("Finished setting up the Output");\r
-\r
- TH1::AddDirectory(oldStatus);\r
-}\r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskBFPsi::SetInputCorrection(TString filename, \r
- Int_t nCentralityBins, \r
- Double_t *centralityArrayForCorrections) {\r
- //Open files that will be used for correction\r
- fCentralityArrayBinsForCorrections = nCentralityBins;\r
- for (Int_t i=0; i<nCentralityBins; i++)\r
- fCentralityArrayForCorrections[i] = centralityArrayForCorrections[i];\r
-\r
- // No file specified -> run without corrections\r
- if(!filename.Contains(".root")) {\r
- AliInfo(Form("No correction file specified (= %s) --> run without corrections",filename.Data()));\r
- return;\r
- }\r
-\r
- //Open the input file\r
- TFile *f = TFile::Open(filename);\r
- if(!f->IsOpen()) {\r
- AliInfo(Form("File %s not found --> run without corrections",filename.Data()));\r
- return;\r
- }\r
- \r
- //TString listEffName = "";\r
- for (Int_t iCent = 0; iCent < fCentralityArrayBinsForCorrections-1; iCent++) { \r
- //Printf("iCent %d:",iCent); \r
- TString histoName = "fHistCorrectionPlus";\r
- histoName += Form("%d-%d",(Int_t)(fCentralityArrayForCorrections[iCent]),(Int_t)(fCentralityArrayForCorrections[iCent+1]));\r
- fHistCorrectionPlus[iCent]= dynamic_cast<TH3F *>(f->Get(histoName.Data()));\r
- if(!fHistCorrectionPlus[iCent]) {\r
- AliError(Form("fHist %s not found!!!",histoName.Data()));\r
- return;\r
- }\r
- \r
- histoName = "fHistCorrectionMinus";\r
- histoName += Form("%d-%d",(Int_t)(fCentralityArrayForCorrections[iCent]),(Int_t)(fCentralityArrayForCorrections[iCent+1]));\r
- fHistCorrectionMinus[iCent] = dynamic_cast<TH3F *>(f->Get(histoName.Data())); \r
- if(!fHistCorrectionMinus[iCent]) {\r
- AliError(Form("fHist %s not found!!!",histoName.Data()));\r
- return; \r
- }\r
- }//loop over centralities: ONLY the PbPb case is covered\r
-\r
- if(fHistCorrectionPlus[0]){\r
- fEtaMinForCorrections = fHistCorrectionPlus[0]->GetXaxis()->GetXmin();\r
- fEtaMaxForCorrections = fHistCorrectionPlus[0]->GetXaxis()->GetXmax();\r
- fEtaBinForCorrections = fHistCorrectionPlus[0]->GetNbinsX();\r
- \r
- fPtMinForCorrections = fHistCorrectionPlus[0]->GetYaxis()->GetXmin();\r
- fPtMaxForCorrections = fHistCorrectionPlus[0]->GetYaxis()->GetXmax();\r
- fPtBinForCorrections = fHistCorrectionPlus[0]->GetNbinsY();\r
- \r
- fPhiMinForCorrections = fHistCorrectionPlus[0]->GetZaxis()->GetXmin();\r
- fPhiMaxForCorrections = fHistCorrectionPlus[0]->GetZaxis()->GetXmax();\r
- fPhiBinForCorrections = fHistCorrectionPlus[0]->GetNbinsZ();\r
- }\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskBFPsi::UserExec(Option_t *) {\r
- // Main loop\r
- // Called for each event\r
-\r
- TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
- Int_t gNumberOfAcceptedTracks = 0;\r
- Double_t lMultiplicityVar = -999.; //-1\r
- Double_t gReactionPlane = -1.; \r
- Float_t bSign = 0.;\r
- \r
- // get the event (for generator level: MCEvent())\r
- AliVEvent* eventMain = NULL;\r
- if(gAnalysisLevel == "MC") {\r
- eventMain = dynamic_cast<AliVEvent*>(MCEvent()); \r
- }\r
- else{\r
- eventMain = dynamic_cast<AliVEvent*>(InputEvent()); \r
- // for HBT like cuts need magnetic field sign\r
- bSign = (eventMain->GetMagneticField() > 0) ? 1 : -1;\r
- }\r
- if(!eventMain) {\r
- AliError("eventMain not available");\r
- return;\r
- }\r
- \r
- // PID Response task active?\r
- if(fUsePID || fElectronRejection) {\r
- fPIDResponse = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetPIDResponse();\r
- if (!fPIDResponse) AliFatal("This Task needs the PID response attached to the inputHandler");\r
- }\r
- \r
- // check event cuts and fill event histograms\r
- if((lMultiplicityVar = IsEventAccepted(eventMain)) < 0){ \r
- return;\r
- }\r
- // get the reaction plane\r
- if(fEventClass != "Multiplicity") {\r
- gReactionPlane = GetEventPlane(eventMain);\r
- fHistEventPlane->Fill(gReactionPlane,lMultiplicityVar);\r
- if(gReactionPlane < 0){\r
- return;\r
- }\r
- }\r
- \r
- // get the accepted tracks in main event\r
- TObjArray *tracksMain = GetAcceptedTracks(eventMain,lMultiplicityVar,gReactionPlane);\r
- gNumberOfAcceptedTracks = tracksMain->GetEntriesFast();\r
-\r
- //multiplicity cut (used in pp)\r
- fHistNumberOfAcceptedTracks->Fill(gNumberOfAcceptedTracks,lMultiplicityVar);\r
-\r
- // store charges of all accepted tracks,shuffle and reassign(two extra loops)\r
- TObjArray* tracksShuffled = NULL;\r
- if(fRunShuffling){\r
- tracksShuffled = GetShuffledTracks(tracksMain,lMultiplicityVar);\r
- }\r
- \r
- // Event mixing \r
- if (fRunMixing)\r
- {\r
- // 1. First get an event pool corresponding in mult (cent) and\r
- // zvertex to the current event. Once initialized, the pool\r
- // should contain nMix (reduced) events. This routine does not\r
- // pre-scan the chain. The first several events of every chain\r
- // will be skipped until the needed pools are filled to the\r
- // specified depth. If the pool categories are not too rare, this\r
- // should not be a problem. If they are rare, you could lose`\r
- // statistics.\r
- \r
- // 2. Collect the whole pool's content of tracks into one TObjArray\r
- // (bgTracks), which is effectively a single background super-event.\r
- \r
- // 3. The reduced and bgTracks arrays must both be passed into\r
- // FillCorrelations(). Also nMix should be passed in, so a weight\r
- // of 1./nMix can be applied.\r
- \r
- AliEventPool* pool = fPoolMgr->GetEventPool(lMultiplicityVar, eventMain->GetPrimaryVertex()->GetZ(),gReactionPlane);\r
- \r
- if (!pool){\r
- AliFatal(Form("No pool found for centrality = %f, zVtx = %f, psi = %f", lMultiplicityVar, eventMain->GetPrimaryVertex()->GetZ(),gReactionPlane));\r
- }\r
- else{\r
- \r
- //pool->SetDebug(1);\r
-\r
- if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5){ \r
- \r
- \r
- Int_t nMix = pool->GetCurrentNEvents();\r
- //cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl;\r
- \r
- //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(2);\r
- //((TH2F*) fListOfHistos->FindObject("mixedDist"))->Fill(centrality, pool->NTracksInPool());\r
- //if (pool->IsReady())\r
- //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(3);\r
- \r
- // Fill mixed-event histos here \r
- for (Int_t jMix=0; jMix<nMix; jMix++) \r
- {\r
- TObjArray* tracksMixed = pool->GetEvent(jMix);\r
- fMixedBalance->CalculateBalance(gReactionPlane,tracksMain,tracksMixed,bSign,lMultiplicityVar,eventMain->GetPrimaryVertex()->GetZ());\r
- }\r
- }\r
- \r
- // Update the Event pool\r
- pool->UpdatePool(tracksMain);\r
- //pool->PrintInfo();\r
- \r
- }//pool NULL check \r
- }//run mixing\r
- \r
- // calculate balance function\r
- fBalance->CalculateBalance(gReactionPlane,tracksMain,NULL,bSign,lMultiplicityVar,eventMain->GetPrimaryVertex()->GetZ());\r
- \r
- // calculate shuffled balance function\r
- if(fRunShuffling && tracksShuffled != NULL) {\r
- fShuffledBalance->CalculateBalance(gReactionPlane,tracksShuffled,NULL,bSign,lMultiplicityVar,eventMain->GetPrimaryVertex()->GetZ());\r
- }\r
-} \r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::IsEventAccepted(AliVEvent *event){\r
- // Checks the Event cuts\r
- // Fills Event statistics histograms\r
- \r
- Bool_t isSelectedMain = kTRUE;\r
- Float_t gRefMultiplicity = -1.;\r
- TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
-\r
- AliMCEvent *mcevent = dynamic_cast<AliMCEvent*>(event);\r
-\r
- fHistEventStats->Fill(1,gRefMultiplicity); //all events\r
-\r
- // check first event in chunk (is not needed for new reconstructions)\r
- if(fCheckFirstEventInChunk){\r
- AliAnalysisUtils ut;\r
- if(ut.IsFirstEventInChunk(event)) \r
- return -1.;\r
- fHistEventStats->Fill(6,gRefMultiplicity); \r
- }\r
- // check for pile-up event\r
- if(fCheckPileUp){\r
- AliAnalysisUtils ut;\r
- ut.SetUseMVPlpSelection(kTRUE);\r
- ut.SetUseOutOfBunchPileUp(kTRUE);\r
- if(ut.IsPileUpEvent(event))\r
- return -1.;\r
- fHistEventStats->Fill(7,gRefMultiplicity); \r
- }\r
-\r
- // Event trigger bits\r
- fHistTriggerStats->Fill(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected());\r
- if(fUseOfflineTrigger)\r
- isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
- \r
- if(isSelectedMain) {\r
- fHistEventStats->Fill(2,gRefMultiplicity); //triggered events\r
- \r
- // Event Vertex MC\r
- if(gAnalysisLevel == "MC") {\r
- if(!event) {\r
- AliError("mcEvent not available");\r
- return 0x0;\r
- }\r
- \r
- if(mcevent){\r
- AliGenEventHeader *header = dynamic_cast<AliGenEventHeader*>(mcevent->GenEventHeader());\r
- if(header){ \r
- TArrayF gVertexArray;\r
- header->PrimaryVertex(gVertexArray);\r
- //Printf("Vertex: %lf (x) - %lf (y) - %lf (z)",\r
- //gVertexArray.At(0),\r
- //gVertexArray.At(1),\r
- //gVertexArray.At(2));\r
- fHistEventStats->Fill(3,gRefMultiplicity); //events with a proper vertex\r
- if(TMath::Abs(gVertexArray.At(0)) < fVxMax) {\r
- if(TMath::Abs(gVertexArray.At(1)) < fVyMax) {\r
- if(TMath::Abs(gVertexArray.At(2)) < fVzMax) {\r
- fHistEventStats->Fill(4,gRefMultiplicity);//analyzed events\r
-\r
- // get the reference multiplicty or centrality\r
- gRefMultiplicity = GetRefMultiOrCentrality(event);\r
-\r
- fHistVx->Fill(gVertexArray.At(0));\r
- fHistVy->Fill(gVertexArray.At(1));\r
- fHistVz->Fill(gVertexArray.At(2),gRefMultiplicity);\r
- \r
- // take only events inside centrality class\r
- if(fUseCentrality) {\r
- if((fImpactParameterMin < gRefMultiplicity) && (fImpactParameterMax > gRefMultiplicity)){\r
- fHistEventStats->Fill(5,gRefMultiplicity); //events with correct centrality\r
- return gRefMultiplicity; \r
- }//centrality class\r
- }\r
- // take events only within the same multiplicity class\r
- else if(fUseMultiplicity) {\r
- if((gRefMultiplicity > fNumberOfAcceptedTracksMin) && (gRefMultiplicity < fNumberOfAcceptedTracksMax)) {\r
- fHistEventStats->Fill(5,gRefMultiplicity); //events with correct multiplicity\r
- return gRefMultiplicity;\r
- }\r
- }//multiplicity range\r
- }//Vz cut\r
- }//Vy cut\r
- }//Vx cut\r
- }//header \r
- }//MC event object\r
- }//MC\r
- \r
- // Event Vertex AOD, ESD, ESDMC\r
- else{\r
- const AliVVertex *vertex = event->GetPrimaryVertex();\r
- \r
- if(vertex) {\r
- Double32_t fCov[6];\r
- vertex->GetCovarianceMatrix(fCov);\r
- if(vertex->GetNContributors() > 0) {\r
- if(fCov[5] != 0) {\r
- fHistEventStats->Fill(3,gRefMultiplicity); //proper vertex\r
- if(TMath::Abs(vertex->GetX()) < fVxMax) {\r
- if(TMath::Abs(vertex->GetY()) < fVyMax) {\r
- if(TMath::Abs(vertex->GetZ()) < fVzMax) {\r
- fHistEventStats->Fill(4,gRefMultiplicity);//analyzed events\r
-\r
- // get the reference multiplicty or centrality\r
- gRefMultiplicity = GetRefMultiOrCentrality(event);\r
- \r
- fHistVx->Fill(vertex->GetX());\r
- fHistVy->Fill(vertex->GetY());\r
- fHistVz->Fill(vertex->GetZ(),gRefMultiplicity);\r
- \r
- // take only events inside centrality class\r
- if(fUseCentrality) {\r
- if((gRefMultiplicity > fCentralityPercentileMin) && (gRefMultiplicity < fCentralityPercentileMax)){\r
-\r
- // centrality weighting (optional for 2011 if central and semicentral triggers are used)\r
- if (fCentralityWeights && !AcceptEventCentralityWeight(gRefMultiplicity)){\r
- AliInfo(Form("Rejecting event because of centrality weighting: %f", gRefMultiplicity));\r
- return -1;\r
- }\r
- \r
- fHistEventStats->Fill(5,gRefMultiplicity); //events with correct centrality\r
- return gRefMultiplicity; \r
- }//centrality class\r
- }\r
- // take events only within the same multiplicity class\r
- else if(fUseMultiplicity) {\r
- //if(fDebugLevel) \r
- //Printf("N(min): %.0f, N(max): %.0f - N(ref): %.0f",fNumberOfAcceptedTracksMin,\r
- //fNumberOfAcceptedTracksMax,gRefMultiplicity);\r
-\r
- if((gRefMultiplicity > fNumberOfAcceptedTracksMin) && (gRefMultiplicity < fNumberOfAcceptedTracksMax)) {\r
- fHistEventStats->Fill(5,gRefMultiplicity); //events with correct multiplicity\r
- return gRefMultiplicity;\r
- }\r
- }//multiplicity range\r
- }//Vz cut\r
- }//Vy cut\r
- }//Vx cut\r
- }//proper vertex resolution\r
- }//proper number of contributors\r
- }//vertex object valid\r
- }//triggered event \r
- }//AOD,ESD,ESDMC\r
- \r
- // in all other cases return -1 (event not accepted)\r
- return -1;\r
-}\r
-\r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::GetRefMultiOrCentrality(AliVEvent *event){\r
- // Checks the Event cuts\r
- // Fills Event statistics histograms\r
- \r
- Float_t gCentrality = -1.;\r
- Double_t gMultiplicity = -1.;\r
- TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
-\r
-\r
- // calculate centrality always (not only in centrality mode)\r
- if(gAnalysisLevel == "AOD"|| gAnalysisLevel == "MCAOD" || gAnalysisLevel == "MCAODrec" ) { //centrality in AOD header //++++++++++++++\r
- AliAODHeader *header = (AliAODHeader*) event->GetHeader();\r
- if(header){\r
- gCentrality = header->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
-\r
- // QA for centrality estimators\r
- fHistCentStats->Fill(0.,header->GetCentralityP()->GetCentralityPercentile("V0M"));\r
- fHistCentStats->Fill(1.,header->GetCentralityP()->GetCentralityPercentile("V0A"));\r
- fHistCentStats->Fill(2.,header->GetCentralityP()->GetCentralityPercentile("V0C"));\r
- fHistCentStats->Fill(3.,header->GetCentralityP()->GetCentralityPercentile("FMD"));\r
- fHistCentStats->Fill(4.,header->GetCentralityP()->GetCentralityPercentile("TRK"));\r
- fHistCentStats->Fill(5.,header->GetCentralityP()->GetCentralityPercentile("TKL")); \r
- fHistCentStats->Fill(6.,header->GetCentralityP()->GetCentralityPercentile("CL0"));\r
- fHistCentStats->Fill(7.,header->GetCentralityP()->GetCentralityPercentile("CL1"));\r
- fHistCentStats->Fill(8.,header->GetCentralityP()->GetCentralityPercentile("ZNA"));\r
- fHistCentStats->Fill(9.,header->GetCentralityP()->GetCentralityPercentile("ZPA"));\r
- fHistCentStats->Fill(10.,header->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));\r
- fHistCentStats->Fill(11.,header->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));\r
- fHistCentStats->Fill(12.,header->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));\r
- \r
- // Centrality estimator USED ++++++++++++++++++++++++++++++\r
- fHistCentStatsUsed->Fill(0.,header->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data()));\r
- \r
- // centrality QA (V0M)\r
- fHistV0M->Fill(event->GetVZEROData()->GetMTotV0A(), event->GetVZEROData()->GetMTotV0C());\r
- \r
- // centrality QA (reference tracks)\r
- fHistRefTracks->Fill(0.,header->GetRefMultiplicity());\r
- fHistRefTracks->Fill(1.,header->GetRefMultiplicityPos());\r
- fHistRefTracks->Fill(2.,header->GetRefMultiplicityNeg());\r
- fHistRefTracks->Fill(3.,header->GetTPConlyRefMultiplicity());\r
- fHistRefTracks->Fill(4.,header->GetNumberOfITSClusters(0));\r
- fHistRefTracks->Fill(5.,header->GetNumberOfITSClusters(1));\r
- fHistRefTracks->Fill(6.,header->GetNumberOfITSClusters(2));\r
- fHistRefTracks->Fill(7.,header->GetNumberOfITSClusters(3));\r
- fHistRefTracks->Fill(8.,header->GetNumberOfITSClusters(4));\r
-\r
- }//AOD header\r
- }//AOD\r
- \r
- else if(gAnalysisLevel == "ESD" || gAnalysisLevel == "MCESD"){ // centrality class for ESDs or MC-ESDs\r
- AliCentrality *centrality = event->GetCentrality();\r
- gCentrality = centrality->GetCentralityPercentile(fCentralityEstimator.Data());\r
-\r
- // QA for centrality estimators\r
- fHistCentStats->Fill(0.,centrality->GetCentralityPercentile("V0M"));\r
- fHistCentStats->Fill(1.,centrality->GetCentralityPercentile("V0A"));\r
- fHistCentStats->Fill(2.,centrality->GetCentralityPercentile("V0C"));\r
- fHistCentStats->Fill(3.,centrality->GetCentralityPercentile("FMD"));\r
- fHistCentStats->Fill(4.,centrality->GetCentralityPercentile("TRK"));\r
- fHistCentStats->Fill(5.,centrality->GetCentralityPercentile("TKL"));\r
- fHistCentStats->Fill(6.,centrality->GetCentralityPercentile("CL0"));\r
- fHistCentStats->Fill(7.,centrality->GetCentralityPercentile("CL1"));\r
- fHistCentStats->Fill(8.,centrality->GetCentralityPercentile("ZNA"));\r
- fHistCentStats->Fill(9.,centrality->GetCentralityPercentile("ZPA"));\r
- fHistCentStats->Fill(10.,centrality->GetCentralityPercentile("V0MvsFMD"));\r
- fHistCentStats->Fill(11.,centrality->GetCentralityPercentile("TKLvsV0M"));\r
- fHistCentStats->Fill(12.,centrality->GetCentralityPercentile("ZEMvsZDC"));\r
- \r
- // Centrality estimator USED ++++++++++++++++++++++++++++++\r
- fHistCentStatsUsed->Fill(0.,centrality->GetCentralityPercentile(fCentralityEstimator.Data()));\r
- \r
- // centrality QA (V0M)\r
- fHistV0M->Fill(event->GetVZEROData()->GetMTotV0A(), event->GetVZEROData()->GetMTotV0C());\r
- }//ESD\r
-\r
- else if(gAnalysisLevel == "MC"){\r
- Double_t gImpactParameter = 0.;\r
- AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(event);\r
- if(gMCEvent){\r
- AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader()); \r
- if(headerH){\r
- gImpactParameter = headerH->ImpactParameter();\r
- gCentrality = gImpactParameter;\r
- }//MC header\r
- }//MC event cast\r
- }//MC\r
-\r
- else{\r
- gCentrality = -1.;\r
- }\r
- \r
- // calculate reference multiplicity always (not only in multiplicity mode)\r
- if(gAnalysisLevel == "ESD" || gAnalysisLevel == "MCESD"){\r
- AliESDEvent* gESDEvent = dynamic_cast<AliESDEvent*>(event);\r
- if(gESDEvent){\r
- gMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(gESDEvent, AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- fHistMultiplicity->Fill(gMultiplicity);\r
- }//AliESDevent cast\r
- }//ESD mode\r
-\r
- else if(gAnalysisLevel == "AOD"|| gAnalysisLevel == "MCAOD" || gAnalysisLevel == "MCAODrec" ){\r
- AliAODHeader *header = (AliAODHeader*) event->GetHeader();\r
- if ((fMultiplicityEstimator == "V0M")||\r
- (fMultiplicityEstimator == "V0A")||\r
- (fMultiplicityEstimator == "V0C") ||\r
- (fMultiplicityEstimator == "TPC")) {\r
- gMultiplicity = GetReferenceMultiplicityFromAOD(event);\r
- if(fDebugLevel) Printf("Reference multiplicity (calculated): %.0f",gMultiplicity);\r
- }\r
- else {\r
- if(header)\r
- gMultiplicity = header->GetRefMultiplicity();\r
- if(fDebugLevel) Printf("Reference multiplicity (AOD header): %.0f",gMultiplicity);\r
- }\r
- fHistMultiplicity->Fill(gMultiplicity);\r
- }//AOD mode\r
- else if(gAnalysisLevel == "MC") {\r
- AliMCEvent* gMCEvent = dynamic_cast<AliMCEvent*>(event);\r
- //Calculating the multiplicity as the number of charged primaries\r
- //within \pm 0.8 in eta and pT > 0.1 GeV/c\r
- for(Int_t iParticle = 0; iParticle < gMCEvent->GetNumberOfPrimaries(); iParticle++) {\r
- AliMCParticle* track = dynamic_cast<AliMCParticle *>(gMCEvent->GetTrack(iParticle));\r
- if (!track) {\r
- AliError(Form("Could not receive particle %d", iParticle));\r
- continue;\r
- }\r
- \r
- //exclude non stable particles\r
- if(!(gMCEvent->IsPhysicalPrimary(iParticle))) continue;\r
- \r
- //++++++++++++++++\r
- if (fMultiplicityEstimator == "V0M") {\r
- if((track->Eta() > 5.1 || track->Eta() < 2.8)&&(track->Eta() < -3.7 || track->Eta() > -1.7)) \r
- continue;}\r
- else if (fMultiplicityEstimator == "V0A") {\r
- if(track->Eta() > 5.1 || track->Eta() < 2.8) continue;}\r
- else if (fMultiplicityEstimator == "V0C") {\r
- if(track->Eta() > -1.7 || track->Eta() < -3.7) continue;}\r
- else if (fMultiplicityEstimator == "TPC") {\r
- if(track->Eta() < fEtaMin || track->Eta() > fEtaMax) continue;\r
- if(track->Pt() < fPtMin || track->Pt() > fPtMax) continue;\r
- }\r
- else{\r
- if(track->Pt() < fPtMin || track->Pt() > fPtMax) continue;\r
- if(track->Eta() < fEtaMin || track->Eta() > fEtaMax) continue;\r
- }\r
- //++++++++++++++++\r
- \r
- if(track->Charge() == 0) continue;\r
- \r
- gMultiplicity += 1;\r
- }//loop over primaries\r
- fHistMultiplicity->Fill(gMultiplicity);\r
- }//MC mode\r
- else{\r
- gMultiplicity = -1;\r
- }\r
- \r
-\r
- // decide what should be returned only here\r
- Double_t lReturnVal = -100;\r
- if(fEventClass=="Multiplicity"){\r
- lReturnVal = gMultiplicity;\r
- }else if(fEventClass=="Centrality"){\r
- lReturnVal = gCentrality;\r
- }\r
- return lReturnVal;\r
-}\r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::GetReferenceMultiplicityFromAOD(AliVEvent *event){\r
- //Function that returns the reference multiplicity from AODs (data or reco MC)\r
- //Different ref. mult. implemented: V0M, V0A, V0C, TPC\r
- Double_t gRefMultiplicity = 0., gRefMultiplicityTPC = 0.;\r
- Double_t gRefMultiplicityVZERO = 0., gRefMultiplicityVZEROA = 0., gRefMultiplicityVZEROC = 0.;\r
-\r
- AliAODHeader *header = dynamic_cast<AliAODHeader *>(event->GetHeader());\r
- if(!header) {\r
- Printf("ERROR: AOD header not available");\r
- return -999;\r
- }\r
- Int_t gRunNumber = header->GetRunNumber();\r
-\r
- // Loop over tracks in event\r
- for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {\r
- AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));\r
- if (!aodTrack) {\r
- AliError(Form("Could not receive track %d", iTracks));\r
- continue;\r
- }\r
- \r
- // AOD track cuts\r
- if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;\r
- \r
- if(aodTrack->Charge() == 0) continue;\r
- // Kinematics cuts from ESD track cuts\r
- if( aodTrack->Pt() < fPtMin || aodTrack->Pt() > fPtMax) continue;\r
- if( aodTrack->Eta() < fEtaMin || aodTrack->Eta() > fEtaMax) continue;\r
- \r
- //=================PID (so far only for electron rejection)==========================//\r
- if(fElectronRejection) {\r
- // get the electron nsigma\r
- Double_t nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kElectron));\r
- \r
- // check only for given momentum range\r
- if( aodTrack->Pt() > fElectronRejectionMinPt && aodTrack->Pt() < fElectronRejectionMaxPt ){\r
- //look only at electron nsigma\r
- if(!fElectronOnlyRejection) {\r
- //Make the decision based on the n-sigma of electrons\r
- if(nSigma < fElectronRejectionNSigma) continue;\r
- }\r
- else {\r
- Double_t nSigmaPions = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kPion));\r
- Double_t nSigmaKaons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kKaon));\r
- Double_t nSigmaProtons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kProton));\r
- \r
- //Make the decision based on the n-sigma of electrons exclusively ( = track not in nsigma region for other species)\r
- if(nSigma < fElectronRejectionNSigma\r
- && nSigmaPions > fElectronRejectionNSigma\r
- && nSigmaKaons > fElectronRejectionNSigma\r
- && nSigmaProtons > fElectronRejectionNSigma ) continue;\r
- }\r
- }\r
- }//electron rejection\r
- \r
- gRefMultiplicityTPC += 1.0;\r
- }// track loop\r
- \r
- //VZERO segmentation in two detectors (0-31: VZERO-C, 32-63: VZERO-A)\r
- for(Int_t iChannel = 0; iChannel < 64; iChannel++) {\r
- fHistVZEROSignal->Fill(iChannel,event->GetVZEROEqMultiplicity(iChannel));\r
- \r
- if(iChannel < 32) \r
- gRefMultiplicityVZEROC += event->GetVZEROEqMultiplicity(iChannel);\r
- else if(iChannel >= 32) \r
- gRefMultiplicityVZEROA += event->GetVZEROEqMultiplicity(iChannel);\r
- }//loop over PMTs\r
- \r
- //Equalization of gain\r
- Double_t gFactorA = GetEqualizationFactor(gRunNumber,"A");\r
- if(gFactorA != 0)\r
- gRefMultiplicityVZEROA /= gFactorA;\r
- Double_t gFactorC = GetEqualizationFactor(gRunNumber,"C");\r
- if(gFactorC != 0)\r
- gRefMultiplicityVZEROC /= gFactorC;\r
- if((gFactorA != 0)&&(gFactorC != 0)) \r
- gRefMultiplicityVZERO = (gRefMultiplicityVZEROA/gFactorA)+(gRefMultiplicityVZEROC/gFactorC);\r
- \r
- if(fDebugLevel) \r
- Printf("VZERO multiplicity: %.0f - TPC multiplicity: %.0f",gRefMultiplicityVZERO,gRefMultiplicityTPC);\r
-\r
- fHistTPCvsVZEROMultiplicity->Fill(gRefMultiplicityVZERO,gRefMultiplicityTPC);\r
-\r
- if(fMultiplicityEstimator == "TPC") \r
- gRefMultiplicity = gRefMultiplicityTPC;\r
- else if(fMultiplicityEstimator == "V0M")\r
- gRefMultiplicity = gRefMultiplicityVZERO;\r
- else if(fMultiplicityEstimator == "V0A")\r
- gRefMultiplicity = gRefMultiplicityVZEROA;\r
- else if(fMultiplicityEstimator == "V0C")\r
- gRefMultiplicity = gRefMultiplicityVZEROC;\r
- \r
- return gRefMultiplicity;\r
-}\r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::GetEventPlane(AliVEvent *event){\r
- // Get the event plane\r
-\r
- TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
-\r
- Float_t gVZEROEventPlane = -10.;\r
- Float_t gReactionPlane = -10.;\r
- Double_t qxTot = 0.0, qyTot = 0.0;\r
-\r
- //MC: from reaction plane\r
- if(gAnalysisLevel == "MC"){\r
- if(!event) {\r
- AliError("mcEvent not available");\r
- return 0x0;\r
- }\r
-\r
- AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(event);\r
- if(gMCEvent){\r
- AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader()); \r
- if (headerH) {\r
- gReactionPlane = headerH->ReactionPlaneAngle();\r
- //gReactionPlane *= TMath::RadToDeg();\r
- }//MC header\r
- }//MC event cast\r
- }//MC\r
- \r
- // AOD,ESD,ESDMC: from VZERO Event Plane\r
- else{\r
- \r
- AliEventplane *ep = event->GetEventplane();\r
- if(ep){ \r
- gVZEROEventPlane = ep->CalculateVZEROEventPlane(event,10,2,qxTot,qyTot);\r
- if(gVZEROEventPlane < 0.) gVZEROEventPlane += TMath::Pi();\r
- //gReactionPlane = gVZEROEventPlane*TMath::RadToDeg();\r
- gReactionPlane = gVZEROEventPlane;\r
- }\r
- }//AOD,ESD,ESDMC\r
-\r
- return gReactionPlane;\r
-}\r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::GetTrackbyTrackCorrectionMatrix( Double_t vEta, \r
- Double_t vPhi, \r
- Double_t vPt, \r
- Short_t vCharge, \r
- Double_t gCentrality) {\r
- // -- Get efficiency correction of particle dependent on (eta, phi, pt, charge, centrality) \r
-\r
- Double_t correction = 1.;\r
- Int_t binEta = 0, binPt = 0, binPhi = 0;\r
-\r
- //Printf("EtaMAx: %lf - EtaMin: %lf - EtaBin: %lf", fEtaMaxForCorrections,fEtaMinForCorrections,fEtaBinForCorrections);\r
- if(fEtaBinForCorrections != 0) {\r
- Double_t widthEta = (fEtaMaxForCorrections - fEtaMinForCorrections)/fEtaBinForCorrections;\r
- if(fEtaMaxForCorrections != fEtaMinForCorrections) \r
- binEta = (Int_t)((vEta-fEtaMinForCorrections)/widthEta)+1;\r
- }\r
-\r
- if(fPtBinForCorrections != 0) {\r
- Double_t widthPt = (fPtMaxForCorrections - fPtMinForCorrections)/fPtBinForCorrections;\r
- if(fPtMaxForCorrections != fPtMinForCorrections) \r
- binPt = (Int_t)((vPt-fPtMinForCorrections)/widthPt) + 1;\r
- }\r
- \r
- if(fPhiBinForCorrections != 0) {\r
- Double_t widthPhi = (fPhiMaxForCorrections - fPhiMinForCorrections)/fPhiBinForCorrections;\r
- if(fPhiMaxForCorrections != fPhiMinForCorrections) \r
- binPhi = (Int_t)((vPhi-fPhiMinForCorrections)/widthPhi)+ 1;\r
- }\r
-\r
- Int_t gCentralityInt = -1;\r
- for (Int_t i=0; i<fCentralityArrayBinsForCorrections-1; i++){\r
- if((fCentralityArrayForCorrections[i] <= gCentrality)&&(gCentrality <= fCentralityArrayForCorrections[i+1])){\r
- gCentralityInt = i;\r
- break;\r
- }\r
- } \r
-\r
- // centrality not in array --> no correction\r
- if(gCentralityInt < 0){\r
- correction = 1.;\r
- }\r
- else{\r
- \r
- //Printf("//=============CENTRALITY=============// %d:",gCentralityInt);\r
- \r
- if(fHistCorrectionPlus[gCentralityInt]){\r
- if (vCharge > 0) {\r
- correction = fHistCorrectionPlus[gCentralityInt]->GetBinContent(fHistCorrectionPlus[gCentralityInt]->GetBin(binEta, binPt, binPhi));\r
- //Printf("CORRECTIONplus: %.2f | Centrality %d",correction,gCentralityInt); \r
- }\r
- if (vCharge < 0) {\r
- correction = fHistCorrectionMinus[gCentralityInt]->GetBinContent(fHistCorrectionMinus[gCentralityInt]->GetBin(binEta, binPt, binPhi));\r
- //Printf("CORRECTIONminus: %.2f | Centrality %d",correction,gCentralityInt);\r
- }\r
- }\r
- else {\r
- correction = 1.;\r
- }\r
- }//centrality in array\r
- \r
- if (correction == 0.) { \r
- AliError(Form("Should not happen : bin content = 0. >> eta: %.2f | phi : %.2f | pt : %.2f | cent %d",vEta, vPhi, vPt, gCentralityInt)); \r
- correction = 1.; \r
- } \r
- \r
- return correction;\r
-}\r
-\r
-//________________________________________________________________________\r
-TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gCentrality, Double_t gReactionPlane){\r
- // Returns TObjArray with tracks after all track cuts (only for AOD!)\r
- // Fills QA histograms\r
-\r
- TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
-\r
- //output TObjArray holding all good tracks\r
- TObjArray* tracksAccepted = new TObjArray;\r
- tracksAccepted->SetOwner(kTRUE);\r
-\r
- Short_t vCharge;\r
- Double_t vEta;\r
- Double_t vY;\r
- Double_t vPhi;\r
- Double_t vPt;\r
-\r
-\r
- if(gAnalysisLevel == "AOD") { // handling of TPC only tracks different in AOD and ESD\r
- // Loop over tracks in event\r
- \r
- for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {\r
- AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));\r
- if (!aodTrack) {\r
- AliError(Form("Could not receive track %d", iTracks));\r
- continue;\r
- }\r
- \r
- // AOD track cuts\r
- \r
- // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C\r
- // take only TPC only tracks \r
- //fHistTrackStats->Fill(aodTrack->GetFilterMap());\r
- for(Int_t iTrackBit = 0; iTrackBit < 16; iTrackBit++){\r
- fHistTrackStats->Fill(iTrackBit,aodTrack->TestFilterBit(1<<iTrackBit));\r
- }\r
-\r
- if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;\r
-\r
-\r
- // additional check on kPrimary flag\r
- if(fCheckPrimaryFlagAOD){\r
- if(aodTrack->GetType() != AliAODTrack::kPrimary)\r
- continue;\r
- }\r
-\r
- \r
- vCharge = aodTrack->Charge();\r
- vEta = aodTrack->Eta();\r
- vY = aodTrack->Y();\r
- vPhi = aodTrack->Phi();// * TMath::RadToDeg();\r
- vPt = aodTrack->Pt();\r
- \r
- //===========================PID (so far only for electron rejection)===============================// \r
- if(fElectronRejection) {\r
-\r
- // get the electron nsigma\r
- Double_t nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kElectron));\r
- \r
- //Fill QA before the PID\r
- fHistdEdxVsPTPCbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());\r
- fHistNSigmaTPCvsPtbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma); \r
- //end of QA-before pid\r
- \r
- // check only for given momentum range\r
- if( vPt > fElectronRejectionMinPt && vPt < fElectronRejectionMaxPt ){\r
- \r
- //look only at electron nsigma\r
- if(!fElectronOnlyRejection){\r
- \r
- //Make the decision based on the n-sigma of electrons\r
- if(nSigma < fElectronRejectionNSigma) continue;\r
- }\r
- else{\r
- \r
- Double_t nSigmaPions = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kPion));\r
- Double_t nSigmaKaons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kKaon));\r
- Double_t nSigmaProtons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kProton));\r
- \r
- //Make the decision based on the n-sigma of electrons exclusively ( = track not in nsigma region for other species)\r
- if(nSigma < fElectronRejectionNSigma\r
- && nSigmaPions > fElectronRejectionNSigma\r
- && nSigmaKaons > fElectronRejectionNSigma\r
- && nSigmaProtons > fElectronRejectionNSigma ) continue;\r
- }\r
- }\r
- \r
- //Fill QA after the PID\r
- fHistdEdxVsPTPCafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());\r
- fHistNSigmaTPCvsPtafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma); \r
- \r
- }\r
- //===========================end of PID (so far only for electron rejection)===============================//\r
-\r
- //+++++++++++++++++++++++++++++//\r
- //===========================PID===============================// \r
- if(fUsePID) {\r
- Double_t prob[AliPID::kSPECIES]={0.};\r
- Double_t probTPC[AliPID::kSPECIES]={0.};\r
- Double_t probTOF[AliPID::kSPECIES]={0.};\r
- Double_t probTPCTOF[AliPID::kSPECIES]={0.};\r
- \r
- Double_t nSigma = 0.;\r
- Double_t nSigmaTPC = 0.; //++++\r
- Double_t nSigmaTOF = 0.; //++++\r
- Double_t nSigmaTPCTOF = 0.; //++++\r
- UInt_t detUsedTPC = 0;\r
- UInt_t detUsedTOF = 0;\r
- UInt_t detUsedTPCTOF = 0;\r
- \r
- nSigmaTPC = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)fParticleOfInterest));\r
- nSigmaTOF = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(aodTrack,(AliPID::EParticleType)fParticleOfInterest));\r
- nSigmaTPCTOF = TMath::Sqrt(nSigmaTPC*nSigmaTPC + nSigmaTOF*nSigmaTOF);\r
-\r
- //Decide what detector configuration we want to use\r
- switch(fPidDetectorConfig) {\r
- case kTPCpid:\r
- fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);\r
- nSigma = nSigmaTPC;\r
- detUsedTPC = fPIDCombined->ComputeProbabilities(aodTrack, fPIDResponse, probTPC);\r
- for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
- prob[iSpecies] = probTPC[iSpecies];\r
- break;\r
- case kTOFpid:\r
- fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF);\r
- nSigma = nSigmaTOF;\r
- detUsedTOF = fPIDCombined->ComputeProbabilities(aodTrack, fPIDResponse, probTOF);\r
- for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
- prob[iSpecies] = probTOF[iSpecies];\r
- break;\r
- case kTPCTOF:\r
- fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);\r
- nSigma = nSigmaTPCTOF;\r
- detUsedTPCTOF = fPIDCombined->ComputeProbabilities(aodTrack, fPIDResponse, probTPCTOF);\r
- for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
- prob[iSpecies] = probTPCTOF[iSpecies];\r
- break;\r
- default:\r
- break;\r
- }//end switch: define detector mask\r
- \r
- //Filling the PID QA\r
- Double_t tofTime = -999., length = 999., tof = -999.;\r
- Double_t c = TMath::C()*1.E-9;// m/ns\r
- Double_t beta = -999.;\r
- if ( (aodTrack->IsOn(AliAODTrack::kTOFin)) &&\r
- (aodTrack->IsOn(AliAODTrack::kTIME)) ) { \r
- tofTime = aodTrack->GetTOFsignal();//in ps\r
- length = aodTrack->GetIntegratedLength();\r
- tof = tofTime*1E-3; // ns \r
- \r
- if (tof <= 0) {\r
- //Printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");\r
- continue;\r
- }\r
- if (length <= 0){\r
- //printf("WARNING: track with negative length found!Skipping this track for PID checks\n");\r
- continue;\r
- }\r
- \r
- length = length*0.01; // in meters\r
- tof = tof*c;\r
- beta = length/tof;\r
- \r
- fHistBetavsPTOFbeforePID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);\r
- fHistProbTOFvsPtbeforePID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);\r
- fHistNSigmaTOFvsPtbeforePID ->Fill(aodTrack->Pt(),nSigmaTOF);\r
- }//TOF signal \r
- \r
- fHistdEdxVsPTPCbeforePID -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());\r
- fHistProbTPCvsPtbeforePID -> Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]); \r
- fHistNSigmaTPCvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPC);\r
- \r
- fHistProbTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);\r
-\r
- //combined TPC&TOF\r
- fHistBetaVsdEdXbeforePID->Fill(aodTrack->GetTPCsignal(),beta); //+++++++++ \r
- fHistNSigmaTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPCTOF);\r
- Printf("NSIGMA: %lf - nSigmaTOF: %lf - nSigmaTPC: %lf - nSigmaTPCTOF: %lf",nSigma,nSigmaTOF,nSigmaTPC,nSigmaTPCTOF);\r
- \r
- //end of QA-before pid\r
- \r
- if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {\r
- //Make the decision based on the n-sigma\r
- if(fUsePIDnSigma) {\r
- if(nSigma > fPIDNSigma) continue; \r
- \r
- fHistNSigmaTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTOF);\r
- fHistNSigmaTPCvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPC);\r
- fHistNSigmaTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPCTOF);\r
- }\r
- //Make the decision based on the bayesian\r
- else if(fUsePIDPropabilities) {\r
- if(fParticleOfInterest != TMath::LocMax(AliPID::kSPECIES,prob)) continue;\r
- if (prob[fParticleOfInterest] < fMinAcceptedPIDProbability) continue; \r
- \r
- fHistProbTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);\r
- fHistProbTPCvsPtafterPID ->Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]); \r
- fHistProbTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);\r
- \r
- }\r
- \r
- //Fill QA after the PID\r
- fHistBetavsPTOFafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);\r
- fHistdEdxVsPTPCafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());\r
- fHistBetaVsdEdXafterPID->Fill(aodTrack->GetTPCsignal(),beta); //+++++++++ \r
- }\r
- }\r
- //===========================PID===============================//\r
- //+++++++++++++++++++++++++++++//\r
-\r
-\r
- Float_t dcaXY = aodTrack->DCA(); // this is the DCA from global track (not exactly what is cut on)\r
- Float_t dcaZ = aodTrack->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)\r
- \r
- \r
- // Kinematics cuts from ESD track cuts\r
- if( vPt < fPtMin || vPt > fPtMax) continue;\r
- if( vEta < fEtaMin || vEta > fEtaMax) continue;\r
- \r
- // Extra DCA cuts (for systematic studies [!= -1])\r
- if( fDCAxyCut != -1 && fDCAzCut != -1){\r
- if(TMath::Sqrt((dcaXY*dcaXY)/(fDCAxyCut*fDCAxyCut)+(dcaZ*dcaZ)/(fDCAzCut*fDCAzCut)) > 1 ){\r
- continue; // 2D cut\r
- }\r
- }\r
- \r
- // Extra TPC cuts (for systematic studies [!= -1])\r
- if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){\r
- continue;\r
- }\r
- if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){\r
- continue;\r
- }\r
- \r
- // fill QA histograms\r
- fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());\r
- fHistDCA->Fill(dcaZ,dcaXY);\r
- fHistChi2->Fill(aodTrack->Chi2perNDF(),gCentrality);\r
- fHistPt->Fill(vPt,gCentrality);\r
- fHistEta->Fill(vEta,gCentrality);\r
- fHistRapidity->Fill(vY,gCentrality);\r
- if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);\r
- else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);\r
- fHistPhi->Fill(vPhi,gCentrality);\r
- if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality); \r
- else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);\r
- \r
- //=======================================correction\r
- Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); \r
- //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);\r
- \r
- // add the track to the TObjArray\r
- tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); \r
- }//track loop\r
- }// AOD analysis\r
-\r
- //==============================================================================================================\r
- else if(gAnalysisLevel == "MCAOD") {\r
- \r
- AliMCEvent* mcEvent = MCEvent();\r
- if (!mcEvent) {\r
- AliError("ERROR: Could not retrieve MC event");\r
- }\r
- else{\r
- \r
- for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {\r
- AliAODMCParticle *aodTrack = (AliAODMCParticle*) mcEvent->GetTrack(iTracks); \r
- if (!aodTrack) {\r
- AliError(Form("ERROR: Could not receive track %d (mc loop)", iTracks));\r
- continue;\r
- }\r
- \r
- if(!aodTrack->IsPhysicalPrimary()) continue; \r
- \r
- vCharge = aodTrack->Charge();\r
- vEta = aodTrack->Eta();\r
- vY = aodTrack->Y();\r
- vPhi = aodTrack->Phi();// * TMath::RadToDeg();\r
- vPt = aodTrack->Pt();\r
- \r
- // Kinematics cuts from ESD track cuts\r
- if( vPt < fPtMin || vPt > fPtMax) continue;\r
- if( vEta < fEtaMin || vEta > fEtaMax) continue;\r
- \r
- // Remove neutral tracks\r
- if( vCharge == 0 ) continue;\r
- \r
- //Exclude resonances\r
- if(fExcludeResonancesInMC) {\r
- \r
- Bool_t kExcludeParticle = kFALSE;\r
- Int_t gMotherIndex = aodTrack->GetMother();\r
- if(gMotherIndex != -1) {\r
- AliAODMCParticle* motherTrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(gMotherIndex));\r
- if(motherTrack) {\r
- Int_t pdgCodeOfMother = motherTrack->GetPdgCode();\r
- //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {\r
- //if(pdgCodeOfMother == 113) {\r
- if(pdgCodeOfMother == 113 // rho0\r
- || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+\r
- // || pdgCodeOfMother == 221 // eta\r
- // || pdgCodeOfMother == 331 // eta'\r
- // || pdgCodeOfMother == 223 // omega\r
- // || pdgCodeOfMother == 333 // phi\r
- || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0\r
- // || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0*\r
- // || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+*\r
- || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda\r
- || pdgCodeOfMother == 111 // pi0 Dalitz\r
- || pdgCodeOfMother == 22 // photon\r
- ) {\r
- kExcludeParticle = kTRUE;\r
- }\r
- }\r
- }\r
- \r
- //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi\r
- if(kExcludeParticle) continue;\r
- }\r
-\r
- //Exclude electrons with PDG\r
- if(fExcludeElectronsInMC) {\r
- \r
- if(TMath::Abs(aodTrack->GetPdgCode()) == 11) continue;\r
- \r
- }\r
- \r
- // fill QA histograms\r
- fHistPt->Fill(vPt,gCentrality);\r
- fHistEta->Fill(vEta,gCentrality);\r
- fHistRapidity->Fill(vY,gCentrality);\r
- if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);\r
- else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);\r
- fHistPhi->Fill(vPhi,gCentrality);\r
- if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality); \r
- else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);\r
- \r
- //=======================================correction\r
- Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); \r
- //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality); \r
- \r
- // add the track to the TObjArray\r
- tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); \r
- }//aodTracks\r
- }//MC event\r
- }//MCAOD\r
- //==============================================================================================================\r
-\r
- //==============================================================================================================\r
- else if(gAnalysisLevel == "MCAODrec") {\r
- \r
- /* fAOD = dynamic_cast<AliAODEvent*>(InputEvent());\r
- if (!fAOD) {\r
- printf("ERROR: fAOD not available\n");\r
- return;\r
- }*/\r
- \r
- fArrayMC = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName())); \r
- if (!fArrayMC) { \r
- AliError("No array of MC particles found !!!");\r
- }\r
-\r
- AliMCEvent* mcEvent = MCEvent();\r
- if (!mcEvent) {\r
- AliError("ERROR: Could not retrieve MC event");\r
- return tracksAccepted;\r
- }\r
- \r
- for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {\r
- AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));\r
- if (!aodTrack) {\r
- AliError(Form("Could not receive track %d", iTracks));\r
- continue;\r
- }\r
- \r
- for(Int_t iTrackBit = 0; iTrackBit < 16; iTrackBit++){\r
- fHistTrackStats->Fill(iTrackBit,aodTrack->TestFilterBit(1<<iTrackBit));\r
- }\r
- if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;\r
- \r
- vCharge = aodTrack->Charge();\r
- vEta = aodTrack->Eta();\r
- vY = aodTrack->Y();\r
- vPhi = aodTrack->Phi();// * TMath::RadToDeg();\r
- vPt = aodTrack->Pt();\r
- \r
- //===========================use MC information for Kinematics===============================// \r
- if(fUseMCforKinematics){\r
-\r
- Int_t label = TMath::Abs(aodTrack->GetLabel());\r
- AliAODMCParticle *AODmcTrack = (AliAODMCParticle*) fArrayMC->At(label);\r
-\r
- if(AODmcTrack){\r
- vCharge = AODmcTrack->Charge();\r
- vEta = AODmcTrack->Eta();\r
- vY = AODmcTrack->Y();\r
- vPhi = AODmcTrack->Phi();// * TMath::RadToDeg();\r
- vPt = AODmcTrack->Pt();\r
- }\r
- else{\r
- AliDebug(1, "no MC particle for this track"); \r
- continue;\r
- }\r
- }\r
- //===========================end of use MC information for Kinematics========================// \r
-\r
-\r
- //===========================PID (so far only for electron rejection)===============================// \r
- if(fElectronRejection) {\r
-\r
- // get the electron nsigma\r
- Double_t nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kElectron));\r
-\r
- //Fill QA before the PID\r
- fHistdEdxVsPTPCbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());\r
- fHistNSigmaTPCvsPtbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma); \r
- //end of QA-before pid\r
- \r
- // check only for given momentum range\r
- if( vPt > fElectronRejectionMinPt && vPt < fElectronRejectionMaxPt ){\r
- \r
- //look only at electron nsigma\r
- if(!fElectronOnlyRejection){\r
- \r
- //Make the decision based on the n-sigma of electrons\r
- if(nSigma < fElectronRejectionNSigma) continue;\r
- }\r
- else{\r
- \r
- Double_t nSigmaPions = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kPion));\r
- Double_t nSigmaKaons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kKaon));\r
- Double_t nSigmaProtons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kProton));\r
- \r
- //Make the decision based on the n-sigma of electrons exclusively ( = track not in nsigma region for other species)\r
- if(nSigma < fElectronRejectionNSigma\r
- && nSigmaPions > fElectronRejectionNSigma\r
- && nSigmaKaons > fElectronRejectionNSigma\r
- && nSigmaProtons > fElectronRejectionNSigma ) continue;\r
- }\r
- }\r
- \r
- //Fill QA after the PID\r
- fHistdEdxVsPTPCafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());\r
- fHistNSigmaTPCvsPtafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma); \r
- \r
- }\r
- //===========================end of PID (so far only for electron rejection)===============================//\r
- \r
- Float_t dcaXY = aodTrack->DCA(); // this is the DCA from global track (not exactly what is cut on)\r
- Float_t dcaZ = aodTrack->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)\r
- \r
- // Kinematics cuts from ESD track cuts\r
- if( vPt < fPtMin || vPt > fPtMax) continue;\r
- if( vEta < fEtaMin || vEta > fEtaMax) continue;\r
- \r
- // Extra DCA cuts (for systematic studies [!= -1])\r
- if( fDCAxyCut != -1 && fDCAzCut != -1){\r
- if(TMath::Sqrt((dcaXY*dcaXY)/(fDCAxyCut*fDCAxyCut)+(dcaZ*dcaZ)/(fDCAzCut*fDCAzCut)) > 1 ){\r
- continue; // 2D cut\r
- }\r
- }\r
- \r
- // Extra TPC cuts (for systematic studies [!= -1])\r
- if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){\r
- continue;\r
- }\r
- if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){\r
- continue;\r
- }\r
-\r
- //Exclude resonances\r
- if(fExcludeResonancesInMC) {\r
- \r
- Bool_t kExcludeParticle = kFALSE;\r
-\r
- Int_t label = TMath::Abs(aodTrack->GetLabel());\r
- AliAODMCParticle *AODmcTrack = (AliAODMCParticle*) fArrayMC->At(label);\r
- \r
- if (AODmcTrack){ \r
- //if (AODmcTrack->IsPhysicalPrimary()){\r
- \r
- Int_t gMotherIndex = AODmcTrack->GetMother();\r
- if(gMotherIndex != -1) {\r
- AliAODMCParticle* motherTrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(gMotherIndex));\r
- if(motherTrack) {\r
- Int_t pdgCodeOfMother = motherTrack->GetPdgCode();\r
- if(pdgCodeOfMother == 113 // rho0\r
- || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+\r
- // || pdgCodeOfMother == 221 // eta\r
- // || pdgCodeOfMother == 331 // eta'\r
- // || pdgCodeOfMother == 223 // omega\r
- // || pdgCodeOfMother == 333 // phi\r
- || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0\r
- // || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0*\r
- // || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+*\r
- || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda\r
- || pdgCodeOfMother == 111 // pi0 Dalitz\r
- || pdgCodeOfMother == 22 // photon\r
- ) {\r
- kExcludeParticle = kTRUE;\r
- }\r
- }\r
- }\r
- } \r
- //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi\r
- if(kExcludeParticle) continue;\r
- }\r
-\r
- //Exclude electrons with PDG\r
- if(fExcludeElectronsInMC) {\r
- \r
- Int_t label = TMath::Abs(aodTrack->GetLabel());\r
- AliAODMCParticle *AODmcTrack = (AliAODMCParticle*) fArrayMC->At(label);\r
- \r
- if (AODmcTrack){ \r
- if(TMath::Abs(AODmcTrack->GetPdgCode()) == 11) continue;\r
- }\r
- }\r
- \r
- // fill QA histograms\r
- fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());\r
- fHistDCA->Fill(dcaZ,dcaXY);\r
- fHistChi2->Fill(aodTrack->Chi2perNDF(),gCentrality);\r
- fHistPt->Fill(vPt,gCentrality);\r
- fHistEta->Fill(vEta,gCentrality);\r
- fHistRapidity->Fill(vY,gCentrality);\r
- if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);\r
- else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);\r
- fHistPhi->Fill(vPhi,gCentrality);\r
- if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality); \r
- else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);\r
- \r
- //=======================================correction\r
- Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); \r
- //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);\r
- \r
- // add the track to the TObjArray\r
- tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); \r
- }//track loop\r
- }//MCAODrec\r
- //==============================================================================================================\r
-\r
- else if(gAnalysisLevel == "ESD" || gAnalysisLevel == "MCESD") { // handling of TPC only tracks different in AOD and ESD\r
-\r
- AliESDtrack *trackTPC = NULL;\r
- AliMCParticle *mcTrack = NULL;\r
-\r
- AliMCEvent* mcEvent = NULL;\r
- \r
- // for MC ESDs use also MC information\r
- if(gAnalysisLevel == "MCESD"){\r
- mcEvent = MCEvent(); \r
- if (!mcEvent) {\r
- AliError("mcEvent not available");\r
- return tracksAccepted;\r
- }\r
- }\r
- \r
- // Loop over tracks in event\r
- for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {\r
- AliESDtrack* track = dynamic_cast<AliESDtrack *>(event->GetTrack(iTracks));\r
- if (!track) {\r
- AliError(Form("Could not receive track %d", iTracks));\r
- continue;\r
- } \r
-\r
- // for MC ESDs use also MC information --> MC track not used further???\r
- if(gAnalysisLevel == "MCESD"){\r
- Int_t label = TMath::Abs(track->GetLabel());\r
- if(label > mcEvent->GetNumberOfTracks()) continue;\r
- if(label > mcEvent->GetNumberOfPrimaries()) continue;\r
- \r
- mcTrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(label));\r
- if(!mcTrack) continue;\r
- }\r
-\r
- // take only TPC only tracks\r
- trackTPC = new AliESDtrack();\r
- if(!track->FillTPCOnlyTrack(*trackTPC)) continue;\r
- \r
- //ESD track cuts\r
- if(fESDtrackCuts) \r
- if(!fESDtrackCuts->AcceptTrack(trackTPC)) continue;\r
- \r
- // fill QA histograms\r
- Float_t b[2];\r
- Float_t bCov[3];\r
- trackTPC->GetImpactParameters(b,bCov);\r
- if (bCov[0]<=0 || bCov[2]<=0) {\r
- AliDebug(1, "Estimated b resolution lower or equal zero!");\r
- bCov[0]=0; bCov[2]=0;\r
- }\r
- \r
- Int_t nClustersTPC = -1;\r
- nClustersTPC = trackTPC->GetTPCNclsIter1(); // TPC standalone\r
- //nClustersTPC = track->GetTPCclusters(0); // global track\r
- Float_t chi2PerClusterTPC = -1;\r
- if (nClustersTPC!=0) {\r
- chi2PerClusterTPC = trackTPC->GetTPCchi2Iter1()/Float_t(nClustersTPC); // TPC standalone\r
- //chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC); // global track\r
- }\r
- \r
- //===========================PID===============================// \r
- if(fUsePID) {\r
- Double_t prob[AliPID::kSPECIES]={0.};\r
- Double_t probTPC[AliPID::kSPECIES]={0.};\r
- Double_t probTOF[AliPID::kSPECIES]={0.};\r
- Double_t probTPCTOF[AliPID::kSPECIES]={0.};\r
- \r
- Double_t nSigma = 0.;\r
- UInt_t detUsedTPC = 0;\r
- UInt_t detUsedTOF = 0;\r
- UInt_t detUsedTPCTOF = 0;\r
- \r
- //Decide what detector configuration we want to use\r
- switch(fPidDetectorConfig) {\r
- case kTPCpid:\r
- fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);\r
- nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)fParticleOfInterest));\r
- detUsedTPC = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTPC);\r
- for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
- prob[iSpecies] = probTPC[iSpecies];\r
- break;\r
- case kTOFpid:\r
- fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF);\r
- nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)fParticleOfInterest));\r
- detUsedTOF = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTOF);\r
- for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
- prob[iSpecies] = probTOF[iSpecies];\r
- break;\r
- case kTPCTOF:\r
- fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);\r
- detUsedTPCTOF = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTPCTOF);\r
- for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
- prob[iSpecies] = probTPCTOF[iSpecies];\r
- break;\r
- default:\r
- break;\r
- }//end switch: define detector mask\r
- \r
- //Filling the PID QA\r
- Double_t tofTime = -999., length = 999., tof = -999.;\r
- Double_t c = TMath::C()*1.E-9;// m/ns\r
- Double_t beta = -999.;\r
- Double_t nSigmaTOFForParticleOfInterest = -999.;\r
- if ( (track->IsOn(AliESDtrack::kTOFin)) &&\r
- (track->IsOn(AliESDtrack::kTIME)) ) { \r
- tofTime = track->GetTOFsignal();//in ps\r
- length = track->GetIntegratedLength();\r
- tof = tofTime*1E-3; // ns \r
- \r
- if (tof <= 0) {\r
- //Printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");\r
- continue;\r
- }\r
- if (length <= 0){\r
- //printf("WARNING: track with negative length found!Skipping this track for PID checks\n");\r
- continue;\r
- }\r
- \r
- length = length*0.01; // in meters\r
- tof = tof*c;\r
- beta = length/tof;\r
- \r
- nSigmaTOFForParticleOfInterest = fPIDResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)fParticleOfInterest);\r
- fHistBetavsPTOFbeforePID ->Fill(track->P()*track->Charge(),beta);\r
- fHistProbTOFvsPtbeforePID ->Fill(track->Pt(),probTOF[fParticleOfInterest]);\r
- fHistNSigmaTOFvsPtbeforePID ->Fill(track->Pt(),nSigmaTOFForParticleOfInterest);\r
- }//TOF signal \r
- \r
- \r
- Double_t nSigmaTPCForParticleOfInterest = fPIDResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)fParticleOfInterest);\r
- fHistdEdxVsPTPCbeforePID -> Fill(track->P()*track->Charge(),track->GetTPCsignal());\r
- fHistProbTPCvsPtbeforePID -> Fill(track->Pt(),probTPC[fParticleOfInterest]); \r
- fHistNSigmaTPCvsPtbeforePID -> Fill(track->Pt(),nSigmaTPCForParticleOfInterest); \r
- fHistProbTPCTOFvsPtbeforePID -> Fill(track->Pt(),probTPCTOF[fParticleOfInterest]);\r
- //end of QA-before pid\r
- \r
- if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {\r
- //Make the decision based on the n-sigma\r
- if(fUsePIDnSigma) {\r
- if(nSigma > fPIDNSigma) continue;}\r
- \r
- //Make the decision based on the bayesian\r
- else if(fUsePIDPropabilities) {\r
- if(fParticleOfInterest != TMath::LocMax(AliPID::kSPECIES,prob)) continue;\r
- if (prob[fParticleOfInterest] < fMinAcceptedPIDProbability) continue; \r
- }\r
- \r
- //Fill QA after the PID\r
- fHistBetavsPTOFafterPID ->Fill(track->P()*track->Charge(),beta);\r
- fHistProbTOFvsPtafterPID ->Fill(track->Pt(),probTOF[fParticleOfInterest]);\r
- fHistNSigmaTOFvsPtafterPID ->Fill(track->Pt(),nSigmaTOFForParticleOfInterest);\r
- \r
- fHistdEdxVsPTPCafterPID -> Fill(track->P()*track->Charge(),track->GetTPCsignal());\r
- fHistProbTPCvsPtafterPID -> Fill(track->Pt(),probTPC[fParticleOfInterest]); \r
- fHistProbTPCTOFvsPtafterPID -> Fill(track->Pt(),probTPCTOF[fParticleOfInterest]);\r
- fHistNSigmaTPCvsPtafterPID -> Fill(track->Pt(),nSigmaTPCForParticleOfInterest); \r
- }\r
- }\r
- //===========================PID===============================//\r
- vCharge = trackTPC->Charge();\r
- vY = trackTPC->Y();\r
- vEta = trackTPC->Eta();\r
- vPhi = trackTPC->Phi();// * TMath::RadToDeg();\r
- vPt = trackTPC->Pt();\r
- fHistClus->Fill(trackTPC->GetITSclusters(0),nClustersTPC);\r
- fHistDCA->Fill(b[1],b[0]);\r
- fHistChi2->Fill(chi2PerClusterTPC,gCentrality);\r
- fHistPt->Fill(vPt,gCentrality);\r
- fHistEta->Fill(vEta,gCentrality);\r
- fHistPhi->Fill(vPhi,gCentrality);\r
- if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);\r
- else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);\r
- fHistRapidity->Fill(vY,gCentrality);\r
- if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);\r
- else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);\r
- \r
- //=======================================correction\r
- Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); \r
- //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);\r
-\r
- // add the track to the TObjArray\r
- tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); \r
-\r
- delete trackTPC;\r
- }//track loop\r
- }// ESD analysis\r
-\r
- else if(gAnalysisLevel == "MC"){\r
- if(!event) {\r
- AliError("mcEvent not available");\r
- return 0x0;\r
- }\r
-\r
- AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(event);\r
- if(gMCEvent) {\r
- // Loop over tracks in event\r
- for (Int_t iTracks = 0; iTracks < gMCEvent->GetNumberOfPrimaries(); iTracks++) {\r
- AliMCParticle* track = dynamic_cast<AliMCParticle *>(gMCEvent->GetTrack(iTracks));\r
- if (!track) {\r
- AliError(Form("Could not receive particle %d", iTracks));\r
- continue;\r
- }\r
- \r
- //exclude non stable particles\r
- if(!(gMCEvent->IsPhysicalPrimary(iTracks))) continue;\r
- \r
- vCharge = track->Charge();\r
- vEta = track->Eta();\r
- vPt = track->Pt();\r
- vY = track->Y();\r
- \r
- if( vPt < fPtMin || vPt > fPtMax) \r
- continue;\r
- if (!fUsePID) {\r
- if( vEta < fEtaMin || vEta > fEtaMax) continue;\r
- }\r
- else if (fUsePID){\r
- if( vY < fEtaMin || vY > fEtaMax) continue;\r
- }\r
-\r
- // Remove neutral tracks\r
- if( vCharge == 0 ) continue;\r
- \r
- //analyze one set of particles\r
- if(fUseMCPdgCode) {\r
- TParticle *particle = track->Particle();\r
- if(!particle) continue;\r
- \r
- Int_t gPdgCode = particle->GetPdgCode();\r
- if(TMath::Abs(fPDGCodeToBeAnalyzed) != TMath::Abs(gPdgCode)) \r
- continue;\r
- }\r
- \r
- //Use the acceptance parameterization\r
- if(fAcceptanceParameterization) {\r
- Double_t gRandomNumber = gRandom->Rndm();\r
- if(gRandomNumber > fAcceptanceParameterization->Eval(track->Pt())) \r
- continue;\r
- }\r
- \r
- //Exclude resonances\r
- if(fExcludeResonancesInMC) {\r
- TParticle *particle = track->Particle();\r
- if(!particle) continue;\r
- \r
- Bool_t kExcludeParticle = kFALSE;\r
- Int_t gMotherIndex = particle->GetFirstMother();\r
- if(gMotherIndex != -1) {\r
- AliMCParticle* motherTrack = dynamic_cast<AliMCParticle *>(event->GetTrack(gMotherIndex));\r
- if(motherTrack) {\r
- TParticle *motherParticle = motherTrack->Particle();\r
- if(motherParticle) {\r
- Int_t pdgCodeOfMother = motherParticle->GetPdgCode();\r
- //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {\r
- if(pdgCodeOfMother == 113 // rho0\r
- || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+\r
- // || pdgCodeOfMother == 221 // eta\r
- // || pdgCodeOfMother == 331 // eta'\r
- // || pdgCodeOfMother == 223 // omega\r
- // || pdgCodeOfMother == 333 // phi\r
- || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0\r
- // || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0*\r
- // || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+*\r
- || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda\r
- || pdgCodeOfMother == 111 // pi0 Dalitz\r
- ) {\r
- kExcludeParticle = kTRUE;\r
- }\r
- }\r
- }\r
- }\r
- \r
- //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi\r
- if(kExcludeParticle) continue;\r
- }\r
-\r
- //Exclude electrons with PDG\r
- if(fExcludeElectronsInMC) {\r
- \r
- TParticle *particle = track->Particle();\r
- \r
- if (particle){ \r
- if(TMath::Abs(particle->GetPdgCode()) == 11) continue;\r
- }\r
- }\r
- \r
- vPhi = track->Phi();\r
- //Printf("phi (before): %lf",vPhi);\r
- \r
- fHistPt->Fill(vPt,gCentrality);\r
- fHistEta->Fill(vEta,gCentrality);\r
- fHistPhi->Fill(vPhi,gCentrality);\r
- if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);\r
- else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);\r
- //fHistPhi->Fill(vPhi*TMath::RadToDeg(),gCentrality);\r
- fHistRapidity->Fill(vY,gCentrality);\r
- //if(vCharge > 0) fHistPhiPos->Fill(vPhi*TMath::RadToDeg(),gCentrality);\r
- //else if(vCharge < 0) fHistPhiNeg->Fill(vPhi*TMath::RadToDeg(),gCentrality);\r
- if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);\r
- else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);\r
- \r
- //Flow after burner\r
- if(fUseFlowAfterBurner) {\r
- Double_t precisionPhi = 0.001;\r
- Int_t maxNumberOfIterations = 100;\r
- \r
- Double_t phi0 = vPhi;\r
- Double_t gV2 = fDifferentialV2->Eval(vPt);\r
- \r
- for (Int_t j = 0; j < maxNumberOfIterations; j++) {\r
- Double_t phiprev = vPhi;\r
- Double_t fl = vPhi - phi0 + gV2*TMath::Sin(2.*(vPhi - gReactionPlane*TMath::DegToRad()));\r
- Double_t fp = 1.0 + 2.0*gV2*TMath::Cos(2.*(vPhi - gReactionPlane*TMath::DegToRad())); \r
- vPhi -= fl/fp;\r
- if (TMath::AreEqualAbs(phiprev,vPhi,precisionPhi)) break;\r
- }\r
- //Printf("phi (after): %lf\n",vPhi);\r
- Double_t vDeltaphiBefore = phi0 - gReactionPlane*TMath::DegToRad();\r
- if(vDeltaphiBefore < 0) vDeltaphiBefore += 2*TMath::Pi();\r
- fHistPhiBefore->Fill(vDeltaphiBefore,gCentrality);\r
- \r
- Double_t vDeltaphiAfter = vPhi - gReactionPlane*TMath::DegToRad();\r
- if(vDeltaphiAfter < 0) vDeltaphiAfter += 2*TMath::Pi();\r
- fHistPhiAfter->Fill(vDeltaphiAfter,gCentrality);\r
- \r
- }\r
- \r
- //vPhi *= TMath::RadToDeg();\r
- \r
- //=======================================correction\r
- Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); \r
- //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);\r
-\r
- tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); \r
- } //track loop\r
- }//MC event object\r
- }//MC\r
- \r
- return tracksAccepted; \r
-}\r
-\r
-//________________________________________________________________________\r
-TObjArray* AliAnalysisTaskBFPsi::GetShuffledTracks(TObjArray *tracks, Double_t gCentrality){\r
- // Clones TObjArray and returns it with tracks after shuffling the charges\r
-\r
- TObjArray* tracksShuffled = new TObjArray;\r
- tracksShuffled->SetOwner(kTRUE);\r
-\r
- vector<Short_t> *chargeVector = new vector<Short_t>; //original charge of accepted tracks \r
-\r
- for (Int_t i=0; i<tracks->GetEntriesFast(); i++)\r
- {\r
- AliVParticle* track = (AliVParticle*) tracks->At(i);\r
- chargeVector->push_back(track->Charge());\r
- } \r
- \r
- random_shuffle(chargeVector->begin(), chargeVector->end());\r
- \r
- for(Int_t i = 0; i < tracks->GetEntriesFast(); i++){\r
- AliVParticle* track = (AliVParticle*) tracks->At(i);\r
- //==============================correction\r
- Double_t correction = GetTrackbyTrackCorrectionMatrix(track->Eta(), track->Phi(),track->Pt(), chargeVector->at(i), gCentrality);\r
- //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);\r
- tracksShuffled->Add(new AliBFBasicParticle(track->Eta(), track->Phi(), track->Pt(),chargeVector->at(i), correction));\r
- }\r
-\r
- delete chargeVector;\r
- \r
- return tracksShuffled;\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskBFPsi::SetVZEROCalibrationFile(const char* filename,\r
- const char* lhcPeriod) {\r
- //Function to setup the VZERO gain equalization\r
- //============Get the equilization map============//\r
- TFile *calibrationFile = TFile::Open(filename);\r
- if((!calibrationFile)||(!calibrationFile->IsOpen())) {\r
- Printf("No calibration file found!!!");\r
- return;\r
- }\r
-\r
- TList *list = dynamic_cast<TList *>(calibrationFile->Get(lhcPeriod));\r
- if(!list) {\r
- Printf("Calibration TList not found!!!");\r
- return;\r
- }\r
-\r
- fHistVZEROAGainEqualizationMap = dynamic_cast<TH1F *>(list->FindObject("gHistVZEROAGainEqualizationMap"));\r
- if(!fHistVZEROAGainEqualizationMap) {\r
- Printf("VZERO-A calibration object not found!!!");\r
- return;\r
- }\r
- fHistVZEROCGainEqualizationMap = dynamic_cast<TH1F *>(list->FindObject("gHistVZEROCGainEqualizationMap"));\r
- if(!fHistVZEROCGainEqualizationMap) {\r
- Printf("VZERO-C calibration object not found!!!");\r
- return;\r
- }\r
-\r
- fHistVZEROChannelGainEqualizationMap = dynamic_cast<TH2F *>(list->FindObject("gHistVZEROChannelGainEqualizationMap"));\r
- if(!fHistVZEROChannelGainEqualizationMap) {\r
- Printf("VZERO channel calibration object not found!!!");\r
- return;\r
- }\r
-}\r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::GetChannelEqualizationFactor(Int_t run, \r
- Int_t channel) {\r
- //\r
- if(!fHistVZEROAGainEqualizationMap) return 1.0;\r
-\r
- for(Int_t iBinX = 1; iBinX <= fHistVZEROChannelGainEqualizationMap->GetNbinsX(); iBinX++) {\r
- Int_t gRunNumber = atoi(fHistVZEROChannelGainEqualizationMap->GetXaxis()->GetBinLabel(iBinX));\r
- if(gRunNumber == run)\r
- return fHistVZEROChannelGainEqualizationMap->GetBinContent(iBinX,channel+1);\r
- }\r
-\r
- return 1.0;\r
-}\r
-\r
-//________________________________________________________________________\r
-Double_t AliAnalysisTaskBFPsi::GetEqualizationFactor(Int_t run, \r
- const char* side) {\r
- //\r
- if(!fHistVZEROAGainEqualizationMap) return 1.0;\r
-\r
- TString gVZEROSide = side;\r
- for(Int_t iBinX = 1; iBinX < fHistVZEROAGainEqualizationMap->GetNbinsX(); iBinX++) {\r
- Int_t gRunNumber = atoi(fHistVZEROAGainEqualizationMap->GetXaxis()->GetBinLabel(iBinX));\r
- //cout<<"Looking for run "<<run<<" - current run: "<<gRunNumber<<endl;\r
- if(gRunNumber == run) {\r
- if(gVZEROSide == "A") \r
- return fHistVZEROAGainEqualizationMap->GetBinContent(iBinX);\r
- else if(gVZEROSide == "C") \r
- return fHistVZEROCGainEqualizationMap->GetBinContent(iBinX);\r
- }\r
- }\r
-\r
- return 1.0;\r
-}\r
-\r
-//____________________________________________________________________\r
-Bool_t AliAnalysisTaskBFPsi::AcceptEventCentralityWeight(Double_t centrality)\r
-{\r
- // copied from AliAnalysisTaskPhiCorrelations\r
- //\r
- // rejects "randomly" events such that the centrality gets flat\r
- // uses fCentralityWeights histogram\r
-\r
- // TODO code taken and adapted from AliRDHFCuts; waiting for general class AliCentralityFlattening\r
- \r
- Double_t weight = fCentralityWeights->GetBinContent(fCentralityWeights->FindBin(centrality));\r
- Double_t centralityDigits = centrality*100. - (Int_t)(centrality*100.);\r
- \r
- Bool_t result = kFALSE;\r
- if (centralityDigits < weight) \r
- result = kTRUE;\r
- \r
- AliInfo(Form("Centrality: %f; Digits: %f; Weight: %f; Result: %d", centrality, centralityDigits, weight, result));\r
- \r
- return result;\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskBFPsi::FinishTaskOutput(){\r
- //Printf("END BF");\r
-\r
- if (!fBalance) {\r
- AliError("fBalance not available");\r
- return;\r
- } \r
- if(fRunShuffling) {\r
- if (!fShuffledBalance) {\r
- AliError("fShuffledBalance not available");\r
- return;\r
- }\r
- }\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskBFPsi::Terminate(Option_t *) {\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
-\r
- // not implemented ...\r
-\r
-}\r
-\r
+#include "TChain.h"
+#include "TList.h"
+#include "TCanvas.h"
+#include "TLorentzVector.h"
+#include "TGraphErrors.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TH2D.h"
+#include "TH3D.h"
+#include "TArrayF.h"
+#include "TF1.h"
+#include "TRandom.h"
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisManager.h"
+
+#include "AliESDVertex.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliAODEvent.h"
+#include "AliAODTrack.h"
+#include "AliAODInputHandler.h"
+#include "AliAODMCParticle.h"
+#include "AliCollisionGeometry.h"
+#include "AliGenEventHeader.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliStack.h"
+#include "AliESDtrackCuts.h"
+#include "AliEventplane.h"
+#include "AliTHn.h"
+#include "AliLog.h"
+#include "AliAnalysisUtils.h"
+
+#include "AliEventPoolManager.h"
+
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliPIDCombined.h"
+
+#include "AliAnalysisTaskBFPsi.h"
+#include "AliBalancePsi.h"
+#include "AliAnalysisTaskTriggeredBF.h"
+
+
+// Analysis task for the BF vs Psi code
+// Authors: Panos.Christakoglou@nikhef.nl
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliAnalysisTaskBFPsi)
+
+//________________________________________________________________________
+AliAnalysisTaskBFPsi::AliAnalysisTaskBFPsi(const char *name)
+: AliAnalysisTaskSE(name),
+ fDebugLevel(kFALSE),
+ fArrayMC(0), //+++++++++++++
+ fBalance(0),
+ fRunShuffling(kFALSE),
+ fShuffledBalance(0),
+ fRunMixing(kFALSE),
+ fRunMixingEventPlane(kFALSE),
+ fMixingTracks(50000),
+ fMixedBalance(0),
+ fPoolMgr(0),
+ fList(0),
+ fListBF(0),
+ fListBFS(0),
+ fListBFM(0),
+ fHistListPIDQA(0),
+ fHistEventStats(0),
+ fHistCentStats(0),
+ fHistCentStatsUsed(0),
+ fHistTriggerStats(0),
+ fHistTrackStats(0),
+ fHistVx(0),
+ fHistVy(0),
+ fHistVz(0),
+ fHistTPCvsVZEROMultiplicity(0),
+ fHistVZEROSignal(0),
+ fHistEventPlane(0),
+ fHistClus(0),
+ fHistDCA(0),
+ fHistChi2(0),
+ fHistPt(0),
+ fHistEta(0),
+ fHistRapidity(0),
+ fHistPhi(0),
+ fHistEtaPhiPos(0),
+ fHistEtaPhiNeg(0),
+ fHistPhiBefore(0),
+ fHistPhiAfter(0),
+ fHistPhiPos(0),
+ fHistPhiNeg(0),
+ fHistV0M(0),
+ fHistRefTracks(0),
+ fHistdEdxVsPTPCbeforePID(NULL),
+ fHistBetavsPTOFbeforePID(NULL),
+ fHistProbTPCvsPtbeforePID(NULL),
+ fHistProbTOFvsPtbeforePID(NULL),
+ fHistProbTPCTOFvsPtbeforePID(NULL),
+ fHistNSigmaTPCvsPtbeforePID(NULL),
+ fHistNSigmaTOFvsPtbeforePID(NULL),
+ fHistBetaVsdEdXbeforePID(NULL), //+++++++
+ fHistNSigmaTPCTOFvsPtbeforePID(NULL), //++++++
+ fHistdEdxVsPTPCafterPID(NULL),
+ fHistBetavsPTOFafterPID(NULL),
+ fHistProbTPCvsPtafterPID(NULL),
+ fHistProbTOFvsPtafterPID(NULL),
+ fHistProbTPCTOFvsPtafterPID(NULL),
+ fHistNSigmaTPCvsPtafterPID(NULL),
+ fHistNSigmaTOFvsPtafterPID(NULL),
+ fHistBetaVsdEdXafterPID(NULL), //+++++++
+ fHistNSigmaTPCTOFvsPtafterPID(NULL), //+++++++
+ fHistdEdxVsPTPCbeforePIDelectron(NULL), //+++++++
+ fHistNSigmaTPCvsPtbeforePIDelectron(NULL), //+++++++
+ fHistdEdxVsPTPCafterPIDelectron(NULL), //+++++++
+ fHistNSigmaTPCvsPtafterPIDelectron(NULL), //+++++++
+ fCentralityArrayBinsForCorrections(kCENTRALITY),
+ fCentralityWeights(0x0),
+ fPIDResponse(0x0),
+ fPIDCombined(0x0),
+ fParticleOfInterest(kPion),
+ fPidDetectorConfig(kTPCTOF),
+ fUsePID(kFALSE),
+ fUsePIDnSigma(kTRUE),
+ fUsePIDPropabilities(kFALSE),
+ fPIDNSigma(3.),
+ fMinAcceptedPIDProbability(0.8),
+ fElectronRejection(kFALSE),
+ fElectronOnlyRejection(kFALSE),
+ fElectronRejectionNSigma(-1.),
+ fElectronRejectionMinPt(0.),
+ fElectronRejectionMaxPt(1000.),
+ fESDtrackCuts(0),
+ fCentralityEstimator("V0M"),
+ fUseCentrality(kFALSE),
+ fCentralityPercentileMin(0.),
+ fCentralityPercentileMax(5.),
+ fImpactParameterMin(0.),
+ fImpactParameterMax(20.),
+ fMultiplicityEstimator("V0A"),
+ fUseMultiplicity(kFALSE),
+ fNumberOfAcceptedTracksMin(0),
+ fNumberOfAcceptedTracksMax(10000),
+ fHistNumberOfAcceptedTracks(0),
+ fHistMultiplicity(0),
+ fUseOfflineTrigger(kFALSE),
+ fCheckFirstEventInChunk(kFALSE),
+ fCheckPileUp(kFALSE),
+ fCheckPrimaryFlagAOD(kFALSE),
+ fUseMCforKinematics(kFALSE),
+ fVxMax(0.3),
+ fVyMax(0.3),
+ fVzMax(10.),
+ fnAODtrackCutBit(128),
+ fPtMin(0.3),
+ fPtMax(1.5),
+ fPtMinForCorrections(0.3),//=================================correction
+ fPtMaxForCorrections(1.5),//=================================correction
+ fPtBinForCorrections(36), //=================================correction
+ fEtaMin(-0.8),
+ fEtaMax(-0.8),
+ fEtaMinForCorrections(-0.8),//=================================correction
+ fEtaMaxForCorrections(0.8),//=================================correction
+ fEtaBinForCorrections(16), //=================================correction
+ fPhiMin(0.),
+ fPhiMax(360.),
+ fPhiMinForCorrections(0.),//=================================correction
+ fPhiMaxForCorrections(360.),//=================================correction
+ fPhiBinForCorrections(100), //=================================correction
+ fDCAxyCut(-1),
+ fDCAzCut(-1),
+ fTPCchi2Cut(-1),
+ fNClustersTPCCut(-1),
+ fAcceptanceParameterization(0),
+ fDifferentialV2(0),
+ fUseFlowAfterBurner(kFALSE),
+ fExcludeResonancesInMC(kFALSE),
+ fExcludeElectronsInMC(kFALSE),
+ fUseMCPdgCode(kFALSE),
+ fPDGCodeToBeAnalyzed(-1),
+ fEventClass("EventPlane"),
+ fCustomBinning(""),
+ fHistVZEROAGainEqualizationMap(0),
+ fHistVZEROCGainEqualizationMap(0),
+ fHistVZEROChannelGainEqualizationMap(0) {
+ // Constructor
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+
+ //======================================================correction
+ for (Int_t i=0; i<kCENTRALITY; i++){
+ fHistCorrectionPlus[i] = NULL;
+ fHistCorrectionMinus[i] = NULL;
+ fCentralityArrayForCorrections[i] = -1.;
+ }
+ //=====================================================correction
+
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, TList::Class());
+ DefineOutput(3, TList::Class());
+ DefineOutput(4, TList::Class());
+ DefineOutput(5, TList::Class());
+}
+
+//________________________________________________________________________
+AliAnalysisTaskBFPsi::~AliAnalysisTaskBFPsi() {
+
+ // delete fBalance;
+ // delete fShuffledBalance;
+ // delete fList;
+ // delete fListBF;
+ // delete fListBFS;
+
+ // delete fHistEventStats;
+ // delete fHistTrackStats;
+ // delete fHistVx;
+ // delete fHistVy;
+ // delete fHistVz;
+
+ // delete fHistClus;
+ // delete fHistDCA;
+ // delete fHistChi2;
+ // delete fHistPt;
+ // delete fHistEta;
+ // delete fHistPhi;
+ // delete fHistEtaPhiPos;
+ // delete fHistEtaPhiNeg;
+ // delete fHistV0M;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskBFPsi::UserCreateOutputObjects() {
+ // Create histograms
+ // Called once
+
+ // global switch disabling the reference
+ // (to avoid "Replacing existing TH1" if several wagons are created in train)
+ Bool_t oldStatus = TH1::AddDirectoryStatus();
+ TH1::AddDirectory(kFALSE);
+
+ if(!fBalance) {
+ fBalance = new AliBalancePsi();
+ fBalance->SetAnalysisLevel("ESD");
+ fBalance->SetEventClass(fEventClass);
+ //fBalance->SetNumberOfBins(-1,16);
+ //fBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6,15.);
+ }
+ if(fRunShuffling) {
+ if(!fShuffledBalance) {
+ fShuffledBalance = new AliBalancePsi();
+ fShuffledBalance->SetAnalysisLevel("ESD");
+ fShuffledBalance->SetEventClass(fEventClass);
+ //fShuffledBalance->SetNumberOfBins(-1,16);
+ //fShuffledBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6,15.);
+ }
+ }
+ if(fRunMixing) {
+ if(!fMixedBalance) {
+ fMixedBalance = new AliBalancePsi();
+ fMixedBalance->SetAnalysisLevel("ESD");
+ fMixedBalance->SetEventClass(fEventClass);
+ }
+ }
+
+ //QA list
+ fList = new TList();
+ fList->SetName("listQA");
+ fList->SetOwner();
+
+ //Balance Function list
+ fListBF = new TList();
+ fListBF->SetName("listBF");
+ fListBF->SetOwner();
+
+ if(fRunShuffling) {
+ fListBFS = new TList();
+ fListBFS->SetName("listBFShuffled");
+ fListBFS->SetOwner();
+ }
+
+ if(fRunMixing) {
+ fListBFM = new TList();
+ fListBFM->SetName("listTriggeredBFMixed");
+ fListBFM->SetOwner();
+ }
+
+ //PID QA list
+ if(fUsePID || fElectronRejection) {
+ fHistListPIDQA = new TList();
+ fHistListPIDQA->SetName("listQAPID");
+ fHistListPIDQA->SetOwner();
+ }
+
+ //Event stats.
+ TString gCutName[7] = {"Total","Offline trigger",
+ "Vertex","Analyzed","sel. Centrality","Not1stEvInChunk","No Pile-Up"};
+ fHistEventStats = new TH2F("fHistEventStats",
+ "Event statistics;;Centrality percentile;N_{events}",
+ 7,0.5,7.5,220,-5,105);
+ for(Int_t i = 1; i <= 7; i++)
+ fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1].Data());
+ fList->Add(fHistEventStats);
+
+ TString gCentName[13] = {"V0M","V0A","V0C","FMD","TRK","TKL","CL0","CL1","ZNA","ZPA","V0MvsFMD","TKLvsV0M","ZEMvsZDC"};
+ fHistCentStats = new TH2F("fHistCentStats",
+ "Centrality statistics;;Cent percentile",
+ 13,-0.5,12.5,220,-5,105);
+ for(Int_t i = 1; i <= 13; i++){
+ fHistCentStats->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());
+ //fHistCentStatsUsed->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());
+ }
+ fList->Add(fHistCentStats);
+
+ fHistCentStatsUsed = new TH2F("fHistCentStatsUsed","Centrality statistics;;Cent percentile", 1,-0.5,0.5,220,-5,105);
+ fHistCentStatsUsed->GetXaxis()->SetBinLabel(1,fCentralityEstimator.Data());
+ fList->Add(fHistCentStatsUsed);
+
+ fHistTriggerStats = new TH1F("fHistTriggerStats","Trigger statistics;TriggerBit;N_{events}",1025,0,1025);
+ fList->Add(fHistTriggerStats);
+
+ fHistTrackStats = new TH1F("fHistTrackStats","Event statistics;TrackFilterBit;N_{events}",16,0,16);
+ fList->Add(fHistTrackStats);
+
+ fHistNumberOfAcceptedTracks = new TH2F("fHistNumberOfAcceptedTracks",";N_{acc.};Centrality percentile;Entries",4001,-0.5,4000.5,220,-5,105);
+ fList->Add(fHistNumberOfAcceptedTracks);
+
+ fHistMultiplicity = new TH1F("fHistMultiplicity",";N_{ch.};Entries",30001,-0.5,30000.5);
+ fList->Add(fHistMultiplicity);
+
+ // Vertex distributions
+ fHistVx = new TH1F("fHistVx","Primary vertex distribution - x coordinate;V_{x} (cm);Entries",100,-0.5,0.5);
+ fList->Add(fHistVx);
+ fHistVy = new TH1F("fHistVy","Primary vertex distribution - y coordinate;V_{y} (cm);Entries",100,-0.5,0.5);
+ fList->Add(fHistVy);
+ fHistVz = new TH2F("fHistVz","Primary vertex distribution - z coordinate;V_{z} (cm);Centrality percentile;Entries",100,-20.,20.,220,-5,105);
+ fList->Add(fHistVz);
+
+ //TPC vs VZERO multiplicity
+ fHistTPCvsVZEROMultiplicity = new TH2F("fHistTPCvsVZEROMultiplicity","VZERO vs TPC multiplicity",10001,-0.5,10000.5,4001,-0.5,4000.5);
+ if(fMultiplicityEstimator == "V0A")
+ fHistTPCvsVZEROMultiplicity->GetXaxis()->SetTitle("VZERO-A multiplicity (a.u.)");
+ else if(fMultiplicityEstimator == "V0C")
+ fHistTPCvsVZEROMultiplicity->GetXaxis()->SetTitle("VZERO-C multiplicity (a.u.)");
+ else
+ fHistTPCvsVZEROMultiplicity->GetXaxis()->SetTitle("VZERO multiplicity (a.u.)");
+ fList->Add(fHistTPCvsVZEROMultiplicity);
+
+ fHistVZEROSignal = new TH2F("fHistVZEROSignal","VZERO signal vs VZERO channel;VZERO channel; Signal (a.u.)",64,0.5,64.5,3001,-0.5,30000.5);
+ fList->Add(fHistVZEROSignal);
+
+ //Event plane
+ fHistEventPlane = new TH2F("fHistEventPlane",";#Psi_{2} [deg.];Centrality percentile;Counts",100,0,360.,220,-5,105);
+ fList->Add(fHistEventPlane);
+
+ // QA histograms
+ fHistClus = new TH2F("fHistClus","# Cluster (TPC vs. ITS)",10,0,10,200,0,200);
+ fList->Add(fHistClus);
+ fHistChi2 = new TH2F("fHistChi2","Chi2/NDF distribution;#chi^{2}/ndf;Centrality percentile",200,0,10,220,-5,105);
+ fList->Add(fHistChi2);
+ fHistDCA = new TH2F("fHistDCA","DCA (xy vs. z)",400,-5,5,400,-5,5);
+ fList->Add(fHistDCA);
+ fHistPt = new TH2F("fHistPt","p_{T} distribution;p_{T} (GeV/c);Centrality percentile",200,0,10,220,-5,105);
+ fList->Add(fHistPt);
+ fHistEta = new TH2F("fHistEta","#eta distribution;#eta;Centrality percentile",200,-2,2,220,-5,105);
+ fList->Add(fHistEta);
+ fHistRapidity = new TH2F("fHistRapidity","y distribution;y;Centrality percentile",200,-2,2,220,-5,105);
+ fList->Add(fHistRapidity);
+ fHistPhi = new TH2F("fHistPhi","#phi distribution;#phi (rad);Centrality percentile",200,0.0,2.*TMath::Pi(),220,-5,105);
+ fList->Add(fHistPhi);
+ fHistEtaPhiPos = new TH3F("fHistEtaPhiPos","#eta-#phi distribution (+);#eta;#phi (rad);Centrality percentile",80,-2,2,72,0.0,2.*TMath::Pi(),220,-5,105);
+ fList->Add(fHistEtaPhiPos);
+ fHistEtaPhiNeg = new TH3F("fHistEtaPhiNeg","#eta-#phi distribution (-);#eta;#phi (rad);Centrality percentile",80,-2,2,72,0.0,2.*TMath::Pi(),220,-5,105);
+ fList->Add(fHistEtaPhiNeg);
+ fHistPhiBefore = new TH2F("fHistPhiBefore","#phi distribution;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);
+ fList->Add(fHistPhiBefore);
+ fHistPhiAfter = new TH2F("fHistPhiAfter","#phi distribution;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);
+ fList->Add(fHistPhiAfter);
+ fHistPhiPos = new TH2F("fHistPhiPos","#phi distribution for positive particles;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);
+ fList->Add(fHistPhiPos);
+ fHistPhiNeg = new TH2F("fHistPhiNeg","#phi distribution for negative particles;#phi;Centrality percentile",200,0.,2.*TMath::Pi(),220,-5,105);
+ fList->Add(fHistPhiNeg);
+ fHistV0M = new TH2F("fHistV0M","V0 Multiplicity C vs. A",500, 0, 20000, 500, 0, 20000);
+ fList->Add(fHistV0M);
+ TString gRefTrackName[6] = {"tracks","tracksPos","tracksNeg","tracksTPConly","clusITS0","clusITS1"};
+ fHistRefTracks = new TH2F("fHistRefTracks","Nr of Ref tracks/event vs. ref track estimator;;Nr of tracks",6, 0, 6, 400, 0, 20000);
+ for(Int_t i = 1; i <= 6; i++)
+ fHistRefTracks->GetXaxis()->SetBinLabel(i,gRefTrackName[i-1].Data());
+ fList->Add(fHistRefTracks);
+
+ // Balance function histograms
+ // Initialize histograms if not done yet (including the custom binning)
+ if(!fBalance->GetHistNp()){
+ AliInfo("Histograms not yet initialized! --> Will be done now");
+ fBalance->SetCustomBinning(fCustomBinning);
+ fBalance->InitHistograms();
+ }
+
+ if(fRunShuffling) {
+ if(!fShuffledBalance->GetHistNp()) {
+ AliInfo("Histograms (shuffling) not yet initialized! --> Will be done now");
+ fShuffledBalance->SetCustomBinning(fCustomBinning);
+ fShuffledBalance->InitHistograms();
+ }
+ }
+
+ if(fRunMixing) {
+ if(!fMixedBalance->GetHistNp()) {
+ AliInfo("Histograms (mixing) not yet initialized! --> Will be done now");
+ fMixedBalance->SetCustomBinning(fCustomBinning);
+ fMixedBalance->InitHistograms();
+ }
+ }
+
+ // QA histograms for different cuts
+ fList->Add(fBalance->GetQAHistHBTbefore());
+ fList->Add(fBalance->GetQAHistHBTafter());
+ fList->Add(fBalance->GetQAHistConversionbefore());
+ fList->Add(fBalance->GetQAHistConversionafter());
+ fList->Add(fBalance->GetQAHistPsiMinusPhi());
+ fList->Add(fBalance->GetQAHistResonancesBefore());
+ fList->Add(fBalance->GetQAHistResonancesRho());
+ fList->Add(fBalance->GetQAHistResonancesK0());
+ fList->Add(fBalance->GetQAHistResonancesLambda());
+ fList->Add(fBalance->GetQAHistQbefore());
+ fList->Add(fBalance->GetQAHistQafter());
+
+ //for(Int_t a = 0; a < ANALYSIS_TYPES; a++){
+ fListBF->Add(fBalance->GetHistNp());
+ fListBF->Add(fBalance->GetHistNn());
+ fListBF->Add(fBalance->GetHistNpn());
+ fListBF->Add(fBalance->GetHistNnn());
+ fListBF->Add(fBalance->GetHistNpp());
+ fListBF->Add(fBalance->GetHistNnp());
+
+ if(fRunShuffling) {
+ fListBFS->Add(fShuffledBalance->GetHistNp());
+ fListBFS->Add(fShuffledBalance->GetHistNn());
+ fListBFS->Add(fShuffledBalance->GetHistNpn());
+ fListBFS->Add(fShuffledBalance->GetHistNnn());
+ fListBFS->Add(fShuffledBalance->GetHistNpp());
+ fListBFS->Add(fShuffledBalance->GetHistNnp());
+ }
+
+ if(fRunMixing) {
+ fListBFM->Add(fMixedBalance->GetHistNp());
+ fListBFM->Add(fMixedBalance->GetHistNn());
+ fListBFM->Add(fMixedBalance->GetHistNpn());
+ fListBFM->Add(fMixedBalance->GetHistNnn());
+ fListBFM->Add(fMixedBalance->GetHistNpp());
+ fListBFM->Add(fMixedBalance->GetHistNnp());
+ }
+ //}
+
+
+ // Event Mixing
+ if(fRunMixing){
+ Int_t trackDepth = fMixingTracks;
+ Int_t poolsize = 1000; // Maximum number of events, ignored in the present implemented of AliEventPoolManager
+
+ // centrality bins
+ Double_t* centbins = NULL;
+ Int_t nCentralityBins;
+ if(fBalance->IsUseVertexBinning()){
+ centbins = fBalance->GetBinning(fBalance->GetBinningString(), "centralityVertex", nCentralityBins);
+ }
+ else{
+ centbins = fBalance->GetBinning(fBalance->GetBinningString(), "centrality", nCentralityBins);
+ }
+
+ // multiplicity bins
+ Double_t* multbins = NULL;
+ Int_t nMultiplicityBins;
+ multbins = fBalance->GetBinning(fBalance->GetBinningString(), "multiplicity", nMultiplicityBins);
+
+ // Zvtx bins
+ Double_t* vtxbins = NULL;
+ Int_t nVertexBins;
+ if(fBalance->IsUseVertexBinning()){
+ vtxbins = fBalance->GetBinning(fBalance->GetBinningString(), "vertexVertex", nVertexBins);
+ }
+ else{
+ vtxbins = fBalance->GetBinning(fBalance->GetBinningString(), "vertex", nVertexBins);
+ }
+
+ // Event plane angle (Psi) bins
+ Double_t* psibins = NULL;
+ Int_t nPsiBins;
+ psibins = fBalance->GetBinning(fBalance->GetBinningString(), "eventPlane", nPsiBins);
+
+
+ // run the event mixing also in bins of event plane (statistics!)
+ if(fRunMixingEventPlane){
+ if(fEventClass=="Multiplicity"){
+ if(multbins && vtxbins && psibins){
+ fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nMultiplicityBins, multbins, nVertexBins, vtxbins, nPsiBins, psibins);
+ }
+ }
+ else{
+ if(centbins && vtxbins && psibins){
+ fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins, nPsiBins, psibins);
+ }
+ }
+ }
+ else{
+ if(fEventClass=="Multiplicity"){
+ if(multbins && vtxbins){
+ fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nMultiplicityBins, multbins, nVertexBins, vtxbins);
+ }
+ }
+ else{
+ if(centbins && vtxbins){
+ fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins);
+ }
+ }
+ }
+
+ // check pool manager
+ if(!fPoolMgr){
+ AliError("Event Mixing required, but Pool Manager not initialized...");
+ return;
+ }
+ }
+
+ if(fESDtrackCuts) fList->Add(fESDtrackCuts);
+
+ //====================PID========================//
+ if(fUsePID) {
+ fPIDCombined = new AliPIDCombined();
+ fPIDCombined->SetDefaultTPCPriors();
+
+ fHistdEdxVsPTPCbeforePID = new TH2D ("dEdxVsPTPCbefore","dEdxVsPTPCbefore", 1000, -10.0, 10.0, 1000, 0, 1000);
+ fHistListPIDQA->Add(fHistdEdxVsPTPCbeforePID);
+
+ fHistBetavsPTOFbeforePID = new TH2D ("BetavsPTOFbefore","BetavsPTOFbefore", 1000, -10.0, 10., 1000, 0, 1.2);
+ fHistListPIDQA->Add(fHistBetavsPTOFbeforePID);
+
+ fHistProbTPCvsPtbeforePID = new TH2D ("ProbTPCvsPtbefore","ProbTPCvsPtbefore", 1000, -10.0,10.0, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTPCvsPtbeforePID);
+
+ fHistProbTOFvsPtbeforePID = new TH2D ("ProbTOFvsPtbefore","ProbTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTOFvsPtbeforePID);
+
+ fHistProbTPCTOFvsPtbeforePID =new TH2D ("ProbTPCTOFvsPtbefore","ProbTPCTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTPCTOFvsPtbeforePID);
+
+ fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePID);
+
+ fHistNSigmaTOFvsPtbeforePID = new TH2D ("NSigmaTOFvsPtbefore","NSigmaTOFvsPtbefore", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTOFvsPtbeforePID);
+
+ fHistBetaVsdEdXbeforePID = new TH2D ("BetaVsdEdXbefore","BetaVsdEdXbefore", 1000, 0., 1000, 1000, 0, 1.2);
+ fHistListPIDQA->Add(fHistBetaVsdEdXbeforePID); //++++++++
+
+ fHistNSigmaTPCTOFvsPtbeforePID = new TH2D ("NSigmaTPCTOFvsPtbefore","NSigmaTPCTOFvsPtbefore", 1000, -10., 10., 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtbeforePID); //++++++++
+
+ fHistdEdxVsPTPCafterPID = new TH2D ("dEdxVsPTPCafter","dEdxVsPTPCafter", 1000, -10, 10, 1000, 0, 1000);
+ fHistListPIDQA->Add(fHistdEdxVsPTPCafterPID);
+
+ fHistBetavsPTOFafterPID = new TH2D ("BetavsPTOFafter","BetavsPTOFafter", 1000, -10, 10, 1000, 0, 1.2);
+ fHistListPIDQA->Add(fHistBetavsPTOFafterPID);
+
+ fHistProbTPCvsPtafterPID = new TH2D ("ProbTPCvsPtafter","ProbTPCvsPtafter", 1000, -10, 10, 1000, 0, 2);
+ fHistListPIDQA->Add(fHistProbTPCvsPtafterPID);
+
+ fHistProbTOFvsPtafterPID = new TH2D ("ProbTOFvsPtafter","ProbTOFvsPtafter", 1000, -10, 10, 1000, 0, 2);
+ fHistListPIDQA->Add(fHistProbTOFvsPtafterPID);
+
+ fHistProbTPCTOFvsPtafterPID =new TH2D ("ProbTPCTOFvsPtafter","ProbTPCTOFvsPtafter", 1000, -50, 50, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTPCTOFvsPtafterPID);
+
+ fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPID);
+
+ fHistNSigmaTOFvsPtafterPID = new TH2D ("NSigmaTOFvsPtafter","NSigmaTOFvsPtafter", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTOFvsPtafterPID);
+
+ fHistBetaVsdEdXafterPID = new TH2D ("BetaVsdEdXafter","BetaVsdEdXafter", 1000, 0., 1000, 1000, 0, 1.2);
+ fHistListPIDQA->Add(fHistBetaVsdEdXafterPID); //++++++++
+
+ fHistNSigmaTPCTOFvsPtafterPID = new TH2D ("NSigmaTPCTOFvsPtafter","NSigmaTPCTOFvsPtafter", 1000, -10., 10., 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtafterPID); //++++++++
+ }
+
+ // for electron rejection only TPC nsigma histograms
+ if(fElectronRejection) {
+
+ fHistdEdxVsPTPCbeforePIDelectron = new TH2D ("dEdxVsPTPCbeforeelectron","dEdxVsPTPCbeforeelectron", 1000, -10.0, 10.0, 1000, 0, 1000);
+ fHistListPIDQA->Add(fHistdEdxVsPTPCbeforePIDelectron);
+
+ fHistNSigmaTPCvsPtbeforePIDelectron = new TH2D ("NSigmaTPCvsPtbeforeelectron","NSigmaTPCvsPtbeforeelectron", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePIDelectron);
+
+ fHistdEdxVsPTPCafterPIDelectron = new TH2D ("dEdxVsPTPCafterelectron","dEdxVsPTPCafterelectron", 1000, -10, 10, 1000, 0, 1000);
+ fHistListPIDQA->Add(fHistdEdxVsPTPCafterPIDelectron);
+
+ fHistNSigmaTPCvsPtafterPIDelectron = new TH2D ("NSigmaTPCvsPtafterelectron","NSigmaTPCvsPtafterelectron", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPIDelectron);
+ }
+ //====================PID========================//
+
+ // Post output data.
+ PostData(1, fList);
+ PostData(2, fListBF);
+ if(fRunShuffling) PostData(3, fListBFS);
+ if(fRunMixing) PostData(4, fListBFM);
+ if(fUsePID || fElectronRejection) PostData(5, fHistListPIDQA); //PID
+
+ AliInfo("Finished setting up the Output");
+
+ TH1::AddDirectory(oldStatus);
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskBFPsi::SetInputCorrection(TString filename,
+ Int_t nCentralityBins,
+ Double_t *centralityArrayForCorrections) {
+ //Open files that will be used for correction
+ fCentralityArrayBinsForCorrections = nCentralityBins;
+ for (Int_t i=0; i<nCentralityBins; i++)
+ fCentralityArrayForCorrections[i] = centralityArrayForCorrections[i];
+
+ // No file specified -> run without corrections
+ if(!filename.Contains(".root")) {
+ AliInfo(Form("No correction file specified (= %s) --> run without corrections",filename.Data()));
+ return;
+ }
+
+ //Open the input file
+ TFile *f = TFile::Open(filename);
+ if(!f->IsOpen()) {
+ AliInfo(Form("File %s not found --> run without corrections",filename.Data()));
+ return;
+ }
+
+ //TString listEffName = "";
+ for (Int_t iCent = 0; iCent < fCentralityArrayBinsForCorrections-1; iCent++) {
+ //Printf("iCent %d:",iCent);
+ TString histoName = "fHistCorrectionPlus";
+ histoName += Form("%d-%d",(Int_t)(fCentralityArrayForCorrections[iCent]),(Int_t)(fCentralityArrayForCorrections[iCent+1]));
+ fHistCorrectionPlus[iCent]= dynamic_cast<TH3F *>(f->Get(histoName.Data()));
+ if(!fHistCorrectionPlus[iCent]) {
+ AliError(Form("fHist %s not found!!!",histoName.Data()));
+ return;
+ }
+
+ histoName = "fHistCorrectionMinus";
+ histoName += Form("%d-%d",(Int_t)(fCentralityArrayForCorrections[iCent]),(Int_t)(fCentralityArrayForCorrections[iCent+1]));
+ fHistCorrectionMinus[iCent] = dynamic_cast<TH3F *>(f->Get(histoName.Data()));
+ if(!fHistCorrectionMinus[iCent]) {
+ AliError(Form("fHist %s not found!!!",histoName.Data()));
+ return;
+ }
+ }//loop over centralities: ONLY the PbPb case is covered
+
+ if(fHistCorrectionPlus[0]){
+ fEtaMinForCorrections = fHistCorrectionPlus[0]->GetXaxis()->GetXmin();
+ fEtaMaxForCorrections = fHistCorrectionPlus[0]->GetXaxis()->GetXmax();
+ fEtaBinForCorrections = fHistCorrectionPlus[0]->GetNbinsX();
+
+ fPtMinForCorrections = fHistCorrectionPlus[0]->GetYaxis()->GetXmin();
+ fPtMaxForCorrections = fHistCorrectionPlus[0]->GetYaxis()->GetXmax();
+ fPtBinForCorrections = fHistCorrectionPlus[0]->GetNbinsY();
+
+ fPhiMinForCorrections = fHistCorrectionPlus[0]->GetZaxis()->GetXmin();
+ fPhiMaxForCorrections = fHistCorrectionPlus[0]->GetZaxis()->GetXmax();
+ fPhiBinForCorrections = fHistCorrectionPlus[0]->GetNbinsZ();
+ }
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskBFPsi::UserExec(Option_t *) {
+ // Main loop
+ // Called for each event
+
+ TString gAnalysisLevel = fBalance->GetAnalysisLevel();
+ Int_t gNumberOfAcceptedTracks = 0;
+ Double_t lMultiplicityVar = -999.; //-1
+ Double_t gReactionPlane = -1.;
+ Float_t bSign = 0.;
+
+ // get the event (for generator level: MCEvent())
+ AliVEvent* eventMain = NULL;
+ if(gAnalysisLevel == "MC") {
+ eventMain = dynamic_cast<AliVEvent*>(MCEvent());
+ }
+ else{
+ eventMain = dynamic_cast<AliVEvent*>(InputEvent());
+ // for HBT like cuts need magnetic field sign
+ bSign = (eventMain->GetMagneticField() > 0) ? 1 : -1;
+ }
+ if(!eventMain) {
+ AliError("eventMain not available");
+ return;
+ }
+
+ // PID Response task active?
+ if(fUsePID || fElectronRejection) {
+ fPIDResponse = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetPIDResponse();
+ if (!fPIDResponse) AliFatal("This Task needs the PID response attached to the inputHandler");
+ }
+
+ // check event cuts and fill event histograms
+ if((lMultiplicityVar = IsEventAccepted(eventMain)) < 0){
+ return;
+ }
+ // get the reaction plane
+ if(fEventClass != "Multiplicity") {
+ gReactionPlane = GetEventPlane(eventMain);
+ fHistEventPlane->Fill(gReactionPlane,lMultiplicityVar);
+ if(gReactionPlane < 0){
+ return;
+ }
+ }
+
+ // get the accepted tracks in main event
+ TObjArray *tracksMain = GetAcceptedTracks(eventMain,lMultiplicityVar,gReactionPlane);
+ gNumberOfAcceptedTracks = tracksMain->GetEntriesFast();
+
+ //multiplicity cut (used in pp)
+ fHistNumberOfAcceptedTracks->Fill(gNumberOfAcceptedTracks,lMultiplicityVar);
+
+ // store charges of all accepted tracks,shuffle and reassign(two extra loops)
+ TObjArray* tracksShuffled = NULL;
+ if(fRunShuffling){
+ tracksShuffled = GetShuffledTracks(tracksMain,lMultiplicityVar);
+ }
+
+ // Event mixing
+ if (fRunMixing)
+ {
+ // 1. First get an event pool corresponding in mult (cent) and
+ // zvertex to the current event. Once initialized, the pool
+ // should contain nMix (reduced) events. This routine does not
+ // pre-scan the chain. The first several events of every chain
+ // will be skipped until the needed pools are filled to the
+ // specified depth. If the pool categories are not too rare, this
+ // should not be a problem. If they are rare, you could lose`
+ // statistics.
+
+ // 2. Collect the whole pool's content of tracks into one TObjArray
+ // (bgTracks), which is effectively a single background super-event.
+
+ // 3. The reduced and bgTracks arrays must both be passed into
+ // FillCorrelations(). Also nMix should be passed in, so a weight
+ // of 1./nMix can be applied.
+
+ AliEventPool* pool = fPoolMgr->GetEventPool(lMultiplicityVar, eventMain->GetPrimaryVertex()->GetZ(),gReactionPlane);
+
+ if (!pool){
+ AliFatal(Form("No pool found for centrality = %f, zVtx = %f, psi = %f", lMultiplicityVar, eventMain->GetPrimaryVertex()->GetZ(),gReactionPlane));
+ }
+ else{
+
+ //pool->SetDebug(1);
+
+ if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5){
+
+
+ Int_t nMix = pool->GetCurrentNEvents();
+ //cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl;
+
+ //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(2);
+ //((TH2F*) fListOfHistos->FindObject("mixedDist"))->Fill(centrality, pool->NTracksInPool());
+ //if (pool->IsReady())
+ //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(3);
+
+ // Fill mixed-event histos here
+ for (Int_t jMix=0; jMix<nMix; jMix++)
+ {
+ TObjArray* tracksMixed = pool->GetEvent(jMix);
+ fMixedBalance->CalculateBalance(gReactionPlane,tracksMain,tracksMixed,bSign,lMultiplicityVar,eventMain->GetPrimaryVertex()->GetZ());
+ }
+ }
+
+ // Update the Event pool
+ pool->UpdatePool(tracksMain);
+ //pool->PrintInfo();
+
+ }//pool NULL check
+ }//run mixing
+
+ // calculate balance function
+ fBalance->CalculateBalance(gReactionPlane,tracksMain,NULL,bSign,lMultiplicityVar,eventMain->GetPrimaryVertex()->GetZ());
+
+ // calculate shuffled balance function
+ if(fRunShuffling && tracksShuffled != NULL) {
+ fShuffledBalance->CalculateBalance(gReactionPlane,tracksShuffled,NULL,bSign,lMultiplicityVar,eventMain->GetPrimaryVertex()->GetZ());
+ }
+}
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::IsEventAccepted(AliVEvent *event){
+ // Checks the Event cuts
+ // Fills Event statistics histograms
+
+ Bool_t isSelectedMain = kTRUE;
+ Float_t gRefMultiplicity = -1.;
+ TString gAnalysisLevel = fBalance->GetAnalysisLevel();
+
+ AliMCEvent *mcevent = dynamic_cast<AliMCEvent*>(event);
+
+ fHistEventStats->Fill(1,gRefMultiplicity); //all events
+
+ // check first event in chunk (is not needed for new reconstructions)
+ if(fCheckFirstEventInChunk){
+ AliAnalysisUtils ut;
+ if(ut.IsFirstEventInChunk(event))
+ return -1.;
+ fHistEventStats->Fill(6,gRefMultiplicity);
+ }
+ // check for pile-up event
+ if(fCheckPileUp){
+ AliAnalysisUtils ut;
+ ut.SetUseMVPlpSelection(kTRUE);
+ ut.SetUseOutOfBunchPileUp(kTRUE);
+ if(ut.IsPileUpEvent(event))
+ return -1.;
+ fHistEventStats->Fill(7,gRefMultiplicity);
+ }
+
+ // Event trigger bits
+ fHistTriggerStats->Fill(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected());
+ if(fUseOfflineTrigger)
+ isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+
+ if(isSelectedMain) {
+ fHistEventStats->Fill(2,gRefMultiplicity); //triggered events
+
+ // Event Vertex MC
+ if(gAnalysisLevel == "MC") {
+ if(!event) {
+ AliError("mcEvent not available");
+ return 0x0;
+ }
+
+ if(mcevent){
+ AliGenEventHeader *header = dynamic_cast<AliGenEventHeader*>(mcevent->GenEventHeader());
+ if(header){
+ TArrayF gVertexArray;
+ header->PrimaryVertex(gVertexArray);
+ //Printf("Vertex: %lf (x) - %lf (y) - %lf (z)",
+ //gVertexArray.At(0),
+ //gVertexArray.At(1),
+ //gVertexArray.At(2));
+ fHistEventStats->Fill(3,gRefMultiplicity); //events with a proper vertex
+ if(TMath::Abs(gVertexArray.At(0)) < fVxMax) {
+ if(TMath::Abs(gVertexArray.At(1)) < fVyMax) {
+ if(TMath::Abs(gVertexArray.At(2)) < fVzMax) {
+ fHistEventStats->Fill(4,gRefMultiplicity);//analyzed events
+
+ // get the reference multiplicty or centrality
+ gRefMultiplicity = GetRefMultiOrCentrality(event);
+
+ fHistVx->Fill(gVertexArray.At(0));
+ fHistVy->Fill(gVertexArray.At(1));
+ fHistVz->Fill(gVertexArray.At(2),gRefMultiplicity);
+
+ // take only events inside centrality class
+ if(fUseCentrality) {
+ if((fImpactParameterMin < gRefMultiplicity) && (fImpactParameterMax > gRefMultiplicity)){
+ fHistEventStats->Fill(5,gRefMultiplicity); //events with correct centrality
+ return gRefMultiplicity;
+ }//centrality class
+ }
+ // take events only within the same multiplicity class
+ else if(fUseMultiplicity) {
+ if((gRefMultiplicity > fNumberOfAcceptedTracksMin) && (gRefMultiplicity < fNumberOfAcceptedTracksMax)) {
+ fHistEventStats->Fill(5,gRefMultiplicity); //events with correct multiplicity
+ return gRefMultiplicity;
+ }
+ }//multiplicity range
+ }//Vz cut
+ }//Vy cut
+ }//Vx cut
+ }//header
+ }//MC event object
+ }//MC
+
+ // Event Vertex AOD, ESD, ESDMC
+ else{
+ const AliVVertex *vertex = event->GetPrimaryVertex();
+
+ if(vertex) {
+ Double32_t fCov[6];
+ vertex->GetCovarianceMatrix(fCov);
+ if(vertex->GetNContributors() > 0) {
+ if(fCov[5] != 0) {
+ fHistEventStats->Fill(3,gRefMultiplicity); //proper vertex
+ if(TMath::Abs(vertex->GetX()) < fVxMax) {
+ if(TMath::Abs(vertex->GetY()) < fVyMax) {
+ if(TMath::Abs(vertex->GetZ()) < fVzMax) {
+ fHistEventStats->Fill(4,gRefMultiplicity);//analyzed events
+
+ // get the reference multiplicty or centrality
+ gRefMultiplicity = GetRefMultiOrCentrality(event);
+
+ fHistVx->Fill(vertex->GetX());
+ fHistVy->Fill(vertex->GetY());
+ fHistVz->Fill(vertex->GetZ(),gRefMultiplicity);
+
+ // take only events inside centrality class
+ if(fUseCentrality) {
+ if((gRefMultiplicity > fCentralityPercentileMin) && (gRefMultiplicity < fCentralityPercentileMax)){
+
+ // centrality weighting (optional for 2011 if central and semicentral triggers are used)
+ if (fCentralityWeights && !AcceptEventCentralityWeight(gRefMultiplicity)){
+ AliInfo(Form("Rejecting event because of centrality weighting: %f", gRefMultiplicity));
+ return -1;
+ }
+
+ fHistEventStats->Fill(5,gRefMultiplicity); //events with correct centrality
+ return gRefMultiplicity;
+ }//centrality class
+ }
+ // take events only within the same multiplicity class
+ else if(fUseMultiplicity) {
+ //if(fDebugLevel)
+ //Printf("N(min): %.0f, N(max): %.0f - N(ref): %.0f",fNumberOfAcceptedTracksMin,
+ //fNumberOfAcceptedTracksMax,gRefMultiplicity);
+
+ if((gRefMultiplicity > fNumberOfAcceptedTracksMin) && (gRefMultiplicity < fNumberOfAcceptedTracksMax)) {
+ fHistEventStats->Fill(5,gRefMultiplicity); //events with correct multiplicity
+ return gRefMultiplicity;
+ }
+ }//multiplicity range
+ }//Vz cut
+ }//Vy cut
+ }//Vx cut
+ }//proper vertex resolution
+ }//proper number of contributors
+ }//vertex object valid
+ }//triggered event
+ }//AOD,ESD,ESDMC
+
+ // in all other cases return -1 (event not accepted)
+ return -1;
+}
+
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::GetRefMultiOrCentrality(AliVEvent *event){
+ // Checks the Event cuts
+ // Fills Event statistics histograms
+
+ Float_t gCentrality = -1.;
+ Double_t gMultiplicity = -1.;
+ TString gAnalysisLevel = fBalance->GetAnalysisLevel();
+
+
+ // calculate centrality always (not only in centrality mode)
+ if(gAnalysisLevel == "AOD"|| gAnalysisLevel == "MCAOD" || gAnalysisLevel == "MCAODrec" ) { //centrality in AOD header //++++++++++++++
+ AliAODHeader *header = (AliAODHeader*) event->GetHeader();
+ if(header){
+ gCentrality = header->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());
+
+ // QA for centrality estimators
+ fHistCentStats->Fill(0.,header->GetCentralityP()->GetCentralityPercentile("V0M"));
+ fHistCentStats->Fill(1.,header->GetCentralityP()->GetCentralityPercentile("V0A"));
+ fHistCentStats->Fill(2.,header->GetCentralityP()->GetCentralityPercentile("V0C"));
+ fHistCentStats->Fill(3.,header->GetCentralityP()->GetCentralityPercentile("FMD"));
+ fHistCentStats->Fill(4.,header->GetCentralityP()->GetCentralityPercentile("TRK"));
+ fHistCentStats->Fill(5.,header->GetCentralityP()->GetCentralityPercentile("TKL"));
+ fHistCentStats->Fill(6.,header->GetCentralityP()->GetCentralityPercentile("CL0"));
+ fHistCentStats->Fill(7.,header->GetCentralityP()->GetCentralityPercentile("CL1"));
+ fHistCentStats->Fill(8.,header->GetCentralityP()->GetCentralityPercentile("ZNA"));
+ fHistCentStats->Fill(9.,header->GetCentralityP()->GetCentralityPercentile("ZPA"));
+ fHistCentStats->Fill(10.,header->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));
+ fHistCentStats->Fill(11.,header->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));
+ fHistCentStats->Fill(12.,header->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));
+
+ // Centrality estimator USED ++++++++++++++++++++++++++++++
+ fHistCentStatsUsed->Fill(0.,header->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data()));
+
+ // centrality QA (V0M)
+ fHistV0M->Fill(event->GetVZEROData()->GetMTotV0A(), event->GetVZEROData()->GetMTotV0C());
+
+ // centrality QA (reference tracks)
+ fHistRefTracks->Fill(0.,header->GetRefMultiplicity());
+ fHistRefTracks->Fill(1.,header->GetRefMultiplicityPos());
+ fHistRefTracks->Fill(2.,header->GetRefMultiplicityNeg());
+ fHistRefTracks->Fill(3.,header->GetTPConlyRefMultiplicity());
+ fHistRefTracks->Fill(4.,header->GetNumberOfITSClusters(0));
+ fHistRefTracks->Fill(5.,header->GetNumberOfITSClusters(1));
+ fHistRefTracks->Fill(6.,header->GetNumberOfITSClusters(2));
+ fHistRefTracks->Fill(7.,header->GetNumberOfITSClusters(3));
+ fHistRefTracks->Fill(8.,header->GetNumberOfITSClusters(4));
+
+ }//AOD header
+ }//AOD
+
+ else if(gAnalysisLevel == "ESD" || gAnalysisLevel == "MCESD"){ // centrality class for ESDs or MC-ESDs
+ AliCentrality *centrality = event->GetCentrality();
+ gCentrality = centrality->GetCentralityPercentile(fCentralityEstimator.Data());
+
+ // QA for centrality estimators
+ fHistCentStats->Fill(0.,centrality->GetCentralityPercentile("V0M"));
+ fHistCentStats->Fill(1.,centrality->GetCentralityPercentile("V0A"));
+ fHistCentStats->Fill(2.,centrality->GetCentralityPercentile("V0C"));
+ fHistCentStats->Fill(3.,centrality->GetCentralityPercentile("FMD"));
+ fHistCentStats->Fill(4.,centrality->GetCentralityPercentile("TRK"));
+ fHistCentStats->Fill(5.,centrality->GetCentralityPercentile("TKL"));
+ fHistCentStats->Fill(6.,centrality->GetCentralityPercentile("CL0"));
+ fHistCentStats->Fill(7.,centrality->GetCentralityPercentile("CL1"));
+ fHistCentStats->Fill(8.,centrality->GetCentralityPercentile("ZNA"));
+ fHistCentStats->Fill(9.,centrality->GetCentralityPercentile("ZPA"));
+ fHistCentStats->Fill(10.,centrality->GetCentralityPercentile("V0MvsFMD"));
+ fHistCentStats->Fill(11.,centrality->GetCentralityPercentile("TKLvsV0M"));
+ fHistCentStats->Fill(12.,centrality->GetCentralityPercentile("ZEMvsZDC"));
+
+ // Centrality estimator USED ++++++++++++++++++++++++++++++
+ fHistCentStatsUsed->Fill(0.,centrality->GetCentralityPercentile(fCentralityEstimator.Data()));
+
+ // centrality QA (V0M)
+ fHistV0M->Fill(event->GetVZEROData()->GetMTotV0A(), event->GetVZEROData()->GetMTotV0C());
+ }//ESD
+
+ else if(gAnalysisLevel == "MC"){
+ Double_t gImpactParameter = 0.;
+ AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(event);
+ if(gMCEvent){
+ AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader());
+ if(headerH){
+ gImpactParameter = headerH->ImpactParameter();
+ gCentrality = gImpactParameter;
+ }//MC header
+ }//MC event cast
+ }//MC
+
+ else{
+ gCentrality = -1.;
+ }
+
+ // calculate reference multiplicity always (not only in multiplicity mode)
+ if(gAnalysisLevel == "ESD" || gAnalysisLevel == "MCESD"){
+ AliESDEvent* gESDEvent = dynamic_cast<AliESDEvent*>(event);
+ if(gESDEvent){
+ gMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(gESDEvent, AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ fHistMultiplicity->Fill(gMultiplicity);
+ }//AliESDevent cast
+ }//ESD mode
+
+ else if(gAnalysisLevel == "AOD"|| gAnalysisLevel == "MCAOD" || gAnalysisLevel == "MCAODrec" ){
+ AliAODHeader *header = (AliAODHeader*) event->GetHeader();
+ if ((fMultiplicityEstimator == "V0M")||
+ (fMultiplicityEstimator == "V0A")||
+ (fMultiplicityEstimator == "V0C") ||
+ (fMultiplicityEstimator == "TPC")) {
+ gMultiplicity = GetReferenceMultiplicityFromAOD(event);
+ if(fDebugLevel) Printf("Reference multiplicity (calculated): %.0f",gMultiplicity);
+ }
+ else {
+ if(header)
+ gMultiplicity = header->GetRefMultiplicity();
+ if(fDebugLevel) Printf("Reference multiplicity (AOD header): %.0f",gMultiplicity);
+ }
+ fHistMultiplicity->Fill(gMultiplicity);
+ }//AOD mode
+ else if(gAnalysisLevel == "MC") {
+ AliMCEvent* gMCEvent = dynamic_cast<AliMCEvent*>(event);
+ //Calculating the multiplicity as the number of charged primaries
+ //within \pm 0.8 in eta and pT > 0.1 GeV/c
+ for(Int_t iParticle = 0; iParticle < gMCEvent->GetNumberOfPrimaries(); iParticle++) {
+ AliMCParticle* track = dynamic_cast<AliMCParticle *>(gMCEvent->GetTrack(iParticle));
+ if (!track) {
+ AliError(Form("Could not receive particle %d", iParticle));
+ continue;
+ }
+
+ //exclude non stable particles
+ if(!(gMCEvent->IsPhysicalPrimary(iParticle))) continue;
+
+ //++++++++++++++++
+ if (fMultiplicityEstimator == "V0M") {
+ if((track->Eta() > 5.1 || track->Eta() < 2.8)&&(track->Eta() < -3.7 || track->Eta() > -1.7))
+ continue;}
+ else if (fMultiplicityEstimator == "V0A") {
+ if(track->Eta() > 5.1 || track->Eta() < 2.8) continue;}
+ else if (fMultiplicityEstimator == "V0C") {
+ if(track->Eta() > -1.7 || track->Eta() < -3.7) continue;}
+ else if (fMultiplicityEstimator == "TPC") {
+ if(track->Eta() < fEtaMin || track->Eta() > fEtaMax) continue;
+ if(track->Pt() < fPtMin || track->Pt() > fPtMax) continue;
+ }
+ else{
+ if(track->Pt() < fPtMin || track->Pt() > fPtMax) continue;
+ if(track->Eta() < fEtaMin || track->Eta() > fEtaMax) continue;
+ }
+ //++++++++++++++++
+
+ if(track->Charge() == 0) continue;
+
+ gMultiplicity += 1;
+ }//loop over primaries
+ fHistMultiplicity->Fill(gMultiplicity);
+ }//MC mode
+ else{
+ gMultiplicity = -1;
+ }
+
+
+ // decide what should be returned only here
+ Double_t lReturnVal = -100;
+ if(fEventClass=="Multiplicity"){
+ lReturnVal = gMultiplicity;
+ }else if(fEventClass=="Centrality"){
+ lReturnVal = gCentrality;
+ }
+ return lReturnVal;
+}
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::GetReferenceMultiplicityFromAOD(AliVEvent *event){
+ //Function that returns the reference multiplicity from AODs (data or reco MC)
+ //Different ref. mult. implemented: V0M, V0A, V0C, TPC
+ Double_t gRefMultiplicity = 0., gRefMultiplicityTPC = 0.;
+ Double_t gRefMultiplicityVZERO = 0., gRefMultiplicityVZEROA = 0., gRefMultiplicityVZEROC = 0.;
+
+ AliAODHeader *header = dynamic_cast<AliAODHeader *>(event->GetHeader());
+ if(!header) {
+ Printf("ERROR: AOD header not available");
+ return -999;
+ }
+ Int_t gRunNumber = header->GetRunNumber();
+
+ // Loop over tracks in event
+ for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {
+ AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));
+ if (!aodTrack) {
+ AliError(Form("Could not receive track %d", iTracks));
+ continue;
+ }
+
+ // AOD track cuts
+ if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;
+
+ if(aodTrack->Charge() == 0) continue;
+ // Kinematics cuts from ESD track cuts
+ if( aodTrack->Pt() < fPtMin || aodTrack->Pt() > fPtMax) continue;
+ if( aodTrack->Eta() < fEtaMin || aodTrack->Eta() > fEtaMax) continue;
+
+ //=================PID (so far only for electron rejection)==========================//
+ if(fElectronRejection) {
+ // get the electron nsigma
+ Double_t nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kElectron));
+
+ // check only for given momentum range
+ if( aodTrack->Pt() > fElectronRejectionMinPt && aodTrack->Pt() < fElectronRejectionMaxPt ){
+ //look only at electron nsigma
+ if(!fElectronOnlyRejection) {
+ //Make the decision based on the n-sigma of electrons
+ if(nSigma < fElectronRejectionNSigma) continue;
+ }
+ else {
+ Double_t nSigmaPions = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kPion));
+ Double_t nSigmaKaons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kKaon));
+ Double_t nSigmaProtons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kProton));
+
+ //Make the decision based on the n-sigma of electrons exclusively ( = track not in nsigma region for other species)
+ if(nSigma < fElectronRejectionNSigma
+ && nSigmaPions > fElectronRejectionNSigma
+ && nSigmaKaons > fElectronRejectionNSigma
+ && nSigmaProtons > fElectronRejectionNSigma ) continue;
+ }
+ }
+ }//electron rejection
+
+ gRefMultiplicityTPC += 1.0;
+ }// track loop
+
+ //VZERO segmentation in two detectors (0-31: VZERO-C, 32-63: VZERO-A)
+ for(Int_t iChannel = 0; iChannel < 64; iChannel++) {
+ fHistVZEROSignal->Fill(iChannel,event->GetVZEROEqMultiplicity(iChannel));
+
+ if(iChannel < 32)
+ gRefMultiplicityVZEROC += event->GetVZEROEqMultiplicity(iChannel);
+ else if(iChannel >= 32)
+ gRefMultiplicityVZEROA += event->GetVZEROEqMultiplicity(iChannel);
+ }//loop over PMTs
+
+ //Equalization of gain
+ Double_t gFactorA = GetEqualizationFactor(gRunNumber,"A");
+ if(gFactorA != 0)
+ gRefMultiplicityVZEROA /= gFactorA;
+ Double_t gFactorC = GetEqualizationFactor(gRunNumber,"C");
+ if(gFactorC != 0)
+ gRefMultiplicityVZEROC /= gFactorC;
+ if((gFactorA != 0)&&(gFactorC != 0))
+ gRefMultiplicityVZERO = (gRefMultiplicityVZEROA/gFactorA)+(gRefMultiplicityVZEROC/gFactorC);
+
+ if(fDebugLevel)
+ Printf("VZERO multiplicity: %.0f - TPC multiplicity: %.0f",gRefMultiplicityVZERO,gRefMultiplicityTPC);
+
+ fHistTPCvsVZEROMultiplicity->Fill(gRefMultiplicityVZERO,gRefMultiplicityTPC);
+
+ if(fMultiplicityEstimator == "TPC")
+ gRefMultiplicity = gRefMultiplicityTPC;
+ else if(fMultiplicityEstimator == "V0M")
+ gRefMultiplicity = gRefMultiplicityVZERO;
+ else if(fMultiplicityEstimator == "V0A")
+ gRefMultiplicity = gRefMultiplicityVZEROA;
+ else if(fMultiplicityEstimator == "V0C")
+ gRefMultiplicity = gRefMultiplicityVZEROC;
+
+ return gRefMultiplicity;
+}
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::GetEventPlane(AliVEvent *event){
+ // Get the event plane
+
+ TString gAnalysisLevel = fBalance->GetAnalysisLevel();
+
+ Float_t gVZEROEventPlane = -10.;
+ Float_t gReactionPlane = -10.;
+ Double_t qxTot = 0.0, qyTot = 0.0;
+
+ //MC: from reaction plane
+ if(gAnalysisLevel == "MC"){
+ if(!event) {
+ AliError("mcEvent not available");
+ return 0x0;
+ }
+
+ AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(event);
+ if(gMCEvent){
+ AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader());
+ if (headerH) {
+ gReactionPlane = headerH->ReactionPlaneAngle();
+ //gReactionPlane *= TMath::RadToDeg();
+ }//MC header
+ }//MC event cast
+ }//MC
+
+ // AOD,ESD,ESDMC: from VZERO Event Plane
+ else{
+
+ AliEventplane *ep = event->GetEventplane();
+ if(ep){
+ gVZEROEventPlane = ep->CalculateVZEROEventPlane(event,10,2,qxTot,qyTot);
+ if(gVZEROEventPlane < 0.) gVZEROEventPlane += TMath::Pi();
+ //gReactionPlane = gVZEROEventPlane*TMath::RadToDeg();
+ gReactionPlane = gVZEROEventPlane;
+ }
+ }//AOD,ESD,ESDMC
+
+ return gReactionPlane;
+}
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::GetTrackbyTrackCorrectionMatrix( Double_t vEta,
+ Double_t vPhi,
+ Double_t vPt,
+ Short_t vCharge,
+ Double_t gCentrality) {
+ // -- Get efficiency correction of particle dependent on (eta, phi, pt, charge, centrality)
+
+ Double_t correction = 1.;
+ Int_t binEta = 0, binPt = 0, binPhi = 0;
+
+ //Printf("EtaMAx: %lf - EtaMin: %lf - EtaBin: %lf", fEtaMaxForCorrections,fEtaMinForCorrections,fEtaBinForCorrections);
+ if(fEtaBinForCorrections != 0) {
+ Double_t widthEta = (fEtaMaxForCorrections - fEtaMinForCorrections)/fEtaBinForCorrections;
+ if(fEtaMaxForCorrections != fEtaMinForCorrections)
+ binEta = (Int_t)((vEta-fEtaMinForCorrections)/widthEta)+1;
+ }
+
+ if(fPtBinForCorrections != 0) {
+ Double_t widthPt = (fPtMaxForCorrections - fPtMinForCorrections)/fPtBinForCorrections;
+ if(fPtMaxForCorrections != fPtMinForCorrections)
+ binPt = (Int_t)((vPt-fPtMinForCorrections)/widthPt) + 1;
+ }
+
+ if(fPhiBinForCorrections != 0) {
+ Double_t widthPhi = (fPhiMaxForCorrections - fPhiMinForCorrections)/fPhiBinForCorrections;
+ if(fPhiMaxForCorrections != fPhiMinForCorrections)
+ binPhi = (Int_t)((vPhi-fPhiMinForCorrections)/widthPhi)+ 1;
+ }
+
+ Int_t gCentralityInt = -1;
+ for (Int_t i=0; i<fCentralityArrayBinsForCorrections-1; i++){
+ if((fCentralityArrayForCorrections[i] <= gCentrality)&&(gCentrality <= fCentralityArrayForCorrections[i+1])){
+ gCentralityInt = i;
+ break;
+ }
+ }
+
+ // centrality not in array --> no correction
+ if(gCentralityInt < 0){
+ correction = 1.;
+ }
+ else{
+
+ //Printf("//=============CENTRALITY=============// %d:",gCentralityInt);
+
+ if(fHistCorrectionPlus[gCentralityInt]){
+ if (vCharge > 0) {
+ correction = fHistCorrectionPlus[gCentralityInt]->GetBinContent(fHistCorrectionPlus[gCentralityInt]->GetBin(binEta, binPt, binPhi));
+ //Printf("CORRECTIONplus: %.2f | Centrality %d",correction,gCentralityInt);
+ }
+ if (vCharge < 0) {
+ correction = fHistCorrectionMinus[gCentralityInt]->GetBinContent(fHistCorrectionMinus[gCentralityInt]->GetBin(binEta, binPt, binPhi));
+ //Printf("CORRECTIONminus: %.2f | Centrality %d",correction,gCentralityInt);
+ }
+ }
+ else {
+ correction = 1.;
+ }
+ }//centrality in array
+
+ if (correction == 0.) {
+ AliError(Form("Should not happen : bin content = 0. >> eta: %.2f | phi : %.2f | pt : %.2f | cent %d",vEta, vPhi, vPt, gCentralityInt));
+ correction = 1.;
+ }
+
+ return correction;
+}
+
+//________________________________________________________________________
+TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gCentrality, Double_t gReactionPlane){
+ // Returns TObjArray with tracks after all track cuts (only for AOD!)
+ // Fills QA histograms
+
+ TString gAnalysisLevel = fBalance->GetAnalysisLevel();
+
+ //output TObjArray holding all good tracks
+ TObjArray* tracksAccepted = new TObjArray;
+ tracksAccepted->SetOwner(kTRUE);
+
+ Short_t vCharge;
+ Double_t vEta;
+ Double_t vY;
+ Double_t vPhi;
+ Double_t vPt;
+
+
+ if(gAnalysisLevel == "AOD") { // handling of TPC only tracks different in AOD and ESD
+ // Loop over tracks in event
+
+ for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {
+ AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));
+ if (!aodTrack) {
+ AliError(Form("Could not receive track %d", iTracks));
+ continue;
+ }
+
+ // AOD track cuts
+
+ // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C
+ // take only TPC only tracks
+ //fHistTrackStats->Fill(aodTrack->GetFilterMap());
+ for(Int_t iTrackBit = 0; iTrackBit < 16; iTrackBit++){
+ fHistTrackStats->Fill(iTrackBit,aodTrack->TestFilterBit(1<<iTrackBit));
+ }
+
+ if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;
+
+
+ // additional check on kPrimary flag
+ if(fCheckPrimaryFlagAOD){
+ if(aodTrack->GetType() != AliAODTrack::kPrimary)
+ continue;
+ }
+
+
+ vCharge = aodTrack->Charge();
+ vEta = aodTrack->Eta();
+ vY = aodTrack->Y();
+ vPhi = aodTrack->Phi();// * TMath::RadToDeg();
+ vPt = aodTrack->Pt();
+
+ //===========================PID (so far only for electron rejection)===============================//
+ if(fElectronRejection) {
+
+ // get the electron nsigma
+ Double_t nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kElectron));
+
+ //Fill QA before the PID
+ fHistdEdxVsPTPCbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+ fHistNSigmaTPCvsPtbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma);
+ //end of QA-before pid
+
+ // check only for given momentum range
+ if( vPt > fElectronRejectionMinPt && vPt < fElectronRejectionMaxPt ){
+
+ //look only at electron nsigma
+ if(!fElectronOnlyRejection){
+
+ //Make the decision based on the n-sigma of electrons
+ if(nSigma < fElectronRejectionNSigma) continue;
+ }
+ else{
+
+ Double_t nSigmaPions = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kPion));
+ Double_t nSigmaKaons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kKaon));
+ Double_t nSigmaProtons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kProton));
+
+ //Make the decision based on the n-sigma of electrons exclusively ( = track not in nsigma region for other species)
+ if(nSigma < fElectronRejectionNSigma
+ && nSigmaPions > fElectronRejectionNSigma
+ && nSigmaKaons > fElectronRejectionNSigma
+ && nSigmaProtons > fElectronRejectionNSigma ) continue;
+ }
+ }
+
+ //Fill QA after the PID
+ fHistdEdxVsPTPCafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+ fHistNSigmaTPCvsPtafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma);
+
+ }
+ //===========================end of PID (so far only for electron rejection)===============================//
+
+ //+++++++++++++++++++++++++++++//
+ //===========================PID===============================//
+ if(fUsePID) {
+ Double_t prob[AliPID::kSPECIES]={0.};
+ Double_t probTPC[AliPID::kSPECIES]={0.};
+ Double_t probTOF[AliPID::kSPECIES]={0.};
+ Double_t probTPCTOF[AliPID::kSPECIES]={0.};
+
+ Double_t nSigma = 0.;
+ Double_t nSigmaTPC = 0.; //++++
+ Double_t nSigmaTOF = 0.; //++++
+ Double_t nSigmaTPCTOF = 0.; //++++
+ UInt_t detUsedTPC = 0;
+ UInt_t detUsedTOF = 0;
+ UInt_t detUsedTPCTOF = 0;
+
+ nSigmaTPC = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)fParticleOfInterest));
+ nSigmaTOF = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(aodTrack,(AliPID::EParticleType)fParticleOfInterest));
+ nSigmaTPCTOF = TMath::Sqrt(nSigmaTPC*nSigmaTPC + nSigmaTOF*nSigmaTOF);
+
+ //Decide what detector configuration we want to use
+ switch(fPidDetectorConfig) {
+ case kTPCpid:
+ fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
+ nSigma = nSigmaTPC;
+ detUsedTPC = fPIDCombined->ComputeProbabilities(aodTrack, fPIDResponse, probTPC);
+ for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ prob[iSpecies] = probTPC[iSpecies];
+ break;
+ case kTOFpid:
+ fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF);
+ nSigma = nSigmaTOF;
+ detUsedTOF = fPIDCombined->ComputeProbabilities(aodTrack, fPIDResponse, probTOF);
+ for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ prob[iSpecies] = probTOF[iSpecies];
+ break;
+ case kTPCTOF:
+ fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);
+ nSigma = nSigmaTPCTOF;
+ detUsedTPCTOF = fPIDCombined->ComputeProbabilities(aodTrack, fPIDResponse, probTPCTOF);
+ for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ prob[iSpecies] = probTPCTOF[iSpecies];
+ break;
+ default:
+ break;
+ }//end switch: define detector mask
+
+ //Filling the PID QA
+ Double_t tofTime = -999., length = 999., tof = -999.;
+ Double_t c = TMath::C()*1.E-9;// m/ns
+ Double_t beta = -999.;
+ if ( (aodTrack->IsOn(AliAODTrack::kTOFin)) &&
+ (aodTrack->IsOn(AliAODTrack::kTIME)) ) {
+ tofTime = aodTrack->GetTOFsignal();//in ps
+ length = aodTrack->GetIntegratedLength();
+ tof = tofTime*1E-3; // ns
+
+ if (tof <= 0) {
+ //Printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");
+ continue;
+ }
+ if (length <= 0){
+ //printf("WARNING: track with negative length found!Skipping this track for PID checks\n");
+ continue;
+ }
+
+ length = length*0.01; // in meters
+ tof = tof*c;
+ beta = length/tof;
+
+ fHistBetavsPTOFbeforePID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);
+ fHistProbTOFvsPtbeforePID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);
+ fHistNSigmaTOFvsPtbeforePID ->Fill(aodTrack->Pt(),nSigmaTOF);
+ }//TOF signal
+
+ fHistdEdxVsPTPCbeforePID -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+ fHistProbTPCvsPtbeforePID -> Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]);
+ fHistNSigmaTPCvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPC);
+
+ fHistProbTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);
+
+ //combined TPC&TOF
+ fHistBetaVsdEdXbeforePID->Fill(aodTrack->GetTPCsignal(),beta); //+++++++++
+ fHistNSigmaTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPCTOF);
+ Printf("NSIGMA: %lf - nSigmaTOF: %lf - nSigmaTPC: %lf - nSigmaTPCTOF: %lf",nSigma,nSigmaTOF,nSigmaTPC,nSigmaTPCTOF);
+
+ //end of QA-before pid
+
+ if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {
+ //Make the decision based on the n-sigma
+ if(fUsePIDnSigma) {
+ if(nSigma > fPIDNSigma) continue;
+
+ fHistNSigmaTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTOF);
+ fHistNSigmaTPCvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPC);
+ fHistNSigmaTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPCTOF);
+ }
+ //Make the decision based on the bayesian
+ else if(fUsePIDPropabilities) {
+ if(fParticleOfInterest != TMath::LocMax(AliPID::kSPECIES,prob)) continue;
+ if (prob[fParticleOfInterest] < fMinAcceptedPIDProbability) continue;
+
+ fHistProbTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);
+ fHistProbTPCvsPtafterPID ->Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]);
+ fHistProbTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);
+
+ }
+
+ //Fill QA after the PID
+ fHistBetavsPTOFafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);
+ fHistdEdxVsPTPCafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+ fHistBetaVsdEdXafterPID->Fill(aodTrack->GetTPCsignal(),beta); //+++++++++
+ }
+ }
+ //===========================PID===============================//
+ //+++++++++++++++++++++++++++++//
+
+
+ Float_t dcaXY = aodTrack->DCA(); // this is the DCA from global track (not exactly what is cut on)
+ Float_t dcaZ = aodTrack->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)
+
+
+ // Kinematics cuts from ESD track cuts
+ if( vPt < fPtMin || vPt > fPtMax) continue;
+ if( vEta < fEtaMin || vEta > fEtaMax) continue;
+
+ // Extra DCA cuts (for systematic studies [!= -1])
+ if( fDCAxyCut != -1 && fDCAzCut != -1){
+ if(TMath::Sqrt((dcaXY*dcaXY)/(fDCAxyCut*fDCAxyCut)+(dcaZ*dcaZ)/(fDCAzCut*fDCAzCut)) > 1 ){
+ continue; // 2D cut
+ }
+ }
+
+ // Extra TPC cuts (for systematic studies [!= -1])
+ if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){
+ continue;
+ }
+ if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){
+ continue;
+ }
+
+ // fill QA histograms
+ fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());
+ fHistDCA->Fill(dcaZ,dcaXY);
+ fHistChi2->Fill(aodTrack->Chi2perNDF(),gCentrality);
+ fHistPt->Fill(vPt,gCentrality);
+ fHistEta->Fill(vEta,gCentrality);
+ fHistRapidity->Fill(vY,gCentrality);
+ if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);
+ else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);
+ fHistPhi->Fill(vPhi,gCentrality);
+ if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);
+ else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);
+
+ //=======================================correction
+ Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality);
+ //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);
+
+ // add the track to the TObjArray
+ tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction));
+ }//track loop
+ }// AOD analysis
+
+ //==============================================================================================================
+ else if(gAnalysisLevel == "MCAOD") {
+
+ AliMCEvent* mcEvent = MCEvent();
+ if (!mcEvent) {
+ AliError("ERROR: Could not retrieve MC event");
+ }
+ else{
+
+ for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {
+ AliAODMCParticle *aodTrack = (AliAODMCParticle*) mcEvent->GetTrack(iTracks);
+ if (!aodTrack) {
+ AliError(Form("ERROR: Could not receive track %d (mc loop)", iTracks));
+ continue;
+ }
+
+ if(!aodTrack->IsPhysicalPrimary()) continue;
+
+ vCharge = aodTrack->Charge();
+ vEta = aodTrack->Eta();
+ vY = aodTrack->Y();
+ vPhi = aodTrack->Phi();// * TMath::RadToDeg();
+ vPt = aodTrack->Pt();
+
+ // Kinematics cuts from ESD track cuts
+ if( vPt < fPtMin || vPt > fPtMax) continue;
+ if( vEta < fEtaMin || vEta > fEtaMax) continue;
+
+ // Remove neutral tracks
+ if( vCharge == 0 ) continue;
+
+ //Exclude resonances
+ if(fExcludeResonancesInMC) {
+
+ Bool_t kExcludeParticle = kFALSE;
+ Int_t gMotherIndex = aodTrack->GetMother();
+ if(gMotherIndex != -1) {
+ AliAODMCParticle* motherTrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(gMotherIndex));
+ if(motherTrack) {
+ Int_t pdgCodeOfMother = motherTrack->GetPdgCode();
+ //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {
+ //if(pdgCodeOfMother == 113) {
+ if(pdgCodeOfMother == 113 // rho0
+ || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
+ // || pdgCodeOfMother == 221 // eta
+ // || pdgCodeOfMother == 331 // eta'
+ // || pdgCodeOfMother == 223 // omega
+ // || pdgCodeOfMother == 333 // phi
+ || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0
+ // || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0*
+ // || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+*
+ || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
+ || pdgCodeOfMother == 111 // pi0 Dalitz
+ || pdgCodeOfMother == 22 // photon
+ ) {
+ kExcludeParticle = kTRUE;
+ }
+ }
+ }
+
+ //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi
+ if(kExcludeParticle) continue;
+ }
+
+ //Exclude electrons with PDG
+ if(fExcludeElectronsInMC) {
+
+ if(TMath::Abs(aodTrack->GetPdgCode()) == 11) continue;
+
+ }
+
+ // fill QA histograms
+ fHistPt->Fill(vPt,gCentrality);
+ fHistEta->Fill(vEta,gCentrality);
+ fHistRapidity->Fill(vY,gCentrality);
+ if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);
+ else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);
+ fHistPhi->Fill(vPhi,gCentrality);
+ if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);
+ else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);
+
+ //=======================================correction
+ Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality);
+ //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);
+
+ // add the track to the TObjArray
+ tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction));
+ }//aodTracks
+ }//MC event
+ }//MCAOD
+ //==============================================================================================================
+
+ //==============================================================================================================
+ else if(gAnalysisLevel == "MCAODrec") {
+
+ /* fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
+ if (!fAOD) {
+ printf("ERROR: fAOD not available\n");
+ return;
+ }*/
+
+ fArrayMC = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
+ if (!fArrayMC) {
+ AliError("No array of MC particles found !!!");
+ }
+
+ AliMCEvent* mcEvent = MCEvent();
+ if (!mcEvent) {
+ AliError("ERROR: Could not retrieve MC event");
+ return tracksAccepted;
+ }
+
+ for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {
+ AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));
+ if (!aodTrack) {
+ AliError(Form("Could not receive track %d", iTracks));
+ continue;
+ }
+
+ for(Int_t iTrackBit = 0; iTrackBit < 16; iTrackBit++){
+ fHistTrackStats->Fill(iTrackBit,aodTrack->TestFilterBit(1<<iTrackBit));
+ }
+ if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;
+
+ vCharge = aodTrack->Charge();
+ vEta = aodTrack->Eta();
+ vY = aodTrack->Y();
+ vPhi = aodTrack->Phi();// * TMath::RadToDeg();
+ vPt = aodTrack->Pt();
+
+ //===========================use MC information for Kinematics===============================//
+ if(fUseMCforKinematics){
+
+ Int_t label = TMath::Abs(aodTrack->GetLabel());
+ AliAODMCParticle *AODmcTrack = (AliAODMCParticle*) fArrayMC->At(label);
+
+ if(AODmcTrack){
+ vCharge = AODmcTrack->Charge();
+ vEta = AODmcTrack->Eta();
+ vY = AODmcTrack->Y();
+ vPhi = AODmcTrack->Phi();// * TMath::RadToDeg();
+ vPt = AODmcTrack->Pt();
+ }
+ else{
+ AliDebug(1, "no MC particle for this track");
+ continue;
+ }
+ }
+ //===========================end of use MC information for Kinematics========================//
+
+
+ //===========================PID (so far only for electron rejection)===============================//
+ if(fElectronRejection) {
+
+ // get the electron nsigma
+ Double_t nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kElectron));
+
+ //Fill QA before the PID
+ fHistdEdxVsPTPCbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+ fHistNSigmaTPCvsPtbeforePIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma);
+ //end of QA-before pid
+
+ // check only for given momentum range
+ if( vPt > fElectronRejectionMinPt && vPt < fElectronRejectionMaxPt ){
+
+ //look only at electron nsigma
+ if(!fElectronOnlyRejection){
+
+ //Make the decision based on the n-sigma of electrons
+ if(nSigma < fElectronRejectionNSigma) continue;
+ }
+ else{
+
+ Double_t nSigmaPions = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kPion));
+ Double_t nSigmaKaons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kKaon));
+ Double_t nSigmaProtons = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)AliPID::kProton));
+
+ //Make the decision based on the n-sigma of electrons exclusively ( = track not in nsigma region for other species)
+ if(nSigma < fElectronRejectionNSigma
+ && nSigmaPions > fElectronRejectionNSigma
+ && nSigmaKaons > fElectronRejectionNSigma
+ && nSigmaProtons > fElectronRejectionNSigma ) continue;
+ }
+ }
+
+ //Fill QA after the PID
+ fHistdEdxVsPTPCafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+ fHistNSigmaTPCvsPtafterPIDelectron -> Fill(aodTrack->P()*aodTrack->Charge(),nSigma);
+
+ }
+ //===========================end of PID (so far only for electron rejection)===============================//
+
+ Float_t dcaXY = aodTrack->DCA(); // this is the DCA from global track (not exactly what is cut on)
+ Float_t dcaZ = aodTrack->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)
+
+ // Kinematics cuts from ESD track cuts
+ if( vPt < fPtMin || vPt > fPtMax) continue;
+ if( vEta < fEtaMin || vEta > fEtaMax) continue;
+
+ // Extra DCA cuts (for systematic studies [!= -1])
+ if( fDCAxyCut != -1 && fDCAzCut != -1){
+ if(TMath::Sqrt((dcaXY*dcaXY)/(fDCAxyCut*fDCAxyCut)+(dcaZ*dcaZ)/(fDCAzCut*fDCAzCut)) > 1 ){
+ continue; // 2D cut
+ }
+ }
+
+ // Extra TPC cuts (for systematic studies [!= -1])
+ if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){
+ continue;
+ }
+ if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){
+ continue;
+ }
+
+ //Exclude resonances
+ if(fExcludeResonancesInMC) {
+
+ Bool_t kExcludeParticle = kFALSE;
+
+ Int_t label = TMath::Abs(aodTrack->GetLabel());
+ AliAODMCParticle *AODmcTrack = (AliAODMCParticle*) fArrayMC->At(label);
+
+ if (AODmcTrack){
+ //if (AODmcTrack->IsPhysicalPrimary()){
+
+ Int_t gMotherIndex = AODmcTrack->GetMother();
+ if(gMotherIndex != -1) {
+ AliAODMCParticle* motherTrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(gMotherIndex));
+ if(motherTrack) {
+ Int_t pdgCodeOfMother = motherTrack->GetPdgCode();
+ if(pdgCodeOfMother == 113 // rho0
+ || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
+ // || pdgCodeOfMother == 221 // eta
+ // || pdgCodeOfMother == 331 // eta'
+ // || pdgCodeOfMother == 223 // omega
+ // || pdgCodeOfMother == 333 // phi
+ || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0
+ // || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0*
+ // || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+*
+ || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
+ || pdgCodeOfMother == 111 // pi0 Dalitz
+ || pdgCodeOfMother == 22 // photon
+ ) {
+ kExcludeParticle = kTRUE;
+ }
+ }
+ }
+ }
+ //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi
+ if(kExcludeParticle) continue;
+ }
+
+ //Exclude electrons with PDG
+ if(fExcludeElectronsInMC) {
+
+ Int_t label = TMath::Abs(aodTrack->GetLabel());
+ AliAODMCParticle *AODmcTrack = (AliAODMCParticle*) fArrayMC->At(label);
+
+ if (AODmcTrack){
+ if(TMath::Abs(AODmcTrack->GetPdgCode()) == 11) continue;
+ }
+ }
+
+ // fill QA histograms
+ fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());
+ fHistDCA->Fill(dcaZ,dcaXY);
+ fHistChi2->Fill(aodTrack->Chi2perNDF(),gCentrality);
+ fHistPt->Fill(vPt,gCentrality);
+ fHistEta->Fill(vEta,gCentrality);
+ fHistRapidity->Fill(vY,gCentrality);
+ if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);
+ else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);
+ fHistPhi->Fill(vPhi,gCentrality);
+ if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);
+ else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);
+
+ //=======================================correction
+ Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality);
+ //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);
+
+ // add the track to the TObjArray
+ tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction));
+ }//track loop
+ }//MCAODrec
+ //==============================================================================================================
+
+ else if(gAnalysisLevel == "ESD" || gAnalysisLevel == "MCESD") { // handling of TPC only tracks different in AOD and ESD
+
+ AliESDtrack *trackTPC = NULL;
+ AliMCParticle *mcTrack = NULL;
+
+ AliMCEvent* mcEvent = NULL;
+
+ // for MC ESDs use also MC information
+ if(gAnalysisLevel == "MCESD"){
+ mcEvent = MCEvent();
+ if (!mcEvent) {
+ AliError("mcEvent not available");
+ return tracksAccepted;
+ }
+ }
+
+ // Loop over tracks in event
+ for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {
+ AliESDtrack* track = dynamic_cast<AliESDtrack *>(event->GetTrack(iTracks));
+ if (!track) {
+ AliError(Form("Could not receive track %d", iTracks));
+ continue;
+ }
+
+ // for MC ESDs use also MC information --> MC track not used further???
+ if(gAnalysisLevel == "MCESD"){
+ Int_t label = TMath::Abs(track->GetLabel());
+ if(label > mcEvent->GetNumberOfTracks()) continue;
+ if(label > mcEvent->GetNumberOfPrimaries()) continue;
+
+ mcTrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(label));
+ if(!mcTrack) continue;
+ }
+
+ // take only TPC only tracks
+ trackTPC = new AliESDtrack();
+ if(!track->FillTPCOnlyTrack(*trackTPC)) continue;
+
+ //ESD track cuts
+ if(fESDtrackCuts)
+ if(!fESDtrackCuts->AcceptTrack(trackTPC)) continue;
+
+ // fill QA histograms
+ Float_t b[2];
+ Float_t bCov[3];
+ trackTPC->GetImpactParameters(b,bCov);
+ if (bCov[0]<=0 || bCov[2]<=0) {
+ AliDebug(1, "Estimated b resolution lower or equal zero!");
+ bCov[0]=0; bCov[2]=0;
+ }
+
+ Int_t nClustersTPC = -1;
+ nClustersTPC = trackTPC->GetTPCNclsIter1(); // TPC standalone
+ //nClustersTPC = track->GetTPCclusters(0); // global track
+ Float_t chi2PerClusterTPC = -1;
+ if (nClustersTPC!=0) {
+ chi2PerClusterTPC = trackTPC->GetTPCchi2Iter1()/Float_t(nClustersTPC); // TPC standalone
+ //chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC); // global track
+ }
+
+ //===========================PID===============================//
+ if(fUsePID) {
+ Double_t prob[AliPID::kSPECIES]={0.};
+ Double_t probTPC[AliPID::kSPECIES]={0.};
+ Double_t probTOF[AliPID::kSPECIES]={0.};
+ Double_t probTPCTOF[AliPID::kSPECIES]={0.};
+
+ Double_t nSigma = 0.;
+ UInt_t detUsedTPC = 0;
+ UInt_t detUsedTOF = 0;
+ UInt_t detUsedTPCTOF = 0;
+
+ //Decide what detector configuration we want to use
+ switch(fPidDetectorConfig) {
+ case kTPCpid:
+ fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
+ nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)fParticleOfInterest));
+ detUsedTPC = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTPC);
+ for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ prob[iSpecies] = probTPC[iSpecies];
+ break;
+ case kTOFpid:
+ fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF);
+ nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)fParticleOfInterest));
+ detUsedTOF = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTOF);
+ for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ prob[iSpecies] = probTOF[iSpecies];
+ break;
+ case kTPCTOF:
+ fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);
+ detUsedTPCTOF = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTPCTOF);
+ for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ prob[iSpecies] = probTPCTOF[iSpecies];
+ break;
+ default:
+ break;
+ }//end switch: define detector mask
+
+ //Filling the PID QA
+ Double_t tofTime = -999., length = 999., tof = -999.;
+ Double_t c = TMath::C()*1.E-9;// m/ns
+ Double_t beta = -999.;
+ Double_t nSigmaTOFForParticleOfInterest = -999.;
+ if ( (track->IsOn(AliESDtrack::kTOFin)) &&
+ (track->IsOn(AliESDtrack::kTIME)) ) {
+ tofTime = track->GetTOFsignal();//in ps
+ length = track->GetIntegratedLength();
+ tof = tofTime*1E-3; // ns
+
+ if (tof <= 0) {
+ //Printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");
+ continue;
+ }
+ if (length <= 0){
+ //printf("WARNING: track with negative length found!Skipping this track for PID checks\n");
+ continue;
+ }
+
+ length = length*0.01; // in meters
+ tof = tof*c;
+ beta = length/tof;
+
+ nSigmaTOFForParticleOfInterest = fPIDResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)fParticleOfInterest);
+ fHistBetavsPTOFbeforePID ->Fill(track->P()*track->Charge(),beta);
+ fHistProbTOFvsPtbeforePID ->Fill(track->Pt(),probTOF[fParticleOfInterest]);
+ fHistNSigmaTOFvsPtbeforePID ->Fill(track->Pt(),nSigmaTOFForParticleOfInterest);
+ }//TOF signal
+
+
+ Double_t nSigmaTPCForParticleOfInterest = fPIDResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)fParticleOfInterest);
+ fHistdEdxVsPTPCbeforePID -> Fill(track->P()*track->Charge(),track->GetTPCsignal());
+ fHistProbTPCvsPtbeforePID -> Fill(track->Pt(),probTPC[fParticleOfInterest]);
+ fHistNSigmaTPCvsPtbeforePID -> Fill(track->Pt(),nSigmaTPCForParticleOfInterest);
+ fHistProbTPCTOFvsPtbeforePID -> Fill(track->Pt(),probTPCTOF[fParticleOfInterest]);
+ //end of QA-before pid
+
+ if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {
+ //Make the decision based on the n-sigma
+ if(fUsePIDnSigma) {
+ if(nSigma > fPIDNSigma) continue;}
+
+ //Make the decision based on the bayesian
+ else if(fUsePIDPropabilities) {
+ if(fParticleOfInterest != TMath::LocMax(AliPID::kSPECIES,prob)) continue;
+ if (prob[fParticleOfInterest] < fMinAcceptedPIDProbability) continue;
+ }
+
+ //Fill QA after the PID
+ fHistBetavsPTOFafterPID ->Fill(track->P()*track->Charge(),beta);
+ fHistProbTOFvsPtafterPID ->Fill(track->Pt(),probTOF[fParticleOfInterest]);
+ fHistNSigmaTOFvsPtafterPID ->Fill(track->Pt(),nSigmaTOFForParticleOfInterest);
+
+ fHistdEdxVsPTPCafterPID -> Fill(track->P()*track->Charge(),track->GetTPCsignal());
+ fHistProbTPCvsPtafterPID -> Fill(track->Pt(),probTPC[fParticleOfInterest]);
+ fHistProbTPCTOFvsPtafterPID -> Fill(track->Pt(),probTPCTOF[fParticleOfInterest]);
+ fHistNSigmaTPCvsPtafterPID -> Fill(track->Pt(),nSigmaTPCForParticleOfInterest);
+ }
+ }
+ //===========================PID===============================//
+ vCharge = trackTPC->Charge();
+ vY = trackTPC->Y();
+ vEta = trackTPC->Eta();
+ vPhi = trackTPC->Phi();// * TMath::RadToDeg();
+ vPt = trackTPC->Pt();
+ fHistClus->Fill(trackTPC->GetITSclusters(0),nClustersTPC);
+ fHistDCA->Fill(b[1],b[0]);
+ fHistChi2->Fill(chi2PerClusterTPC,gCentrality);
+ fHistPt->Fill(vPt,gCentrality);
+ fHistEta->Fill(vEta,gCentrality);
+ fHistPhi->Fill(vPhi,gCentrality);
+ if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);
+ else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);
+ fHistRapidity->Fill(vY,gCentrality);
+ if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);
+ else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);
+
+ //=======================================correction
+ Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality);
+ //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);
+
+ // add the track to the TObjArray
+ tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction));
+
+ delete trackTPC;
+ }//track loop
+ }// ESD analysis
+
+ else if(gAnalysisLevel == "MC"){
+ if(!event) {
+ AliError("mcEvent not available");
+ return 0x0;
+ }
+
+ AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(event);
+ if(gMCEvent) {
+ // Loop over tracks in event
+ for (Int_t iTracks = 0; iTracks < gMCEvent->GetNumberOfPrimaries(); iTracks++) {
+ AliMCParticle* track = dynamic_cast<AliMCParticle *>(gMCEvent->GetTrack(iTracks));
+ if (!track) {
+ AliError(Form("Could not receive particle %d", iTracks));
+ continue;
+ }
+
+ //exclude non stable particles
+ if(!(gMCEvent->IsPhysicalPrimary(iTracks))) continue;
+
+ vCharge = track->Charge();
+ vEta = track->Eta();
+ vPt = track->Pt();
+ vY = track->Y();
+
+ if( vPt < fPtMin || vPt > fPtMax)
+ continue;
+ if (!fUsePID) {
+ if( vEta < fEtaMin || vEta > fEtaMax) continue;
+ }
+ else if (fUsePID){
+ if( vY < fEtaMin || vY > fEtaMax) continue;
+ }
+
+ // Remove neutral tracks
+ if( vCharge == 0 ) continue;
+
+ //analyze one set of particles
+ if(fUseMCPdgCode) {
+ TParticle *particle = track->Particle();
+ if(!particle) continue;
+
+ Int_t gPdgCode = particle->GetPdgCode();
+ if(TMath::Abs(fPDGCodeToBeAnalyzed) != TMath::Abs(gPdgCode))
+ continue;
+ }
+
+ //Use the acceptance parameterization
+ if(fAcceptanceParameterization) {
+ Double_t gRandomNumber = gRandom->Rndm();
+ if(gRandomNumber > fAcceptanceParameterization->Eval(track->Pt()))
+ continue;
+ }
+
+ //Exclude resonances
+ if(fExcludeResonancesInMC) {
+ TParticle *particle = track->Particle();
+ if(!particle) continue;
+
+ Bool_t kExcludeParticle = kFALSE;
+ Int_t gMotherIndex = particle->GetFirstMother();
+ if(gMotherIndex != -1) {
+ AliMCParticle* motherTrack = dynamic_cast<AliMCParticle *>(event->GetTrack(gMotherIndex));
+ if(motherTrack) {
+ TParticle *motherParticle = motherTrack->Particle();
+ if(motherParticle) {
+ Int_t pdgCodeOfMother = motherParticle->GetPdgCode();
+ //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {
+ if(pdgCodeOfMother == 113 // rho0
+ || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
+ // || pdgCodeOfMother == 221 // eta
+ // || pdgCodeOfMother == 331 // eta'
+ // || pdgCodeOfMother == 223 // omega
+ // || pdgCodeOfMother == 333 // phi
+ || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0
+ // || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0*
+ // || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+*
+ || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
+ || pdgCodeOfMother == 111 // pi0 Dalitz
+ ) {
+ kExcludeParticle = kTRUE;
+ }
+ }
+ }
+ }
+
+ //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi
+ if(kExcludeParticle) continue;
+ }
+
+ //Exclude electrons with PDG
+ if(fExcludeElectronsInMC) {
+
+ TParticle *particle = track->Particle();
+
+ if (particle){
+ if(TMath::Abs(particle->GetPdgCode()) == 11) continue;
+ }
+ }
+
+ vPhi = track->Phi();
+ //Printf("phi (before): %lf",vPhi);
+
+ fHistPt->Fill(vPt,gCentrality);
+ fHistEta->Fill(vEta,gCentrality);
+ fHistPhi->Fill(vPhi,gCentrality);
+ if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality);
+ else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality);
+ //fHistPhi->Fill(vPhi*TMath::RadToDeg(),gCentrality);
+ fHistRapidity->Fill(vY,gCentrality);
+ //if(vCharge > 0) fHistPhiPos->Fill(vPhi*TMath::RadToDeg(),gCentrality);
+ //else if(vCharge < 0) fHistPhiNeg->Fill(vPhi*TMath::RadToDeg(),gCentrality);
+ if(vCharge > 0) fHistPhiPos->Fill(vPhi,gCentrality);
+ else if(vCharge < 0) fHistPhiNeg->Fill(vPhi,gCentrality);
+
+ //Flow after burner
+ if(fUseFlowAfterBurner) {
+ Double_t precisionPhi = 0.001;
+ Int_t maxNumberOfIterations = 100;
+
+ Double_t phi0 = vPhi;
+ Double_t gV2 = fDifferentialV2->Eval(vPt);
+
+ for (Int_t j = 0; j < maxNumberOfIterations; j++) {
+ Double_t phiprev = vPhi;
+ Double_t fl = vPhi - phi0 + gV2*TMath::Sin(2.*(vPhi - gReactionPlane*TMath::DegToRad()));
+ Double_t fp = 1.0 + 2.0*gV2*TMath::Cos(2.*(vPhi - gReactionPlane*TMath::DegToRad()));
+ vPhi -= fl/fp;
+ if (TMath::AreEqualAbs(phiprev,vPhi,precisionPhi)) break;
+ }
+ //Printf("phi (after): %lf\n",vPhi);
+ Double_t vDeltaphiBefore = phi0 - gReactionPlane*TMath::DegToRad();
+ if(vDeltaphiBefore < 0) vDeltaphiBefore += 2*TMath::Pi();
+ fHistPhiBefore->Fill(vDeltaphiBefore,gCentrality);
+
+ Double_t vDeltaphiAfter = vPhi - gReactionPlane*TMath::DegToRad();
+ if(vDeltaphiAfter < 0) vDeltaphiAfter += 2*TMath::Pi();
+ fHistPhiAfter->Fill(vDeltaphiAfter,gCentrality);
+
+ }
+
+ //vPhi *= TMath::RadToDeg();
+
+ //=======================================correction
+ Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality);
+ //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);
+
+ tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction));
+ } //track loop
+ }//MC event object
+ }//MC
+
+ return tracksAccepted;
+}
+
+//________________________________________________________________________
+TObjArray* AliAnalysisTaskBFPsi::GetShuffledTracks(TObjArray *tracks, Double_t gCentrality){
+ // Clones TObjArray and returns it with tracks after shuffling the charges
+
+ TObjArray* tracksShuffled = new TObjArray;
+ tracksShuffled->SetOwner(kTRUE);
+
+ vector<Short_t> *chargeVector = new vector<Short_t>; //original charge of accepted tracks
+
+ for (Int_t i=0; i<tracks->GetEntriesFast(); i++)
+ {
+ AliVParticle* track = (AliVParticle*) tracks->At(i);
+ chargeVector->push_back(track->Charge());
+ }
+
+ random_shuffle(chargeVector->begin(), chargeVector->end());
+
+ for(Int_t i = 0; i < tracks->GetEntriesFast(); i++){
+ AliVParticle* track = (AliVParticle*) tracks->At(i);
+ //==============================correction
+ Double_t correction = GetTrackbyTrackCorrectionMatrix(track->Eta(), track->Phi(),track->Pt(), chargeVector->at(i), gCentrality);
+ //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality);
+ tracksShuffled->Add(new AliBFBasicParticle(track->Eta(), track->Phi(), track->Pt(),chargeVector->at(i), correction));
+ }
+
+ delete chargeVector;
+
+ return tracksShuffled;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskBFPsi::SetVZEROCalibrationFile(const char* filename,
+ const char* lhcPeriod) {
+ //Function to setup the VZERO gain equalization
+ //============Get the equilization map============//
+ TFile *calibrationFile = TFile::Open(filename);
+ if((!calibrationFile)||(!calibrationFile->IsOpen())) {
+ Printf("No calibration file found!!!");
+ return;
+ }
+
+ TList *list = dynamic_cast<TList *>(calibrationFile->Get(lhcPeriod));
+ if(!list) {
+ Printf("Calibration TList not found!!!");
+ return;
+ }
+
+ fHistVZEROAGainEqualizationMap = dynamic_cast<TH1F *>(list->FindObject("gHistVZEROAGainEqualizationMap"));
+ if(!fHistVZEROAGainEqualizationMap) {
+ Printf("VZERO-A calibration object not found!!!");
+ return;
+ }
+ fHistVZEROCGainEqualizationMap = dynamic_cast<TH1F *>(list->FindObject("gHistVZEROCGainEqualizationMap"));
+ if(!fHistVZEROCGainEqualizationMap) {
+ Printf("VZERO-C calibration object not found!!!");
+ return;
+ }
+
+ fHistVZEROChannelGainEqualizationMap = dynamic_cast<TH2F *>(list->FindObject("gHistVZEROChannelGainEqualizationMap"));
+ if(!fHistVZEROChannelGainEqualizationMap) {
+ Printf("VZERO channel calibration object not found!!!");
+ return;
+ }
+}
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::GetChannelEqualizationFactor(Int_t run,
+ Int_t channel) {
+ //
+ if(!fHistVZEROAGainEqualizationMap) return 1.0;
+
+ for(Int_t iBinX = 1; iBinX <= fHistVZEROChannelGainEqualizationMap->GetNbinsX(); iBinX++) {
+ Int_t gRunNumber = atoi(fHistVZEROChannelGainEqualizationMap->GetXaxis()->GetBinLabel(iBinX));
+ if(gRunNumber == run)
+ return fHistVZEROChannelGainEqualizationMap->GetBinContent(iBinX,channel+1);
+ }
+
+ return 1.0;
+}
+
+//________________________________________________________________________
+Double_t AliAnalysisTaskBFPsi::GetEqualizationFactor(Int_t run,
+ const char* side) {
+ //
+ if(!fHistVZEROAGainEqualizationMap) return 1.0;
+
+ TString gVZEROSide = side;
+ for(Int_t iBinX = 1; iBinX < fHistVZEROAGainEqualizationMap->GetNbinsX(); iBinX++) {
+ Int_t gRunNumber = atoi(fHistVZEROAGainEqualizationMap->GetXaxis()->GetBinLabel(iBinX));
+ //cout<<"Looking for run "<<run<<" - current run: "<<gRunNumber<<endl;
+ if(gRunNumber == run) {
+ if(gVZEROSide == "A")
+ return fHistVZEROAGainEqualizationMap->GetBinContent(iBinX);
+ else if(gVZEROSide == "C")
+ return fHistVZEROCGainEqualizationMap->GetBinContent(iBinX);
+ }
+ }
+
+ return 1.0;
+}
+
+//____________________________________________________________________
+Bool_t AliAnalysisTaskBFPsi::AcceptEventCentralityWeight(Double_t centrality)
+{
+ // copied from AliAnalysisTaskPhiCorrelations
+ //
+ // rejects "randomly" events such that the centrality gets flat
+ // uses fCentralityWeights histogram
+
+ // TODO code taken and adapted from AliRDHFCuts; waiting for general class AliCentralityFlattening
+
+ Double_t weight = fCentralityWeights->GetBinContent(fCentralityWeights->FindBin(centrality));
+ Double_t centralityDigits = centrality*100. - (Int_t)(centrality*100.);
+
+ Bool_t result = kFALSE;
+ if (centralityDigits < weight)
+ result = kTRUE;
+
+ AliInfo(Form("Centrality: %f; Digits: %f; Weight: %f; Result: %d", centrality, centralityDigits, weight, result));
+
+ return result;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskBFPsi::FinishTaskOutput(){
+ //Printf("END BF");
+
+ if (!fBalance) {
+ AliError("fBalance not available");
+ return;
+ }
+ if(fRunShuffling) {
+ if (!fShuffledBalance) {
+ AliError("fShuffledBalance not available");
+ return;
+ }
+ }
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskBFPsi::Terminate(Option_t *) {
+ // Draw result to the screen
+ // Called once at the end of the query
+
+ // not implemented ...
+
+}
+
-#ifndef ALIANALYSISTASKBFPSI_H\r
-#define ALIANALYSISTASKBFPSI_H\r
-\r
-// Analysis task for the BF vs Psi code\r
-// Authors: Panos Cristakoglou@cern.ch\r
-\r
-class TList;\r
-class TH1F;\r
-class TH2F;\r
-class TH3F; \r
-class TF1;\r
-class TH3D;\r
-\r
-class AliBalancePsi;\r
-class AliESDtrackCuts;\r
-class AliEventPoolManager;\r
-\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliBalancePsi.h"\r
-\r
-#include "AliPID.h" \r
-#include "AliPIDResponse.h"\r
-#include "AliPIDCombined.h"\r
- \r
-//================================correction\r
-#define kCENTRALITY 101 \r
-//const Double_t centralityArrayForPbPb[kCENTRALITY+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.};\r
-//const TString centralityArrayForPbPb_string[kCENTRALITY] = {"0-5","5-10","10-20","20-30","30-40","40-50","50-60","60-70","70-80"};\r
-//================================correction\r
-\r
-class AliAnalysisTaskBFPsi : public AliAnalysisTaskSE {\r
- public:\r
- AliAnalysisTaskBFPsi(const char *name = "AliAnalysisTaskBFPsi");\r
- virtual ~AliAnalysisTaskBFPsi(); \r
- \r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void FinishTaskOutput();\r
- virtual void Terminate(Option_t *);\r
-\r
- //========================correction\r
- virtual void SetInputCorrection(TString filename, \r
- Int_t nCentralityBins, \r
- Double_t *centralityArrayForCorrections);\r
- //========================correction\r
- // void SetDebugLevel() {fDebugLevel = kTRUE;} //hides overloaded virtual function\r
-\r
- void SetAnalysisObject(AliBalancePsi *const analysis) {\r
- fBalance = analysis;\r
- }\r
- void SetShufflingObject(AliBalancePsi *const analysisShuffled) {\r
- fRunShuffling = kTRUE;\r
- fShuffledBalance = analysisShuffled;\r
- }\r
- void SetMixingObject(AliBalancePsi *const analysisMixed) {\r
- fRunMixing = kTRUE;\r
- fMixedBalance = analysisMixed;\r
- }\r
- void SetMixingWithEventPlane(Bool_t bMixingWithEventPlane = kTRUE) { fRunMixingEventPlane = bMixingWithEventPlane; }\r
- void SetMixingTracks(Int_t tracks) { fMixingTracks = tracks; }\r
- void SetAnalysisCutObject(AliESDtrackCuts *const trackCuts) {\r
- fESDtrackCuts = trackCuts;}\r
- void SetVertexDiamond(Double_t vx, Double_t vy, Double_t vz) {\r
- fVxMax = vx;\r
- fVyMax = vy;\r
- fVzMax = vz;\r
- }\r
-\r
- //==============AOD analysis==============//\r
- void SetAODtrackCutBit(Int_t bit){\r
- fnAODtrackCutBit = bit;\r
- }\r
-\r
- void SetKinematicsCutsAOD(Double_t ptmin, Double_t ptmax, Double_t etamin, Double_t etamax){\r
- fPtMin = ptmin; fPtMax = ptmax;\r
- fEtaMin = etamin; fEtaMax = etamax;\r
- }\r
-\r
- void SetExtraDCACutsAOD(Double_t DCAxy, Double_t DCAz){\r
- fDCAxyCut = DCAxy;\r
- fDCAzCut = DCAz;\r
- }\r
-\r
- void SetExtraTPCCutsAOD(Double_t maxTPCchi2, Int_t minNClustersTPC){\r
- fTPCchi2Cut = maxTPCchi2;\r
- fNClustersTPCCut = minNClustersTPC;\r
- }\r
-\r
- //==============MC analysis==============//\r
- void SetKinematicsCutsMC(Double_t ptmin, Double_t ptmax,\r
- Double_t etamin, Double_t etamax){\r
- fPtMin = ptmin; fPtMax = ptmax;\r
- fEtaMin = etamin; fEtaMax = etamax;\r
- }\r
- void UseFlowAfterBurner(TF1 *gDifferentialV2) {\r
- fDifferentialV2 = gDifferentialV2;\r
- fUseFlowAfterBurner = kTRUE;\r
- }\r
- void ExcludeResonancesInMC() {fExcludeResonancesInMC = kTRUE;}\r
- void ExcludeElectronsInMC() {fExcludeElectronsInMC = kTRUE;}\r
-\r
- void SetPDGCode(Int_t gPdgCode) {\r
- fUseMCPdgCode = kTRUE;\r
- fPDGCodeToBeAnalyzed = gPdgCode;\r
- }\r
-\r
- //Centrality\r
- void SetCentralityEstimator(const char* centralityEstimator) {fCentralityEstimator = centralityEstimator;}\r
- const char* GetCentralityEstimator(void) const {return fCentralityEstimator;}\r
- void SetCentralityPercentileRange(Double_t min, Double_t max) { \r
- fUseCentrality = kTRUE;\r
- fCentralityPercentileMin=min;\r
- fCentralityPercentileMax=max;\r
- }\r
- void SetImpactParameterRange(Double_t min, Double_t max) { \r
- fUseCentrality = kTRUE;\r
- fImpactParameterMin=min;\r
- fImpactParameterMax=max;\r
- }\r
-\r
- //multiplicity\r
- void SetMultiplicityEstimator(const char* multiplicityEstimator) {fMultiplicityEstimator = multiplicityEstimator;}\r
- const char* GetMultiplicityEstimator(void) const {return fMultiplicityEstimator;}\r
- void SetMultiplicityRange(Double_t min, Double_t max) {\r
- fUseMultiplicity = kTRUE;\r
- fNumberOfAcceptedTracksMin = min;\r
- fNumberOfAcceptedTracksMax = max;}\r
- \r
- // additional event cuts (default = kFALSE)\r
- void UseOfflineTrigger() {fUseOfflineTrigger = kTRUE;}\r
- void CheckFirstEventInChunk() {fCheckFirstEventInChunk = kTRUE;}\r
- void CheckPileUp() {fCheckPileUp = kTRUE;}\r
- void CheckPrimaryFlagAOD() {fCheckPrimaryFlagAOD = kTRUE;}\r
- void UseMCforKinematics() {fUseMCforKinematics = kTRUE;}\r
- void SetCentralityWeights(TH1* hist) { fCentralityWeights = hist; }\r
- Bool_t AcceptEventCentralityWeight(Double_t centrality);\r
-\r
- \r
- //Acceptance filter\r
- void SetAcceptanceParameterization(TF1 *parameterization) {\r
- fAcceptanceParameterization = parameterization;}\r
-\r
- //pid\r
- enum kDetectorUsedForPID { kTPCpid, kTOFpid, kTPCTOF }; // default TPC & TOF pid (via GetTPCpid & GetTOFpid) \r
- enum kParticleOfInterest { kMuon, kElectron, kPion, kKaon, kProton }; \r
-\r
- void SetUseBayesianPID(Double_t gMinProbabilityValue) {\r
- fUsePID = kTRUE; fUsePIDnSigma = kFALSE; fUsePIDPropabilities = kTRUE;\r
- fMinAcceptedPIDProbability = gMinProbabilityValue; }\r
-\r
- void SetUseNSigmaPID(Double_t gMaxNSigma) {\r
- fUsePID = kTRUE; fUsePIDPropabilities = kFALSE; fUsePIDnSigma = kTRUE;\r
- fPIDNSigma = gMaxNSigma; }\r
-\r
- void SetParticleOfInterest(kParticleOfInterest poi) {\r
- fParticleOfInterest = poi;}\r
- void SetDetectorUsedForPID(kDetectorUsedForPID detConfig) {\r
- fPidDetectorConfig = detConfig;}\r
- void SetEventClass(TString receivedEventClass){\r
- fEventClass = receivedEventClass;\r
- }\r
- \r
- void SetCustomBinning(TString receivedCustomBinning) { fCustomBinning = receivedCustomBinning; }\r
-\r
-\r
- // electron rejection\r
- void SetElectronRejection(Double_t gMaxNSigma){\r
- fElectronRejection = kTRUE;\r
- fElectronRejectionNSigma = gMaxNSigma;\r
- }\r
-\r
- void SetElectronOnlyRejection(Double_t gMaxNSigma){\r
- fElectronRejection = kTRUE;\r
- fElectronOnlyRejection = kTRUE;\r
- fElectronRejectionNSigma = gMaxNSigma;\r
- }\r
-\r
- void SetElectronRejectionPt(Double_t minPt,Double_t maxPt){\r
- fElectronRejectionMinPt = minPt;\r
- fElectronRejectionMaxPt = maxPt;\r
- }\r
-\r
- void SetVZEROCalibrationFile(const char* filename, const char* lhcPeriod);\r
-\r
- private:\r
- Double_t IsEventAccepted(AliVEvent* event);\r
- Double_t GetRefMultiOrCentrality(AliVEvent* event);\r
- Double_t GetReferenceMultiplicityFromAOD(AliVEvent* event);\r
- Double_t GetEventPlane(AliVEvent* event);\r
- //===============================correction\r
- Double_t GetTrackbyTrackCorrectionMatrix(Double_t vEta, \r
- Double_t vPhi, \r
- Double_t vPt, \r
- Short_t vCharge, \r
- Double_t gCentrality);\r
- //===============================correction\r
- TObjArray* GetAcceptedTracks(AliVEvent* event, Double_t gCentrality, Double_t gReactionPlane);\r
- TObjArray* GetShuffledTracks(TObjArray* tracks, Double_t gCentrality);\r
-\r
- Double_t GetChannelEqualizationFactor(Int_t run, Int_t channel);\r
- Double_t GetEqualizationFactor(Int_t run, const char *side);\r
- \r
- Bool_t fDebugLevel; // debug level\r
-\r
- TClonesArray* fArrayMC; //! AOD object //+++++++++++++++++++++\r
- AliBalancePsi *fBalance; //BF object\r
- Bool_t fRunShuffling;//run shuffling or not\r
- AliBalancePsi *fShuffledBalance; //BF object (shuffled)\r
- Bool_t fRunMixing;//run mixing or not\r
- Bool_t fRunMixingEventPlane;//run mixing with Event Plane\r
- Int_t fMixingTracks;\r
- AliBalancePsi *fMixedBalance; //TriggeredBF object (mixed)\r
- AliEventPoolManager* fPoolMgr; //! event pool manager\r
-\r
- TList *fList; //fList object\r
- TList *fListBF; //fList object\r
- TList *fListBFS; //fList object\r
- TList *fListBFM; //fList object\r
- TList *fHistListPIDQA; //! list of histograms\r
-\r
- TH2F *fHistEventStats; //event stats\r
- TH2F *fHistCentStats; //centrality stats\r
- TH2F *fHistCentStatsUsed; //centrality stats USED +++++++++++++++++++++++\r
- TH1F *fHistTriggerStats; //trigger stats\r
- TH1F *fHistTrackStats; //Track filter bit stats\r
- TH1F *fHistVx; //x coordinate of the primary vertex\r
- TH1F *fHistVy; //y coordinate of the primary vertex\r
- TH2F *fHistVz; //z coordinate of the primary vertex\r
-\r
- TH2F *fHistTPCvsVZEROMultiplicity; //VZERO vs TPC reference multiplicity\r
- TH2F *fHistVZEROSignal; //VZERO channel vs signal\r
-\r
- TH2F *fHistEventPlane; //event plane distribution\r
-\r
- TH2F *fHistClus;//number of clusters (QA histogram)\r
- TH2F *fHistDCA;//DCA (QA histogram)\r
- TH2F *fHistChi2;//track chi2 (QA histogram)\r
- TH2F *fHistPt;//transverse momentum (QA histogram)\r
- TH2F *fHistEta;//pseudorapidity (QA histogram)\r
- TH2F *fHistRapidity;//rapidity (QA histogram)\r
- TH2F *fHistPhi;//phi (QA histogram)\r
- TH3F *fHistEtaPhiPos;//eta-phi pos particles (QA histogram) \r
- TH3F *fHistEtaPhiNeg;//eta-phi neg particles (QA histogram)\r
- TH2F *fHistPhiBefore;//phi before v2 afterburner (QA histogram)\r
- TH2F *fHistPhiAfter;//phi after v2 afterburner (QA histogram)\r
- TH2F *fHistPhiPos;//phi for positive particles (QA histogram)\r
- TH2F *fHistPhiNeg;//phi for negative particles (QA histogram)\r
- TH2F *fHistV0M;//V0 multiplicities (QA histogram)\r
- TH2F *fHistRefTracks;//reference track multiplicities (QA histogram)\r
-\r
- //============PID============//\r
- TH2D *fHistdEdxVsPTPCbeforePID;//TPC dEdx vs momentum before PID cuts (QA histogram)\r
- TH2D *fHistBetavsPTOFbeforePID;//beta vs momentum before PID cuts (QA histogram)\r
- TH2D *fHistProbTPCvsPtbeforePID; //TPC probability vs pT before PID cuts (QA histogram)\r
- TH2D *fHistProbTOFvsPtbeforePID;//TOF probability vs pT before PID cuts (QA histogram)\r
- TH2D *fHistProbTPCTOFvsPtbeforePID;//TOF/TPC probability vs pT before PID cuts (QA histogram)\r
- TH2D *fHistNSigmaTPCvsPtbeforePID;//TPC nsigma vs pT before PID cuts (QA histogram)\r
- TH2D *fHistNSigmaTOFvsPtbeforePID;//TOF nsigma vs pT before PID cuts (QA histogram)\r
- TH2D *fHistBetaVsdEdXbeforePID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
- TH2D *fHistNSigmaTPCTOFvsPtbeforePID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
- TH2D *fHistdEdxVsPTPCafterPID;//TPC dEdx vs momentum after PID cuts (QA histogram)\r
- TH2D *fHistBetavsPTOFafterPID;//beta vs momentum after PID cuts (QA histogram)\r
- TH2D *fHistProbTPCvsPtafterPID; //TPC probability vs pT after PID cuts (QA histogram)\r
- TH2D *fHistProbTOFvsPtafterPID;//TOF probability vs pT after PID cuts (QA histogram)\r
- TH2D *fHistProbTPCTOFvsPtafterPID;//TOF/TPC probability vs pT after PID cuts (QA histogram)\r
- TH2D *fHistNSigmaTPCvsPtafterPID;//TPC nsigma vs pT after PID cuts (QA histogram)\r
- TH2D *fHistNSigmaTOFvsPtafterPID;//TOF nsigma vs pT after PID cuts (QA histogram)\r
- TH2D *fHistBetaVsdEdXafterPID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
- TH2D *fHistNSigmaTPCTOFvsPtafterPID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++\r
-\r
- TH2D *fHistdEdxVsPTPCbeforePIDelectron; //+++++++\r
- TH2D *fHistNSigmaTPCvsPtbeforePIDelectron; //+++++++\r
- TH2D *fHistdEdxVsPTPCafterPIDelectron; //+++++++\r
- TH2D *fHistNSigmaTPCvsPtafterPIDelectron; //+++++++\r
- \r
- TH3F *fHistCorrectionPlus[kCENTRALITY]; //====correction\r
- TH3F *fHistCorrectionMinus[kCENTRALITY]; //===correction\r
- Double_t fCentralityArrayForCorrections[kCENTRALITY];\r
- Int_t fCentralityArrayBinsForCorrections;\r
-\r
- TH1* fCentralityWeights; // for centrality flattening\r
-\r
- AliPIDResponse *fPIDResponse; //! PID response object\r
- AliPIDCombined *fPIDCombined; //! combined PID object\r
- \r
- kParticleOfInterest fParticleOfInterest;//analyzed particle\r
- kDetectorUsedForPID fPidDetectorConfig;//used detector for PID\r
-\r
- Bool_t fUsePID; //flag to use PID \r
- Bool_t fUsePIDnSigma;//flag to use nsigma method for PID\r
- Bool_t fUsePIDPropabilities;//flag to use probability method for PID\r
- Double_t fPIDNSigma;//nsigma cut for PID\r
- Double_t fMinAcceptedPIDProbability;//probability cut for PID\r
-\r
- Bool_t fElectronRejection;//flag to use electron rejection\r
- Bool_t fElectronOnlyRejection;//flag to use electron rejection with exclusive electron PID (no other particle in nsigma range)\r
- Double_t fElectronRejectionNSigma;//nsigma cut for electron rejection\r
- Double_t fElectronRejectionMinPt;//minimum pt for electron rejection (default = 0.)\r
- Double_t fElectronRejectionMaxPt;//maximum pt for electron rejection (default = 1000.)\r
- //============PID============//\r
-\r
- AliESDtrackCuts *fESDtrackCuts; //ESD track cuts\r
-\r
- TString fCentralityEstimator; //"V0M","TRK","TKL","ZDC","FMD"\r
- Bool_t fUseCentrality;//use the centrality (PbPb) or not (pp)\r
- Double_t fCentralityPercentileMin;//centrality percentile min\r
- Double_t fCentralityPercentileMax;//centrality percentile max\r
- Double_t fImpactParameterMin;//impact parameter min (used for MC)\r
- Double_t fImpactParameterMax;//impact parameter max (used for MC)\r
-\r
- TString fMultiplicityEstimator;//"V0M","V0A","V0C","TPC"\r
- Bool_t fUseMultiplicity;//use the multiplicity cuts\r
- Double_t fNumberOfAcceptedTracksMin;//min. number of number of accepted tracks (used for the multiplicity dependence study - pp)\r
- Double_t fNumberOfAcceptedTracksMax;//max. number of number of accepted tracks (used for the multiplicity dependence study - pp)\r
- TH2F *fHistNumberOfAcceptedTracks;//hisot to store the number of accepted tracks\r
- TH1F *fHistMultiplicity;//hisot to store the number of accepted tracks //++++++++++++++++++\r
-\r
- Bool_t fUseOfflineTrigger;//Usage of the offline trigger selection\r
- Bool_t fCheckFirstEventInChunk;//Usage of the "First Event in Chunk" check (not needed for new productions)\r
- Bool_t fCheckPileUp;//Usage of the "Pile-Up" event check\r
- Bool_t fCheckPrimaryFlagAOD;// Usage of check on AliAODtrack::kPrimary (default = OFF)\r
- Bool_t fUseMCforKinematics;//Usage of MC information for filling the kinematics information of particles (only in MCAODrec mode)\r
-\r
- Double_t fVxMax;//vxmax\r
- Double_t fVyMax;//vymax\r
- Double_t fVzMax;//vzmax\r
-\r
- Int_t fnAODtrackCutBit;//track cut bit from track selection (only used for AODs)\r
-\r
- Double_t fPtMin;//only used for AODs\r
- Double_t fPtMax;//only used for AODs\r
- Double_t fPtMinForCorrections;//only used for AODs\r
- Double_t fPtMaxForCorrections;//only used for AODs\r
- Double_t fPtBinForCorrections; //=================================correction\r
- Double_t fEtaMin;//only used for AODs\r
- Double_t fEtaMax;//only used for AODs\r
- Double_t fEtaMinForCorrections;//only used for AODs\r
- Double_t fEtaMaxForCorrections;//only used for AODs\r
- Double_t fEtaBinForCorrections; //=================================correction\r
- Double_t fPhiMin; //=================================correction \r
- Double_t fPhiMax; //=================================correction\r
- Double_t fPhiMinForCorrections;//only used for AODs\r
- Double_t fPhiMaxForCorrections;//only used for AODs\r
- Double_t fPhiBinForCorrections; //=================================correction\r
-\r
- Double_t fDCAxyCut;//only used for AODs\r
- Double_t fDCAzCut;//only used for AODs\r
-\r
- Double_t fTPCchi2Cut;//only used for AODs\r
- Int_t fNClustersTPCCut;//only used for AODs\r
-\r
- TF1 *fAcceptanceParameterization;//acceptance filter used for MC\r
-\r
- TF1 *fDifferentialV2;//pt-differential v2 (from real data)\r
- Bool_t fUseFlowAfterBurner;//Usage of a flow after burner\r
-\r
- Bool_t fExcludeResonancesInMC;//flag to exclude the resonances' decay products (and conversion) from the MC analysis\r
- Bool_t fExcludeElectronsInMC;//flag to exclude the electrons from the MC analysis\r
- Bool_t fUseMCPdgCode; //Boolean to analyze a set of particles in MC\r
- Int_t fPDGCodeToBeAnalyzed; //Analyze a set of particles in MC\r
- TString fEventClass; //Can be "EventPlane", "Centrality", "Multiplicity"\r
- TString fCustomBinning;//for setting customized binning (for output AliTHn of AliBalancePsi)\r
- \r
- //VZERO calibration\r
- TH1F *fHistVZEROAGainEqualizationMap;//VZERO calibration map\r
- TH1F *fHistVZEROCGainEqualizationMap;//VZERO calibration map\r
- TH2F *fHistVZEROChannelGainEqualizationMap; //VZERO calibration map\r
-\r
- AliAnalysisTaskBFPsi(const AliAnalysisTaskBFPsi&); // not implemented\r
- AliAnalysisTaskBFPsi& operator=(const AliAnalysisTaskBFPsi&); // not implemented\r
- \r
- ClassDef(AliAnalysisTaskBFPsi, 6); // example of analysis\r
-};\r
-\r
-\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKBFPSI_H
+#define ALIANALYSISTASKBFPSI_H
+
+// Analysis task for the BF vs Psi code
+// Authors: Panos Cristakoglou@cern.ch
+
+class TList;
+class TH1F;
+class TH2F;
+class TH3F;
+class TF1;
+class TH3D;
+
+class AliBalancePsi;
+class AliESDtrackCuts;
+class AliEventPoolManager;
+
+
+#include "AliAnalysisTaskSE.h"
+#include "AliBalancePsi.h"
+
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliPIDCombined.h"
+
+//================================correction
+#define kCENTRALITY 101
+//const Double_t centralityArrayForPbPb[kCENTRALITY+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.};
+//const TString centralityArrayForPbPb_string[kCENTRALITY] = {"0-5","5-10","10-20","20-30","30-40","40-50","50-60","60-70","70-80"};
+//================================correction
+
+class AliAnalysisTaskBFPsi : public AliAnalysisTaskSE {
+ public:
+ AliAnalysisTaskBFPsi(const char *name = "AliAnalysisTaskBFPsi");
+ virtual ~AliAnalysisTaskBFPsi();
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void FinishTaskOutput();
+ virtual void Terminate(Option_t *);
+
+ //========================correction
+ virtual void SetInputCorrection(TString filename,
+ Int_t nCentralityBins,
+ Double_t *centralityArrayForCorrections);
+ //========================correction
+ // void SetDebugLevel() {fDebugLevel = kTRUE;} //hides overloaded virtual function
+
+ void SetAnalysisObject(AliBalancePsi *const analysis) {
+ fBalance = analysis;
+ }
+ void SetShufflingObject(AliBalancePsi *const analysisShuffled) {
+ fRunShuffling = kTRUE;
+ fShuffledBalance = analysisShuffled;
+ }
+ void SetMixingObject(AliBalancePsi *const analysisMixed) {
+ fRunMixing = kTRUE;
+ fMixedBalance = analysisMixed;
+ }
+ void SetMixingWithEventPlane(Bool_t bMixingWithEventPlane = kTRUE) { fRunMixingEventPlane = bMixingWithEventPlane; }
+ void SetMixingTracks(Int_t tracks) { fMixingTracks = tracks; }
+ void SetAnalysisCutObject(AliESDtrackCuts *const trackCuts) {
+ fESDtrackCuts = trackCuts;}
+ void SetVertexDiamond(Double_t vx, Double_t vy, Double_t vz) {
+ fVxMax = vx;
+ fVyMax = vy;
+ fVzMax = vz;
+ }
+
+ //==============AOD analysis==============//
+ void SetAODtrackCutBit(Int_t bit){
+ fnAODtrackCutBit = bit;
+ }
+
+ void SetKinematicsCutsAOD(Double_t ptmin, Double_t ptmax, Double_t etamin, Double_t etamax){
+ fPtMin = ptmin; fPtMax = ptmax;
+ fEtaMin = etamin; fEtaMax = etamax;
+ }
+
+ void SetExtraDCACutsAOD(Double_t DCAxy, Double_t DCAz){
+ fDCAxyCut = DCAxy;
+ fDCAzCut = DCAz;
+ }
+
+ void SetExtraTPCCutsAOD(Double_t maxTPCchi2, Int_t minNClustersTPC){
+ fTPCchi2Cut = maxTPCchi2;
+ fNClustersTPCCut = minNClustersTPC;
+ }
+
+ //==============MC analysis==============//
+ void SetKinematicsCutsMC(Double_t ptmin, Double_t ptmax,
+ Double_t etamin, Double_t etamax){
+ fPtMin = ptmin; fPtMax = ptmax;
+ fEtaMin = etamin; fEtaMax = etamax;
+ }
+ void UseFlowAfterBurner(TF1 *gDifferentialV2) {
+ fDifferentialV2 = gDifferentialV2;
+ fUseFlowAfterBurner = kTRUE;
+ }
+ void ExcludeResonancesInMC() {fExcludeResonancesInMC = kTRUE;}
+ void ExcludeElectronsInMC() {fExcludeElectronsInMC = kTRUE;}
+
+ void SetPDGCode(Int_t gPdgCode) {
+ fUseMCPdgCode = kTRUE;
+ fPDGCodeToBeAnalyzed = gPdgCode;
+ }
+
+ //Centrality
+ void SetCentralityEstimator(const char* centralityEstimator) {fCentralityEstimator = centralityEstimator;}
+ const char* GetCentralityEstimator(void) const {return fCentralityEstimator;}
+ void SetCentralityPercentileRange(Double_t min, Double_t max) {
+ fUseCentrality = kTRUE;
+ fCentralityPercentileMin=min;
+ fCentralityPercentileMax=max;
+ }
+ void SetImpactParameterRange(Double_t min, Double_t max) {
+ fUseCentrality = kTRUE;
+ fImpactParameterMin=min;
+ fImpactParameterMax=max;
+ }
+
+ //multiplicity
+ void SetMultiplicityEstimator(const char* multiplicityEstimator) {fMultiplicityEstimator = multiplicityEstimator;}
+ const char* GetMultiplicityEstimator(void) const {return fMultiplicityEstimator;}
+ void SetMultiplicityRange(Double_t min, Double_t max) {
+ fUseMultiplicity = kTRUE;
+ fNumberOfAcceptedTracksMin = min;
+ fNumberOfAcceptedTracksMax = max;}
+
+ // additional event cuts (default = kFALSE)
+ void UseOfflineTrigger() {fUseOfflineTrigger = kTRUE;}
+ void CheckFirstEventInChunk() {fCheckFirstEventInChunk = kTRUE;}
+ void CheckPileUp() {fCheckPileUp = kTRUE;}
+ void CheckPrimaryFlagAOD() {fCheckPrimaryFlagAOD = kTRUE;}
+ void UseMCforKinematics() {fUseMCforKinematics = kTRUE;}
+ void SetCentralityWeights(TH1* hist) { fCentralityWeights = hist; }
+ Bool_t AcceptEventCentralityWeight(Double_t centrality);
+
+
+ //Acceptance filter
+ void SetAcceptanceParameterization(TF1 *parameterization) {
+ fAcceptanceParameterization = parameterization;}
+
+ //pid
+ enum kDetectorUsedForPID { kTPCpid, kTOFpid, kTPCTOF }; // default TPC & TOF pid (via GetTPCpid & GetTOFpid)
+ enum kParticleOfInterest { kMuon, kElectron, kPion, kKaon, kProton };
+
+ void SetUseBayesianPID(Double_t gMinProbabilityValue) {
+ fUsePID = kTRUE; fUsePIDnSigma = kFALSE; fUsePIDPropabilities = kTRUE;
+ fMinAcceptedPIDProbability = gMinProbabilityValue; }
+
+ void SetUseNSigmaPID(Double_t gMaxNSigma) {
+ fUsePID = kTRUE; fUsePIDPropabilities = kFALSE; fUsePIDnSigma = kTRUE;
+ fPIDNSigma = gMaxNSigma; }
+
+ void SetParticleOfInterest(kParticleOfInterest poi) {
+ fParticleOfInterest = poi;}
+ void SetDetectorUsedForPID(kDetectorUsedForPID detConfig) {
+ fPidDetectorConfig = detConfig;}
+ void SetEventClass(TString receivedEventClass){
+ fEventClass = receivedEventClass;
+ }
+
+ void SetCustomBinning(TString receivedCustomBinning) { fCustomBinning = receivedCustomBinning; }
+
+
+ // electron rejection
+ void SetElectronRejection(Double_t gMaxNSigma){
+ fElectronRejection = kTRUE;
+ fElectronRejectionNSigma = gMaxNSigma;
+ }
+
+ void SetElectronOnlyRejection(Double_t gMaxNSigma){
+ fElectronRejection = kTRUE;
+ fElectronOnlyRejection = kTRUE;
+ fElectronRejectionNSigma = gMaxNSigma;
+ }
+
+ void SetElectronRejectionPt(Double_t minPt,Double_t maxPt){
+ fElectronRejectionMinPt = minPt;
+ fElectronRejectionMaxPt = maxPt;
+ }
+
+ void SetVZEROCalibrationFile(const char* filename, const char* lhcPeriod);
+
+ private:
+ Double_t IsEventAccepted(AliVEvent* event);
+ Double_t GetRefMultiOrCentrality(AliVEvent* event);
+ Double_t GetReferenceMultiplicityFromAOD(AliVEvent* event);
+ Double_t GetEventPlane(AliVEvent* event);
+ //===============================correction
+ Double_t GetTrackbyTrackCorrectionMatrix(Double_t vEta,
+ Double_t vPhi,
+ Double_t vPt,
+ Short_t vCharge,
+ Double_t gCentrality);
+ //===============================correction
+ TObjArray* GetAcceptedTracks(AliVEvent* event, Double_t gCentrality, Double_t gReactionPlane);
+ TObjArray* GetShuffledTracks(TObjArray* tracks, Double_t gCentrality);
+
+ Double_t GetChannelEqualizationFactor(Int_t run, Int_t channel);
+ Double_t GetEqualizationFactor(Int_t run, const char *side);
+
+ Bool_t fDebugLevel; // debug level
+
+ TClonesArray* fArrayMC; //! AOD object //+++++++++++++++++++++
+ AliBalancePsi *fBalance; //BF object
+ Bool_t fRunShuffling;//run shuffling or not
+ AliBalancePsi *fShuffledBalance; //BF object (shuffled)
+ Bool_t fRunMixing;//run mixing or not
+ Bool_t fRunMixingEventPlane;//run mixing with Event Plane
+ Int_t fMixingTracks;
+ AliBalancePsi *fMixedBalance; //TriggeredBF object (mixed)
+ AliEventPoolManager* fPoolMgr; //! event pool manager
+
+ TList *fList; //fList object
+ TList *fListBF; //fList object
+ TList *fListBFS; //fList object
+ TList *fListBFM; //fList object
+ TList *fHistListPIDQA; //! list of histograms
+
+ TH2F *fHistEventStats; //event stats
+ TH2F *fHistCentStats; //centrality stats
+ TH2F *fHistCentStatsUsed; //centrality stats USED +++++++++++++++++++++++
+ TH1F *fHistTriggerStats; //trigger stats
+ TH1F *fHistTrackStats; //Track filter bit stats
+ TH1F *fHistVx; //x coordinate of the primary vertex
+ TH1F *fHistVy; //y coordinate of the primary vertex
+ TH2F *fHistVz; //z coordinate of the primary vertex
+
+ TH2F *fHistTPCvsVZEROMultiplicity; //VZERO vs TPC reference multiplicity
+ TH2F *fHistVZEROSignal; //VZERO channel vs signal
+
+ TH2F *fHistEventPlane; //event plane distribution
+
+ TH2F *fHistClus;//number of clusters (QA histogram)
+ TH2F *fHistDCA;//DCA (QA histogram)
+ TH2F *fHistChi2;//track chi2 (QA histogram)
+ TH2F *fHistPt;//transverse momentum (QA histogram)
+ TH2F *fHistEta;//pseudorapidity (QA histogram)
+ TH2F *fHistRapidity;//rapidity (QA histogram)
+ TH2F *fHistPhi;//phi (QA histogram)
+ TH3F *fHistEtaPhiPos;//eta-phi pos particles (QA histogram)
+ TH3F *fHistEtaPhiNeg;//eta-phi neg particles (QA histogram)
+ TH2F *fHistPhiBefore;//phi before v2 afterburner (QA histogram)
+ TH2F *fHistPhiAfter;//phi after v2 afterburner (QA histogram)
+ TH2F *fHistPhiPos;//phi for positive particles (QA histogram)
+ TH2F *fHistPhiNeg;//phi for negative particles (QA histogram)
+ TH2F *fHistV0M;//V0 multiplicities (QA histogram)
+ TH2F *fHistRefTracks;//reference track multiplicities (QA histogram)
+
+ //============PID============//
+ TH2D *fHistdEdxVsPTPCbeforePID;//TPC dEdx vs momentum before PID cuts (QA histogram)
+ TH2D *fHistBetavsPTOFbeforePID;//beta vs momentum before PID cuts (QA histogram)
+ TH2D *fHistProbTPCvsPtbeforePID; //TPC probability vs pT before PID cuts (QA histogram)
+ TH2D *fHistProbTOFvsPtbeforePID;//TOF probability vs pT before PID cuts (QA histogram)
+ TH2D *fHistProbTPCTOFvsPtbeforePID;//TOF/TPC probability vs pT before PID cuts (QA histogram)
+ TH2D *fHistNSigmaTPCvsPtbeforePID;//TPC nsigma vs pT before PID cuts (QA histogram)
+ TH2D *fHistNSigmaTOFvsPtbeforePID;//TOF nsigma vs pT before PID cuts (QA histogram)
+ TH2D *fHistBetaVsdEdXbeforePID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++
+ TH2D *fHistNSigmaTPCTOFvsPtbeforePID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++
+ TH2D *fHistdEdxVsPTPCafterPID;//TPC dEdx vs momentum after PID cuts (QA histogram)
+ TH2D *fHistBetavsPTOFafterPID;//beta vs momentum after PID cuts (QA histogram)
+ TH2D *fHistProbTPCvsPtafterPID; //TPC probability vs pT after PID cuts (QA histogram)
+ TH2D *fHistProbTOFvsPtafterPID;//TOF probability vs pT after PID cuts (QA histogram)
+ TH2D *fHistProbTPCTOFvsPtafterPID;//TOF/TPC probability vs pT after PID cuts (QA histogram)
+ TH2D *fHistNSigmaTPCvsPtafterPID;//TPC nsigma vs pT after PID cuts (QA histogram)
+ TH2D *fHistNSigmaTOFvsPtafterPID;//TOF nsigma vs pT after PID cuts (QA histogram)
+ TH2D *fHistBetaVsdEdXafterPID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++
+ TH2D *fHistNSigmaTPCTOFvsPtafterPID;//TPCTOF before PID cuts (QA histogram)//+++++++++++++++++++++
+
+ TH2D *fHistdEdxVsPTPCbeforePIDelectron; //+++++++
+ TH2D *fHistNSigmaTPCvsPtbeforePIDelectron; //+++++++
+ TH2D *fHistdEdxVsPTPCafterPIDelectron; //+++++++
+ TH2D *fHistNSigmaTPCvsPtafterPIDelectron; //+++++++
+
+ TH3F *fHistCorrectionPlus[kCENTRALITY]; //====correction
+ TH3F *fHistCorrectionMinus[kCENTRALITY]; //===correction
+ Double_t fCentralityArrayForCorrections[kCENTRALITY];
+ Int_t fCentralityArrayBinsForCorrections;
+
+ TH1* fCentralityWeights; // for centrality flattening
+
+ AliPIDResponse *fPIDResponse; //! PID response object
+ AliPIDCombined *fPIDCombined; //! combined PID object
+
+ kParticleOfInterest fParticleOfInterest;//analyzed particle
+ kDetectorUsedForPID fPidDetectorConfig;//used detector for PID
+
+ Bool_t fUsePID; //flag to use PID
+ Bool_t fUsePIDnSigma;//flag to use nsigma method for PID
+ Bool_t fUsePIDPropabilities;//flag to use probability method for PID
+ Double_t fPIDNSigma;//nsigma cut for PID
+ Double_t fMinAcceptedPIDProbability;//probability cut for PID
+
+ Bool_t fElectronRejection;//flag to use electron rejection
+ Bool_t fElectronOnlyRejection;//flag to use electron rejection with exclusive electron PID (no other particle in nsigma range)
+ Double_t fElectronRejectionNSigma;//nsigma cut for electron rejection
+ Double_t fElectronRejectionMinPt;//minimum pt for electron rejection (default = 0.)
+ Double_t fElectronRejectionMaxPt;//maximum pt for electron rejection (default = 1000.)
+ //============PID============//
+
+ AliESDtrackCuts *fESDtrackCuts; //ESD track cuts
+
+ TString fCentralityEstimator; //"V0M","TRK","TKL","ZDC","FMD"
+ Bool_t fUseCentrality;//use the centrality (PbPb) or not (pp)
+ Double_t fCentralityPercentileMin;//centrality percentile min
+ Double_t fCentralityPercentileMax;//centrality percentile max
+ Double_t fImpactParameterMin;//impact parameter min (used for MC)
+ Double_t fImpactParameterMax;//impact parameter max (used for MC)
+
+ TString fMultiplicityEstimator;//"V0M","V0A","V0C","TPC"
+ Bool_t fUseMultiplicity;//use the multiplicity cuts
+ Double_t fNumberOfAcceptedTracksMin;//min. number of number of accepted tracks (used for the multiplicity dependence study - pp)
+ Double_t fNumberOfAcceptedTracksMax;//max. number of number of accepted tracks (used for the multiplicity dependence study - pp)
+ TH2F *fHistNumberOfAcceptedTracks;//hisot to store the number of accepted tracks
+ TH1F *fHistMultiplicity;//hisot to store the number of accepted tracks //++++++++++++++++++
+
+ Bool_t fUseOfflineTrigger;//Usage of the offline trigger selection
+ Bool_t fCheckFirstEventInChunk;//Usage of the "First Event in Chunk" check (not needed for new productions)
+ Bool_t fCheckPileUp;//Usage of the "Pile-Up" event check
+ Bool_t fCheckPrimaryFlagAOD;// Usage of check on AliAODtrack::kPrimary (default = OFF)
+ Bool_t fUseMCforKinematics;//Usage of MC information for filling the kinematics information of particles (only in MCAODrec mode)
+
+ Double_t fVxMax;//vxmax
+ Double_t fVyMax;//vymax
+ Double_t fVzMax;//vzmax
+
+ Int_t fnAODtrackCutBit;//track cut bit from track selection (only used for AODs)
+
+ Double_t fPtMin;//only used for AODs
+ Double_t fPtMax;//only used for AODs
+ Double_t fPtMinForCorrections;//only used for AODs
+ Double_t fPtMaxForCorrections;//only used for AODs
+ Double_t fPtBinForCorrections; //=================================correction
+ Double_t fEtaMin;//only used for AODs
+ Double_t fEtaMax;//only used for AODs
+ Double_t fEtaMinForCorrections;//only used for AODs
+ Double_t fEtaMaxForCorrections;//only used for AODs
+ Double_t fEtaBinForCorrections; //=================================correction
+ Double_t fPhiMin; //=================================correction
+ Double_t fPhiMax; //=================================correction
+ Double_t fPhiMinForCorrections;//only used for AODs
+ Double_t fPhiMaxForCorrections;//only used for AODs
+ Double_t fPhiBinForCorrections; //=================================correction
+
+ Double_t fDCAxyCut;//only used for AODs
+ Double_t fDCAzCut;//only used for AODs
+
+ Double_t fTPCchi2Cut;//only used for AODs
+ Int_t fNClustersTPCCut;//only used for AODs
+
+ TF1 *fAcceptanceParameterization;//acceptance filter used for MC
+
+ TF1 *fDifferentialV2;//pt-differential v2 (from real data)
+ Bool_t fUseFlowAfterBurner;//Usage of a flow after burner
+
+ Bool_t fExcludeResonancesInMC;//flag to exclude the resonances' decay products (and conversion) from the MC analysis
+ Bool_t fExcludeElectronsInMC;//flag to exclude the electrons from the MC analysis
+ Bool_t fUseMCPdgCode; //Boolean to analyze a set of particles in MC
+ Int_t fPDGCodeToBeAnalyzed; //Analyze a set of particles in MC
+ TString fEventClass; //Can be "EventPlane", "Centrality", "Multiplicity"
+ TString fCustomBinning;//for setting customized binning (for output AliTHn of AliBalancePsi)
+
+ //VZERO calibration
+ TH1F *fHistVZEROAGainEqualizationMap;//VZERO calibration map
+ TH1F *fHistVZEROCGainEqualizationMap;//VZERO calibration map
+ TH2F *fHistVZEROChannelGainEqualizationMap; //VZERO calibration map
+
+ AliAnalysisTaskBFPsi(const AliAnalysisTaskBFPsi&); // not implemented
+ AliAnalysisTaskBFPsi& operator=(const AliAnalysisTaskBFPsi&); // not implemented
+
+ ClassDef(AliAnalysisTaskBFPsi, 6); // example of analysis
+};
+
+
+
+#endif
-#include "TChain.h"\r
-#include "TList.h"\r
-#include "TCanvas.h"\r
-#include "TLorentzVector.h"\r
-#include "TGraphErrors.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TArrayF.h"\r
-#include "TF1.h"\r
-#include "TRandom.h"\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliAnalysisManager.h"\r
-\r
-#include "AliESDVertex.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODTrack.h"\r
-#include "AliAODInputHandler.h"\r
-#include "AliGenEventHeader.h"\r
-#include "AliGenHijingEventHeader.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliMCEvent.h"\r
-#include "AliMixInputEventHandler.h"\r
-#include "AliStack.h"\r
-#include "AliESDtrackCuts.h"\r
-\r
-#include "TH2D.h" \r
-#include "AliPID.h" \r
-#include "AliPIDResponse.h" \r
-#include "AliPIDCombined.h" \r
-\r
-#include "AliAnalysisTaskEventMixingBF.h"\r
-#include "AliBalanceEventMixing.h"\r
-\r
-\r
-// Analysis task for the EventMixingBF code\r
-// Authors: Panos.Christakoglou@nikhef.nl, m.weber@cern.ch\r
-\r
-ClassImp(AliAnalysisTaskEventMixingBF)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskEventMixingBF::AliAnalysisTaskEventMixingBF(const char *name) \r
-: AliAnalysisTaskSE(name), \r
- fBalance(0),\r
- fRunShuffling(kFALSE),\r
- fShuffledBalance(0),\r
- fList(0),\r
- fListEventMixingBF(0),\r
- fListEventMixingBFS(0),\r
- fHistListPIDQA(0),\r
- fHistEventStats(0),\r
- fHistCentStats(0),\r
- fHistTriggerStats(0),\r
- fHistTrackStats(0),\r
- fHistVx(0),\r
- fHistVy(0),\r
- fHistVz(0),\r
- fHistClus(0),\r
- fHistDCA(0),\r
- fHistChi2(0),\r
- fHistPt(0),\r
- fHistEta(0),\r
- fHistPhi(0),\r
- fHistPhiBefore(0),\r
- fHistPhiAfter(0),\r
- fHistV0M(0),\r
- fHistRefTracks(0),\r
- fHistdEdxVsPTPCbeforePID(NULL),\r
- fHistBetavsPTOFbeforePID(NULL), \r
- fHistProbTPCvsPtbeforePID(NULL), \r
- fHistProbTOFvsPtbeforePID(NULL), \r
- fHistProbTPCTOFvsPtbeforePID(NULL),\r
- fHistNSigmaTPCvsPtbeforePID(NULL), \r
- fHistNSigmaTOFvsPtbeforePID(NULL), \r
- fHistdEdxVsPTPCafterPID(NULL),\r
- fHistBetavsPTOFafterPID(NULL), \r
- fHistProbTPCvsPtafterPID(NULL), \r
- fHistProbTOFvsPtafterPID(NULL), \r
- fHistProbTPCTOFvsPtafterPID(NULL),\r
- fHistNSigmaTPCvsPtafterPID(NULL), \r
- fHistNSigmaTOFvsPtafterPID(NULL), \r
- fPIDResponse(0x0),\r
- fPIDCombined(0x0),\r
- fParticleOfInterest(kPion),\r
- fPidDetectorConfig(kTPCTOF),\r
- fUsePID(kFALSE),\r
- fUsePIDnSigma(kTRUE),\r
- fUsePIDPropabilities(kFALSE), \r
- fPIDNSigma(3.),\r
- fMinAcceptedPIDProbability(0.8),\r
- fESDtrackCuts(0),\r
- fCentralityEstimator("V0M"),\r
- fUseCentrality(kFALSE),\r
- fCentralityPercentileMin(0.), \r
- fCentralityPercentileMax(5.),\r
- fImpactParameterMin(0.),\r
- fImpactParameterMax(20.),\r
- fUseMultiplicity(kFALSE),\r
- fNumberOfAcceptedTracksMin(0),\r
- fNumberOfAcceptedTracksMax(10000),\r
- fHistNumberOfAcceptedTracks(0),\r
- fUseOfflineTrigger(kFALSE),\r
- fVxMax(0.3),\r
- fVyMax(0.3),\r
- fVzMax(10.),\r
- nAODtrackCutBit(128),\r
- fPtMin(0.3),\r
- fPtMax(1.5),\r
- fEtaMin(-0.8),\r
- fEtaMax(-0.8),\r
- fDCAxyCut(-1),\r
- fDCAzCut(-1),\r
- fTPCchi2Cut(-1),\r
- fNClustersTPCCut(-1),\r
- fAcceptanceParameterization(0),\r
- fDifferentialV2(0),\r
- fUseFlowAfterBurner(kFALSE),\r
- fExcludeResonancesInMC(kFALSE),\r
- fUseMCPdgCode(kFALSE),\r
- fPDGCodeToBeAnalyzed(-1),\r
- fMainEvent(0x0),\r
- fMixEvent(0x0)\r
-{\r
- // Constructor\r
- // Define input and output slots here\r
- // Input slot #0 works with a TChain\r
- DefineInput(0, TChain::Class());\r
- // Output slot #0 writes into a TH1 container\r
- DefineOutput(1, TList::Class());\r
- DefineOutput(2, TList::Class());\r
- DefineOutput(3, TList::Class());\r
- DefineOutput(4, TList::Class());\r
-}\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskEventMixingBF::~AliAnalysisTaskEventMixingBF() {\r
-\r
- // delete fBalance; \r
- // delete fShuffledBalance; \r
- // delete fList;\r
- // delete fListEventMixingBF; \r
- // delete fListEventMixingBFS;\r
-\r
- // delete fHistEventStats; \r
- // delete fHistTrackStats; \r
- // delete fHistVx; \r
- // delete fHistVy; \r
- // delete fHistVz; \r
-\r
- // delete fHistClus;\r
- // delete fHistDCA;\r
- // delete fHistChi2;\r
- // delete fHistPt;\r
- // delete fHistEta;\r
- // delete fHistPhi;\r
- // delete fHistV0M;\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskEventMixingBF::UserCreateOutputObjects() {\r
- // Create histograms\r
- // Called once\r
- if(!fBalance) {\r
- fBalance = new AliBalanceEventMixing();\r
- fBalance->SetAnalysisLevel("ESD");\r
- //fBalance->SetNumberOfBins(-1,16);\r
- fBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6);\r
- }\r
- if(fRunShuffling) {\r
- if(!fShuffledBalance) {\r
- fShuffledBalance = new AliBalanceEventMixing();\r
- fShuffledBalance->SetAnalysisLevel("ESD");\r
- //fShuffledBalance->SetNumberOfBins(-1,16);\r
- fShuffledBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6);\r
- }\r
- }\r
-\r
- //QA list\r
- fList = new TList();\r
- fList->SetName("listQA");\r
- fList->SetOwner();\r
-\r
- //Balance Function list\r
- fListEventMixingBF = new TList();\r
- fListEventMixingBF->SetName("listEventMixingBF");\r
- fListEventMixingBF->SetOwner();\r
-\r
- if(fRunShuffling) {\r
- fListEventMixingBFS = new TList();\r
- fListEventMixingBFS->SetName("listEventMixingBFShuffled");\r
- fListEventMixingBFS->SetOwner();\r
- }\r
-\r
- //PID QA list\r
- if(fUsePID) {\r
- fHistListPIDQA = new TList();\r
- fHistListPIDQA->SetName("listQAPID");\r
- fHistListPIDQA->SetOwner();\r
- }\r
-\r
- //Event stats.\r
- TString gCutName[4] = {"Total","Offline trigger",\r
- "Vertex","Analyzed"};\r
- fHistEventStats = new TH1F("fHistEventStats",\r
- "Event statistics;;N_{events}",\r
- 4,0.5,4.5);\r
- for(Int_t i = 1; i <= 4; i++)\r
- fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1].Data());\r
- fList->Add(fHistEventStats);\r
-\r
- TString gCentName[9] = {"V0M","FMD","TRK","TKL","CL0","CL1","V0MvsFMD","TKLvsV0M","ZEMvsZDC"};\r
- fHistCentStats = new TH2F("fHistCentStats",\r
- "Centrality statistics;;Cent percentile",\r
- 9,-0.5,8.5,220,-5,105);\r
- for(Int_t i = 1; i <= 9; i++)\r
- fHistCentStats->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());\r
- fList->Add(fHistCentStats);\r
-\r
- fHistTriggerStats = new TH1F("fHistTriggerStats","Trigger statistics;TriggerBit;N_{events}",130,0,130);\r
- fList->Add(fHistTriggerStats);\r
-\r
- fHistTrackStats = new TH1F("fHistTrackStats","Event statistics;TrackFilterBit;N_{events}",130,0,130);\r
- fList->Add(fHistTrackStats);\r
-\r
- fHistNumberOfAcceptedTracks = new TH1F("fHistNumberOfAcceptedTracks",";N_{acc.};Entries",4001,-0.5,4000.5);\r
- fList->Add(fHistNumberOfAcceptedTracks);\r
-\r
- // Vertex distributions\r
- fHistVx = new TH1F("fHistVx","Primary vertex distribution - x coordinate;V_{x} (cm);Entries",100,-0.5,0.5);\r
- fList->Add(fHistVx);\r
- fHistVy = new TH1F("fHistVy","Primary vertex distribution - y coordinate;V_{y} (cm);Entries",100,-0.5,0.5);\r
- fList->Add(fHistVy);\r
- fHistVz = new TH1F("fHistVz","Primary vertex distribution - z coordinate;V_{z} (cm);Entries",100,-20.,20.);\r
- fList->Add(fHistVz);\r
-\r
- // QA histograms\r
- fHistClus = new TH2F("fHistClus","# Cluster (TPC vs. ITS)",10,0,10,200,0,200);\r
- fList->Add(fHistClus);\r
- fHistChi2 = new TH1F("fHistChi2","Chi2/NDF distribution",200,0,10);\r
- fList->Add(fHistChi2);\r
- fHistDCA = new TH2F("fHistDCA","DCA (xy vs. z)",400,-5,5,400,-5,5); \r
- fList->Add(fHistDCA);\r
- fHistPt = new TH1F("fHistPt","p_{T} distribution",200,0,10);\r
- fList->Add(fHistPt);\r
- fHistEta = new TH1F("fHistEta","#eta distribution",200,-2,2);\r
- fList->Add(fHistEta);\r
- fHistPhi = new TH1F("fHistPhi","#phi distribution",200,-20,380);\r
- fList->Add(fHistPhi);\r
- fHistPhiBefore = new TH1F("fHistPhiBefore","#phi distribution",200,0.,2*TMath::Pi());\r
- fList->Add(fHistPhiBefore);\r
- fHistPhiAfter = new TH1F("fHistPhiAfter","#phi distribution",200,0.,2*TMath::Pi());\r
- fList->Add(fHistPhiAfter);\r
- fHistV0M = new TH2F("fHistV0M","V0 Multiplicity C vs. A",500, 0, 20000, 500, 0, 20000);\r
- fList->Add(fHistV0M);\r
- TString gRefTrackName[6] = {"tracks","tracksPos","tracksNeg","tracksTPConly","clusITS0","clusITS1"};\r
- fHistRefTracks = new TH2F("fHistRefTracks","Nr of Ref tracks/event vs. ref track estimator;;Nr of tracks",6, 0, 6, 400, 0, 20000);\r
- for(Int_t i = 1; i <= 6; i++)\r
- fHistRefTracks->GetXaxis()->SetBinLabel(i,gRefTrackName[i-1].Data());\r
- fList->Add(fHistRefTracks);\r
-\r
- // Balance function histograms\r
- // Initialize histograms if not done yet\r
- if(!fBalance->GetHistNp(0)){\r
- AliWarning("Histograms not yet initialized! --> Will be done now");\r
- AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");\r
- fBalance->InitHistograms();\r
- }\r
-\r
- if(fRunShuffling) {\r
- if(!fShuffledBalance->GetHistNp(0)) {\r
- AliWarning("Histograms (shuffling) not yet initialized! --> Will be done now");\r
- AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");\r
- fShuffledBalance->InitHistograms();\r
- }\r
- }\r
-\r
- for(Int_t a = 0; a < ANALYSIS_TYPES; a++){\r
- fListEventMixingBF->Add(fBalance->GetHistNp(a));\r
- fListEventMixingBF->Add(fBalance->GetHistNn(a));\r
- fListEventMixingBF->Add(fBalance->GetHistNpn(a));\r
- fListEventMixingBF->Add(fBalance->GetHistNnn(a));\r
- fListEventMixingBF->Add(fBalance->GetHistNpp(a));\r
- fListEventMixingBF->Add(fBalance->GetHistNnp(a));\r
-\r
- if(fRunShuffling) {\r
- fListEventMixingBFS->Add(fShuffledBalance->GetHistNp(a));\r
- fListEventMixingBFS->Add(fShuffledBalance->GetHistNn(a));\r
- fListEventMixingBFS->Add(fShuffledBalance->GetHistNpn(a));\r
- fListEventMixingBFS->Add(fShuffledBalance->GetHistNnn(a));\r
- fListEventMixingBFS->Add(fShuffledBalance->GetHistNpp(a));\r
- fListEventMixingBFS->Add(fShuffledBalance->GetHistNnp(a));\r
- } \r
- }\r
-\r
- if(fESDtrackCuts) fList->Add(fESDtrackCuts);\r
-\r
- //====================PID========================//\r
- if(fUsePID) {\r
- fPIDCombined = new AliPIDCombined();\r
- fPIDCombined->SetDefaultTPCPriors();\r
-\r
- fHistdEdxVsPTPCbeforePID = new TH2D ("dEdxVsPTPCbefore","dEdxVsPTPCbefore", 1000, -10.0, 10.0, 1000, 0, 1000); \r
- fHistListPIDQA->Add(fHistdEdxVsPTPCbeforePID); //addition \r
- \r
- fHistBetavsPTOFbeforePID = new TH2D ("BetavsPTOFbefore","BetavsPTOFbefore", 1000, -10.0, 10., 1000, 0, 1.2); \r
- fHistListPIDQA->Add(fHistBetavsPTOFbeforePID); //addition\r
- \r
- fHistProbTPCvsPtbeforePID = new TH2D ("ProbTPCvsPtbefore","ProbTPCvsPtbefore", 1000, -10.0,10.0, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTPCvsPtbeforePID); //addition \r
- \r
- fHistProbTOFvsPtbeforePID = new TH2D ("ProbTOFvsPtbefore","ProbTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTOFvsPtbeforePID); //addition \r
-\r
- fHistProbTPCTOFvsPtbeforePID =new TH2D ("ProbTPCTOFvsPtbefore","ProbTPCTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTPCTOFvsPtbeforePID); //addition \r
- \r
- fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePID); //addition \r
- \r
- fHistNSigmaTOFvsPtbeforePID = new TH2D ("NSigmaTOFvsPtbefore","NSigmaTOFvsPtbefore", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTOFvsPtbeforePID); //addition \r
- \r
- fHistdEdxVsPTPCafterPID = new TH2D ("dEdxVsPTPCafter","dEdxVsPTPCafter", 1000, -10, 10, 1000, 0, 1000); \r
- fHistListPIDQA->Add(fHistdEdxVsPTPCafterPID); //addition \r
- \r
- fHistBetavsPTOFafterPID = new TH2D ("BetavsPTOFafter","BetavsPTOFafter", 1000, -10, 10, 1000, 0, 1.2); \r
- fHistListPIDQA->Add(fHistBetavsPTOFafterPID); //addition \r
- \r
- fHistProbTPCvsPtafterPID = new TH2D ("ProbTPCvsPtafter","ProbTPCvsPtafter", 1000, -10, 10, 1000, 0, 2); \r
- fHistListPIDQA->Add(fHistProbTPCvsPtafterPID); //addition \r
- \r
- fHistProbTOFvsPtafterPID = new TH2D ("ProbTOFvsPtafter","ProbTOFvsPtafter", 1000, -10, 10, 1000, 0, 2); \r
- fHistListPIDQA->Add(fHistProbTOFvsPtafterPID); //addition \r
- \r
- fHistProbTPCTOFvsPtafterPID =new TH2D ("ProbTPCTOFvsPtafter","ProbTPCTOFvsPtafter", 1000, -50, 50, 1000, 0, 2.0); \r
- fHistListPIDQA->Add(fHistProbTPCTOFvsPtafterPID); //addition \r
-\r
- fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPID); //addition \r
- \r
- fHistNSigmaTOFvsPtafterPID = new TH2D ("NSigmaTOFvsPtafter","NSigmaTOFvsPtafter", 1000, -10, 10, 1000, 0, 500); \r
- fHistListPIDQA->Add(fHistNSigmaTOFvsPtafterPID); //addition \r
- }\r
- //====================PID========================//\r
-\r
- // Post output data.\r
- PostData(1, fList);\r
- PostData(2, fListEventMixingBF);\r
- if(fRunShuffling) PostData(3, fListEventMixingBFS);\r
- if(fUsePID) PostData(4, fHistListPIDQA); //PID\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskEventMixingBF::UserExec(Option_t *) {\r
- // Main loop\r
- // Called for each event\r
- // NOTHING TO DO for event mixing!\r
-} \r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskEventMixingBF::FinishTaskOutput(){\r
- //Printf("END EventMixingBF");\r
-\r
- if (!fBalance) {\r
- AliError("ERROR: fBalance not available");\r
- return;\r
- } \r
- if(fRunShuffling) {\r
- if (!fShuffledBalance) {\r
- AliError("ERROR: fShuffledBalance not available");\r
- return;\r
- }\r
- }\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskEventMixingBF::Terminate(Option_t *) {\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
-\r
- // not implemented ...\r
-\r
-}\r
-\r
-void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)\r
-{\r
- // Main loop for event mixing\r
-\r
- TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
-\r
- AliMixInputEventHandler *mixIEH = SetupEventsForMixing();\r
-\r
- Float_t fCentrality = 0.;\r
-\r
- // for HBT like cuts need magnetic field sign\r
- Float_t bSign = 0; // only used in AOD so far\r
- \r
- // vector holding the charges/kinematics of all tracks (charge,y,eta,phi,p0,p1,p2,pt,E)\r
- vector<Double_t> *chargeVector[9]; // original charge\r
- for(Int_t i = 0; i < 9; i++){\r
- chargeVector[i] = new vector<Double_t>;\r
- }\r
- \r
- Double_t vCharge;\r
- Double_t vY;\r
- Double_t vEta;\r
- Double_t vPhi;\r
- Double_t vP[3];\r
- Double_t vPt;\r
- Double_t vE;\r
-\r
- Int_t iMainTrackUsed = -1;\r
-\r
- // ------------------------------------------------------------- \r
- // At the moment MIXING only for AODs\r
- if(mixIEH){\r
-\r
- //AOD analysis (vertex and track cuts also here!!!!)\r
- if(gAnalysisLevel == "AOD") {\r
- AliAODEvent* aodEventMain = dynamic_cast<AliAODEvent*>(fMainEvent); \r
- if(!aodEventMain) {\r
- AliError("ERROR: aodEventMain not available");\r
- return;\r
- }\r
- AliAODEvent *aodEventMix = dynamic_cast<AliAODEvent *>(fMixEvent); \r
- if(!aodEventMix) {\r
- AliError("ERROR: aodEventMix not available");\r
- return;\r
- }\r
-\r
- // for HBT like cuts need magnetic field sign\r
- bSign = (aodEventMain->GetMagneticField() > 0) ? 1 : -1;\r
- \r
- AliAODHeader *aodHeaderMain = aodEventMain->GetHeader(); \r
-\r
- // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
- fHistEventStats->Fill(1); //all events\r
-\r
- // this is not needed (checked in mixing handler!)\r
- Bool_t isSelectedMain = kTRUE;\r
- Bool_t isSelectedMix = kTRUE;\r
- \r
- if(fUseOfflineTrigger){\r
- isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
- isSelectedMix = ((AliInputEventHandler*)((AliMultiInputEventHandler *)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetFirstMultiInputHandler())->IsEventSelected();\r
- }\r
- \r
- if(isSelectedMain && isSelectedMix) {\r
- fHistEventStats->Fill(2); //triggered events\r
- \r
- //Centrality stuff (centrality in AOD header)\r
- if(fUseCentrality) {\r
- fCentrality = aodHeaderMain->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
- \r
- // QA for centrality estimators\r
- fHistCentStats->Fill(0.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0M"));\r
- fHistCentStats->Fill(1.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("FMD"));\r
- fHistCentStats->Fill(2.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TRK"));\r
- fHistCentStats->Fill(3.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKL"));\r
- fHistCentStats->Fill(4.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL0"));\r
- fHistCentStats->Fill(5.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL1"));\r
- fHistCentStats->Fill(6.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));\r
- fHistCentStats->Fill(7.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));\r
- fHistCentStats->Fill(8.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));\r
- \r
- // take only events inside centrality class\r
- if((fCentrality < fCentralityPercentileMin) || (fCentrality > fCentralityPercentileMax)) \r
- return;\r
- \r
- // centrality QA (V0M)\r
- fHistV0M->Fill(aodEventMain->GetVZEROData()->GetMTotV0A(), aodEventMain->GetVZEROData()->GetMTotV0C());\r
- \r
- // centrality QA (reference tracks)\r
- fHistRefTracks->Fill(0.,aodHeaderMain->GetRefMultiplicity());\r
- fHistRefTracks->Fill(1.,aodHeaderMain->GetRefMultiplicityPos());\r
- fHistRefTracks->Fill(2.,aodHeaderMain->GetRefMultiplicityNeg());\r
- fHistRefTracks->Fill(3.,aodHeaderMain->GetTPConlyRefMultiplicity());\r
- fHistRefTracks->Fill(4.,aodHeaderMain->GetNumberOfITSClusters(0));\r
- fHistRefTracks->Fill(5.,aodHeaderMain->GetNumberOfITSClusters(1));\r
- fHistRefTracks->Fill(6.,aodHeaderMain->GetNumberOfITSClusters(2));\r
- fHistRefTracks->Fill(7.,aodHeaderMain->GetNumberOfITSClusters(3));\r
- fHistRefTracks->Fill(8.,aodHeaderMain->GetNumberOfITSClusters(4));\r
- }\r
- \r
- // // this is crashing (Bug in ROOT (to be solved)) but not needed (checked in mixing handler)\r
- // const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();\r
- // const AliAODVertex *vertexMix = aodEventMix->GetPrimaryVertex();\r
- \r
- // if(vertexMain && vertexMix) {\r
- // Double32_t fCovMain[6];\r
- // Double32_t fCovMix[6];\r
- // vertexMain->GetCovarianceMatrix(fCovMain);\r
- // vertexMix->GetCovarianceMatrix(fCovMix);\r
- \r
- // if(vertexMain->GetNContributors() > 0 && vertexMix->GetNContributors() > 0) {\r
- // if(fCovMain[5] != 0 && fCovMix[5] != 0) {\r
- // fHistEventStats->Fill(3); //events with a proper vertex\r
- // if(TMath::Abs(vertexMain->GetX()) < fVxMax && TMath::Abs(vertexMix->GetX()) < fVxMax ) {\r
- // if(TMath::Abs(vertexMain->GetY()) < fVyMax && TMath::Abs(vertexMix->GetY()) < fVyMax) {\r
- // if(TMath::Abs(vertexMain->GetZ()) < fVzMax && TMath::Abs(vertexMix->GetZ()) < fVzMax) {\r
- // fHistEventStats->Fill(4); //analyzed events\r
- // fHistVx->Fill(vertexMain->GetX());\r
- // fHistVy->Fill(vertexMain->GetY());\r
- // fHistVz->Fill(vertexMain->GetZ());\r
-\r
- // Loop over tracks in main event\r
- for (Int_t iTracksMain = 0; iTracksMain < aodEventMain->GetNumberOfTracks(); iTracksMain++) {\r
- AliAODTrack* aodTrackMain = dynamic_cast<AliAODTrack *>(aodEventMain->GetTrack(iTracksMain));\r
- if (!aodTrackMain) {\r
- AliError(Form("ERROR: Could not receive track %d", iTracksMain));\r
- continue;\r
- }\r
- \r
- // AOD track cuts\r
- \r
- // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C\r
- // take only TPC only tracks \r
- fHistTrackStats->Fill(aodTrackMain->GetFilterMap());\r
- if(!aodTrackMain->TestFilterBit(nAODtrackCutBit)) continue;\r
- \r
- vCharge = aodTrackMain->Charge();\r
- vY = aodTrackMain->Y();\r
- vEta = aodTrackMain->Eta();\r
- vPhi = aodTrackMain->Phi() * TMath::RadToDeg();\r
- vE = aodTrackMain->E();\r
- vPt = aodTrackMain->Pt();\r
- aodTrackMain->PxPyPz(vP);\r
- \r
- Float_t dcaXYMain = aodTrackMain->DCA(); // this is the DCA from global track (not exactly what is cut on)\r
- Float_t dcaZMain = aodTrackMain->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)\r
- \r
- \r
- // Kinematics cuts from ESD track cuts\r
- if( vPt < fPtMin || vPt > fPtMax) continue;\r
- if( vEta < fEtaMin || vEta > fEtaMax) continue;\r
- \r
- // Extra DCA cuts (for systematic studies [!= -1])\r
- if( fDCAxyCut != -1 && fDCAzCut != -1){\r
- if(TMath::Sqrt((dcaXYMain*dcaXYMain)/(fDCAxyCut*fDCAxyCut)+(dcaZMain*dcaZMain)/(fDCAzCut*fDCAzCut)) > 1 ){\r
- continue; // 2D cut\r
- }\r
- }\r
- \r
- // Extra TPC cuts (for systematic studies [!= -1])\r
- if( fTPCchi2Cut != -1 && aodTrackMain->Chi2perNDF() > fTPCchi2Cut){\r
- continue;\r
- }\r
- if( fNClustersTPCCut != -1 && aodTrackMain->GetTPCNcls() < fNClustersTPCCut){\r
- continue;\r
- }\r
- \r
- // fill QA histograms\r
- fHistClus->Fill(aodTrackMain->GetITSNcls(),aodTrackMain->GetTPCNcls());\r
- fHistDCA->Fill(dcaZMain,dcaXYMain);\r
- fHistChi2->Fill(aodTrackMain->Chi2perNDF());\r
- fHistPt->Fill(vPt);\r
- fHistEta->Fill(vEta);\r
- fHistPhi->Fill(vPhi);\r
- \r
- // fill charge vector\r
- chargeVector[0]->push_back(vCharge);\r
- chargeVector[1]->push_back(vY);\r
- chargeVector[2]->push_back(vEta);\r
- chargeVector[3]->push_back(vPhi);\r
- chargeVector[4]->push_back(vP[0]);\r
- chargeVector[5]->push_back(vP[1]);\r
- chargeVector[6]->push_back(vP[2]);\r
- chargeVector[7]->push_back(vPt);\r
- chargeVector[8]->push_back(vE);\r
-\r
- // ------------------------------------------------------------- \r
- // for each track in main event loop over all tracks in mix event\r
- for (Int_t iTracksMix = 0; iTracksMix < aodEventMix->GetNumberOfTracks(); iTracksMix++) {\r
-\r
- AliAODTrack* aodTrackMix = dynamic_cast<AliAODTrack *>(aodEventMix->GetTrack(iTracksMix));\r
- if (!aodTrackMix) {\r
- AliError(Form("ERROR: Could not receive track %d", iTracksMix));\r
- continue;\r
- }\r
-\r
- // AOD track cuts\r
- \r
- // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C\r
- // take only TPC only tracks \r
- fHistTrackStats->Fill(aodTrackMix->GetFilterMap());\r
- if(!aodTrackMix->TestFilterBit(nAODtrackCutBit)) continue;\r
- \r
- vCharge = aodTrackMix->Charge();\r
- vY = aodTrackMix->Y();\r
- vEta = aodTrackMix->Eta();\r
- vPhi = aodTrackMix->Phi() * TMath::RadToDeg();\r
- vE = aodTrackMix->E();\r
- vPt = aodTrackMix->Pt();\r
- aodTrackMix->PxPyPz(vP);\r
- \r
- Float_t dcaXYMix = aodTrackMix->DCA(); // this is the DCA from global track (not exactly what is cut on)\r
- Float_t dcaZMix = aodTrackMix->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)\r
- \r
- \r
- // Kinematics cuts from ESD track cuts\r
- if( vPt < fPtMin || vPt > fPtMax) continue;\r
- if( vEta < fEtaMin || vEta > fEtaMax) continue;\r
- \r
- // Extra DCA cuts (for systematic studies [!= -1])\r
- if( fDCAxyCut != -1 && fDCAxyCut != -1){\r
- if(TMath::Sqrt((dcaXYMix*dcaXYMix)/(fDCAxyCut*fDCAxyCut)+(dcaZMix*dcaZMix)/(fDCAzCut*fDCAzCut)) > 1 ){\r
- continue; // 2D cut\r
- }\r
- }\r
- \r
- // Extra TPC cuts (for systematic studies [!= -1])\r
- if( fTPCchi2Cut != -1 && aodTrackMix->Chi2perNDF() > fTPCchi2Cut){\r
- continue;\r
- }\r
- if( fNClustersTPCCut != -1 && aodTrackMix->GetTPCNcls() < fNClustersTPCCut){\r
- continue;\r
- }\r
- \r
- // fill QA histograms\r
- fHistClus->Fill(aodTrackMix->GetITSNcls(),aodTrackMix->GetTPCNcls());\r
- fHistDCA->Fill(dcaZMix,dcaXYMix);\r
- fHistChi2->Fill(aodTrackMix->Chi2perNDF());\r
- fHistPt->Fill(vPt);\r
- fHistEta->Fill(vEta);\r
- fHistPhi->Fill(vPhi);\r
- \r
- // fill charge vector\r
- chargeVector[0]->push_back(vCharge);\r
- chargeVector[1]->push_back(vY);\r
- chargeVector[2]->push_back(vEta);\r
- chargeVector[3]->push_back(vPhi);\r
- chargeVector[4]->push_back(vP[0]);\r
- chargeVector[5]->push_back(vP[1]);\r
- chargeVector[6]->push_back(vP[2]);\r
- chargeVector[7]->push_back(vPt);\r
- chargeVector[8]->push_back(vE);\r
- \r
- \r
- \r
- } //mix track loop\r
-\r
- // calculate balance function for each track in main event\r
- iMainTrackUsed++; // is needed to do no double counting in Balance Function calculation \r
- if(iMainTrackUsed >= (Int_t)chargeVector[0]->size()) break; //do not allow more tracks than in mixed event!\r
- fBalance->CalculateBalance(fCentrality,chargeVector,iMainTrackUsed,bSign);\r
- // clean charge vector afterwards\r
- for(Int_t i = 0; i < 9; i++){ \r
- chargeVector[i]->clear();\r
- }\r
- \r
-\r
- } //main track loop\r
- // }//Vz cut\r
- // }//Vy cut\r
- // }//Vx cut\r
- // }//proper vertexresolution\r
- // }//proper number of contributors\r
- // }//vertex object valid\r
- }//triggered event \r
- }//AOD analysis\r
- }\r
-}\r
-\r
-AliMixInputEventHandler *AliAnalysisTaskEventMixingBF::SetupEventsForMixing() {\r
- //sets the input handlers for event mixing\r
-\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliMultiInputEventHandler *inEvHMain = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());\r
- if (inEvHMain) {\r
-\r
- AliMixInputEventHandler *mixEH = dynamic_cast<AliMixInputEventHandler *>(inEvHMain->GetFirstMultiInputHandler());\r
- if (!mixEH) return nullptr;\r
- if (mixEH->CurrentBinIndex() < 0) {\r
- AliDebug(AliLog::kDebug + 1, "Current event mixEH->CurrentEntry() == -1");\r
- return nullptr;\r
- }\r
- AliDebug(AliLog::kDebug, Form("Mixing %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->CurrentBinIndex(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->NumberMixed()));\r
-\r
- AliInputEventHandler *ihMainCurrent = inEvHMain->GetFirstInputEventHandler();\r
- fMainEvent = ihMainCurrent->GetEvent();\r
-\r
- AliMultiInputEventHandler *inEvHMixedCurrent = mixEH->GetFirstMultiInputHandler(); // for buffer = 1\r
- AliInputEventHandler *ihMixedCurrent = inEvHMixedCurrent->GetFirstInputEventHandler();\r
- fMixEvent = ihMixedCurrent->GetEvent();\r
- \r
- return mixEH;\r
- }\r
- return NULL;\r
-} \r
+#include "TChain.h"
+#include "TList.h"
+#include "TCanvas.h"
+#include "TLorentzVector.h"
+#include "TGraphErrors.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TArrayF.h"
+#include "TF1.h"
+#include "TRandom.h"
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisManager.h"
+
+#include "AliESDVertex.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliAODEvent.h"
+#include "AliAODTrack.h"
+#include "AliAODInputHandler.h"
+#include "AliGenEventHeader.h"
+#include "AliGenHijingEventHeader.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliMixInputEventHandler.h"
+#include "AliStack.h"
+#include "AliESDtrackCuts.h"
+
+#include "TH2D.h"
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliPIDCombined.h"
+
+#include "AliAnalysisTaskEventMixingBF.h"
+#include "AliBalanceEventMixing.h"
+
+
+// Analysis task for the EventMixingBF code
+// Authors: Panos.Christakoglou@nikhef.nl, m.weber@cern.ch
+
+ClassImp(AliAnalysisTaskEventMixingBF)
+
+//________________________________________________________________________
+AliAnalysisTaskEventMixingBF::AliAnalysisTaskEventMixingBF(const char *name)
+: AliAnalysisTaskSE(name),
+ fBalance(0),
+ fRunShuffling(kFALSE),
+ fShuffledBalance(0),
+ fList(0),
+ fListEventMixingBF(0),
+ fListEventMixingBFS(0),
+ fHistListPIDQA(0),
+ fHistEventStats(0),
+ fHistCentStats(0),
+ fHistTriggerStats(0),
+ fHistTrackStats(0),
+ fHistVx(0),
+ fHistVy(0),
+ fHistVz(0),
+ fHistClus(0),
+ fHistDCA(0),
+ fHistChi2(0),
+ fHistPt(0),
+ fHistEta(0),
+ fHistPhi(0),
+ fHistPhiBefore(0),
+ fHistPhiAfter(0),
+ fHistV0M(0),
+ fHistRefTracks(0),
+ fHistdEdxVsPTPCbeforePID(NULL),
+ fHistBetavsPTOFbeforePID(NULL),
+ fHistProbTPCvsPtbeforePID(NULL),
+ fHistProbTOFvsPtbeforePID(NULL),
+ fHistProbTPCTOFvsPtbeforePID(NULL),
+ fHistNSigmaTPCvsPtbeforePID(NULL),
+ fHistNSigmaTOFvsPtbeforePID(NULL),
+ fHistdEdxVsPTPCafterPID(NULL),
+ fHistBetavsPTOFafterPID(NULL),
+ fHistProbTPCvsPtafterPID(NULL),
+ fHistProbTOFvsPtafterPID(NULL),
+ fHistProbTPCTOFvsPtafterPID(NULL),
+ fHistNSigmaTPCvsPtafterPID(NULL),
+ fHistNSigmaTOFvsPtafterPID(NULL),
+ fPIDResponse(0x0),
+ fPIDCombined(0x0),
+ fParticleOfInterest(kPion),
+ fPidDetectorConfig(kTPCTOF),
+ fUsePID(kFALSE),
+ fUsePIDnSigma(kTRUE),
+ fUsePIDPropabilities(kFALSE),
+ fPIDNSigma(3.),
+ fMinAcceptedPIDProbability(0.8),
+ fESDtrackCuts(0),
+ fCentralityEstimator("V0M"),
+ fUseCentrality(kFALSE),
+ fCentralityPercentileMin(0.),
+ fCentralityPercentileMax(5.),
+ fImpactParameterMin(0.),
+ fImpactParameterMax(20.),
+ fUseMultiplicity(kFALSE),
+ fNumberOfAcceptedTracksMin(0),
+ fNumberOfAcceptedTracksMax(10000),
+ fHistNumberOfAcceptedTracks(0),
+ fUseOfflineTrigger(kFALSE),
+ fVxMax(0.3),
+ fVyMax(0.3),
+ fVzMax(10.),
+ nAODtrackCutBit(128),
+ fPtMin(0.3),
+ fPtMax(1.5),
+ fEtaMin(-0.8),
+ fEtaMax(-0.8),
+ fDCAxyCut(-1),
+ fDCAzCut(-1),
+ fTPCchi2Cut(-1),
+ fNClustersTPCCut(-1),
+ fAcceptanceParameterization(0),
+ fDifferentialV2(0),
+ fUseFlowAfterBurner(kFALSE),
+ fExcludeResonancesInMC(kFALSE),
+ fUseMCPdgCode(kFALSE),
+ fPDGCodeToBeAnalyzed(-1),
+ fMainEvent(0x0),
+ fMixEvent(0x0)
+{
+ // Constructor
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TH1 container
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, TList::Class());
+ DefineOutput(3, TList::Class());
+ DefineOutput(4, TList::Class());
+}
+
+//________________________________________________________________________
+AliAnalysisTaskEventMixingBF::~AliAnalysisTaskEventMixingBF() {
+
+ // delete fBalance;
+ // delete fShuffledBalance;
+ // delete fList;
+ // delete fListEventMixingBF;
+ // delete fListEventMixingBFS;
+
+ // delete fHistEventStats;
+ // delete fHistTrackStats;
+ // delete fHistVx;
+ // delete fHistVy;
+ // delete fHistVz;
+
+ // delete fHistClus;
+ // delete fHistDCA;
+ // delete fHistChi2;
+ // delete fHistPt;
+ // delete fHistEta;
+ // delete fHistPhi;
+ // delete fHistV0M;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEventMixingBF::UserCreateOutputObjects() {
+ // Create histograms
+ // Called once
+ if(!fBalance) {
+ fBalance = new AliBalanceEventMixing();
+ fBalance->SetAnalysisLevel("ESD");
+ //fBalance->SetNumberOfBins(-1,16);
+ fBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6);
+ }
+ if(fRunShuffling) {
+ if(!fShuffledBalance) {
+ fShuffledBalance = new AliBalanceEventMixing();
+ fShuffledBalance->SetAnalysisLevel("ESD");
+ //fShuffledBalance->SetNumberOfBins(-1,16);
+ fShuffledBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6);
+ }
+ }
+
+ //QA list
+ fList = new TList();
+ fList->SetName("listQA");
+ fList->SetOwner();
+
+ //Balance Function list
+ fListEventMixingBF = new TList();
+ fListEventMixingBF->SetName("listEventMixingBF");
+ fListEventMixingBF->SetOwner();
+
+ if(fRunShuffling) {
+ fListEventMixingBFS = new TList();
+ fListEventMixingBFS->SetName("listEventMixingBFShuffled");
+ fListEventMixingBFS->SetOwner();
+ }
+
+ //PID QA list
+ if(fUsePID) {
+ fHistListPIDQA = new TList();
+ fHistListPIDQA->SetName("listQAPID");
+ fHistListPIDQA->SetOwner();
+ }
+
+ //Event stats.
+ TString gCutName[4] = {"Total","Offline trigger",
+ "Vertex","Analyzed"};
+ fHistEventStats = new TH1F("fHistEventStats",
+ "Event statistics;;N_{events}",
+ 4,0.5,4.5);
+ for(Int_t i = 1; i <= 4; i++)
+ fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1].Data());
+ fList->Add(fHistEventStats);
+
+ TString gCentName[9] = {"V0M","FMD","TRK","TKL","CL0","CL1","V0MvsFMD","TKLvsV0M","ZEMvsZDC"};
+ fHistCentStats = new TH2F("fHistCentStats",
+ "Centrality statistics;;Cent percentile",
+ 9,-0.5,8.5,220,-5,105);
+ for(Int_t i = 1; i <= 9; i++)
+ fHistCentStats->GetXaxis()->SetBinLabel(i,gCentName[i-1].Data());
+ fList->Add(fHistCentStats);
+
+ fHistTriggerStats = new TH1F("fHistTriggerStats","Trigger statistics;TriggerBit;N_{events}",130,0,130);
+ fList->Add(fHistTriggerStats);
+
+ fHistTrackStats = new TH1F("fHistTrackStats","Event statistics;TrackFilterBit;N_{events}",130,0,130);
+ fList->Add(fHistTrackStats);
+
+ fHistNumberOfAcceptedTracks = new TH1F("fHistNumberOfAcceptedTracks",";N_{acc.};Entries",4001,-0.5,4000.5);
+ fList->Add(fHistNumberOfAcceptedTracks);
+
+ // Vertex distributions
+ fHistVx = new TH1F("fHistVx","Primary vertex distribution - x coordinate;V_{x} (cm);Entries",100,-0.5,0.5);
+ fList->Add(fHistVx);
+ fHistVy = new TH1F("fHistVy","Primary vertex distribution - y coordinate;V_{y} (cm);Entries",100,-0.5,0.5);
+ fList->Add(fHistVy);
+ fHistVz = new TH1F("fHistVz","Primary vertex distribution - z coordinate;V_{z} (cm);Entries",100,-20.,20.);
+ fList->Add(fHistVz);
+
+ // QA histograms
+ fHistClus = new TH2F("fHistClus","# Cluster (TPC vs. ITS)",10,0,10,200,0,200);
+ fList->Add(fHistClus);
+ fHistChi2 = new TH1F("fHistChi2","Chi2/NDF distribution",200,0,10);
+ fList->Add(fHistChi2);
+ fHistDCA = new TH2F("fHistDCA","DCA (xy vs. z)",400,-5,5,400,-5,5);
+ fList->Add(fHistDCA);
+ fHistPt = new TH1F("fHistPt","p_{T} distribution",200,0,10);
+ fList->Add(fHistPt);
+ fHistEta = new TH1F("fHistEta","#eta distribution",200,-2,2);
+ fList->Add(fHistEta);
+ fHistPhi = new TH1F("fHistPhi","#phi distribution",200,-20,380);
+ fList->Add(fHistPhi);
+ fHistPhiBefore = new TH1F("fHistPhiBefore","#phi distribution",200,0.,2*TMath::Pi());
+ fList->Add(fHistPhiBefore);
+ fHistPhiAfter = new TH1F("fHistPhiAfter","#phi distribution",200,0.,2*TMath::Pi());
+ fList->Add(fHistPhiAfter);
+ fHistV0M = new TH2F("fHistV0M","V0 Multiplicity C vs. A",500, 0, 20000, 500, 0, 20000);
+ fList->Add(fHistV0M);
+ TString gRefTrackName[6] = {"tracks","tracksPos","tracksNeg","tracksTPConly","clusITS0","clusITS1"};
+ fHistRefTracks = new TH2F("fHistRefTracks","Nr of Ref tracks/event vs. ref track estimator;;Nr of tracks",6, 0, 6, 400, 0, 20000);
+ for(Int_t i = 1; i <= 6; i++)
+ fHistRefTracks->GetXaxis()->SetBinLabel(i,gRefTrackName[i-1].Data());
+ fList->Add(fHistRefTracks);
+
+ // Balance function histograms
+ // Initialize histograms if not done yet
+ if(!fBalance->GetHistNp(0)){
+ AliWarning("Histograms not yet initialized! --> Will be done now");
+ AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");
+ fBalance->InitHistograms();
+ }
+
+ if(fRunShuffling) {
+ if(!fShuffledBalance->GetHistNp(0)) {
+ AliWarning("Histograms (shuffling) not yet initialized! --> Will be done now");
+ AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");
+ fShuffledBalance->InitHistograms();
+ }
+ }
+
+ for(Int_t a = 0; a < ANALYSIS_TYPES; a++){
+ fListEventMixingBF->Add(fBalance->GetHistNp(a));
+ fListEventMixingBF->Add(fBalance->GetHistNn(a));
+ fListEventMixingBF->Add(fBalance->GetHistNpn(a));
+ fListEventMixingBF->Add(fBalance->GetHistNnn(a));
+ fListEventMixingBF->Add(fBalance->GetHistNpp(a));
+ fListEventMixingBF->Add(fBalance->GetHistNnp(a));
+
+ if(fRunShuffling) {
+ fListEventMixingBFS->Add(fShuffledBalance->GetHistNp(a));
+ fListEventMixingBFS->Add(fShuffledBalance->GetHistNn(a));
+ fListEventMixingBFS->Add(fShuffledBalance->GetHistNpn(a));
+ fListEventMixingBFS->Add(fShuffledBalance->GetHistNnn(a));
+ fListEventMixingBFS->Add(fShuffledBalance->GetHistNpp(a));
+ fListEventMixingBFS->Add(fShuffledBalance->GetHistNnp(a));
+ }
+ }
+
+ if(fESDtrackCuts) fList->Add(fESDtrackCuts);
+
+ //====================PID========================//
+ if(fUsePID) {
+ fPIDCombined = new AliPIDCombined();
+ fPIDCombined->SetDefaultTPCPriors();
+
+ fHistdEdxVsPTPCbeforePID = new TH2D ("dEdxVsPTPCbefore","dEdxVsPTPCbefore", 1000, -10.0, 10.0, 1000, 0, 1000);
+ fHistListPIDQA->Add(fHistdEdxVsPTPCbeforePID); //addition
+
+ fHistBetavsPTOFbeforePID = new TH2D ("BetavsPTOFbefore","BetavsPTOFbefore", 1000, -10.0, 10., 1000, 0, 1.2);
+ fHistListPIDQA->Add(fHistBetavsPTOFbeforePID); //addition
+
+ fHistProbTPCvsPtbeforePID = new TH2D ("ProbTPCvsPtbefore","ProbTPCvsPtbefore", 1000, -10.0,10.0, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTPCvsPtbeforePID); //addition
+
+ fHistProbTOFvsPtbeforePID = new TH2D ("ProbTOFvsPtbefore","ProbTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTOFvsPtbeforePID); //addition
+
+ fHistProbTPCTOFvsPtbeforePID =new TH2D ("ProbTPCTOFvsPtbefore","ProbTPCTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTPCTOFvsPtbeforePID); //addition
+
+ fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePID); //addition
+
+ fHistNSigmaTOFvsPtbeforePID = new TH2D ("NSigmaTOFvsPtbefore","NSigmaTOFvsPtbefore", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTOFvsPtbeforePID); //addition
+
+ fHistdEdxVsPTPCafterPID = new TH2D ("dEdxVsPTPCafter","dEdxVsPTPCafter", 1000, -10, 10, 1000, 0, 1000);
+ fHistListPIDQA->Add(fHistdEdxVsPTPCafterPID); //addition
+
+ fHistBetavsPTOFafterPID = new TH2D ("BetavsPTOFafter","BetavsPTOFafter", 1000, -10, 10, 1000, 0, 1.2);
+ fHistListPIDQA->Add(fHistBetavsPTOFafterPID); //addition
+
+ fHistProbTPCvsPtafterPID = new TH2D ("ProbTPCvsPtafter","ProbTPCvsPtafter", 1000, -10, 10, 1000, 0, 2);
+ fHistListPIDQA->Add(fHistProbTPCvsPtafterPID); //addition
+
+ fHistProbTOFvsPtafterPID = new TH2D ("ProbTOFvsPtafter","ProbTOFvsPtafter", 1000, -10, 10, 1000, 0, 2);
+ fHistListPIDQA->Add(fHistProbTOFvsPtafterPID); //addition
+
+ fHistProbTPCTOFvsPtafterPID =new TH2D ("ProbTPCTOFvsPtafter","ProbTPCTOFvsPtafter", 1000, -50, 50, 1000, 0, 2.0);
+ fHistListPIDQA->Add(fHistProbTPCTOFvsPtafterPID); //addition
+
+ fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPID); //addition
+
+ fHistNSigmaTOFvsPtafterPID = new TH2D ("NSigmaTOFvsPtafter","NSigmaTOFvsPtafter", 1000, -10, 10, 1000, 0, 500);
+ fHistListPIDQA->Add(fHistNSigmaTOFvsPtafterPID); //addition
+ }
+ //====================PID========================//
+
+ // Post output data.
+ PostData(1, fList);
+ PostData(2, fListEventMixingBF);
+ if(fRunShuffling) PostData(3, fListEventMixingBFS);
+ if(fUsePID) PostData(4, fHistListPIDQA); //PID
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEventMixingBF::UserExec(Option_t *) {
+ // Main loop
+ // Called for each event
+ // NOTHING TO DO for event mixing!
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEventMixingBF::FinishTaskOutput(){
+ //Printf("END EventMixingBF");
+
+ if (!fBalance) {
+ AliError("ERROR: fBalance not available");
+ return;
+ }
+ if(fRunShuffling) {
+ if (!fShuffledBalance) {
+ AliError("ERROR: fShuffledBalance not available");
+ return;
+ }
+ }
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEventMixingBF::Terminate(Option_t *) {
+ // Draw result to the screen
+ // Called once at the end of the query
+
+ // not implemented ...
+
+}
+
+void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
+{
+ // Main loop for event mixing
+
+ TString gAnalysisLevel = fBalance->GetAnalysisLevel();
+
+ AliMixInputEventHandler *mixIEH = SetupEventsForMixing();
+
+ Float_t fCentrality = 0.;
+
+ // for HBT like cuts need magnetic field sign
+ Float_t bSign = 0; // only used in AOD so far
+
+ // vector holding the charges/kinematics of all tracks (charge,y,eta,phi,p0,p1,p2,pt,E)
+ vector<Double_t> *chargeVector[9]; // original charge
+ for(Int_t i = 0; i < 9; i++){
+ chargeVector[i] = new vector<Double_t>;
+ }
+
+ Double_t vCharge;
+ Double_t vY;
+ Double_t vEta;
+ Double_t vPhi;
+ Double_t vP[3];
+ Double_t vPt;
+ Double_t vE;
+
+ Int_t iMainTrackUsed = -1;
+
+ // -------------------------------------------------------------
+ // At the moment MIXING only for AODs
+ if(mixIEH){
+
+ //AOD analysis (vertex and track cuts also here!!!!)
+ if(gAnalysisLevel == "AOD") {
+ AliAODEvent* aodEventMain = dynamic_cast<AliAODEvent*>(fMainEvent);
+ if(!aodEventMain) {
+ AliError("ERROR: aodEventMain not available");
+ return;
+ }
+ AliAODEvent *aodEventMix = dynamic_cast<AliAODEvent *>(fMixEvent);
+ if(!aodEventMix) {
+ AliError("ERROR: aodEventMix not available");
+ return;
+ }
+
+ // for HBT like cuts need magnetic field sign
+ bSign = (aodEventMain->GetMagneticField() > 0) ? 1 : -1;
+
+ AliAODHeader *aodHeaderMain = aodEventMain->GetHeader();
+
+ // event selection done in AliAnalysisTaskSE::Exec() --> this is not used
+ fHistEventStats->Fill(1); //all events
+
+ // this is not needed (checked in mixing handler!)
+ Bool_t isSelectedMain = kTRUE;
+ Bool_t isSelectedMix = kTRUE;
+
+ if(fUseOfflineTrigger){
+ isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+ isSelectedMix = ((AliInputEventHandler*)((AliMultiInputEventHandler *)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetFirstMultiInputHandler())->IsEventSelected();
+ }
+
+ if(isSelectedMain && isSelectedMix) {
+ fHistEventStats->Fill(2); //triggered events
+
+ //Centrality stuff (centrality in AOD header)
+ if(fUseCentrality) {
+ fCentrality = aodHeaderMain->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());
+
+ // QA for centrality estimators
+ fHistCentStats->Fill(0.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0M"));
+ fHistCentStats->Fill(1.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("FMD"));
+ fHistCentStats->Fill(2.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TRK"));
+ fHistCentStats->Fill(3.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKL"));
+ fHistCentStats->Fill(4.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL0"));
+ fHistCentStats->Fill(5.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL1"));
+ fHistCentStats->Fill(6.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));
+ fHistCentStats->Fill(7.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));
+ fHistCentStats->Fill(8.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));
+
+ // take only events inside centrality class
+ if((fCentrality < fCentralityPercentileMin) || (fCentrality > fCentralityPercentileMax))
+ return;
+
+ // centrality QA (V0M)
+ fHistV0M->Fill(aodEventMain->GetVZEROData()->GetMTotV0A(), aodEventMain->GetVZEROData()->GetMTotV0C());
+
+ // centrality QA (reference tracks)
+ fHistRefTracks->Fill(0.,aodHeaderMain->GetRefMultiplicity());
+ fHistRefTracks->Fill(1.,aodHeaderMain->GetRefMultiplicityPos());
+ fHistRefTracks->Fill(2.,aodHeaderMain->GetRefMultiplicityNeg());
+ fHistRefTracks->Fill(3.,aodHeaderMain->GetTPConlyRefMultiplicity());
+ fHistRefTracks->Fill(4.,aodHeaderMain->GetNumberOfITSClusters(0));
+ fHistRefTracks->Fill(5.,aodHeaderMain->GetNumberOfITSClusters(1));
+ fHistRefTracks->Fill(6.,aodHeaderMain->GetNumberOfITSClusters(2));
+ fHistRefTracks->Fill(7.,aodHeaderMain->GetNumberOfITSClusters(3));
+ fHistRefTracks->Fill(8.,aodHeaderMain->GetNumberOfITSClusters(4));
+ }
+
+ // // this is crashing (Bug in ROOT (to be solved)) but not needed (checked in mixing handler)
+ // const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();
+ // const AliAODVertex *vertexMix = aodEventMix->GetPrimaryVertex();
+
+ // if(vertexMain && vertexMix) {
+ // Double32_t fCovMain[6];
+ // Double32_t fCovMix[6];
+ // vertexMain->GetCovarianceMatrix(fCovMain);
+ // vertexMix->GetCovarianceMatrix(fCovMix);
+
+ // if(vertexMain->GetNContributors() > 0 && vertexMix->GetNContributors() > 0) {
+ // if(fCovMain[5] != 0 && fCovMix[5] != 0) {
+ // fHistEventStats->Fill(3); //events with a proper vertex
+ // if(TMath::Abs(vertexMain->GetX()) < fVxMax && TMath::Abs(vertexMix->GetX()) < fVxMax ) {
+ // if(TMath::Abs(vertexMain->GetY()) < fVyMax && TMath::Abs(vertexMix->GetY()) < fVyMax) {
+ // if(TMath::Abs(vertexMain->GetZ()) < fVzMax && TMath::Abs(vertexMix->GetZ()) < fVzMax) {
+ // fHistEventStats->Fill(4); //analyzed events
+ // fHistVx->Fill(vertexMain->GetX());
+ // fHistVy->Fill(vertexMain->GetY());
+ // fHistVz->Fill(vertexMain->GetZ());
+
+ // Loop over tracks in main event
+ for (Int_t iTracksMain = 0; iTracksMain < aodEventMain->GetNumberOfTracks(); iTracksMain++) {
+ AliAODTrack* aodTrackMain = dynamic_cast<AliAODTrack *>(aodEventMain->GetTrack(iTracksMain));
+ if (!aodTrackMain) {
+ AliError(Form("ERROR: Could not receive track %d", iTracksMain));
+ continue;
+ }
+
+ // AOD track cuts
+
+ // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C
+ // take only TPC only tracks
+ fHistTrackStats->Fill(aodTrackMain->GetFilterMap());
+ if(!aodTrackMain->TestFilterBit(nAODtrackCutBit)) continue;
+
+ vCharge = aodTrackMain->Charge();
+ vY = aodTrackMain->Y();
+ vEta = aodTrackMain->Eta();
+ vPhi = aodTrackMain->Phi() * TMath::RadToDeg();
+ vE = aodTrackMain->E();
+ vPt = aodTrackMain->Pt();
+ aodTrackMain->PxPyPz(vP);
+
+ Float_t dcaXYMain = aodTrackMain->DCA(); // this is the DCA from global track (not exactly what is cut on)
+ Float_t dcaZMain = aodTrackMain->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)
+
+
+ // Kinematics cuts from ESD track cuts
+ if( vPt < fPtMin || vPt > fPtMax) continue;
+ if( vEta < fEtaMin || vEta > fEtaMax) continue;
+
+ // Extra DCA cuts (for systematic studies [!= -1])
+ if( fDCAxyCut != -1 && fDCAzCut != -1){
+ if(TMath::Sqrt((dcaXYMain*dcaXYMain)/(fDCAxyCut*fDCAxyCut)+(dcaZMain*dcaZMain)/(fDCAzCut*fDCAzCut)) > 1 ){
+ continue; // 2D cut
+ }
+ }
+
+ // Extra TPC cuts (for systematic studies [!= -1])
+ if( fTPCchi2Cut != -1 && aodTrackMain->Chi2perNDF() > fTPCchi2Cut){
+ continue;
+ }
+ if( fNClustersTPCCut != -1 && aodTrackMain->GetTPCNcls() < fNClustersTPCCut){
+ continue;
+ }
+
+ // fill QA histograms
+ fHistClus->Fill(aodTrackMain->GetITSNcls(),aodTrackMain->GetTPCNcls());
+ fHistDCA->Fill(dcaZMain,dcaXYMain);
+ fHistChi2->Fill(aodTrackMain->Chi2perNDF());
+ fHistPt->Fill(vPt);
+ fHistEta->Fill(vEta);
+ fHistPhi->Fill(vPhi);
+
+ // fill charge vector
+ chargeVector[0]->push_back(vCharge);
+ chargeVector[1]->push_back(vY);
+ chargeVector[2]->push_back(vEta);
+ chargeVector[3]->push_back(vPhi);
+ chargeVector[4]->push_back(vP[0]);
+ chargeVector[5]->push_back(vP[1]);
+ chargeVector[6]->push_back(vP[2]);
+ chargeVector[7]->push_back(vPt);
+ chargeVector[8]->push_back(vE);
+
+ // -------------------------------------------------------------
+ // for each track in main event loop over all tracks in mix event
+ for (Int_t iTracksMix = 0; iTracksMix < aodEventMix->GetNumberOfTracks(); iTracksMix++) {
+
+ AliAODTrack* aodTrackMix = dynamic_cast<AliAODTrack *>(aodEventMix->GetTrack(iTracksMix));
+ if (!aodTrackMix) {
+ AliError(Form("ERROR: Could not receive track %d", iTracksMix));
+ continue;
+ }
+
+ // AOD track cuts
+
+ // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C
+ // take only TPC only tracks
+ fHistTrackStats->Fill(aodTrackMix->GetFilterMap());
+ if(!aodTrackMix->TestFilterBit(nAODtrackCutBit)) continue;
+
+ vCharge = aodTrackMix->Charge();
+ vY = aodTrackMix->Y();
+ vEta = aodTrackMix->Eta();
+ vPhi = aodTrackMix->Phi() * TMath::RadToDeg();
+ vE = aodTrackMix->E();
+ vPt = aodTrackMix->Pt();
+ aodTrackMix->PxPyPz(vP);
+
+ Float_t dcaXYMix = aodTrackMix->DCA(); // this is the DCA from global track (not exactly what is cut on)
+ Float_t dcaZMix = aodTrackMix->ZAtDCA(); // this is the DCA from global track (not exactly what is cut on)
+
+
+ // Kinematics cuts from ESD track cuts
+ if( vPt < fPtMin || vPt > fPtMax) continue;
+ if( vEta < fEtaMin || vEta > fEtaMax) continue;
+
+ // Extra DCA cuts (for systematic studies [!= -1])
+ if( fDCAxyCut != -1 && fDCAxyCut != -1){
+ if(TMath::Sqrt((dcaXYMix*dcaXYMix)/(fDCAxyCut*fDCAxyCut)+(dcaZMix*dcaZMix)/(fDCAzCut*fDCAzCut)) > 1 ){
+ continue; // 2D cut
+ }
+ }
+
+ // Extra TPC cuts (for systematic studies [!= -1])
+ if( fTPCchi2Cut != -1 && aodTrackMix->Chi2perNDF() > fTPCchi2Cut){
+ continue;
+ }
+ if( fNClustersTPCCut != -1 && aodTrackMix->GetTPCNcls() < fNClustersTPCCut){
+ continue;
+ }
+
+ // fill QA histograms
+ fHistClus->Fill(aodTrackMix->GetITSNcls(),aodTrackMix->GetTPCNcls());
+ fHistDCA->Fill(dcaZMix,dcaXYMix);
+ fHistChi2->Fill(aodTrackMix->Chi2perNDF());
+ fHistPt->Fill(vPt);
+ fHistEta->Fill(vEta);
+ fHistPhi->Fill(vPhi);
+
+ // fill charge vector
+ chargeVector[0]->push_back(vCharge);
+ chargeVector[1]->push_back(vY);
+ chargeVector[2]->push_back(vEta);
+ chargeVector[3]->push_back(vPhi);
+ chargeVector[4]->push_back(vP[0]);
+ chargeVector[5]->push_back(vP[1]);
+ chargeVector[6]->push_back(vP[2]);
+ chargeVector[7]->push_back(vPt);
+ chargeVector[8]->push_back(vE);
+
+
+
+ } //mix track loop
+
+ // calculate balance function for each track in main event
+ iMainTrackUsed++; // is needed to do no double counting in Balance Function calculation
+ if(iMainTrackUsed >= (Int_t)chargeVector[0]->size()) break; //do not allow more tracks than in mixed event!
+ fBalance->CalculateBalance(fCentrality,chargeVector,iMainTrackUsed,bSign);
+ // clean charge vector afterwards
+ for(Int_t i = 0; i < 9; i++){
+ chargeVector[i]->clear();
+ }
+
+
+ } //main track loop
+ // }//Vz cut
+ // }//Vy cut
+ // }//Vx cut
+ // }//proper vertexresolution
+ // }//proper number of contributors
+ // }//vertex object valid
+ }//triggered event
+ }//AOD analysis
+ }
+}
+
+AliMixInputEventHandler *AliAnalysisTaskEventMixingBF::SetupEventsForMixing() {
+ //sets the input handlers for event mixing
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliMultiInputEventHandler *inEvHMain = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
+ if (inEvHMain) {
+
+ AliMixInputEventHandler *mixEH = dynamic_cast<AliMixInputEventHandler *>(inEvHMain->GetFirstMultiInputHandler());
+ if (!mixEH) return nullptr;
+ if (mixEH->CurrentBinIndex() < 0) {
+ AliDebug(AliLog::kDebug + 1, "Current event mixEH->CurrentEntry() == -1");
+ return nullptr;
+ }
+ AliDebug(AliLog::kDebug, Form("Mixing %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->CurrentBinIndex(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->NumberMixed()));
+
+ AliInputEventHandler *ihMainCurrent = inEvHMain->GetFirstInputEventHandler();
+ fMainEvent = ihMainCurrent->GetEvent();
+
+ AliMultiInputEventHandler *inEvHMixedCurrent = mixEH->GetFirstMultiInputHandler(); // for buffer = 1
+ AliInputEventHandler *ihMixedCurrent = inEvHMixedCurrent->GetFirstInputEventHandler();
+ fMixEvent = ihMixedCurrent->GetEvent();
+
+ return mixEH;
+ }
+ return NULL;
+}
-#ifndef AliAnalysisTaskLRC_H\r
-#define AliAnalysisTaskLRC_H\r
-\r
-// Analysis task for Long Range Correlation (LRC) analysis using TPC data\r
-// This includes a TList of AliLRCProcess objects that are processing LRC analysis\r
-// for a given eta-phi windows\r
-\r
-// Author : Andrey Ivanov, Igor Altsybeev, St.Peterburg State University\r
-// Email: Igor.Altsybeev.ch\r
-\r
-\r
-#include <AliPIDResponse.h>\r
-#include <AliPIDCombined.h>\r
-#include <AliAnalysisTaskSE.h>\r
-\r
-//#define kNumberOfParentParticleClassesInMC 8\r
-\r
-//class AliLRCProcess;\r
-class AliLRCBase;\r
-class AliESDtrackCuts;\r
-class TH1D;\r
-class TH2D;\r
-class TH1I;\r
-class TRandom3;\r
-class TParticle;\r
-//class AliSimpleEvent;\r
-class TTree;\r
-\r
-class TStopwatch;\r
-//enum en_AnalysisType\r
-//{\r
-// en_AnalysisType_ESD = 0,\r
-// en_AnalysisType_AOD\r
-\r
-//};\r
-\r
-class AliAnalysisTaskLRC : public AliAnalysisTaskSE {\r
-\r
-public:\r
- //Constructors\r
- AliAnalysisTaskLRC( const char *name = "AliAnalysisTaskLRC", Bool_t runKine = kFALSE );\r
- virtual ~AliAnalysisTaskLRC() {}\r
-\r
- //AliAnalysisTaskSE overloading\r
-\r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- // virtual void UserExecLoop( Double_t phiAdditional = 0 );//Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- //----------------------------------\r
-\r
- void AddLRCProcess(AliLRCBase *newProc); //Adds new AliLRCProcess to analysis task\r
-\r
- // Setters\r
- void SetMinNumberOfSPDtracklets( Int_t MinSPDtracklets ); //Sets min number of SPD tracklets\r
- void SetMaxPtLimit(Double_t MaxPtLimit); //Sets Max Pt filter\r
- void SetMinPtLimit(Double_t MinPtLimit); //Sets Min Pt filter\r
- void SetKineLowPtCut(Double_t MinKineParticlePtLimit); //Sets Min Pt filter for kine particles\r
- void SetCheckForkVtx(Bool_t CheckForkVtx){fCheckForkVtx=CheckForkVtx;} // Accept only events with veretex\r
- void SetCheckForVtxPosition(Bool_t CheckForVtxPosition ){fCheckForVtxPosition=CheckForVtxPosition;} //Accept only events with veretex in slected range\r
- void SetTrackCuts(AliESDtrackCuts* const cuts) { fEsdTrackCuts = cuts; }\r
- void SetAODtrackCutBit(UInt_t bit){ fAODtrackCutBit = bit; } //AOD track cut bit\r
- void SetShowEventStats(Bool_t ShowEventStats) {fShowEventStats= ShowEventStats;}\r
- void SetShowPerTrackStats(Bool_t ShowPerTrackStats) {fShowPerTrackStats=ShowPerTrackStats;}\r
- void SetVtxDiamond(Double_t Vx, Double_t Vy, Double_t Vz) {fVxMax = Vx;fVyMax =Vy;fVzMax = Vz;}\r
- void SetNchCuts(Int_t minNch, Int_t maxNch){fMinAcceptedTracksCut=minNch; fMaxAcceptedTracksCut=maxNch;}\r
-\r
- void SetNumberOfPhiSectors(Int_t nSectors){ fNumberOfPhiSectors = nSectors; }//fNeedToRotateSector = kTRUE; }\r
- void SetCentralityClass(Float_t minCentralityClass, Float_t maxCentralityClass ){ fMinCentralityClass = minCentralityClass; fMaxCentralityClass = maxCentralityClass; }\r
- \r
- void SetIonsAnalysis(Bool_t isIonsFlag ){ fIsIonsAnalysis = isIonsFlag; }\r
- void SetEtAnalysis(Bool_t isEtAnalysisFlag ){ fEtInsteadOfPt = isEtAnalysisFlag; }\r
- void SetUsePhiShufflingByHand(Bool_t usePhiShufflingByHand ){ fUsePhiShufflingByHand = usePhiShufflingByHand; }\r
- void SetUseToyEvents(Bool_t useToyEvents ){ fUseToyEvents = useToyEvents; }\r
- void SetNumberOfToyEvents(Int_t nEvents ){ fNumberOfToyEvents = nEvents; }\r
- void SetArtificialInefficiencyCoeff( Double_t artificialInefficiencyCoeff ) { fArtificialInefficiency = artificialInefficiencyCoeff; } //Sets coeff for artificial inefficiency\r
-\r
- //void SetNumberOfPhiSectorsByHand( Int_t numberOfPhiSectorsByHand ) { fNumberOfPhiSectorsByHand = numberOfPhiSectorsByHand; }\r
-\r
- // Getters\r
- TList* GetListOfProcessors() { return &fLRCproc;} // Returns list of included\r
- AliESDtrackCuts* GetTrackCuts() const { return fEsdTrackCuts; }\r
- AliLRCBase * Proc(Int_t index);// Get Processor i\r
-\r
- void SetParticleTypeForTask( TString strF, TString strB ); //( char* strF, char* strB );\r
- // void SetMCparticleClassForFillingLRC( TString strParticleType ) { fStrMCparticleClassForFillingLRC = strParticleType; }\r
- // void SetEtaCutsForSpecMCanalysis( double etaMin, double etaMax ) { fEtaMCanalysisCutMin = etaMin; fEtaMCanalysisCutMax = etaMax; }\r
-\r
- void SetV0ACMultThreshold( int minMult ) { fThresholdOnV0mult = minMult; }\r
-\r
- // void SetIncludeEventTreeInOutput( Bool_t flag ) { fSetIncludeEventTreeInOutput = flag; }\r
- // Bool_t GetIncludeEventTreeInOutput() { return fSetIncludeEventTreeInOutput; }\r
-\r
- // void SetAnalysisType( en_AnalysisType analysisType ) { fAnalysisType = analysisType; }\r
- // en_AnalysisType GetAnalysisType() { return fAnalysisType; }\r
-\r
- Double_t GetEventPlane(AliVEvent *event);\r
-\r
-\r
- //track cuts array stuff\r
- void AddTrackCutForBits(AliESDtrackCuts* const cuts, TString cutsName );\r
- void SetUseListCuts( Bool_t const useCutsList ) { fSwitchToListingCuts = useCutsList; }\r
- Int_t GetNumberOfTrackCutForBits() const { return fArrTrackCuts.GetEntries();/*fNumberOfCutsToRemember*/; }\r
-\r
- void SetAnalysisLevel(const char* analysisLevel) { fAnalysisLevel = analysisLevel;}\r
- const char* GetAnalysisLevel() { return fAnalysisLevel.Data(); }\r
-\r
- void SetMCESD( Bool_t flagMCESD ) { fAnalyseMCESD = flagMCESD; }\r
- Bool_t GetMCESD() const { return fAnalyseMCESD; }\r
-\r
- void SetFlagWatchZDC( Bool_t flagWatchZDC) { fFlagWatchZDC = flagWatchZDC;}\r
- void SetFlagWatchV0 ( Bool_t flagWatchV0 ) { fFlagWatchV0 = flagWatchV0 ;}\r
- void SetFlagWatchFMD( Bool_t flagWatchFMD) { fFlagWatchFMD = flagWatchFMD;}\r
- Bool_t GetFlagWatchZDC() { return fFlagWatchZDC; }\r
- Bool_t GetFlagWatchV0 () { return fFlagWatchV0 ; }\r
- Bool_t GetFlagWatchFMD() { return fFlagWatchFMD; }\r
-\r
- void FillLRCProcessors( int nTracks, Double_t eventCentrality );\r
- void ProfilePhiByHand( int numberOfAcceptedTracksForLRC );\r
- void UseToyEvents();\r
-\r
- void SetEtaRegionForTests( Double_t etaRegionForTests ) { fEtaRegionForTests = etaRegionForTests; }\r
- Double_t GetEtaRegionForTests() { return fEtaRegionForTests; }\r
-\r
- void SetMultCutInEtaRegion( Double_t multCutInEtaRegion ) { fMultCutInEtaRegion = multCutInEtaRegion; }\r
- Double_t GetMultCutInEtaRegion() { return fMultCutInEtaRegion; }\r
-\r
- inline void FixAngleInTwoPi( Double_t &lPhi )\r
- {\r
- if ( lPhi > 2 * TMath::Pi() )\r
- lPhi -= 2 * TMath::Pi();\r
- else if ( lPhi < 0 )\r
- lPhi += 2 * TMath::Pi();\r
- }\r
-\r
- void SetFlagSuppressAddingSomeHistos( Bool_t flagSuppressAddingSomeHistos ) { fFlagSuppressAddingSomeHistos = flagSuppressAddingSomeHistos; }\r
-\r
- enum enTaskObjectParameters { kMaxParticlesNumber = 15000, kMaxLRCprocArrayPointers = 10000 }; // default TPC & TOF pid (via GetTPCpid & GetTOFpid)\r
-\r
-protected:\r
- void SetParticleTypeToProcessors( int windowId, TString strPid );\r
- \r
- Int_t fNumberOfPhiSectors; // n of phi rotations\r
- Bool_t fFlagSuppressAddingSomeHistos; //flag to include in output list some histos or not include\r
- // AliLRCBase *fLRCprocArrayPointers[kMaxLRCprocArrayPointers];\r
-\r
- // Track cuts\r
- TString fAnalysisLevel; //ESD, AOD or MC\r
- AliESDtrackCuts *fEsdTrackCuts; // esd track cuts\r
- UInt_t fAODtrackCutBit;//track cut bit from track selection (only used for AODs)\r
-\r
- // Array with different track cuts to remember in simple event Tree\r
- TObjArray fArrTrackCuts; //AliESDtrackCuts* [100]; // Arr with different track cuts\r
- TString fArrCutsNames[100]; // Arr with names of different track cuts\r
- TH1I *fHistCutsNamesBins; //! tracks passed different cut sets in histogram bins\r
- Bool_t fSwitchToListingCuts; // switch to remember cuts desicions and not to drop track by fTrackCuts\r
-\r
-\r
- // en_AnalysisType fAnalysisType; // type of analysis\r
-\r
- //SPD tracklets cut\r
- Int_t fMinNumberOfSPDtracklets; //Minimum number of SPD tracklets in ESD event\r
-\r
- // Acceptance cuts\r
- Double_t fMaxPtLimit; //Max Pt filter\r
- Double_t fMinPtLimit; // Min Pt filter\r
- Double_t fKineLowPtCut; // Min Pt for Kine tracks\r
-\r
- // Nch cuts\r
- Int_t fMinAcceptedTracksCut; //Minimum number of accepted tracks in event\r
- Int_t fMaxAcceptedTracksCut; //Maximum number of accepted tracks in event\r
-\r
- // Vtx cuts\r
- Bool_t fCheckForkVtx; // Check for vertex\r
- Bool_t fCheckForVtxPosition; // Check if vertex position in range\r
- Double_t fVxMax; // X vrtx max\r
- Double_t fVyMax; // Y vrtx max\r
- Double_t fVzMax; // Z vrtx max\r
-\r
-\r
- TList fLRCproc; // AliLRCProcess objects list\r
- TList* fOutList; //! Task Output data container\r
-\r
- Bool_t fRunKine; // ESD/AOD - KINE switch\r
- Bool_t fAnalyseMCESD; // MCESD switch\r
- Bool_t fShowEventStats; // Allows per event debug output (trigger Nch, cuts etc)\r
- Bool_t fShowPerTrackStats; // Allows per track debug output\r
-\r
-\r
- Double_t fEtaRegionForTests; //eta region to tests\r
- Double_t fMultCutInEtaRegion; // cut on mult in eta region\r
-\r
- // QA histos\r
-\r
- TH1I *fHistEventCutStats; //! Event cut statistics\r
- TH1I *fHistTrackCutStats; //! Track cut statistics\r
- TH1I *fHistAODTrackStats; //! AOD track bits statistics\r
-\r
-\r
- TH1D *fHistVx; //! Vx hist\r
- TH1D *fHistVy; //! Vy hist\r
- TH1D *fHistVz; //! Vz hist\r
-\r
- TH1D *fHistVxMCrecoDiff; //! Vx hist MC-reco diff\r
- TH1D *fHistVyMCrecoDiff; //! Vy hist MC-reco diff\r
- TH1D *fHistVzMCrecoDiff; //! Vz hist MC-reco diff\r
-\r
- TH1I *fHistVertexNconributors; //! vertex contributors number\r
- TH1I *fHistNumberOfPileupVerticesTracks; //! number of pileup verteces in event (ESD or AOD) by tracks\r
- TH1I *fHistNumberOfPileupVerticesSPD; //! number of pileup verteces in event (ESD or AOD) by SPD\r
-\r
- TH2F *fHistEventPlane; //event plane distribution\r
-\r
-\r
- TH1F *fHistPt; //! Overal Pt spectrum\r
- TH1F *fHistEta; //! Overal Eta spectrum\r
- TH1F *fHistEtaAODpure; //! Overal Eta spectrum aod pure before cuts\r
- TH1F *fHistPhi; //! Overal Phi spectrum\r
- TH2D *fHistEtaPhi; //! 2D plot for checking acceptance\r
- TH1F *fHistPhiLRCrotationsCheck; //! Overal Phi spectrum for LRC rotations\r
- TH1F *fHistPhiArtificialProfilingCheck; //! hist for the check of profiled phi\r
- TH1F *fHistPhiArtificialProfilingCheckWrtEvPlane; //! hist for the check of profiled phi wrt event plane\r
- TH1F *fHistPhiArtificialEvPlane; //! hist artificial event plane\r
-\r
- TH2D *fHistEtaVsZvCoverage; //! Statistics on tracks Zv and Eta for all tracks\r
- TH2D *fHistEtaVsZvCoverageAccepted; //! Statistics on tracks Zv and Eta for accepted tracks\r
-\r
- TH1D *fHistMultBeforeCuts; //! Histo: Number of tracks before applying cuts\r
- TH1D *fHistAcceptedMult; //! Number of accepted tracks histo\r
- TH1D *fHistAcceptedTracks; //! Number of tracks accepted for filling LRC processors, histo\r
- TH1D *fHistMultiplicityInEtaRegion; //! Number of tracks in |eta| region\r
- TH1D *fHistMultiplicityInEtaRegionAfterPtCuts; //! Number of tracks in |eta| region after Pt Cuts\r
- TH2D *fHist2DMultiplicityMCESDInEtaRegion; //! Number of tracks in |eta| region (MC vs ESD)\r
- TH1D *fHistAcceptedTracksAfterPtCuts; //! Number of tracks accepted for filling LRC processors, histo\r
- TH1D *fHistAcceptedTPCtracks; //! Number of accepted tracks with TPC inner param\r
- TH1D *fHistClustersTPC; //! Number of TPC clusters distribution\r
- TH1D *fHistClustersTPCafterCuts; //! Number of TPC clusters distribution after cuts\r
- TH1D *fHistCrossedRowsTPC; //! Number of TPC crossed rows\r
- TH1D *fHistCrossedRowsTPCafterCuts; //! Number of TPC crossed rows after cuts\r
- \r
-\r
- TH1D *fHistClustersITS; //! Number of ITS clusters distribution\r
- TH1D *fHistTrackletsITS; //! Number of ITS tracklets distribution\r
- TH2D *fHist2DClustersTPCvsPt; //! Number of TPC clusters vs Pt distribution (to see the dependence!)\r
- TH2D *fHist2DClustersTPCvsEta; //! Number of TPC clusters vs Eta distribution (to see the dependence!)\r
-\r
- TH2D *fHist2DAcceptedTracksPtvsEta; //! rejected tracks pt vs eta\r
-\r
- TH1D *fHistMClabels; //! MC labels\r
- TH1D *fHistRejectedTracksCharge; //! Charge of rejected tracks\r
- TH1D *fHistTracksCharge; //! Charge of accepted tracks (zero is filled only for MC truth)\r
-\r
- //netcharge study\r
- TH1D *fHistPtPlus; //! pt distr for +\r
- TH1D *fHistPtMinus; //! pt distr for -\r
- TH1D *fHistNetChargeVsPt; //! Net charge vs pt of accepted tracks\r
- TH1D *fHistChargePlusVsPtTmp; //! Net charge vs pt of accepted tracks +\r
- TH1D *fHistChargeMinusVsPtTmp; //! Net charge vs pt of accepted tracks -\r
- TH2D *fHist2DNetChargeVsPt; //! Net charge vs pt of accepted tracks 2D\r
- TH2D *fHist2DNetChargeVsPtCorrectedOnEventMean; //! Net charge vs pt of accepted tracks 2D shifted by mean\r
- TH2D *fHist2DNetChargeVsPtCorrectedOnEventMeanNormOnNch; //! Net charge vs pt of accepted tracks 2D norm on nCh\r
-\r
- AliAnalysisTaskLRC(const AliAnalysisTaskLRC&); // not implemented\r
- AliAnalysisTaskLRC& operator=(const AliAnalysisTaskLRC&); // not implemented\r
-\r
- TH1D *fHistProbabilitiesPID; //!hist of esd pid prob-s\r
- //Double_t *fProbabilitiesPID; //! array of esd pid prob-s\r
- TH1D *fHistESDtrackMass; //!hist of esd particle masses\r
- TH1D *fHistProbabilityPion; //!hist of pion probability\r
- TH1D *fHistProbabilityKaon; //!hist of kaon probability\r
- TH1D *fHistProbabilityProton; //!hist of proton probability\r
- TH1D *fHistParticlesDistr; //!hist of particles distr\r
- TH1D *fHistParticlesDistrBeforeCuts; //!hist of particles distr\r
-\r
-\r
-\r
- TH1D *fHistCentralityPercentile; //! centrality class\r
- TH1D *fHistCentralityClass10; //! centrality class by 10\r
- TH1D *fHistCentralityClass5; //! centrality class by 5\r
-\r
-\r
- //ZDC stuff\r
- TH1D *fHistZDCenergy[5]; //! ZDC energy for diff mult conditions\r
- TH1D *fHistZDCparticipants; //! ZDC participants\r
-\r
- //V0 stuff\r
- TH1D *fHistV0multiplicity; //! V0 mult\r
- TH1D *fHistV0Amultiplicity; //! V0 A mult\r
- TH1D *fHistV0Cmultiplicity; //! V0 C mult\r
- TH2D *fHist2DV0ACmultiplicity; //! V0 A-C mult\r
- //TH1D *fHistV0spectra; //! V0 particle masses\r
- TH2D *fHist2DTracksAcceptedVsV0multiplicity; //! V0 mult Vs N tracks Accepted\r
-\r
- TH1D *fHistV0AmultiplicityRing[4]; //! V0 A mult in rings\r
- TH1D *fHistV0CmultiplicityRing[4]; //! V0 C mult in rings\r
- TH2D *fHist2DV0ACmultiplicityRing[4]; //! V0 A-C mult in rings\r
- TH2D *fHist2DTracksAcceptedVsV0AmultiplicityRing[4]; //! V0A mult Rings Vs N tracks Accepted\r
- TH2D *fHist2DTracksAcceptedVsV0CmultiplicityRing[4]; //! V0C mult Rings Vs N tracks Accepted\r
-\r
- TH1D *fHistV0cells ; //! V0 cells\r
- TH1D *fHistV0Acells ; //! V0 A cells\r
- TH1D *fHistV0Ccells ; //! V0 C cells\r
- TH2D *fHist2DV0ACcells ; //! V0 A-C cells\r
-\r
- Int_t fThresholdOnV0mult; //min V0AC mult to analyse this event (default is 0)\r
-\r
-\r
- //centrality class\r
- Float_t fMinCentralityClass; // min bound on centrality percentile\r
- Float_t fMaxCentralityClass; // max bound on centrality percentile\r
-\r
-\r
- Bool_t fIsIonsAnalysis; //Ions analysis flag\r
- Bool_t fEtInsteadOfPt; //pass the Et instead of Pt to LRC processors\r
-\r
- Bool_t fUsePhiShufflingByHand; //flag for manual suffling of tracks phi\r
- Bool_t fUseToyEvents; //flag for manual suffling of tracks phi\r
- Int_t fNumberOfToyEvents; //number of toy events\r
-\r
- Int_t fTmpCounter; //! TMP\r
-\r
- const AliPIDResponse *fPIDResponse; //! PID response object\r
- AliPIDCombined *fPIDCombined; //! combined PID object\r
- TH1F *fPriors[AliPID::kSPECIES]; //! priors\r
- TH2D *fPriorsUsed[AliPID::kSPECIES]; //! priors used\r
- TH2D *fProbTPCTOF[AliPID::kSPECIES]; //! combined probabilities vs mom TPC-TOF\r
- TH2D *fProbAllDets[AliPID::kSPECIES]; //! combined probabilities ALL dets vs mom\r
-\r
- TH1D *fHistPidMaxProbability; //!hist of max probabilities for arrays PID species\r
- TH1D *fHistPidPureMaxProbability; //!hist of max probabilities for arrays PID species (when detId is TPC+TOF)\r
-\r
- TString fStrPIDforFwd; //PID name for FWD win\r
- TString fStrPIDforBwd; //PID name for BWD win\r
- Bool_t fPIDsensingFlag; //flag that we sense PID in processors\r
-\r
-\r
- int fMultForZDCstudy[5]; //! threshold multiplicities for ZDC study\r
-\r
- //artificial inefficiency (27.09.12)\r
- Double_t fArtificialInefficiency; // inefficiency by hand in [0,1], default is 0\r
- TH2D *fHistNumberOfDroppedByHandTracks; //! Number of tracks which were dropped by hand vs N of accepted tracks\r
- TRandom3 *fRand; //random generator for some uses\r
-\r
- //phi artificial gaps\r
- Double_t fPhiArtificialGapBegin; // inefficiency in phi - gap position edge begins\r
- Double_t fPhiArtificialGapEnd; // inefficiency in phi - gap position edge ends\r
-\r
- //flags for inclusion of detectors info:\r
- Bool_t fFlagWatchZDC; //study ZDC issues\r
- Bool_t fFlagWatchV0; //study V0 issues\r
- Bool_t fFlagWatchFMD; //study FMD issues\r
-\r
-\r
- TStopwatch *fAnalysisTimer;\r
-\r
-\r
- //arrays with data for LRC processors\r
- Double_t fArrayTracksPt[kMaxParticlesNumber];\r
- Double_t fArrayTracksEta[kMaxParticlesNumber];\r
- Double_t fArrayTracksPhi[kMaxParticlesNumber];\r
- Short_t fArrayTracksCharge[kMaxParticlesNumber];\r
- Int_t fArrayTracksPID[kMaxParticlesNumber];\r
-\r
-\r
- //test MC particles\r
- // TH1D *fHistMCvertexRdeltaFromParent; //!MC R hist\r
- // TH1F *fHistMCparentsStat; //! MC parent ratios for different partile classes\r
- // TH1F *fHistMCparentsEta[kNumberOfParentParticleClassesInMC]; //! MC parents eta distributions for different particle classes\r
- // TH1F *fHistMCchildsEta[kNumberOfParentParticleClassesInMC]; //! MC childs eta distributions for different partile classes\r
- // TH1F *fHistMCdeltaEtaChildParent[kNumberOfParentParticleClassesInMC]; //! MC delta eta b/n parent and child\r
- // TH1F *fHistMCdeltaPhiChildParent[kNumberOfParentParticleClassesInMC]; //! MC delta phi b/n parent and child\r
- // TH2D *fHist2DMCchildrenPhiChildParent[kNumberOfParentParticleClassesInMC]; //! MC delta b/n parent and child in eta-phi\r
-\r
- // TH1F *fHistMCNumberOfChildren[kNumberOfParentParticleClassesInMC]; //! Number of children for fathers in MC (for different father classes)\r
- // TH1D *fHistMCchildrenEtaDeviationsFromAverage[kNumberOfParentParticleClassesInMC]; //! MC delta b/n av. eta and each child's eta for each father (for different father classes)\r
- // TH1D *fHistMCchildrenPhiDeviationsFromAverage[kNumberOfParentParticleClassesInMC]; //! MC delta b/n av. phi and each child's phi for each father (for different father classes)\r
- // TH2D *fHist2DMCchildrenPhiDeviationsFromAverage[kNumberOfParentParticleClassesInMC]; //! MC delta b/n av. eta-phi and each child's eta and phi for each father (for different father classes)\r
-\r
- // TString fStrMCparticleClassForFillingLRC; // name of particle class for LRC filling (default is All)\r
- // Double_t fEtaMCanalysisCutMin; // spec MC analysis: cut on eta\r
- // Double_t fEtaMCanalysisCutMax; // spec MC analysis: cut on eta\r
-\r
- // TH1F *fHistMCparentDeepness; //! MC deepness of parent tree from "physical primary" children\r
- // TH1F *fHistMCparentsInitialStat; //! MC initial papa particle class distr\r
-\r
- // TH1F *fHistMCEtaInitialQuark; //! MC eta distr of "initial" quarks\r
- // TH1F *fHistMCEtaInitialGluon; //! MC eta distr of "initial" gluons\r
- // TH1F *fHistMCEtaInitialProton; //! MC eta distr of "initial" protons\r
-\r
- // TH1F *fHistMCnumberInitialQuarksInEvent; //! MC initial quarks number distr\r
- // TH1F *fHistMCnumberInitialGluonsInEvent; //! MC initial gluons number distr\r
- // TH1F *fHistMCnumberInitialProtonInEvent; //! MC initial proton number distr (check that there are 2)\r
-\r
- // TH1F *fHistMCnumberChildrenFromInitialQuarksInEvent; //! MC children number from initial quarks distr\r
- // TH1F *fHistMCnumberChildrenFromInitialGluonsInEvent; //! MC children number from initial gluons distr\r
- // TH1F *fHistMCnumberChildrenFromInitialProtonInEvent; //! MC children number from initial proton distr (check that there are 2)\r
-\r
-\r
- // 4.01.2012: MyTree stuff\r
- // AliSimpleEvent *fSimpleEvent; // instance of simple event to be filled in analysis loop\r
- // Int_t fNsimpleEvents;\r
- // TTree *fEventTree; //! event tree to write into output file\r
- // Bool_t fSetIncludeEventTreeInOutput; // flag to use event tree or not\r
-\r
- ClassDef(AliAnalysisTaskLRC, 11 );\r
-};\r
-\r
-#endif\r
+#ifndef AliAnalysisTaskLRC_H
+#define AliAnalysisTaskLRC_H
+
+// Analysis task for Long Range Correlation (LRC) analysis using TPC data
+// This includes a TList of AliLRCProcess objects that are processing LRC analysis
+// for a given eta-phi windows
+
+// Author : Andrey Ivanov, Igor Altsybeev, St.Peterburg State University
+// Email: Igor.Altsybeev.ch
+
+
+#include <AliPIDResponse.h>
+#include <AliPIDCombined.h>
+#include <AliAnalysisTaskSE.h>
+
+//#define kNumberOfParentParticleClassesInMC 8
+
+//class AliLRCProcess;
+class AliLRCBase;
+class AliESDtrackCuts;
+class TH1D;
+class TH2D;
+class TH1I;
+class TRandom3;
+class TParticle;
+//class AliSimpleEvent;
+class TTree;
+
+class TStopwatch;
+//enum en_AnalysisType
+//{
+// en_AnalysisType_ESD = 0,
+// en_AnalysisType_AOD
+
+//};
+
+class AliAnalysisTaskLRC : public AliAnalysisTaskSE {
+
+public:
+ //Constructors
+ AliAnalysisTaskLRC( const char *name = "AliAnalysisTaskLRC", Bool_t runKine = kFALSE );
+ virtual ~AliAnalysisTaskLRC() {}
+
+ //AliAnalysisTaskSE overloading
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ // virtual void UserExecLoop( Double_t phiAdditional = 0 );//Option_t *option);
+ virtual void Terminate(Option_t *);
+ //----------------------------------
+
+ void AddLRCProcess(AliLRCBase *newProc); //Adds new AliLRCProcess to analysis task
+
+ // Setters
+ void SetMinNumberOfSPDtracklets( Int_t MinSPDtracklets ); //Sets min number of SPD tracklets
+ void SetMaxPtLimit(Double_t MaxPtLimit); //Sets Max Pt filter
+ void SetMinPtLimit(Double_t MinPtLimit); //Sets Min Pt filter
+ void SetKineLowPtCut(Double_t MinKineParticlePtLimit); //Sets Min Pt filter for kine particles
+ void SetCheckForkVtx(Bool_t CheckForkVtx){fCheckForkVtx=CheckForkVtx;} // Accept only events with veretex
+ void SetCheckForVtxPosition(Bool_t CheckForVtxPosition ){fCheckForVtxPosition=CheckForVtxPosition;} //Accept only events with veretex in slected range
+ void SetTrackCuts(AliESDtrackCuts* const cuts) { fEsdTrackCuts = cuts; }
+ void SetAODtrackCutBit(UInt_t bit){ fAODtrackCutBit = bit; } //AOD track cut bit
+ void SetShowEventStats(Bool_t ShowEventStats) {fShowEventStats= ShowEventStats;}
+ void SetShowPerTrackStats(Bool_t ShowPerTrackStats) {fShowPerTrackStats=ShowPerTrackStats;}
+ void SetVtxDiamond(Double_t Vx, Double_t Vy, Double_t Vz) {fVxMax = Vx;fVyMax =Vy;fVzMax = Vz;}
+ void SetNchCuts(Int_t minNch, Int_t maxNch){fMinAcceptedTracksCut=minNch; fMaxAcceptedTracksCut=maxNch;}
+
+ void SetNumberOfPhiSectors(Int_t nSectors){ fNumberOfPhiSectors = nSectors; }//fNeedToRotateSector = kTRUE; }
+ void SetCentralityClass(Float_t minCentralityClass, Float_t maxCentralityClass ){ fMinCentralityClass = minCentralityClass; fMaxCentralityClass = maxCentralityClass; }
+
+ void SetIonsAnalysis(Bool_t isIonsFlag ){ fIsIonsAnalysis = isIonsFlag; }
+ void SetEtAnalysis(Bool_t isEtAnalysisFlag ){ fEtInsteadOfPt = isEtAnalysisFlag; }
+ void SetUsePhiShufflingByHand(Bool_t usePhiShufflingByHand ){ fUsePhiShufflingByHand = usePhiShufflingByHand; }
+ void SetUseToyEvents(Bool_t useToyEvents ){ fUseToyEvents = useToyEvents; }
+ void SetNumberOfToyEvents(Int_t nEvents ){ fNumberOfToyEvents = nEvents; }
+ void SetArtificialInefficiencyCoeff( Double_t artificialInefficiencyCoeff ) { fArtificialInefficiency = artificialInefficiencyCoeff; } //Sets coeff for artificial inefficiency
+
+ //void SetNumberOfPhiSectorsByHand( Int_t numberOfPhiSectorsByHand ) { fNumberOfPhiSectorsByHand = numberOfPhiSectorsByHand; }
+
+ // Getters
+ TList* GetListOfProcessors() { return &fLRCproc;} // Returns list of included
+ AliESDtrackCuts* GetTrackCuts() const { return fEsdTrackCuts; }
+ AliLRCBase * Proc(Int_t index);// Get Processor i
+
+ void SetParticleTypeForTask( TString strF, TString strB ); //( char* strF, char* strB );
+ // void SetMCparticleClassForFillingLRC( TString strParticleType ) { fStrMCparticleClassForFillingLRC = strParticleType; }
+ // void SetEtaCutsForSpecMCanalysis( double etaMin, double etaMax ) { fEtaMCanalysisCutMin = etaMin; fEtaMCanalysisCutMax = etaMax; }
+
+ void SetV0ACMultThreshold( int minMult ) { fThresholdOnV0mult = minMult; }
+
+ // void SetIncludeEventTreeInOutput( Bool_t flag ) { fSetIncludeEventTreeInOutput = flag; }
+ // Bool_t GetIncludeEventTreeInOutput() { return fSetIncludeEventTreeInOutput; }
+
+ // void SetAnalysisType( en_AnalysisType analysisType ) { fAnalysisType = analysisType; }
+ // en_AnalysisType GetAnalysisType() { return fAnalysisType; }
+
+ Double_t GetEventPlane(AliVEvent *event);
+
+
+ //track cuts array stuff
+ void AddTrackCutForBits(AliESDtrackCuts* const cuts, TString cutsName );
+ void SetUseListCuts( Bool_t const useCutsList ) { fSwitchToListingCuts = useCutsList; }
+ Int_t GetNumberOfTrackCutForBits() const { return fArrTrackCuts.GetEntries();/*fNumberOfCutsToRemember*/; }
+
+ void SetAnalysisLevel(const char* analysisLevel) { fAnalysisLevel = analysisLevel;}
+ const char* GetAnalysisLevel() { return fAnalysisLevel.Data(); }
+
+ void SetMCESD( Bool_t flagMCESD ) { fAnalyseMCESD = flagMCESD; }
+ Bool_t GetMCESD() const { return fAnalyseMCESD; }
+
+ void SetFlagWatchZDC( Bool_t flagWatchZDC) { fFlagWatchZDC = flagWatchZDC;}
+ void SetFlagWatchV0 ( Bool_t flagWatchV0 ) { fFlagWatchV0 = flagWatchV0 ;}
+ void SetFlagWatchFMD( Bool_t flagWatchFMD) { fFlagWatchFMD = flagWatchFMD;}
+ Bool_t GetFlagWatchZDC() { return fFlagWatchZDC; }
+ Bool_t GetFlagWatchV0 () { return fFlagWatchV0 ; }
+ Bool_t GetFlagWatchFMD() { return fFlagWatchFMD; }
+
+ void FillLRCProcessors( int nTracks, Double_t eventCentrality );
+ void ProfilePhiByHand( int numberOfAcceptedTracksForLRC );
+ void UseToyEvents();
+
+ void SetEtaRegionForTests( Double_t etaRegionForTests ) { fEtaRegionForTests = etaRegionForTests; }
+ Double_t GetEtaRegionForTests() { return fEtaRegionForTests; }
+
+ void SetMultCutInEtaRegion( Double_t multCutInEtaRegion ) { fMultCutInEtaRegion = multCutInEtaRegion; }
+ Double_t GetMultCutInEtaRegion() { return fMultCutInEtaRegion; }
+
+ inline void FixAngleInTwoPi( Double_t &lPhi )
+ {
+ if ( lPhi > 2 * TMath::Pi() )
+ lPhi -= 2 * TMath::Pi();
+ else if ( lPhi < 0 )
+ lPhi += 2 * TMath::Pi();
+ }
+
+ void SetFlagSuppressAddingSomeHistos( Bool_t flagSuppressAddingSomeHistos ) { fFlagSuppressAddingSomeHistos = flagSuppressAddingSomeHistos; }
+
+ enum enTaskObjectParameters { kMaxParticlesNumber = 15000, kMaxLRCprocArrayPointers = 10000 }; // default TPC & TOF pid (via GetTPCpid & GetTOFpid)
+
+protected:
+ void SetParticleTypeToProcessors( int windowId, TString strPid );
+
+ Int_t fNumberOfPhiSectors; // n of phi rotations
+ Bool_t fFlagSuppressAddingSomeHistos; //flag to include in output list some histos or not include
+ // AliLRCBase *fLRCprocArrayPointers[kMaxLRCprocArrayPointers];
+
+ // Track cuts
+ TString fAnalysisLevel; //ESD, AOD or MC
+ AliESDtrackCuts *fEsdTrackCuts; // esd track cuts
+ UInt_t fAODtrackCutBit;//track cut bit from track selection (only used for AODs)
+
+ // Array with different track cuts to remember in simple event Tree
+ TObjArray fArrTrackCuts; //AliESDtrackCuts* [100]; // Arr with different track cuts
+ TString fArrCutsNames[100]; // Arr with names of different track cuts
+ TH1I *fHistCutsNamesBins; //! tracks passed different cut sets in histogram bins
+ Bool_t fSwitchToListingCuts; // switch to remember cuts desicions and not to drop track by fTrackCuts
+
+
+ // en_AnalysisType fAnalysisType; // type of analysis
+
+ //SPD tracklets cut
+ Int_t fMinNumberOfSPDtracklets; //Minimum number of SPD tracklets in ESD event
+
+ // Acceptance cuts
+ Double_t fMaxPtLimit; //Max Pt filter
+ Double_t fMinPtLimit; // Min Pt filter
+ Double_t fKineLowPtCut; // Min Pt for Kine tracks
+
+ // Nch cuts
+ Int_t fMinAcceptedTracksCut; //Minimum number of accepted tracks in event
+ Int_t fMaxAcceptedTracksCut; //Maximum number of accepted tracks in event
+
+ // Vtx cuts
+ Bool_t fCheckForkVtx; // Check for vertex
+ Bool_t fCheckForVtxPosition; // Check if vertex position in range
+ Double_t fVxMax; // X vrtx max
+ Double_t fVyMax; // Y vrtx max
+ Double_t fVzMax; // Z vrtx max
+
+
+ TList fLRCproc; // AliLRCProcess objects list
+ TList* fOutList; //! Task Output data container
+
+ Bool_t fRunKine; // ESD/AOD - KINE switch
+ Bool_t fAnalyseMCESD; // MCESD switch
+ Bool_t fShowEventStats; // Allows per event debug output (trigger Nch, cuts etc)
+ Bool_t fShowPerTrackStats; // Allows per track debug output
+
+
+ Double_t fEtaRegionForTests; //eta region to tests
+ Double_t fMultCutInEtaRegion; // cut on mult in eta region
+
+ // QA histos
+
+ TH1I *fHistEventCutStats; //! Event cut statistics
+ TH1I *fHistTrackCutStats; //! Track cut statistics
+ TH1I *fHistAODTrackStats; //! AOD track bits statistics
+
+
+ TH1D *fHistVx; //! Vx hist
+ TH1D *fHistVy; //! Vy hist
+ TH1D *fHistVz; //! Vz hist
+
+ TH1D *fHistVxMCrecoDiff; //! Vx hist MC-reco diff
+ TH1D *fHistVyMCrecoDiff; //! Vy hist MC-reco diff
+ TH1D *fHistVzMCrecoDiff; //! Vz hist MC-reco diff
+
+ TH1I *fHistVertexNconributors; //! vertex contributors number
+ TH1I *fHistNumberOfPileupVerticesTracks; //! number of pileup verteces in event (ESD or AOD) by tracks
+ TH1I *fHistNumberOfPileupVerticesSPD; //! number of pileup verteces in event (ESD or AOD) by SPD
+
+ TH2F *fHistEventPlane; //event plane distribution
+
+
+ TH1F *fHistPt; //! Overal Pt spectrum
+ TH1F *fHistEta; //! Overal Eta spectrum
+ TH1F *fHistEtaAODpure; //! Overal Eta spectrum aod pure before cuts
+ TH1F *fHistPhi; //! Overal Phi spectrum
+ TH2D *fHistEtaPhi; //! 2D plot for checking acceptance
+ TH1F *fHistPhiLRCrotationsCheck; //! Overal Phi spectrum for LRC rotations
+ TH1F *fHistPhiArtificialProfilingCheck; //! hist for the check of profiled phi
+ TH1F *fHistPhiArtificialProfilingCheckWrtEvPlane; //! hist for the check of profiled phi wrt event plane
+ TH1F *fHistPhiArtificialEvPlane; //! hist artificial event plane
+
+ TH2D *fHistEtaVsZvCoverage; //! Statistics on tracks Zv and Eta for all tracks
+ TH2D *fHistEtaVsZvCoverageAccepted; //! Statistics on tracks Zv and Eta for accepted tracks
+
+ TH1D *fHistMultBeforeCuts; //! Histo: Number of tracks before applying cuts
+ TH1D *fHistAcceptedMult; //! Number of accepted tracks histo
+ TH1D *fHistAcceptedTracks; //! Number of tracks accepted for filling LRC processors, histo
+ TH1D *fHistMultiplicityInEtaRegion; //! Number of tracks in |eta| region
+ TH1D *fHistMultiplicityInEtaRegionAfterPtCuts; //! Number of tracks in |eta| region after Pt Cuts
+ TH2D *fHist2DMultiplicityMCESDInEtaRegion; //! Number of tracks in |eta| region (MC vs ESD)
+ TH1D *fHistAcceptedTracksAfterPtCuts; //! Number of tracks accepted for filling LRC processors, histo
+ TH1D *fHistAcceptedTPCtracks; //! Number of accepted tracks with TPC inner param
+ TH1D *fHistClustersTPC; //! Number of TPC clusters distribution
+ TH1D *fHistClustersTPCafterCuts; //! Number of TPC clusters distribution after cuts
+ TH1D *fHistCrossedRowsTPC; //! Number of TPC crossed rows
+ TH1D *fHistCrossedRowsTPCafterCuts; //! Number of TPC crossed rows after cuts
+
+
+ TH1D *fHistClustersITS; //! Number of ITS clusters distribution
+ TH1D *fHistTrackletsITS; //! Number of ITS tracklets distribution
+ TH2D *fHist2DClustersTPCvsPt; //! Number of TPC clusters vs Pt distribution (to see the dependence!)
+ TH2D *fHist2DClustersTPCvsEta; //! Number of TPC clusters vs Eta distribution (to see the dependence!)
+
+ TH2D *fHist2DAcceptedTracksPtvsEta; //! rejected tracks pt vs eta
+
+ TH1D *fHistMClabels; //! MC labels
+ TH1D *fHistRejectedTracksCharge; //! Charge of rejected tracks
+ TH1D *fHistTracksCharge; //! Charge of accepted tracks (zero is filled only for MC truth)
+
+ //netcharge study
+ TH1D *fHistPtPlus; //! pt distr for +
+ TH1D *fHistPtMinus; //! pt distr for -
+ TH1D *fHistNetChargeVsPt; //! Net charge vs pt of accepted tracks
+ TH1D *fHistChargePlusVsPtTmp; //! Net charge vs pt of accepted tracks +
+ TH1D *fHistChargeMinusVsPtTmp; //! Net charge vs pt of accepted tracks -
+ TH2D *fHist2DNetChargeVsPt; //! Net charge vs pt of accepted tracks 2D
+ TH2D *fHist2DNetChargeVsPtCorrectedOnEventMean; //! Net charge vs pt of accepted tracks 2D shifted by mean
+ TH2D *fHist2DNetChargeVsPtCorrectedOnEventMeanNormOnNch; //! Net charge vs pt of accepted tracks 2D norm on nCh
+
+ AliAnalysisTaskLRC(const AliAnalysisTaskLRC&); // not implemented
+ AliAnalysisTaskLRC& operator=(const AliAnalysisTaskLRC&); // not implemented
+
+ TH1D *fHistProbabilitiesPID; //!hist of esd pid prob-s
+ //Double_t *fProbabilitiesPID; //! array of esd pid prob-s
+ TH1D *fHistESDtrackMass; //!hist of esd particle masses
+ TH1D *fHistProbabilityPion; //!hist of pion probability
+ TH1D *fHistProbabilityKaon; //!hist of kaon probability
+ TH1D *fHistProbabilityProton; //!hist of proton probability
+ TH1D *fHistParticlesDistr; //!hist of particles distr
+ TH1D *fHistParticlesDistrBeforeCuts; //!hist of particles distr
+
+
+
+ TH1D *fHistCentralityPercentile; //! centrality class
+ TH1D *fHistCentralityClass10; //! centrality class by 10
+ TH1D *fHistCentralityClass5; //! centrality class by 5
+
+
+ //ZDC stuff
+ TH1D *fHistZDCenergy[5]; //! ZDC energy for diff mult conditions
+ TH1D *fHistZDCparticipants; //! ZDC participants
+
+ //V0 stuff
+ TH1D *fHistV0multiplicity; //! V0 mult
+ TH1D *fHistV0Amultiplicity; //! V0 A mult
+ TH1D *fHistV0Cmultiplicity; //! V0 C mult
+ TH2D *fHist2DV0ACmultiplicity; //! V0 A-C mult
+ //TH1D *fHistV0spectra; //! V0 particle masses
+ TH2D *fHist2DTracksAcceptedVsV0multiplicity; //! V0 mult Vs N tracks Accepted
+
+ TH1D *fHistV0AmultiplicityRing[4]; //! V0 A mult in rings
+ TH1D *fHistV0CmultiplicityRing[4]; //! V0 C mult in rings
+ TH2D *fHist2DV0ACmultiplicityRing[4]; //! V0 A-C mult in rings
+ TH2D *fHist2DTracksAcceptedVsV0AmultiplicityRing[4]; //! V0A mult Rings Vs N tracks Accepted
+ TH2D *fHist2DTracksAcceptedVsV0CmultiplicityRing[4]; //! V0C mult Rings Vs N tracks Accepted
+
+ TH1D *fHistV0cells ; //! V0 cells
+ TH1D *fHistV0Acells ; //! V0 A cells
+ TH1D *fHistV0Ccells ; //! V0 C cells
+ TH2D *fHist2DV0ACcells ; //! V0 A-C cells
+
+ Int_t fThresholdOnV0mult; //min V0AC mult to analyse this event (default is 0)
+
+
+ //centrality class
+ Float_t fMinCentralityClass; // min bound on centrality percentile
+ Float_t fMaxCentralityClass; // max bound on centrality percentile
+
+
+ Bool_t fIsIonsAnalysis; //Ions analysis flag
+ Bool_t fEtInsteadOfPt; //pass the Et instead of Pt to LRC processors
+
+ Bool_t fUsePhiShufflingByHand; //flag for manual suffling of tracks phi
+ Bool_t fUseToyEvents; //flag for manual suffling of tracks phi
+ Int_t fNumberOfToyEvents; //number of toy events
+
+ Int_t fTmpCounter; //! TMP
+
+ const AliPIDResponse *fPIDResponse; //! PID response object
+ AliPIDCombined *fPIDCombined; //! combined PID object
+ TH1F *fPriors[AliPID::kSPECIES]; //! priors
+ TH2D *fPriorsUsed[AliPID::kSPECIES]; //! priors used
+ TH2D *fProbTPCTOF[AliPID::kSPECIES]; //! combined probabilities vs mom TPC-TOF
+ TH2D *fProbAllDets[AliPID::kSPECIES]; //! combined probabilities ALL dets vs mom
+
+ TH1D *fHistPidMaxProbability; //!hist of max probabilities for arrays PID species
+ TH1D *fHistPidPureMaxProbability; //!hist of max probabilities for arrays PID species (when detId is TPC+TOF)
+
+ TString fStrPIDforFwd; //PID name for FWD win
+ TString fStrPIDforBwd; //PID name for BWD win
+ Bool_t fPIDsensingFlag; //flag that we sense PID in processors
+
+
+ int fMultForZDCstudy[5]; //! threshold multiplicities for ZDC study
+
+ //artificial inefficiency (27.09.12)
+ Double_t fArtificialInefficiency; // inefficiency by hand in [0,1], default is 0
+ TH2D *fHistNumberOfDroppedByHandTracks; //! Number of tracks which were dropped by hand vs N of accepted tracks
+ TRandom3 *fRand; //random generator for some uses
+
+ //phi artificial gaps
+ Double_t fPhiArtificialGapBegin; // inefficiency in phi - gap position edge begins
+ Double_t fPhiArtificialGapEnd; // inefficiency in phi - gap position edge ends
+
+ //flags for inclusion of detectors info:
+ Bool_t fFlagWatchZDC; //study ZDC issues
+ Bool_t fFlagWatchV0; //study V0 issues
+ Bool_t fFlagWatchFMD; //study FMD issues
+
+
+ TStopwatch *fAnalysisTimer;
+
+
+ //arrays with data for LRC processors
+ Double_t fArrayTracksPt[kMaxParticlesNumber];
+ Double_t fArrayTracksEta[kMaxParticlesNumber];
+ Double_t fArrayTracksPhi[kMaxParticlesNumber];
+ Short_t fArrayTracksCharge[kMaxParticlesNumber];
+ Int_t fArrayTracksPID[kMaxParticlesNumber];
+
+
+ //test MC particles
+ // TH1D *fHistMCvertexRdeltaFromParent; //!MC R hist
+ // TH1F *fHistMCparentsStat; //! MC parent ratios for different partile classes
+ // TH1F *fHistMCparentsEta[kNumberOfParentParticleClassesInMC]; //! MC parents eta distributions for different particle classes
+ // TH1F *fHistMCchildsEta[kNumberOfParentParticleClassesInMC]; //! MC childs eta distributions for different partile classes
+ // TH1F *fHistMCdeltaEtaChildParent[kNumberOfParentParticleClassesInMC]; //! MC delta eta b/n parent and child
+ // TH1F *fHistMCdeltaPhiChildParent[kNumberOfParentParticleClassesInMC]; //! MC delta phi b/n parent and child
+ // TH2D *fHist2DMCchildrenPhiChildParent[kNumberOfParentParticleClassesInMC]; //! MC delta b/n parent and child in eta-phi
+
+ // TH1F *fHistMCNumberOfChildren[kNumberOfParentParticleClassesInMC]; //! Number of children for fathers in MC (for different father classes)
+ // TH1D *fHistMCchildrenEtaDeviationsFromAverage[kNumberOfParentParticleClassesInMC]; //! MC delta b/n av. eta and each child's eta for each father (for different father classes)
+ // TH1D *fHistMCchildrenPhiDeviationsFromAverage[kNumberOfParentParticleClassesInMC]; //! MC delta b/n av. phi and each child's phi for each father (for different father classes)
+ // TH2D *fHist2DMCchildrenPhiDeviationsFromAverage[kNumberOfParentParticleClassesInMC]; //! MC delta b/n av. eta-phi and each child's eta and phi for each father (for different father classes)
+
+ // TString fStrMCparticleClassForFillingLRC; // name of particle class for LRC filling (default is All)
+ // Double_t fEtaMCanalysisCutMin; // spec MC analysis: cut on eta
+ // Double_t fEtaMCanalysisCutMax; // spec MC analysis: cut on eta
+
+ // TH1F *fHistMCparentDeepness; //! MC deepness of parent tree from "physical primary" children
+ // TH1F *fHistMCparentsInitialStat; //! MC initial papa particle class distr
+
+ // TH1F *fHistMCEtaInitialQuark; //! MC eta distr of "initial" quarks
+ // TH1F *fHistMCEtaInitialGluon; //! MC eta distr of "initial" gluons
+ // TH1F *fHistMCEtaInitialProton; //! MC eta distr of "initial" protons
+
+ // TH1F *fHistMCnumberInitialQuarksInEvent; //! MC initial quarks number distr
+ // TH1F *fHistMCnumberInitialGluonsInEvent; //! MC initial gluons number distr
+ // TH1F *fHistMCnumberInitialProtonInEvent; //! MC initial proton number distr (check that there are 2)
+
+ // TH1F *fHistMCnumberChildrenFromInitialQuarksInEvent; //! MC children number from initial quarks distr
+ // TH1F *fHistMCnumberChildrenFromInitialGluonsInEvent; //! MC children number from initial gluons distr
+ // TH1F *fHistMCnumberChildrenFromInitialProtonInEvent; //! MC children number from initial proton distr (check that there are 2)
+
+
+ // 4.01.2012: MyTree stuff
+ // AliSimpleEvent *fSimpleEvent; // instance of simple event to be filled in analysis loop
+ // Int_t fNsimpleEvents;
+ // TTree *fEventTree; //! event tree to write into output file
+ // Bool_t fSetIncludeEventTreeInOutput; // flag to use event tree or not
+
+ ClassDef(AliAnalysisTaskLRC, 11 );
+};
+
+#endif
-/**************************************************************************\r
- * Authors: Andrey Ivanov, Igor Altsybeev. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-// This class creates TH2D histogramms for Nch - Nch , Nch - Pt , Pt - Pt \r
-// dirtributions for given ETA windows and some supplementary data for Long Range Correlation (LRC) analysis . \r
-// Class is designid to work with AliAnalysisTaskLRC\r
-\r
-// Authors : Andrey Ivanov, Igor Altsybeev, St.Peterburg State University\r
-// Email: Igor.Altsybeev@cern.ch\r
-\r
-#include "Riostream.h"\r
-#include "AliLRCProcess.h"\r
-//#include "THnSparse.h"\r
-#include "TH1F.h"\r
-#include "TH1D.h"\r
-#include "TH2D.h"\r
-#include "TProfile.h"\r
-#include "TList.h"\r
-#include "TString.h"\r
-#include "TMath.h"\r
-//#include "TClonesArray.h"\r
-\r
-//#include <AliPID.h> //for particle mass only\r
-ClassImp(AliLRCProcess)\r
-\r
-//const bool useSparse = false;//false;\r
-//const bool useAccumulatingHist = true;//false;\r
-using std::endl;\r
-using std::cout;\r
-\r
-AliLRCProcess::AliLRCProcess():fIsEventOpend(kFALSE), fIsOnline(kFALSE), fDisplayInitOnDemandWarning(kTRUE)\r
- ,fUseSparse(false)\r
- ,fUseAccumulatingHist(true)\r
- ,fEventCount(0),fStartForwardETA(0), fEndForwardETA(0)\r
- ,fStartForwardPhi(0)\r
- ,fEndForwardPhi(0)\r
- ,fStartBackwardETA(0)\r
- ,fEndBackwardETA(0)\r
- ,fStartBackwardPhi(0)\r
- ,fEndBackwardPhi(0)\r
- ,fDoubleSidedBackwardPhiWindow(kFALSE)\r
- ,fHiPt(0)\r
- ,fLoPt(0)\r
- ,fHiMultHor(0)\r
- ,fLowMultHor(0)\r
- ,fHiMultVert(0)\r
- ,fLowMultVert(0)\r
- ,fMultBinsHor(0)\r
- ,fMultBinsVert(0)\r
- ,fPtBins(0)\r
- ,fPtHistXaxisRebinFactor(1)\r
- ,fSumPtFw(0)\r
- ,fSumPtBw(0)\r
- ,fSumPtBw2(0)\r
- ,fNchFw(0)\r
- ,fNchBw(0)\r
- ,fNchFwPlus(0)\r
- ,fNchBwPlus(0)\r
- ,fNchFwMinus(0)\r
- ,fNchBwMinus(0)\r
- ,fOutList(0), fShortDef(0),fOutputSlot(0), fHistPt(0),fHistEta(0),fHistClouds(0),fHistNN(0),fHistPtN(0),fHistPtPt(0),fProfNberr(0),fProfNberrPtPt(0),fProfdPtB(0),fProfTestLRC(0),fHistSparseDimensionLabeling(0),fHistSparsePIDblocksLabeling(0)\r
-\r
- ,fHistPtForward(0)\r
- ,fHistEtaForward(0)\r
- ,fHistNchForward(0)\r
- ,fHistNchForwardPtPt(0)\r
- ,fHistPhiForward(0)\r
- ,fHistTracksChargeForward(0)\r
- ,fHistPtPlusForward(0)\r
- ,fHistPtMinusForward(0)\r
- ,fHistNetChargeVsPtForward(0)\r
-\r
- ,fHistPtBackward(0)\r
- ,fHistEtaBackward(0)\r
- ,fHistNchBackward(0)\r
- ,fHistPhiBackward(0)\r
- ,fHistTracksChargeBackward(0)\r
- ,fHistPtPlusBackward(0)\r
- ,fHistPtMinusBackward(0)\r
- ,fHistNetChargeVsPtBackward(0)\r
-\r
- ,fArrAccumulatedValues(0)\r
- // ,fHistArrayLabeling(0)\r
- ,fEventCentrality(0)\r
- ,fHistNfCentrality(0)\r
- ,fHistTestPIDForward(0)\r
- ,fHistTestPIDBackward(0)\r
- ,fHistDifferenceNf(0)\r
- ,fHistDifferenceNb(0)\r
-\r
- ,fPidForward(-1)//kLRCany)\r
- ,fPidBackward(-1)//kLRCany)\r
- //,fWhichParticleToProcess(kLRCany)//kLRCany)\r
- //,fPidFillCondition(kLRCpidIgnored)\r
- //,fNumberOfSectors(1)\r
- //,fNeedToRotateSector(kFALSE)\r
-{\r
- //fWhichParticleToProcess = kLRCany; //default - all particle types\r
- //fPidFillCondition = kLRCpidIgnored;\r
- SetCorrespondanceWithAliROOTpid();\r
- ZeroPidArrays();\r
-}\r
-\r
-AliLRCProcess::AliLRCProcess(Double_t _StartForwardETA,Double_t _EndForwardETA,Double_t _StartBakwardETA,Double_t _EndBakwardETA ): fIsEventOpend(kFALSE), fIsOnline(kFALSE), fDisplayInitOnDemandWarning(kTRUE)\r
- ,fUseSparse(false)\r
- ,fUseAccumulatingHist(true)\r
- ,fEventCount(0),fStartForwardETA(0), fEndForwardETA(0), fStartForwardPhi(0),fEndForwardPhi(0),fStartBackwardETA(0), fEndBackwardETA(0),fStartBackwardPhi(0)\r
- ,fEndBackwardPhi(0)\r
- ,fDoubleSidedBackwardPhiWindow(kFALSE)\r
- ,fHiPt(0)\r
- ,fLoPt(0)\r
- ,fHiMultHor(0)\r
- ,fLowMultHor(0)\r
- ,fHiMultVert(0)\r
- ,fLowMultVert(0)\r
- ,fMultBinsHor(0)\r
- ,fMultBinsVert(0)\r
- ,fPtBins(0)\r
- ,fPtHistXaxisRebinFactor(1)\r
- ,fSumPtFw(0), fSumPtBw(0), fSumPtBw2(0),fNchFw(0)\r
- ,/*fNchFwPtPt(0),*/ fNchBw(0)\r
- ,fNchFwPlus(0)\r
- ,fNchBwPlus(0)\r
- ,fNchFwMinus(0)\r
- ,fNchBwMinus(0)\r
- ,fOutList(0), fShortDef(0),fOutputSlot(0), fHistPt(0),fHistEta(0),fHistClouds(0),fHistNN(0),fHistPtN(0),fHistPtPt(0),fProfNberr(0),fProfNberrPtPt(0),fProfdPtB(0),fProfTestLRC(0),fHistSparseDimensionLabeling(0),fHistSparsePIDblocksLabeling(0)\r
-\r
- ,fHistPtForward(0)\r
- ,fHistEtaForward(0)\r
- ,fHistNchForward(0)\r
- ,fHistNchForwardPtPt(0)\r
- ,fHistPhiForward(0)\r
- ,fHistTracksChargeForward(0)\r
- ,fHistPtPlusForward(0)\r
- ,fHistPtMinusForward(0)\r
- ,fHistNetChargeVsPtForward(0)\r
-\r
- ,fHistPtBackward(0)\r
- ,fHistEtaBackward(0)\r
- ,fHistNchBackward(0)\r
- ,fHistPhiBackward(0)\r
- ,fHistTracksChargeBackward(0)\r
- ,fHistPtPlusBackward(0)\r
- ,fHistPtMinusBackward(0)\r
- ,fHistNetChargeVsPtBackward(0)\r
-\r
- ,fArrAccumulatedValues(0)\r
- // ,fHistArrayLabeling(0)\r
- ,fEventCentrality(0)\r
- ,fHistNfCentrality(0)\r
- ,fHistTestPIDForward(0)\r
- ,fHistTestPIDBackward(0)\r
- ,fHistDifferenceNf(0)\r
- ,fHistDifferenceNb(0)\r
- ,fPidForward(-1)//kLRCany)\r
- ,fPidBackward(-1)//kLRCany)\r
- //,fWhichParticleToProcess(kLRCany)//kLRCany)\r
- //,fPidFillCondition(kLRCpidIgnored)\r
- //,fNumberOfSectors(1)\r
- //,fNeedToRotateSector(kFALSE)\r
-{\r
- // Constructor with window setup makes ready-to-run processor\r
- fEventCount=0;\r
-\r
- //fWhichParticleToProcess = kLRCany; //default - all particle types\r
- //fPidFillCondition = kLRCpidIgnored;\r
- \r
- //cout << "TEST" << endl;\r
- SetETAWindows( _StartForwardETA, _EndForwardETA,_StartBakwardETA,_EndBakwardETA);\r
- SetHistPtRange( 0.15, 1.5, 270 );\r
- SetHistMultRange( 0, 0, 100 );\r
- SetForwardWindowPhi( 0, 2*TMath::Pi() );\r
- SetBackwardWindowPhi( 0, 2*TMath::Pi() );\r
-\r
- SetCorrespondanceWithAliROOTpid();\r
- ZeroPidArrays();\r
-\r
- \r
-\r
-}\r
-\r
-Bool_t AliLRCProcess::InitDataMembers()\r
-{\r
- //Printf("INITDATAMEMBERS");\r
- // This method is actualy creating output histogramms\r
- // Thist method is to be called in CreateOutputObjects method of AliAnalysisTask\r
- //cout<<" # Init for "<<fShortDef<<" this="<<this<<"\n";\r
- if( fIsOnline )\r
- {\r
- Printf("Can't init data members more then one time! \n");\r
- return kFALSE;\r
- }\r
- fEventCount=0;\r
- fOutList = new TList();\r
- fOutList->SetOwner(); // IMPORTANT!\r
-\r
- fOutList->SetName(fShortDef);\r
-\r
- Double_t lowMultHor, hiMultHor;\r
- Double_t lowMultVert, hiMultVert;\r
-\r
- lowMultHor = fLowMultHor - 0.5;\r
- hiMultHor = fHiMultHor + 0.5;\r
-\r
- lowMultVert = fLowMultVert - 0.5;\r
- hiMultVert = fHiMultVert + 0.5;\r
-\r
-\r
- //TArray to accumulate data, with names hist\r
- //26.01.2013: array with accumulated values\r
- //fArrAccumulatedValues = new TClonesArray("Float_t", en_arr_labels_total );//TArrayF(en_arr_labels_total);\r
- if ( fUseAccumulatingHist )\r
- {\r
- fArrAccumulatedValues = new TH1D( "fArrAccumulatedValues", "Accumulating hist with labeling", en_arr_labels_total,-0.5,en_arr_labels_total-0.5);\r
- TString gArrayMemberNames[en_arr_labels_total];\r
- gArrayMemberNames[ en_arr_labels_NN_Nevents ] = "NN_Nevents" ;\r
- gArrayMemberNames[ en_arr_labels_NN_Nf ] = "NN_Nf" ;\r
- gArrayMemberNames[ en_arr_labels_NN_Nb ] = "NN_Nb" ;\r
- gArrayMemberNames[ en_arr_labels_NN_N2_f ] = "NN_N2_f" ;\r
- gArrayMemberNames[ en_arr_labels_NN_Nf_Nb ] = "NN_Nf_Nb" ;\r
- gArrayMemberNames[ en_arr_labels_NN_N2_b ] = "NN_N2_b" ;\r
-\r
- gArrayMemberNames[ en_arr_labels_PtN_Nevents ] = "PtN_Nevents" ;\r
- gArrayMemberNames[ en_arr_labels_PtN_Nf ] = "PtN_Nf" ;\r
- gArrayMemberNames[ en_arr_labels_PtN_PtB ] = "PtN_PtB" ;\r
- gArrayMemberNames[ en_arr_labels_PtN_N2_f ] = "PtN_N2_f" ;\r
- gArrayMemberNames[ en_arr_labels_PtN_Ptb_Nf ] = "PtN_Ptb_Nf" ;\r
-\r
- gArrayMemberNames[ en_arr_labels_PtPt_Nevents] = "PtPt_Nevents" ;\r
- gArrayMemberNames[ en_arr_labels_PtPt_PtF ] = "PtPt_PtF" ;\r
- gArrayMemberNames[ en_arr_labels_PtPt_PtB ] = "PtPt_PtB" ;\r
- gArrayMemberNames[ en_arr_labels_PtPt_Pt2_f ] = "PtPt_Pt2_f" ;\r
- gArrayMemberNames[ en_arr_labels_PtPt_Ptf_Ptb] = "PtPt_Ptf_Ptb" ;\r
-\r
- for( Int_t i = 1; i <= en_arr_labels_total; i++ )\r
- fArrAccumulatedValues->GetXaxis()->SetBinLabel(i,gArrayMemberNames[i-1].Data());\r
- //fOutList->Add(fArrAccumulatedValues);\r
- fOutList->Add(fArrAccumulatedValues);\r
- }\r
-\r
-\r
-\r
- \r
- // Window statistics histograms\r
-\r
- // ########## Forward\r
-\r
- fHistPtForward = new TH1D("fHistPtForward", "P_{T} distribution in Forward window", 100, 0.0, 5);\r
- fHistPtForward->GetXaxis()->SetTitle("P_{T} (GeV/c)");\r
- fHistPtForward->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");\r
- fHistPtForward->SetMarkerStyle(kFullCircle);\r
-\r
-\r
- fHistEtaForward = new TH1D("fEtaForward", "#eta distribution in Forward window", 200, -2, 2);\r
- fHistEtaForward->GetXaxis()->SetTitle("ETA");\r
- fHistEtaForward->GetYaxis()->SetTitle("dN/ETA");\r
- fHistEtaForward->SetMarkerStyle(kFullCircle);\r
-\r
- \r
- fHistNchForward = new TH1D("fHistNchForward", "N_{ch} distribution in Forward window", fMultBinsHor, lowMultHor, hiMultHor);\r
- fHistNchForward->GetXaxis()->SetTitle("N_{ch}");\r
- fHistNchForward->GetYaxis()->SetTitle("dN/dN_{ch}");\r
- fHistNchForward->SetMarkerStyle(kFullCircle);\r
-\r
- fHistNchForwardPtPt = new TH1D("fHistNchForwardPtPt", "N_{ch} distribution in Forward window for PtPt accept conditions", fMultBinsHor, lowMultHor, hiMultHor);\r
- fHistNchForwardPtPt->GetXaxis()->SetTitle("N_{ch}");\r
- fHistNchForwardPtPt->GetYaxis()->SetTitle("dN/dN_{ch}");\r
- fHistNchForwardPtPt->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPhiForward = new TH1D("fPhiForward", "#phi distribution in Forward window", 144, 0, 2*TMath::Pi());\r
- fHistPhiForward->GetXaxis()->SetTitle("Phi");\r
- fHistPhiForward->GetYaxis()->SetTitle("dN/Phi");\r
- fHistPhiForward->SetMarkerStyle(kFullCircle);\r
-\r
- fHistTestPIDForward = new TH1D("fHistTestPIDForward","PID distribution in Forward window;PID;N",5,-0.5,4.5);\r
- TString gBinParticleNames[5] = {/*"Other",*/"Electron","Muon","Pion","Kaon", "Proton"};\r
- for(Int_t i = 1; i <= 5; i++)\r
- fHistTestPIDForward->GetXaxis()->SetBinLabel(i,gBinParticleNames[i-1].Data());\r
-\r
- //15/12/2012: charge hist\r
- fHistTracksChargeForward = new TH1D("fHistTracksChargeForward","Accepted tracks charge;charge;Entries",3,-1.5,1.5);\r
-\r
-\r
- // ### net charge vs pt study (July 2013)\r
- const int kPtNetChargePtBins = 200;\r
- const double kPtNetChargePtMin = 0.1;\r
- const double kPtNetChargePtMax = 2.1;\r
-\r
- //pt plus\r
- fHistPtPlusForward = new TH1D("fHistPtPlusForward","p_{T} +;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );\r
- fOutList->Add(fHistPtPlusForward);\r
- //pt minus\r
- fHistPtMinusForward = new TH1D("fHistPtMinusForward","p_{T} -;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );\r
- fOutList->Add(fHistPtMinusForward);\r
- //net charge vs pT\r
- fHistNetChargeVsPtForward = new TH1D("fHistNetChargeVsPtForward","charge vs p_{T};p_{T};Q", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );\r
- fOutList->Add(fHistNetChargeVsPtForward);\r
-\r
-\r
- // ########## Backward\r
-\r
- fHistPtBackward = new TH1D("fHistPtBakward", "P_{T} distribution in Backward window", 100, 0.0, 5);\r
- fHistPtBackward->GetXaxis()->SetTitle("P_{T} (GeV/c)");\r
- fHistPtBackward->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");\r
- fHistPtBackward->SetMarkerStyle(kFullCircle);\r
-\r
-\r
- fHistEtaBackward = new TH1D("fEtaBakward", "#eta distribution in Backward window", 200, -2, 2);\r
- fHistEtaBackward->GetXaxis()->SetTitle("ETA");\r
- fHistEtaBackward->GetYaxis()->SetTitle("dN/ETA");\r
- fHistEtaBackward->SetMarkerStyle(kFullCircle);\r
-\r
-\r
- fHistNchBackward = new TH1D("fHistNchBakward", "N_{ch} distribution in Backward window", fMultBinsVert, lowMultVert, hiMultVert);\r
- fHistNchBackward->GetXaxis()->SetTitle("N_{ch}");\r
- fHistNchBackward->GetYaxis()->SetTitle("dN/dN_{ch}");\r
- fHistNchBackward->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPhiBackward = new TH1D("fPhiBakward", "#phi distribution in Backward window", 144, 0, 2*TMath::Pi());\r
- fHistPhiBackward->GetXaxis()->SetTitle("Phi");\r
- fHistPhiBackward->GetYaxis()->SetTitle("dN/Phi");\r
- fHistPhiBackward->SetMarkerStyle(kFullCircle);\r
-\r
- fHistTestPIDBackward = new TH1D("fHistTestPIDBackward","PID distribution in Backward window;PID;N",5,-0.5,4.5);\r
- for(Int_t i = 1; i <= 5; i++)\r
- fHistTestPIDBackward->GetXaxis()->SetBinLabel(i,gBinParticleNames[i-1].Data());\r
-\r
-\r
- //15/12/2012: charge hist\r
- fHistTracksChargeBackward = new TH1D("fHistTracksChargeBackward","Accepted tracks charge;charge;Entries",3,-1.5,1.5);\r
-\r
- // ### net charge vs pt study (July 2013)\r
- //pt plus\r
- fHistPtPlusBackward = new TH1D("fHistPtPlusBackward","p_{T} +;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );\r
- fOutList->Add(fHistPtPlusBackward);\r
- //pt minus\r
- fHistPtMinusBackward = new TH1D("fHistPtMinusBackward","p_{T} -;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );\r
- fOutList->Add(fHistPtMinusBackward);\r
- //net charge vs pT\r
- fHistNetChargeVsPtBackward = new TH1D("fHistNetChargeVsPtBackward","charge vs p_{T};p_{T};Q", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );\r
- fOutList->Add(fHistNetChargeVsPtBackward);\r
-\r
-\r
-\r
-\r
-\r
- //Overal statistics histograms\r
-\r
- fHistPt = new TH1F("fHistPt", "P_{T} distribution", 100, 0.0, 5.0);\r
- fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");\r
- fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");\r
- fHistPt->SetMarkerStyle(kFullCircle);\r
-\r
-\r
- fHistEta = new TH1F("fHistEta", "#eta distribution", 200, -2, 2);\r
- fHistEta->GetXaxis()->SetTitle("ETA");\r
- fHistEta->GetYaxis()->SetTitle("dN/ETA");\r
- fHistEta->SetMarkerStyle(kFullCircle);\r
- \r
- \r
- \r
- // -------- LRC histograms\r
- //new cloud implementation\r
- //const int lSparseDim = en_sparse_total;\r
- //const int nSparseBins = 1000;\r
-\r
-\r
- /* from AliROOT //deprecated!\r
- enum EParticleType {\r
- kElectron = 0,\r
- kMuon = 1,\r
- kPion = 2,\r
- kKaon = 3,\r
- kProton = 4,\r
- kPhoton = 5,\r
- kPi0 = 6,\r
- kNeutron = 7,\r
- kKaon0 = 8,\r
- kEleCon = 9,\r
- kDeuteron = 10,\r
- kTriton = 11,\r
- kHe3 = 12,\r
- kAlpha = 13,\r
- kUnknown = 14\r
- };*/\r
-\r
-\r
- if ( fUseSparse )\r
- {\r
-\r
- //correspondance of PID blocks\r
- //it's a way to unlink THnSparse data dimenstion from enum\r
- fHistSparsePIDblocksLabeling = new TH1D("fHistSparsePIDblocksLabeling","THnSparse PID blocks labeling", kSparsePIDtotal,-0.5,kSparsePIDtotal-0.5);\r
- TString gEventCutBinPIDblocksNames[kSparsePIDtotal]; // = {"Total","No trigger","Centrality","No vertex","Bad vertex position","HighMult cut","LowMult cut","Analyzed"};\r
- gEventCutBinPIDblocksNames[kSparsePIDany] = "any";\r
- gEventCutBinPIDblocksNames[kSparsePIDdefined] = "defined";\r
- gEventCutBinPIDblocksNames[kSparsePIDpion] = "pion";\r
- gEventCutBinPIDblocksNames[kSparsePIDkaon] = "kaon";\r
- gEventCutBinPIDblocksNames[kSparsePIDproton] = "proton";\r
-\r
-\r
- for(Int_t i = 1; i <= kSparsePIDtotal; i++)fHistSparsePIDblocksLabeling->GetXaxis()->SetBinLabel(i,gEventCutBinPIDblocksNames[i-1].Data());\r
- //for(Int_t i = 0; i < nEnumBins; i++)fHistSparseDimensionLabeling->Fill( i );\r
-\r
- //dimensions labelling\r
-\r
- fHistSparseDimensionLabeling = new TH1D("fHistSparseDimensionLabeling","THnSparse labeling", kSparseTotal,-0.5,kSparseTotal-0.5);\r
- TString gSparseDimensionsNames[kSparseTotal]; // = {"Total","No trigger","Centrality","No vertex","Bad vertex position","HighMult cut","LowMult cut","Analyzed"};\r
- gSparseDimensionsNames[kSparseNf] = "N_f";\r
- gSparseDimensionsNames[kSparseNb] = "N_b";\r
- gSparseDimensionsNames[kSparsePtF] = "Pt_f";\r
- gSparseDimensionsNames[kSparsePtB] = "Pt_b";\r
- gSparseDimensionsNames[en_sparse_N2_f] = "N2_f";\r
- gSparseDimensionsNames[en_sparse_Nf_Nb] = "Nf_Nb";\r
- gSparseDimensionsNames[en_sparse_Ptb_Nf] = "Ptb_Nf";\r
- gSparseDimensionsNames[en_sparse_Pt2_f] = "Pt2_f";\r
- gSparseDimensionsNames[en_sparse_Ptf_Ptb] = "Ptf_Ptb";\r
-\r
- for( Int_t i = 1; i <= kSparseTotal; i++ )\r
- fHistSparseDimensionLabeling->GetXaxis()->SetBinLabel(i,gSparseDimensionsNames[i-1].Data());\r
-\r
-\r
-\r
- Int_t* lSparseBins = new Int_t[kSparseTotal*kSparsePIDtotal];\r
- Double_t *lSparseXmin = new Double_t[kSparseTotal*kSparsePIDtotal];\r
- Double_t *lSparseXmax = new Double_t[kSparseTotal*kSparsePIDtotal];\r
- TString *lSparseAxisNames = new TString[kSparseTotal*kSparsePIDtotal];\r
-\r
- TString *lPIDNames = new TString[kSparsePIDtotal];\r
- lPIDNames[ kSparsePIDany ] = Form( "any" );\r
- lPIDNames[ kSparsePIDdefined ] = Form( "defined" );\r
- lPIDNames[ kSparsePIDpion ] = Form( "pion" );\r
- lPIDNames[ kSparsePIDkaon ] = Form( "kaon" );\r
- lPIDNames[ kSparsePIDproton ] = Form( "proton" );\r
-\r
-\r
-\r
- for ( Int_t d = 0; d < kSparsePIDtotal; ++d )\r
- {\r
- Int_t binShift = kSparseTotal*d;\r
-\r
- lSparseAxisNames[kSparseNf + binShift] = Form( "axisNf_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[kSparseNb + binShift] = Form( "axisNb_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[kSparsePtF + binShift] = Form( "axisPtf_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[kSparsePtB + binShift] = Form( "axisPtb_%s", lPIDNames[ d ].Data() );\r
-\r
- lSparseAxisNames[en_sparse_N2_f + binShift] = Form( "axisN2_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[en_sparse_Nf_Nb + binShift] = Form( "axisNf_Nb_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[en_sparse_Ptb_Nf + binShift] = Form( "axisPtb_Nf_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[en_sparse_Pt2_f + binShift] = Form( "axisPt2_f_%s", lPIDNames[ d ].Data() );\r
- lSparseAxisNames[en_sparse_Ptf_Ptb + binShift] = Form( "axisPtf_Ptb_%s", lPIDNames[ d ].Data() );\r
-\r
-\r
- lSparseBins[kSparseNf + binShift ] = fMultBinsHor;\r
- lSparseXmin[kSparseNf + binShift ] = lowMultHor;\r
- lSparseXmax[kSparseNf + binShift ] = hiMultHor;\r
- lSparseBins[kSparseNb + binShift ] = fMultBinsVert;\r
- lSparseXmin[kSparseNb + binShift ] = lowMultVert;\r
- lSparseXmax[kSparseNb + binShift ] = hiMultVert;\r
- //}\r
- //for (Int_t d = 2; d < lSparseDim; ++d) {\r
- lSparseBins[kSparsePtF + binShift ] = fPtBins;\r
- lSparseXmin[kSparsePtF + binShift ] = fLoPt;\r
- lSparseXmax[kSparsePtF + binShift ] = fHiPt;\r
- lSparseBins[kSparsePtB + binShift ] = fPtBins;\r
- lSparseXmin[kSparsePtB + binShift ] = fLoPt;\r
- lSparseXmax[kSparsePtB + binShift ] = fHiPt;\r
-\r
-\r
-\r
-\r
-\r
- //}\r
- /*\r
- lSparseBins[en_sparse_Et_f + binShift ] = 500;\r
- lSparseXmin[en_sparse_Et_f + binShift ] = 0.2;\r
- lSparseXmax[en_sparse_Et_f + binShift ] = 2.7;\r
- lSparseBins[en_sparse_Et_b + binShift ] = 500;\r
- lSparseXmin[en_sparse_Et_b + binShift ] = 0.2;\r
- lSparseXmax[en_sparse_Et_b + binShift ] = 2.7;\r
-*/\r
-\r
- lSparseBins[en_sparse_N2_f + binShift ] = (fMultBinsHor-1)*(fMultBinsHor-1)+1;\r
- lSparseXmin[en_sparse_N2_f + binShift ] = fLowMultHor*fLowMultHor-0.5; // ! use global mult without shift\r
- lSparseXmax[en_sparse_N2_f + binShift ] = fHiMultHor*fHiMultHor+0.5;\r
- //lSparseBins[en_sparse_N_b] = fMultBinsVert;\r
- //lSparseXmin[en_sparse_N_b] = lowMultVert;\r
- //lSparseXmax[en_sparse_N_b] = hiMultVert;\r
- lSparseBins[en_sparse_Nf_Nb + binShift ] = (fMultBinsHor-1)*(fMultBinsVert-1)+1;\r
- lSparseXmin[en_sparse_Nf_Nb + binShift ] = fLowMultHor*fLowMultVert-0.5;\r
- lSparseXmax[en_sparse_Nf_Nb + binShift ] = fHiMultHor*fHiMultVert+0.5;\r
-\r
-\r
-\r
- lSparseBins[en_sparse_Ptb_Nf + binShift ] = /*(fMultBinsHor-1)**/(10*fPtBins);//+1;\r
- lSparseXmin[en_sparse_Ptb_Nf + binShift ] = fLowMultHor*fLoPt-0.5;\r
- lSparseXmax[en_sparse_Ptb_Nf + binShift ] = fHiMultHor*fHiPt+0.5;\r
-\r
- lSparseBins[en_sparse_Pt2_f + binShift ] = (10*fPtBins);//*(fPtBins);//+1;\r
- lSparseXmin[en_sparse_Pt2_f + binShift ] = fLoPt*fLoPt;\r
- lSparseXmax[en_sparse_Pt2_f + binShift ] = fHiPt*fHiPt;\r
-\r
- lSparseBins[en_sparse_Ptf_Ptb + binShift ] = (10*fPtBins);//*(fPtBins)+1;\r
- lSparseXmin[en_sparse_Ptf_Ptb + binShift ] = fLoPt*fLoPt;\r
- lSparseXmax[en_sparse_Ptf_Ptb + binShift ] = fHiPt*fHiPt;\r
-\r
- /*\r
- lSparseBins[en_sparse_Nf_plus + binShift ] = fMultBinsHor;\r
- lSparseXmin[en_sparse_Nf_plus + binShift ] = lowMultHor;\r
- lSparseXmax[en_sparse_Nf_plus + binShift ] = hiMultHor;\r
- lSparseBins[en_sparse_Nf_minus + binShift ] = fMultBinsHor;\r
- lSparseXmin[en_sparse_Nf_minus + binShift ] = lowMultHor;\r
- lSparseXmax[en_sparse_Nf_minus + binShift ] = hiMultHor;\r
-\r
- lSparseBins[en_sparse_Nb_plus + binShift ] = fMultBinsVert;\r
- lSparseXmin[en_sparse_Nb_plus + binShift ] = lowMultVert;\r
- lSparseXmax[en_sparse_Nb_plus + binShift ] = hiMultVert;\r
- lSparseBins[en_sparse_Nb_minus + binShift ] = fMultBinsVert;\r
- lSparseXmin[en_sparse_Nb_minus + binShift ] = lowMultVert;\r
- lSparseXmax[en_sparse_Nb_minus + binShift ] = hiMultVert;\r
-\r
- lSparseBins[en_sparse_Nf_plus_Nb_minus + binShift ] = (fMultBinsHor-1)*(fMultBinsVert-1)+1;\r
- lSparseXmin[en_sparse_Nf_plus_Nb_minus + binShift ] = fLowMultHor*fLowMultVert-0.5;\r
- lSparseXmax[en_sparse_Nf_plus_Nb_minus + binShift ] = fHiMultHor*fHiMultVert+0.5;\r
-\r
- lSparseBins[en_sparse_Nb_plus_Nf_minus + binShift ] = (fMultBinsHor-1)*(fMultBinsVert-1);\r
- lSparseXmin[en_sparse_Nb_plus_Nf_minus + binShift ] = fLowMultHor*fLowMultVert-0.5;\r
- lSparseXmax[en_sparse_Nb_plus_Nf_minus + binShift ] = fHiMultHor*fHiMultVert+0.5;\r
- */\r
- }\r
-\r
- fHistClouds = new THnSparseD("cloudLRC", "cloudLRC", kSparseTotal*kSparsePIDtotal, lSparseBins, lSparseXmin, lSparseXmax);\r
- //end of cloud implementation\r
-\r
- //set axis names\r
- TAxis *lSparseAxis = 0x0;\r
- for ( Int_t d = 0; d < kSparseTotal*kSparsePIDtotal; ++d )\r
- {\r
- lSparseAxis = fHistClouds->GetAxis( d );\r
- lSparseAxis->SetNameTitle( lSparseAxisNames[d], lSparseAxisNames[d] );\r
- }\r
-\r
-\r
- delete [] lSparseBins;\r
- delete [] lSparseXmin;\r
- delete [] lSparseXmax;\r
- delete [] lSparseAxisNames;\r
-\r
-\r
- fOutList->Add(fHistSparseDimensionLabeling);\r
- fOutList->Add(fHistSparsePIDblocksLabeling);\r
-\r
- // bool useSparse = false;\r
-\r
- // !!!!!! temp comment!\r
- fOutList->Add(fHistClouds);\r
- }\r
-\r
-\r
- fHistNN = new TH2D("NN","NN",fMultBinsHor, lowMultHor, hiMultHor,fMultBinsVert, lowMultVert, hiMultVert );\r
- fHistPtN = new TH2D("PtN","PtN",fMultBinsHor, lowMultHor, hiMultHor,fPtBins/* /fPtHistXaxisRebinFactor*/,fLoPt,fHiPt);\r
- fHistPtPt = new TH2D("PtPt","PtPt",fPtBins/fPtHistXaxisRebinFactor,fLoPt,fHiPt,fPtBins,fLoPt,fHiPt);\r
- fProfNberr = new TProfile("nber","nber",fMultBinsHor, lowMultHor, hiMultHor);\r
- fProfNberrPtPt = new TProfile("nberPtPt","nberPtPt",fPtBins/fPtHistXaxisRebinFactor,fLoPt,fHiPt);\r
- fProfdPtB = new TProfile("dPtB","Overal multievent Pt_Backward (first bin) Pt_Backward^2 (sec. bin) ",16,0.5,16.5);\r
- fProfTestLRC = new TProfile("TestLRC","Test LRC calculaion via TProfile",fMultBinsHor, lowMultHor, hiMultHor);\r
-\r
- fHistNfCentrality = new TH2D("NfCentrality","NfCentrality",fMultBinsHor, lowMultHor, hiMultHor,101,-1.01,100.01);\r
- fHistDifferenceNf = new TH2D("fHistDifferenceNf","Hist nF-nB;nF;nF-nB",fMultBinsHor, lowMultHor, hiMultHor,fMultBinsHor,-hiMultHor,hiMultHor);\r
- fHistDifferenceNb = new TH2D("fHistDifferenceNb","Hist nB-nF;nB;nB-nF",fMultBinsVert, lowMultVert, hiMultVert,fMultBinsVert,-hiMultVert,hiMultVert);\r
-\r
- // ---------- Adding data members to output list\r
-\r
- // Adding overal statistics\r
-\r
- //commented: to save memory\r
- //fOutList->Add(fHistPt);\r
- //fOutList->Add(fHistEta);\r
-\r
- //Adding LRC hists\r
-\r
- \r
- if (1)\r
- {\r
- fOutList->Add(fHistNN);\r
- fOutList->Add(fHistPtN);\r
- fOutList->Add(fHistPtPt);\r
- }\r
- fOutList->Add(fProfNberr);\r
- fOutList->Add(fProfNberrPtPt);\r
- fOutList->Add(fProfdPtB);\r
- fOutList->Add(fProfTestLRC);\r
-\r
-\r
- //Adding window statistics\r
- \r
-\r
-\r
- fOutList->Add(fHistNchForward);\r
- fOutList->Add(fHistNchBackward);\r
- fOutList->Add(fHistNchForwardPtPt);\r
-\r
- fOutList->Add(fHistPtForward);\r
- fOutList->Add(fHistPtBackward);\r
-\r
- fOutList->Add(fHistEtaForward);\r
- fOutList->Add(fHistEtaBackward);\r
-\r
- fOutList->Add(fHistPhiForward);\r
- fOutList->Add(fHistPhiBackward);\r
-\r
- fOutList->Add(fHistTracksChargeForward);\r
- fOutList->Add(fHistTracksChargeBackward);\r
-\r
- fOutList->Add(fHistTestPIDForward);\r
- fOutList->Add(fHistTestPIDBackward);\r
-\r
- // fOutList->Add(fHistNfCentrality);\r
- \r
- \r
- //fOutList->Add(fHistDifferenceNf);\r
- //fOutList->Add(fHistDifferenceNb);\r
-\r
- // Adding status to dPtB\r
-\r
- fProfdPtB->Fill(3 , fStartForwardETA);\r
- fProfdPtB->Fill(4 , fEndForwardETA);\r
- fProfdPtB->Fill(5 , fStartBackwardETA);\r
- fProfdPtB->Fill(6 , fEndBackwardETA);\r
- fProfdPtB->Fill(7 , fStartForwardPhi);\r
- fProfdPtB->Fill(8 , fEndForwardPhi);\r
- fProfdPtB->Fill(9 , fStartBackwardPhi);\r
- fProfdPtB->Fill(10 , fEndBackwardPhi);\r
-\r
-\r
-\r
-\r
- fIsOnline = kTRUE;\r
- return kTRUE;\r
-}\r
-AliLRCProcess::~AliLRCProcess()\r
-{\r
- //Destructor\r
-\r
-}\r
-\r
-// --------------------------------------- Setters ------------------\r
-void AliLRCProcess::SetShortDef()\r
-{\r
- // Creating task and output container name\r
- char str[200];\r
- snprintf(str,200, "TaskLRCw%3.1fto%3.1fvs%3.1fto%3.1f",fStartForwardETA,fEndForwardETA,fStartBackwardETA,fEndBackwardETA);\r
- /*if ( fWhichParticleToProcess != kLRCany\r
- && (int)fWhichParticleToProcess > 0 && (int)fWhichParticleToProcess <= 6 ) //to avoid program falling\r
- {\r
- char str2[80];\r
- TString gBinParticleNames[6] = {"Other","Electron","Muon","Pion","Kaon", "Proton"};\r
- snprintf(str2,80, "%s_%s",str,gBinParticleNames[(int)fWhichParticleToProcess].Data());\r
- fShortDef= str2;\r
- }\r
- else*/\r
- fShortDef= str;\r
-\r
-}\r
-\r
-void AliLRCProcess::SetForwardWindow(Double_t StartETA,Double_t EndETA)\r
-{\r
- //setter for the forward eta window\r
- fStartForwardETA=StartETA;\r
- fEndForwardETA=EndETA;\r
- SetShortDef();\r
-}\r
-void AliLRCProcess::SetBackwardWindow(Double_t StartETA,Double_t EndETA)\r
-{\r
- //setter for the backward eta window\r
- fStartBackwardETA=StartETA;\r
- fEndBackwardETA=EndETA;\r
- SetShortDef();\r
-}\r
-void AliLRCProcess::SetETAWindows(Double_t _StartForwardETA,Double_t _EndForwardETA,Double_t _StartBakwardETA,Double_t _EndBakwardETA)\r
-{\r
- //setter for the eta windows\r
- fStartForwardETA=_StartForwardETA;\r
- fEndForwardETA=_EndForwardETA;\r
- fStartBackwardETA=_StartBakwardETA;\r
- fEndBackwardETA=_EndBakwardETA;\r
- SetShortDef();\r
-}\r
-void AliLRCProcess::GetETAWindows(Double_t &_StartForwardETA,Double_t &_EndForwardETA,Double_t &_StartBakwardETA,Double_t &_EndBakwardETA)\r
-{\r
- //getter for the eta windows\r
- _StartForwardETA = fStartForwardETA;\r
- _EndForwardETA = fEndForwardETA;\r
- _StartBakwardETA = fStartBackwardETA;\r
- _EndBakwardETA = fEndBackwardETA;\r
-}\r
-\r
-void AliLRCProcess::GetPhiWindows(Double_t &_StartForwardPhi,Double_t &_EndForwardPhi,Double_t &_StartBakwardPhi,Double_t &_EndBakwardPhi)\r
-{\r
- //getter for the eta windows\r
- _StartForwardPhi = fStartForwardPhi;\r
- _EndForwardPhi = fEndForwardPhi;\r
- _StartBakwardPhi = fStartBackwardPhi;\r
- _EndBakwardPhi = fEndBackwardPhi;\r
-}\r
-\r
-void AliLRCProcess::SetParticleType( char* strForwardOrBackward, char* strPid )\r
-{\r
- //cout << "hm! strForwardOrBackward = " << strForwardOrBackward\r
- // << ", strPid = " << strPid << endl;\r
- //cout << "before ae! fPidForward = " << fPidForward << ", fPidBackward = " << fPidBackward << endl;\r
-\r
- int lPid = -1;//kLRCany;\r
- if ( !strcmp( strPid, "pion") )\r
- lPid = 2;//kLRCpion;\r
- else if ( !strcmp( strPid, "kaon") )\r
- lPid = 3;//kLRCkaon;\r
- else if ( !strcmp( strPid, "proton") )\r
- lPid = 4;//kLRCproton;\r
- else if ( !strcmp( strPid, "knownpid") )\r
- lPid = 100;//will will histos if we KNOW PID! (not important which)\r
-\r
- //set pid for window\r
- if ( !strcmp( strForwardOrBackward, "fwd") )\r
- fPidForward = lPid;\r
- else if ( !strcmp( strForwardOrBackward, "bkwd") )\r
- fPidBackward = lPid;\r
- //cout << "ae! lPid = " << lPid << ", fPidForward = " << fPidForward << ", fPidBackward = " << fPidBackward << endl;\r
- //int aaaa;\r
- //cin>> aaaa;\r
-}\r
-\r
-\r
-void AliLRCProcess::SetHistPtRangeForwardWindowRebinFactor( Int_t ptHistXaxisRebinFactor )\r
-{\r
- // Rebining for Pt histograms X-axis\r
- if(fIsOnline)\r
- {\r
- Printf("Can't change histos paramiters after InitDataMembers() was called! \n");\r
- return ;\r
- }\r
- fPtHistXaxisRebinFactor = ptHistXaxisRebinFactor;\r
-}\r
-\r
-void AliLRCProcess::SetHistPtRange(Double_t LoPt,Double_t HiPt,Int_t PtBins)\r
-{\r
- // Sets Pt range and number of bins for Pt axis of histos\r
- if(fIsOnline)\r
- {\r
- Printf("Can't change histos paramiters after InitDataMembers() was called! \n");\r
- return ;\r
- }\r
- // Setter for Pt range and N bins in histos\r
- fLoPt=LoPt;\r
- fHiPt=HiPt;\r
- fPtBins=PtBins;\r
-}\r
-void AliLRCProcess::SetHistMultRange( Int_t whichWindow, Int_t LoMult,Int_t HiMult,Int_t MultBins)\r
-{\r
- // Setter for multiplicity range and N bins in histos\r
- if ( whichWindow == 0 ) //set range for both windows\r
- {\r
- SetHistMultRangeHor( LoMult, HiMult, MultBins) ;\r
- SetHistMultRangeVert( LoMult, HiMult, MultBins) ;\r
- }\r
- else if ( whichWindow == 1 ) //for fwd\r
- SetHistMultRangeHor( LoMult, HiMult, MultBins) ;\r
- else if ( whichWindow == 2 ) //for bwd\r
- SetHistMultRangeVert( LoMult, HiMult, MultBins) ;\r
- /*\r
-\r
- if(fIsOnline)\r
- {\r
- Printf("Can't change histos paramiters after InitDataMembers() was called! \n");\r
- return ;\r
- }\r
- fLoMult=LoMult;\r
- fHiMult=HiMult;\r
- if(!MultBins)\r
- {\r
- fMultBins=fHiMult-fLoMult+1;\r
- }else\r
- {\r
- fMultBins=MultBins;\r
- }*/\r
-}\r
-\r
-void AliLRCProcess::SetHistMultRangeHor(Int_t LoMult,Int_t HiMult,Int_t MultBins)\r
-{\r
- // Setter for multiplicity range and N bins in histos\r
- if(fIsOnline)\r
- {\r
- Printf("Can't change histos paramiters after InitDataMembers() was called! \n");\r
- return ;\r
- }\r
- fLowMultHor = LoMult;\r
- fHiMultHor = HiMult;\r
- if(!MultBins)\r
- {\r
- fMultBinsHor = fHiMultHor-fLowMultHor+1;\r
- }else\r
- {\r
- fMultBinsHor = MultBins;\r
- }\r
-}\r
-\r
-void AliLRCProcess::SetHistMultRangeVert(Int_t LoMult,Int_t HiMult,Int_t MultBins)\r
-{\r
- // Setter for multiplicity range and N bins in histos\r
- if(fIsOnline)\r
- {\r
- Printf("Can't change histos parameters after InitDataMembers() was called! \n");\r
- return ;\r
- }\r
- fLowMultVert = LoMult;\r
- fHiMultVert = HiMult;\r
- if(!MultBins)\r
- {\r
- fMultBinsVert = fHiMultVert-fLowMultVert+1;\r
- }else\r
- {\r
- fMultBinsVert = MultBins;\r
- }\r
-}\r
-\r
-void AliLRCProcess::SetOutputSlotNumber(Int_t SlotNumber)\r
-{\r
- //Sets number of output slot for LRCProcessor\r
- fOutputSlot=SlotNumber;\r
-}\r
-\r
-//________________________________________________________________________\r
-\r
-\r
-\r
-TList* AliLRCProcess::CreateOutput() const\r
-{\r
- // Creates a link to output data TList\r
- return fOutList;\r
-}\r
-\r
-TString AliLRCProcess::GetShortDef() const\r
-{\r
- return fShortDef;\r
-}\r
-\r
-Int_t AliLRCProcess::GetOutputSlotNumber() const\r
-{\r
- // Returns number of output slot for LRCProcessor\r
- return fOutputSlot;\r
-}\r
-\r
-void AliLRCProcess::StartEvent()\r
-{\r
- // Open new Event for track by track event import\r
- if(fIsEventOpend) // Check if trying to open event more than once !\r
- {\r
- Printf("Event is already opened! Auto finishing ! \n");\r
-// cout<<fShortDef<<": event count = "<<fEventCount<<" ";\r
- Printf("NchF = %i,NchB = %i \n",fNchFw,fNchBw);\r
-\r
- FinishEvent();\r
- }\r
- if(!fIsOnline) // Autocreating histos if InitDataMembers was not called by hand\r
- {\r
- Printf("InitDataMembers was not called by hand ! Autocreating histos...\n");\r
- InitDataMembers();\r
- }\r
-\r
- fNchFw=0;\r
- fSumPtFw=0;\r
- fNchBw=0;\r
- fSumPtBw=0;\r
- fSumPtBw2=0;\r
- \r
- fNchFwPlus = 0;\r
- fNchBwPlus = 0;\r
- fNchFwMinus = 0;\r
- fNchBwMinus = 0;\r
- \r
- ZeroPidArrays();\r
- \r
- //fNchFwPtPt = 0;\r
-\r
- fIsEventOpend=kTRUE;\r
-}\r
-void AliLRCProcess::AddTrackForward(Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )\r
-{\r
- // Imports track to the event directly to Forward window\r
- if(!fIsEventOpend)\r
- {Printf("Event is not opened!\n");\r
- return;}\r
-\r
- //Bool_t lAddDecision = kFALSE;\r
-\r
- //if ( fPidForward == 100 ) //add particle if we know pid (i.e. particleType != -1)\r
- //{\r
- //if ( particleType != -1 )\r
- //{\r
- // lAddDecision = kTRUE;\r
- //cout << "fill fwd with pid " << particleType << endl;\r
- //}\r
- //}\r
- //else if ( fPidForward != -1 ) //if we specify pid for this window - just check it\r
- //{\r
- //if ( particleType == fPidForward )\r
- //{\r
- //lAddDecision = kTRUE;\r
- //cout << "fill fwd with pid " << particleType << endl;\r
- //}\r
- //}\r
- //else\r
- //lAddDecision = kTRUE;\r
-\r
- //if ( !lAddDecision )\r
- //return;\r
-\r
- fHistTestPIDForward->Fill( particleType );\r
-\r
- fNchFw++;\r
- Charge > 0 ? fNchFwPlus++ : fNchFwMinus++;\r
- fSumPtFw+=Pt;\r
- fHistPtForward->Fill(Pt);\r
- fHistEtaForward->Fill(Eta);\r
- fHistPhiForward->Fill(Phi);\r
-\r
- //added 15.12.12\r
- fHistTracksChargeForward->Fill(Charge);\r
- \r
- //added 23.03\r
- for ( int pid = 0; pid < kSparsePIDtotal; pid++ )\r
- {\r
- if ( pid == kSparsePIDany //write ALL pid types\r
- ||\r
- ( pid == kSparsePIDdefined && particleType != -1 ) //write defined particles\r
- ||\r
- ( fCorrespondanceWithAliROOTpid[pid] == particleType ) //write not defined particles\r
- )\r
- {\r
- fNchFwPID[pid]++;\r
- Charge > 0 ? fNchFwPlusPID[pid]++ : fNchFwMinusPID[pid]++;\r
- fSumPtFwPID[pid] += Pt;\r
- if ( pid != kSparsePIDany )\r
- {\r
- Double_t lMass = 0;//AliPID::ParticleMass( particleType );\r
- fSumEtFwPID[pid] += sqrt( Pt*Pt + lMass*lMass ) ;\r
- }\r
- }\r
- }\r
-\r
- //netcharge part (July 2013)\r
- fHistNetChargeVsPtForward->Fill( Pt, Charge );\r
- if ( Charge > 0 )\r
- fHistPtPlusForward->Fill( Pt );\r
- else if ( Charge < 0 )\r
- fHistPtMinusForward->Fill( Pt );\r
-\r
-\r
-}\r
-void AliLRCProcess::AddTrackBackward(Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )\r
-{\r
- // Imports track to the event directly to Backward window\r
- if(!fIsEventOpend)\r
- {Printf("Event is not opened!\n");\r
- return;}\r
-\r
- /*Bool_t lAddDecision = kFALSE;\r
-\r
- if ( fPidBackward == 100 ) //add particle if we know pid (i.e. particleType != -1)\r
- {\r
- if ( particleType != -1 )\r
- {\r
- lAddDecision = kTRUE;\r
- //cout << "fill fwd with pid " << particleType << endl;\r
- }\r
- }\r
- else if ( fPidBackward != -1 ) //if we specify pid for this window - just check it\r
- {\r
- if ( particleType == fPidBackward )\r
- {\r
- lAddDecision = kTRUE;\r
- //cout << "fill fwd with pid " << particleType << endl;\r
- }\r
- }\r
- else\r
- lAddDecision = kTRUE;\r
-\r
- if ( !lAddDecision )\r
- return;\r
- */\r
- fHistTestPIDBackward->Fill( particleType );\r
-\r
- fNchBw++;\r
- Charge > 0 ? fNchBwPlus++ : fNchBwMinus++;\r
- fSumPtBw += Pt;\r
- fSumPtBw2 += Pt*Pt;\r
- fProfdPtB->Fill( 1, Pt );\r
- fProfdPtB->Fill( 2, Pt*Pt );\r
- fHistPtBackward->Fill( Pt );\r
- fHistEtaBackward->Fill( Eta );\r
- fHistPhiBackward->Fill( Phi );\r
-\r
- //added 15.12.12\r
- fHistTracksChargeBackward->Fill(Charge);\r
-\r
- //added 23.03\r
- for ( int pid = 0; pid < kSparsePIDtotal; pid++ )\r
- {\r
- if ( pid == kSparsePIDany //write ALL pid types\r
- ||\r
- ( pid == kSparsePIDdefined && particleType != -1 ) //write defined particles\r
- ||\r
- ( fCorrespondanceWithAliROOTpid[pid] == particleType )\r
- )\r
- {\r
- fNchBwPID[pid]++;\r
- Charge > 0 ? fNchBwPlusPID[pid]++ : fNchBwMinusPID[pid]++;\r
- fSumPtBwPID[pid] += Pt;\r
- if ( pid != kSparsePIDany )\r
- {\r
- Double_t lMass = 0;//AliPID::ParticleMass( particleType );\r
- fSumEtBwPID[pid] += sqrt( Pt*Pt + lMass*lMass ) ;\r
- }\r
- \r
- }\r
- }\r
-\r
- //netcharge part (July 2013)\r
- fHistNetChargeVsPtBackward->Fill( Pt, Charge );\r
- if ( Charge > 0 )\r
- fHistPtPlusBackward->Fill( Pt );\r
- else if ( Charge < 0 )\r
- fHistPtMinusBackward->Fill( Pt );\r
-\r
-}\r
-\r
-\r
-\r
-void AliLRCProcess::AddTrackPtEta(Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )\r
-{\r
- //cout << Pt << endl;\r
-\r
-\r
- //if particle type is different - ignore the track\r
- //if ( fWhichParticleToFill != -1 && ParticleType != fWhichParticleToFill )\r
- // return;\r
- //Track by track event import : Imports track to the event\r
-\r
- //cout << "fWhichParticleToProcess = " << fWhichParticleToProcess\r
- // << ", particleType = " << particleType << endl;\r
- if(!fIsEventOpend)\r
- {Printf("Event is not opened!\n");\r
- return;}\r
-\r
- // Global track data\r
- fHistPt->Fill(Pt);\r
- fHistEta->Fill(Eta);\r
-\r
- //Bool_t lAddForwardDecision = kFALSE;\r
- //Bool_t lAddBackwardDecision = kFALSE;\r
-\r
- //Forward window\r
- if( ( fStartForwardETA < Eta ) && ( Eta < fEndForwardETA ) )\r
- if( IsPhiInRange( Phi, fStartForwardPhi, fEndForwardPhi) )//( fStartForwardPhi < Phi ) && ( Phi < fEndForwardPhi ) )\r
- {\r
- AddTrackForward( Pt, Eta, Phi, Charge, particleType );\r
- //if ( fPidFillCondition == kLRCpidForForwardOnly\r
- // || fPidFillCondition == kLRCpidForBoth )\r
- //if ( fPidForward != -1 )//kLRCany )\r
- //{\r
- // if ( particleType == fPidForward )//kLRCpion )//particleType )\r
- // {\r
- // lAddForwardDecision = kTRUE;//AddTrackForward( Pt, Eta, Phi );\r
- //cout << "fill fwd with pid " << particleType << endl;\r
- // }\r
- //}\r
- //else\r
- // lAddForwardDecision = kTRUE;//AddTrackForward( Pt, Eta, Phi );\r
- }\r
- //if ( lAddForwardDecision )\r
- //{\r
- // AddTrackForward( Pt, Eta, Phi, particleType );\r
- // fHistTestPIDForward->Fill( particleType );\r
- //}\r
-\r
- //Backward window\r
- if( ( fStartBackwardETA < Eta ) && ( Eta < fEndBackwardETA ) )\r
- if (\r
- (\r
- IsPhiInRange( Phi, fStartBackwardPhi, fEndBackwardPhi) //( fStartBackwardPhi < Phi ) && ( Phi < fEndBackwardPhi )\r
- )\r
- ||\r
- (\r
- fDoubleSidedBackwardPhiWindow //if this option is true\r
- && IsPhiInRange( Phi, fStartBackwardPhi + TMath::Pi(), fEndBackwardPhi + TMath::Pi() ) //\r
- //&& ( fStartBackwardPhi + TMath::Pi() < Phi )\r
- //&& ( Phi < fEndBackwardPhi + TMath::Pi() )\r
- )\r
- )\r
- {\r
- AddTrackBackward( Pt, Eta, Phi, Charge, particleType );\r
- //if ( fPidFillCondition == kLRCpidForBackwardOnly\r
- // || fPidFillCondition == kLRCpidForBoth )\r
- //if ( fPidBackward != -1 )//kLRCany )\r
- //{\r
- // if ( particleType == fPidBackward )//kLRCpion )//particleType )\r
- // {\r
- // lAddBackwardDecision = kTRUE;//AddTrackBackward( Pt, Eta, Phi );\r
- //cout << "fill bkwd with pid " << particleType << endl;\r
- // }\r
-\r
- //}\r
- //else\r
- // lAddBackwardDecision = kTRUE;//AddTrackBackward( Pt, Eta, Phi );\r
- }\r
- //if ( lAddBackwardDecision )\r
- //{\r
- // AddTrackBackward( Pt, Eta, Phi, particleType );\r
- // fHistTestPIDBackward->Fill( particleType );\r
- //}\r
-\r
-}\r
-\r
-\r
-\r
-void AliLRCProcess::AddTrackPtEtaMixing( Int_t winFB, Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )\r
-{\r
- // put track in F or B window using varible winFB\r
- if(!fIsEventOpend)\r
- {\r
- Printf("Event is not opened!\n");\r
- return;\r
- }\r
-\r
- // Global track data\r
- fHistPt->Fill(Pt);\r
- fHistEta->Fill(Eta);\r
-\r
-\r
- //Forward window\r
- if( winFB == 0\r
- && ( fStartForwardETA < Eta ) && ( Eta < fEndForwardETA ) )\r
- if( IsPhiInRange( Phi, fStartForwardPhi, fEndForwardPhi) ) // (fStartForwardPhi < Phi ) && ( Phi < fEndForwardPhi ) )\r
- {\r
- AddTrackForward( Pt, Eta, Phi, Charge, particleType );\r
- }\r
-\r
- //Backward window\r
- if( winFB == 1\r
- && ( fStartBackwardETA < Eta ) && ( Eta < fEndBackwardETA ) )\r
- if (\r
- (\r
- IsPhiInRange( Phi, fStartBackwardPhi, fEndBackwardPhi) //( fStartBackwardPhi < Phi ) && ( Phi < fEndBackwardPhi )\r
- )\r
- ||\r
- (\r
- fDoubleSidedBackwardPhiWindow //if this option is true\r
- && IsPhiInRange( Phi, fStartBackwardPhi + TMath::Pi(), fEndBackwardPhi + TMath::Pi() )\r
- //&& ( fStartBackwardPhi + TMath::Pi() < Phi )\r
- //&& ( Phi < fEndBackwardPhi + TMath::Pi() )\r
- )\r
- )\r
- {\r
- AddTrackBackward( Pt, Eta, Phi, Charge, particleType );\r
- }\r
-\r
-\r
-}\r
-\r
-void AliLRCProcess::FinishEvent(Bool_t kDontCount)\r
-{\r
- // Track by track event import : Close opened event and fill event summary histos\r
-\r
- if(!fIsEventOpend)\r
- {\r
- Printf("Event is not opened!\n");\r
- return;\r
- }\r
- if ( kDontCount ) //don't count this event! just ignore it\r
- {\r
- fIsEventOpend = kFALSE;\r
- return;\r
- }\r
- //fHistSparseDimensionLabeling->Fill(1);\r
- //Filling even-total data\r
- //cout << "filling" << endl;\r
- /*Double_t lCloudData[en_sparse_total*en_sparse_PID_total];\r
- lCloudData[en_sparse_N_f] = fNchFw; //write Nf\r
- lCloudData[en_sparse_N_b] = fNchBw; //write Nb\r
- lCloudData[en_sparse_N2_f] = fNchFw*fNchFw; //write Nf^2\r
- lCloudData[en_sparse_Nf_Nb] = fNchFw*fNchBw; //write Nb\r
- \r
- lCloudData[en_sparse_Pt_f] = 0; //fill bin 0, if don't have appropriate PtSum\r
- lCloudData[en_sparse_Pt_b] = 0; //fill bin 0, if don't have appropriate PtSum\r
-\r
- lCloudData[en_sparse_Nf_plus] = fNchFwPlus;\r
- lCloudData[en_sparse_Nf_minus] = fNchFwMinus;\r
- lCloudData[en_sparse_Nb_plus] = fNchBwPlus;\r
- lCloudData[en_sparse_Nb_minus] = fNchBwMinus;\r
- lCloudData[en_sparse_Nf_plus_Nb_minus] = fNchFwPlus * fNchBwMinus;\r
- lCloudData[en_sparse_Nb_plus_Nf_minus] = fNchBwPlus * fNchFwMinus; */\r
- \r
- fHistNN->Fill(fNchFw,fNchBw);\r
-\r
- if ( fUseAccumulatingHist )\r
- {\r
- fArrAccumulatedValues->Fill( en_arr_labels_NN_Nevents, 1 );\r
- fArrAccumulatedValues->Fill( en_arr_labels_NN_Nf , fNchFw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_NN_Nb , fNchBw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_NN_N2_f , fNchFw*fNchFw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_NN_Nf_Nb , fNchFw*fNchBw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_NN_N2_b , fNchBw*fNchBw );\r
- }\r
-\r
- if( fNchBw != 0 )\r
- {\r
- fSumPtBw = fSumPtBw / fNchBw;\r
- //lCloudData[en_sparse_Pt_b] = fSumPtBw; //write <PtB>\r
- fProfTestLRC->Fill( fNchFw, fSumPtBw );\r
- fHistPtN->Fill( fNchFw, fSumPtBw );\r
- //cout << "fill PtN: fNchFw = " << fNchFw << ", fSumPtBw=" << fSumPtBw << endl;\r
- fProfNberr->Fill(fNchFw, 1.0 / fNchBw);\r
-\r
- if ( fUseAccumulatingHist )\r
- {\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtN_Nevents, 1 );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtN_Nf , fNchFw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtN_PtB , fSumPtBw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtN_N2_f , fNchFw*fNchFw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtN_Ptb_Nf , fSumPtBw*fNchFw );\r
- }\r
-\r
- if( fNchFw != 0 )\r
- {\r
- fSumPtFw = fSumPtFw / fNchFw;\r
- //lCloudData[en_sparse_Pt_f] = fSumPtFw; //write <PtF>\r
- fHistPtPt->Fill( fSumPtFw, fSumPtBw );\r
- fProfNberrPtPt->Fill( fSumPtFw, 1.0 / fNchBw );\r
- // dPtB for PtPt\r
- fProfdPtB->Fill( 15, fSumPtBw, fNchBw );\r
- fProfdPtB->Fill( 16, fSumPtBw2 / fNchBw, fNchBw );\r
- fHistNchForwardPtPt->Fill(fNchFw);\r
-\r
- if ( fUseAccumulatingHist )\r
- {\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtPt_Nevents, 1 );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtPt_PtF , fSumPtFw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtPt_PtB , fSumPtBw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtPt_Pt2_f , fSumPtFw*fSumPtFw );\r
- fArrAccumulatedValues->Fill( en_arr_labels_PtPt_Ptf_Ptb, fSumPtBw*fSumPtFw );\r
- }\r
-\r
- }\r
- }\r
-\r
-\r
-\r
-\r
-\r
- if ( fUseSparse )\r
- {\r
- Double_t lCloudData[kSparseTotal*kSparsePIDtotal];\r
-\r
- for (Int_t d = 0; d < kSparsePIDtotal; ++d)\r
- {\r
- Int_t binShift = kSparseTotal*d; //step over dimension set\r
-\r
- lCloudData[kSparseNf + binShift ] = fNchFwPID[d]; //write Nf\r
- lCloudData[kSparseNb + binShift ] = fNchBwPID[d]; //write Nb\r
- lCloudData[en_sparse_N2_f + binShift ] = fNchFwPID[d]*fNchFwPID[d]; //write Nf^2\r
- lCloudData[en_sparse_Nf_Nb + binShift ] = fNchFwPID[d]*fNchBwPID[d]; //write Nb\r
-\r
- lCloudData[kSparsePtF + binShift ] = 0; //fill bin 0, if don't have appropriate PtSum\r
- lCloudData[kSparsePtB + binShift ] = 0; //fill bin 0, if don't have appropriate PtSum\r
-\r
- lCloudData[en_sparse_Ptb_Nf + binShift ] = 0;\r
- lCloudData[en_sparse_Pt2_f + binShift ] = 0;\r
- lCloudData[en_sparse_Ptf_Ptb + binShift ] = 0;\r
-\r
-\r
- if( fNchBwPID[d] != 0 )\r
- {\r
- double lSumPtBwPID = fSumPtBwPID[d] / fNchBwPID[d];\r
- lCloudData[kSparsePtB + binShift ] = lSumPtBwPID; //write <PtB>\r
-\r
- fSumEtBwPID[d] = fSumEtBwPID[d] / fNchBwPID[d];\r
- //lCloudData[en_sparse_Et_b + binShift ] = fSumEtBwPID[d]; //write <PtB>\r
- lCloudData[en_sparse_Ptb_Nf + binShift ] = lSumPtBwPID * fNchFwPID[d];\r
-\r
- //fProfTestLRC->Fill( fNchFw, fSumPtBw );\r
- //fHistPtN->Fill( fNchFw, fSumPtBw );\r
- //cout << "fill PtN: fNchFw = " << fNchFw << ", fSumPtBw=" << fSumPtBw << endl;\r
-\r
- //fProfNberr->Fill(fNchFw, 1.0 / fNchBw);\r
-\r
-\r
- if( fNchFwPID[d] != 0 )\r
- {\r
- double lSumPtFwPID = fSumPtFwPID[d] / fNchFwPID[d];\r
- lCloudData[kSparsePtF + binShift ] = lSumPtFwPID; //write <PtF>\r
-\r
- fSumEtFwPID[d] = fSumEtFwPID[d] / fNchFwPID[d];\r
-\r
- lCloudData[en_sparse_Pt2_f + binShift ] = lSumPtFwPID * lSumPtFwPID;\r
- lCloudData[en_sparse_Ptf_Ptb + binShift ] = lSumPtFwPID*lSumPtBwPID;\r
-\r
- //lCloudData[en_sparse_Et_f + binShift ] = fSumEtFwPID[d]; //write <PtF>\r
- //fHistPtPt->Fill( fSumPtFw, fSumPtBw );\r
- //fProfNberrPtPt->Fill( fSumPtFw, 1.0 / fNchBw );\r
- // dPtB for PtPt\r
- //fProfdPtB->Fill( 15, fSumPtBw, fNchBw );\r
- //fProfdPtB->Fill( 16, fSumPtBw2 / fNchBw, fNchBw );\r
- //fHistNchForwardPtPt->Fill(fNchFw);\r
-\r
- }\r
- }\r
- /*\r
- lCloudData[en_sparse_Nf_plus + binShift ] = fNchFwPlusPID[d];\r
- lCloudData[en_sparse_Nf_minus + binShift ] = fNchFwMinusPID[d];\r
- lCloudData[en_sparse_Nb_plus + binShift ] = fNchBwPlusPID[d];\r
- lCloudData[en_sparse_Nb_minus + binShift ] = fNchBwMinusPID[d];\r
- lCloudData[en_sparse_Nf_plus_Nb_minus + binShift ] = fNchFwPlusPID[d] * fNchBwMinusPID[d];\r
- lCloudData[en_sparse_Nb_plus_Nf_minus + binShift ] = fNchBwPlusPID[d] * fNchFwMinusPID[d];\r
- */\r
- }\r
-\r
- //tmp (22.03): fill pid with fignya data\r
- /* for (Int_t d = 1; d < en_sparse_PID_total; ++d)\r
- {\r
- Int_t binShift = en_sparse_total*d;\r
- lCloudData[en_sparse_N_f + binShift ] = 1+d; //write Nf\r
- lCloudData[en_sparse_N_b + binShift ] = 2+d; //write Nb\r
- lCloudData[en_sparse_N2_f + binShift ] = 3+d; //write Nf^2\r
- lCloudData[en_sparse_Nf_Nb + binShift ] = 4+d; //write Nb\r
-\r
- lCloudData[en_sparse_Pt_f + binShift ] = 5+d; //fill bin 0, if don't have appropriate PtSum\r
- lCloudData[en_sparse_Pt_b + binShift ] = 6+d; //fill bin 0, if don't have appropriate PtSum\r
-\r
- lCloudData[en_sparse_Nf_plus + binShift ] = 7+d;\r
- lCloudData[en_sparse_Nf_minus + binShift ] = 8+d;\r
- lCloudData[en_sparse_Nb_plus + binShift ] = 9+d;\r
- lCloudData[en_sparse_Nb_minus + binShift ] = 10+d;\r
- lCloudData[en_sparse_Nf_plus_Nb_minus + binShift ] = 11+d;\r
- lCloudData[en_sparse_Nb_plus_Nf_minus + binShift ] = 12+d;\r
- }\r
- */\r
-\r
- // cout << "before filling" << endl;\r
- fHistClouds->Fill( lCloudData ); //fill sparse hist with Nf, Nb, <PtF>, <PtB>\r
- // cout << "filled." << endl;\r
- }\r
-\r
-\r
-\r
-\r
- //additional info-hist\r
- if ( fNchFw > 0 || fNchBw > 0 )\r
- {\r
- Double_t lAvMult = ( fNchFw + fNchBw ) / 2.;\r
- fHistDifferenceNf->Fill( fNchFw, ( fNchFw-fNchBw ) / lAvMult );\r
- fHistDifferenceNb->Fill( fNchBw, ( fNchBw-fNchFw ) / lAvMult);\r
- }\r
-\r
- //cout << "n particles: " << fNchFw << " , Back = " << fNchBw << endl;\r
- //cout << "fHistNN: " << fHistNN->GetEntries() << endl;\r
- //cout << "mean= " << fHistNN->GetMean() << endl;\r
-\r
-\r
- fHistNchForward->Fill(fNchFw);\r
- fHistNchBackward->Fill(fNchBw);\r
-\r
- fEventCount++;\r
- fIsEventOpend = kFALSE;\r
- \r
- //fill nf-centr plot\r
- fHistNfCentrality->Fill( fNchFw, fEventCentrality );\r
- \r
- //cout<<fShortDef<<": event count = "<<fEventCount<<" ";\r
- // Printf("NchF = %i,NchB = %i",fNchFw,fNchBw);\r
-}\r
-\r
-Bool_t AliLRCProcess::IsPhiInRange( Double_t phi, Double_t phiBoundMin, Double_t phiBoundMax )\r
-{\r
- if ( ( phiBoundMin < phi ) && ( phi < phiBoundMax ) )\r
- return kTRUE;\r
-\r
- //when bound is more than 2pi - check phi+2pi!\r
- phi += 2 * TMath::Pi();\r
- if ( ( phiBoundMin < phi ) && ( phi < phiBoundMax ) )\r
- return kTRUE;\r
-\r
- return kFALSE; //phi not in range\r
-}\r
-\r
-void AliLRCProcess::SetCorrespondanceWithAliROOTpid()\r
-{\r
- fCorrespondanceWithAliROOTpid[kSparsePIDany] = kSparsePIDany;\r
- fCorrespondanceWithAliROOTpid[kSparsePIDdefined] = -1000;\r
- fCorrespondanceWithAliROOTpid[kSparsePIDpion] = 2;\r
- fCorrespondanceWithAliROOTpid[kSparsePIDkaon] = 3;\r
- fCorrespondanceWithAliROOTpid[kSparsePIDproton] = 4;\r
-}\r
-\r
-void AliLRCProcess::ZeroPidArrays()\r
-{\r
- //added 23.03\r
- for ( int pid = 0; pid < kSparsePIDtotal; pid++ )\r
- {\r
- fNchFwPID[pid] = 0;\r
- fNchFwPlusPID[pid] = 0;\r
- fNchFwMinusPID[pid] = 0;\r
- fSumPtFwPID[pid] = 0;\r
- fSumEtFwPID[pid] = 0;\r
-\r
- fNchBwPID[pid] = 0;\r
- fNchBwPlusPID[pid] = 0;\r
- fNchBwMinusPID[pid] = 0;\r
- fSumPtBwPID[pid] = 0;\r
- fSumEtBwPID[pid] = 0;\r
- }\r
-}\r
+/**************************************************************************
+ * Authors: Andrey Ivanov, Igor Altsybeev. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// This class creates TH2D histogramms for Nch - Nch , Nch - Pt , Pt - Pt
+// dirtributions for given ETA windows and some supplementary data for Long Range Correlation (LRC) analysis .
+// Class is designid to work with AliAnalysisTaskLRC
+
+// Authors : Andrey Ivanov, Igor Altsybeev, St.Peterburg State University
+// Email: Igor.Altsybeev@cern.ch
+
+#include "Riostream.h"
+#include "AliLRCProcess.h"
+//#include "THnSparse.h"
+#include "TH1F.h"
+#include "TH1D.h"
+#include "TH2D.h"
+#include "TProfile.h"
+#include "TList.h"
+#include "TString.h"
+#include "TMath.h"
+//#include "TClonesArray.h"
+
+//#include <AliPID.h> //for particle mass only
+ClassImp(AliLRCProcess)
+
+//const bool useSparse = false;//false;
+//const bool useAccumulatingHist = true;//false;
+using std::endl;
+using std::cout;
+
+AliLRCProcess::AliLRCProcess():fIsEventOpend(kFALSE), fIsOnline(kFALSE), fDisplayInitOnDemandWarning(kTRUE)
+ ,fUseSparse(false)
+ ,fUseAccumulatingHist(true)
+ ,fEventCount(0),fStartForwardETA(0), fEndForwardETA(0)
+ ,fStartForwardPhi(0)
+ ,fEndForwardPhi(0)
+ ,fStartBackwardETA(0)
+ ,fEndBackwardETA(0)
+ ,fStartBackwardPhi(0)
+ ,fEndBackwardPhi(0)
+ ,fDoubleSidedBackwardPhiWindow(kFALSE)
+ ,fHiPt(0)
+ ,fLoPt(0)
+ ,fHiMultHor(0)
+ ,fLowMultHor(0)
+ ,fHiMultVert(0)
+ ,fLowMultVert(0)
+ ,fMultBinsHor(0)
+ ,fMultBinsVert(0)
+ ,fPtBins(0)
+ ,fPtHistXaxisRebinFactor(1)
+ ,fSumPtFw(0)
+ ,fSumPtBw(0)
+ ,fSumPtBw2(0)
+ ,fNchFw(0)
+ ,fNchBw(0)
+ ,fNchFwPlus(0)
+ ,fNchBwPlus(0)
+ ,fNchFwMinus(0)
+ ,fNchBwMinus(0)
+ ,fOutList(0), fShortDef(0),fOutputSlot(0), fHistPt(0),fHistEta(0),fHistClouds(0),fHistNN(0),fHistPtN(0),fHistPtPt(0),fProfNberr(0),fProfNberrPtPt(0),fProfdPtB(0),fProfTestLRC(0),fHistSparseDimensionLabeling(0),fHistSparsePIDblocksLabeling(0)
+
+ ,fHistPtForward(0)
+ ,fHistEtaForward(0)
+ ,fHistNchForward(0)
+ ,fHistNchForwardPtPt(0)
+ ,fHistPhiForward(0)
+ ,fHistTracksChargeForward(0)
+ ,fHistPtPlusForward(0)
+ ,fHistPtMinusForward(0)
+ ,fHistNetChargeVsPtForward(0)
+
+ ,fHistPtBackward(0)
+ ,fHistEtaBackward(0)
+ ,fHistNchBackward(0)
+ ,fHistPhiBackward(0)
+ ,fHistTracksChargeBackward(0)
+ ,fHistPtPlusBackward(0)
+ ,fHistPtMinusBackward(0)
+ ,fHistNetChargeVsPtBackward(0)
+
+ ,fArrAccumulatedValues(0)
+ // ,fHistArrayLabeling(0)
+ ,fEventCentrality(0)
+ ,fHistNfCentrality(0)
+ ,fHistTestPIDForward(0)
+ ,fHistTestPIDBackward(0)
+ ,fHistDifferenceNf(0)
+ ,fHistDifferenceNb(0)
+
+ ,fPidForward(-1)//kLRCany)
+ ,fPidBackward(-1)//kLRCany)
+ //,fWhichParticleToProcess(kLRCany)//kLRCany)
+ //,fPidFillCondition(kLRCpidIgnored)
+ //,fNumberOfSectors(1)
+ //,fNeedToRotateSector(kFALSE)
+{
+ //fWhichParticleToProcess = kLRCany; //default - all particle types
+ //fPidFillCondition = kLRCpidIgnored;
+ SetCorrespondanceWithAliROOTpid();
+ ZeroPidArrays();
+}
+
+AliLRCProcess::AliLRCProcess(Double_t _StartForwardETA,Double_t _EndForwardETA,Double_t _StartBakwardETA,Double_t _EndBakwardETA ): fIsEventOpend(kFALSE), fIsOnline(kFALSE), fDisplayInitOnDemandWarning(kTRUE)
+ ,fUseSparse(false)
+ ,fUseAccumulatingHist(true)
+ ,fEventCount(0),fStartForwardETA(0), fEndForwardETA(0), fStartForwardPhi(0),fEndForwardPhi(0),fStartBackwardETA(0), fEndBackwardETA(0),fStartBackwardPhi(0)
+ ,fEndBackwardPhi(0)
+ ,fDoubleSidedBackwardPhiWindow(kFALSE)
+ ,fHiPt(0)
+ ,fLoPt(0)
+ ,fHiMultHor(0)
+ ,fLowMultHor(0)
+ ,fHiMultVert(0)
+ ,fLowMultVert(0)
+ ,fMultBinsHor(0)
+ ,fMultBinsVert(0)
+ ,fPtBins(0)
+ ,fPtHistXaxisRebinFactor(1)
+ ,fSumPtFw(0), fSumPtBw(0), fSumPtBw2(0),fNchFw(0)
+ ,/*fNchFwPtPt(0),*/ fNchBw(0)
+ ,fNchFwPlus(0)
+ ,fNchBwPlus(0)
+ ,fNchFwMinus(0)
+ ,fNchBwMinus(0)
+ ,fOutList(0), fShortDef(0),fOutputSlot(0), fHistPt(0),fHistEta(0),fHistClouds(0),fHistNN(0),fHistPtN(0),fHistPtPt(0),fProfNberr(0),fProfNberrPtPt(0),fProfdPtB(0),fProfTestLRC(0),fHistSparseDimensionLabeling(0),fHistSparsePIDblocksLabeling(0)
+
+ ,fHistPtForward(0)
+ ,fHistEtaForward(0)
+ ,fHistNchForward(0)
+ ,fHistNchForwardPtPt(0)
+ ,fHistPhiForward(0)
+ ,fHistTracksChargeForward(0)
+ ,fHistPtPlusForward(0)
+ ,fHistPtMinusForward(0)
+ ,fHistNetChargeVsPtForward(0)
+
+ ,fHistPtBackward(0)
+ ,fHistEtaBackward(0)
+ ,fHistNchBackward(0)
+ ,fHistPhiBackward(0)
+ ,fHistTracksChargeBackward(0)
+ ,fHistPtPlusBackward(0)
+ ,fHistPtMinusBackward(0)
+ ,fHistNetChargeVsPtBackward(0)
+
+ ,fArrAccumulatedValues(0)
+ // ,fHistArrayLabeling(0)
+ ,fEventCentrality(0)
+ ,fHistNfCentrality(0)
+ ,fHistTestPIDForward(0)
+ ,fHistTestPIDBackward(0)
+ ,fHistDifferenceNf(0)
+ ,fHistDifferenceNb(0)
+ ,fPidForward(-1)//kLRCany)
+ ,fPidBackward(-1)//kLRCany)
+ //,fWhichParticleToProcess(kLRCany)//kLRCany)
+ //,fPidFillCondition(kLRCpidIgnored)
+ //,fNumberOfSectors(1)
+ //,fNeedToRotateSector(kFALSE)
+{
+ // Constructor with window setup makes ready-to-run processor
+ fEventCount=0;
+
+ //fWhichParticleToProcess = kLRCany; //default - all particle types
+ //fPidFillCondition = kLRCpidIgnored;
+
+ //cout << "TEST" << endl;
+ SetETAWindows( _StartForwardETA, _EndForwardETA,_StartBakwardETA,_EndBakwardETA);
+ SetHistPtRange( 0.15, 1.5, 270 );
+ SetHistMultRange( 0, 0, 100 );
+ SetForwardWindowPhi( 0, 2*TMath::Pi() );
+ SetBackwardWindowPhi( 0, 2*TMath::Pi() );
+
+ SetCorrespondanceWithAliROOTpid();
+ ZeroPidArrays();
+
+
+
+}
+
+Bool_t AliLRCProcess::InitDataMembers()
+{
+ //Printf("INITDATAMEMBERS");
+ // This method is actualy creating output histogramms
+ // Thist method is to be called in CreateOutputObjects method of AliAnalysisTask
+ //cout<<" # Init for "<<fShortDef<<" this="<<this<<"\n";
+ if( fIsOnline )
+ {
+ Printf("Can't init data members more then one time! \n");
+ return kFALSE;
+ }
+ fEventCount=0;
+ fOutList = new TList();
+ fOutList->SetOwner(); // IMPORTANT!
+
+ fOutList->SetName(fShortDef);
+
+ Double_t lowMultHor, hiMultHor;
+ Double_t lowMultVert, hiMultVert;
+
+ lowMultHor = fLowMultHor - 0.5;
+ hiMultHor = fHiMultHor + 0.5;
+
+ lowMultVert = fLowMultVert - 0.5;
+ hiMultVert = fHiMultVert + 0.5;
+
+
+ //TArray to accumulate data, with names hist
+ //26.01.2013: array with accumulated values
+ //fArrAccumulatedValues = new TClonesArray("Float_t", en_arr_labels_total );//TArrayF(en_arr_labels_total);
+ if ( fUseAccumulatingHist )
+ {
+ fArrAccumulatedValues = new TH1D( "fArrAccumulatedValues", "Accumulating hist with labeling", en_arr_labels_total,-0.5,en_arr_labels_total-0.5);
+ TString gArrayMemberNames[en_arr_labels_total];
+ gArrayMemberNames[ en_arr_labels_NN_Nevents ] = "NN_Nevents" ;
+ gArrayMemberNames[ en_arr_labels_NN_Nf ] = "NN_Nf" ;
+ gArrayMemberNames[ en_arr_labels_NN_Nb ] = "NN_Nb" ;
+ gArrayMemberNames[ en_arr_labels_NN_N2_f ] = "NN_N2_f" ;
+ gArrayMemberNames[ en_arr_labels_NN_Nf_Nb ] = "NN_Nf_Nb" ;
+ gArrayMemberNames[ en_arr_labels_NN_N2_b ] = "NN_N2_b" ;
+
+ gArrayMemberNames[ en_arr_labels_PtN_Nevents ] = "PtN_Nevents" ;
+ gArrayMemberNames[ en_arr_labels_PtN_Nf ] = "PtN_Nf" ;
+ gArrayMemberNames[ en_arr_labels_PtN_PtB ] = "PtN_PtB" ;
+ gArrayMemberNames[ en_arr_labels_PtN_N2_f ] = "PtN_N2_f" ;
+ gArrayMemberNames[ en_arr_labels_PtN_Ptb_Nf ] = "PtN_Ptb_Nf" ;
+
+ gArrayMemberNames[ en_arr_labels_PtPt_Nevents] = "PtPt_Nevents" ;
+ gArrayMemberNames[ en_arr_labels_PtPt_PtF ] = "PtPt_PtF" ;
+ gArrayMemberNames[ en_arr_labels_PtPt_PtB ] = "PtPt_PtB" ;
+ gArrayMemberNames[ en_arr_labels_PtPt_Pt2_f ] = "PtPt_Pt2_f" ;
+ gArrayMemberNames[ en_arr_labels_PtPt_Ptf_Ptb] = "PtPt_Ptf_Ptb" ;
+
+ for( Int_t i = 1; i <= en_arr_labels_total; i++ )
+ fArrAccumulatedValues->GetXaxis()->SetBinLabel(i,gArrayMemberNames[i-1].Data());
+ //fOutList->Add(fArrAccumulatedValues);
+ fOutList->Add(fArrAccumulatedValues);
+ }
+
+
+
+
+ // Window statistics histograms
+
+ // ########## Forward
+
+ fHistPtForward = new TH1D("fHistPtForward", "P_{T} distribution in Forward window", 100, 0.0, 5);
+ fHistPtForward->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+ fHistPtForward->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+ fHistPtForward->SetMarkerStyle(kFullCircle);
+
+
+ fHistEtaForward = new TH1D("fEtaForward", "#eta distribution in Forward window", 200, -2, 2);
+ fHistEtaForward->GetXaxis()->SetTitle("ETA");
+ fHistEtaForward->GetYaxis()->SetTitle("dN/ETA");
+ fHistEtaForward->SetMarkerStyle(kFullCircle);
+
+
+ fHistNchForward = new TH1D("fHistNchForward", "N_{ch} distribution in Forward window", fMultBinsHor, lowMultHor, hiMultHor);
+ fHistNchForward->GetXaxis()->SetTitle("N_{ch}");
+ fHistNchForward->GetYaxis()->SetTitle("dN/dN_{ch}");
+ fHistNchForward->SetMarkerStyle(kFullCircle);
+
+ fHistNchForwardPtPt = new TH1D("fHistNchForwardPtPt", "N_{ch} distribution in Forward window for PtPt accept conditions", fMultBinsHor, lowMultHor, hiMultHor);
+ fHistNchForwardPtPt->GetXaxis()->SetTitle("N_{ch}");
+ fHistNchForwardPtPt->GetYaxis()->SetTitle("dN/dN_{ch}");
+ fHistNchForwardPtPt->SetMarkerStyle(kFullCircle);
+
+ fHistPhiForward = new TH1D("fPhiForward", "#phi distribution in Forward window", 144, 0, 2*TMath::Pi());
+ fHistPhiForward->GetXaxis()->SetTitle("Phi");
+ fHistPhiForward->GetYaxis()->SetTitle("dN/Phi");
+ fHistPhiForward->SetMarkerStyle(kFullCircle);
+
+ fHistTestPIDForward = new TH1D("fHistTestPIDForward","PID distribution in Forward window;PID;N",5,-0.5,4.5);
+ TString gBinParticleNames[5] = {/*"Other",*/"Electron","Muon","Pion","Kaon", "Proton"};
+ for(Int_t i = 1; i <= 5; i++)
+ fHistTestPIDForward->GetXaxis()->SetBinLabel(i,gBinParticleNames[i-1].Data());
+
+ //15/12/2012: charge hist
+ fHistTracksChargeForward = new TH1D("fHistTracksChargeForward","Accepted tracks charge;charge;Entries",3,-1.5,1.5);
+
+
+ // ### net charge vs pt study (July 2013)
+ const int kPtNetChargePtBins = 200;
+ const double kPtNetChargePtMin = 0.1;
+ const double kPtNetChargePtMax = 2.1;
+
+ //pt plus
+ fHistPtPlusForward = new TH1D("fHistPtPlusForward","p_{T} +;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );
+ fOutList->Add(fHistPtPlusForward);
+ //pt minus
+ fHistPtMinusForward = new TH1D("fHistPtMinusForward","p_{T} -;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );
+ fOutList->Add(fHistPtMinusForward);
+ //net charge vs pT
+ fHistNetChargeVsPtForward = new TH1D("fHistNetChargeVsPtForward","charge vs p_{T};p_{T};Q", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );
+ fOutList->Add(fHistNetChargeVsPtForward);
+
+
+ // ########## Backward
+
+ fHistPtBackward = new TH1D("fHistPtBakward", "P_{T} distribution in Backward window", 100, 0.0, 5);
+ fHistPtBackward->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+ fHistPtBackward->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+ fHistPtBackward->SetMarkerStyle(kFullCircle);
+
+
+ fHistEtaBackward = new TH1D("fEtaBakward", "#eta distribution in Backward window", 200, -2, 2);
+ fHistEtaBackward->GetXaxis()->SetTitle("ETA");
+ fHistEtaBackward->GetYaxis()->SetTitle("dN/ETA");
+ fHistEtaBackward->SetMarkerStyle(kFullCircle);
+
+
+ fHistNchBackward = new TH1D("fHistNchBakward", "N_{ch} distribution in Backward window", fMultBinsVert, lowMultVert, hiMultVert);
+ fHistNchBackward->GetXaxis()->SetTitle("N_{ch}");
+ fHistNchBackward->GetYaxis()->SetTitle("dN/dN_{ch}");
+ fHistNchBackward->SetMarkerStyle(kFullCircle);
+
+ fHistPhiBackward = new TH1D("fPhiBakward", "#phi distribution in Backward window", 144, 0, 2*TMath::Pi());
+ fHistPhiBackward->GetXaxis()->SetTitle("Phi");
+ fHistPhiBackward->GetYaxis()->SetTitle("dN/Phi");
+ fHistPhiBackward->SetMarkerStyle(kFullCircle);
+
+ fHistTestPIDBackward = new TH1D("fHistTestPIDBackward","PID distribution in Backward window;PID;N",5,-0.5,4.5);
+ for(Int_t i = 1; i <= 5; i++)
+ fHistTestPIDBackward->GetXaxis()->SetBinLabel(i,gBinParticleNames[i-1].Data());
+
+
+ //15/12/2012: charge hist
+ fHistTracksChargeBackward = new TH1D("fHistTracksChargeBackward","Accepted tracks charge;charge;Entries",3,-1.5,1.5);
+
+ // ### net charge vs pt study (July 2013)
+ //pt plus
+ fHistPtPlusBackward = new TH1D("fHistPtPlusBackward","p_{T} +;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );
+ fOutList->Add(fHistPtPlusBackward);
+ //pt minus
+ fHistPtMinusBackward = new TH1D("fHistPtMinusBackward","p_{T} -;p_{T};dN/dpT", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );
+ fOutList->Add(fHistPtMinusBackward);
+ //net charge vs pT
+ fHistNetChargeVsPtBackward = new TH1D("fHistNetChargeVsPtBackward","charge vs p_{T};p_{T};Q", kPtNetChargePtBins, kPtNetChargePtMin, kPtNetChargePtMax );
+ fOutList->Add(fHistNetChargeVsPtBackward);
+
+
+
+
+
+ //Overal statistics histograms
+
+ fHistPt = new TH1F("fHistPt", "P_{T} distribution", 100, 0.0, 5.0);
+ fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+ fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+ fHistPt->SetMarkerStyle(kFullCircle);
+
+
+ fHistEta = new TH1F("fHistEta", "#eta distribution", 200, -2, 2);
+ fHistEta->GetXaxis()->SetTitle("ETA");
+ fHistEta->GetYaxis()->SetTitle("dN/ETA");
+ fHistEta->SetMarkerStyle(kFullCircle);
+
+
+
+ // -------- LRC histograms
+ //new cloud implementation
+ //const int lSparseDim = en_sparse_total;
+ //const int nSparseBins = 1000;
+
+
+ /* from AliROOT //deprecated!
+ enum EParticleType {
+ kElectron = 0,
+ kMuon = 1,
+ kPion = 2,
+ kKaon = 3,
+ kProton = 4,
+ kPhoton = 5,
+ kPi0 = 6,
+ kNeutron = 7,
+ kKaon0 = 8,
+ kEleCon = 9,
+ kDeuteron = 10,
+ kTriton = 11,
+ kHe3 = 12,
+ kAlpha = 13,
+ kUnknown = 14
+ };*/
+
+
+ if ( fUseSparse )
+ {
+
+ //correspondance of PID blocks
+ //it's a way to unlink THnSparse data dimenstion from enum
+ fHistSparsePIDblocksLabeling = new TH1D("fHistSparsePIDblocksLabeling","THnSparse PID blocks labeling", kSparsePIDtotal,-0.5,kSparsePIDtotal-0.5);
+ TString gEventCutBinPIDblocksNames[kSparsePIDtotal]; // = {"Total","No trigger","Centrality","No vertex","Bad vertex position","HighMult cut","LowMult cut","Analyzed"};
+ gEventCutBinPIDblocksNames[kSparsePIDany] = "any";
+ gEventCutBinPIDblocksNames[kSparsePIDdefined] = "defined";
+ gEventCutBinPIDblocksNames[kSparsePIDpion] = "pion";
+ gEventCutBinPIDblocksNames[kSparsePIDkaon] = "kaon";
+ gEventCutBinPIDblocksNames[kSparsePIDproton] = "proton";
+
+
+ for(Int_t i = 1; i <= kSparsePIDtotal; i++)fHistSparsePIDblocksLabeling->GetXaxis()->SetBinLabel(i,gEventCutBinPIDblocksNames[i-1].Data());
+ //for(Int_t i = 0; i < nEnumBins; i++)fHistSparseDimensionLabeling->Fill( i );
+
+ //dimensions labelling
+
+ fHistSparseDimensionLabeling = new TH1D("fHistSparseDimensionLabeling","THnSparse labeling", kSparseTotal,-0.5,kSparseTotal-0.5);
+ TString gSparseDimensionsNames[kSparseTotal]; // = {"Total","No trigger","Centrality","No vertex","Bad vertex position","HighMult cut","LowMult cut","Analyzed"};
+ gSparseDimensionsNames[kSparseNf] = "N_f";
+ gSparseDimensionsNames[kSparseNb] = "N_b";
+ gSparseDimensionsNames[kSparsePtF] = "Pt_f";
+ gSparseDimensionsNames[kSparsePtB] = "Pt_b";
+ gSparseDimensionsNames[en_sparse_N2_f] = "N2_f";
+ gSparseDimensionsNames[en_sparse_Nf_Nb] = "Nf_Nb";
+ gSparseDimensionsNames[en_sparse_Ptb_Nf] = "Ptb_Nf";
+ gSparseDimensionsNames[en_sparse_Pt2_f] = "Pt2_f";
+ gSparseDimensionsNames[en_sparse_Ptf_Ptb] = "Ptf_Ptb";
+
+ for( Int_t i = 1; i <= kSparseTotal; i++ )
+ fHistSparseDimensionLabeling->GetXaxis()->SetBinLabel(i,gSparseDimensionsNames[i-1].Data());
+
+
+
+ Int_t* lSparseBins = new Int_t[kSparseTotal*kSparsePIDtotal];
+ Double_t *lSparseXmin = new Double_t[kSparseTotal*kSparsePIDtotal];
+ Double_t *lSparseXmax = new Double_t[kSparseTotal*kSparsePIDtotal];
+ TString *lSparseAxisNames = new TString[kSparseTotal*kSparsePIDtotal];
+
+ TString *lPIDNames = new TString[kSparsePIDtotal];
+ lPIDNames[ kSparsePIDany ] = Form( "any" );
+ lPIDNames[ kSparsePIDdefined ] = Form( "defined" );
+ lPIDNames[ kSparsePIDpion ] = Form( "pion" );
+ lPIDNames[ kSparsePIDkaon ] = Form( "kaon" );
+ lPIDNames[ kSparsePIDproton ] = Form( "proton" );
+
+
+
+ for ( Int_t d = 0; d < kSparsePIDtotal; ++d )
+ {
+ Int_t binShift = kSparseTotal*d;
+
+ lSparseAxisNames[kSparseNf + binShift] = Form( "axisNf_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[kSparseNb + binShift] = Form( "axisNb_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[kSparsePtF + binShift] = Form( "axisPtf_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[kSparsePtB + binShift] = Form( "axisPtb_%s", lPIDNames[ d ].Data() );
+
+ lSparseAxisNames[en_sparse_N2_f + binShift] = Form( "axisN2_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[en_sparse_Nf_Nb + binShift] = Form( "axisNf_Nb_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[en_sparse_Ptb_Nf + binShift] = Form( "axisPtb_Nf_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[en_sparse_Pt2_f + binShift] = Form( "axisPt2_f_%s", lPIDNames[ d ].Data() );
+ lSparseAxisNames[en_sparse_Ptf_Ptb + binShift] = Form( "axisPtf_Ptb_%s", lPIDNames[ d ].Data() );
+
+
+ lSparseBins[kSparseNf + binShift ] = fMultBinsHor;
+ lSparseXmin[kSparseNf + binShift ] = lowMultHor;
+ lSparseXmax[kSparseNf + binShift ] = hiMultHor;
+ lSparseBins[kSparseNb + binShift ] = fMultBinsVert;
+ lSparseXmin[kSparseNb + binShift ] = lowMultVert;
+ lSparseXmax[kSparseNb + binShift ] = hiMultVert;
+ //}
+ //for (Int_t d = 2; d < lSparseDim; ++d) {
+ lSparseBins[kSparsePtF + binShift ] = fPtBins;
+ lSparseXmin[kSparsePtF + binShift ] = fLoPt;
+ lSparseXmax[kSparsePtF + binShift ] = fHiPt;
+ lSparseBins[kSparsePtB + binShift ] = fPtBins;
+ lSparseXmin[kSparsePtB + binShift ] = fLoPt;
+ lSparseXmax[kSparsePtB + binShift ] = fHiPt;
+
+
+
+
+
+ //}
+ /*
+ lSparseBins[en_sparse_Et_f + binShift ] = 500;
+ lSparseXmin[en_sparse_Et_f + binShift ] = 0.2;
+ lSparseXmax[en_sparse_Et_f + binShift ] = 2.7;
+ lSparseBins[en_sparse_Et_b + binShift ] = 500;
+ lSparseXmin[en_sparse_Et_b + binShift ] = 0.2;
+ lSparseXmax[en_sparse_Et_b + binShift ] = 2.7;
+*/
+
+ lSparseBins[en_sparse_N2_f + binShift ] = (fMultBinsHor-1)*(fMultBinsHor-1)+1;
+ lSparseXmin[en_sparse_N2_f + binShift ] = fLowMultHor*fLowMultHor-0.5; // ! use global mult without shift
+ lSparseXmax[en_sparse_N2_f + binShift ] = fHiMultHor*fHiMultHor+0.5;
+ //lSparseBins[en_sparse_N_b] = fMultBinsVert;
+ //lSparseXmin[en_sparse_N_b] = lowMultVert;
+ //lSparseXmax[en_sparse_N_b] = hiMultVert;
+ lSparseBins[en_sparse_Nf_Nb + binShift ] = (fMultBinsHor-1)*(fMultBinsVert-1)+1;
+ lSparseXmin[en_sparse_Nf_Nb + binShift ] = fLowMultHor*fLowMultVert-0.5;
+ lSparseXmax[en_sparse_Nf_Nb + binShift ] = fHiMultHor*fHiMultVert+0.5;
+
+
+
+ lSparseBins[en_sparse_Ptb_Nf + binShift ] = /*(fMultBinsHor-1)**/(10*fPtBins);//+1;
+ lSparseXmin[en_sparse_Ptb_Nf + binShift ] = fLowMultHor*fLoPt-0.5;
+ lSparseXmax[en_sparse_Ptb_Nf + binShift ] = fHiMultHor*fHiPt+0.5;
+
+ lSparseBins[en_sparse_Pt2_f + binShift ] = (10*fPtBins);//*(fPtBins);//+1;
+ lSparseXmin[en_sparse_Pt2_f + binShift ] = fLoPt*fLoPt;
+ lSparseXmax[en_sparse_Pt2_f + binShift ] = fHiPt*fHiPt;
+
+ lSparseBins[en_sparse_Ptf_Ptb + binShift ] = (10*fPtBins);//*(fPtBins)+1;
+ lSparseXmin[en_sparse_Ptf_Ptb + binShift ] = fLoPt*fLoPt;
+ lSparseXmax[en_sparse_Ptf_Ptb + binShift ] = fHiPt*fHiPt;
+
+ /*
+ lSparseBins[en_sparse_Nf_plus + binShift ] = fMultBinsHor;
+ lSparseXmin[en_sparse_Nf_plus + binShift ] = lowMultHor;
+ lSparseXmax[en_sparse_Nf_plus + binShift ] = hiMultHor;
+ lSparseBins[en_sparse_Nf_minus + binShift ] = fMultBinsHor;
+ lSparseXmin[en_sparse_Nf_minus + binShift ] = lowMultHor;
+ lSparseXmax[en_sparse_Nf_minus + binShift ] = hiMultHor;
+
+ lSparseBins[en_sparse_Nb_plus + binShift ] = fMultBinsVert;
+ lSparseXmin[en_sparse_Nb_plus + binShift ] = lowMultVert;
+ lSparseXmax[en_sparse_Nb_plus + binShift ] = hiMultVert;
+ lSparseBins[en_sparse_Nb_minus + binShift ] = fMultBinsVert;
+ lSparseXmin[en_sparse_Nb_minus + binShift ] = lowMultVert;
+ lSparseXmax[en_sparse_Nb_minus + binShift ] = hiMultVert;
+
+ lSparseBins[en_sparse_Nf_plus_Nb_minus + binShift ] = (fMultBinsHor-1)*(fMultBinsVert-1)+1;
+ lSparseXmin[en_sparse_Nf_plus_Nb_minus + binShift ] = fLowMultHor*fLowMultVert-0.5;
+ lSparseXmax[en_sparse_Nf_plus_Nb_minus + binShift ] = fHiMultHor*fHiMultVert+0.5;
+
+ lSparseBins[en_sparse_Nb_plus_Nf_minus + binShift ] = (fMultBinsHor-1)*(fMultBinsVert-1);
+ lSparseXmin[en_sparse_Nb_plus_Nf_minus + binShift ] = fLowMultHor*fLowMultVert-0.5;
+ lSparseXmax[en_sparse_Nb_plus_Nf_minus + binShift ] = fHiMultHor*fHiMultVert+0.5;
+ */
+ }
+
+ fHistClouds = new THnSparseD("cloudLRC", "cloudLRC", kSparseTotal*kSparsePIDtotal, lSparseBins, lSparseXmin, lSparseXmax);
+ //end of cloud implementation
+
+ //set axis names
+ TAxis *lSparseAxis = 0x0;
+ for ( Int_t d = 0; d < kSparseTotal*kSparsePIDtotal; ++d )
+ {
+ lSparseAxis = fHistClouds->GetAxis( d );
+ lSparseAxis->SetNameTitle( lSparseAxisNames[d], lSparseAxisNames[d] );
+ }
+
+
+ delete [] lSparseBins;
+ delete [] lSparseXmin;
+ delete [] lSparseXmax;
+ delete [] lSparseAxisNames;
+
+
+ fOutList->Add(fHistSparseDimensionLabeling);
+ fOutList->Add(fHistSparsePIDblocksLabeling);
+
+ // bool useSparse = false;
+
+ // !!!!!! temp comment!
+ fOutList->Add(fHistClouds);
+ }
+
+
+ fHistNN = new TH2D("NN","NN",fMultBinsHor, lowMultHor, hiMultHor,fMultBinsVert, lowMultVert, hiMultVert );
+ fHistPtN = new TH2D("PtN","PtN",fMultBinsHor, lowMultHor, hiMultHor,fPtBins/* /fPtHistXaxisRebinFactor*/,fLoPt,fHiPt);
+ fHistPtPt = new TH2D("PtPt","PtPt",fPtBins/fPtHistXaxisRebinFactor,fLoPt,fHiPt,fPtBins,fLoPt,fHiPt);
+ fProfNberr = new TProfile("nber","nber",fMultBinsHor, lowMultHor, hiMultHor);
+ fProfNberrPtPt = new TProfile("nberPtPt","nberPtPt",fPtBins/fPtHistXaxisRebinFactor,fLoPt,fHiPt);
+ fProfdPtB = new TProfile("dPtB","Overal multievent Pt_Backward (first bin) Pt_Backward^2 (sec. bin) ",16,0.5,16.5);
+ fProfTestLRC = new TProfile("TestLRC","Test LRC calculaion via TProfile",fMultBinsHor, lowMultHor, hiMultHor);
+
+ fHistNfCentrality = new TH2D("NfCentrality","NfCentrality",fMultBinsHor, lowMultHor, hiMultHor,101,-1.01,100.01);
+ fHistDifferenceNf = new TH2D("fHistDifferenceNf","Hist nF-nB;nF;nF-nB",fMultBinsHor, lowMultHor, hiMultHor,fMultBinsHor,-hiMultHor,hiMultHor);
+ fHistDifferenceNb = new TH2D("fHistDifferenceNb","Hist nB-nF;nB;nB-nF",fMultBinsVert, lowMultVert, hiMultVert,fMultBinsVert,-hiMultVert,hiMultVert);
+
+ // ---------- Adding data members to output list
+
+ // Adding overal statistics
+
+ //commented: to save memory
+ //fOutList->Add(fHistPt);
+ //fOutList->Add(fHistEta);
+
+ //Adding LRC hists
+
+
+ if (1)
+ {
+ fOutList->Add(fHistNN);
+ fOutList->Add(fHistPtN);
+ fOutList->Add(fHistPtPt);
+ }
+ fOutList->Add(fProfNberr);
+ fOutList->Add(fProfNberrPtPt);
+ fOutList->Add(fProfdPtB);
+ fOutList->Add(fProfTestLRC);
+
+
+ //Adding window statistics
+
+
+
+ fOutList->Add(fHistNchForward);
+ fOutList->Add(fHistNchBackward);
+ fOutList->Add(fHistNchForwardPtPt);
+
+ fOutList->Add(fHistPtForward);
+ fOutList->Add(fHistPtBackward);
+
+ fOutList->Add(fHistEtaForward);
+ fOutList->Add(fHistEtaBackward);
+
+ fOutList->Add(fHistPhiForward);
+ fOutList->Add(fHistPhiBackward);
+
+ fOutList->Add(fHistTracksChargeForward);
+ fOutList->Add(fHistTracksChargeBackward);
+
+ fOutList->Add(fHistTestPIDForward);
+ fOutList->Add(fHistTestPIDBackward);
+
+ // fOutList->Add(fHistNfCentrality);
+
+
+ //fOutList->Add(fHistDifferenceNf);
+ //fOutList->Add(fHistDifferenceNb);
+
+ // Adding status to dPtB
+
+ fProfdPtB->Fill(3 , fStartForwardETA);
+ fProfdPtB->Fill(4 , fEndForwardETA);
+ fProfdPtB->Fill(5 , fStartBackwardETA);
+ fProfdPtB->Fill(6 , fEndBackwardETA);
+ fProfdPtB->Fill(7 , fStartForwardPhi);
+ fProfdPtB->Fill(8 , fEndForwardPhi);
+ fProfdPtB->Fill(9 , fStartBackwardPhi);
+ fProfdPtB->Fill(10 , fEndBackwardPhi);
+
+
+
+
+ fIsOnline = kTRUE;
+ return kTRUE;
+}
+AliLRCProcess::~AliLRCProcess()
+{
+ //Destructor
+
+}
+
+// --------------------------------------- Setters ------------------
+void AliLRCProcess::SetShortDef()
+{
+ // Creating task and output container name
+ char str[200];
+ snprintf(str,200, "TaskLRCw%3.1fto%3.1fvs%3.1fto%3.1f",fStartForwardETA,fEndForwardETA,fStartBackwardETA,fEndBackwardETA);
+ /*if ( fWhichParticleToProcess != kLRCany
+ && (int)fWhichParticleToProcess > 0 && (int)fWhichParticleToProcess <= 6 ) //to avoid program falling
+ {
+ char str2[80];
+ TString gBinParticleNames[6] = {"Other","Electron","Muon","Pion","Kaon", "Proton"};
+ snprintf(str2,80, "%s_%s",str,gBinParticleNames[(int)fWhichParticleToProcess].Data());
+ fShortDef= str2;
+ }
+ else*/
+ fShortDef= str;
+
+}
+
+void AliLRCProcess::SetForwardWindow(Double_t StartETA,Double_t EndETA)
+{
+ //setter for the forward eta window
+ fStartForwardETA=StartETA;
+ fEndForwardETA=EndETA;
+ SetShortDef();
+}
+void AliLRCProcess::SetBackwardWindow(Double_t StartETA,Double_t EndETA)
+{
+ //setter for the backward eta window
+ fStartBackwardETA=StartETA;
+ fEndBackwardETA=EndETA;
+ SetShortDef();
+}
+void AliLRCProcess::SetETAWindows(Double_t _StartForwardETA,Double_t _EndForwardETA,Double_t _StartBakwardETA,Double_t _EndBakwardETA)
+{
+ //setter for the eta windows
+ fStartForwardETA=_StartForwardETA;
+ fEndForwardETA=_EndForwardETA;
+ fStartBackwardETA=_StartBakwardETA;
+ fEndBackwardETA=_EndBakwardETA;
+ SetShortDef();
+}
+void AliLRCProcess::GetETAWindows(Double_t &_StartForwardETA,Double_t &_EndForwardETA,Double_t &_StartBakwardETA,Double_t &_EndBakwardETA)
+{
+ //getter for the eta windows
+ _StartForwardETA = fStartForwardETA;
+ _EndForwardETA = fEndForwardETA;
+ _StartBakwardETA = fStartBackwardETA;
+ _EndBakwardETA = fEndBackwardETA;
+}
+
+void AliLRCProcess::GetPhiWindows(Double_t &_StartForwardPhi,Double_t &_EndForwardPhi,Double_t &_StartBakwardPhi,Double_t &_EndBakwardPhi)
+{
+ //getter for the eta windows
+ _StartForwardPhi = fStartForwardPhi;
+ _EndForwardPhi = fEndForwardPhi;
+ _StartBakwardPhi = fStartBackwardPhi;
+ _EndBakwardPhi = fEndBackwardPhi;
+}
+
+void AliLRCProcess::SetParticleType( char* strForwardOrBackward, char* strPid )
+{
+ //cout << "hm! strForwardOrBackward = " << strForwardOrBackward
+ // << ", strPid = " << strPid << endl;
+ //cout << "before ae! fPidForward = " << fPidForward << ", fPidBackward = " << fPidBackward << endl;
+
+ int lPid = -1;//kLRCany;
+ if ( !strcmp( strPid, "pion") )
+ lPid = 2;//kLRCpion;
+ else if ( !strcmp( strPid, "kaon") )
+ lPid = 3;//kLRCkaon;
+ else if ( !strcmp( strPid, "proton") )
+ lPid = 4;//kLRCproton;
+ else if ( !strcmp( strPid, "knownpid") )
+ lPid = 100;//will will histos if we KNOW PID! (not important which)
+
+ //set pid for window
+ if ( !strcmp( strForwardOrBackward, "fwd") )
+ fPidForward = lPid;
+ else if ( !strcmp( strForwardOrBackward, "bkwd") )
+ fPidBackward = lPid;
+ //cout << "ae! lPid = " << lPid << ", fPidForward = " << fPidForward << ", fPidBackward = " << fPidBackward << endl;
+ //int aaaa;
+ //cin>> aaaa;
+}
+
+
+void AliLRCProcess::SetHistPtRangeForwardWindowRebinFactor( Int_t ptHistXaxisRebinFactor )
+{
+ // Rebining for Pt histograms X-axis
+ if(fIsOnline)
+ {
+ Printf("Can't change histos paramiters after InitDataMembers() was called! \n");
+ return ;
+ }
+ fPtHistXaxisRebinFactor = ptHistXaxisRebinFactor;
+}
+
+void AliLRCProcess::SetHistPtRange(Double_t LoPt,Double_t HiPt,Int_t PtBins)
+{
+ // Sets Pt range and number of bins for Pt axis of histos
+ if(fIsOnline)
+ {
+ Printf("Can't change histos paramiters after InitDataMembers() was called! \n");
+ return ;
+ }
+ // Setter for Pt range and N bins in histos
+ fLoPt=LoPt;
+ fHiPt=HiPt;
+ fPtBins=PtBins;
+}
+void AliLRCProcess::SetHistMultRange( Int_t whichWindow, Int_t LoMult,Int_t HiMult,Int_t MultBins)
+{
+ // Setter for multiplicity range and N bins in histos
+ if ( whichWindow == 0 ) //set range for both windows
+ {
+ SetHistMultRangeHor( LoMult, HiMult, MultBins) ;
+ SetHistMultRangeVert( LoMult, HiMult, MultBins) ;
+ }
+ else if ( whichWindow == 1 ) //for fwd
+ SetHistMultRangeHor( LoMult, HiMult, MultBins) ;
+ else if ( whichWindow == 2 ) //for bwd
+ SetHistMultRangeVert( LoMult, HiMult, MultBins) ;
+ /*
+
+ if(fIsOnline)
+ {
+ Printf("Can't change histos paramiters after InitDataMembers() was called! \n");
+ return ;
+ }
+ fLoMult=LoMult;
+ fHiMult=HiMult;
+ if(!MultBins)
+ {
+ fMultBins=fHiMult-fLoMult+1;
+ }else
+ {
+ fMultBins=MultBins;
+ }*/
+}
+
+void AliLRCProcess::SetHistMultRangeHor(Int_t LoMult,Int_t HiMult,Int_t MultBins)
+{
+ // Setter for multiplicity range and N bins in histos
+ if(fIsOnline)
+ {
+ Printf("Can't change histos paramiters after InitDataMembers() was called! \n");
+ return ;
+ }
+ fLowMultHor = LoMult;
+ fHiMultHor = HiMult;
+ if(!MultBins)
+ {
+ fMultBinsHor = fHiMultHor-fLowMultHor+1;
+ }else
+ {
+ fMultBinsHor = MultBins;
+ }
+}
+
+void AliLRCProcess::SetHistMultRangeVert(Int_t LoMult,Int_t HiMult,Int_t MultBins)
+{
+ // Setter for multiplicity range and N bins in histos
+ if(fIsOnline)
+ {
+ Printf("Can't change histos parameters after InitDataMembers() was called! \n");
+ return ;
+ }
+ fLowMultVert = LoMult;
+ fHiMultVert = HiMult;
+ if(!MultBins)
+ {
+ fMultBinsVert = fHiMultVert-fLowMultVert+1;
+ }else
+ {
+ fMultBinsVert = MultBins;
+ }
+}
+
+void AliLRCProcess::SetOutputSlotNumber(Int_t SlotNumber)
+{
+ //Sets number of output slot for LRCProcessor
+ fOutputSlot=SlotNumber;
+}
+
+//________________________________________________________________________
+
+
+
+TList* AliLRCProcess::CreateOutput() const
+{
+ // Creates a link to output data TList
+ return fOutList;
+}
+
+TString AliLRCProcess::GetShortDef() const
+{
+ return fShortDef;
+}
+
+Int_t AliLRCProcess::GetOutputSlotNumber() const
+{
+ // Returns number of output slot for LRCProcessor
+ return fOutputSlot;
+}
+
+void AliLRCProcess::StartEvent()
+{
+ // Open new Event for track by track event import
+ if(fIsEventOpend) // Check if trying to open event more than once !
+ {
+ Printf("Event is already opened! Auto finishing ! \n");
+// cout<<fShortDef<<": event count = "<<fEventCount<<" ";
+ Printf("NchF = %i,NchB = %i \n",fNchFw,fNchBw);
+
+ FinishEvent();
+ }
+ if(!fIsOnline) // Autocreating histos if InitDataMembers was not called by hand
+ {
+ Printf("InitDataMembers was not called by hand ! Autocreating histos...\n");
+ InitDataMembers();
+ }
+
+ fNchFw=0;
+ fSumPtFw=0;
+ fNchBw=0;
+ fSumPtBw=0;
+ fSumPtBw2=0;
+
+ fNchFwPlus = 0;
+ fNchBwPlus = 0;
+ fNchFwMinus = 0;
+ fNchBwMinus = 0;
+
+ ZeroPidArrays();
+
+ //fNchFwPtPt = 0;
+
+ fIsEventOpend=kTRUE;
+}
+void AliLRCProcess::AddTrackForward(Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )
+{
+ // Imports track to the event directly to Forward window
+ if(!fIsEventOpend)
+ {Printf("Event is not opened!\n");
+ return;}
+
+ //Bool_t lAddDecision = kFALSE;
+
+ //if ( fPidForward == 100 ) //add particle if we know pid (i.e. particleType != -1)
+ //{
+ //if ( particleType != -1 )
+ //{
+ // lAddDecision = kTRUE;
+ //cout << "fill fwd with pid " << particleType << endl;
+ //}
+ //}
+ //else if ( fPidForward != -1 ) //if we specify pid for this window - just check it
+ //{
+ //if ( particleType == fPidForward )
+ //{
+ //lAddDecision = kTRUE;
+ //cout << "fill fwd with pid " << particleType << endl;
+ //}
+ //}
+ //else
+ //lAddDecision = kTRUE;
+
+ //if ( !lAddDecision )
+ //return;
+
+ fHistTestPIDForward->Fill( particleType );
+
+ fNchFw++;
+ Charge > 0 ? fNchFwPlus++ : fNchFwMinus++;
+ fSumPtFw+=Pt;
+ fHistPtForward->Fill(Pt);
+ fHistEtaForward->Fill(Eta);
+ fHistPhiForward->Fill(Phi);
+
+ //added 15.12.12
+ fHistTracksChargeForward->Fill(Charge);
+
+ //added 23.03
+ for ( int pid = 0; pid < kSparsePIDtotal; pid++ )
+ {
+ if ( pid == kSparsePIDany //write ALL pid types
+ ||
+ ( pid == kSparsePIDdefined && particleType != -1 ) //write defined particles
+ ||
+ ( fCorrespondanceWithAliROOTpid[pid] == particleType ) //write not defined particles
+ )
+ {
+ fNchFwPID[pid]++;
+ Charge > 0 ? fNchFwPlusPID[pid]++ : fNchFwMinusPID[pid]++;
+ fSumPtFwPID[pid] += Pt;
+ if ( pid != kSparsePIDany )
+ {
+ Double_t lMass = 0;//AliPID::ParticleMass( particleType );
+ fSumEtFwPID[pid] += sqrt( Pt*Pt + lMass*lMass ) ;
+ }
+ }
+ }
+
+ //netcharge part (July 2013)
+ fHistNetChargeVsPtForward->Fill( Pt, Charge );
+ if ( Charge > 0 )
+ fHistPtPlusForward->Fill( Pt );
+ else if ( Charge < 0 )
+ fHistPtMinusForward->Fill( Pt );
+
+
+}
+void AliLRCProcess::AddTrackBackward(Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )
+{
+ // Imports track to the event directly to Backward window
+ if(!fIsEventOpend)
+ {Printf("Event is not opened!\n");
+ return;}
+
+ /*Bool_t lAddDecision = kFALSE;
+
+ if ( fPidBackward == 100 ) //add particle if we know pid (i.e. particleType != -1)
+ {
+ if ( particleType != -1 )
+ {
+ lAddDecision = kTRUE;
+ //cout << "fill fwd with pid " << particleType << endl;
+ }
+ }
+ else if ( fPidBackward != -1 ) //if we specify pid for this window - just check it
+ {
+ if ( particleType == fPidBackward )
+ {
+ lAddDecision = kTRUE;
+ //cout << "fill fwd with pid " << particleType << endl;
+ }
+ }
+ else
+ lAddDecision = kTRUE;
+
+ if ( !lAddDecision )
+ return;
+ */
+ fHistTestPIDBackward->Fill( particleType );
+
+ fNchBw++;
+ Charge > 0 ? fNchBwPlus++ : fNchBwMinus++;
+ fSumPtBw += Pt;
+ fSumPtBw2 += Pt*Pt;
+ fProfdPtB->Fill( 1, Pt );
+ fProfdPtB->Fill( 2, Pt*Pt );
+ fHistPtBackward->Fill( Pt );
+ fHistEtaBackward->Fill( Eta );
+ fHistPhiBackward->Fill( Phi );
+
+ //added 15.12.12
+ fHistTracksChargeBackward->Fill(Charge);
+
+ //added 23.03
+ for ( int pid = 0; pid < kSparsePIDtotal; pid++ )
+ {
+ if ( pid == kSparsePIDany //write ALL pid types
+ ||
+ ( pid == kSparsePIDdefined && particleType != -1 ) //write defined particles
+ ||
+ ( fCorrespondanceWithAliROOTpid[pid] == particleType )
+ )
+ {
+ fNchBwPID[pid]++;
+ Charge > 0 ? fNchBwPlusPID[pid]++ : fNchBwMinusPID[pid]++;
+ fSumPtBwPID[pid] += Pt;
+ if ( pid != kSparsePIDany )
+ {
+ Double_t lMass = 0;//AliPID::ParticleMass( particleType );
+ fSumEtBwPID[pid] += sqrt( Pt*Pt + lMass*lMass ) ;
+ }
+
+ }
+ }
+
+ //netcharge part (July 2013)
+ fHistNetChargeVsPtBackward->Fill( Pt, Charge );
+ if ( Charge > 0 )
+ fHistPtPlusBackward->Fill( Pt );
+ else if ( Charge < 0 )
+ fHistPtMinusBackward->Fill( Pt );
+
+}
+
+
+
+void AliLRCProcess::AddTrackPtEta(Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )
+{
+ //cout << Pt << endl;
+
+
+ //if particle type is different - ignore the track
+ //if ( fWhichParticleToFill != -1 && ParticleType != fWhichParticleToFill )
+ // return;
+ //Track by track event import : Imports track to the event
+
+ //cout << "fWhichParticleToProcess = " << fWhichParticleToProcess
+ // << ", particleType = " << particleType << endl;
+ if(!fIsEventOpend)
+ {Printf("Event is not opened!\n");
+ return;}
+
+ // Global track data
+ fHistPt->Fill(Pt);
+ fHistEta->Fill(Eta);
+
+ //Bool_t lAddForwardDecision = kFALSE;
+ //Bool_t lAddBackwardDecision = kFALSE;
+
+ //Forward window
+ if( ( fStartForwardETA < Eta ) && ( Eta < fEndForwardETA ) )
+ if( IsPhiInRange( Phi, fStartForwardPhi, fEndForwardPhi) )//( fStartForwardPhi < Phi ) && ( Phi < fEndForwardPhi ) )
+ {
+ AddTrackForward( Pt, Eta, Phi, Charge, particleType );
+ //if ( fPidFillCondition == kLRCpidForForwardOnly
+ // || fPidFillCondition == kLRCpidForBoth )
+ //if ( fPidForward != -1 )//kLRCany )
+ //{
+ // if ( particleType == fPidForward )//kLRCpion )//particleType )
+ // {
+ // lAddForwardDecision = kTRUE;//AddTrackForward( Pt, Eta, Phi );
+ //cout << "fill fwd with pid " << particleType << endl;
+ // }
+ //}
+ //else
+ // lAddForwardDecision = kTRUE;//AddTrackForward( Pt, Eta, Phi );
+ }
+ //if ( lAddForwardDecision )
+ //{
+ // AddTrackForward( Pt, Eta, Phi, particleType );
+ // fHistTestPIDForward->Fill( particleType );
+ //}
+
+ //Backward window
+ if( ( fStartBackwardETA < Eta ) && ( Eta < fEndBackwardETA ) )
+ if (
+ (
+ IsPhiInRange( Phi, fStartBackwardPhi, fEndBackwardPhi) //( fStartBackwardPhi < Phi ) && ( Phi < fEndBackwardPhi )
+ )
+ ||
+ (
+ fDoubleSidedBackwardPhiWindow //if this option is true
+ && IsPhiInRange( Phi, fStartBackwardPhi + TMath::Pi(), fEndBackwardPhi + TMath::Pi() ) //
+ //&& ( fStartBackwardPhi + TMath::Pi() < Phi )
+ //&& ( Phi < fEndBackwardPhi + TMath::Pi() )
+ )
+ )
+ {
+ AddTrackBackward( Pt, Eta, Phi, Charge, particleType );
+ //if ( fPidFillCondition == kLRCpidForBackwardOnly
+ // || fPidFillCondition == kLRCpidForBoth )
+ //if ( fPidBackward != -1 )//kLRCany )
+ //{
+ // if ( particleType == fPidBackward )//kLRCpion )//particleType )
+ // {
+ // lAddBackwardDecision = kTRUE;//AddTrackBackward( Pt, Eta, Phi );
+ //cout << "fill bkwd with pid " << particleType << endl;
+ // }
+
+ //}
+ //else
+ // lAddBackwardDecision = kTRUE;//AddTrackBackward( Pt, Eta, Phi );
+ }
+ //if ( lAddBackwardDecision )
+ //{
+ // AddTrackBackward( Pt, Eta, Phi, particleType );
+ // fHistTestPIDBackward->Fill( particleType );
+ //}
+
+}
+
+
+
+void AliLRCProcess::AddTrackPtEtaMixing( Int_t winFB, Double_t Pt, Double_t Eta ,Double_t Phi, Short_t Charge, Int_t particleType )
+{
+ // put track in F or B window using varible winFB
+ if(!fIsEventOpend)
+ {
+ Printf("Event is not opened!\n");
+ return;
+ }
+
+ // Global track data
+ fHistPt->Fill(Pt);
+ fHistEta->Fill(Eta);
+
+
+ //Forward window
+ if( winFB == 0
+ && ( fStartForwardETA < Eta ) && ( Eta < fEndForwardETA ) )
+ if( IsPhiInRange( Phi, fStartForwardPhi, fEndForwardPhi) ) // (fStartForwardPhi < Phi ) && ( Phi < fEndForwardPhi ) )
+ {
+ AddTrackForward( Pt, Eta, Phi, Charge, particleType );
+ }
+
+ //Backward window
+ if( winFB == 1
+ && ( fStartBackwardETA < Eta ) && ( Eta < fEndBackwardETA ) )
+ if (
+ (
+ IsPhiInRange( Phi, fStartBackwardPhi, fEndBackwardPhi) //( fStartBackwardPhi < Phi ) && ( Phi < fEndBackwardPhi )
+ )
+ ||
+ (
+ fDoubleSidedBackwardPhiWindow //if this option is true
+ && IsPhiInRange( Phi, fStartBackwardPhi + TMath::Pi(), fEndBackwardPhi + TMath::Pi() )
+ //&& ( fStartBackwardPhi + TMath::Pi() < Phi )
+ //&& ( Phi < fEndBackwardPhi + TMath::Pi() )
+ )
+ )
+ {
+ AddTrackBackward( Pt, Eta, Phi, Charge, particleType );
+ }
+
+
+}
+
+void AliLRCProcess::FinishEvent(Bool_t kDontCount)
+{
+ // Track by track event import : Close opened event and fill event summary histos
+
+ if(!fIsEventOpend)
+ {
+ Printf("Event is not opened!\n");
+ return;
+ }
+ if ( kDontCount ) //don't count this event! just ignore it
+ {
+ fIsEventOpend = kFALSE;
+ return;
+ }
+ //fHistSparseDimensionLabeling->Fill(1);
+ //Filling even-total data
+ //cout << "filling" << endl;
+ /*Double_t lCloudData[en_sparse_total*en_sparse_PID_total];
+ lCloudData[en_sparse_N_f] = fNchFw; //write Nf
+ lCloudData[en_sparse_N_b] = fNchBw; //write Nb
+ lCloudData[en_sparse_N2_f] = fNchFw*fNchFw; //write Nf^2
+ lCloudData[en_sparse_Nf_Nb] = fNchFw*fNchBw; //write Nb
+
+ lCloudData[en_sparse_Pt_f] = 0; //fill bin 0, if don't have appropriate PtSum
+ lCloudData[en_sparse_Pt_b] = 0; //fill bin 0, if don't have appropriate PtSum
+
+ lCloudData[en_sparse_Nf_plus] = fNchFwPlus;
+ lCloudData[en_sparse_Nf_minus] = fNchFwMinus;
+ lCloudData[en_sparse_Nb_plus] = fNchBwPlus;
+ lCloudData[en_sparse_Nb_minus] = fNchBwMinus;
+ lCloudData[en_sparse_Nf_plus_Nb_minus] = fNchFwPlus * fNchBwMinus;
+ lCloudData[en_sparse_Nb_plus_Nf_minus] = fNchBwPlus * fNchFwMinus; */
+
+ fHistNN->Fill(fNchFw,fNchBw);
+
+ if ( fUseAccumulatingHist )
+ {
+ fArrAccumulatedValues->Fill( en_arr_labels_NN_Nevents, 1 );
+ fArrAccumulatedValues->Fill( en_arr_labels_NN_Nf , fNchFw );
+ fArrAccumulatedValues->Fill( en_arr_labels_NN_Nb , fNchBw );
+ fArrAccumulatedValues->Fill( en_arr_labels_NN_N2_f , fNchFw*fNchFw );
+ fArrAccumulatedValues->Fill( en_arr_labels_NN_Nf_Nb , fNchFw*fNchBw );
+ fArrAccumulatedValues->Fill( en_arr_labels_NN_N2_b , fNchBw*fNchBw );
+ }
+
+ if( fNchBw != 0 )
+ {
+ fSumPtBw = fSumPtBw / fNchBw;
+ //lCloudData[en_sparse_Pt_b] = fSumPtBw; //write <PtB>
+ fProfTestLRC->Fill( fNchFw, fSumPtBw );
+ fHistPtN->Fill( fNchFw, fSumPtBw );
+ //cout << "fill PtN: fNchFw = " << fNchFw << ", fSumPtBw=" << fSumPtBw << endl;
+ fProfNberr->Fill(fNchFw, 1.0 / fNchBw);
+
+ if ( fUseAccumulatingHist )
+ {
+ fArrAccumulatedValues->Fill( en_arr_labels_PtN_Nevents, 1 );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtN_Nf , fNchFw );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtN_PtB , fSumPtBw );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtN_N2_f , fNchFw*fNchFw );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtN_Ptb_Nf , fSumPtBw*fNchFw );
+ }
+
+ if( fNchFw != 0 )
+ {
+ fSumPtFw = fSumPtFw / fNchFw;
+ //lCloudData[en_sparse_Pt_f] = fSumPtFw; //write <PtF>
+ fHistPtPt->Fill( fSumPtFw, fSumPtBw );
+ fProfNberrPtPt->Fill( fSumPtFw, 1.0 / fNchBw );
+ // dPtB for PtPt
+ fProfdPtB->Fill( 15, fSumPtBw, fNchBw );
+ fProfdPtB->Fill( 16, fSumPtBw2 / fNchBw, fNchBw );
+ fHistNchForwardPtPt->Fill(fNchFw);
+
+ if ( fUseAccumulatingHist )
+ {
+ fArrAccumulatedValues->Fill( en_arr_labels_PtPt_Nevents, 1 );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtPt_PtF , fSumPtFw );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtPt_PtB , fSumPtBw );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtPt_Pt2_f , fSumPtFw*fSumPtFw );
+ fArrAccumulatedValues->Fill( en_arr_labels_PtPt_Ptf_Ptb, fSumPtBw*fSumPtFw );
+ }
+
+ }
+ }
+
+
+
+
+
+ if ( fUseSparse )
+ {
+ Double_t lCloudData[kSparseTotal*kSparsePIDtotal];
+
+ for (Int_t d = 0; d < kSparsePIDtotal; ++d)
+ {
+ Int_t binShift = kSparseTotal*d; //step over dimension set
+
+ lCloudData[kSparseNf + binShift ] = fNchFwPID[d]; //write Nf
+ lCloudData[kSparseNb + binShift ] = fNchBwPID[d]; //write Nb
+ lCloudData[en_sparse_N2_f + binShift ] = fNchFwPID[d]*fNchFwPID[d]; //write Nf^2
+ lCloudData[en_sparse_Nf_Nb + binShift ] = fNchFwPID[d]*fNchBwPID[d]; //write Nb
+
+ lCloudData[kSparsePtF + binShift ] = 0; //fill bin 0, if don't have appropriate PtSum
+ lCloudData[kSparsePtB + binShift ] = 0; //fill bin 0, if don't have appropriate PtSum
+
+ lCloudData[en_sparse_Ptb_Nf + binShift ] = 0;
+ lCloudData[en_sparse_Pt2_f + binShift ] = 0;
+ lCloudData[en_sparse_Ptf_Ptb + binShift ] = 0;
+
+
+ if( fNchBwPID[d] != 0 )
+ {
+ double lSumPtBwPID = fSumPtBwPID[d] / fNchBwPID[d];
+ lCloudData[kSparsePtB + binShift ] = lSumPtBwPID; //write <PtB>
+
+ fSumEtBwPID[d] = fSumEtBwPID[d] / fNchBwPID[d];
+ //lCloudData[en_sparse_Et_b + binShift ] = fSumEtBwPID[d]; //write <PtB>
+ lCloudData[en_sparse_Ptb_Nf + binShift ] = lSumPtBwPID * fNchFwPID[d];
+
+ //fProfTestLRC->Fill( fNchFw, fSumPtBw );
+ //fHistPtN->Fill( fNchFw, fSumPtBw );
+ //cout << "fill PtN: fNchFw = " << fNchFw << ", fSumPtBw=" << fSumPtBw << endl;
+
+ //fProfNberr->Fill(fNchFw, 1.0 / fNchBw);
+
+
+ if( fNchFwPID[d] != 0 )
+ {
+ double lSumPtFwPID = fSumPtFwPID[d] / fNchFwPID[d];
+ lCloudData[kSparsePtF + binShift ] = lSumPtFwPID; //write <PtF>
+
+ fSumEtFwPID[d] = fSumEtFwPID[d] / fNchFwPID[d];
+
+ lCloudData[en_sparse_Pt2_f + binShift ] = lSumPtFwPID * lSumPtFwPID;
+ lCloudData[en_sparse_Ptf_Ptb + binShift ] = lSumPtFwPID*lSumPtBwPID;
+
+ //lCloudData[en_sparse_Et_f + binShift ] = fSumEtFwPID[d]; //write <PtF>
+ //fHistPtPt->Fill( fSumPtFw, fSumPtBw );
+ //fProfNberrPtPt->Fill( fSumPtFw, 1.0 / fNchBw );
+ // dPtB for PtPt
+ //fProfdPtB->Fill( 15, fSumPtBw, fNchBw );
+ //fProfdPtB->Fill( 16, fSumPtBw2 / fNchBw, fNchBw );
+ //fHistNchForwardPtPt->Fill(fNchFw);
+
+ }
+ }
+ /*
+ lCloudData[en_sparse_Nf_plus + binShift ] = fNchFwPlusPID[d];
+ lCloudData[en_sparse_Nf_minus + binShift ] = fNchFwMinusPID[d];
+ lCloudData[en_sparse_Nb_plus + binShift ] = fNchBwPlusPID[d];
+ lCloudData[en_sparse_Nb_minus + binShift ] = fNchBwMinusPID[d];
+ lCloudData[en_sparse_Nf_plus_Nb_minus + binShift ] = fNchFwPlusPID[d] * fNchBwMinusPID[d];
+ lCloudData[en_sparse_Nb_plus_Nf_minus + binShift ] = fNchBwPlusPID[d] * fNchFwMinusPID[d];
+ */
+ }
+
+ //tmp (22.03): fill pid with fignya data
+ /* for (Int_t d = 1; d < en_sparse_PID_total; ++d)
+ {
+ Int_t binShift = en_sparse_total*d;
+ lCloudData[en_sparse_N_f + binShift ] = 1+d; //write Nf
+ lCloudData[en_sparse_N_b + binShift ] = 2+d; //write Nb
+ lCloudData[en_sparse_N2_f + binShift ] = 3+d; //write Nf^2
+ lCloudData[en_sparse_Nf_Nb + binShift ] = 4+d; //write Nb
+
+ lCloudData[en_sparse_Pt_f + binShift ] = 5+d; //fill bin 0, if don't have appropriate PtSum
+ lCloudData[en_sparse_Pt_b + binShift ] = 6+d; //fill bin 0, if don't have appropriate PtSum
+
+ lCloudData[en_sparse_Nf_plus + binShift ] = 7+d;
+ lCloudData[en_sparse_Nf_minus + binShift ] = 8+d;
+ lCloudData[en_sparse_Nb_plus + binShift ] = 9+d;
+ lCloudData[en_sparse_Nb_minus + binShift ] = 10+d;
+ lCloudData[en_sparse_Nf_plus_Nb_minus + binShift ] = 11+d;
+ lCloudData[en_sparse_Nb_plus_Nf_minus + binShift ] = 12+d;
+ }
+ */
+
+ // cout << "before filling" << endl;
+ fHistClouds->Fill( lCloudData ); //fill sparse hist with Nf, Nb, <PtF>, <PtB>
+ // cout << "filled." << endl;
+ }
+
+
+
+
+ //additional info-hist
+ if ( fNchFw > 0 || fNchBw > 0 )
+ {
+ Double_t lAvMult = ( fNchFw + fNchBw ) / 2.;
+ fHistDifferenceNf->Fill( fNchFw, ( fNchFw-fNchBw ) / lAvMult );
+ fHistDifferenceNb->Fill( fNchBw, ( fNchBw-fNchFw ) / lAvMult);
+ }
+
+ //cout << "n particles: " << fNchFw << " , Back = " << fNchBw << endl;
+ //cout << "fHistNN: " << fHistNN->GetEntries() << endl;
+ //cout << "mean= " << fHistNN->GetMean() << endl;
+
+
+ fHistNchForward->Fill(fNchFw);
+ fHistNchBackward->Fill(fNchBw);
+
+ fEventCount++;
+ fIsEventOpend = kFALSE;
+
+ //fill nf-centr plot
+ fHistNfCentrality->Fill( fNchFw, fEventCentrality );
+
+ //cout<<fShortDef<<": event count = "<<fEventCount<<" ";
+ // Printf("NchF = %i,NchB = %i",fNchFw,fNchBw);
+}
+
+Bool_t AliLRCProcess::IsPhiInRange( Double_t phi, Double_t phiBoundMin, Double_t phiBoundMax )
+{
+ if ( ( phiBoundMin < phi ) && ( phi < phiBoundMax ) )
+ return kTRUE;
+
+ //when bound is more than 2pi - check phi+2pi!
+ phi += 2 * TMath::Pi();
+ if ( ( phiBoundMin < phi ) && ( phi < phiBoundMax ) )
+ return kTRUE;
+
+ return kFALSE; //phi not in range
+}
+
+void AliLRCProcess::SetCorrespondanceWithAliROOTpid()
+{
+ fCorrespondanceWithAliROOTpid[kSparsePIDany] = kSparsePIDany;
+ fCorrespondanceWithAliROOTpid[kSparsePIDdefined] = -1000;
+ fCorrespondanceWithAliROOTpid[kSparsePIDpion] = 2;
+ fCorrespondanceWithAliROOTpid[kSparsePIDkaon] = 3;
+ fCorrespondanceWithAliROOTpid[kSparsePIDproton] = 4;
+}
+
+void AliLRCProcess::ZeroPidArrays()
+{
+ //added 23.03
+ for ( int pid = 0; pid < kSparsePIDtotal; pid++ )
+ {
+ fNchFwPID[pid] = 0;
+ fNchFwPlusPID[pid] = 0;
+ fNchFwMinusPID[pid] = 0;
+ fSumPtFwPID[pid] = 0;
+ fSumEtFwPID[pid] = 0;
+
+ fNchBwPID[pid] = 0;
+ fNchBwPlusPID[pid] = 0;
+ fNchBwMinusPID[pid] = 0;
+ fSumPtBwPID[pid] = 0;
+ fSumEtBwPID[pid] = 0;
+ }
+}
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: Satyajit Jena. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-\r
-//=========================================================================//\r
-// AliEbyE Analysis for Particle Ratio Fluctuation //\r
-// Deepika Rathee | Satyajit Jena //\r
-// drathee@cern.ch | sjena@cern.ch //\r
-//\r
-// V0.1 2013/03/25 Using THnSparse\r
-// V0.2 2013/04/03 Cleanup\r
-// V1.0 2013/04/10 Cleanup Bins for Less Memory\r
-// V1.1 2013/04/15 Bins Added \r
-// Todo: pp and pA, Mix Events\r
-//=========================================================================//\r
-\r
-#include "TChain.h"\r
-#include "TList.h"\r
-#include "TFile.h"\r
-#include "TTree.h"\r
-#include "TH1D.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h"\r
-#include "TCanvas.h"\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliVEvent.h"\r
-#include "AliESD.h"\r
-#include "AliESDEvent.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAODMCHeader.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliAODHeader.h"\r
-#include "AliAODpidUtil.h"\r
-#include "AliHelperPID.h"\r
-using std::endl;\r
-using std::cout;\r
-#include "AliEbyEParticleRatioFluctuationTask.h"\r
-\r
-ClassImp(AliEbyEParticleRatioFluctuationTask)\r
-\r
-//-----------------------------------------------------------------------\r
-AliEbyEParticleRatioFluctuationTask::AliEbyEParticleRatioFluctuationTask( const char *name ) : AliAnalysisTaskSE( name ), \r
- fThnList(NULL), \r
- fAnalysisType("AOD"), \r
- fAnalysisData("PbPb"), \r
- fCentralityEstimator("V0M"), \r
- fVxMax(3.), \r
- fVyMax(3.), \r
- fVzMax(10.), \r
- fDCAxy(2.4), \r
- fDCAz(3.2), \r
- fPtLowerLimit(0.2), \r
- fPtHigherLimit(5.), \r
- fEtaLowerLimit(-1.), \r
- fEtaHigherLimit(1.), \r
- fTPCNClus(80),\r
- fAODtrackCutBit(128), \r
- isQA(kFALSE), \r
- fDebug(kFALSE), \r
- fHelperPID(0x0),\r
- fEventCounter(NULL), \r
- fHistoCorrelation(NULL) { \r
- for(Int_t i = 0; i < 14; i++ ) fHistQA[i] = NULL;\r
- DefineOutput(1, TList::Class()); //! Connect Outpput....\r
-}\r
-\r
-AliEbyEParticleRatioFluctuationTask::~AliEbyEParticleRatioFluctuationTask() {\r
- //! Cleaning up\r
- if (fThnList) delete fThnList;\r
- if (fHelperPID) delete fHelperPID;\r
-}\r
-\r
-//---------------------------------------------------------------------------------\r
-void AliEbyEParticleRatioFluctuationTask::UserCreateOutputObjects() {\r
- fThnList = new TList();\r
- fThnList->SetOwner(kTRUE);\r
-\r
- fEventCounter = new TH1D("fEventCounter","EventCounter", 300, 0.5,300.5);\r
- if (isQA) fThnList->Add(fEventCounter);\r
- \r
- fHistQA[0] = new TH2F("fHistQAvx", "Histo Vx Selected;Centrality;Vx", 100,0,100, 5000, -5., 5.);\r
- fHistQA[1] = new TH2F("fHistQAvy", "Histo Vy Selected;Centrality;Vy", 100,0,100, 5000, -5., 5.);\r
- fHistQA[2] = new TH2F("fHistQAvz", "Histo Vz Selected;Centrality;Vz", 100,0,100, 5000, -25., 25.); \r
- fHistQA[3] = new TH2F("fHistQAvxA", "Histo Vx;Centrality;Vx", 100,0,100, 5000, -5., 5.);\r
- fHistQA[4] = new TH2F("fHistQAvyA", "Histo Vy;Centrality;Vy", 100,0,100, 5000, -5., 5.);\r
- fHistQA[5] = new TH2F("fHistQAvzA", "Histo Vz;Centrality;Vz", 100,0,100, 5000, -25., 25.);\r
-\r
- fHistQA[6] = new TH2F("fHistQADcaXyA", "Histo DCAxy;Centrality;DCAxy",100,0,100, 600, -15., 15.);\r
- fHistQA[7] = new TH2F("fHistQADcaZA", "Histo DCAz;Centrality;DCAz ",100,0,100, 600, -15., 15.); \r
- fHistQA[8] = new TH2F("fHistQAPtA","p_{T} distribution;Centrality;p_{T}",100,0,100,1000,0,10);\r
- fHistQA[9] = new TH2F("fHistQAEtaA","#eta distribution;Centrality;#eta",100,0,100,240,-1.2,1.2);\r
-\r
- fHistQA[10] = new TH2F("fHistQADcaXy", "Histo DCAxy after Selected;Centrality;DCAxy", 100,0,100,600, -15., 15.);\r
- fHistQA[11] = new TH2F("fHistQADcaZ", "Histo DCAz Selected;Centrality;DCAz", 100,0,100,600, -15., 15.); \r
- fHistQA[12] = new TH2F("fHistQAPt","p_{T} distribution Selected;Centrality;p_{T}",100,0,100,1000,0,10);\r
- fHistQA[13] = new TH2F("fHistQAEta","#eta distribution Selected;Centrality;#eta",100,0,100, 240,-1.2,1.2);\r
- \r
- if (isQA) for(Int_t i = 0; i < 14; i++) fThnList->Add(fHistQA[i]);\r
- \r
- Int_t fgSparseDataBins[kNSparseData] = {100, 5000, 5000, 2500, 2500, 3000, 1500, 1500, 1000, 500, 500, 500, 250, 250};\r
- Double_t fgSparseDataMin[kNSparseData] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};\r
- Double_t fgSparseDataMax[kNSparseData] = {100.,5000.,5000.,2500.,2500.,3000.,1500.,1500.,1000.,500.,500.,500.,250.,250.};\r
- \r
- const Char_t *fgkSparseDataTitle[] = {"centrality","RefMult","N_{ch}", "N_{+}","N_{-}","N_{#pi}", "N_{#pi^{+}}","N_{#pi^{-}}","N_{K}","N_{K^{+}}", "N_{K^{-}}","N_{p}","N_{p}","N_{#bar{p}}"};\r
- \r
- fHistoCorrelation = new THnSparseI("fThnCorr", "", kNSparseData, fgSparseDataBins, fgSparseDataMin, fgSparseDataMax);\r
- for (Int_t iaxis = 0; iaxis < kNSparseData; iaxis++)\r
- fHistoCorrelation->GetAxis(iaxis)->SetTitle(fgkSparseDataTitle[iaxis]);\r
- \r
- if(!isQA) fThnList->Add(fHistoCorrelation);\r
- if(isQA) \r
- if (fHelperPID)\r
- fThnList->Add(fHelperPID);\r
- \r
- PostData(1, fThnList);\r
-}\r
-\r
-//----------------------------------------------------------------------------------\r
-void AliEbyEParticleRatioFluctuationTask::UserExec( Option_t * ){\r
-\r
- if (isQA) fEventCounter->Fill(1);\r
-\r
- AliAODEvent* event = dynamic_cast<AliAODEvent*>(InputEvent());\r
- if (!event) {\r
- Printf("ERROR 01: AOD not found ");\r
- return;\r
- }\r
-\r
- Int_t gCent = -1;\r
- Float_t gRefMul = -1;\r
- \r
- AliAODHeader *aodHeader = event->GetHeader();\r
- gCent = (Int_t)aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
- gRefMul = aodHeader->GetRefMultiplicity();\r
- if (gCent < 0 || gCent > 100) return;\r
- if (isQA) fEventCounter->Fill(2); \r
-\r
- if (!AcceptEvent(event,gCent)) return;\r
- \r
- Int_t icharge = -1;\r
- Int_t gCharge[2];\r
- Int_t gPid[3][2];\r
- \r
- for (Int_t i = 0; i < 2; i++) {\r
- gCharge[i] = 0;\r
- for (Int_t ii = 0; ii < 3; ii++) {\r
- gPid[ii][i] = 0;\r
- }\r
- }\r
-\r
-\r
- if(fAnalysisType == "AOD") {\r
- if (isQA) {\r
- fEventCounter->Fill(5);\r
- fEventCounter->Fill(50+gCent);\r
- }\r
- \r
- for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {\r
- AliAODTrack* track = dynamic_cast<AliAODTrack *>(event->GetTrack(itrk));\r
- if (!track) continue;\r
- \r
- if (!AcceptTrack(track, gCent)) continue;\r
- \r
- Int_t a = fHelperPID->GetParticleSpecies((AliVTrack*) track,kTRUE);\r
-\r
- if(a < 0 || a > 2) continue;\r
- icharge = track->Charge() > 0 ? 0 : 1;\r
- gCharge[icharge]++;\r
- gPid[a][icharge]++;\r
- }\r
- }\r
- else if(fAnalysisType == "MCAOD") {\r
- TClonesArray *arrayMC= 0; \r
- arrayMC = dynamic_cast<TClonesArray*> (event->GetList()->FindObject(AliAODMCParticle::StdBranchName()));\r
- if (!arrayMC) {\r
- Printf("Error: MC particles branch not found!\n");\r
- return;\r
- }\r
- AliAODMCHeader *mcHdr=0;\r
- mcHdr=(AliAODMCHeader*)event->GetList()->FindObject(AliAODMCHeader::StdBranchName()); \r
- if(!mcHdr) {\r
- Printf("MC header branch not found!\n");\r
- return;\r
- }\r
- \r
- if (isQA) {\r
- fEventCounter->Fill(5);\r
- fEventCounter->Fill(50+gCent);\r
- }\r
- \r
- Int_t nMC = arrayMC->GetEntries();\r
- for (Int_t iMC = 0; iMC < nMC; iMC++) {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);\r
- if(!AcceptMCTrack(partMC, gCent)) continue;\r
- Int_t a = fHelperPID->GetMCParticleSpecie((AliVEvent*) event,(AliVTrack*)partMC,1);\r
- if(a < 0 || a > 2) continue;\r
- icharge = partMC->Charge() > 0 ? 0 : 1;\r
- gCharge[icharge]++;\r
- gPid[a][icharge]++;\r
- }\r
- }\r
- else {\r
- printf(" No Event Type is Defined ");\r
- return;\r
- }\r
- \r
- if( (gCharge[0] + gCharge[1]) != 0 ) {\r
- if (isQA) {\r
- fEventCounter->Fill(6); \r
- fEventCounter->Fill(160 + gCent);\r
- }\r
- else { \r
- Double_t vsparse[kNSparseData];\r
- vsparse[0] = gCent;\r
- vsparse[1] = gRefMul;\r
- vsparse[2] = gCharge[0] + gCharge[1];\r
- vsparse[3] = gCharge[0];\r
- vsparse[4] = gCharge[1];\r
- vsparse[5] = gPid[0][0] + gPid[0][1];\r
- vsparse[6] = gPid[0][0];\r
- vsparse[7] = gPid[0][1];\r
- vsparse[8] = gPid[1][0] + gPid[1][0];\r
- vsparse[9] = gPid[1][0];\r
- vsparse[10] = gPid[1][1];\r
- vsparse[11] = gPid[2][0] + gPid[2][1];\r
- vsparse[12] = gPid[2][0];\r
- vsparse[13] = gPid[2][1];\r
- fHistoCorrelation->Fill(vsparse);\r
- }\r
- }\r
- \r
- if(fDebug && isQA) Printf(" %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d", \r
- (Int_t)fEventCounter->GetBinContent(1), \r
- (Int_t)fEventCounter->GetBinContent(2), \r
- (Int_t)fEventCounter->GetBinContent(3), \r
- (Int_t)gCent, (Int_t)gRefMul, \r
- gCharge[0], gCharge[1], \r
- gPid[0][0], gPid[0][1], gPid[1][0], \r
- gPid[1][1], gPid[2][0], gPid[2][1]);\r
- \r
- PostData(1, fThnList);\r
-}\r
-\r
-void AliEbyEParticleRatioFluctuationTask::Terminate( Option_t * ){\r
- Info("AliEbyEParticleRatioFluctuationTask"," Task Successfully finished");\r
-}\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptEvent(AliAODEvent *event, Int_t cent) const {\r
- Bool_t ver = kFALSE;\r
- const AliAODVertex *vertex = event->GetPrimaryVertex();\r
- if(vertex) {\r
- Double32_t fCov[6];\r
- vertex->GetCovarianceMatrix(fCov);\r
- if(vertex->GetNContributors() > 0) {\r
- if(fCov[5] != 0) {\r
- \r
- if(isQA) { \r
- fEventCounter->Fill(3);\r
- fHistQA[3]->Fill(cent,vertex->GetX());\r
- fHistQA[4]->Fill(cent,vertex->GetY());\r
- fHistQA[5]->Fill(cent,vertex->GetZ());\r
- }\r
- \r
- if(TMath::Abs(vertex->GetX()) < fVxMax) {\r
- if(TMath::Abs(vertex->GetY()) < fVyMax) {\r
- if(TMath::Abs(vertex->GetZ()) < fVzMax) {\r
- ver = kTRUE;\r
- if(isQA) { \r
- fEventCounter->Fill(4);\r
- fHistQA[0]->Fill(cent,vertex->GetX());\r
- fHistQA[1]->Fill(cent,vertex->GetY());\r
- fHistQA[2]->Fill(cent,vertex->GetZ());\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- \r
- AliCentrality *centrality = event->GetCentrality();\r
- if (centrality->GetQuality() != 0) ver = kFALSE;\r
- return ver;\r
-}\r
-\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptTrack(AliAODTrack *track, Int_t cent) const {\r
- if(!track) return kFALSE;\r
- if (track->Charge() == 0 ) return kFALSE;\r
- \r
- if(isQA) {\r
- fHistQA[6]->Fill(cent,track->DCA());\r
- fHistQA[7]->Fill(cent,track->ZAtDCA());\r
- fHistQA[8]->Fill(cent,track->Pt());\r
- fHistQA[9]->Fill(cent,track->Eta());\r
- }\r
- \r
- if (!track->TestFilterBit(fAODtrackCutBit)) return kFALSE;\r
-\r
- if (track->Eta() < fEtaLowerLimit ||\r
- track->Eta() > fEtaHigherLimit) return kFALSE;\r
- if (track->Pt() < fPtLowerLimit ||\r
- track->Pt() > fPtHigherLimit) return kFALSE; \r
- if ( track->DCA() > fDCAxy ) return kFALSE; \r
- if ( track->ZAtDCA() > fDCAz ) return kFALSE;\r
- \r
- if(isQA) {\r
- fHistQA[10]->Fill(cent,track->DCA());\r
- fHistQA[11]->Fill(cent,track->ZAtDCA());\r
- fHistQA[12]->Fill(cent,track->Pt());\r
- fHistQA[13]->Fill(cent,track->Eta());\r
- }\r
- \r
- return kTRUE;\r
-}\r
-\r
-\r
-//___________________________________________________________\r
-Bool_t AliEbyEParticleRatioFluctuationTask::AcceptMCTrack(AliAODMCParticle *track, Int_t cent) const {\r
- if(!track) return kFALSE;\r
- if(!track->IsPhysicalPrimary()) return kFALSE;\r
- if (track->Charge() == 0 ) return kFALSE;\r
- if(isQA) {\r
- fHistQA[8]->Fill(cent,track->Pt());\r
- fHistQA[9]->Fill(cent,track->Eta());\r
- }\r
-\r
- if (track->Eta() < fEtaLowerLimit ||\r
- track->Eta() > fEtaHigherLimit) return kFALSE;\r
- if (track->Pt() < fPtLowerLimit ||\r
- track->Pt() > fPtHigherLimit) return kFALSE; \r
- \r
- if(isQA) {\r
- fHistQA[12]->Fill(cent,track->Pt());\r
- fHistQA[13]->Fill(cent,track->Eta());\r
- }\r
- \r
- return kTRUE;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: Satyajit Jena. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+
+//=========================================================================//
+// AliEbyE Analysis for Particle Ratio Fluctuation //
+// Deepika Rathee | Satyajit Jena //
+// drathee@cern.ch | sjena@cern.ch //
+//
+// V0.1 2013/03/25 Using THnSparse
+// V0.2 2013/04/03 Cleanup
+// V1.0 2013/04/10 Cleanup Bins for Less Memory
+// V1.1 2013/04/15 Bins Added
+// Todo: pp and pA, Mix Events
+//=========================================================================//
+
+#include "TChain.h"
+#include "TList.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TH1D.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TCanvas.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliVEvent.h"
+#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliAODEvent.h"
+#include "AliAODMCParticle.h"
+#include "AliAODMCHeader.h"
+#include "AliPIDResponse.h"
+#include "AliAODHeader.h"
+#include "AliAODpidUtil.h"
+#include "AliHelperPID.h"
+using std::endl;
+using std::cout;
+#include "AliEbyEParticleRatioFluctuationTask.h"
+
+ClassImp(AliEbyEParticleRatioFluctuationTask)
+
+//-----------------------------------------------------------------------
+AliEbyEParticleRatioFluctuationTask::AliEbyEParticleRatioFluctuationTask( const char *name ) : AliAnalysisTaskSE( name ),
+ fThnList(NULL),
+ fAnalysisType("AOD"),
+ fAnalysisData("PbPb"),
+ fCentralityEstimator("V0M"),
+ fVxMax(3.),
+ fVyMax(3.),
+ fVzMax(10.),
+ fDCAxy(2.4),
+ fDCAz(3.2),
+ fPtLowerLimit(0.2),
+ fPtHigherLimit(5.),
+ fEtaLowerLimit(-1.),
+ fEtaHigherLimit(1.),
+ fTPCNClus(80),
+ fAODtrackCutBit(128),
+ isQA(kFALSE),
+ fDebug(kFALSE),
+ fHelperPID(0x0),
+ fEventCounter(NULL),
+ fHistoCorrelation(NULL) {
+ for(Int_t i = 0; i < 14; i++ ) fHistQA[i] = NULL;
+ DefineOutput(1, TList::Class()); //! Connect Outpput....
+}
+
+AliEbyEParticleRatioFluctuationTask::~AliEbyEParticleRatioFluctuationTask() {
+ //! Cleaning up
+ if (fThnList) delete fThnList;
+ if (fHelperPID) delete fHelperPID;
+}
+
+//---------------------------------------------------------------------------------
+void AliEbyEParticleRatioFluctuationTask::UserCreateOutputObjects() {
+ fThnList = new TList();
+ fThnList->SetOwner(kTRUE);
+
+ fEventCounter = new TH1D("fEventCounter","EventCounter", 300, 0.5,300.5);
+ if (isQA) fThnList->Add(fEventCounter);
+
+ fHistQA[0] = new TH2F("fHistQAvx", "Histo Vx Selected;Centrality;Vx", 100,0,100, 5000, -5., 5.);
+ fHistQA[1] = new TH2F("fHistQAvy", "Histo Vy Selected;Centrality;Vy", 100,0,100, 5000, -5., 5.);
+ fHistQA[2] = new TH2F("fHistQAvz", "Histo Vz Selected;Centrality;Vz", 100,0,100, 5000, -25., 25.);
+ fHistQA[3] = new TH2F("fHistQAvxA", "Histo Vx;Centrality;Vx", 100,0,100, 5000, -5., 5.);
+ fHistQA[4] = new TH2F("fHistQAvyA", "Histo Vy;Centrality;Vy", 100,0,100, 5000, -5., 5.);
+ fHistQA[5] = new TH2F("fHistQAvzA", "Histo Vz;Centrality;Vz", 100,0,100, 5000, -25., 25.);
+
+ fHistQA[6] = new TH2F("fHistQADcaXyA", "Histo DCAxy;Centrality;DCAxy",100,0,100, 600, -15., 15.);
+ fHistQA[7] = new TH2F("fHistQADcaZA", "Histo DCAz;Centrality;DCAz ",100,0,100, 600, -15., 15.);
+ fHistQA[8] = new TH2F("fHistQAPtA","p_{T} distribution;Centrality;p_{T}",100,0,100,1000,0,10);
+ fHistQA[9] = new TH2F("fHistQAEtaA","#eta distribution;Centrality;#eta",100,0,100,240,-1.2,1.2);
+
+ fHistQA[10] = new TH2F("fHistQADcaXy", "Histo DCAxy after Selected;Centrality;DCAxy", 100,0,100,600, -15., 15.);
+ fHistQA[11] = new TH2F("fHistQADcaZ", "Histo DCAz Selected;Centrality;DCAz", 100,0,100,600, -15., 15.);
+ fHistQA[12] = new TH2F("fHistQAPt","p_{T} distribution Selected;Centrality;p_{T}",100,0,100,1000,0,10);
+ fHistQA[13] = new TH2F("fHistQAEta","#eta distribution Selected;Centrality;#eta",100,0,100, 240,-1.2,1.2);
+
+ if (isQA) for(Int_t i = 0; i < 14; i++) fThnList->Add(fHistQA[i]);
+
+ Int_t fgSparseDataBins[kNSparseData] = {100, 5000, 5000, 2500, 2500, 3000, 1500, 1500, 1000, 500, 500, 500, 250, 250};
+ Double_t fgSparseDataMin[kNSparseData] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
+ Double_t fgSparseDataMax[kNSparseData] = {100.,5000.,5000.,2500.,2500.,3000.,1500.,1500.,1000.,500.,500.,500.,250.,250.};
+
+ const Char_t *fgkSparseDataTitle[] = {"centrality","RefMult","N_{ch}", "N_{+}","N_{-}","N_{#pi}", "N_{#pi^{+}}","N_{#pi^{-}}","N_{K}","N_{K^{+}}", "N_{K^{-}}","N_{p}","N_{p}","N_{#bar{p}}"};
+
+ fHistoCorrelation = new THnSparseI("fThnCorr", "", kNSparseData, fgSparseDataBins, fgSparseDataMin, fgSparseDataMax);
+ for (Int_t iaxis = 0; iaxis < kNSparseData; iaxis++)
+ fHistoCorrelation->GetAxis(iaxis)->SetTitle(fgkSparseDataTitle[iaxis]);
+
+ if(!isQA) fThnList->Add(fHistoCorrelation);
+ if(isQA)
+ if (fHelperPID)
+ fThnList->Add(fHelperPID);
+
+ PostData(1, fThnList);
+}
+
+//----------------------------------------------------------------------------------
+void AliEbyEParticleRatioFluctuationTask::UserExec( Option_t * ){
+
+ if (isQA) fEventCounter->Fill(1);
+
+ AliAODEvent* event = dynamic_cast<AliAODEvent*>(InputEvent());
+ if (!event) {
+ Printf("ERROR 01: AOD not found ");
+ return;
+ }
+
+ Int_t gCent = -1;
+ Float_t gRefMul = -1;
+
+ AliAODHeader *aodHeader = event->GetHeader();
+ gCent = (Int_t)aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());
+ gRefMul = aodHeader->GetRefMultiplicity();
+ if (gCent < 0 || gCent > 100) return;
+ if (isQA) fEventCounter->Fill(2);
+
+ if (!AcceptEvent(event,gCent)) return;
+
+ Int_t icharge = -1;
+ Int_t gCharge[2];
+ Int_t gPid[3][2];
+
+ for (Int_t i = 0; i < 2; i++) {
+ gCharge[i] = 0;
+ for (Int_t ii = 0; ii < 3; ii++) {
+ gPid[ii][i] = 0;
+ }
+ }
+
+
+ if(fAnalysisType == "AOD") {
+ if (isQA) {
+ fEventCounter->Fill(5);
+ fEventCounter->Fill(50+gCent);
+ }
+
+ for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {
+ AliAODTrack* track = dynamic_cast<AliAODTrack *>(event->GetTrack(itrk));
+ if (!track) continue;
+
+ if (!AcceptTrack(track, gCent)) continue;
+
+ Int_t a = fHelperPID->GetParticleSpecies((AliVTrack*) track,kTRUE);
+
+ if(a < 0 || a > 2) continue;
+ icharge = track->Charge() > 0 ? 0 : 1;
+ gCharge[icharge]++;
+ gPid[a][icharge]++;
+ }
+ }
+ else if(fAnalysisType == "MCAOD") {
+ TClonesArray *arrayMC= 0;
+ arrayMC = dynamic_cast<TClonesArray*> (event->GetList()->FindObject(AliAODMCParticle::StdBranchName()));
+ if (!arrayMC) {
+ Printf("Error: MC particles branch not found!\n");
+ return;
+ }
+ AliAODMCHeader *mcHdr=0;
+ mcHdr=(AliAODMCHeader*)event->GetList()->FindObject(AliAODMCHeader::StdBranchName());
+ if(!mcHdr) {
+ Printf("MC header branch not found!\n");
+ return;
+ }
+
+ if (isQA) {
+ fEventCounter->Fill(5);
+ fEventCounter->Fill(50+gCent);
+ }
+
+ Int_t nMC = arrayMC->GetEntries();
+ for (Int_t iMC = 0; iMC < nMC; iMC++) {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);
+ if(!AcceptMCTrack(partMC, gCent)) continue;
+ Int_t a = fHelperPID->GetMCParticleSpecie((AliVEvent*) event,(AliVTrack*)partMC,1);
+ if(a < 0 || a > 2) continue;
+ icharge = partMC->Charge() > 0 ? 0 : 1;
+ gCharge[icharge]++;
+ gPid[a][icharge]++;
+ }
+ }
+ else {
+ printf(" No Event Type is Defined ");
+ return;
+ }
+
+ if( (gCharge[0] + gCharge[1]) != 0 ) {
+ if (isQA) {
+ fEventCounter->Fill(6);
+ fEventCounter->Fill(160 + gCent);
+ }
+ else {
+ Double_t vsparse[kNSparseData];
+ vsparse[0] = gCent;
+ vsparse[1] = gRefMul;
+ vsparse[2] = gCharge[0] + gCharge[1];
+ vsparse[3] = gCharge[0];
+ vsparse[4] = gCharge[1];
+ vsparse[5] = gPid[0][0] + gPid[0][1];
+ vsparse[6] = gPid[0][0];
+ vsparse[7] = gPid[0][1];
+ vsparse[8] = gPid[1][0] + gPid[1][0];
+ vsparse[9] = gPid[1][0];
+ vsparse[10] = gPid[1][1];
+ vsparse[11] = gPid[2][0] + gPid[2][1];
+ vsparse[12] = gPid[2][0];
+ vsparse[13] = gPid[2][1];
+ fHistoCorrelation->Fill(vsparse);
+ }
+ }
+
+ if(fDebug && isQA) Printf(" %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d",
+ (Int_t)fEventCounter->GetBinContent(1),
+ (Int_t)fEventCounter->GetBinContent(2),
+ (Int_t)fEventCounter->GetBinContent(3),
+ (Int_t)gCent, (Int_t)gRefMul,
+ gCharge[0], gCharge[1],
+ gPid[0][0], gPid[0][1], gPid[1][0],
+ gPid[1][1], gPid[2][0], gPid[2][1]);
+
+ PostData(1, fThnList);
+}
+
+void AliEbyEParticleRatioFluctuationTask::Terminate( Option_t * ){
+ Info("AliEbyEParticleRatioFluctuationTask"," Task Successfully finished");
+}
+
+//___________________________________________________________
+Bool_t AliEbyEParticleRatioFluctuationTask::AcceptEvent(AliAODEvent *event, Int_t cent) const {
+ Bool_t ver = kFALSE;
+ const AliAODVertex *vertex = event->GetPrimaryVertex();
+ if(vertex) {
+ Double32_t fCov[6];
+ vertex->GetCovarianceMatrix(fCov);
+ if(vertex->GetNContributors() > 0) {
+ if(fCov[5] != 0) {
+
+ if(isQA) {
+ fEventCounter->Fill(3);
+ fHistQA[3]->Fill(cent,vertex->GetX());
+ fHistQA[4]->Fill(cent,vertex->GetY());
+ fHistQA[5]->Fill(cent,vertex->GetZ());
+ }
+
+ if(TMath::Abs(vertex->GetX()) < fVxMax) {
+ if(TMath::Abs(vertex->GetY()) < fVyMax) {
+ if(TMath::Abs(vertex->GetZ()) < fVzMax) {
+ ver = kTRUE;
+ if(isQA) {
+ fEventCounter->Fill(4);
+ fHistQA[0]->Fill(cent,vertex->GetX());
+ fHistQA[1]->Fill(cent,vertex->GetY());
+ fHistQA[2]->Fill(cent,vertex->GetZ());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ AliCentrality *centrality = event->GetCentrality();
+ if (centrality->GetQuality() != 0) ver = kFALSE;
+ return ver;
+}
+
+
+//___________________________________________________________
+Bool_t AliEbyEParticleRatioFluctuationTask::AcceptTrack(AliAODTrack *track, Int_t cent) const {
+ if(!track) return kFALSE;
+ if (track->Charge() == 0 ) return kFALSE;
+
+ if(isQA) {
+ fHistQA[6]->Fill(cent,track->DCA());
+ fHistQA[7]->Fill(cent,track->ZAtDCA());
+ fHistQA[8]->Fill(cent,track->Pt());
+ fHistQA[9]->Fill(cent,track->Eta());
+ }
+
+ if (!track->TestFilterBit(fAODtrackCutBit)) return kFALSE;
+
+ if (track->Eta() < fEtaLowerLimit ||
+ track->Eta() > fEtaHigherLimit) return kFALSE;
+ if (track->Pt() < fPtLowerLimit ||
+ track->Pt() > fPtHigherLimit) return kFALSE;
+ if ( track->DCA() > fDCAxy ) return kFALSE;
+ if ( track->ZAtDCA() > fDCAz ) return kFALSE;
+
+ if(isQA) {
+ fHistQA[10]->Fill(cent,track->DCA());
+ fHistQA[11]->Fill(cent,track->ZAtDCA());
+ fHistQA[12]->Fill(cent,track->Pt());
+ fHistQA[13]->Fill(cent,track->Eta());
+ }
+
+ return kTRUE;
+}
+
+
+//___________________________________________________________
+Bool_t AliEbyEParticleRatioFluctuationTask::AcceptMCTrack(AliAODMCParticle *track, Int_t cent) const {
+ if(!track) return kFALSE;
+ if(!track->IsPhysicalPrimary()) return kFALSE;
+ if (track->Charge() == 0 ) return kFALSE;
+ if(isQA) {
+ fHistQA[8]->Fill(cent,track->Pt());
+ fHistQA[9]->Fill(cent,track->Eta());
+ }
+
+ if (track->Eta() < fEtaLowerLimit ||
+ track->Eta() > fEtaHigherLimit) return kFALSE;
+ if (track->Pt() < fPtLowerLimit ||
+ track->Pt() > fPtHigherLimit) return kFALSE;
+
+ if(isQA) {
+ fHistQA[12]->Fill(cent,track->Pt());
+ fHistQA[13]->Fill(cent,track->Eta());
+ }
+
+ return kTRUE;
+}
-// now in options\r
-//=============================================//\r
-//const char* centralityEstimator = "V0M";\r
-//const char* centralityEstimator = "CL1";\r
-//const char* centralityEstimator = "TRK";\r
-//=============================================//\r
-//Bool_t gRunShuffling = kFALSE;\r
-//Bool_t gRunShuffling = kTRUE;\r
-//=============================================//\r
-\r
-//PID config\r
-Bool_t kUseNSigmaPID = kTRUE;\r
-Double_t nSigmaMax = 3.0;\r
-Bool_t kUseBayesianPID = kFALSE;\r
-Double_t gMinAcceptedProbability = 0.7;\r
-\r
-//_________________________________________________________//\r
-AliAnalysisTaskBFPsi *AddTaskBalancePsiCentralityTrain(Double_t centrMin=0.,\r
- Double_t centrMax=100.,\r
- Bool_t gRunShuffling=kFALSE,\r
- Bool_t gRunMixing=kTRUE,\r
- Bool_t gRunMixingWithEventPlane=kFALSE,\r
- TString centralityEstimator="V0M",\r
- Double_t vertexZ=10.,\r
- Double_t DCAxy=-1,\r
- Double_t DCAz=-1,\r
- Double_t ptMin=0.3,\r
- Double_t ptMax=1.5,\r
- Double_t etaMin=-0.8,\r
- Double_t etaMax=0.8,\r
- Double_t maxTPCchi2 = -1, \r
- Int_t minNClustersTPC = -1,\r
- Bool_t kUsePID = kTRUE,\r
- Bool_t bResonancesCut = kTRUE,\r
- Bool_t bHBTcut = kTRUE,\r
- Double_t HBTCutValue = 0.02,\r
- Bool_t bConversionCut = kTRUE,\r
- Double_t invMassForConversionCut = 0.04,\r
- Bool_t bMomentumDifferenceCut = kTRUE,\r
- Double_t fQCutMin = 0.0,\r
- Int_t AODfilterBit = 128,\r
- Bool_t bCentralTrigger = kFALSE,\r
- TString fileNameBase="AnalysisResults",\r
- TString dirNameExtra="",\r
- TString fArgEventClass="Centrality",\r
- TString analysisTypeUser="AOD",\r
- Bool_t bVertexBinning=kTRUE,\r
- Double_t sigmaElectronRejection=3,\r
- Bool_t electronExclusiveRejection=kFALSE,\r
- TString correctionFileName = "",\r
- Int_t nCentralityArrayBinsForCorrection,\r
- Double_t *gCentralityArrayForCorrections) {\r
- // Creates a balance function analysis task and adds it to the analysis manager.\r
- // Get the pointer to the existing analysis manager via the static access method.\r
- TString outputFileName(fileNameBase);\r
- outputFileName.Append(".root");\r
-\r
- //===========================================================================\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- ::Error("AddTaskBF", "No analysis manager to connect to.");\r
- return NULL;\r
- }\r
-\r
- // Check the analysis type using the event handlers connected to the analysis manager.\r
- //===========================================================================\r
- if (!mgr->GetInputEventHandler()) {\r
- ::Error("AddTaskBF", "This task requires an input event handler");\r
- return NULL;\r
- }\r
- TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
- if(dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())) analysisType = "MC";\r
- \r
- // to set the analysis type manually\r
- if(analysisTypeUser != ""){\r
- analysisType = analysisTypeUser;\r
- ::Info("AddTaskBF",Form("Analysis Type manually set to %s",analysisType.Data()));\r
- }\r
-\r
- // for local changed BF configuration\r
- //gROOT->LoadMacro("./configBalanceFunctionPsiAnalysis.C");\r
- gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/configBalanceFunctionPsiAnalysis.C");\r
- AliBalancePsi *bf = 0; // Balance Function object\r
- AliBalancePsi *bfs = 0; // shuffled Balance function object\r
- AliBalancePsi *bfm = 0; // mixing Balance function object\r
-\r
- //maximum Delta eta range\r
- Double_t deltaEtaMax=TMath::Abs(etaMax-etaMin);\r
-\r
- if (analysisType=="ESD"){\r
- bf = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunMixing) bfm = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- }\r
- else if (analysisType=="AOD"){\r
- bf = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunMixing) bfm = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- }\r
- else if (analysisType=="MC"){\r
- bf = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunMixing) bfm = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- }\r
- else if (analysisType=="MCAOD"){\r
- bf = GetBalanceFunctionObject("MCAOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunShuffling) bfs = GetBalanceFunctionObject("MCAOD",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunMixing) bfm = GetBalanceFunctionObject("MCAOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- }\r
- else if (analysisType=="MCAODrec"){\r
- bf = GetBalanceFunctionObject("MCAODrec",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunShuffling) bfs = GetBalanceFunctionObject("MCAODrec",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- if(gRunMixing) bfm = GetBalanceFunctionObject("MCAODrec",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);\r
- }\r
- else{\r
- ::Error("AddTaskBF", "analysis type NOT known.");\r
- return NULL;\r
- }\r
-\r
- // Create the task, add it to manager and configure it.\r
- //===========================================================================\r
- AliAnalysisTaskBFPsi *taskBF = new AliAnalysisTaskBFPsi(Form("TaskBFPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()));\r
- \r
- //Event characteristics scheme\r
- taskBF->SetEventClass(fArgEventClass);\r
- //taskBF->SetCustomBinning("centralityVertex:0,80");\r
- //taskBF->SetCustomBinning("multiplicity:0,260");\r
- \r
- if(fArgEventClass == "Multiplicity") {\r
- taskBF->SetMultiplicityRange(centrMin,centrMax);\r
- taskBF->SetMultiplicityEstimator(centralityEstimator);\r
- cout<<"Multiplicity estimator "<<centralityEstimator.Data()<<endl;\r
- }\r
- else if(fArgEventClass == "Centrality") {\r
- if(analysisType == "MC")\r
- taskBF->SetImpactParameterRange(centrMin,centrMax);\r
- else {\r
- taskBF->SetCentralityPercentileRange(centrMin,centrMax);\r
- // centrality estimator (default = V0M)\r
- taskBF->SetCentralityEstimator(centralityEstimator);\r
- cout<<"Centrality estimator "<<centralityEstimator.Data()<<endl;\r
- }\r
- }\r
-\r
- //++++++++++++++++++++++\r
- // Efficiency + Contamination corrections\r
- // If correctionFileName = "", do not use corrections\r
- if(correctionFileName != "")\r
- taskBF->SetInputCorrection(Form("$ALICE_ROOT/PWGCF/EBYE/BalanceFunctions/Corrections/%s",correctionFileName.Data()),nCentralityArrayBinsForCorrection,gCentralityArrayForCorrections);\r
-\r
- //+++++++++++++++++++++\r
-\r
- taskBF->SetAnalysisObject(bf);\r
- if(gRunShuffling) taskBF->SetShufflingObject(bfs);\r
- if(gRunMixing){\r
- taskBF->SetMixingObject(bfm);\r
- taskBF->SetMixingTracks(50000);\r
- if(gRunMixingWithEventPlane){\r
- taskBF->SetMixingWithEventPlane(gRunMixingWithEventPlane);\r
- }\r
- }\r
-\r
- if(analysisType == "ESD") {\r
- AliESDtrackCuts *trackCuts = GetTrackCutsObject(ptMin,ptMax,etaMin,etaMax,maxTPCchi2,DCAxy,DCAz,minNClustersTPC);\r
- taskBF->SetAnalysisCutObject(trackCuts);\r
- if(kUsePID) {\r
- if(kUseBayesianPID)\r
- taskBF->SetUseBayesianPID(gMinAcceptedProbability);\r
- else if(kUseNSigmaPID)\r
- taskBF->SetUseNSigmaPID(nSigmaMax);\r
- taskBF->SetParticleOfInterest(AliAnalysisTaskBFPsi::kPion);\r
- taskBF->SetDetectorUsedForPID(AliAnalysisTaskBFPsi::kTOFpid);\r
- }\r
- }\r
- else if(analysisType == "AOD") {\r
- // pt and eta cut (pt_min, pt_max, eta_min, eta_max)\r
- taskBF->SetAODtrackCutBit(AODfilterBit);\r
- taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);\r
-\r
- // set extra DCA cuts (-1 no extra cut)\r
- taskBF->SetExtraDCACutsAOD(DCAxy,DCAz);\r
-\r
- // set extra TPC chi2 / nr of clusters cut\r
- taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC);\r
-\r
- // electron rejection (so far only for AOD), <0 --> no rejection\r
- if(sigmaElectronRejection > 0){\r
- if(electronExclusiveRejection) taskBF->SetElectronOnlyRejection(sigmaElectronRejection); // no other particle in nsigma \r
- else taskBF->SetElectronRejection(sigmaElectronRejection); // check only if electrons in nsigma\r
- }\r
-\r
- //++++++++++++++++//\r
- if(kUsePID) {\r
- if(kUseBayesianPID)\r
- taskBF->SetUseBayesianPID(gMinAcceptedProbability);\r
- else if(kUseNSigmaPID)\r
- taskBF->SetUseNSigmaPID(nSigmaMax);\r
- taskBF->SetParticleOfInterest(AliAnalysisTaskBFPsi::kPion);\r
- taskBF->SetDetectorUsedForPID(AliAnalysisTaskBFPsi::kTPCTOF); //TOFpid,TPCpid\r
- }\r
- //++++++++++++++++//\r
-\r
- }\r
- else if(analysisType == "MC") {\r
- taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);\r
- }\r
- else if(analysisType == "MCAOD") {\r
- // pt and eta cut (pt_min, pt_max, eta_min, eta_max)\r
- taskBF->SetAODtrackCutBit(AODfilterBit);\r
- taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax); \r
- }\r
- else if(analysisType == "MCAODrec") { //++++++++++++++++\r
- // pt and eta cut (pt_min, pt_max, eta_min, eta_max)\r
- taskBF->SetAODtrackCutBit(AODfilterBit);\r
- taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax); \r
-\r
- // set extra DCA cuts (-1 no extra cut)\r
- taskBF->SetExtraDCACutsAOD(DCAxy,DCAz);\r
-\r
- // set extra TPC chi2 / nr of clusters cut\r
- taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC);\r
-\r
- // electron rejection (so far only for AOD), <0 --> no rejection\r
- if(sigmaElectronRejection > 0){\r
- if(electronExclusiveRejection) taskBF->SetElectronOnlyRejection(sigmaElectronRejection); // no other particle in nsigma \r
- else taskBF->SetElectronRejection(sigmaElectronRejection); // check only if electrons in nsigma\r
- }\r
- }//++++++++++++++++\r
-\r
- // offline trigger selection (AliVEvent.h)\r
- // taskBF->UseOfflineTrigger(); // NOT used (selection is done with the AliAnalysisTaskSE::SelectCollisionCandidates()) \r
- // with this only selected events are analyzed (first 2 bins in event QA histogram are the same))\r
- // documentation in https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PWG1EvSelDocumentation\r
- if(bCentralTrigger) taskBF->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);\r
- else taskBF->SelectCollisionCandidates(AliVEvent::kMB);\r
-\r
- // centrality estimator (default = V0M)\r
- taskBF->SetCentralityEstimator(centralityEstimator);\r
- \r
- // vertex cut (x,y,z)\r
- taskBF->SetVertexDiamond(3.,3.,vertexZ);\r
- \r
-\r
-\r
- //bf->PrintAnalysisSettings();\r
- mgr->AddTask(taskBF);\r
- \r
- // Create ONLY the output containers for the data produced by the task.\r
- // Get and connect other common input/output containers via the manager as below\r
- //==============================================================================\r
- TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
- outputFileName += ":PWGCFEbyE.outputBalanceFunctionPsiAnalysis";\r
- AliAnalysisDataContainer *coutQA = mgr->CreateContainer(Form("listQAPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
- AliAnalysisDataContainer *coutBF = mgr->CreateContainer(Form("listBFPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
- if(gRunShuffling) AliAnalysisDataContainer *coutBFS = mgr->CreateContainer(Form("listBFPsiShuffled_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
- if(gRunMixing) AliAnalysisDataContainer *coutBFM = mgr->CreateContainer(Form("listBFPsiMixed_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
- if(kUsePID || sigmaElectronRejection > 0) AliAnalysisDataContainer *coutQAPID = mgr->CreateContainer(Form("listQAPIDPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
-\r
- mgr->ConnectInput(taskBF, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(taskBF, 1, coutQA);\r
- mgr->ConnectOutput(taskBF, 2, coutBF);\r
- if(gRunShuffling) mgr->ConnectOutput(taskBF, 3, coutBFS);\r
- if(gRunMixing) mgr->ConnectOutput(taskBF, 4, coutBFM);\r
- if(kUsePID||sigmaElectronRejection > 0) mgr->ConnectOutput(taskBF, 5, coutQAPID);\r
- //if((kUsePID && analysisType == "AOD")||sigmaElectronRejection > 0) mgr->ConnectOutput(taskBF, 5, coutQAPID);\r
- //if((kUsePID && analysisType == "ESD")||sigmaElectronRejection > 0) mgr->ConnectOutput(taskBF, 5, coutQAPID);\r
-\r
- return taskBF;\r
-}\r
+// now in options
+//=============================================//
+//const char* centralityEstimator = "V0M";
+//const char* centralityEstimator = "CL1";
+//const char* centralityEstimator = "TRK";
+//=============================================//
+//Bool_t gRunShuffling = kFALSE;
+//Bool_t gRunShuffling = kTRUE;
+//=============================================//
+
+//PID config
+Bool_t kUseNSigmaPID = kTRUE;
+Double_t nSigmaMax = 3.0;
+Bool_t kUseBayesianPID = kFALSE;
+Double_t gMinAcceptedProbability = 0.7;
+
+//_________________________________________________________//
+AliAnalysisTaskBFPsi *AddTaskBalancePsiCentralityTrain(Double_t centrMin=0.,
+ Double_t centrMax=100.,
+ Bool_t gRunShuffling=kFALSE,
+ Bool_t gRunMixing=kTRUE,
+ Bool_t gRunMixingWithEventPlane=kFALSE,
+ TString centralityEstimator="V0M",
+ Double_t vertexZ=10.,
+ Double_t DCAxy=-1,
+ Double_t DCAz=-1,
+ Double_t ptMin=0.3,
+ Double_t ptMax=1.5,
+ Double_t etaMin=-0.8,
+ Double_t etaMax=0.8,
+ Double_t maxTPCchi2 = -1,
+ Int_t minNClustersTPC = -1,
+ Bool_t kUsePID = kTRUE,
+ Bool_t bResonancesCut = kTRUE,
+ Bool_t bHBTcut = kTRUE,
+ Double_t HBTCutValue = 0.02,
+ Bool_t bConversionCut = kTRUE,
+ Double_t invMassForConversionCut = 0.04,
+ Bool_t bMomentumDifferenceCut = kTRUE,
+ Double_t fQCutMin = 0.0,
+ Int_t AODfilterBit = 128,
+ Bool_t bCentralTrigger = kFALSE,
+ TString fileNameBase="AnalysisResults",
+ TString dirNameExtra="",
+ TString fArgEventClass="Centrality",
+ TString analysisTypeUser="AOD",
+ Bool_t bVertexBinning=kTRUE,
+ Double_t sigmaElectronRejection=3,
+ Bool_t electronExclusiveRejection=kFALSE,
+ TString correctionFileName = "",
+ Int_t nCentralityArrayBinsForCorrection,
+ Double_t *gCentralityArrayForCorrections) {
+ // Creates a balance function analysis task and adds it to the analysis manager.
+ // Get the pointer to the existing analysis manager via the static access method.
+ TString outputFileName(fileNameBase);
+ outputFileName.Append(".root");
+
+ //===========================================================================
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error("AddTaskBF", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis manager.
+ //===========================================================================
+ if (!mgr->GetInputEventHandler()) {
+ ::Error("AddTaskBF", "This task requires an input event handler");
+ return NULL;
+ }
+ TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+ if(dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())) analysisType = "MC";
+
+ // to set the analysis type manually
+ if(analysisTypeUser != ""){
+ analysisType = analysisTypeUser;
+ ::Info("AddTaskBF",Form("Analysis Type manually set to %s",analysisType.Data()));
+ }
+
+ // for local changed BF configuration
+ //gROOT->LoadMacro("./configBalanceFunctionPsiAnalysis.C");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/configBalanceFunctionPsiAnalysis.C");
+ AliBalancePsi *bf = 0; // Balance Function object
+ AliBalancePsi *bfs = 0; // shuffled Balance function object
+ AliBalancePsi *bfm = 0; // mixing Balance function object
+
+ //maximum Delta eta range
+ Double_t deltaEtaMax=TMath::Abs(etaMax-etaMin);
+
+ if (analysisType=="ESD"){
+ bf = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunMixing) bfm = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ }
+ else if (analysisType=="AOD"){
+ bf = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunMixing) bfm = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ }
+ else if (analysisType=="MC"){
+ bf = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunMixing) bfm = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ }
+ else if (analysisType=="MCAOD"){
+ bf = GetBalanceFunctionObject("MCAOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunShuffling) bfs = GetBalanceFunctionObject("MCAOD",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunMixing) bfm = GetBalanceFunctionObject("MCAOD",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ }
+ else if (analysisType=="MCAODrec"){
+ bf = GetBalanceFunctionObject("MCAODrec",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunShuffling) bfs = GetBalanceFunctionObject("MCAODrec",centralityEstimator,centrMin,centrMax,kTRUE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ if(gRunMixing) bfm = GetBalanceFunctionObject("MCAODrec",centralityEstimator,centrMin,centrMax,kFALSE,bResonancesCut,bHBTcut,HBTCutValue,bConversionCut,invMassForConversionCut,bMomentumDifferenceCut,fQCutMin,fArgEventClass,deltaEtaMax,bVertexBinning);
+ }
+ else{
+ ::Error("AddTaskBF", "analysis type NOT known.");
+ return NULL;
+ }
+
+ // Create the task, add it to manager and configure it.
+ //===========================================================================
+ AliAnalysisTaskBFPsi *taskBF = new AliAnalysisTaskBFPsi(Form("TaskBFPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()));
+
+ //Event characteristics scheme
+ taskBF->SetEventClass(fArgEventClass);
+ //taskBF->SetCustomBinning("centralityVertex:0,80");
+ //taskBF->SetCustomBinning("multiplicity:0,260");
+
+ if(fArgEventClass == "Multiplicity") {
+ taskBF->SetMultiplicityRange(centrMin,centrMax);
+ taskBF->SetMultiplicityEstimator(centralityEstimator);
+ cout<<"Multiplicity estimator "<<centralityEstimator.Data()<<endl;
+ }
+ else if(fArgEventClass == "Centrality") {
+ if(analysisType == "MC")
+ taskBF->SetImpactParameterRange(centrMin,centrMax);
+ else {
+ taskBF->SetCentralityPercentileRange(centrMin,centrMax);
+ // centrality estimator (default = V0M)
+ taskBF->SetCentralityEstimator(centralityEstimator);
+ cout<<"Centrality estimator "<<centralityEstimator.Data()<<endl;
+ }
+ }
+
+ //++++++++++++++++++++++
+ // Efficiency + Contamination corrections
+ // If correctionFileName = "", do not use corrections
+ if(correctionFileName != "")
+ taskBF->SetInputCorrection(Form("$ALICE_ROOT/PWGCF/EBYE/BalanceFunctions/Corrections/%s",correctionFileName.Data()),nCentralityArrayBinsForCorrection,gCentralityArrayForCorrections);
+
+ //+++++++++++++++++++++
+
+ taskBF->SetAnalysisObject(bf);
+ if(gRunShuffling) taskBF->SetShufflingObject(bfs);
+ if(gRunMixing){
+ taskBF->SetMixingObject(bfm);
+ taskBF->SetMixingTracks(50000);
+ if(gRunMixingWithEventPlane){
+ taskBF->SetMixingWithEventPlane(gRunMixingWithEventPlane);
+ }
+ }
+
+ if(analysisType == "ESD") {
+ AliESDtrackCuts *trackCuts = GetTrackCutsObject(ptMin,ptMax,etaMin,etaMax,maxTPCchi2,DCAxy,DCAz,minNClustersTPC);
+ taskBF->SetAnalysisCutObject(trackCuts);
+ if(kUsePID) {
+ if(kUseBayesianPID)
+ taskBF->SetUseBayesianPID(gMinAcceptedProbability);
+ else if(kUseNSigmaPID)
+ taskBF->SetUseNSigmaPID(nSigmaMax);
+ taskBF->SetParticleOfInterest(AliAnalysisTaskBFPsi::kPion);
+ taskBF->SetDetectorUsedForPID(AliAnalysisTaskBFPsi::kTOFpid);
+ }
+ }
+ else if(analysisType == "AOD") {
+ // pt and eta cut (pt_min, pt_max, eta_min, eta_max)
+ taskBF->SetAODtrackCutBit(AODfilterBit);
+ taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);
+
+ // set extra DCA cuts (-1 no extra cut)
+ taskBF->SetExtraDCACutsAOD(DCAxy,DCAz);
+
+ // set extra TPC chi2 / nr of clusters cut
+ taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC);
+
+ // electron rejection (so far only for AOD), <0 --> no rejection
+ if(sigmaElectronRejection > 0){
+ if(electronExclusiveRejection) taskBF->SetElectronOnlyRejection(sigmaElectronRejection); // no other particle in nsigma
+ else taskBF->SetElectronRejection(sigmaElectronRejection); // check only if electrons in nsigma
+ }
+
+ //++++++++++++++++//
+ if(kUsePID) {
+ if(kUseBayesianPID)
+ taskBF->SetUseBayesianPID(gMinAcceptedProbability);
+ else if(kUseNSigmaPID)
+ taskBF->SetUseNSigmaPID(nSigmaMax);
+ taskBF->SetParticleOfInterest(AliAnalysisTaskBFPsi::kPion);
+ taskBF->SetDetectorUsedForPID(AliAnalysisTaskBFPsi::kTPCTOF); //TOFpid,TPCpid
+ }
+ //++++++++++++++++//
+
+ }
+ else if(analysisType == "MC") {
+ taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);
+ }
+ else if(analysisType == "MCAOD") {
+ // pt and eta cut (pt_min, pt_max, eta_min, eta_max)
+ taskBF->SetAODtrackCutBit(AODfilterBit);
+ taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);
+ }
+ else if(analysisType == "MCAODrec") { //++++++++++++++++
+ // pt and eta cut (pt_min, pt_max, eta_min, eta_max)
+ taskBF->SetAODtrackCutBit(AODfilterBit);
+ taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);
+
+ // set extra DCA cuts (-1 no extra cut)
+ taskBF->SetExtraDCACutsAOD(DCAxy,DCAz);
+
+ // set extra TPC chi2 / nr of clusters cut
+ taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC);
+
+ // electron rejection (so far only for AOD), <0 --> no rejection
+ if(sigmaElectronRejection > 0){
+ if(electronExclusiveRejection) taskBF->SetElectronOnlyRejection(sigmaElectronRejection); // no other particle in nsigma
+ else taskBF->SetElectronRejection(sigmaElectronRejection); // check only if electrons in nsigma
+ }
+ }//++++++++++++++++
+
+ // offline trigger selection (AliVEvent.h)
+ // taskBF->UseOfflineTrigger(); // NOT used (selection is done with the AliAnalysisTaskSE::SelectCollisionCandidates())
+ // with this only selected events are analyzed (first 2 bins in event QA histogram are the same))
+ // documentation in https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PWG1EvSelDocumentation
+ if(bCentralTrigger) taskBF->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
+ else taskBF->SelectCollisionCandidates(AliVEvent::kMB);
+
+ // centrality estimator (default = V0M)
+ taskBF->SetCentralityEstimator(centralityEstimator);
+
+ // vertex cut (x,y,z)
+ taskBF->SetVertexDiamond(3.,3.,vertexZ);
+
+
+
+ //bf->PrintAnalysisSettings();
+ mgr->AddTask(taskBF);
+
+ // Create ONLY the output containers for the data produced by the task.
+ // Get and connect other common input/output containers via the manager as below
+ //==============================================================================
+ TString outputFileName = AliAnalysisManager::GetCommonFileName();
+ outputFileName += ":PWGCFEbyE.outputBalanceFunctionPsiAnalysis";
+ AliAnalysisDataContainer *coutQA = mgr->CreateContainer(Form("listQAPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
+ AliAnalysisDataContainer *coutBF = mgr->CreateContainer(Form("listBFPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
+ if(gRunShuffling) AliAnalysisDataContainer *coutBFS = mgr->CreateContainer(Form("listBFPsiShuffled_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
+ if(gRunMixing) AliAnalysisDataContainer *coutBFM = mgr->CreateContainer(Form("listBFPsiMixed_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
+ if(kUsePID || sigmaElectronRejection > 0) AliAnalysisDataContainer *coutQAPID = mgr->CreateContainer(Form("listQAPIDPsi_%.0f-%.0f_Bit%d_%s%s",centrMin,centrMax,AODfilterBit,centralityEstimator.Data(),dirNameExtra.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
+
+ mgr->ConnectInput(taskBF, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(taskBF, 1, coutQA);
+ mgr->ConnectOutput(taskBF, 2, coutBF);
+ if(gRunShuffling) mgr->ConnectOutput(taskBF, 3, coutBFS);
+ if(gRunMixing) mgr->ConnectOutput(taskBF, 4, coutBFM);
+ if(kUsePID||sigmaElectronRejection > 0) mgr->ConnectOutput(taskBF, 5, coutQAPID);
+ //if((kUsePID && analysisType == "AOD")||sigmaElectronRejection > 0) mgr->ConnectOutput(taskBF, 5, coutQAPID);
+ //if((kUsePID && analysisType == "ESD")||sigmaElectronRejection > 0) mgr->ConnectOutput(taskBF, 5, coutQAPID);
+
+ return taskBF;
+}
-//__________________________________________________//\r
-AliBalancePsi *GetBalanceFunctionObject(const char* analysisLevel = "MCAOD", //\r
- const char* centralityName = 0x0,\r
- Double_t centrMin = 0.,\r
- Double_t centrMax = 100.,\r
- Bool_t bShuffle = kFALSE,\r
- Bool_t bResonancesCut = kFALSE,\r
- Bool_t bHBTCut = kFALSE,\r
- Double_t HBTCutValue = 0.02,\r
- Bool_t bConversionCut = kFALSE,\r
- Double_t invMassForConversionCut = 0.04,\r
- Bool_t bMomentumDifferenceCut = kFALSE,\r
- Double_t fQCutMin = 0.0,\r
- TString fArgEventClass = "EventPlane",\r
- Double_t deltaEtaMax = 2.0,\r
- Bool_t bVertexBinning = kFALSE) {\r
- //Function to setup the AliBalance object and return it\r
- AliBalancePsi *gBalance = new AliBalancePsi();\r
- gBalance->SetAnalysisLevel(analysisLevel);\r
- gBalance->SetShuffle(bShuffle);\r
- if(bResonancesCut) gBalance->UseResonancesCut();\r
- if(bHBTCut) gBalance->UseHBTCut(HBTCutValue);\r
- if(bConversionCut) gBalance->UseConversionCut(invMassForConversionCut);\r
- if(bMomentumDifferenceCut) gBalance->UseMomentumDifferenceCut(fQCutMin);\r
- if(centralityName) gBalance->SetCentralityIdentifier(centralityName);\r
- if(bVertexBinning) gBalance->SetVertexZBinning();\r
- gBalance->SetCentralityInterval(centrMin,centrMax);\r
- gBalance->SetEventClass(fArgEventClass);\r
- gBalance->SetDeltaEtaMax(deltaEtaMax);\r
-\r
- //Set all analyses separately\r
- //Rapidity\r
- //gBalance->SetInterval(AliBalance::kRapidity,-0.8,0.8,32,-1.6,1.6,15.); \r
- //Eta\r
- //gBalance->SetInterval(AliBalance::kEta,-0.8,0.8,32,-1.6,1.6,15);\r
- //Qlong\r
- //gBalance->SetInterval(AliBalance::kQlong,-1,1,200,0.0,4.0,15);\r
- //Qout\r
- //gBalance->SetInterval(AliBalance::kQout,-1,1,200,0.0,4.0,15);\r
- //Qside\r
- //gBalance->SetInterval(AliBalance::kQside,-1,1,200,0.0,4.0,15);\r
- //Qinv\r
- //gBalance->SetInterval(AliBalance::kQinv,-1,1,200,0.0,4.0,15);\r
- //Phi\r
- //gBalance->SetInterval(AliBalance::kPhi,0.,360.,90,-180.,180.0,15);\r
-\r
- // Init the histograms (not done here, for customization from analysis task)\r
- // gBalance->InitHistograms();\r
- \r
- return gBalance;\r
-}\r
-\r
-//__________________________________________________//\r
-AliESDtrackCuts *GetTrackCutsObject(Double_t ptMin, Double_t ptMax, Double_t etaMin, Double_t etaMax, Double_t maxTPCchi2, Double_t maxDCAz, Double_t maxDCAxy, Int_t minNClustersTPC) {\r
-\r
- // only used for ESDs\r
- // Function to setup the AliESDtrackCuts object and return it\r
- AliESDtrackCuts *cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
- cuts->SetRequireTPCStandAlone(kTRUE); // TPC only cuts! \r
-\r
- // extra TPC cuts (Syst studies)\r
- if(minNClustersTPC != -1) cuts->SetMinNClustersTPC(minNClustersTPC);\r
- else cuts->SetMinNClustersTPC(70); // standard for filter bit 128\r
- \r
- if(maxTPCchi2 != -1) cuts->SetMaxChi2PerClusterTPC(maxTPCchi2);\r
-\r
- // extra DCA cuts (Syst studies) \r
- if(maxDCAz!=-1 && maxDCAxy != -1){\r
- cuts->SetMaxDCAToVertexZ(maxDCAz);\r
- cuts->SetMaxDCAToVertexXY(maxDCAxy);\r
- }\r
-\r
- cuts->SetPtRange(ptMin,ptMax);\r
- cuts->SetEtaRange(etaMin,etaMax);\r
- cuts->DefineHistograms(1);\r
- //cuts->SaveHistograms("trackCuts");\r
-\r
- return cuts;\r
-}\r
-\r
+//__________________________________________________//
+AliBalancePsi *GetBalanceFunctionObject(const char* analysisLevel = "MCAOD", //
+ const char* centralityName = 0x0,
+ Double_t centrMin = 0.,
+ Double_t centrMax = 100.,
+ Bool_t bShuffle = kFALSE,
+ Bool_t bResonancesCut = kFALSE,
+ Bool_t bHBTCut = kFALSE,
+ Double_t HBTCutValue = 0.02,
+ Bool_t bConversionCut = kFALSE,
+ Double_t invMassForConversionCut = 0.04,
+ Bool_t bMomentumDifferenceCut = kFALSE,
+ Double_t fQCutMin = 0.0,
+ TString fArgEventClass = "EventPlane",
+ Double_t deltaEtaMax = 2.0,
+ Bool_t bVertexBinning = kFALSE) {
+ //Function to setup the AliBalance object and return it
+ AliBalancePsi *gBalance = new AliBalancePsi();
+ gBalance->SetAnalysisLevel(analysisLevel);
+ gBalance->SetShuffle(bShuffle);
+ if(bResonancesCut) gBalance->UseResonancesCut();
+ if(bHBTCut) gBalance->UseHBTCut(HBTCutValue);
+ if(bConversionCut) gBalance->UseConversionCut(invMassForConversionCut);
+ if(bMomentumDifferenceCut) gBalance->UseMomentumDifferenceCut(fQCutMin);
+ if(centralityName) gBalance->SetCentralityIdentifier(centralityName);
+ if(bVertexBinning) gBalance->SetVertexZBinning();
+ gBalance->SetCentralityInterval(centrMin,centrMax);
+ gBalance->SetEventClass(fArgEventClass);
+ gBalance->SetDeltaEtaMax(deltaEtaMax);
+
+ //Set all analyses separately
+ //Rapidity
+ //gBalance->SetInterval(AliBalance::kRapidity,-0.8,0.8,32,-1.6,1.6,15.);
+ //Eta
+ //gBalance->SetInterval(AliBalance::kEta,-0.8,0.8,32,-1.6,1.6,15);
+ //Qlong
+ //gBalance->SetInterval(AliBalance::kQlong,-1,1,200,0.0,4.0,15);
+ //Qout
+ //gBalance->SetInterval(AliBalance::kQout,-1,1,200,0.0,4.0,15);
+ //Qside
+ //gBalance->SetInterval(AliBalance::kQside,-1,1,200,0.0,4.0,15);
+ //Qinv
+ //gBalance->SetInterval(AliBalance::kQinv,-1,1,200,0.0,4.0,15);
+ //Phi
+ //gBalance->SetInterval(AliBalance::kPhi,0.,360.,90,-180.,180.0,15);
+
+ // Init the histograms (not done here, for customization from analysis task)
+ // gBalance->InitHistograms();
+
+ return gBalance;
+}
+
+//__________________________________________________//
+AliESDtrackCuts *GetTrackCutsObject(Double_t ptMin, Double_t ptMax, Double_t etaMin, Double_t etaMax, Double_t maxTPCchi2, Double_t maxDCAz, Double_t maxDCAxy, Int_t minNClustersTPC) {
+
+ // only used for ESDs
+ // Function to setup the AliESDtrackCuts object and return it
+ AliESDtrackCuts *cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+ cuts->SetRequireTPCStandAlone(kTRUE); // TPC only cuts!
+
+ // extra TPC cuts (Syst studies)
+ if(minNClustersTPC != -1) cuts->SetMinNClustersTPC(minNClustersTPC);
+ else cuts->SetMinNClustersTPC(70); // standard for filter bit 128
+
+ if(maxTPCchi2 != -1) cuts->SetMaxChi2PerClusterTPC(maxTPCchi2);
+
+ // extra DCA cuts (Syst studies)
+ if(maxDCAz!=-1 && maxDCAxy != -1){
+ cuts->SetMaxDCAToVertexZ(maxDCAz);
+ cuts->SetMaxDCAToVertexXY(maxDCAxy);
+ }
+
+ cuts->SetPtRange(ptMin,ptMax);
+ cuts->SetEtaRange(etaMin,etaMax);
+ cuts->DefineHistograms(1);
+ //cuts->SaveHistograms("trackCuts");
+
+ return cuts;
+}
+
-// run.C\r
-//\r
-// Template run macro for AliBasicTask.cxx/.h with example layout of\r
-// physics selections and options, in macro and task.\r
-//\r
-// Author: Arvinder Palaha\r
-//\r
-class AliAnalysisGrid;\r
-class AliAnalysisTaskBF;\r
-class AliBalance;\r
-\r
-//Centrality stuff\r
-Int_t binfirst = 0; //where do we start numbering bins\r
-Int_t binlast = 8; //where do we stop numbering bins\r
-const Int_t numberOfCentralityBins = 9;\r
-Double_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile\r
-\r
-//Systematic studies\r
-const Int_t numberOfSyst = 13;\r
-Float_t vZ[numberOfSyst] = {10.,12.,6.,8.,10.,10.,10.,10.,10.,10.,10.,10.,10.}; // global Vertex Z cut\r
-Float_t DCAxy[numberOfSyst] = {-1.,2.4,2.4,2.4,2.2,2.0,1.8,2.4,2.4,2.4,2.4,2.4,2.4}; // DCA xy cut (afterburner, -1 = w/o additional cut)\r
-Float_t DCAz[numberOfSyst] = {-1.,3.2,3.2,3.2,3.0,2.8,2.6,3.2,3.2,3.2,3.2,3.2,3.2}; // DCA z cut (afterburner, -1 = w/o additional cut)\r
-Float_t ptMin[numberOfSyst] = {0.3,0.3,0.3,0.3,0.3,0.3,0.3,1.5,5.0,0.3,0.3,0.3,0.3}; // pt cuts\r
-Float_t ptMax[numberOfSyst] = {5.,1.5,1.5,1.5,1.5,1.5,1.5,5.0,10.0,10.0,1.5,1.5,1.5}; // pt cuts\r
-Float_t etaMin[numberOfSyst] = {-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-1.0,-0.6,-0.4}; // eta cuts\r
-Float_t etaMax[numberOfSyst] = {0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,1.0,0.6,0.4}; // eta cuts\r
-\r
-Bool_t kUsePID = kFALSE;\r
-Bool_t bUseHBTCut = kTRUE;\r
-Bool_t bUseConversionCut = kTRUE;\r
-Bool_t bResonancesCut = kTRUE;\r
-Bool_t bMomentumDifferenceCut = kTRUE;\r
-Int_t kNSigmaElectronRejection = 3;\r
-\r
-//______________________________________________________________________________\r
-void runBalanceFunctionPsi(\r
- const char* runtype = "local", // local, proof or grid\r
- const char *gridmode = "test", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof\r
- const Int_t bunchN = 0,\r
- const bool bAOD = 1, // 1 = AOD ANALYSIS, 0 = ESD ANALYSIS\r
- const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)\r
- const bool bMCphyssel = 1, // 1 = looking at MC truth or reconstructed, 0 = looking at real data\r
- const Long64_t nentries = 50000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.\r
- const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode\r
- TString proofdataset = "bunchPROOF", // path to dataset on proof cluster, for proof analysis\r
- const char *proofcluster = "miweber@alice-caf.cern.ch", // which proof cluster to use in proof mode\r
- const char *taskname = "BF_Syst_Test" // sets name of grid generated macros\r
- )\r
-{\r
- // check run type\r
- if(runtype != "local" && runtype != "proof" && runtype != "grid") {\r
- Printf("\n\tIncorrect run option, check first argument of run macro");\r
- Printf("\tint runtype = local, proof or grid\n");\r
- return;\r
- }\r
- Printf("%s analysis chosen",runtype);\r
- \r
- // load libraries\r
- gSystem->Load("libCore.so"); \r
- gSystem->Load("libGeom.so");\r
- gSystem->Load("libVMC.so");\r
- gSystem->Load("libPhysics.so");\r
- gSystem->Load("libTree.so");\r
- gSystem->Load("libSTEERBase.so");\r
- gSystem->Load("libESD.so");\r
- gSystem->Load("libAOD.so");\r
- gSystem->Load("libANALYSIS.so");\r
- gSystem->Load("libANALYSISalice.so");\r
- gSystem->Load("libEventMixing.so");\r
- gSystem->Load("libCORRFW.so");\r
- gSystem->Load("libPWGTools.so");\r
- gSystem->Load("libPWGCFebye.so");\r
-\r
- // additional\r
-\r
- // compile standalone stuff\r
- //gROOT->LoadMacro("AliBalance.cxx++g");\r
- //gROOT->LoadMacro("AliAnalysisTaskBF.cxx++g");\r
-\r
- // add aliroot indlude path\r
- //gROOT->ProcessLine(".include $PWD/.");\r
- //gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));\r
-\r
- gROOT->SetStyle("Plain");\r
-\r
- // analysis manager\r
- AliAnalysisManager* mgr = new AliAnalysisManager(Form("%s%i",taskname,bunchN));\r
- \r
- // create the alien handler and attach it to the manager\r
- if(runtype == "grid") {\r
- AliAnalysisGrid *plugin = CreateAlienHandler(bAOD,bunchN,Form("%s%i",taskname,bunchN), gridmode, proofcluster, Form("%s_%d.txt",proofdataset.Data(),bunchN)); \r
- mgr->SetGridHandler(plugin);\r
- }\r
- else if(runtype == "local") {\r
- TString filename;\r
- TChain* chain = 0x0;\r
- if((!bAOD)&&(!bMCtruth)) {\r
- chain = new TChain("esdTree");\r
- for(Int_t i = 0; i < 4; i++) {\r
- filename = "/data/alice2/pchrist/HeavyIons/Data/2011/Set";\r
- filename += i; filename += "/AliESDs.root";\r
- chain->Add(filename.Data());\r
- }\r
- }\r
- else if((bAOD)&&(!bMCtruth)) {\r
- chain = new TChain("aodTree");\r
- for(Int_t i = 1; i < 20; i++) {\r
- filename = "/glusterfs/alice1/alice2/pchrist/pp/LHC10c/7TeV/Data/Set";\r
- filename += i; filename += "/AliAOD.root";\r
- chain->Add(filename.Data());\r
- }\r
- }\r
- else if((!bAOD)&&(bMCtruth)) {\r
- chain = new TChain("TE");\r
- for(Int_t i = 10; i < 99; i++) {\r
- filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";\r
- filename += i;\r
- filename += "/galice.root";\r
- chain->Add(filename.Data());\r
- }\r
- }\r
- else if((bAOD)&&(bMCtruth)) { //used for MCAOD\r
- chain = new TChain("aodTree"); \r
- for(Int_t i = 10; i < 99; i++) { \r
- filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";\r
- filename += i; \r
- filename += "/AliAOD.root";\r
- chain->Add(filename.Data());\r
- } \r
- }\r
- \r
-\r
- }//local mode\r
-\r
- // input handler (ESD or AOD)\r
- AliVEventHandler* inputH = NULL;\r
- if(!bAOD){\r
- inputH = new AliESDInputHandler();\r
- }\r
- else{\r
- inputH = new AliAODInputHandler();\r
- }\r
- mgr->SetInputEventHandler(inputH);\r
- \r
- // mc event handler\r
- if(bMCtruth) {\r
- AliMCEventHandler* mchandler = new AliMCEventHandler();\r
- // Not reading track references\r
- mchandler->SetReadTR(kFALSE);\r
- mgr->SetMCtruthEventHandler(mchandler);\r
- } \r
- \r
- // AOD output handler\r
- //AliAODHandler* aodoutHandler = new AliAODHandler();\r
- //aodoutHandler->SetOutputFileName("aod.root");\r
- //mgr->SetOutputEventHandler(aodoutHandler); \r
- \r
- // === Physics Selection Task ===\r
- //\r
- // In SelectCollisionCandidate(), default is kMB, so the task UserExec() \r
- // function is only called for these events.\r
- // Options are:\r
- // kMB Minimum Bias trigger\r
- // kMBNoTRD Minimum bias trigger where the TRD is not read out\r
- // kMUON Muon trigger\r
- // kHighMult High-Multiplicity Trigger\r
- // kUserDefined For manually defined trigger selection\r
- //\r
- // Multiple options possible with the standard AND/OR operators && and ||\r
- // These all have the usual offline SPD or V0 selections performed.\r
- //\r
- // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(),\r
- // one can manually set the selected and background classes using:\r
- // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL")\r
- // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL");\r
- //\r
- // One can also specify multiple classes at once, or require a class to NOT\r
- // trigger, for e.g.\r
- // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL");\r
- //\r
- // NOTE that manually setting the physics selection overrides the standard\r
- // selection, so it must be done in completeness.\r
- //\r
- // ALTERNATIVELY, one can make the physics selection inside the task\r
- // UserExec().\r
- // For this case, comment out the task->SelectCol.... line, \r
- // and see AliBasicTask.cxx UserExec() function for details on this.\r
-\r
- //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");\r
- //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);\r
- //if(!physSelTask) { Printf("no physSelTask"); return; }\r
- //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection();\r
- //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769");\r
- \r
- // create task\r
- //Add the centrality determination task and the physics selection \r
- // (only on ESD level, in AODs centrality is already in header and events are selected)\r
- if((!bAOD)&&(!bMCtruth)){\r
- gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");\r
- AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();\r
-\r
- // Add physics selection task (NOT needed for AODs)\r
- gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");\r
- AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(bMCphyssel);\r
- }\r
-\r
- //Add the PID response\r
- if((kUsePID)||(kNSigmaElectronRejection)) {\r
- gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");\r
- AddTaskPIDResponse(bMCphyssel); \r
- }\r
-\r
- //Add the VZERO event plane task\r
- gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C"); \r
- AliVZEROEPSelectionTask* epSelTask = AddTaskVZEROEPSelection();\r
-\r
- //Add the BF task (all centralities)\r
- gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/AddTaskBalancePsiCentralityTrain.C"); \r
-\r
- AliAnalysisTaskBFPsi *taskBF = AddTaskBalancePsiCentralityTrain(0, 500, kFALSE, kTRUE, kFALSE, "V0M", 10, -1, -1, 0.2, 20.0, -0.8, 0.8, -1, -1, kUsePID, kFALSE, kTRUE, 0.02, kFALSE, 0.04, kTRUE, 0.1, 128, 1, "AnalysisResults","TE","Multiplicity","AOD",kTRUE, kNSigmaElectronRejection);\r
- //taskBF->SetDebugLevel();\r
-\r
- // enable debug printouts\r
- //mgr->SetDebugLevel(2);\r
- //mgr->SetUseProgressBar(1,100);\r
- if (!mgr->InitAnalysis()) return;\r
- mgr->PrintStatus();\r
- \r
- // start analysis\r
- Printf("Starting Analysis....");\r
- if(runtype == "local") \r
- mgr->StartAnalysis("local",chain);\r
- else\r
- mgr->StartAnalysis(runtype,nentries,firstentry);\r
-}\r
-\r
-//______________________________________________________________________________\r
-AliAnalysisGrid* CreateAlienHandler(Bool_t bAOD, Int_t bunchN, const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)\r
-{\r
- AliAnalysisAlien *plugin = new AliAnalysisAlien();\r
- // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")\r
- plugin->SetRunMode(gridmode);\r
-\r
- // Set versions of used packages\r
- plugin->SetAPIVersion("V1.1x");\r
- plugin->SetROOTVersion("v5-28-00d");\r
- plugin->SetAliROOTVersion("v5-02-05-AN");\r
-\r
- // Declare input data to be processed.\r
-\r
- // Method 1: Create automatically XML collections using alien 'find' command.\r
- // Define production directory LFN\r
- plugin->SetGridDataDir("/alice/data/2010/LHC10h/");\r
- // On real reconstructed data:\r
- // plugin->SetGridDataDir("/alice/data/2009/LHC09d");\r
-\r
- // Set data search pattern\r
- //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES\r
- // Data pattern for reconstructed data\r
- if(!bAOD){\r
- plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH\r
- } \r
- else{\r
- plugin->SetDataPattern("*ESDs/pass2/AOD049/*/AliAOD.root");\r
- }\r
-\r
- plugin->SetRunPrefix("000"); // real data\r
- // ...then add run numbers to be considered\r
- //plugin->SetRunRange(114917,115322);\r
-\r
- if(bunchN==0){\r
- plugin->AddRunNumber(137366);\r
- }\r
- \r
- //bunch1\r
- else if(bunchN == 1){\r
- plugin->AddRunNumber(139510);\r
- plugin->AddRunNumber(139507);\r
- plugin->AddRunNumber(139505);\r
- plugin->AddRunNumber(139503); \r
- plugin->AddRunNumber(139465); \r
- plugin->AddRunNumber(139438);\r
- plugin->AddRunNumber(139437);\r
- plugin->AddRunNumber(139360); \r
- plugin->AddRunNumber(139329);\r
- plugin->AddRunNumber(139328); \r
- }\r
-\r
- //bunch2\r
- else if(bunchN == 2){\r
- plugin->AddRunNumber(139314); \r
- plugin->AddRunNumber(139310);\r
- plugin->AddRunNumber(139309); \r
- plugin->AddRunNumber(139173); \r
- plugin->AddRunNumber(139107); \r
- plugin->AddRunNumber(139105); \r
- plugin->AddRunNumber(139038); \r
- plugin->AddRunNumber(139037); \r
- plugin->AddRunNumber(139036); \r
- plugin->AddRunNumber(139029); \r
- plugin->AddRunNumber(139028); \r
- plugin->AddRunNumber(138872); \r
- plugin->AddRunNumber(138871); \r
- plugin->AddRunNumber(138870); \r
- plugin->AddRunNumber(138837); \r
- plugin->AddRunNumber(138732); \r
- plugin->AddRunNumber(138730);\r
- plugin->AddRunNumber(138666);\r
- plugin->AddRunNumber(138662); \r
- plugin->AddRunNumber(138653); \r
- }\r
-\r
- else if(bunchN == 3){\r
- plugin->AddRunNumber(138652);\r
- plugin->AddRunNumber(138638);\r
- plugin->AddRunNumber(138624); \r
- plugin->AddRunNumber(138621); \r
- plugin->AddRunNumber(138583); \r
- plugin->AddRunNumber(138582); \r
- plugin->AddRunNumber(138579); \r
- plugin->AddRunNumber(138578);\r
- plugin->AddRunNumber(138534);\r
- plugin->AddRunNumber(138469); \r
- }\r
-\r
- else if(bunchN == 4){\r
- \r
- plugin->AddRunNumber(138442);\r
- plugin->AddRunNumber(138439);\r
- plugin->AddRunNumber(138438);\r
- plugin->AddRunNumber(138396); \r
- plugin->AddRunNumber(138364); \r
- plugin->AddRunNumber(138275); \r
- plugin->AddRunNumber(138225); \r
- plugin->AddRunNumber(138201);\r
- plugin->AddRunNumber(138197); \r
- plugin->AddRunNumber(138192); \r
- }\r
-\r
- else if(bunchN == 5){\r
-\r
- plugin->AddRunNumber(138190);\r
- plugin->AddRunNumber(137848); \r
- plugin->AddRunNumber(137844); \r
- plugin->AddRunNumber(137752); \r
- plugin->AddRunNumber(137751); \r
- plugin->AddRunNumber(137724); \r
- plugin->AddRunNumber(137722); \r
- plugin->AddRunNumber(137718); \r
- plugin->AddRunNumber(137704); \r
- plugin->AddRunNumber(137693);\r
- }\r
-\r
- else if(bunchN == 6){\r
-\r
- plugin->AddRunNumber(137692); \r
- plugin->AddRunNumber(137691); \r
- plugin->AddRunNumber(137686); \r
- plugin->AddRunNumber(137685); \r
- plugin->AddRunNumber(137639); \r
- plugin->AddRunNumber(137638);\r
- plugin->AddRunNumber(137608); \r
- plugin->AddRunNumber(137595);\r
- plugin->AddRunNumber(137549);\r
- plugin->AddRunNumber(137546); \r
-\r
- }\r
-\r
- else if(bunchN == 7){\r
-\r
- plugin->AddRunNumber(137544); \r
- plugin->AddRunNumber(137541); \r
- plugin->AddRunNumber(137539); \r
- plugin->AddRunNumber(137531); \r
- plugin->AddRunNumber(137530); \r
- plugin->AddRunNumber(137443); \r
- plugin->AddRunNumber(137441); \r
- plugin->AddRunNumber(137440); \r
- plugin->AddRunNumber(137439); \r
- plugin->AddRunNumber(137434); \r
-\r
- }\r
-\r
- else if(bunchN == 8){\r
-\r
- plugin->AddRunNumber(137432); \r
- plugin->AddRunNumber(137431); \r
- plugin->AddRunNumber(137430); \r
- plugin->AddRunNumber(137366); \r
- plugin->AddRunNumber(137243); \r
- plugin->AddRunNumber(137236);\r
- plugin->AddRunNumber(137235);\r
- plugin->AddRunNumber(137232); \r
- plugin->AddRunNumber(137231); \r
- plugin->AddRunNumber(137162); \r
- plugin->AddRunNumber(137161);\r
- }\r
-\r
- else{\r
-\r
- stderr<<"BUNCH NOT THERE"<<endl;\r
- return NULL;\r
-\r
- }\r
-\r
-\r
- //plugin->AddRunList("139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137162, 137161");\r
-\r
-\r
-\r
-\r
-\r
- plugin->SetNrunsPerMaster(1);\r
- plugin->SetOutputToRunNo();\r
- // comment out the next line when using the "terminate" option, unless\r
- // you want separate merged files for each run\r
- plugin->SetMergeViaJDL();\r
-\r
- // Method 2: Declare existing data files (raw collections, xml collections, root file)\r
- // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())\r
- // XML collections added via this method can be combined with the first method if\r
- // the content is compatible (using or not tags)\r
- // plugin->AddDataFile("tag.xml");\r
- // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");\r
-\r
- // Define alien work directory where all files will be copied. Relative to alien $HOME.\r
- plugin->SetGridWorkingDir(taskname);\r
-\r
- // Declare alien output directory. Relative to working directory.\r
- plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out\r
-\r
- // Declare the analysis source files names separated by blancs. To be compiled runtime\r
- // using ACLiC on the worker nodes.\r
- plugin->SetAnalysisSource("AliBalance.cxx AliAnalysisTaskBF.cxx");\r
-\r
- // Declare all libraries (other than the default ones for the framework. These will be\r
- // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.\r
- //plugin->AddIncludePath("-I.");\r
- //plugin->SetAdditionalLibs("libPWGCFebye.so");\r
- plugin->SetAdditionalLibs("AliBalance.cxx AliBalance.h AliAnalysisTaskBF.cxx AliAnalysisTaskBF.h");\r
-\r
- // Declare the output file names separated by blancs.\r
- // (can be like: file.root or file.root@ALICE::Niham::File)\r
- // To only save certain files, use SetDefaultOutputs(kFALSE), and then\r
- // SetOutputFiles("list.root other.filename") to choose which files to save\r
- plugin->SetDefaultOutputs();\r
- //plugin->SetOutputFiles("list.root");\r
-\r
- // Optionally set a name for the generated analysis macro (default MyAnalysis.C)\r
- plugin->SetAnalysisMacro(Form("%s.C",taskname));\r
-\r
- // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)\r
- plugin->SetSplitMaxInputFileNumber(100);\r
-\r
- // Optionally modify the executable name (default analysis.sh)\r
- plugin->SetExecutable(Form("%s.sh",taskname));\r
-\r
- // set number of test files to use in "test" mode\r
- plugin->SetNtestFiles(1);\r
-\r
- // Optionally resubmit threshold.\r
- plugin->SetMasterResubmitThreshold(90);\r
-\r
- // Optionally set time to live (default 30000 sec)\r
- plugin->SetTTL(90000);\r
-\r
- // Optionally set input format (default xml-single)\r
- plugin->SetInputFormat("xml-single");\r
-\r
- // Optionally modify the name of the generated JDL (default analysis.jdl)\r
- plugin->SetJDLName(Form("%s.jdl",taskname));\r
-\r
- // Optionally modify job price (default 1)\r
- plugin->SetPrice(1); \r
-\r
- // Optionally modify split mode (default 'se') \r
- plugin->SetSplitMode("se");\r
-\r
- //plugin->SetUseSubmitPolicy();\r
- //plugin->SetKeepLogs();\r
- \r
- //----------------------------------------------------------\r
- //--- PROOF MODE SPECIFIC SETTINGS ------------\r
- //---------------------------------------------------------- \r
- // Proof cluster\r
- plugin->SetProofCluster(proofcluster);\r
- // Dataset to be used \r
- plugin->SetProofDataSet(proofdataset);\r
- // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard\r
- plugin->SetProofReset(0);\r
- // May limit number of workers\r
- plugin->SetNproofWorkers(0);\r
- // May limit the number of workers per slave\r
- plugin->SetNproofWorkersPerSlave(1); \r
- // May use a specific version of root installed in proof\r
- plugin->SetRootVersionForProof("current");\r
- // May set the aliroot mode. Check http://aaf.cern.ch/node/83 \r
- plugin->SetAliRootMode("default"); // Loads AF libs by default\r
- // May request ClearPackages (individual ClearPackage not supported)\r
- plugin->SetClearPackages(kFALSE);\r
- // Plugin test mode works only providing a file containing test file locations, used in "local" mode also\r
- plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc\r
- // Request connection to alien upon connection to grid\r
- plugin->SetProofConnectGrid(kFALSE);\r
-\r
- plugin->Print();\r
-\r
- return plugin;\r
-}\r
-\r
+// run.C
+//
+// Template run macro for AliBasicTask.cxx/.h with example layout of
+// physics selections and options, in macro and task.
+//
+// Author: Arvinder Palaha
+//
+class AliAnalysisGrid;
+class AliAnalysisTaskBF;
+class AliBalance;
+
+//Centrality stuff
+Int_t binfirst = 0; //where do we start numbering bins
+Int_t binlast = 8; //where do we stop numbering bins
+const Int_t numberOfCentralityBins = 9;
+Double_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile
+
+//Systematic studies
+const Int_t numberOfSyst = 13;
+Float_t vZ[numberOfSyst] = {10.,12.,6.,8.,10.,10.,10.,10.,10.,10.,10.,10.,10.}; // global Vertex Z cut
+Float_t DCAxy[numberOfSyst] = {-1.,2.4,2.4,2.4,2.2,2.0,1.8,2.4,2.4,2.4,2.4,2.4,2.4}; // DCA xy cut (afterburner, -1 = w/o additional cut)
+Float_t DCAz[numberOfSyst] = {-1.,3.2,3.2,3.2,3.0,2.8,2.6,3.2,3.2,3.2,3.2,3.2,3.2}; // DCA z cut (afterburner, -1 = w/o additional cut)
+Float_t ptMin[numberOfSyst] = {0.3,0.3,0.3,0.3,0.3,0.3,0.3,1.5,5.0,0.3,0.3,0.3,0.3}; // pt cuts
+Float_t ptMax[numberOfSyst] = {5.,1.5,1.5,1.5,1.5,1.5,1.5,5.0,10.0,10.0,1.5,1.5,1.5}; // pt cuts
+Float_t etaMin[numberOfSyst] = {-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-1.0,-0.6,-0.4}; // eta cuts
+Float_t etaMax[numberOfSyst] = {0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,1.0,0.6,0.4}; // eta cuts
+
+Bool_t kUsePID = kFALSE;
+Bool_t bUseHBTCut = kTRUE;
+Bool_t bUseConversionCut = kTRUE;
+Bool_t bResonancesCut = kTRUE;
+Bool_t bMomentumDifferenceCut = kTRUE;
+Int_t kNSigmaElectronRejection = 3;
+
+//______________________________________________________________________________
+void runBalanceFunctionPsi(
+ const char* runtype = "local", // local, proof or grid
+ const char *gridmode = "test", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
+ const Int_t bunchN = 0,
+ const bool bAOD = 1, // 1 = AOD ANALYSIS, 0 = ESD ANALYSIS
+ const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)
+ const bool bMCphyssel = 1, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
+ const Long64_t nentries = 50000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.
+ const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode
+ TString proofdataset = "bunchPROOF", // path to dataset on proof cluster, for proof analysis
+ const char *proofcluster = "miweber@alice-caf.cern.ch", // which proof cluster to use in proof mode
+ const char *taskname = "BF_Syst_Test" // sets name of grid generated macros
+ )
+{
+ // check run type
+ if(runtype != "local" && runtype != "proof" && runtype != "grid") {
+ Printf("\n\tIncorrect run option, check first argument of run macro");
+ Printf("\tint runtype = local, proof or grid\n");
+ return;
+ }
+ Printf("%s analysis chosen",runtype);
+
+ // load libraries
+ gSystem->Load("libCore.so");
+ gSystem->Load("libGeom.so");
+ gSystem->Load("libVMC.so");
+ gSystem->Load("libPhysics.so");
+ gSystem->Load("libTree.so");
+ gSystem->Load("libSTEERBase.so");
+ gSystem->Load("libESD.so");
+ gSystem->Load("libAOD.so");
+ gSystem->Load("libANALYSIS.so");
+ gSystem->Load("libANALYSISalice.so");
+ gSystem->Load("libEventMixing.so");
+ gSystem->Load("libCORRFW.so");
+ gSystem->Load("libPWGTools.so");
+ gSystem->Load("libPWGCFebye.so");
+
+ // additional
+
+ // compile standalone stuff
+ //gROOT->LoadMacro("AliBalance.cxx++g");
+ //gROOT->LoadMacro("AliAnalysisTaskBF.cxx++g");
+
+ // add aliroot indlude path
+ //gROOT->ProcessLine(".include $PWD/.");
+ //gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
+
+ gROOT->SetStyle("Plain");
+
+ // analysis manager
+ AliAnalysisManager* mgr = new AliAnalysisManager(Form("%s%i",taskname,bunchN));
+
+ // create the alien handler and attach it to the manager
+ if(runtype == "grid") {
+ AliAnalysisGrid *plugin = CreateAlienHandler(bAOD,bunchN,Form("%s%i",taskname,bunchN), gridmode, proofcluster, Form("%s_%d.txt",proofdataset.Data(),bunchN));
+ mgr->SetGridHandler(plugin);
+ }
+ else if(runtype == "local") {
+ TString filename;
+ TChain* chain = 0x0;
+ if((!bAOD)&&(!bMCtruth)) {
+ chain = new TChain("esdTree");
+ for(Int_t i = 0; i < 4; i++) {
+ filename = "/data/alice2/pchrist/HeavyIons/Data/2011/Set";
+ filename += i; filename += "/AliESDs.root";
+ chain->Add(filename.Data());
+ }
+ }
+ else if((bAOD)&&(!bMCtruth)) {
+ chain = new TChain("aodTree");
+ for(Int_t i = 1; i < 20; i++) {
+ filename = "/glusterfs/alice1/alice2/pchrist/pp/LHC10c/7TeV/Data/Set";
+ filename += i; filename += "/AliAOD.root";
+ chain->Add(filename.Data());
+ }
+ }
+ else if((!bAOD)&&(bMCtruth)) {
+ chain = new TChain("TE");
+ for(Int_t i = 10; i < 99; i++) {
+ filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";
+ filename += i;
+ filename += "/galice.root";
+ chain->Add(filename.Data());
+ }
+ }
+ else if((bAOD)&&(bMCtruth)) { //used for MCAOD
+ chain = new TChain("aodTree");
+ for(Int_t i = 10; i < 99; i++) {
+ filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";
+ filename += i;
+ filename += "/AliAOD.root";
+ chain->Add(filename.Data());
+ }
+ }
+
+
+ }//local mode
+
+ // input handler (ESD or AOD)
+ AliVEventHandler* inputH = NULL;
+ if(!bAOD){
+ inputH = new AliESDInputHandler();
+ }
+ else{
+ inputH = new AliAODInputHandler();
+ }
+ mgr->SetInputEventHandler(inputH);
+
+ // mc event handler
+ if(bMCtruth) {
+ AliMCEventHandler* mchandler = new AliMCEventHandler();
+ // Not reading track references
+ mchandler->SetReadTR(kFALSE);
+ mgr->SetMCtruthEventHandler(mchandler);
+ }
+
+ // AOD output handler
+ //AliAODHandler* aodoutHandler = new AliAODHandler();
+ //aodoutHandler->SetOutputFileName("aod.root");
+ //mgr->SetOutputEventHandler(aodoutHandler);
+
+ // === Physics Selection Task ===
+ //
+ // In SelectCollisionCandidate(), default is kMB, so the task UserExec()
+ // function is only called for these events.
+ // Options are:
+ // kMB Minimum Bias trigger
+ // kMBNoTRD Minimum bias trigger where the TRD is not read out
+ // kMUON Muon trigger
+ // kHighMult High-Multiplicity Trigger
+ // kUserDefined For manually defined trigger selection
+ //
+ // Multiple options possible with the standard AND/OR operators && and ||
+ // These all have the usual offline SPD or V0 selections performed.
+ //
+ // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(),
+ // one can manually set the selected and background classes using:
+ // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL")
+ // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL");
+ //
+ // One can also specify multiple classes at once, or require a class to NOT
+ // trigger, for e.g.
+ // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL");
+ //
+ // NOTE that manually setting the physics selection overrides the standard
+ // selection, so it must be done in completeness.
+ //
+ // ALTERNATIVELY, one can make the physics selection inside the task
+ // UserExec().
+ // For this case, comment out the task->SelectCol.... line,
+ // and see AliBasicTask.cxx UserExec() function for details on this.
+
+ //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+ //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);
+ //if(!physSelTask) { Printf("no physSelTask"); return; }
+ //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection();
+ //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769");
+
+ // create task
+ //Add the centrality determination task and the physics selection
+ // (only on ESD level, in AODs centrality is already in header and events are selected)
+ if((!bAOD)&&(!bMCtruth)){
+ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
+ AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
+
+ // Add physics selection task (NOT needed for AODs)
+ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+ AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(bMCphyssel);
+ }
+
+ //Add the PID response
+ if((kUsePID)||(kNSigmaElectronRejection)) {
+ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+ AddTaskPIDResponse(bMCphyssel);
+ }
+
+ //Add the VZERO event plane task
+ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
+ AliVZEROEPSelectionTask* epSelTask = AddTaskVZEROEPSelection();
+
+ //Add the BF task (all centralities)
+ gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/AddTaskBalancePsiCentralityTrain.C");
+
+ AliAnalysisTaskBFPsi *taskBF = AddTaskBalancePsiCentralityTrain(0, 500, kFALSE, kTRUE, kFALSE, "V0M", 10, -1, -1, 0.2, 20.0, -0.8, 0.8, -1, -1, kUsePID, kFALSE, kTRUE, 0.02, kFALSE, 0.04, kTRUE, 0.1, 128, 1, "AnalysisResults","TE","Multiplicity","AOD",kTRUE, kNSigmaElectronRejection);
+ //taskBF->SetDebugLevel();
+
+ // enable debug printouts
+ //mgr->SetDebugLevel(2);
+ //mgr->SetUseProgressBar(1,100);
+ if (!mgr->InitAnalysis()) return;
+ mgr->PrintStatus();
+
+ // start analysis
+ Printf("Starting Analysis....");
+ if(runtype == "local")
+ mgr->StartAnalysis("local",chain);
+ else
+ mgr->StartAnalysis(runtype,nentries,firstentry);
+}
+
+//______________________________________________________________________________
+AliAnalysisGrid* CreateAlienHandler(Bool_t bAOD, Int_t bunchN, const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)
+{
+ AliAnalysisAlien *plugin = new AliAnalysisAlien();
+ // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
+ plugin->SetRunMode(gridmode);
+
+ // Set versions of used packages
+ plugin->SetAPIVersion("V1.1x");
+ plugin->SetROOTVersion("v5-28-00d");
+ plugin->SetAliROOTVersion("v5-02-05-AN");
+
+ // Declare input data to be processed.
+
+ // Method 1: Create automatically XML collections using alien 'find' command.
+ // Define production directory LFN
+ plugin->SetGridDataDir("/alice/data/2010/LHC10h/");
+ // On real reconstructed data:
+ // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
+
+ // Set data search pattern
+ //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
+ // Data pattern for reconstructed data
+ if(!bAOD){
+ plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
+ }
+ else{
+ plugin->SetDataPattern("*ESDs/pass2/AOD049/*/AliAOD.root");
+ }
+
+ plugin->SetRunPrefix("000"); // real data
+ // ...then add run numbers to be considered
+ //plugin->SetRunRange(114917,115322);
+
+ if(bunchN==0){
+ plugin->AddRunNumber(137366);
+ }
+
+ //bunch1
+ else if(bunchN == 1){
+ plugin->AddRunNumber(139510);
+ plugin->AddRunNumber(139507);
+ plugin->AddRunNumber(139505);
+ plugin->AddRunNumber(139503);
+ plugin->AddRunNumber(139465);
+ plugin->AddRunNumber(139438);
+ plugin->AddRunNumber(139437);
+ plugin->AddRunNumber(139360);
+ plugin->AddRunNumber(139329);
+ plugin->AddRunNumber(139328);
+ }
+
+ //bunch2
+ else if(bunchN == 2){
+ plugin->AddRunNumber(139314);
+ plugin->AddRunNumber(139310);
+ plugin->AddRunNumber(139309);
+ plugin->AddRunNumber(139173);
+ plugin->AddRunNumber(139107);
+ plugin->AddRunNumber(139105);
+ plugin->AddRunNumber(139038);
+ plugin->AddRunNumber(139037);
+ plugin->AddRunNumber(139036);
+ plugin->AddRunNumber(139029);
+ plugin->AddRunNumber(139028);
+ plugin->AddRunNumber(138872);
+ plugin->AddRunNumber(138871);
+ plugin->AddRunNumber(138870);
+ plugin->AddRunNumber(138837);
+ plugin->AddRunNumber(138732);
+ plugin->AddRunNumber(138730);
+ plugin->AddRunNumber(138666);
+ plugin->AddRunNumber(138662);
+ plugin->AddRunNumber(138653);
+ }
+
+ else if(bunchN == 3){
+ plugin->AddRunNumber(138652);
+ plugin->AddRunNumber(138638);
+ plugin->AddRunNumber(138624);
+ plugin->AddRunNumber(138621);
+ plugin->AddRunNumber(138583);
+ plugin->AddRunNumber(138582);
+ plugin->AddRunNumber(138579);
+ plugin->AddRunNumber(138578);
+ plugin->AddRunNumber(138534);
+ plugin->AddRunNumber(138469);
+ }
+
+ else if(bunchN == 4){
+
+ plugin->AddRunNumber(138442);
+ plugin->AddRunNumber(138439);
+ plugin->AddRunNumber(138438);
+ plugin->AddRunNumber(138396);
+ plugin->AddRunNumber(138364);
+ plugin->AddRunNumber(138275);
+ plugin->AddRunNumber(138225);
+ plugin->AddRunNumber(138201);
+ plugin->AddRunNumber(138197);
+ plugin->AddRunNumber(138192);
+ }
+
+ else if(bunchN == 5){
+
+ plugin->AddRunNumber(138190);
+ plugin->AddRunNumber(137848);
+ plugin->AddRunNumber(137844);
+ plugin->AddRunNumber(137752);
+ plugin->AddRunNumber(137751);
+ plugin->AddRunNumber(137724);
+ plugin->AddRunNumber(137722);
+ plugin->AddRunNumber(137718);
+ plugin->AddRunNumber(137704);
+ plugin->AddRunNumber(137693);
+ }
+
+ else if(bunchN == 6){
+
+ plugin->AddRunNumber(137692);
+ plugin->AddRunNumber(137691);
+ plugin->AddRunNumber(137686);
+ plugin->AddRunNumber(137685);
+ plugin->AddRunNumber(137639);
+ plugin->AddRunNumber(137638);
+ plugin->AddRunNumber(137608);
+ plugin->AddRunNumber(137595);
+ plugin->AddRunNumber(137549);
+ plugin->AddRunNumber(137546);
+
+ }
+
+ else if(bunchN == 7){
+
+ plugin->AddRunNumber(137544);
+ plugin->AddRunNumber(137541);
+ plugin->AddRunNumber(137539);
+ plugin->AddRunNumber(137531);
+ plugin->AddRunNumber(137530);
+ plugin->AddRunNumber(137443);
+ plugin->AddRunNumber(137441);
+ plugin->AddRunNumber(137440);
+ plugin->AddRunNumber(137439);
+ plugin->AddRunNumber(137434);
+
+ }
+
+ else if(bunchN == 8){
+
+ plugin->AddRunNumber(137432);
+ plugin->AddRunNumber(137431);
+ plugin->AddRunNumber(137430);
+ plugin->AddRunNumber(137366);
+ plugin->AddRunNumber(137243);
+ plugin->AddRunNumber(137236);
+ plugin->AddRunNumber(137235);
+ plugin->AddRunNumber(137232);
+ plugin->AddRunNumber(137231);
+ plugin->AddRunNumber(137162);
+ plugin->AddRunNumber(137161);
+ }
+
+ else{
+
+ stderr<<"BUNCH NOT THERE"<<endl;
+ return NULL;
+
+ }
+
+
+ //plugin->AddRunList("139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137162, 137161");
+
+
+
+
+
+ plugin->SetNrunsPerMaster(1);
+ plugin->SetOutputToRunNo();
+ // comment out the next line when using the "terminate" option, unless
+ // you want separate merged files for each run
+ plugin->SetMergeViaJDL();
+
+ // Method 2: Declare existing data files (raw collections, xml collections, root file)
+ // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
+ // XML collections added via this method can be combined with the first method if
+ // the content is compatible (using or not tags)
+ // plugin->AddDataFile("tag.xml");
+ // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
+
+ // Define alien work directory where all files will be copied. Relative to alien $HOME.
+ plugin->SetGridWorkingDir(taskname);
+
+ // Declare alien output directory. Relative to working directory.
+ plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
+
+ // Declare the analysis source files names separated by blancs. To be compiled runtime
+ // using ACLiC on the worker nodes.
+ plugin->SetAnalysisSource("AliBalance.cxx AliAnalysisTaskBF.cxx");
+
+ // Declare all libraries (other than the default ones for the framework. These will be
+ // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
+ //plugin->AddIncludePath("-I.");
+ //plugin->SetAdditionalLibs("libPWGCFebye.so");
+ plugin->SetAdditionalLibs("AliBalance.cxx AliBalance.h AliAnalysisTaskBF.cxx AliAnalysisTaskBF.h");
+
+ // Declare the output file names separated by blancs.
+ // (can be like: file.root or file.root@ALICE::Niham::File)
+ // To only save certain files, use SetDefaultOutputs(kFALSE), and then
+ // SetOutputFiles("list.root other.filename") to choose which files to save
+ plugin->SetDefaultOutputs();
+ //plugin->SetOutputFiles("list.root");
+
+ // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
+ plugin->SetAnalysisMacro(Form("%s.C",taskname));
+
+ // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
+ plugin->SetSplitMaxInputFileNumber(100);
+
+ // Optionally modify the executable name (default analysis.sh)
+ plugin->SetExecutable(Form("%s.sh",taskname));
+
+ // set number of test files to use in "test" mode
+ plugin->SetNtestFiles(1);
+
+ // Optionally resubmit threshold.
+ plugin->SetMasterResubmitThreshold(90);
+
+ // Optionally set time to live (default 30000 sec)
+ plugin->SetTTL(90000);
+
+ // Optionally set input format (default xml-single)
+ plugin->SetInputFormat("xml-single");
+
+ // Optionally modify the name of the generated JDL (default analysis.jdl)
+ plugin->SetJDLName(Form("%s.jdl",taskname));
+
+ // Optionally modify job price (default 1)
+ plugin->SetPrice(1);
+
+ // Optionally modify split mode (default 'se')
+ plugin->SetSplitMode("se");
+
+ //plugin->SetUseSubmitPolicy();
+ //plugin->SetKeepLogs();
+
+ //----------------------------------------------------------
+ //--- PROOF MODE SPECIFIC SETTINGS ------------
+ //----------------------------------------------------------
+ // Proof cluster
+ plugin->SetProofCluster(proofcluster);
+ // Dataset to be used
+ plugin->SetProofDataSet(proofdataset);
+ // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
+ plugin->SetProofReset(0);
+ // May limit number of workers
+ plugin->SetNproofWorkers(0);
+ // May limit the number of workers per slave
+ plugin->SetNproofWorkersPerSlave(1);
+ // May use a specific version of root installed in proof
+ plugin->SetRootVersionForProof("current");
+ // May set the aliroot mode. Check http://aaf.cern.ch/node/83
+ plugin->SetAliRootMode("default"); // Loads AF libs by default
+ // May request ClearPackages (individual ClearPackage not supported)
+ plugin->SetClearPackages(kFALSE);
+ // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
+ plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc
+ // Request connection to alien upon connection to grid
+ plugin->SetProofConnectGrid(kFALSE);
+
+ plugin->Print();
+
+ return plugin;
+}
+
-\r
-/*********************************************************************\r
- * *\r
- * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic *\r
- * analysis, meant as a QA process for two-particle effects *\r
- * *\r
- * Author: Adam Kisiel (Adam.Kisiel@cern.ch) *\r
- * *\r
- *********************************************************************/\r
-\r
-#if !defined(__CINT__) || defined(__MAKECINT_)\r
-#include "AliFemtoManager.h"\r
-#include "AliFemtoEventReaderESDChain.h"\r
-#include "AliFemtoEventReaderESDChainKine.h"\r
-#include "AliFemtoEventReaderAODChain.h"\r
-#include "AliFemtoSimpleAnalysis.h"\r
-#include "AliFemtoBasicEventCut.h"\r
-#include "AliFemtoESDTrackCut.h"\r
-#include "AliFemtoKKTrackCut.h"\r
-#include "AliFemtoCorrFctn.h"\r
-#include "AliFemtoCutMonitorParticleYPt.h"\r
-#include "AliFemtoCutMonitorParticleVertPos.h"\r
-#include "AliFemtoCutMonitorParticleMomRes.h"\r
-#include "AliFemtoCutMonitorParticlePID.h"\r
-#include "AliFemtoCutMonitorEventMult.h"\r
-#include "AliFemtoCutMonitorEventVertex.h"\r
-#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"\r
-#include "AliFemtoPairCutAntiGamma.h"\r
-#include "AliFemtoPairCutRadialDistance.h"\r
-#include "AliFemtoQinvCorrFctn.h"\r
-#include "AliFemtoShareQualityCorrFctn.h"\r
-#include "AliFemtoTPCInnerCorrFctn.h"\r
-#include "AliFemtoVertexMultAnalysis.h"\r
-#include "AliFemtoCorrFctn3DSpherical.h"\r
-#include "AliFemtoChi2CorrFctn.h"\r
-#include "AliFemtoCorrFctnTPCNcls.h"\r
-#include "AliFemtoBPLCMS3DCorrFctn.h"\r
-#include "AliFemtoCorrFctn3DLCMSSym.h"\r
-#include "AliFemtoModelBPLCMSCorrFctn.h"\r
-#include "AliFemtoModelCorrFctn3DSpherical.h"\r
-#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"\r
-#include "AliFemtoModelGausRinvFreezeOutGenerator.h"\r
-#include "AliFemtoModelManager.h"\r
-#include "AliFemtoModelWeightGeneratorBasic.h"\r
-#include "AliFemtoModelWeightGeneratorLednicky.h"\r
-#include "AliFemtoCorrFctnDirectYlm.h"\r
-#include "AliFemtoModelCorrFctnDirectYlm.h"\r
-#include "AliFemtoModelCorrFctnSource.h"\r
-#include "AliFemtoCutMonitorParticlePtPDG.h"\r
-#include "AliFemtoKTPairCut.h"\r
-#include "AliFemtoCutMonitorCollections.h"\r
-#endif\r
-\r
-//________________________________________________________________________\r
-AliFemtoManager* ConfigFemtoAnalysis() {\r
-\r
- double PionMass = 0.13956995;\r
- double KaonMass = 0.493677;\r
- \r
- //multiplicity bins\r
- //int runmults[10] = {1, 1, 1, 1, 0, 0, 0, 0, 0, 0};\r
- //int multbins[11] = {0.01, 200, 400, 600, 1000, 950, 500, 600, 700, 800, 900};\r
- //int runmults[3] = {1, 1, 1};\r
- //int multbins[4] = {0.01, 200, 400, 900};\r
- int runmults[3] = {1, 0, 0};\r
- int multbins[4] = {0.01, 50, 100, 900};\r
-\r
- int runch[2] = {1, 1};\r
- //const char *chrgs[2] = { "pip", "pim" };\r
- const char *chrgs[2] = { "Kp", "Km"};\r
-\r
- int runktdep = 1;\r
- //double ktrng[8] = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0};\r
- //double ktrng[3] = {0.2, 0.5, 1.0};\r
- //double ktrng[3] = {0.2, 0.5, 1.0};\r
- double ktrng[2] = {0.2, 0.36};\r
- \r
- int run3d = 1; // Do 3D cartesian analysis?\r
- //int runshlcms = 1;\r
- int runshlcms = 0;\r
-\r
- //PhysicsSelection set only in runBatch with trigger + Physics Selection Task\r
-\r
-\r
- double shqmax;\r
- int nbinssh = 200;\r
- //int nbinssh = 100;\r
-\r
- //if (runshlcms) shqmax = 2.0;\r
- if (runshlcms) shqmax = 0.25;\r
- //else shqmax = 0.9;\r
- else shqmax = 2.0;\r
-\r
- AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();\r
- Reader->SetFilterBit(0);\r
- Reader->SetCentralityPreSelection(0.01, 900);\r
-\r
- //AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();\r
- //Reader->SetConstrained(true);\r
- // Reader->SetUseTPCOnly(false);\r
-\r
- // AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();\r
- // Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kV0Centrality);\r
- // Reader->SetReadTrackType(AliFemtoEventReaderESDChain::kGlobal);\r
-\r
-\r
- AliFemtoManager* Manager=new AliFemtoManager();\r
- Manager->SetEventReader(Reader);\r
-\r
- AliFemtoVertexMultAnalysis *anetaphitpc[20];\r
- AliFemtoBasicEventCut *mecetaphitpc[20];\r
- AliFemtoCutMonitorEventMult *cutPassEvMetaphitpc[20];\r
- AliFemtoCutMonitorEventMult *cutFailEvMetaphitpc[20];\r
- AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[20];\r
- AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[20];\r
- AliFemtoCutMonitorCollections *cutPassColletaphitpc[20];\r
- AliFemtoCutMonitorCollections *cutFailColletaphitpc[20];\r
- AliFemtoKKTrackCut *dtc1etaphitpc[20];\r
- AliFemtoKKTrackCut *dtc2etaphitpc[20];\r
- //AliFemtoESDTrackCut *dtc1etaphitpc[20];\r
- //AliFemtoESDTrackCut *dtc2etaphitpc[20];\r
- AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[20];\r
- AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[20];\r
- AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[20];\r
- AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[20];\r
- AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[20];\r
- AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[20];\r
- AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[20];\r
- AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];\r
- // AliFemtoPairCutAntiGamma *sqpcetaphitpc[20];\r
- AliFemtoShareQualityPairCut *sqpcetaphitpc[20];\r
- //AliFemtoPairCutRadialDistance *sqpcetaphitpc[20];\r
- AliFemtoCorrFctnDirectYlm *cylmetaphitpc[20];\r
- AliFemtoCorrFctnDEtaDPhi *cdedpetaphi[20];\r
- AliFemtoChi2CorrFctn *cchiqinvetaphitpc[20];\r
- //AliFemtoKTPairCut *ktpcuts[20*7];\r
- //AliFemtoCorrFctnDirectYlm *cylmkttpc[20*7];\r
- //AliFemtoQinvCorrFctn *cqinvkttpc[20*7];\r
- //AliFemtoCorrFctn3DLCMSSym *cq3dlcmskttpc[20*7];\r
- AliFemtoKTPairCut *ktpcuts[20*8];\r
- AliFemtoCorrFctnDirectYlm *cylmkttpc[20*8];\r
- AliFemtoQinvCorrFctn *cqinvkttpc[20*8];\r
- AliFemtoCorrFctn3DLCMSSym *cq3dlcmskttpc[20*8];\r
- AliFemtoCorrFctnTPCNcls *cqinvnclstpc[20];\r
- AliFemtoShareQualityCorrFctn *cqinvsqtpc[20*10];\r
- AliFemtoChi2CorrFctn *cqinvchi2tpc[20];\r
- AliFemtoTPCInnerCorrFctn *cqinvinnertpc[20*10];\r
-\r
- // *** Begin pion-pion analysis ***\r
- int aniter = 0;\r
-\r
- for (int imult=0; imult<3; imult++) {\r
- if (runmults[imult]) {\r
- for (int ichg=0; ichg<2; ichg++) {\r
- if (runch[ichg]) {\r
- aniter = ichg*3+imult;\r
-\r
- anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(10, -10.0, 10.0, 4, multbins[imult], multbins[imult+1]);\r
- anetaphitpc[aniter]->SetNumEventsToMix(5);\r
- anetaphitpc[aniter]->SetMinSizePartCollection(1);\r
-\r
- mecetaphitpc[aniter] = new AliFemtoBasicEventCut();\r
- mecetaphitpc[aniter]->SetEventMult(0,10000);\r
- mecetaphitpc[aniter]->SetVertZPos(-10,10);\r
-\r
- //cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));\r
- //cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));\r
-\r
- cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult),500);\r
- cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult),500);\r
-\r
- mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);\r
- \r
- cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));\r
- cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));\r
- mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);\r
- \r
- cutPassColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutPass%stpcM%i", chrgs[ichg], imult));\r
- cutFailColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutFail%stpcM%i", chrgs[ichg], imult));\r
- mecetaphitpc[aniter]->AddCutMonitor(cutPassColletaphitpc[aniter], cutFailColletaphitpc[aniter]);\r
-\r
- //dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();\r
- dtc1etaphitpc[aniter] = new AliFemtoKKTrackCut();\r
-\r
- if (ichg == 0)\r
- dtc1etaphitpc[aniter]->SetCharge(1.0);\r
- else if (ichg == 1)\r
- dtc1etaphitpc[aniter]->SetCharge(-1.0);\r
-\r
- dtc1etaphitpc[aniter]->SetPt(0.14,1.5);\r
- dtc1etaphitpc[aniter]->SetRapidity(-0.5,0.5);\r
- //dtc1etaphitpc[aniter]->SetPt(0.14,1.5);\r
- //dtc1etaphitpc[aniter]->SetEta(-0.8,0.8);\r
-\r
- //PID method\r
- //dtc1etaphitpc[aniter]->SetMass(PionMass);\r
- //dtc1etaphitpc[aniter]->SetMostProbablePion();\r
- dtc1etaphitpc[aniter]->SetMass(KaonMass);\r
- dtc1etaphitpc[aniter]->SetMostProbableKaon();\r
- //dtc1etaphitpc[aniter]->SetPIDMethod(AliFemtoESDTrackCut::kContour);\r
-\r
- //Track quality cuts\r
- dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);\r
- dtc1etaphitpc[aniter]->SetminTPCncls(50);\r
- dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);\r
-\r
-\r
- dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);\r
- dtc1etaphitpc[aniter]->SetMaxITSChiNdof(36); \r
- dtc1etaphitpc[aniter]->SetLabel(kFALSE);\r
- \r
- //primary particles: hits in ITS + DCA cut\r
- //dtc1etaphitpc[aniter]->SetClusterRequirementITS(AliESDtrackCuts::kSPD,\r
- // AliESDtrackCuts::kAny);\r
- dtc1etaphitpc[aniter]->SetMaxImpactZ(2.0);\r
- //dtc1etaphitpc[aniter]->SetMaxImpactXY(2.4);\r
- dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0105, 0.0350, -1.1);\r
- //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);\r
- //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);\r
-\r
- //cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.13957);\r
- //cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.13957);\r
- cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.493677);\r
- cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.493677);\r
- dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1YPtetaphitpc[aniter], cutFail1YPtetaphitpc[aniter]);\r
- \r
- //cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),0);\r
- //cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),0);\r
- cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),1);\r
- cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),1);\r
- dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1PIDetaphitpc[aniter], cutFail1PIDetaphitpc[aniter]);\r
- \r
- //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();\r
- sqpcetaphitpc[aniter] = new AliFemtoShareQualityPairCut();\r
- //sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();\r
- //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();\r
- sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);\r
- sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);\r
- sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);\r
- //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);\r
- //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);\r
- //runtype==0\r
- // sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);\r
- // sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);\r
- // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);\r
- // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);\r
- // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);\r
- //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);\r
- //runtype==1\r
- // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(5.0);\r
- // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);\r
- //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.03);\r
- //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);\r
- //runtype==2\r
- // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.0);\r
- // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);\r
- //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);\r
- //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);\r
- //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);\r
- \r
- anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);\r
- anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);\r
- anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);\r
- anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);\r
- \r
- //Correlation functions\r
-\r
- //Spherical harmonics (without kT bins)\r
- //cylmetaphitpc[aniter] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%i", chrgs[ichg], imult),3,nbinssh,0.0,shqmax,runshlcms);\r
- //anetaphitpc[aniter]->AddCorrFctn(cylmetaphitpc[aniter]);\r
-\r
- //Qinv (without kT bins)\r
- cqinvkttpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);\r
- anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[aniter]);\r
-\r
- //3D cartesian (without kT bins)\r
- if(run3d){\r
- //cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),60,0.5);\r
- cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),100,0.5);\r
- anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[aniter]);\r
- }\r
- \r
- // cqinvnclstpc[aniter] = new AliFemtoCorrFctnTPCNcls(Form("cqinvncls%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);\r
- // anetaphitpc[aniter]->AddCorrFctn(cqinvnclstpc[aniter]);\r
-\r
- // cqinvchi2tpc[aniter] = new AliFemtoChi2CorrFctn(Form("cqinvchi2%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);\r
- // anetaphitpc[aniter]->AddCorrFctn(cqinvchi2tpc[aniter]);\r
-\r
- if (runktdep) {\r
- int ktm;\r
- for (int ikt=0; ikt<2; ikt++) {\r
- ktm = aniter*2 + ikt;\r
- ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);\r
- \r
- //cylmkttpc[ktm] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%ikT%i", chrgs[ichg], imult, ikt),3,\r
- // nbinssh, 0.0, shqmax, runshlcms);\r
- //cylmkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);\r
- //anetaphitpc[aniter]->AddCorrFctn(cylmkttpc[ktm]);\r
- \r
- cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0, shqmax);\r
- cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);\r
- anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);\r
-\r
- cqinvsqtpc[ktm] = new AliFemtoShareQualityCorrFctn(Form("cqinvsq%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);\r
- cqinvsqtpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);\r
- anetaphitpc[aniter]->AddCorrFctn(cqinvsqtpc[ktm]);\r
-\r
- cqinvinnertpc[ktm] = new AliFemtoTPCInnerCorrFctn(Form("cqinvinner%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);\r
- cqinvinnertpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);\r
- cqinvinnertpc[ktm]->SetRadius(1.2);\r
- anetaphitpc[aniter]->AddCorrFctn(cqinvinnertpc[ktm]);\r
-\r
- if (run3d) {\r
- // cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,(imult>3)?((imult>6)?((imult>7)?0.6:0.4):0.25):0.15);\r
- cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,0.5);\r
- cq3dlcmskttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);\r
- anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[ktm]);\r
- }\r
- }\r
- }\r
- \r
- cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),39, 39);\r
- anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);\r
- \r
- Manager->AddAnalysis(anetaphitpc[aniter]); \r
- }\r
- }\r
- }\r
- }\r
- // *** End pion-pion analysis\r
-\r
- return Manager;\r
-} \r
- \r
+
+/*********************************************************************
+ * *
+ * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic *
+ * analysis, meant as a QA process for two-particle effects *
+ * *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch) *
+ * *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoESDTrackCut.h"
+#include "AliFemtoKKTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoCutMonitorCollections.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis() {
+
+ double PionMass = 0.13956995;
+ double KaonMass = 0.493677;
+
+ //multiplicity bins
+ //int runmults[10] = {1, 1, 1, 1, 0, 0, 0, 0, 0, 0};
+ //int multbins[11] = {0.01, 200, 400, 600, 1000, 950, 500, 600, 700, 800, 900};
+ //int runmults[3] = {1, 1, 1};
+ //int multbins[4] = {0.01, 200, 400, 900};
+ int runmults[3] = {1, 0, 0};
+ int multbins[4] = {0.01, 50, 100, 900};
+
+ int runch[2] = {1, 1};
+ //const char *chrgs[2] = { "pip", "pim" };
+ const char *chrgs[2] = { "Kp", "Km"};
+
+ int runktdep = 1;
+ //double ktrng[8] = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0};
+ //double ktrng[3] = {0.2, 0.5, 1.0};
+ //double ktrng[3] = {0.2, 0.5, 1.0};
+ double ktrng[2] = {0.2, 0.36};
+
+ int run3d = 1; // Do 3D cartesian analysis?
+ //int runshlcms = 1;
+ int runshlcms = 0;
+
+ //PhysicsSelection set only in runBatch with trigger + Physics Selection Task
+
+
+ double shqmax;
+ int nbinssh = 200;
+ //int nbinssh = 100;
+
+ //if (runshlcms) shqmax = 2.0;
+ if (runshlcms) shqmax = 0.25;
+ //else shqmax = 0.9;
+ else shqmax = 2.0;
+
+ AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+ Reader->SetFilterBit(0);
+ Reader->SetCentralityPreSelection(0.01, 900);
+
+ //AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();
+ //Reader->SetConstrained(true);
+ // Reader->SetUseTPCOnly(false);
+
+ // AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+ // Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kV0Centrality);
+ // Reader->SetReadTrackType(AliFemtoEventReaderESDChain::kGlobal);
+
+
+ AliFemtoManager* Manager=new AliFemtoManager();
+ Manager->SetEventReader(Reader);
+
+ AliFemtoVertexMultAnalysis *anetaphitpc[20];
+ AliFemtoBasicEventCut *mecetaphitpc[20];
+ AliFemtoCutMonitorEventMult *cutPassEvMetaphitpc[20];
+ AliFemtoCutMonitorEventMult *cutFailEvMetaphitpc[20];
+ AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[20];
+ AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[20];
+ AliFemtoCutMonitorCollections *cutPassColletaphitpc[20];
+ AliFemtoCutMonitorCollections *cutFailColletaphitpc[20];
+ AliFemtoKKTrackCut *dtc1etaphitpc[20];
+ AliFemtoKKTrackCut *dtc2etaphitpc[20];
+ //AliFemtoESDTrackCut *dtc1etaphitpc[20];
+ //AliFemtoESDTrackCut *dtc2etaphitpc[20];
+ AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[20];
+ AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[20];
+ AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[20];
+ AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[20];
+ AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[20];
+ AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[20];
+ AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[20];
+ AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];
+ // AliFemtoPairCutAntiGamma *sqpcetaphitpc[20];
+ AliFemtoShareQualityPairCut *sqpcetaphitpc[20];
+ //AliFemtoPairCutRadialDistance *sqpcetaphitpc[20];
+ AliFemtoCorrFctnDirectYlm *cylmetaphitpc[20];
+ AliFemtoCorrFctnDEtaDPhi *cdedpetaphi[20];
+ AliFemtoChi2CorrFctn *cchiqinvetaphitpc[20];
+ //AliFemtoKTPairCut *ktpcuts[20*7];
+ //AliFemtoCorrFctnDirectYlm *cylmkttpc[20*7];
+ //AliFemtoQinvCorrFctn *cqinvkttpc[20*7];
+ //AliFemtoCorrFctn3DLCMSSym *cq3dlcmskttpc[20*7];
+ AliFemtoKTPairCut *ktpcuts[20*8];
+ AliFemtoCorrFctnDirectYlm *cylmkttpc[20*8];
+ AliFemtoQinvCorrFctn *cqinvkttpc[20*8];
+ AliFemtoCorrFctn3DLCMSSym *cq3dlcmskttpc[20*8];
+ AliFemtoCorrFctnTPCNcls *cqinvnclstpc[20];
+ AliFemtoShareQualityCorrFctn *cqinvsqtpc[20*10];
+ AliFemtoChi2CorrFctn *cqinvchi2tpc[20];
+ AliFemtoTPCInnerCorrFctn *cqinvinnertpc[20*10];
+
+ // *** Begin pion-pion analysis ***
+ int aniter = 0;
+
+ for (int imult=0; imult<3; imult++) {
+ if (runmults[imult]) {
+ for (int ichg=0; ichg<2; ichg++) {
+ if (runch[ichg]) {
+ aniter = ichg*3+imult;
+
+ anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(10, -10.0, 10.0, 4, multbins[imult], multbins[imult+1]);
+ anetaphitpc[aniter]->SetNumEventsToMix(5);
+ anetaphitpc[aniter]->SetMinSizePartCollection(1);
+
+ mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+ mecetaphitpc[aniter]->SetEventMult(0,10000);
+ mecetaphitpc[aniter]->SetVertZPos(-10,10);
+
+ //cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+ //cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+
+ cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult),500);
+ cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult),500);
+
+ mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+
+ cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+ cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+ mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+ cutPassColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+ cutFailColletaphitpc[aniter] = new AliFemtoCutMonitorCollections(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+ mecetaphitpc[aniter]->AddCutMonitor(cutPassColletaphitpc[aniter], cutFailColletaphitpc[aniter]);
+
+ //dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();
+ dtc1etaphitpc[aniter] = new AliFemtoKKTrackCut();
+
+ if (ichg == 0)
+ dtc1etaphitpc[aniter]->SetCharge(1.0);
+ else if (ichg == 1)
+ dtc1etaphitpc[aniter]->SetCharge(-1.0);
+
+ dtc1etaphitpc[aniter]->SetPt(0.14,1.5);
+ dtc1etaphitpc[aniter]->SetRapidity(-0.5,0.5);
+ //dtc1etaphitpc[aniter]->SetPt(0.14,1.5);
+ //dtc1etaphitpc[aniter]->SetEta(-0.8,0.8);
+
+ //PID method
+ //dtc1etaphitpc[aniter]->SetMass(PionMass);
+ //dtc1etaphitpc[aniter]->SetMostProbablePion();
+ dtc1etaphitpc[aniter]->SetMass(KaonMass);
+ dtc1etaphitpc[aniter]->SetMostProbableKaon();
+ //dtc1etaphitpc[aniter]->SetPIDMethod(AliFemtoESDTrackCut::kContour);
+
+ //Track quality cuts
+ dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+ dtc1etaphitpc[aniter]->SetminTPCncls(50);
+ dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+
+
+ dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+ dtc1etaphitpc[aniter]->SetMaxITSChiNdof(36);
+ dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+
+ //primary particles: hits in ITS + DCA cut
+ //dtc1etaphitpc[aniter]->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+ // AliESDtrackCuts::kAny);
+ dtc1etaphitpc[aniter]->SetMaxImpactZ(2.0);
+ //dtc1etaphitpc[aniter]->SetMaxImpactXY(2.4);
+ dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0105, 0.0350, -1.1);
+ //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+ //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+ //cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.13957);
+ //cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.13957);
+ cutPass1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass1%stpcM%i", chrgs[ichg], imult), 0.493677);
+ cutFail1YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail1%stpcM%i", chrgs[ichg], imult), 0.493677);
+ dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1YPtetaphitpc[aniter], cutFail1YPtetaphitpc[aniter]);
+
+ //cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),0);
+ //cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),0);
+ cutPass1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass1%stpcM%i", chrgs[ichg], imult),1);
+ cutFail1PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail1%stpcM%i", chrgs[ichg], imult),1);
+ dtc1etaphitpc[aniter]->AddCutMonitor(cutPass1PIDetaphitpc[aniter], cutFail1PIDetaphitpc[aniter]);
+
+ //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+ sqpcetaphitpc[aniter] = new AliFemtoShareQualityPairCut();
+ //sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();
+ //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();
+ sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);
+ sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
+ sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+ //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+ //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+ //runtype==0
+ // sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+ // sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+ // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+ // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+ // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+ //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+ //runtype==1
+ // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(5.0);
+ // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+ //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.03);
+ //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+ //runtype==2
+ // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.0);
+ // sqpcetaphitpc[aniter]->SetPhiStarDistanceMinimum(0.03);
+ //sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);
+ //sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
+ //sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+
+ anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+ anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+ anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+ anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+ //Correlation functions
+
+ //Spherical harmonics (without kT bins)
+ //cylmetaphitpc[aniter] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%i", chrgs[ichg], imult),3,nbinssh,0.0,shqmax,runshlcms);
+ //anetaphitpc[aniter]->AddCorrFctn(cylmetaphitpc[aniter]);
+
+ //Qinv (without kT bins)
+ cqinvkttpc[aniter] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+ anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[aniter]);
+
+ //3D cartesian (without kT bins)
+ if(run3d){
+ //cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),60,0.5);
+ cq3dlcmskttpc[aniter] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%i", chrgs[ichg], imult),100,0.5);
+ anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[aniter]);
+ }
+
+ // cqinvnclstpc[aniter] = new AliFemtoCorrFctnTPCNcls(Form("cqinvncls%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+ // anetaphitpc[aniter]->AddCorrFctn(cqinvnclstpc[aniter]);
+
+ // cqinvchi2tpc[aniter] = new AliFemtoChi2CorrFctn(Form("cqinvchi2%stpcM%i", chrgs[ichg], imult),nbinssh,0.0,shqmax);
+ // anetaphitpc[aniter]->AddCorrFctn(cqinvchi2tpc[aniter]);
+
+ if (runktdep) {
+ int ktm;
+ for (int ikt=0; ikt<2; ikt++) {
+ ktm = aniter*2 + ikt;
+ ktpcuts[ktm] = new AliFemtoKTPairCut(ktrng[ikt], ktrng[ikt+1]);
+
+ //cylmkttpc[ktm] = new AliFemtoCorrFctnDirectYlm(Form("cylm%stpcM%ikT%i", chrgs[ichg], imult, ikt),3,
+ // nbinssh, 0.0, shqmax, runshlcms);
+ //cylmkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+ //anetaphitpc[aniter]->AddCorrFctn(cylmkttpc[ktm]);
+
+ cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0, shqmax);
+ cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+ anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+ cqinvsqtpc[ktm] = new AliFemtoShareQualityCorrFctn(Form("cqinvsq%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+ cqinvsqtpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+ anetaphitpc[aniter]->AddCorrFctn(cqinvsqtpc[ktm]);
+
+ cqinvinnertpc[ktm] = new AliFemtoTPCInnerCorrFctn(Form("cqinvinner%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,shqmax);
+ cqinvinnertpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+ cqinvinnertpc[ktm]->SetRadius(1.2);
+ anetaphitpc[aniter]->AddCorrFctn(cqinvinnertpc[ktm]);
+
+ if (run3d) {
+ // cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,(imult>3)?((imult>6)?((imult>7)?0.6:0.4):0.25):0.15);
+ cq3dlcmskttpc[ktm] = new AliFemtoCorrFctn3DLCMSSym(Form("cq3d%stpcM%ikT%i", chrgs[ichg], imult, ikt),60,0.5);
+ cq3dlcmskttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+ anetaphitpc[aniter]->AddCorrFctn(cq3dlcmskttpc[ktm]);
+ }
+ }
+ }
+
+ cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),39, 39);
+ anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+ Manager->AddAnalysis(anetaphitpc[aniter]);
+ }
+ }
+ }
+ }
+ // *** End pion-pion analysis
+
+ return Manager;
+}
+
-void AddTaskFlowCascade(int trigger, int centrMin, int centrMax, int cut=1, int harmonic=2) {\r
- AddTaskFlowCascade(trigger, centrMin, centrMax, "Xi", \r
- Form("Xi%d%dcut%d", centrMin, centrMax, cut), 0, cut, "V0M", "VZESP", harmonic);\r
-\r
- AddTaskFlowCascade(trigger, centrMin, centrMax, "Omega", \r
- Form("Omega%d%dcut%d", centrMin,centrMax, cut), 1, cut, "V0M", "VZESP", harmonic);\r
-}\r
-\r
-void AddTaskFlowCascade(int trigger, float centrMin, float centrMax, \r
- TString folderName="myFolder", TString suffixName="mySuffix", \r
- int specie=0, int cuts=1, char* MULT="V0M", \r
- TString method="VZESP QC TPCSP", int harmonic=2) {\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- // fileName.ReplaceAll(".root","");\r
-\r
- //-E-V-E-N-T- -c-u-t-s--------------------------------------------------------\r
- AliFlowEventCuts* cutsEvent = new AliFlowEventCuts(Form("event_cuts_%s",suffixName.Data()));\r
- cutsEvent->SetCentralityPercentileRange(centrMin,centrMax);\r
- if(MULT=="V0M")\r
- cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);\r
- else\r
- cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kTPConly);\r
- cutsEvent->SetRefMultMethod(AliFlowEventCuts::kSPDtracklets);\r
- cutsEvent->SetNContributorsRange(2);\r
- cutsEvent->SetPrimaryVertexZrange(-10.,+10.);\r
-\r
- //-R-P---c-u-t-s--------------------------------------------------------------\r
- AliFlowTrackCuts *cutsRPTPC \r
- = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts();\r
- cutsRPTPC->SetParamType( AliFlowTrackCuts::kGlobal );\r
- cutsRPTPC->SetAODfilterBit(1); // for AOD compatibility\r
- \r
- AliFlowTrackCuts *cutsRPVZE = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();\r
- // AliFlowTrackCuts* trkCuts = new AliFlowTrackCuts();\r
- //AliFlowTrackCuts *cutsRPVZE = trkCuts->GetStandardVZEROOnlyTrackCuts();\r
- cutsRPVZE->SetApplyRecentering(kTRUE);\r
- \r
- //-D-A-U-G-H-T-E-R-S---c-u-t-s------------------------------------------------\r
- // AliESDtrackCuts* cutsDaughter \r
- // = new AliESDtrackCuts(Form("daughter_cuts_%s",suffixName.Data()) );\r
- AliFlowTrackCuts * cutsDaughter \r
- = new AliFlowTrackCuts(Form("daughter_cuts_%s",suffixName.Data()));\r
- cutsDaughter->SetPtRange(0.15,10.0);\r
- cutsDaughter->SetEtaRange(-0.8, 0.8 );\r
- cutsDaughter->SetMinNClustersTPC(70);\r
- cutsDaughter->SetMaxChi2PerClusterTPC(4.0);\r
- cutsDaughter->SetRequireTPCRefit(kTRUE);\r
- cutsDaughter->SetAcceptKinkDaughters(kFALSE);\r
-\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();\r
-\r
- //-----------------Cascade TASK----------------------------\r
- AliAnalysisTaskFlowCascade *taskSel \r
- = new AliAnalysisTaskFlowCascade(Form("Cascade_%s",suffixName.Data()),\r
- cutsEvent, cutsRPTPC, cutsRPVZE,\r
- cutsDaughter );\r
- taskSel->SelectCollisionCandidates(trigger);\r
- //taskSel->SetDebug();\r
- taskSel->SetCuts2010(cuts);\r
- taskSel->SetSpecie(specie);\r
- //printf( "CMM %d %f %f\n", MassBins(specie), MinMass(specie), MSFT_MaxMass(specie) );\r
- taskSel->SetCommonConstants( MSFT_MassBins(specie), MSFT_MinMass(specie), MSFT_MaxMass(specie) );\r
- AliAnalysisDataContainer *cOutHist \r
- = mgr->CreateContainer(Form("OutHistos_%s",suffixName.Data()),\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- Form("%s:Selector_%s",fileName.Data(),\r
- folderName.Data()));\r
- AliAnalysisDataContainer *exc_TPC \r
- = mgr->CreateContainer( Form("TPCEventWithCandidates_%s",suffixName.Data()),\r
- AliFlowEventSimple::Class(),\r
- AliAnalysisManager::kExchangeContainer );\r
- AliAnalysisDataContainer *exc_VZE \r
- = mgr->CreateContainer( Form("VZEEventWithCandidates_%s",suffixName.Data()),\r
- AliFlowEventSimple::Class(),\r
- AliAnalysisManager::kExchangeContainer );\r
- mgr->AddTask(taskSel);\r
- mgr->ConnectInput (taskSel, 0, cinput1);\r
- mgr->ConnectOutput(taskSel, 1, exc_TPC);\r
- mgr->ConnectOutput(taskSel, 2, exc_VZE);\r
- mgr->ConnectOutput(taskSel, 3, cOutHist);\r
-\r
- //-------------------FLOW TASKS----------------------------\r
- AliFlowTrackSimpleCuts *filter[15], *filterhf[15][2]; // MASS BANDS\r
- for(int mb=0; mb!=MSFT_MassBands(0); ++mb) {\r
- filter[mb] = new AliFlowTrackSimpleCuts( Form("Filter_MB%d",mb) );\r
- filter[mb]->SetEtaMin( -0.8 ); \r
- filter[mb]->SetEtaMax( +0.8 );\r
- filter[mb]->SetMassMin( MSFT_MassBandLowEdge(specie, mb) ); \r
- filter[mb]->SetMassMax( MSFT_MassBandLowEdge(specie, mb+1) );\r
-\r
- filterhf[mb][0] = new AliFlowTrackSimpleCuts( Form("Filterhf0_MB%d",mb) );\r
- filterhf[mb][0]->SetEtaMin( 0.0 ); \r
- filterhf[mb][0]->SetEtaMax( +0.8 );\r
- filterhf[mb][0]->SetMassMin( MSFT_MassBandLowEdge(specie, mb) ); \r
- filterhf[mb][0]->SetMassMax( MSFT_MassBandLowEdge(specie, mb+1) );\r
-\r
- filterhf[mb][1] = new AliFlowTrackSimpleCuts( Form("Filterhf1_MB%d",mb) );\r
- filterhf[mb][1]->SetEtaMin( -0.8 ); \r
- filterhf[mb][1]->SetEtaMax( 0.0 );\r
- filterhf[mb][1]->SetMassMin( MSFT_MassBandLowEdge(specie, mb) ); \r
- filterhf[mb][1]->SetMassMax( MSFT_MassBandLowEdge(specie, mb+1) );\r
-\r
- if(method.Contains("QC"))\r
- MSFT_AddQCmethod( Form("QCTPCMB%d", mb), folderName.Data(), suffixName.Data(), harmonic, \r
- exc_TPC, filter[mb]); // QC TPC\r
- if(method.Contains("TPCSP")){\r
- MSFT_AddSPmethod( Form("SPTPCMB%d", mb), folderName.Data(), suffixName.Data(), harmonic, \r
- exc_TPC, filterhf[mb][0], "Qa" ); // SP TPC Qa\r
- MSFT_AddSPmethod( Form("SPTPCMB%d", mb), folderName.Data(), suffixName.Data(), harmonic, \r
- exc_TPC, filterhf[mb][1], "Qb" ); // SP TPC Qb\r
- }\r
- if(method.Contains("VZESP")){\r
- MSFT_AddSPmethod( Form("SPVZEMB%d", mb), folderName.Data(), suffixName.Data(), harmonic, \r
- exc_VZE, filter[mb], "Qa" ); // SP VZE Qa\r
- MSFT_AddSPmethod( Form("SPVZEMB%d",mb), folderName.Data(), suffixName.Data(), harmonic, \r
- exc_VZE, filter[mb], "Qb" ); // SP VZE Qa\r
- MSFT_AddSPmethod( Form("SPVZEMB%d",mb), folderName.Data(), suffixName.Data(), harmonic,\r
- exc_VZE, filter[mb], "QaQb" ); // SP VZE QaQb\r
- }\r
- }\r
-}\r
-\r
-void MSFT_AddQCmethod(char *name, TString myFolder, char *thecuts, int harmonic, \r
- AliAnalysisDataContainer *flowEvent, \r
- AliFlowTrackSimpleCuts *cutsPOI=NULL) {\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- myFolder.Append( Form("v%d",harmonic) );\r
- TString myName = Form("%sv%d_%s", name, harmonic, thecuts);\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *flowEvent2 \r
- = mgr->CreateContainer( Form("Filter_%s", myName.Data()),\r
- AliFlowEventSimple::Class(),\r
- AliAnalysisManager::kExchangeContainer );\r
- AliAnalysisTaskFilterFE *tskFilter \r
- = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myName.Data()),\r
- NULL, cutsPOI);\r
- mgr->AddTask(tskFilter);\r
- mgr->ConnectInput( tskFilter, 0, flowEvent);\r
- mgr->ConnectOutput(tskFilter, 1, flowEvent2);\r
-\r
- AliAnalysisDataContainer *outQC \r
- = mgr->CreateContainer( myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer,\r
- Form("%s:FlowCascade_QC_%s", fileName.Data(), myFolder.Data()) );\r
- AliAnalysisTaskQCumulants *tskQC \r
- = new AliAnalysisTaskQCumulants( Form("TaskQCumulants_%s",myName.Data()),kFALSE );\r
- tskQC->SetApplyCorrectionForNUA(kTRUE);\r
- tskQC->SetHarmonic(harmonic);\r
- tskQC->SetBookOnlyBasicCCH(kTRUE);\r
- mgr->AddTask(tskQC);\r
- mgr->ConnectInput( tskQC, 0, flowEvent2);\r
- mgr->ConnectOutput(tskQC, 1, outQC);\r
-}\r
-\r
-\r
-void MSFT_AddSPmethod(char *name, TString myFolder, char *thecuts, int harmonic,\r
- AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL,\r
- char *Qvector) {\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- myFolder.Append( Form("v%d",harmonic) );\r
- TString myNameSP = Form("%sv%d%s_%s", name, harmonic, Qvector, thecuts);\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *flowEvent2 \r
- = mgr->CreateContainer( Form("Filter_%s", myNameSP.Data()),\r
- AliFlowEventSimple::Class(),\r
- AliAnalysisManager::kExchangeContainer );\r
- AliAnalysisTaskFilterFE *tskFilter \r
- = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameSP.Data()),\r
- NULL, cutsPOI);\r
- tskFilter->SetSubeventEtaRange( -5.0, -1.0, 1.0, +5.0 );\r
- mgr->AddTask(tskFilter);\r
- mgr->ConnectInput( tskFilter, 0, flowEvent);\r
- mgr->ConnectOutput(tskFilter, 1, flowEvent2);\r
- AliAnalysisDataContainer *outSP \r
- = mgr->CreateContainer( myNameSP.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,\r
- Form("%s:FlowCascade_SP_%s",fileName.Data(),myFolder.Data()) );\r
- AliAnalysisTaskScalarProduct *tskSP \r
- = new AliAnalysisTaskScalarProduct( Form("TaskScalarProduct_%s",myNameSP.Data()),kFALSE);\r
- tskSP->SetApplyCorrectionForNUA(kTRUE);\r
- tskSP->SetHarmonic(harmonic);\r
- tskSP->SetTotalQvector(Qvector);\r
- tskSP->SetBookOnlyBasicCCH(kTRUE);\r
- mgr->AddTask(tskSP);\r
- mgr->ConnectInput( tskSP,0,flowEvent2);\r
- mgr->ConnectOutput(tskSP,1,outSP);\r
-}\r
-\r
-double MSFT_MassBandLowEdge( int nv0, int mb ) {\r
- if(nv0==0) {\r
- double lowEdge[15+1]={ 1.282, 1.292, 1.302, 1.312, 1.317, 1.319, 1.321, 1.322, \r
- 1.323, 1.325, 1.327, 1.332, 1.342, 1.352, 1.362, 1.372};\r
- } if(nv0==1) {\r
- double lowEdge[15+1]={ 1.632, 1.642, 1.652, 1.662, 1.667, 1.669, 1.671, 1.672, \r
- 1.673, 1.675, 1.677, 1.682, 1.692, 1.702, 1.712, 1.722 };\r
- }\r
- return lowEdge[mb];\r
-}\r
-\r
-int MSFT_MassBands( int nv0 ) {\r
- if(nv0==0) {\r
- return 15;\r
- } else if(nv0==1) {\r
- return 15;\r
- }\r
-}\r
-\r
-int MSFT_MassBins( int nv0 ) {\r
- if(nv0==0) {\r
- return 90;\r
- } else if(nv0==1) {\r
- return 90;\r
- }\r
-}\r
-\r
-double MSFT_MinMass( int nv0 ) {\r
- return MSFT_MassBandLowEdge( nv0, 0 );\r
-}\r
-\r
-double MSFT_MaxMass( int nv0 ) {\r
- return MSFT_MassBandLowEdge( nv0, MSFT_MassBands(nv0) );\r
-}\r
+void AddTaskFlowCascade(int trigger, int centrMin, int centrMax, int cut=1, int harmonic=2) {
+ AddTaskFlowCascade(trigger, centrMin, centrMax, "Xi",
+ Form("Xi%d%dcut%d", centrMin, centrMax, cut), 0, cut, "V0M", "VZESP", harmonic);
+
+ AddTaskFlowCascade(trigger, centrMin, centrMax, "Omega",
+ Form("Omega%d%dcut%d", centrMin,centrMax, cut), 1, cut, "V0M", "VZESP", harmonic);
+}
+
+void AddTaskFlowCascade(int trigger, float centrMin, float centrMax,
+ TString folderName="myFolder", TString suffixName="mySuffix",
+ int specie=0, int cuts=1, char* MULT="V0M",
+ TString method="VZESP QC TPCSP", int harmonic=2) {
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ // fileName.ReplaceAll(".root","");
+
+ //-E-V-E-N-T- -c-u-t-s--------------------------------------------------------
+ AliFlowEventCuts* cutsEvent = new AliFlowEventCuts(Form("event_cuts_%s",suffixName.Data()));
+ cutsEvent->SetCentralityPercentileRange(centrMin,centrMax);
+ if(MULT=="V0M")
+ cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);
+ else
+ cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kTPConly);
+ cutsEvent->SetRefMultMethod(AliFlowEventCuts::kSPDtracklets);
+ cutsEvent->SetNContributorsRange(2);
+ cutsEvent->SetPrimaryVertexZrange(-10.,+10.);
+
+ //-R-P---c-u-t-s--------------------------------------------------------------
+ AliFlowTrackCuts *cutsRPTPC
+ = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts();
+ cutsRPTPC->SetParamType( AliFlowTrackCuts::kGlobal );
+ cutsRPTPC->SetAODfilterBit(1); // for AOD compatibility
+
+ AliFlowTrackCuts *cutsRPVZE = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();
+ // AliFlowTrackCuts* trkCuts = new AliFlowTrackCuts();
+ //AliFlowTrackCuts *cutsRPVZE = trkCuts->GetStandardVZEROOnlyTrackCuts();
+ cutsRPVZE->SetApplyRecentering(kTRUE);
+
+ //-D-A-U-G-H-T-E-R-S---c-u-t-s------------------------------------------------
+ // AliESDtrackCuts* cutsDaughter
+ // = new AliESDtrackCuts(Form("daughter_cuts_%s",suffixName.Data()) );
+ AliFlowTrackCuts * cutsDaughter
+ = new AliFlowTrackCuts(Form("daughter_cuts_%s",suffixName.Data()));
+ cutsDaughter->SetPtRange(0.15,10.0);
+ cutsDaughter->SetEtaRange(-0.8, 0.8 );
+ cutsDaughter->SetMinNClustersTPC(70);
+ cutsDaughter->SetMaxChi2PerClusterTPC(4.0);
+ cutsDaughter->SetRequireTPCRefit(kTRUE);
+ cutsDaughter->SetAcceptKinkDaughters(kFALSE);
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+
+ //-----------------Cascade TASK----------------------------
+ AliAnalysisTaskFlowCascade *taskSel
+ = new AliAnalysisTaskFlowCascade(Form("Cascade_%s",suffixName.Data()),
+ cutsEvent, cutsRPTPC, cutsRPVZE,
+ cutsDaughter );
+ taskSel->SelectCollisionCandidates(trigger);
+ //taskSel->SetDebug();
+ taskSel->SetCuts2010(cuts);
+ taskSel->SetSpecie(specie);
+ //printf( "CMM %d %f %f\n", MassBins(specie), MinMass(specie), MSFT_MaxMass(specie) );
+ taskSel->SetCommonConstants( MSFT_MassBins(specie), MSFT_MinMass(specie), MSFT_MaxMass(specie) );
+ AliAnalysisDataContainer *cOutHist
+ = mgr->CreateContainer(Form("OutHistos_%s",suffixName.Data()),
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ Form("%s:Selector_%s",fileName.Data(),
+ folderName.Data()));
+ AliAnalysisDataContainer *exc_TPC
+ = mgr->CreateContainer( Form("TPCEventWithCandidates_%s",suffixName.Data()),
+ AliFlowEventSimple::Class(),
+ AliAnalysisManager::kExchangeContainer );
+ AliAnalysisDataContainer *exc_VZE
+ = mgr->CreateContainer( Form("VZEEventWithCandidates_%s",suffixName.Data()),
+ AliFlowEventSimple::Class(),
+ AliAnalysisManager::kExchangeContainer );
+ mgr->AddTask(taskSel);
+ mgr->ConnectInput (taskSel, 0, cinput1);
+ mgr->ConnectOutput(taskSel, 1, exc_TPC);
+ mgr->ConnectOutput(taskSel, 2, exc_VZE);
+ mgr->ConnectOutput(taskSel, 3, cOutHist);
+
+ //-------------------FLOW TASKS----------------------------
+ AliFlowTrackSimpleCuts *filter[15], *filterhf[15][2]; // MASS BANDS
+ for(int mb=0; mb!=MSFT_MassBands(0); ++mb) {
+ filter[mb] = new AliFlowTrackSimpleCuts( Form("Filter_MB%d",mb) );
+ filter[mb]->SetEtaMin( -0.8 );
+ filter[mb]->SetEtaMax( +0.8 );
+ filter[mb]->SetMassMin( MSFT_MassBandLowEdge(specie, mb) );
+ filter[mb]->SetMassMax( MSFT_MassBandLowEdge(specie, mb+1) );
+
+ filterhf[mb][0] = new AliFlowTrackSimpleCuts( Form("Filterhf0_MB%d",mb) );
+ filterhf[mb][0]->SetEtaMin( 0.0 );
+ filterhf[mb][0]->SetEtaMax( +0.8 );
+ filterhf[mb][0]->SetMassMin( MSFT_MassBandLowEdge(specie, mb) );
+ filterhf[mb][0]->SetMassMax( MSFT_MassBandLowEdge(specie, mb+1) );
+
+ filterhf[mb][1] = new AliFlowTrackSimpleCuts( Form("Filterhf1_MB%d",mb) );
+ filterhf[mb][1]->SetEtaMin( -0.8 );
+ filterhf[mb][1]->SetEtaMax( 0.0 );
+ filterhf[mb][1]->SetMassMin( MSFT_MassBandLowEdge(specie, mb) );
+ filterhf[mb][1]->SetMassMax( MSFT_MassBandLowEdge(specie, mb+1) );
+
+ if(method.Contains("QC"))
+ MSFT_AddQCmethod( Form("QCTPCMB%d", mb), folderName.Data(), suffixName.Data(), harmonic,
+ exc_TPC, filter[mb]); // QC TPC
+ if(method.Contains("TPCSP")){
+ MSFT_AddSPmethod( Form("SPTPCMB%d", mb), folderName.Data(), suffixName.Data(), harmonic,
+ exc_TPC, filterhf[mb][0], "Qa" ); // SP TPC Qa
+ MSFT_AddSPmethod( Form("SPTPCMB%d", mb), folderName.Data(), suffixName.Data(), harmonic,
+ exc_TPC, filterhf[mb][1], "Qb" ); // SP TPC Qb
+ }
+ if(method.Contains("VZESP")){
+ MSFT_AddSPmethod( Form("SPVZEMB%d", mb), folderName.Data(), suffixName.Data(), harmonic,
+ exc_VZE, filter[mb], "Qa" ); // SP VZE Qa
+ MSFT_AddSPmethod( Form("SPVZEMB%d",mb), folderName.Data(), suffixName.Data(), harmonic,
+ exc_VZE, filter[mb], "Qb" ); // SP VZE Qa
+ MSFT_AddSPmethod( Form("SPVZEMB%d",mb), folderName.Data(), suffixName.Data(), harmonic,
+ exc_VZE, filter[mb], "QaQb" ); // SP VZE QaQb
+ }
+ }
+}
+
+void MSFT_AddQCmethod(char *name, TString myFolder, char *thecuts, int harmonic,
+ AliAnalysisDataContainer *flowEvent,
+ AliFlowTrackSimpleCuts *cutsPOI=NULL) {
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ myFolder.Append( Form("v%d",harmonic) );
+ TString myName = Form("%sv%d_%s", name, harmonic, thecuts);
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *flowEvent2
+ = mgr->CreateContainer( Form("Filter_%s", myName.Data()),
+ AliFlowEventSimple::Class(),
+ AliAnalysisManager::kExchangeContainer );
+ AliAnalysisTaskFilterFE *tskFilter
+ = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myName.Data()),
+ NULL, cutsPOI);
+ mgr->AddTask(tskFilter);
+ mgr->ConnectInput( tskFilter, 0, flowEvent);
+ mgr->ConnectOutput(tskFilter, 1, flowEvent2);
+
+ AliAnalysisDataContainer *outQC
+ = mgr->CreateContainer( myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer,
+ Form("%s:FlowCascade_QC_%s", fileName.Data(), myFolder.Data()) );
+ AliAnalysisTaskQCumulants *tskQC
+ = new AliAnalysisTaskQCumulants( Form("TaskQCumulants_%s",myName.Data()),kFALSE );
+ tskQC->SetApplyCorrectionForNUA(kTRUE);
+ tskQC->SetHarmonic(harmonic);
+ tskQC->SetBookOnlyBasicCCH(kTRUE);
+ mgr->AddTask(tskQC);
+ mgr->ConnectInput( tskQC, 0, flowEvent2);
+ mgr->ConnectOutput(tskQC, 1, outQC);
+}
+
+
+void MSFT_AddSPmethod(char *name, TString myFolder, char *thecuts, int harmonic,
+ AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL,
+ char *Qvector) {
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ myFolder.Append( Form("v%d",harmonic) );
+ TString myNameSP = Form("%sv%d%s_%s", name, harmonic, Qvector, thecuts);
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *flowEvent2
+ = mgr->CreateContainer( Form("Filter_%s", myNameSP.Data()),
+ AliFlowEventSimple::Class(),
+ AliAnalysisManager::kExchangeContainer );
+ AliAnalysisTaskFilterFE *tskFilter
+ = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameSP.Data()),
+ NULL, cutsPOI);
+ tskFilter->SetSubeventEtaRange( -5.0, -1.0, 1.0, +5.0 );
+ mgr->AddTask(tskFilter);
+ mgr->ConnectInput( tskFilter, 0, flowEvent);
+ mgr->ConnectOutput(tskFilter, 1, flowEvent2);
+ AliAnalysisDataContainer *outSP
+ = mgr->CreateContainer( myNameSP.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,
+ Form("%s:FlowCascade_SP_%s",fileName.Data(),myFolder.Data()) );
+ AliAnalysisTaskScalarProduct *tskSP
+ = new AliAnalysisTaskScalarProduct( Form("TaskScalarProduct_%s",myNameSP.Data()),kFALSE);
+ tskSP->SetApplyCorrectionForNUA(kTRUE);
+ tskSP->SetHarmonic(harmonic);
+ tskSP->SetTotalQvector(Qvector);
+ tskSP->SetBookOnlyBasicCCH(kTRUE);
+ mgr->AddTask(tskSP);
+ mgr->ConnectInput( tskSP,0,flowEvent2);
+ mgr->ConnectOutput(tskSP,1,outSP);
+}
+
+double MSFT_MassBandLowEdge( int nv0, int mb ) {
+ if(nv0==0) {
+ double lowEdge[15+1]={ 1.282, 1.292, 1.302, 1.312, 1.317, 1.319, 1.321, 1.322,
+ 1.323, 1.325, 1.327, 1.332, 1.342, 1.352, 1.362, 1.372};
+ } if(nv0==1) {
+ double lowEdge[15+1]={ 1.632, 1.642, 1.652, 1.662, 1.667, 1.669, 1.671, 1.672,
+ 1.673, 1.675, 1.677, 1.682, 1.692, 1.702, 1.712, 1.722 };
+ }
+ return lowEdge[mb];
+}
+
+int MSFT_MassBands( int nv0 ) {
+ if(nv0==0) {
+ return 15;
+ } else if(nv0==1) {
+ return 15;
+ }
+}
+
+int MSFT_MassBins( int nv0 ) {
+ if(nv0==0) {
+ return 90;
+ } else if(nv0==1) {
+ return 90;
+ }
+}
+
+double MSFT_MinMass( int nv0 ) {
+ return MSFT_MassBandLowEdge( nv0, 0 );
+}
+
+double MSFT_MaxMass( int nv0 ) {
+ return MSFT_MassBandLowEdge( nv0, MSFT_MassBands(nv0) );
+}
-/////////////////////////////////////////////////////////////////////////////////////////////\r
-//\r
-// AddTask* macro for flow analysis\r
-// Creates a Flow Event task and adds it to the analysis manager.\r
-// Sets the cuts using the correction framework (CORRFW) classes.\r
-// Also creates Flow Analysis tasks and connects them to the output of the flow event task.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////////////////////\r
-\r
-void AddTaskFlowHigherOrdersPID(Int_t centralitysel,\r
- Float_t centrMin=0.,\r
- Float_t centrMax=100.,\r
- TString fileNameBase="output",\r
- Bool_t isPID = kTRUE,\r
- Int_t AODfilterBitRP = 768,\r
- Int_t AODfilterBitPOI = 768,\r
- AliPID::EParticleType particleType=AliPID::kPion,\r
- AliFlowTrackCuts::PIDsource sourcePID = AliFlowTrackCuts::kTOFbayesian,\r
- Int_t charge=0,\r
- Int_t harmonic=3,\r
- Bool_t doQA=kFALSE,\r
- Float_t etamin=-0.8,\r
- Float_t etamax=0.8, \r
- TString uniqueStr="" )\r
-{\r
- // Define the range for eta subevents (for SP method)\r
- Double_t minA = -0.9;//\r
- Double_t maxA = -0.5;//\r
- Double_t minB = 0.5;//\r
- Double_t maxB = 0.9;//\r
-\r
- // AFTERBURNER\r
- Bool_t useAfterBurner=kFALSE;\r
- Double_t v1=0.0;\r
- Double_t v2=0.0;\r
- Double_t v3=0.0;\r
- Double_t v4=0.0;\r
- Int_t numberOfTrackClones=0; //non-flow\r
-\r
- // Define a range of the detector to exclude\r
- Bool_t ExcludeRegion = kFALSE;\r
- Double_t excludeEtaMin = -0.;\r
- Double_t excludeEtaMax = 0.;\r
- Double_t excludePhiMin = 0.;\r
- Double_t excludePhiMax = 0.;\r
-\r
- // use physics selection class\r
- Bool_t UsePhysicsSelection = kTRUE;\r
-\r
- // QA\r
- Bool_t runQAtask=kFALSE;\r
- Bool_t FillQAntuple=kFALSE;\r
- Bool_t DoQAcorrelations=kFALSE;\r
-\r
- // RUN SETTINGS\r
- // Flow analysis method can be:(set to kTRUE or kFALSE)\r
- Bool_t SP = kTRUE; // scalar product method (similar to eventplane method)\r
- Bool_t QC = kTRUE; // cumulants using Q vectors\r
- \r
- //these are OBSOLETE, use at own peril\r
- Bool_t GFC = kFALSE; // cumulants based on generating function\r
- Bool_t MCEP = kFALSE; // correlation with Monte Carlo reaction plane\r
- Bool_t FQD = kFALSE; // fit of the distribution of the Q vector (only integrated v)\r
- Bool_t LYZ1SUM = kFALSE; // Lee Yang Zeroes using sum generating function (integrated v)\r
- Bool_t LYZ1PROD = kFALSE; // Lee Yang Zeroes using product generating function (integrated v)\r
- Bool_t LYZ2SUM = kFALSE; // Lee Yang Zeroes using sum generating function (second pass differential v)\r
- Bool_t LYZ2PROD = kFALSE; // Lee Yang Zeroes using product generating function (second pass differential v)\r
- Bool_t LYZEP = kFALSE; // Lee Yang Zeroes Event plane using sum generating function (gives eventplane + weight)\r
- Bool_t MH = kFALSE; // azimuthal correlators in mixed harmonics \r
- Bool_t NL = kFALSE; // nested loops (for instance distribution of phi1-phi2 for all distinct pairs)\r
-\r
- Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP,MH,NL};\r
-\r
- // Boolean to use/not use weights for the Q vector\r
- Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)\r
-\r
- // SETTING THE CUTS\r
-\r
- //---------Data selection----------\r
- //kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet\r
- AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kTPCstandalone;\r
- AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kTPCstandalone;\r
-\r
- //---------Parameter mixing--------\r
- //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt\r
- AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;\r
- AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;\r
-\r
-\r
- const char* rptypestr = AliFlowTrackCuts::GetParamTypeName(rptype);\r
- const char* poitypestr = AliFlowTrackCuts::GetParamTypeName(poitype);\r
-\r
- //===========================================================================\r
- // EVENTS CUTS:\r
- AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("event cuts");\r
- cutsEvent->SetCentralityPercentileRange(centrMin,centrMax);\r
- cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);\r
-// cutsEvent->SetRefMultMethod(AliFlowEventCuts::kVZERO);\r
- //cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kSPD1tracklets);\r
- //cutsEvent->SetNContributorsRange(2);\r
- cutsEvent->SetPrimaryVertexZrange(-10.,10.);\r
- cutsEvent->SetQA(doQA);\r
- cutsEvent->SetCutTPCmultiplicityOutliers();\r
- \r
- // RP TRACK CUTS:\r
-// AliFlowTrackCuts* cutsRP2 = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();\r
- AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("TPConlyRP");\r
- cutsRP->SetParamType(rptype);\r
- cutsRP->SetParamMix(rpmix);\r
- cutsRP->SetPtRange(0.2,5.);\r
- cutsRP->SetEtaRange(etamin,etamax);\r
- cutsRP->SetMinNClustersTPC(70);\r
-// cutsRP->SetMinChi2PerClusterTPC(0.1);//\r
- // cutsRP->SetMaxChi2PerClusterTPC(4.0);//\r
- cutsRP->SetMaxDCAToVertexXY(3.0);\r
- cutsRP->SetMaxDCAToVertexZ(3.0);\r
- cutsRP->SetAcceptKinkDaughters(kFALSE);\r
- cutsRP->SetMinimalTPCdedx(10.);\r
- cutsRP->SetAODfilterBit(AODfilterBitRP); \r
-// cutsRP->SetAODfilterBit(768); \r
-cutsRP->SetQA(doQA);\r
-\r
- // POI TRACK CUTS:\r
- AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("TPConlyPOI");\r
- cutsPOI->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one\r
- cutsPOI->SetParamType(poitype);\r
- cutsPOI->SetParamMix(poimix);\r
- cutsPOI->SetPtRange(0.2,5.);//\r
- cutsPOI->SetEtaRange(etamin,etamax);\r
- //cutsPOI->SetRequireCharge(kTRUE);\r
- //cutsPOI->SetPID(PdgRP);\r
- cutsPOI->SetMinNClustersTPC(70);\r
- // cutsPOI->SetMinChi2PerClusterTPC(0.1); //\r
- // cutsPOI->SetMaxChi2PerClusterTPC(4.0); //\r
-// cutsPOI->SetRequireITSRefit(kTRUE);\r
-// cutsPOI->SetRequireTPCRefit(kTRUE);\r
-// cutsPOI->SetMinNClustersITS(2);\r
- //cutsPOI->SetMaxChi2PerClusterITS(1.e+09);\r
- cutsPOI->SetMaxDCAToVertexXY(3.0);\r
- cutsPOI->SetMaxDCAToVertexZ(3.0);\r
- //cutsPOI->SetDCAToVertex2D(kTRUE);\r
- //cutsPOI->SetMaxNsigmaToVertex(1.e+10);\r
- //cutsPOI->SetRequireSigmaToVertex(kFALSE);\r
- cutsPOI->SetAcceptKinkDaughters(kFALSE);\r
- if(isPID) cutsPOI->SetPID(particleType, sourcePID);//particleType, sourcePID\r
- if (charge!=0) cutsPOI->SetCharge(charge);\r
- //cutsPOI->SetAllowTOFmismatch(kFALSE);\r
- cutsPOI->SetRequireStrictTOFTPCagreement(kTRUE);\r
- //iexample: francesco's tunig TPC Bethe Bloch for data:\r
- //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);\r
- //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);\r
- cutsPOI->SetMinimalTPCdedx(10.);\r
- cutsPOI->SetAODfilterBit(AODfilterBitPOI);\r
- // cutsPOI->SetAODfilterBit(768); \r
- cutsPOI->SetQA(doQA);\r
- cutsPOI->SetPriors((centrMin+centrMax)*0.5); // set priors and PID as a function of the centrality\r
-\r
-// Int_t sourcePID = 2;\r
-// Int_t particleType = 2; //2 or 3 or 4 for kPion, kKaon and kProton \r
- TString outputSlotName("");\r
- outputSlotName+=uniqueStr;\r
- outputSlotName+=Form("QC(%i) ",harmonic);\r
- outputSlotName+=cutsRP->GetName();\r
- outputSlotName+=" ";\r
- outputSlotName+=cutsPOI->GetName();\r
- outputSlotName+=Form(" %.0f-",centrMin);\r
- outputSlotName+=Form("%.0f ",centrMax);\r
- if(isPID){\r
- outputSlotName+=AliFlowTrackCuts::PIDsourceName(sourcePID);//sourcePID\r
- outputSlotName+=" ";\r
- outputSlotName+=AliPID::ParticleName(particleType);//particleType\r
- }\r
- else{\r
- outputSlotName+="AllCharged";\r
- }\r
- if (charge<0) outputSlotName+="-";\r
- if (charge>0) outputSlotName+="+";\r
-\r
- TString fileName(fileNameBase);\r
- fileName.Append(".root");\r
-\r
- Bool_t useWeights = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];\r
- if (useWeights) cout<<"Weights are used"<<endl;\r
- else cout<<"Weights are not used"<<endl;\r
- \r
- // Get the pointer to the existing analysis manager via the static access method.\r
- //==============================================================================\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTaskFlowEvent", "No analysis manager to connect to.");\r
- return NULL;\r
- }\r
- \r
- // Check the analysis type using the event handlers connected to the analysis\r
- // manager. The availability of MC handler can also be checked here.\r
- //==============================================================================\r
- if (!mgr->GetInputEventHandler()) {\r
- ::Error("AddTaskFlowEvent", "This task requires an input event handler");\r
- return NULL;\r
- } \r
-\r
- // Open external input files\r
- //===========================================================================\r
- //weights: \r
- TFile *weightsFile = NULL;\r
- TList *weightsList = NULL;\r
-\r
- if(useWeights) {\r
- //open the file with the weights:\r
- weightsFile = TFile::Open("weights.root","READ");\r
- if(weightsFile) {\r
- //access the list which holds the histos with weigths:\r
- weightsList = (TList*)weightsFile->Get("weights");\r
- }\r
- else {\r
- cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl;\r
- break;\r
- } \r
- }\r
- \r
- //LYZ2\r
- if (LYZ2SUM || LYZ2PROD) {\r
- //read the outputfile of the first run\r
- TString outputFileName = "AnalysisResults1.root";\r
- TString pwd(gSystem->pwd());\r
- pwd+="/";\r
- pwd+=outputFileName.Data();\r
- TFile *outputFile = NULL;\r
- if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {\r
- cout<<"WARNING: You do not have an output file:"<<endl;\r
- cout<<" "<<pwd.Data()<<endl;\r
- exit(0);\r
- } else { outputFile = TFile::Open(pwd.Data(),"READ");}\r
- \r
- if (LYZ2SUM){ \r
- // read the output directory from LYZ1SUM \r
- TString inputFileNameLYZ2SUM = "outputLYZ1SUManalysis" ;\r
- inputFileNameLYZ2SUM += rptypestr;\r
- cout<<"The input directory is "<<inputFileNameLYZ2SUM.Data()<<endl;\r
- TFile* fInputFileLYZ2SUM = (TFile*)outputFile->FindObjectAny(inputFileNameLYZ2SUM.Data());\r
- if(!fInputFileLYZ2SUM || fInputFileLYZ2SUM->IsZombie()) { \r
- cerr << " ERROR: To run LYZ2SUM you need the output file from LYZ1SUM. This file is not there! Please run LYZ1SUM first." << endl ; \r
- break;\r
- }\r
- else {\r
- TList* fInputListLYZ2SUM = (TList*)fInputFileLYZ2SUM->Get("LYZ1SUM");\r
- if (!fInputListLYZ2SUM) {cout<<"list is NULL pointer!"<<endl;}\r
- }\r
- cout<<"LYZ2SUM input file/list read..."<<endl;\r
- }\r
-\r
- if (LYZ2PROD){ \r
- // read the output directory from LYZ1PROD \r
- TString inputFileNameLYZ2PROD = "outputLYZ1PRODanalysis" ;\r
- inputFileNameLYZ2PROD += rptypestr;\r
- cout<<"The input directory is "<<inputFileNameLYZ2PROD.Data()<<endl;\r
- TFile* fInputFileLYZ2PROD = (TFile*)outputFile->FindObjectAny(inputFileNameLYZ2PROD.Data());\r
- if(!fInputFileLYZ2PROD || fInputFileLYZ2PROD->IsZombie()) { \r
- cerr << " ERROR: To run LYZ2PROD you need the output file from LYZ1PROD. This file is not there! Please run LYZ1PROD first." << endl ; \r
- break;\r
- }\r
- else {\r
- TList* fInputListLYZ2PROD = (TList*)fInputFileLYZ2PROD->Get("LYZ1PROD");\r
- if (!fInputListLYZ2PROD) {cout<<"list is NULL pointer!"<<endl;}\r
- }\r
- cout<<"LYZ2PROD input file/list read..."<<endl;\r
- }\r
- }\r
-\r
- if (LYZEP) {\r
- //read the outputfile of the second run\r
- TString outputFileName = "AnalysisResults2.root";\r
- TString pwd(gSystem->pwd());\r
- pwd+="/";\r
- pwd+=outputFileName.Data();\r
- TFile *outputFile = NULL;\r
- if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {\r
- cout<<"WARNING: You do not have an output file:"<<endl;\r
- cout<<" "<<pwd.Data()<<endl;\r
- exit(0);\r
- } else {\r
- outputFile = TFile::Open(pwd.Data(),"READ");\r
- }\r
- \r
- // read the output file from LYZ2SUM\r
- TString inputFileNameLYZEP = "outputLYZ2SUManalysis" ;\r
- inputFileNameLYZEP += rptypestr;\r
- cout<<"The input file is "<<inputFileNameLYZEP.Data()<<endl;\r
- TFile* fInputFileLYZEP = (TFile*)outputFile->FindObjectAny(inputFileNameLYZEP.Data());\r
- if(!fInputFileLYZEP || fInputFileLYZEP->IsZombie()) { \r
- cerr << " ERROR: To run LYZEP you need the output file from LYZ2SUM. This file is not there! Please run LYZ2SUM first." << endl ; \r
- break;\r
- }\r
- else {\r
- TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("LYZ2SUM");\r
- if (!fInputListLYZEP) {cout<<"list is NULL pointer!"<<endl;}\r
- }\r
- cout<<"LYZEP input file/list read..."<<endl;\r
- }\r
- \r
- \r
- // Create the FMD task and add it to the manager\r
- //===========================================================================\r
- if (rptypestr == "FMD") {\r
- AliFMDAnalysisTaskSE *taskfmd = NULL;\r
- if (rptypestr == "FMD") {\r
- taskfmd = new AliFMDAnalysisTaskSE("TaskFMD");\r
- taskfmd->SelectCollisionCandidates(centralitysel);\r
- mgr->AddTask(taskfmd);\r
- \r
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();\r
- pars->Init();\r
- pars->SetProcessPrimary(kTRUE); //for MC only\r
- pars->SetProcessHits(kFALSE);\r
- \r
- //pars->SetRealData(kTRUE); //for real data\r
- //pars->SetProcessPrimary(kFALSE); //for real data\r
- }\r
- }\r
- \r
- // Create the flow event task, add it to the manager.\r
- //===========================================================================\r
- AliAnalysisTaskFlowEvent *taskFE = NULL;\r
-\r
- if(useAfterBurner)\r
- { \r
- taskFE = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent %s",outputSlotName.Data()),"",doQA,1);\r
- taskFE->SetFlow(v1,v2,v3,v4); \r
- taskFE->SetNonFlowNumberOfTrackClones(numberOfTrackClones);\r
- taskFE->SetAfterburnerOn();\r
- taskFE->SelectCollisionCandidates(centralitysel);\r
- }\r
- else {taskFE = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent %s",outputSlotName.Data()),"",doQA); \r
- taskFE->SelectCollisionCandidates(centralitysel);}\r
- if (ExcludeRegion) {\r
- taskFE->DefineDeadZone(excludeEtaMin, excludeEtaMax, excludePhiMin, excludePhiMax); \r
- }\r
- taskFE->SetSubeventEtaRange(minA, maxA, minB, maxB);\r
- if (UsePhysicsSelection) {\r
- taskFE->SelectCollisionCandidates(AliVEvent::kMB);\r
- cout<<"Using Physics Selection"<<endl;\r
- }\r
- mgr->AddTask(taskFE);\r
- \r
- // Pass cuts for RPs and POIs to the task:\r
- taskFE->SetCutsEvent(cutsEvent);\r
- taskFE->SetCutsRP(cutsRP);\r
- taskFE->SetCutsPOI(cutsPOI);\r
- if (cutsRP->GetParamType()==AliFlowTrackCuts::kVZERO)\r
- { \r
- //TODO: since this is set in a static object all analyses in an analysis train\r
- //will be affected.\r
- taskFE->SetHistWeightvsPhiMin(0.);\r
- taskFE->SetHistWeightvsPhiMax(200.);\r
- }\r
-\r
- // Create the analysis tasks, add them to the manager.\r
- //===========================================================================\r
- if (SP){\r
- AliAnalysisTaskScalarProduct *taskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct %s",outputSlotName.Data()),WEIGHTS[0]);\r
- taskSP->SelectCollisionCandidates(centralitysel);\r
- taskSP->SetRelDiffMsub(1.0);\r
- taskSP->SetApplyCorrectionForNUA(kTRUE);\r
- mgr->AddTask(taskSP);\r
- }\r
- if (LYZ1SUM){\r
- AliAnalysisTaskLeeYangZeros *taskLYZ1SUM = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosSUM %s",outputSlotName.Data()),kTRUE);\r
- taskLYZ1SUM->SelectCollisionCandidates(centralitysel);\r
- taskLYZ1SUM->SetFirstRunLYZ(kTRUE);\r
- taskLYZ1SUM->SetUseSumLYZ(kTRUE);\r
- mgr->AddTask(taskLYZ1SUM);\r
- }\r
- if (LYZ1PROD){\r
- AliAnalysisTaskLeeYangZeros *taskLYZ1PROD = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosPROD %s",outputSlotName.Data()),kTRUE);\r
- taskLYZ1PROD->SelectCollisionCandidates(centralitysel);\r
- taskLYZ1PROD->SetFirstRunLYZ(kTRUE);\r
- taskLYZ1PROD->SetUseSumLYZ(kFALSE);\r
- mgr->AddTask(taskLYZ1PROD);\r
- }\r
- if (LYZ2SUM){\r
- AliAnalysisTaskLeeYangZeros *taskLYZ2SUM = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosSUM %s",outputSlotName.Data()),kFALSE);\r
- taskLYZ2SUM->SelectCollisionCandidates(centralitysel);\r
- taskLYZ2SUM->SetFirstRunLYZ(kFALSE);\r
- taskLYZ2SUM->SetUseSumLYZ(kTRUE);\r
- mgr->AddTask(taskLYZ2SUM);\r
- }\r
- if (LYZ2PROD){\r
- AliAnalysisTaskLeeYangZeros *taskLYZ2PROD = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosPROD %s",outputSlotName.Data()),kFALSE);\r
- taskLYZ2PROD->SelectCollisionCandidates(centralitysel);\r
- taskLYZ2PROD->SetFirstRunLYZ(kFALSE);\r
- taskLYZ2PROD->SetUseSumLYZ(kFALSE);\r
- mgr->AddTask(taskLYZ2PROD);\r
- }\r
- if (LYZEP){\r
- AliAnalysisTaskLYZEventPlane *taskLYZEP = new AliAnalysisTaskLYZEventPlane(Form("TaskLYZEventPlane %s",outputSlotName.Data()));\r
- taskLYZEP->SelectCollisionCandidates(centralitysel);\r
- mgr->AddTask(taskLYZEP);\r
- }\r
- if (GFC){\r
- AliAnalysisTaskCumulants *taskGFC = new AliAnalysisTaskCumulants(Form("TaskCumulants %s",outputSlotName.Data()),useWeights);\r
- taskGFC->SelectCollisionCandidates(centralitysel);\r
- taskGFC->SetUsePhiWeights(WEIGHTS[0]); \r
- taskGFC->SetUsePtWeights(WEIGHTS[1]);\r
- taskGFC->SetUseEtaWeights(WEIGHTS[2]); \r
- mgr->AddTask(taskGFC);\r
- }\r
- if (QC){\r
- AliAnalysisTaskQCumulants *taskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants %s",outputSlotName.Data()),useWeights);\r
- taskQC->SelectCollisionCandidates(centralitysel);\r
- taskQC->SetUsePhiWeights(WEIGHTS[0]); \r
- taskQC->SetUsePtWeights(WEIGHTS[1]);\r
- taskQC->SetUseEtaWeights(WEIGHTS[2]); \r
- taskQC->SetCalculateCumulantsVsM(kFALSE);\r
- taskQC->SetnBinsMult(10000);\r
- taskQC->SetMinMult(0.);\r
- taskQC->SetMaxMult(10000.);\r
- taskQC->SetHarmonic(harmonic);\r
- taskQC->SetApplyCorrectionForNUA(kFALSE);\r
- taskQC->SetFillMultipleControlHistograms(kFALSE); \r
- mgr->AddTask(taskQC);\r
- }\r
- if (FQD){\r
- AliAnalysisTaskFittingQDistribution *taskFQD = new AliAnalysisTaskFittingQDistribution(Form("TaskFittingQDistribution %s",outputSlotName.Data()),kFALSE);\r
- taskFQD->SelectCollisionCandidates(centralitysel);\r
- taskFQD->SetUsePhiWeights(WEIGHTS[0]); \r
- taskFQD->SetqMin(0.);\r
- taskFQD->SetqMax(1000.);\r
- taskFQD->SetqNbins(10000);\r
- mgr->AddTask(taskFQD);\r
- }\r
- if (MCEP){\r
- AliAnalysisTaskMCEventPlane *taskMCEP = new AliAnalysisTaskMCEventPlane(Form("TaskMCEventPlane %s",outputSlotName.Data()));\r
- taskMCEP->SelectCollisionCandidates(centralitysel);\r
- mgr->AddTask(taskMCEP);\r
- }\r
- if (MH){\r
- AliAnalysisTaskMixedHarmonics *taskMH = new AliAnalysisTaskMixedHarmonics(Form("TaskMixedHarmonics %s",outputSlotName.Data()),useWeights);\r
- taskMH->SelectCollisionCandidates(centralitysel);\r
- taskMH->SetHarmonic(1); // n in cos[n(phi1+phi2-2phi3)] and cos[n(psi1+psi2-2phi3)]\r
- taskMH->SetNoOfMultipicityBins(10000);\r
- taskMH->SetMultipicityBinWidth(1.);\r
- taskMH->SetMinMultiplicity(1.);\r
- taskMH->SetCorrectForDetectorEffects(kTRUE);\r
- taskMH->SetEvaluateDifferential3pCorrelator(kFALSE); // evaluate <<cos[n(psi1+psi2-2phi3)]>> (Remark: two nested loops) \r
- taskMH->SetOppositeChargesPOI(kFALSE); // POIs psi1 and psi2 in cos[n(psi1+psi2-2phi3)] will have opposite charges \r
- mgr->AddTask(taskMH);\r
- } \r
- if (NL){\r
- AliAnalysisTaskNestedLoops *taskNL = new AliAnalysisTaskNestedLoops(Form("TaskNestedLoops %s",outputSlotName.Data()),useWeights);\r
- taskNL->SelectCollisionCandidates(centralitysel);\r
- taskNL->SetHarmonic(1); // n in cos[n(phi1+phi2-2phi3)] and cos[n(psi1+psi2-2phi3)]\r
- taskNL->SetEvaluateNestedLoopsForRAD(kTRUE); // RAD = Relative Angle Distribution\r
- taskNL->SetEvaluateNestedLoopsForMH(kTRUE); // evalaute <<cos[n(phi1+phi2-2phi3)]>> (Remark: three nested loops) \r
- taskNL->SetEvaluateDifferential3pCorrelator(kFALSE); // evaluate <<cos[n(psi1+psi2-2phi3)]>> (Remark: three nested loops) \r
- taskNL->SetOppositeChargesPOI(kFALSE); // POIs psi1 and psi2 in cos[n(psi1+psi2-2phi3)] will have opposite charges \r
- mgr->AddTask(taskNL);\r
- }\r
-\r
- // Create the output container for the data produced by the task\r
- // Connect to the input and output containers\r
- //===========================================================================\r
- AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();\r
- \r
- if (rptypestr == "FMD") {\r
- AliAnalysisDataContainer *coutputFMD = \r
- mgr->CreateContainer(Form("BackgroundCorrected %s",outputSlotName.Data()), TList::Class(), AliAnalysisManager::kExchangeContainer);\r
- //input and output taskFMD \r
- mgr->ConnectInput(taskfmd, 0, cinput1);\r
- mgr->ConnectOutput(taskfmd, 1, coutputFMD);\r
- //input into taskFE\r
- mgr->ConnectInput(taskFE,1,coutputFMD);\r
- }\r
- \r
- AliAnalysisDataContainer *coutputFE = \r
- mgr->CreateContainer(Form("FlowEventSimple %s",outputSlotName.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);\r
- mgr->ConnectInput(taskFE,0,cinput1); \r
- mgr->ConnectOutput(taskFE,1,coutputFE);\r
- \r
- if (taskFE->GetQAOn())\r
- {\r
- TString outputQA = fileName;\r
- outputQA += ":QA";\r
- AliAnalysisDataContainer* coutputFEQA = \r
- mgr->CreateContainer(Form("QA %s",outputSlotName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputQA);\r
- mgr->ConnectOutput(taskFE,2,coutputFEQA);\r
- }\r
-\r
- // Create the output containers for the data produced by the analysis tasks\r
- // Connect to the input and output containers\r
- //===========================================================================\r
- if (useWeights) { \r
- AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer(Form("Weights %s",outputSlotName.Data()),\r
- TList::Class(),AliAnalysisManager::kInputContainer); \r
- }\r
-\r
- if(SP) {\r
- TString outputSP = fileName;\r
- outputSP += ":outputSPanalysis";\r
- outputSP+= rptypestr;\r
- AliAnalysisDataContainer *coutputSP = mgr->CreateContainer(Form("SP %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputSP); \r
- mgr->ConnectInput(taskSP,0,coutputFE); \r
- mgr->ConnectOutput(taskSP,1,coutputSP); \r
- if (WEIGHTS[0]) {\r
- mgr->ConnectInput(taskSP,1,cinputWeights);\r
- cinputWeights->SetData(weightsList);\r
- }\r
- }\r
- if(LYZ1SUM) {\r
- TString outputLYZ1SUM = fileName;\r
- outputLYZ1SUM += ":outputLYZ1SUManalysis";\r
- outputLYZ1SUM+= rptypestr;\r
- AliAnalysisDataContainer *coutputLYZ1SUM = mgr->CreateContainer(Form("LYZ1SUM %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1SUM); \r
- mgr->ConnectInput(taskLYZ1SUM,0,coutputFE);\r
- mgr->ConnectOutput(taskLYZ1SUM,1,coutputLYZ1SUM);\r
- }\r
- if(LYZ1PROD) {\r
- TString outputLYZ1PROD = fileName;\r
- outputLYZ1PROD += ":outputLYZ1PRODanalysis";\r
- outputLYZ1PROD+= rptypestr;\r
- AliAnalysisDataContainer *coutputLYZ1PROD = mgr->CreateContainer(Form("LYZ1PROD %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1PROD); \r
- mgr->ConnectInput(taskLYZ1PROD,0,coutputFE); \r
- mgr->ConnectOutput(taskLYZ1PROD,1,coutputLYZ1PROD);\r
- }\r
- if(LYZ2SUM) {\r
- AliAnalysisDataContainer *cinputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUMin %s",outputSlotName.Data()),\r
- TList::Class(),AliAnalysisManager::kInputContainer);\r
- TString outputLYZ2SUM = fileName;\r
- outputLYZ2SUM += ":outputLYZ2SUManalysis";\r
- outputLYZ2SUM+= rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUM %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2SUM); \r
- mgr->ConnectInput(taskLYZ2SUM,0,coutputFE); \r
- mgr->ConnectInput(taskLYZ2SUM,1,cinputLYZ2SUM);\r
- mgr->ConnectOutput(taskLYZ2SUM,1,coutputLYZ2SUM); \r
- cinputLYZ2SUM->SetData(fInputListLYZ2SUM);\r
- }\r
- if(LYZ2PROD) {\r
- AliAnalysisDataContainer *cinputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PRODin %s",outputSlotName.Data()),\r
- TList::Class(),AliAnalysisManager::kInputContainer);\r
- TString outputLYZ2PROD = fileName;\r
- outputLYZ2PROD += ":outputLYZ2PRODanalysis";\r
- outputLYZ2PROD+= rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PROD %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2PROD); \r
- mgr->ConnectInput(taskLYZ2PROD,0,coutputFE); \r
- mgr->ConnectInput(taskLYZ2PROD,1,cinputLYZ2PROD);\r
- mgr->ConnectOutput(taskLYZ2PROD,1,coutputLYZ2PROD); \r
- cinputLYZ2PROD->SetData(fInputListLYZ2PROD);\r
- }\r
- if(LYZEP) {\r
- AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer(Form("LYZEPin %s",outputSlotName.Data()),\r
- TList::Class(),AliAnalysisManager::kInputContainer);\r
- TString outputLYZEP = fileName;\r
- outputLYZEP += ":outputLYZEPanalysis";\r
- outputLYZEP+= rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer(Form("LYZEP %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZEP); \r
- mgr->ConnectInput(taskLYZEP,0,coutputFE); \r
- mgr->ConnectInput(taskLYZEP,1,cinputLYZEP);\r
- mgr->ConnectOutput(taskLYZEP,1,coutputLYZEP); \r
- cinputLYZEP->SetData(fInputListLYZEP);\r
- }\r
- if(GFC) {\r
- TString outputGFC = fileName;\r
- outputGFC += ":outputGFCanalysis";\r
- outputGFC+= rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer(Form("GFC %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputGFC); \r
- mgr->ConnectInput(taskGFC,0,coutputFE); \r
- mgr->ConnectOutput(taskGFC,1,coutputGFC);\r
- if (useWeights) {\r
- mgr->ConnectInput(taskGFC,1,cinputWeights);\r
- cinputWeights->SetData(weightsList);\r
- } \r
- }\r
- if(QC) {\r
- TString outputQC = fileName;\r
- outputQC += ":outputQCanalysis";\r
- outputQC+= rptypestr;\r
-\r
- AliAnalysisDataContainer *coutputQC = mgr->CreateContainer(Form("QC %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputQC); \r
- mgr->ConnectInput(taskQC,0,coutputFE); \r
- mgr->ConnectOutput(taskQC,1,coutputQC);\r
- if (useWeights) {\r
- mgr->ConnectInput(taskQC,1,cinputWeights);\r
- cinputWeights->SetData(weightsList);\r
- }\r
- }\r
- if(FQD) {\r
- TString outputFQD = fileName;\r
- outputFQD += ":outputFQDanalysis";\r
- outputFQD+= rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer(Form("FQD %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputFQD); \r
- mgr->ConnectInput(taskFQD,0,coutputFE); \r
- mgr->ConnectOutput(taskFQD,1,coutputFQD);\r
- if(useWeights) {\r
- mgr->ConnectInput(taskFQD,1,cinputWeights);\r
- cinputWeights->SetData(weightsList);\r
- } \r
- }\r
- if(MCEP) {\r
- TString outputMCEP = fileName;\r
- outputMCEP += ":outputMCEPanalysis";\r
- outputMCEP+= rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer(Form("MCEP %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputMCEP); \r
- mgr->ConnectInput(taskMCEP,0,coutputFE);\r
- mgr->ConnectOutput(taskMCEP,1,coutputMCEP); \r
- }\r
- if(MH) {\r
- TString outputMH = fileName;\r
- outputMH += ":outputMHanalysis";\r
- outputMH += rptypestr;\r
- \r
- AliAnalysisDataContainer *coutputMH = mgr->CreateContainer(Form("MH %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputMH); \r
- mgr->ConnectInput(taskMH,0,coutputFE); \r
- mgr->ConnectOutput(taskMH,1,coutputMH); \r
- //if (useWeights) {\r
- // mgr->ConnectInput(taskMH,1,cinputWeights);\r
- // cinputWeights->SetData(weightsList);\r
- //} \r
- }\r
- if(NL) {\r
- TString outputNL = fileName;\r
- outputNL += ":outputNLanalysis";\r
- outputNL += rptypestr;\r
-\r
- AliAnalysisDataContainer *coutputNL = mgr->CreateContainer(Form("NL %s",outputSlotName.Data()), \r
- TList::Class(),AliAnalysisManager::kOutputContainer,outputNL); \r
- mgr->ConnectInput(taskNL,0,coutputFE);\r
- mgr->ConnectOutput(taskNL,1,coutputNL);\r
- //if (useWeights) {\r
- // mgr->ConnectInput(taskNL,1,cinputWeights);\r
- // cinputWeights->SetData(weightsList);\r
- //} \r
- }\r
-\r
- ///////////////////////////////////////////////////////////////////////////////////////////\r
- if (runQAtask)\r
- {\r
- AliAnalysisTaskQAflow* taskQAflow = new AliAnalysisTaskQAflow(Form("TaskQAflow %s",outputSlotName.Data()));\r
- taskQAflow->SelectCollisionCandidates(centralitysel);\r
- taskQAflow->SetEventCuts(cutsEvent);\r
- taskQAflow->SetTrackCuts(cutsRP);\r
- taskQAflow->SetFillNTuple(FillQAntuple);\r
- taskQAflow->SetDoCorrelations(DoQAcorrelations);\r
- mgr->AddTask(taskQAflow);\r
- \r
- Printf("outputSlotName %s",outputSlotName.Data());\r
- TString taskQAoutputFileName(fileNameBase);\r
- taskQAoutputFileName.Append("_QA.root");\r
- AliAnalysisDataContainer* coutputQAtask = mgr->CreateContainer(Form("flowQA %s",outputSlotName.Data()),\r
- TObjArray::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- taskQAoutputFileName);\r
- AliAnalysisDataContainer* coutputQAtaskTree = mgr->CreateContainer(Form("flowQAntuple %s",outputSlotName.Data()),\r
- TNtuple::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- taskQAoutputFileName);\r
- mgr->ConnectInput(taskQAflow,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectInput(taskQAflow,1,coutputFE);\r
- mgr->ConnectOutput(taskQAflow,1,coutputQAtask);\r
- if (FillQAntuple) mgr->ConnectOutput(taskQAflow,2,coutputQAtaskTree);\r
- }\r
-}\r
-\r
-\r
-\r
-\r
-\r
+/////////////////////////////////////////////////////////////////////////////////////////////
+//
+// AddTask* macro for flow analysis
+// Creates a Flow Event task and adds it to the analysis manager.
+// Sets the cuts using the correction framework (CORRFW) classes.
+// Also creates Flow Analysis tasks and connects them to the output of the flow event task.
+//
+/////////////////////////////////////////////////////////////////////////////////////////////
+
+void AddTaskFlowHigherOrdersPID(Int_t centralitysel,
+ Float_t centrMin=0.,
+ Float_t centrMax=100.,
+ TString fileNameBase="output",
+ Bool_t isPID = kTRUE,
+ Int_t AODfilterBitRP = 768,
+ Int_t AODfilterBitPOI = 768,
+ AliPID::EParticleType particleType=AliPID::kPion,
+ AliFlowTrackCuts::PIDsource sourcePID = AliFlowTrackCuts::kTOFbayesian,
+ Int_t charge=0,
+ Int_t harmonic=3,
+ Bool_t doQA=kFALSE,
+ Float_t etamin=-0.8,
+ Float_t etamax=0.8,
+ TString uniqueStr="" )
+{
+ // Define the range for eta subevents (for SP method)
+ Double_t minA = -0.9;//
+ Double_t maxA = -0.5;//
+ Double_t minB = 0.5;//
+ Double_t maxB = 0.9;//
+
+ // AFTERBURNER
+ Bool_t useAfterBurner=kFALSE;
+ Double_t v1=0.0;
+ Double_t v2=0.0;
+ Double_t v3=0.0;
+ Double_t v4=0.0;
+ Int_t numberOfTrackClones=0; //non-flow
+
+ // Define a range of the detector to exclude
+ Bool_t ExcludeRegion = kFALSE;
+ Double_t excludeEtaMin = -0.;
+ Double_t excludeEtaMax = 0.;
+ Double_t excludePhiMin = 0.;
+ Double_t excludePhiMax = 0.;
+
+ // use physics selection class
+ Bool_t UsePhysicsSelection = kTRUE;
+
+ // QA
+ Bool_t runQAtask=kFALSE;
+ Bool_t FillQAntuple=kFALSE;
+ Bool_t DoQAcorrelations=kFALSE;
+
+ // RUN SETTINGS
+ // Flow analysis method can be:(set to kTRUE or kFALSE)
+ Bool_t SP = kTRUE; // scalar product method (similar to eventplane method)
+ Bool_t QC = kTRUE; // cumulants using Q vectors
+
+ //these are OBSOLETE, use at own peril
+ Bool_t GFC = kFALSE; // cumulants based on generating function
+ Bool_t MCEP = kFALSE; // correlation with Monte Carlo reaction plane
+ Bool_t FQD = kFALSE; // fit of the distribution of the Q vector (only integrated v)
+ Bool_t LYZ1SUM = kFALSE; // Lee Yang Zeroes using sum generating function (integrated v)
+ Bool_t LYZ1PROD = kFALSE; // Lee Yang Zeroes using product generating function (integrated v)
+ Bool_t LYZ2SUM = kFALSE; // Lee Yang Zeroes using sum generating function (second pass differential v)
+ Bool_t LYZ2PROD = kFALSE; // Lee Yang Zeroes using product generating function (second pass differential v)
+ Bool_t LYZEP = kFALSE; // Lee Yang Zeroes Event plane using sum generating function (gives eventplane + weight)
+ Bool_t MH = kFALSE; // azimuthal correlators in mixed harmonics
+ Bool_t NL = kFALSE; // nested loops (for instance distribution of phi1-phi2 for all distinct pairs)
+
+ Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP,MH,NL};
+
+ // Boolean to use/not use weights for the Q vector
+ Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)
+
+ // SETTING THE CUTS
+
+ //---------Data selection----------
+ //kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet
+ AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kTPCstandalone;
+ AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kTPCstandalone;
+
+ //---------Parameter mixing--------
+ //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt
+ AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;
+ AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;
+
+
+ const char* rptypestr = AliFlowTrackCuts::GetParamTypeName(rptype);
+ const char* poitypestr = AliFlowTrackCuts::GetParamTypeName(poitype);
+
+ //===========================================================================
+ // EVENTS CUTS:
+ AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("event cuts");
+ cutsEvent->SetCentralityPercentileRange(centrMin,centrMax);
+ cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);
+// cutsEvent->SetRefMultMethod(AliFlowEventCuts::kVZERO);
+ //cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kSPD1tracklets);
+ //cutsEvent->SetNContributorsRange(2);
+ cutsEvent->SetPrimaryVertexZrange(-10.,10.);
+ cutsEvent->SetQA(doQA);
+ cutsEvent->SetCutTPCmultiplicityOutliers();
+
+ // RP TRACK CUTS:
+// AliFlowTrackCuts* cutsRP2 = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();
+ AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("TPConlyRP");
+ cutsRP->SetParamType(rptype);
+ cutsRP->SetParamMix(rpmix);
+ cutsRP->SetPtRange(0.2,5.);
+ cutsRP->SetEtaRange(etamin,etamax);
+ cutsRP->SetMinNClustersTPC(70);
+// cutsRP->SetMinChi2PerClusterTPC(0.1);//
+ // cutsRP->SetMaxChi2PerClusterTPC(4.0);//
+ cutsRP->SetMaxDCAToVertexXY(3.0);
+ cutsRP->SetMaxDCAToVertexZ(3.0);
+ cutsRP->SetAcceptKinkDaughters(kFALSE);
+ cutsRP->SetMinimalTPCdedx(10.);
+ cutsRP->SetAODfilterBit(AODfilterBitRP);
+// cutsRP->SetAODfilterBit(768);
+cutsRP->SetQA(doQA);
+
+ // POI TRACK CUTS:
+ AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("TPConlyPOI");
+ cutsPOI->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
+ cutsPOI->SetParamType(poitype);
+ cutsPOI->SetParamMix(poimix);
+ cutsPOI->SetPtRange(0.2,5.);//
+ cutsPOI->SetEtaRange(etamin,etamax);
+ //cutsPOI->SetRequireCharge(kTRUE);
+ //cutsPOI->SetPID(PdgRP);
+ cutsPOI->SetMinNClustersTPC(70);
+ // cutsPOI->SetMinChi2PerClusterTPC(0.1); //
+ // cutsPOI->SetMaxChi2PerClusterTPC(4.0); //
+// cutsPOI->SetRequireITSRefit(kTRUE);
+// cutsPOI->SetRequireTPCRefit(kTRUE);
+// cutsPOI->SetMinNClustersITS(2);
+ //cutsPOI->SetMaxChi2PerClusterITS(1.e+09);
+ cutsPOI->SetMaxDCAToVertexXY(3.0);
+ cutsPOI->SetMaxDCAToVertexZ(3.0);
+ //cutsPOI->SetDCAToVertex2D(kTRUE);
+ //cutsPOI->SetMaxNsigmaToVertex(1.e+10);
+ //cutsPOI->SetRequireSigmaToVertex(kFALSE);
+ cutsPOI->SetAcceptKinkDaughters(kFALSE);
+ if(isPID) cutsPOI->SetPID(particleType, sourcePID);//particleType, sourcePID
+ if (charge!=0) cutsPOI->SetCharge(charge);
+ //cutsPOI->SetAllowTOFmismatch(kFALSE);
+ cutsPOI->SetRequireStrictTOFTPCagreement(kTRUE);
+ //iexample: francesco's tunig TPC Bethe Bloch for data:
+ //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);
+ //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);
+ cutsPOI->SetMinimalTPCdedx(10.);
+ cutsPOI->SetAODfilterBit(AODfilterBitPOI);
+ // cutsPOI->SetAODfilterBit(768);
+ cutsPOI->SetQA(doQA);
+ cutsPOI->SetPriors((centrMin+centrMax)*0.5); // set priors and PID as a function of the centrality
+
+// Int_t sourcePID = 2;
+// Int_t particleType = 2; //2 or 3 or 4 for kPion, kKaon and kProton
+ TString outputSlotName("");
+ outputSlotName+=uniqueStr;
+ outputSlotName+=Form("QC(%i) ",harmonic);
+ outputSlotName+=cutsRP->GetName();
+ outputSlotName+=" ";
+ outputSlotName+=cutsPOI->GetName();
+ outputSlotName+=Form(" %.0f-",centrMin);
+ outputSlotName+=Form("%.0f ",centrMax);
+ if(isPID){
+ outputSlotName+=AliFlowTrackCuts::PIDsourceName(sourcePID);//sourcePID
+ outputSlotName+=" ";
+ outputSlotName+=AliPID::ParticleName(particleType);//particleType
+ }
+ else{
+ outputSlotName+="AllCharged";
+ }
+ if (charge<0) outputSlotName+="-";
+ if (charge>0) outputSlotName+="+";
+
+ TString fileName(fileNameBase);
+ fileName.Append(".root");
+
+ Bool_t useWeights = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];
+ if (useWeights) cout<<"Weights are used"<<endl;
+ else cout<<"Weights are not used"<<endl;
+
+ // Get the pointer to the existing analysis manager via the static access method.
+ //==============================================================================
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTaskFlowEvent", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis
+ // manager. The availability of MC handler can also be checked here.
+ //==============================================================================
+ if (!mgr->GetInputEventHandler()) {
+ ::Error("AddTaskFlowEvent", "This task requires an input event handler");
+ return NULL;
+ }
+
+ // Open external input files
+ //===========================================================================
+ //weights:
+ TFile *weightsFile = NULL;
+ TList *weightsList = NULL;
+
+ if(useWeights) {
+ //open the file with the weights:
+ weightsFile = TFile::Open("weights.root","READ");
+ if(weightsFile) {
+ //access the list which holds the histos with weigths:
+ weightsList = (TList*)weightsFile->Get("weights");
+ }
+ else {
+ cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl;
+ break;
+ }
+ }
+
+ //LYZ2
+ if (LYZ2SUM || LYZ2PROD) {
+ //read the outputfile of the first run
+ TString outputFileName = "AnalysisResults1.root";
+ TString pwd(gSystem->pwd());
+ pwd+="/";
+ pwd+=outputFileName.Data();
+ TFile *outputFile = NULL;
+ if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {
+ cout<<"WARNING: You do not have an output file:"<<endl;
+ cout<<" "<<pwd.Data()<<endl;
+ exit(0);
+ } else { outputFile = TFile::Open(pwd.Data(),"READ");}
+
+ if (LYZ2SUM){
+ // read the output directory from LYZ1SUM
+ TString inputFileNameLYZ2SUM = "outputLYZ1SUManalysis" ;
+ inputFileNameLYZ2SUM += rptypestr;
+ cout<<"The input directory is "<<inputFileNameLYZ2SUM.Data()<<endl;
+ TFile* fInputFileLYZ2SUM = (TFile*)outputFile->FindObjectAny(inputFileNameLYZ2SUM.Data());
+ if(!fInputFileLYZ2SUM || fInputFileLYZ2SUM->IsZombie()) {
+ cerr << " ERROR: To run LYZ2SUM you need the output file from LYZ1SUM. This file is not there! Please run LYZ1SUM first." << endl ;
+ break;
+ }
+ else {
+ TList* fInputListLYZ2SUM = (TList*)fInputFileLYZ2SUM->Get("LYZ1SUM");
+ if (!fInputListLYZ2SUM) {cout<<"list is NULL pointer!"<<endl;}
+ }
+ cout<<"LYZ2SUM input file/list read..."<<endl;
+ }
+
+ if (LYZ2PROD){
+ // read the output directory from LYZ1PROD
+ TString inputFileNameLYZ2PROD = "outputLYZ1PRODanalysis" ;
+ inputFileNameLYZ2PROD += rptypestr;
+ cout<<"The input directory is "<<inputFileNameLYZ2PROD.Data()<<endl;
+ TFile* fInputFileLYZ2PROD = (TFile*)outputFile->FindObjectAny(inputFileNameLYZ2PROD.Data());
+ if(!fInputFileLYZ2PROD || fInputFileLYZ2PROD->IsZombie()) {
+ cerr << " ERROR: To run LYZ2PROD you need the output file from LYZ1PROD. This file is not there! Please run LYZ1PROD first." << endl ;
+ break;
+ }
+ else {
+ TList* fInputListLYZ2PROD = (TList*)fInputFileLYZ2PROD->Get("LYZ1PROD");
+ if (!fInputListLYZ2PROD) {cout<<"list is NULL pointer!"<<endl;}
+ }
+ cout<<"LYZ2PROD input file/list read..."<<endl;
+ }
+ }
+
+ if (LYZEP) {
+ //read the outputfile of the second run
+ TString outputFileName = "AnalysisResults2.root";
+ TString pwd(gSystem->pwd());
+ pwd+="/";
+ pwd+=outputFileName.Data();
+ TFile *outputFile = NULL;
+ if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {
+ cout<<"WARNING: You do not have an output file:"<<endl;
+ cout<<" "<<pwd.Data()<<endl;
+ exit(0);
+ } else {
+ outputFile = TFile::Open(pwd.Data(),"READ");
+ }
+
+ // read the output file from LYZ2SUM
+ TString inputFileNameLYZEP = "outputLYZ2SUManalysis" ;
+ inputFileNameLYZEP += rptypestr;
+ cout<<"The input file is "<<inputFileNameLYZEP.Data()<<endl;
+ TFile* fInputFileLYZEP = (TFile*)outputFile->FindObjectAny(inputFileNameLYZEP.Data());
+ if(!fInputFileLYZEP || fInputFileLYZEP->IsZombie()) {
+ cerr << " ERROR: To run LYZEP you need the output file from LYZ2SUM. This file is not there! Please run LYZ2SUM first." << endl ;
+ break;
+ }
+ else {
+ TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("LYZ2SUM");
+ if (!fInputListLYZEP) {cout<<"list is NULL pointer!"<<endl;}
+ }
+ cout<<"LYZEP input file/list read..."<<endl;
+ }
+
+
+ // Create the FMD task and add it to the manager
+ //===========================================================================
+ if (rptypestr == "FMD") {
+ AliFMDAnalysisTaskSE *taskfmd = NULL;
+ if (rptypestr == "FMD") {
+ taskfmd = new AliFMDAnalysisTaskSE("TaskFMD");
+ taskfmd->SelectCollisionCandidates(centralitysel);
+ mgr->AddTask(taskfmd);
+
+ AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+ pars->Init();
+ pars->SetProcessPrimary(kTRUE); //for MC only
+ pars->SetProcessHits(kFALSE);
+
+ //pars->SetRealData(kTRUE); //for real data
+ //pars->SetProcessPrimary(kFALSE); //for real data
+ }
+ }
+
+ // Create the flow event task, add it to the manager.
+ //===========================================================================
+ AliAnalysisTaskFlowEvent *taskFE = NULL;
+
+ if(useAfterBurner)
+ {
+ taskFE = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent %s",outputSlotName.Data()),"",doQA,1);
+ taskFE->SetFlow(v1,v2,v3,v4);
+ taskFE->SetNonFlowNumberOfTrackClones(numberOfTrackClones);
+ taskFE->SetAfterburnerOn();
+ taskFE->SelectCollisionCandidates(centralitysel);
+ }
+ else {taskFE = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent %s",outputSlotName.Data()),"",doQA);
+ taskFE->SelectCollisionCandidates(centralitysel);}
+ if (ExcludeRegion) {
+ taskFE->DefineDeadZone(excludeEtaMin, excludeEtaMax, excludePhiMin, excludePhiMax);
+ }
+ taskFE->SetSubeventEtaRange(minA, maxA, minB, maxB);
+ if (UsePhysicsSelection) {
+ taskFE->SelectCollisionCandidates(AliVEvent::kMB);
+ cout<<"Using Physics Selection"<<endl;
+ }
+ mgr->AddTask(taskFE);
+
+ // Pass cuts for RPs and POIs to the task:
+ taskFE->SetCutsEvent(cutsEvent);
+ taskFE->SetCutsRP(cutsRP);
+ taskFE->SetCutsPOI(cutsPOI);
+ if (cutsRP->GetParamType()==AliFlowTrackCuts::kVZERO)
+ {
+ //TODO: since this is set in a static object all analyses in an analysis train
+ //will be affected.
+ taskFE->SetHistWeightvsPhiMin(0.);
+ taskFE->SetHistWeightvsPhiMax(200.);
+ }
+
+ // Create the analysis tasks, add them to the manager.
+ //===========================================================================
+ if (SP){
+ AliAnalysisTaskScalarProduct *taskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct %s",outputSlotName.Data()),WEIGHTS[0]);
+ taskSP->SelectCollisionCandidates(centralitysel);
+ taskSP->SetRelDiffMsub(1.0);
+ taskSP->SetApplyCorrectionForNUA(kTRUE);
+ mgr->AddTask(taskSP);
+ }
+ if (LYZ1SUM){
+ AliAnalysisTaskLeeYangZeros *taskLYZ1SUM = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosSUM %s",outputSlotName.Data()),kTRUE);
+ taskLYZ1SUM->SelectCollisionCandidates(centralitysel);
+ taskLYZ1SUM->SetFirstRunLYZ(kTRUE);
+ taskLYZ1SUM->SetUseSumLYZ(kTRUE);
+ mgr->AddTask(taskLYZ1SUM);
+ }
+ if (LYZ1PROD){
+ AliAnalysisTaskLeeYangZeros *taskLYZ1PROD = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosPROD %s",outputSlotName.Data()),kTRUE);
+ taskLYZ1PROD->SelectCollisionCandidates(centralitysel);
+ taskLYZ1PROD->SetFirstRunLYZ(kTRUE);
+ taskLYZ1PROD->SetUseSumLYZ(kFALSE);
+ mgr->AddTask(taskLYZ1PROD);
+ }
+ if (LYZ2SUM){
+ AliAnalysisTaskLeeYangZeros *taskLYZ2SUM = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosSUM %s",outputSlotName.Data()),kFALSE);
+ taskLYZ2SUM->SelectCollisionCandidates(centralitysel);
+ taskLYZ2SUM->SetFirstRunLYZ(kFALSE);
+ taskLYZ2SUM->SetUseSumLYZ(kTRUE);
+ mgr->AddTask(taskLYZ2SUM);
+ }
+ if (LYZ2PROD){
+ AliAnalysisTaskLeeYangZeros *taskLYZ2PROD = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosPROD %s",outputSlotName.Data()),kFALSE);
+ taskLYZ2PROD->SelectCollisionCandidates(centralitysel);
+ taskLYZ2PROD->SetFirstRunLYZ(kFALSE);
+ taskLYZ2PROD->SetUseSumLYZ(kFALSE);
+ mgr->AddTask(taskLYZ2PROD);
+ }
+ if (LYZEP){
+ AliAnalysisTaskLYZEventPlane *taskLYZEP = new AliAnalysisTaskLYZEventPlane(Form("TaskLYZEventPlane %s",outputSlotName.Data()));
+ taskLYZEP->SelectCollisionCandidates(centralitysel);
+ mgr->AddTask(taskLYZEP);
+ }
+ if (GFC){
+ AliAnalysisTaskCumulants *taskGFC = new AliAnalysisTaskCumulants(Form("TaskCumulants %s",outputSlotName.Data()),useWeights);
+ taskGFC->SelectCollisionCandidates(centralitysel);
+ taskGFC->SetUsePhiWeights(WEIGHTS[0]);
+ taskGFC->SetUsePtWeights(WEIGHTS[1]);
+ taskGFC->SetUseEtaWeights(WEIGHTS[2]);
+ mgr->AddTask(taskGFC);
+ }
+ if (QC){
+ AliAnalysisTaskQCumulants *taskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants %s",outputSlotName.Data()),useWeights);
+ taskQC->SelectCollisionCandidates(centralitysel);
+ taskQC->SetUsePhiWeights(WEIGHTS[0]);
+ taskQC->SetUsePtWeights(WEIGHTS[1]);
+ taskQC->SetUseEtaWeights(WEIGHTS[2]);
+ taskQC->SetCalculateCumulantsVsM(kFALSE);
+ taskQC->SetnBinsMult(10000);
+ taskQC->SetMinMult(0.);
+ taskQC->SetMaxMult(10000.);
+ taskQC->SetHarmonic(harmonic);
+ taskQC->SetApplyCorrectionForNUA(kFALSE);
+ taskQC->SetFillMultipleControlHistograms(kFALSE);
+ mgr->AddTask(taskQC);
+ }
+ if (FQD){
+ AliAnalysisTaskFittingQDistribution *taskFQD = new AliAnalysisTaskFittingQDistribution(Form("TaskFittingQDistribution %s",outputSlotName.Data()),kFALSE);
+ taskFQD->SelectCollisionCandidates(centralitysel);
+ taskFQD->SetUsePhiWeights(WEIGHTS[0]);
+ taskFQD->SetqMin(0.);
+ taskFQD->SetqMax(1000.);
+ taskFQD->SetqNbins(10000);
+ mgr->AddTask(taskFQD);
+ }
+ if (MCEP){
+ AliAnalysisTaskMCEventPlane *taskMCEP = new AliAnalysisTaskMCEventPlane(Form("TaskMCEventPlane %s",outputSlotName.Data()));
+ taskMCEP->SelectCollisionCandidates(centralitysel);
+ mgr->AddTask(taskMCEP);
+ }
+ if (MH){
+ AliAnalysisTaskMixedHarmonics *taskMH = new AliAnalysisTaskMixedHarmonics(Form("TaskMixedHarmonics %s",outputSlotName.Data()),useWeights);
+ taskMH->SelectCollisionCandidates(centralitysel);
+ taskMH->SetHarmonic(1); // n in cos[n(phi1+phi2-2phi3)] and cos[n(psi1+psi2-2phi3)]
+ taskMH->SetNoOfMultipicityBins(10000);
+ taskMH->SetMultipicityBinWidth(1.);
+ taskMH->SetMinMultiplicity(1.);
+ taskMH->SetCorrectForDetectorEffects(kTRUE);
+ taskMH->SetEvaluateDifferential3pCorrelator(kFALSE); // evaluate <<cos[n(psi1+psi2-2phi3)]>> (Remark: two nested loops)
+ taskMH->SetOppositeChargesPOI(kFALSE); // POIs psi1 and psi2 in cos[n(psi1+psi2-2phi3)] will have opposite charges
+ mgr->AddTask(taskMH);
+ }
+ if (NL){
+ AliAnalysisTaskNestedLoops *taskNL = new AliAnalysisTaskNestedLoops(Form("TaskNestedLoops %s",outputSlotName.Data()),useWeights);
+ taskNL->SelectCollisionCandidates(centralitysel);
+ taskNL->SetHarmonic(1); // n in cos[n(phi1+phi2-2phi3)] and cos[n(psi1+psi2-2phi3)]
+ taskNL->SetEvaluateNestedLoopsForRAD(kTRUE); // RAD = Relative Angle Distribution
+ taskNL->SetEvaluateNestedLoopsForMH(kTRUE); // evalaute <<cos[n(phi1+phi2-2phi3)]>> (Remark: three nested loops)
+ taskNL->SetEvaluateDifferential3pCorrelator(kFALSE); // evaluate <<cos[n(psi1+psi2-2phi3)]>> (Remark: three nested loops)
+ taskNL->SetOppositeChargesPOI(kFALSE); // POIs psi1 and psi2 in cos[n(psi1+psi2-2phi3)] will have opposite charges
+ mgr->AddTask(taskNL);
+ }
+
+ // Create the output container for the data produced by the task
+ // Connect to the input and output containers
+ //===========================================================================
+ AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+
+ if (rptypestr == "FMD") {
+ AliAnalysisDataContainer *coutputFMD =
+ mgr->CreateContainer(Form("BackgroundCorrected %s",outputSlotName.Data()), TList::Class(), AliAnalysisManager::kExchangeContainer);
+ //input and output taskFMD
+ mgr->ConnectInput(taskfmd, 0, cinput1);
+ mgr->ConnectOutput(taskfmd, 1, coutputFMD);
+ //input into taskFE
+ mgr->ConnectInput(taskFE,1,coutputFMD);
+ }
+
+ AliAnalysisDataContainer *coutputFE =
+ mgr->CreateContainer(Form("FlowEventSimple %s",outputSlotName.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+ mgr->ConnectInput(taskFE,0,cinput1);
+ mgr->ConnectOutput(taskFE,1,coutputFE);
+
+ if (taskFE->GetQAOn())
+ {
+ TString outputQA = fileName;
+ outputQA += ":QA";
+ AliAnalysisDataContainer* coutputFEQA =
+ mgr->CreateContainer(Form("QA %s",outputSlotName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputQA);
+ mgr->ConnectOutput(taskFE,2,coutputFEQA);
+ }
+
+ // Create the output containers for the data produced by the analysis tasks
+ // Connect to the input and output containers
+ //===========================================================================
+ if (useWeights) {
+ AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer(Form("Weights %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kInputContainer);
+ }
+
+ if(SP) {
+ TString outputSP = fileName;
+ outputSP += ":outputSPanalysis";
+ outputSP+= rptypestr;
+ AliAnalysisDataContainer *coutputSP = mgr->CreateContainer(Form("SP %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputSP);
+ mgr->ConnectInput(taskSP,0,coutputFE);
+ mgr->ConnectOutput(taskSP,1,coutputSP);
+ if (WEIGHTS[0]) {
+ mgr->ConnectInput(taskSP,1,cinputWeights);
+ cinputWeights->SetData(weightsList);
+ }
+ }
+ if(LYZ1SUM) {
+ TString outputLYZ1SUM = fileName;
+ outputLYZ1SUM += ":outputLYZ1SUManalysis";
+ outputLYZ1SUM+= rptypestr;
+ AliAnalysisDataContainer *coutputLYZ1SUM = mgr->CreateContainer(Form("LYZ1SUM %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1SUM);
+ mgr->ConnectInput(taskLYZ1SUM,0,coutputFE);
+ mgr->ConnectOutput(taskLYZ1SUM,1,coutputLYZ1SUM);
+ }
+ if(LYZ1PROD) {
+ TString outputLYZ1PROD = fileName;
+ outputLYZ1PROD += ":outputLYZ1PRODanalysis";
+ outputLYZ1PROD+= rptypestr;
+ AliAnalysisDataContainer *coutputLYZ1PROD = mgr->CreateContainer(Form("LYZ1PROD %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1PROD);
+ mgr->ConnectInput(taskLYZ1PROD,0,coutputFE);
+ mgr->ConnectOutput(taskLYZ1PROD,1,coutputLYZ1PROD);
+ }
+ if(LYZ2SUM) {
+ AliAnalysisDataContainer *cinputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUMin %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kInputContainer);
+ TString outputLYZ2SUM = fileName;
+ outputLYZ2SUM += ":outputLYZ2SUManalysis";
+ outputLYZ2SUM+= rptypestr;
+
+ AliAnalysisDataContainer *coutputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUM %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2SUM);
+ mgr->ConnectInput(taskLYZ2SUM,0,coutputFE);
+ mgr->ConnectInput(taskLYZ2SUM,1,cinputLYZ2SUM);
+ mgr->ConnectOutput(taskLYZ2SUM,1,coutputLYZ2SUM);
+ cinputLYZ2SUM->SetData(fInputListLYZ2SUM);
+ }
+ if(LYZ2PROD) {
+ AliAnalysisDataContainer *cinputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PRODin %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kInputContainer);
+ TString outputLYZ2PROD = fileName;
+ outputLYZ2PROD += ":outputLYZ2PRODanalysis";
+ outputLYZ2PROD+= rptypestr;
+
+ AliAnalysisDataContainer *coutputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PROD %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2PROD);
+ mgr->ConnectInput(taskLYZ2PROD,0,coutputFE);
+ mgr->ConnectInput(taskLYZ2PROD,1,cinputLYZ2PROD);
+ mgr->ConnectOutput(taskLYZ2PROD,1,coutputLYZ2PROD);
+ cinputLYZ2PROD->SetData(fInputListLYZ2PROD);
+ }
+ if(LYZEP) {
+ AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer(Form("LYZEPin %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kInputContainer);
+ TString outputLYZEP = fileName;
+ outputLYZEP += ":outputLYZEPanalysis";
+ outputLYZEP+= rptypestr;
+
+ AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer(Form("LYZEP %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZEP);
+ mgr->ConnectInput(taskLYZEP,0,coutputFE);
+ mgr->ConnectInput(taskLYZEP,1,cinputLYZEP);
+ mgr->ConnectOutput(taskLYZEP,1,coutputLYZEP);
+ cinputLYZEP->SetData(fInputListLYZEP);
+ }
+ if(GFC) {
+ TString outputGFC = fileName;
+ outputGFC += ":outputGFCanalysis";
+ outputGFC+= rptypestr;
+
+ AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer(Form("GFC %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputGFC);
+ mgr->ConnectInput(taskGFC,0,coutputFE);
+ mgr->ConnectOutput(taskGFC,1,coutputGFC);
+ if (useWeights) {
+ mgr->ConnectInput(taskGFC,1,cinputWeights);
+ cinputWeights->SetData(weightsList);
+ }
+ }
+ if(QC) {
+ TString outputQC = fileName;
+ outputQC += ":outputQCanalysis";
+ outputQC+= rptypestr;
+
+ AliAnalysisDataContainer *coutputQC = mgr->CreateContainer(Form("QC %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputQC);
+ mgr->ConnectInput(taskQC,0,coutputFE);
+ mgr->ConnectOutput(taskQC,1,coutputQC);
+ if (useWeights) {
+ mgr->ConnectInput(taskQC,1,cinputWeights);
+ cinputWeights->SetData(weightsList);
+ }
+ }
+ if(FQD) {
+ TString outputFQD = fileName;
+ outputFQD += ":outputFQDanalysis";
+ outputFQD+= rptypestr;
+
+ AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer(Form("FQD %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputFQD);
+ mgr->ConnectInput(taskFQD,0,coutputFE);
+ mgr->ConnectOutput(taskFQD,1,coutputFQD);
+ if(useWeights) {
+ mgr->ConnectInput(taskFQD,1,cinputWeights);
+ cinputWeights->SetData(weightsList);
+ }
+ }
+ if(MCEP) {
+ TString outputMCEP = fileName;
+ outputMCEP += ":outputMCEPanalysis";
+ outputMCEP+= rptypestr;
+
+ AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer(Form("MCEP %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputMCEP);
+ mgr->ConnectInput(taskMCEP,0,coutputFE);
+ mgr->ConnectOutput(taskMCEP,1,coutputMCEP);
+ }
+ if(MH) {
+ TString outputMH = fileName;
+ outputMH += ":outputMHanalysis";
+ outputMH += rptypestr;
+
+ AliAnalysisDataContainer *coutputMH = mgr->CreateContainer(Form("MH %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputMH);
+ mgr->ConnectInput(taskMH,0,coutputFE);
+ mgr->ConnectOutput(taskMH,1,coutputMH);
+ //if (useWeights) {
+ // mgr->ConnectInput(taskMH,1,cinputWeights);
+ // cinputWeights->SetData(weightsList);
+ //}
+ }
+ if(NL) {
+ TString outputNL = fileName;
+ outputNL += ":outputNLanalysis";
+ outputNL += rptypestr;
+
+ AliAnalysisDataContainer *coutputNL = mgr->CreateContainer(Form("NL %s",outputSlotName.Data()),
+ TList::Class(),AliAnalysisManager::kOutputContainer,outputNL);
+ mgr->ConnectInput(taskNL,0,coutputFE);
+ mgr->ConnectOutput(taskNL,1,coutputNL);
+ //if (useWeights) {
+ // mgr->ConnectInput(taskNL,1,cinputWeights);
+ // cinputWeights->SetData(weightsList);
+ //}
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ if (runQAtask)
+ {
+ AliAnalysisTaskQAflow* taskQAflow = new AliAnalysisTaskQAflow(Form("TaskQAflow %s",outputSlotName.Data()));
+ taskQAflow->SelectCollisionCandidates(centralitysel);
+ taskQAflow->SetEventCuts(cutsEvent);
+ taskQAflow->SetTrackCuts(cutsRP);
+ taskQAflow->SetFillNTuple(FillQAntuple);
+ taskQAflow->SetDoCorrelations(DoQAcorrelations);
+ mgr->AddTask(taskQAflow);
+
+ Printf("outputSlotName %s",outputSlotName.Data());
+ TString taskQAoutputFileName(fileNameBase);
+ taskQAoutputFileName.Append("_QA.root");
+ AliAnalysisDataContainer* coutputQAtask = mgr->CreateContainer(Form("flowQA %s",outputSlotName.Data()),
+ TObjArray::Class(),
+ AliAnalysisManager::kOutputContainer,
+ taskQAoutputFileName);
+ AliAnalysisDataContainer* coutputQAtaskTree = mgr->CreateContainer(Form("flowQAntuple %s",outputSlotName.Data()),
+ TNtuple::Class(),
+ AliAnalysisManager::kOutputContainer,
+ taskQAoutputFileName);
+ mgr->ConnectInput(taskQAflow,0,mgr->GetCommonInputContainer());
+ mgr->ConnectInput(taskQAflow,1,coutputFE);
+ mgr->ConnectOutput(taskQAflow,1,coutputQAtask);
+ if (FillQAntuple) mgr->ConnectOutput(taskQAflow,2,coutputQAtaskTree);
+ }
+}
+
+
+
+
+
-// run.C\r
-//\r
-// Template run macro for AliBasicTask.cxx/.h with example layout of\r
-// physics selections and options, in macro and task.\r
-//\r
-// Author: Arvinder Palaha\r
-//\r
-class AliAnalysisGrid;\r
-class AliAnalysisTaskBF;\r
-class AliBalance;\r
-\r
-//Centrality stuff\r
-Int_t binfirst = 0; //where do we start numbering bins\r
-Int_t binlast = 8; //where do we stop numbering bins\r
-const Int_t numberOfCentralityBins = 9;\r
-Double_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile\r
-\r
-//Systematic studies\r
-const Int_t numberOfSyst = 13;\r
-Float_t vZ[numberOfSyst] = {10.,12.,6.,8.,10.,10.,10.,10.,10.,10.,10.,10.,10.}; // global Vertex Z cut\r
-Float_t DCAxy[numberOfSyst] = {-1.,2.4,2.4,2.4,2.2,2.0,1.8,2.4,2.4,2.4,2.4,2.4,2.4}; // DCA xy cut (afterburner, -1 = w/o additional cut)\r
-Float_t DCAz[numberOfSyst] = {-1.,3.2,3.2,3.2,3.0,2.8,2.6,3.2,3.2,3.2,3.2,3.2,3.2}; // DCA z cut (afterburner, -1 = w/o additional cut)\r
-Float_t ptMin[numberOfSyst] = {0.3,0.3,0.3,0.3,0.3,0.3,0.3,1.5,5.0,0.3,0.3,0.3,0.3}; // pt cuts\r
-Float_t ptMax[numberOfSyst] = {5.,1.5,1.5,1.5,1.5,1.5,1.5,5.0,10.0,10.0,1.5,1.5,1.5}; // pt cuts\r
-Float_t etaMin[numberOfSyst] = {-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-1.0,-0.6,-0.4}; // eta cuts\r
-Float_t etaMax[numberOfSyst] = {0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,1.0,0.6,0.4}; // eta cuts\r
-\r
-Bool_t kUsePID = kFALSE;\r
-Bool_t bUseHBTCut = kTRUE;\r
-Bool_t bUseConversionCut = kTRUE;\r
-Bool_t bResonancesCut = kTRUE;\r
-Bool_t bMomentumDifferenceCut = kTRUE;\r
-Int_t kNSigmaElectronRejection = 3;\r
-\r
-//______________________________________________________________________________\r
-void runTaskFlowHigherOrdersAllPID(\r
- const char* runtype = "local", // local, proof or grid\r
- const char *gridmode = "terminate", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof\r
- const Int_t bunchN = 0,\r
- const bool bAOD = 1, // 1 = AOD ANALYSIS, 0 = ESD ANALYSIS\r
- const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)\r
- const bool bMCphyssel = 1, // 1 = looking at MC truth or reconstructed, 0 = looking at real data\r
- const Long64_t nentries = 50000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.\r
- const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode\r
- TString proofdataset = "bunchPROOF", // path to dataset on proof cluster, for proof analysis\r
- const char *proofcluster = "miweber@alice-caf.cern.ch", // which proof cluster to use in proof mode\r
- const char *taskname = "BF_Syst_Test" // sets name of grid generated macros\r
- )\r
-{\r
- // check run type\r
- if(runtype != "local" && runtype != "proof" && runtype != "grid") {\r
- Printf("\n\tIncorrect run option, check first argument of run macro");\r
- Printf("\tint runtype = local, proof or grid\n");\r
- return;\r
- }\r
- Printf("%s analysis chosen",runtype);\r
- \r
- // load libraries\r
- gSystem->Load("libCore.so"); \r
- gSystem->Load("libGeom.so");\r
- gSystem->Load("libVMC.so");\r
- gSystem->Load("libPhysics.so");\r
- gSystem->Load("libTree.so");\r
- gSystem->Load("libSTEERBase.so");\r
- gSystem->Load("libESD.so");\r
- gSystem->Load("libAOD.so");\r
- gSystem->Load("libANALYSIS.so");\r
- gSystem->Load("libANALYSISalice.so");\r
- gSystem->Load("libEventMixing.so");\r
- gSystem->Load("libCORRFW.so");\r
- gSystem->Load("libPWGTools.so");\r
- gSystem->Load("libPWGCFebye.so");\r
- gSystem->Load("libPWGflowBase.so");\r
- gSystem->Load("libPWGflowTasks.so");\r
-\r
- // additional\r
-\r
- // compile standalone stuff\r
- //gROOT->LoadMacro("AliBalance.cxx++g");\r
- //gROOT->LoadMacro("AliAnalysisTaskBF.cxx++g");\r
-\r
- // add aliroot indlude path\r
- //gROOT->ProcessLine(".include $PWD/.");\r
- //gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));\r
-\r
- gROOT->SetStyle("Plain");\r
-\r
- // analysis manager\r
- AliAnalysisManager* mgr = new AliAnalysisManager(Form("%s%i",taskname,bunchN));\r
- \r
- // create the alien handler and attach it to the manager\r
- if(runtype == "grid") {\r
- AliAnalysisGrid *plugin = CreateAlienHandler(bAOD,bunchN,Form("%s%i",taskname,bunchN), gridmode, proofcluster, Form("%s_%d.txt",proofdataset.Data(),bunchN)); \r
- mgr->SetGridHandler(plugin);\r
- }\r
- else if(runtype == "local") {\r
- TString filename;\r
- TChain* chain = 0x0;\r
- if((!bAOD)&&(!bMCtruth)) {\r
- chain = new TChain("esdTree");\r
- for(Int_t i = 0; i < 4; i++) {\r
- filename = "/data/alice2/pchrist/HeavyIons/Data/2011/Set";\r
- filename += i; filename += "/AliESDs.root";\r
- chain->Add(filename.Data());\r
- }\r
- }\r
- else if((bAOD)&&(!bMCtruth)) {\r
- chain = new TChain("aodTree");\r
- for(Int_t i = 0; i < 10; i++) {\r
- filename = "/glusterfs/alice1/alice2/pchrist/HeavyIons/Data/2011/Set";\r
- filename += i; filename += "/AliAOD.root";\r
- chain->Add(filename.Data());\r
- }\r
- }\r
- else if((!bAOD)&&(bMCtruth)) {\r
- chain = new TChain("TE");\r
- for(Int_t i = 10; i < 99; i++) {\r
- filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";\r
- filename += i;\r
- filename += "/galice.root";\r
- chain->Add(filename.Data());\r
- }\r
- }\r
- else if((bAOD)&&(bMCtruth)) { //used for MCAOD\r
- chain = new TChain("aodTree"); \r
- for(Int_t i = 10; i < 99; i++) { \r
- filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";\r
- filename += i; \r
- filename += "/AliAOD.root";\r
- chain->Add(filename.Data());\r
- } \r
- }\r
- \r
-\r
- }//local mode\r
-\r
- // input handler (ESD or AOD)\r
- AliVEventHandler* inputH = NULL;\r
- if(!bAOD){\r
- inputH = new AliESDInputHandler();\r
- }\r
- else{\r
- inputH = new AliAODInputHandler();\r
- }\r
- mgr->SetInputEventHandler(inputH);\r
- \r
- // mc event handler\r
- if(bMCtruth) {\r
- AliMCEventHandler* mchandler = new AliMCEventHandler();\r
- // Not reading track references\r
- mchandler->SetReadTR(kFALSE);\r
- mgr->SetMCtruthEventHandler(mchandler);\r
- } \r
- \r
- // AOD output handler\r
- //AliAODHandler* aodoutHandler = new AliAODHandler();\r
- //aodoutHandler->SetOutputFileName("aod.root");\r
- //mgr->SetOutputEventHandler(aodoutHandler); \r
- \r
- // === Physics Selection Task ===\r
- //\r
- // In SelectCollisionCandidate(), default is kMB, so the task UserExec() \r
- // function is only called for these events.\r
- // Options are:\r
- // kMB Minimum Bias trigger\r
- // kMBNoTRD Minimum bias trigger where the TRD is not read out\r
- // kMUON Muon trigger\r
- // kHighMult High-Multiplicity Trigger\r
- // kUserDefined For manually defined trigger selection\r
- //\r
- // Multiple options possible with the standard AND/OR operators && and ||\r
- // These all have the usual offline SPD or V0 selections performed.\r
- //\r
- // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(),\r
- // one can manually set the selected and background classes using:\r
- // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL")\r
- // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL");\r
- //\r
- // One can also specify multiple classes at once, or require a class to NOT\r
- // trigger, for e.g.\r
- // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL");\r
- //\r
- // NOTE that manually setting the physics selection overrides the standard\r
- // selection, so it must be done in completeness.\r
- //\r
- // ALTERNATIVELY, one can make the physics selection inside the task\r
- // UserExec().\r
- // For this case, comment out the task->SelectCol.... line, \r
- // and see AliBasicTask.cxx UserExec() function for details on this.\r
-\r
- //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");\r
- //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);\r
- //if(!physSelTask) { Printf("no physSelTask"); return; }\r
- //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection();\r
- //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769");\r
- \r
- // create task\r
- //Add the centrality determination task and the physics selection \r
- // (only on ESD level, in AODs centrality is already in header and events are selected)\r
-// if((!bAOD)&&(!bMCtruth)){\r
-// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");\r
-// AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();\r
-\r
- // Add physics selection task (NOT needed for AODs)\r
-// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");\r
-// AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(bMCphyssel);\r
-// }\r
-/////////////////////////////////////////\r
- //Add flow centrality bayesian \r
-\r
- gROOT->LoadMacro("AddTaskFlowHigherOrdersAllPID.C");\r
- //gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskFlowHigherOrdersAllPID.C");\r
- // gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskFlowCentralityBayesian.C");\r
- // gROOT->LoadMacro("~/Desktop/work/PhD/flow/AddTaskFlowCentralityBayesian.C");\r
- AliAnalysisTaskFlowEvent* FlowTask = AddTaskFlowHigherOrdersAllPID(AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB,0.,80.,"AnalysisResults",kTRUE,768,768,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,kFALSE,-0.8,0.8,"");\r
-/////////////////////////////////////////\r
-\r
- //Add the PID response\r
-// if((kUsePID)||(kNSigmaElectronRejection)) {\r
-// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");\r
-// AddTaskPIDResponse(bMCphyssel); \r
-// }\r
-\r
- //Add the VZERO event plane task\r
-// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C"); \r
-// AliVZEROEPSelectionTask* epSelTask = AddTaskVZEROEPSelection();\r
-\r
- //Add the BF task (all centralities)\r
- // gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/AddTaskBalancePsiCentralityTrain.C"); \r
-\r
-// AliAnalysisTaskBFPsi *taskBF = AddTaskBalancePsiCentralityTrain(0, 500, kFALSE, kTRUE, kFALSE, "V0M", 10, -1, -1, 0.2, 20.0, -0.8, 0.8, -1, -1, kUsePID, kFALSE, kTRUE, 0.02, kFALSE, 0.04, kTRUE, 0.1, 128, 1, "AnalysisResults","TE","Multiplicity","AOD",kTRUE, kNSigmaElectronRejection);\r
- //taskBF->SetDebugLevel();\r
-\r
- // enable debug printouts\r
- //mgr->SetDebugLevel(2);\r
- //mgr->SetUseProgressBar(1,100);\r
- if (!mgr->InitAnalysis()) return;\r
- mgr->PrintStatus();\r
- \r
- // start analysis\r
- Printf("Starting Analysis....");\r
- if(runtype == "local") \r
- mgr->StartAnalysis("local",chain);\r
- else\r
- mgr->StartAnalysis(runtype,nentries,firstentry);\r
-}\r
-\r
-//______________________________________________________________________________\r
-AliAnalysisGrid* CreateAlienHandler(Bool_t bAOD, Int_t bunchN, const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)\r
-{\r
- AliAnalysisAlien *plugin = new AliAnalysisAlien();\r
- // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")\r
- plugin->SetRunMode(gridmode);\r
-\r
- // Set versions of used packages\r
- plugin->SetAPIVersion("V1.1x");\r
- plugin->SetROOTVersion("v5-34-08");\r
- plugin->SetAliROOTVersion("v5-05-19-AN");\r
-\r
- // Declare input data to be processed.\r
-\r
- // Method 1: Create automatically XML collections using alien 'find' command.\r
- // Define production directory LFN\r
- plugin->SetGridDataDir("/alice/data/2010/LHC10h/");\r
- // On real reconstructed data:\r
- // plugin->SetGridDataDir("/alice/data/2009/LHC09d");\r
-\r
- // Set data search pattern\r
- //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES\r
- // Data pattern for reconstructed data\r
- if(!bAOD){\r
- plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH\r
- } \r
- else{\r
- plugin->SetDataPattern("*ESDs/pass2/AOD086/*/AliAOD.root");\r
- }\r
-\r
- plugin->SetRunPrefix("000"); // real data\r
- // ...then add run numbers to be considered\r
- //plugin->SetRunRange(114917,115322);\r
-\r
- if(bunchN==0){\r
- plugin->AddRunNumber(137366);\r
- }\r
- \r
- //bunch1\r
- else if(bunchN == 1){\r
- plugin->AddRunNumber(139510);\r
- plugin->AddRunNumber(139507);\r
- plugin->AddRunNumber(139505);\r
- plugin->AddRunNumber(139503); \r
- plugin->AddRunNumber(139465); \r
- plugin->AddRunNumber(139438);\r
- plugin->AddRunNumber(139437);\r
- plugin->AddRunNumber(139360); \r
- plugin->AddRunNumber(139329);\r
- plugin->AddRunNumber(139328); \r
- }\r
-\r
- //bunch2\r
- else if(bunchN == 2){\r
- plugin->AddRunNumber(139314); \r
- plugin->AddRunNumber(139310);\r
- plugin->AddRunNumber(139309); \r
- plugin->AddRunNumber(139173); \r
- plugin->AddRunNumber(139107); \r
- plugin->AddRunNumber(139105); \r
- plugin->AddRunNumber(139038); \r
- plugin->AddRunNumber(139037); \r
- plugin->AddRunNumber(139036); \r
- plugin->AddRunNumber(139029); \r
- plugin->AddRunNumber(139028); \r
- plugin->AddRunNumber(138872); \r
- plugin->AddRunNumber(138871); \r
- plugin->AddRunNumber(138870); \r
- plugin->AddRunNumber(138837); \r
- plugin->AddRunNumber(138732); \r
- plugin->AddRunNumber(138730);\r
- plugin->AddRunNumber(138666);\r
- plugin->AddRunNumber(138662); \r
- plugin->AddRunNumber(138653); \r
- }\r
-\r
- else if(bunchN == 3){\r
- plugin->AddRunNumber(138652);\r
- plugin->AddRunNumber(138638);\r
- plugin->AddRunNumber(138624); \r
- plugin->AddRunNumber(138621); \r
- plugin->AddRunNumber(138583); \r
- plugin->AddRunNumber(138582); \r
- plugin->AddRunNumber(138579); \r
- plugin->AddRunNumber(138578);\r
- plugin->AddRunNumber(138534);\r
- plugin->AddRunNumber(138469); \r
- }\r
-\r
- else if(bunchN == 4){\r
- \r
- plugin->AddRunNumber(138442);\r
- plugin->AddRunNumber(138439);\r
- plugin->AddRunNumber(138438);\r
- plugin->AddRunNumber(138396); \r
- plugin->AddRunNumber(138364); \r
- plugin->AddRunNumber(138275); \r
- plugin->AddRunNumber(138225); \r
- plugin->AddRunNumber(138201);\r
- plugin->AddRunNumber(138197); \r
- plugin->AddRunNumber(138192); \r
- }\r
-\r
- else if(bunchN == 5){\r
-\r
- plugin->AddRunNumber(138190);\r
- plugin->AddRunNumber(137848); \r
- plugin->AddRunNumber(137844); \r
- plugin->AddRunNumber(137752); \r
- plugin->AddRunNumber(137751); \r
- plugin->AddRunNumber(137724); \r
- plugin->AddRunNumber(137722); \r
- plugin->AddRunNumber(137718); \r
- plugin->AddRunNumber(137704); \r
- plugin->AddRunNumber(137693);\r
- }\r
-\r
- else if(bunchN == 6){\r
-\r
- plugin->AddRunNumber(137692); \r
- plugin->AddRunNumber(137691); \r
- plugin->AddRunNumber(137686); \r
- plugin->AddRunNumber(137685); \r
- plugin->AddRunNumber(137639); \r
- plugin->AddRunNumber(137638);\r
- plugin->AddRunNumber(137608); \r
- plugin->AddRunNumber(137595);\r
- plugin->AddRunNumber(137549);\r
- plugin->AddRunNumber(137546); \r
-\r
- }\r
-\r
- else if(bunchN == 7){\r
-\r
- plugin->AddRunNumber(137544); \r
- plugin->AddRunNumber(137541); \r
- plugin->AddRunNumber(137539); \r
- plugin->AddRunNumber(137531); \r
- plugin->AddRunNumber(137530); \r
- plugin->AddRunNumber(137443); \r
- plugin->AddRunNumber(137441); \r
- plugin->AddRunNumber(137440); \r
- plugin->AddRunNumber(137439); \r
- plugin->AddRunNumber(137434); \r
-\r
- }\r
-\r
- else if(bunchN == 8){\r
-\r
- plugin->AddRunNumber(137432); \r
- plugin->AddRunNumber(137431); \r
- plugin->AddRunNumber(137430); \r
- plugin->AddRunNumber(137366); \r
- plugin->AddRunNumber(137243); \r
- plugin->AddRunNumber(137236);\r
- plugin->AddRunNumber(137235);\r
- plugin->AddRunNumber(137232); \r
- plugin->AddRunNumber(137231); \r
- plugin->AddRunNumber(137162); \r
- plugin->AddRunNumber(137161);\r
- }\r
-\r
- else{\r
-\r
- stderr<<"BUNCH NOT THERE"<<endl;\r
- return NULL;\r
-\r
- }\r
-\r
- //plugin->AddRunList("139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137162, 137161");\r
-\r
-\r
-\r
-\r
-\r
- plugin->SetNrunsPerMaster(1);\r
- plugin->SetOutputToRunNo();\r
- // comment out the next line when using the "terminate" option, unless\r
- // you want separate merged files for each run\r
- plugin->SetMergeViaJDL();\r
-\r
- // Method 2: Declare existing data files (raw collections, xml collections, root file)\r
- // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())\r
- // XML collections added via this method can be combined with the first method if\r
- // the content is compatible (using or not tags)\r
- // plugin->AddDataFile("tag.xml");\r
- // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");\r
-\r
- // Define alien work directory where all files will be copied. Relative to alien $HOME.\r
- plugin->SetGridWorkingDir(taskname);\r
-\r
- // Declare alien output directory. Relative to working directory.\r
- plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out\r
-\r
- // Declare the analysis source files names separated by blancs. To be compiled runtime\r
- // using ACLiC on the worker nodes.\r
- plugin->SetAnalysisSource("AliBalance.cxx AliAnalysisTaskBF.cxx");\r
-\r
- // Declare all libraries (other than the default ones for the framework. These will be\r
- // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.\r
- //plugin->AddIncludePath("-I.");\r
- //plugin->SetAdditionalLibs("libPWGCFebye.so");\r
- plugin->SetAdditionalLibs("AliBalance.cxx AliBalance.h AliAnalysisTaskBF.cxx AliAnalysisTaskBF.h");\r
-\r
- // Declare the output file names separated by blancs.\r
- // (can be like: file.root or file.root@ALICE::Niham::File)\r
- // To only save certain files, use SetDefaultOutputs(kFALSE), and then\r
- // SetOutputFiles("list.root other.filename") to choose which files to save\r
- plugin->SetDefaultOutputs();\r
- //plugin->SetOutputFiles("list.root");\r
-\r
- // Optionally set a name for the generated analysis macro (default MyAnalysis.C)\r
- plugin->SetAnalysisMacro(Form("%s.C",taskname));\r
-\r
- // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)\r
- plugin->SetSplitMaxInputFileNumber(100);\r
-\r
- // Optionally modify the executable name (default analysis.sh)\r
- plugin->SetExecutable(Form("%s.sh",taskname));\r
-\r
- // set number of test files to use in "test" mode\r
- plugin->SetNtestFiles(1);\r
-\r
- // Optionally resubmit threshold.\r
- plugin->SetMasterResubmitThreshold(90);\r
-\r
- // Optionally set time to live (default 30000 sec)\r
- plugin->SetTTL(90000);\r
-\r
- // Optionally set input format (default xml-single)\r
- plugin->SetInputFormat("xml-single");\r
-\r
- // Optionally modify the name of the generated JDL (default analysis.jdl)\r
- plugin->SetJDLName(Form("%s.jdl",taskname));\r
-\r
- // Optionally modify job price (default 1)\r
- plugin->SetPrice(1); \r
-\r
- // Optionally modify split mode (default 'se') \r
- plugin->SetSplitMode("se");\r
-\r
- //plugin->SetUseSubmitPolicy();\r
- //plugin->SetKeepLogs();\r
- \r
- //----------------------------------------------------------\r
- //--- PROOF MODE SPECIFIC SETTINGS ------------\r
- //---------------------------------------------------------- \r
- // Proof cluster\r
- plugin->SetProofCluster(proofcluster);\r
- // Dataset to be used \r
- plugin->SetProofDataSet(proofdataset);\r
- // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard\r
- plugin->SetProofReset(0);\r
- // May limit number of workers\r
- plugin->SetNproofWorkers(0);\r
- // May limit the number of workers per slave\r
- plugin->SetNproofWorkersPerSlave(1); \r
- // May use a specific version of root installed in proof\r
- plugin->SetRootVersionForProof("current");\r
- // May set the aliroot mode. Check http://aaf.cern.ch/node/83 \r
- plugin->SetAliRootMode("default"); // Loads AF libs by default\r
- // May request ClearPackages (individual ClearPackage not supported)\r
- plugin->SetClearPackages(kFALSE);\r
- // Plugin test mode works only providing a file containing test file locations, used in "local" mode also\r
- plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc\r
- // Request connection to alien upon connection to grid\r
- plugin->SetProofConnectGrid(kFALSE);\r
-\r
- plugin->Print();\r
-\r
- return plugin;\r
-}\r
-\r
+// run.C
+//
+// Template run macro for AliBasicTask.cxx/.h with example layout of
+// physics selections and options, in macro and task.
+//
+// Author: Arvinder Palaha
+//
+class AliAnalysisGrid;
+class AliAnalysisTaskBF;
+class AliBalance;
+
+//Centrality stuff
+Int_t binfirst = 0; //where do we start numbering bins
+Int_t binlast = 8; //where do we stop numbering bins
+const Int_t numberOfCentralityBins = 9;
+Double_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile
+
+//Systematic studies
+const Int_t numberOfSyst = 13;
+Float_t vZ[numberOfSyst] = {10.,12.,6.,8.,10.,10.,10.,10.,10.,10.,10.,10.,10.}; // global Vertex Z cut
+Float_t DCAxy[numberOfSyst] = {-1.,2.4,2.4,2.4,2.2,2.0,1.8,2.4,2.4,2.4,2.4,2.4,2.4}; // DCA xy cut (afterburner, -1 = w/o additional cut)
+Float_t DCAz[numberOfSyst] = {-1.,3.2,3.2,3.2,3.0,2.8,2.6,3.2,3.2,3.2,3.2,3.2,3.2}; // DCA z cut (afterburner, -1 = w/o additional cut)
+Float_t ptMin[numberOfSyst] = {0.3,0.3,0.3,0.3,0.3,0.3,0.3,1.5,5.0,0.3,0.3,0.3,0.3}; // pt cuts
+Float_t ptMax[numberOfSyst] = {5.,1.5,1.5,1.5,1.5,1.5,1.5,5.0,10.0,10.0,1.5,1.5,1.5}; // pt cuts
+Float_t etaMin[numberOfSyst] = {-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-1.0,-0.6,-0.4}; // eta cuts
+Float_t etaMax[numberOfSyst] = {0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,1.0,0.6,0.4}; // eta cuts
+
+Bool_t kUsePID = kFALSE;
+Bool_t bUseHBTCut = kTRUE;
+Bool_t bUseConversionCut = kTRUE;
+Bool_t bResonancesCut = kTRUE;
+Bool_t bMomentumDifferenceCut = kTRUE;
+Int_t kNSigmaElectronRejection = 3;
+
+//______________________________________________________________________________
+void runTaskFlowHigherOrdersAllPID(
+ const char* runtype = "local", // local, proof or grid
+ const char *gridmode = "terminate", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
+ const Int_t bunchN = 0,
+ const bool bAOD = 1, // 1 = AOD ANALYSIS, 0 = ESD ANALYSIS
+ const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)
+ const bool bMCphyssel = 1, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
+ const Long64_t nentries = 50000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.
+ const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode
+ TString proofdataset = "bunchPROOF", // path to dataset on proof cluster, for proof analysis
+ const char *proofcluster = "miweber@alice-caf.cern.ch", // which proof cluster to use in proof mode
+ const char *taskname = "BF_Syst_Test" // sets name of grid generated macros
+ )
+{
+ // check run type
+ if(runtype != "local" && runtype != "proof" && runtype != "grid") {
+ Printf("\n\tIncorrect run option, check first argument of run macro");
+ Printf("\tint runtype = local, proof or grid\n");
+ return;
+ }
+ Printf("%s analysis chosen",runtype);
+
+ // load libraries
+ gSystem->Load("libCore.so");
+ gSystem->Load("libGeom.so");
+ gSystem->Load("libVMC.so");
+ gSystem->Load("libPhysics.so");
+ gSystem->Load("libTree.so");
+ gSystem->Load("libSTEERBase.so");
+ gSystem->Load("libESD.so");
+ gSystem->Load("libAOD.so");
+ gSystem->Load("libANALYSIS.so");
+ gSystem->Load("libANALYSISalice.so");
+ gSystem->Load("libEventMixing.so");
+ gSystem->Load("libCORRFW.so");
+ gSystem->Load("libPWGTools.so");
+ gSystem->Load("libPWGCFebye.so");
+ gSystem->Load("libPWGflowBase.so");
+ gSystem->Load("libPWGflowTasks.so");
+
+ // additional
+
+ // compile standalone stuff
+ //gROOT->LoadMacro("AliBalance.cxx++g");
+ //gROOT->LoadMacro("AliAnalysisTaskBF.cxx++g");
+
+ // add aliroot indlude path
+ //gROOT->ProcessLine(".include $PWD/.");
+ //gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
+
+ gROOT->SetStyle("Plain");
+
+ // analysis manager
+ AliAnalysisManager* mgr = new AliAnalysisManager(Form("%s%i",taskname,bunchN));
+
+ // create the alien handler and attach it to the manager
+ if(runtype == "grid") {
+ AliAnalysisGrid *plugin = CreateAlienHandler(bAOD,bunchN,Form("%s%i",taskname,bunchN), gridmode, proofcluster, Form("%s_%d.txt",proofdataset.Data(),bunchN));
+ mgr->SetGridHandler(plugin);
+ }
+ else if(runtype == "local") {
+ TString filename;
+ TChain* chain = 0x0;
+ if((!bAOD)&&(!bMCtruth)) {
+ chain = new TChain("esdTree");
+ for(Int_t i = 0; i < 4; i++) {
+ filename = "/data/alice2/pchrist/HeavyIons/Data/2011/Set";
+ filename += i; filename += "/AliESDs.root";
+ chain->Add(filename.Data());
+ }
+ }
+ else if((bAOD)&&(!bMCtruth)) {
+ chain = new TChain("aodTree");
+ for(Int_t i = 0; i < 10; i++) {
+ filename = "/glusterfs/alice1/alice2/pchrist/HeavyIons/Data/2011/Set";
+ filename += i; filename += "/AliAOD.root";
+ chain->Add(filename.Data());
+ }
+ }
+ else if((!bAOD)&&(bMCtruth)) {
+ chain = new TChain("TE");
+ for(Int_t i = 10; i < 99; i++) {
+ filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";
+ filename += i;
+ filename += "/galice.root";
+ chain->Add(filename.Data());
+ }
+ }
+ else if((bAOD)&&(bMCtruth)) { //used for MCAOD
+ chain = new TChain("aodTree");
+ for(Int_t i = 10; i < 99; i++) {
+ filename = "/project/alice/users/alisrm/Efficiency_Contamination/LHC13b3_HIJING_pA_AOD/";
+ filename += i;
+ filename += "/AliAOD.root";
+ chain->Add(filename.Data());
+ }
+ }
+
+
+ }//local mode
+
+ // input handler (ESD or AOD)
+ AliVEventHandler* inputH = NULL;
+ if(!bAOD){
+ inputH = new AliESDInputHandler();
+ }
+ else{
+ inputH = new AliAODInputHandler();
+ }
+ mgr->SetInputEventHandler(inputH);
+
+ // mc event handler
+ if(bMCtruth) {
+ AliMCEventHandler* mchandler = new AliMCEventHandler();
+ // Not reading track references
+ mchandler->SetReadTR(kFALSE);
+ mgr->SetMCtruthEventHandler(mchandler);
+ }
+
+ // AOD output handler
+ //AliAODHandler* aodoutHandler = new AliAODHandler();
+ //aodoutHandler->SetOutputFileName("aod.root");
+ //mgr->SetOutputEventHandler(aodoutHandler);
+
+ // === Physics Selection Task ===
+ //
+ // In SelectCollisionCandidate(), default is kMB, so the task UserExec()
+ // function is only called for these events.
+ // Options are:
+ // kMB Minimum Bias trigger
+ // kMBNoTRD Minimum bias trigger where the TRD is not read out
+ // kMUON Muon trigger
+ // kHighMult High-Multiplicity Trigger
+ // kUserDefined For manually defined trigger selection
+ //
+ // Multiple options possible with the standard AND/OR operators && and ||
+ // These all have the usual offline SPD or V0 selections performed.
+ //
+ // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(),
+ // one can manually set the selected and background classes using:
+ // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL")
+ // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL");
+ //
+ // One can also specify multiple classes at once, or require a class to NOT
+ // trigger, for e.g.
+ // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL");
+ //
+ // NOTE that manually setting the physics selection overrides the standard
+ // selection, so it must be done in completeness.
+ //
+ // ALTERNATIVELY, one can make the physics selection inside the task
+ // UserExec().
+ // For this case, comment out the task->SelectCol.... line,
+ // and see AliBasicTask.cxx UserExec() function for details on this.
+
+ //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+ //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);
+ //if(!physSelTask) { Printf("no physSelTask"); return; }
+ //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection();
+ //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769");
+
+ // create task
+ //Add the centrality determination task and the physics selection
+ // (only on ESD level, in AODs centrality is already in header and events are selected)
+// if((!bAOD)&&(!bMCtruth)){
+// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
+// AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
+
+ // Add physics selection task (NOT needed for AODs)
+// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+// AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(bMCphyssel);
+// }
+/////////////////////////////////////////
+ //Add flow centrality bayesian
+
+ gROOT->LoadMacro("AddTaskFlowHigherOrdersAllPID.C");
+ //gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskFlowHigherOrdersAllPID.C");
+ // gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskFlowCentralityBayesian.C");
+ // gROOT->LoadMacro("~/Desktop/work/PhD/flow/AddTaskFlowCentralityBayesian.C");
+ AliAnalysisTaskFlowEvent* FlowTask = AddTaskFlowHigherOrdersAllPID(AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB,0.,80.,"AnalysisResults",kTRUE,768,768,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,kFALSE,-0.8,0.8,"");
+/////////////////////////////////////////
+
+ //Add the PID response
+// if((kUsePID)||(kNSigmaElectronRejection)) {
+// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+// AddTaskPIDResponse(bMCphyssel);
+// }
+
+ //Add the VZERO event plane task
+// gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
+// AliVZEROEPSelectionTask* epSelTask = AddTaskVZEROEPSelection();
+
+ //Add the BF task (all centralities)
+ // gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/AddTaskBalancePsiCentralityTrain.C");
+
+// AliAnalysisTaskBFPsi *taskBF = AddTaskBalancePsiCentralityTrain(0, 500, kFALSE, kTRUE, kFALSE, "V0M", 10, -1, -1, 0.2, 20.0, -0.8, 0.8, -1, -1, kUsePID, kFALSE, kTRUE, 0.02, kFALSE, 0.04, kTRUE, 0.1, 128, 1, "AnalysisResults","TE","Multiplicity","AOD",kTRUE, kNSigmaElectronRejection);
+ //taskBF->SetDebugLevel();
+
+ // enable debug printouts
+ //mgr->SetDebugLevel(2);
+ //mgr->SetUseProgressBar(1,100);
+ if (!mgr->InitAnalysis()) return;
+ mgr->PrintStatus();
+
+ // start analysis
+ Printf("Starting Analysis....");
+ if(runtype == "local")
+ mgr->StartAnalysis("local",chain);
+ else
+ mgr->StartAnalysis(runtype,nentries,firstentry);
+}
+
+//______________________________________________________________________________
+AliAnalysisGrid* CreateAlienHandler(Bool_t bAOD, Int_t bunchN, const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)
+{
+ AliAnalysisAlien *plugin = new AliAnalysisAlien();
+ // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
+ plugin->SetRunMode(gridmode);
+
+ // Set versions of used packages
+ plugin->SetAPIVersion("V1.1x");
+ plugin->SetROOTVersion("v5-34-08");
+ plugin->SetAliROOTVersion("v5-05-19-AN");
+
+ // Declare input data to be processed.
+
+ // Method 1: Create automatically XML collections using alien 'find' command.
+ // Define production directory LFN
+ plugin->SetGridDataDir("/alice/data/2010/LHC10h/");
+ // On real reconstructed data:
+ // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
+
+ // Set data search pattern
+ //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
+ // Data pattern for reconstructed data
+ if(!bAOD){
+ plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
+ }
+ else{
+ plugin->SetDataPattern("*ESDs/pass2/AOD086/*/AliAOD.root");
+ }
+
+ plugin->SetRunPrefix("000"); // real data
+ // ...then add run numbers to be considered
+ //plugin->SetRunRange(114917,115322);
+
+ if(bunchN==0){
+ plugin->AddRunNumber(137366);
+ }
+
+ //bunch1
+ else if(bunchN == 1){
+ plugin->AddRunNumber(139510);
+ plugin->AddRunNumber(139507);
+ plugin->AddRunNumber(139505);
+ plugin->AddRunNumber(139503);
+ plugin->AddRunNumber(139465);
+ plugin->AddRunNumber(139438);
+ plugin->AddRunNumber(139437);
+ plugin->AddRunNumber(139360);
+ plugin->AddRunNumber(139329);
+ plugin->AddRunNumber(139328);
+ }
+
+ //bunch2
+ else if(bunchN == 2){
+ plugin->AddRunNumber(139314);
+ plugin->AddRunNumber(139310);
+ plugin->AddRunNumber(139309);
+ plugin->AddRunNumber(139173);
+ plugin->AddRunNumber(139107);
+ plugin->AddRunNumber(139105);
+ plugin->AddRunNumber(139038);
+ plugin->AddRunNumber(139037);
+ plugin->AddRunNumber(139036);
+ plugin->AddRunNumber(139029);
+ plugin->AddRunNumber(139028);
+ plugin->AddRunNumber(138872);
+ plugin->AddRunNumber(138871);
+ plugin->AddRunNumber(138870);
+ plugin->AddRunNumber(138837);
+ plugin->AddRunNumber(138732);
+ plugin->AddRunNumber(138730);
+ plugin->AddRunNumber(138666);
+ plugin->AddRunNumber(138662);
+ plugin->AddRunNumber(138653);
+ }
+
+ else if(bunchN == 3){
+ plugin->AddRunNumber(138652);
+ plugin->AddRunNumber(138638);
+ plugin->AddRunNumber(138624);
+ plugin->AddRunNumber(138621);
+ plugin->AddRunNumber(138583);
+ plugin->AddRunNumber(138582);
+ plugin->AddRunNumber(138579);
+ plugin->AddRunNumber(138578);
+ plugin->AddRunNumber(138534);
+ plugin->AddRunNumber(138469);
+ }
+
+ else if(bunchN == 4){
+
+ plugin->AddRunNumber(138442);
+ plugin->AddRunNumber(138439);
+ plugin->AddRunNumber(138438);
+ plugin->AddRunNumber(138396);
+ plugin->AddRunNumber(138364);
+ plugin->AddRunNumber(138275);
+ plugin->AddRunNumber(138225);
+ plugin->AddRunNumber(138201);
+ plugin->AddRunNumber(138197);
+ plugin->AddRunNumber(138192);
+ }
+
+ else if(bunchN == 5){
+
+ plugin->AddRunNumber(138190);
+ plugin->AddRunNumber(137848);
+ plugin->AddRunNumber(137844);
+ plugin->AddRunNumber(137752);
+ plugin->AddRunNumber(137751);
+ plugin->AddRunNumber(137724);
+ plugin->AddRunNumber(137722);
+ plugin->AddRunNumber(137718);
+ plugin->AddRunNumber(137704);
+ plugin->AddRunNumber(137693);
+ }
+
+ else if(bunchN == 6){
+
+ plugin->AddRunNumber(137692);
+ plugin->AddRunNumber(137691);
+ plugin->AddRunNumber(137686);
+ plugin->AddRunNumber(137685);
+ plugin->AddRunNumber(137639);
+ plugin->AddRunNumber(137638);
+ plugin->AddRunNumber(137608);
+ plugin->AddRunNumber(137595);
+ plugin->AddRunNumber(137549);
+ plugin->AddRunNumber(137546);
+
+ }
+
+ else if(bunchN == 7){
+
+ plugin->AddRunNumber(137544);
+ plugin->AddRunNumber(137541);
+ plugin->AddRunNumber(137539);
+ plugin->AddRunNumber(137531);
+ plugin->AddRunNumber(137530);
+ plugin->AddRunNumber(137443);
+ plugin->AddRunNumber(137441);
+ plugin->AddRunNumber(137440);
+ plugin->AddRunNumber(137439);
+ plugin->AddRunNumber(137434);
+
+ }
+
+ else if(bunchN == 8){
+
+ plugin->AddRunNumber(137432);
+ plugin->AddRunNumber(137431);
+ plugin->AddRunNumber(137430);
+ plugin->AddRunNumber(137366);
+ plugin->AddRunNumber(137243);
+ plugin->AddRunNumber(137236);
+ plugin->AddRunNumber(137235);
+ plugin->AddRunNumber(137232);
+ plugin->AddRunNumber(137231);
+ plugin->AddRunNumber(137162);
+ plugin->AddRunNumber(137161);
+ }
+
+ else{
+
+ stderr<<"BUNCH NOT THERE"<<endl;
+ return NULL;
+
+ }
+
+ //plugin->AddRunList("139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137162, 137161");
+
+
+
+
+
+ plugin->SetNrunsPerMaster(1);
+ plugin->SetOutputToRunNo();
+ // comment out the next line when using the "terminate" option, unless
+ // you want separate merged files for each run
+ plugin->SetMergeViaJDL();
+
+ // Method 2: Declare existing data files (raw collections, xml collections, root file)
+ // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
+ // XML collections added via this method can be combined with the first method if
+ // the content is compatible (using or not tags)
+ // plugin->AddDataFile("tag.xml");
+ // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
+
+ // Define alien work directory where all files will be copied. Relative to alien $HOME.
+ plugin->SetGridWorkingDir(taskname);
+
+ // Declare alien output directory. Relative to working directory.
+ plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
+
+ // Declare the analysis source files names separated by blancs. To be compiled runtime
+ // using ACLiC on the worker nodes.
+ plugin->SetAnalysisSource("AliBalance.cxx AliAnalysisTaskBF.cxx");
+
+ // Declare all libraries (other than the default ones for the framework. These will be
+ // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
+ //plugin->AddIncludePath("-I.");
+ //plugin->SetAdditionalLibs("libPWGCFebye.so");
+ plugin->SetAdditionalLibs("AliBalance.cxx AliBalance.h AliAnalysisTaskBF.cxx AliAnalysisTaskBF.h");
+
+ // Declare the output file names separated by blancs.
+ // (can be like: file.root or file.root@ALICE::Niham::File)
+ // To only save certain files, use SetDefaultOutputs(kFALSE), and then
+ // SetOutputFiles("list.root other.filename") to choose which files to save
+ plugin->SetDefaultOutputs();
+ //plugin->SetOutputFiles("list.root");
+
+ // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
+ plugin->SetAnalysisMacro(Form("%s.C",taskname));
+
+ // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
+ plugin->SetSplitMaxInputFileNumber(100);
+
+ // Optionally modify the executable name (default analysis.sh)
+ plugin->SetExecutable(Form("%s.sh",taskname));
+
+ // set number of test files to use in "test" mode
+ plugin->SetNtestFiles(1);
+
+ // Optionally resubmit threshold.
+ plugin->SetMasterResubmitThreshold(90);
+
+ // Optionally set time to live (default 30000 sec)
+ plugin->SetTTL(90000);
+
+ // Optionally set input format (default xml-single)
+ plugin->SetInputFormat("xml-single");
+
+ // Optionally modify the name of the generated JDL (default analysis.jdl)
+ plugin->SetJDLName(Form("%s.jdl",taskname));
+
+ // Optionally modify job price (default 1)
+ plugin->SetPrice(1);
+
+ // Optionally modify split mode (default 'se')
+ plugin->SetSplitMode("se");
+
+ //plugin->SetUseSubmitPolicy();
+ //plugin->SetKeepLogs();
+
+ //----------------------------------------------------------
+ //--- PROOF MODE SPECIFIC SETTINGS ------------
+ //----------------------------------------------------------
+ // Proof cluster
+ plugin->SetProofCluster(proofcluster);
+ // Dataset to be used
+ plugin->SetProofDataSet(proofdataset);
+ // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
+ plugin->SetProofReset(0);
+ // May limit number of workers
+ plugin->SetNproofWorkers(0);
+ // May limit the number of workers per slave
+ plugin->SetNproofWorkersPerSlave(1);
+ // May use a specific version of root installed in proof
+ plugin->SetRootVersionForProof("current");
+ // May set the aliroot mode. Check http://aaf.cern.ch/node/83
+ plugin->SetAliRootMode("default"); // Loads AF libs by default
+ // May request ClearPackages (individual ClearPackage not supported)
+ plugin->SetClearPackages(kFALSE);
+ // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
+ plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc
+ // Request connection to alien upon connection to grid
+ plugin->SetProofConnectGrid(kFALSE);
+
+ plugin->Print();
+
+ return plugin;
+}
+
-#ifndef ALIDIELECTRONBTOJPSITOELE_H\r
-#define ALIDIELECTRONBTOJPSITOELE_H\r
-/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-//-------------------------------------------------------------------------\r
-// Class AliDielectronBtoJPSItoEle\r
-// Unbinned log-likelihood fit analysis class\r
-//\r
-// Origin: C.Di Giglio\r
-// Contact: Carmelo.Digiglio@ba.infn.it , giuseppe.bruno@ba.infn.it\r
-//-------------------------------------------------------------------------\r
-\r
-#include "TH1F.h"\r
-\r
-class TNtuple ;\r
-class AliDielectronBtoJPSItoEleCDFfitHandler ; \r
-class AliDielectronBtoJPSItoEleCDFfitFCN ; \r
-\r
-class AliDielectronBtoJPSItoEle : public TNamed {\r
- public:\r
- //\r
- AliDielectronBtoJPSItoEle();\r
- AliDielectronBtoJPSItoEle(const AliDielectronBtoJPSItoEle& source);\r
- AliDielectronBtoJPSItoEle& operator=(const AliDielectronBtoJPSItoEle& source);\r
- virtual ~AliDielectronBtoJPSItoEle();\r
-\r
- Int_t DoMinimization(Int_t step = 0);\r
- void ReadCandidates(TNtuple* nt, Double_t* &x, Double_t* &m, Double_t* &pt, Int_t * &typeCand, Int_t& n,Double_t massLow = -1., Double_t massUp = -1., Double_t ptLow = -1., Double_t ptUp = -1.); // primary JPSI + secondary JPSI + bkg couples\r
-\r
- void SetCsiMC();\r
- void SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Double_t *pt /*transverse momentum */, Int_t *type /*type*/, Int_t ncand /*candidates*/); \r
- void CloneMCtemplate(const TH1F* MCtemplate) {fMCtemplate = (TH1F*)MCtemplate->Clone("fMCtemplate");}\r
- void SetResTypeAnalysis(TString resType){fResType = resType;}\r
- Double_t* GetResolutionConstants(Double_t* resolutionConst);\r
- AliDielectronBtoJPSItoEleCDFfitHandler* GetCDFFitHandler() const { return fFCNfunction ; }\r
-\r
- private:\r
- //\r
- AliDielectronBtoJPSItoEleCDFfitHandler* fFCNfunction; //! pointer to the interface class\r
- TH1F* fMCtemplate; //! template of the MC distribution for the x distribution of the secondary J/psi\r
- TString fResType; // string with candidate's types considered\r
-\r
- ClassDef(AliDielectronBtoJPSItoEle,1); // AliDielectronBtoJPSItoEle class\r
-};\r
-\r
-#endif\r
+#ifndef ALIDIELECTRONBTOJPSITOELE_H
+#define ALIDIELECTRONBTOJPSITOELE_H
+/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//-------------------------------------------------------------------------
+// Class AliDielectronBtoJPSItoEle
+// Unbinned log-likelihood fit analysis class
+//
+// Origin: C.Di Giglio
+// Contact: Carmelo.Digiglio@ba.infn.it , giuseppe.bruno@ba.infn.it
+//-------------------------------------------------------------------------
+
+#include "TH1F.h"
+
+class TNtuple ;
+class AliDielectronBtoJPSItoEleCDFfitHandler ;
+class AliDielectronBtoJPSItoEleCDFfitFCN ;
+
+class AliDielectronBtoJPSItoEle : public TNamed {
+ public:
+ //
+ AliDielectronBtoJPSItoEle();
+ AliDielectronBtoJPSItoEle(const AliDielectronBtoJPSItoEle& source);
+ AliDielectronBtoJPSItoEle& operator=(const AliDielectronBtoJPSItoEle& source);
+ virtual ~AliDielectronBtoJPSItoEle();
+
+ Int_t DoMinimization(Int_t step = 0);
+ void ReadCandidates(TNtuple* nt, Double_t* &x, Double_t* &m, Double_t* &pt, Int_t * &typeCand, Int_t& n,Double_t massLow = -1., Double_t massUp = -1., Double_t ptLow = -1., Double_t ptUp = -1.); // primary JPSI + secondary JPSI + bkg couples
+
+ void SetCsiMC();
+ void SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Double_t *pt /*transverse momentum */, Int_t *type /*type*/, Int_t ncand /*candidates*/);
+ void CloneMCtemplate(const TH1F* MCtemplate) {fMCtemplate = (TH1F*)MCtemplate->Clone("fMCtemplate");}
+ void SetResTypeAnalysis(TString resType){fResType = resType;}
+ Double_t* GetResolutionConstants(Double_t* resolutionConst);
+ AliDielectronBtoJPSItoEleCDFfitHandler* GetCDFFitHandler() const { return fFCNfunction ; }
+
+ private:
+ //
+ AliDielectronBtoJPSItoEleCDFfitHandler* fFCNfunction; //! pointer to the interface class
+ TH1F* fMCtemplate; //! template of the MC distribution for the x distribution of the secondary J/psi
+ TString fResType; // string with candidate's types considered
+
+ ClassDef(AliDielectronBtoJPSItoEle,1); // AliDielectronBtoJPSItoEle class
+};
+
+#endif
-#ifndef ALIDIELECTRONBTOJPSITOELECDFFITFCN_H\r
-#define ALIDIELECTRONBTOJPSITOELECDFFITFCN_H\r
-/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-//_________________________________________________________________________\r
-// Class AliDielectronBtoJPSItoEleCDFfitFCN\r
-// Definition of main function used in \r
-// unbinned log-likelihood fit for\r
-// the channel B -> JPsi + X -> e+e- + X\r
-// \r
-// Origin: C.Di Giglio\r
-// Contact: Carmelo.Digiglio@ba.infn.it , Giuseppe.Bruno@ba.infn.it\r
-//_________________________________________________________________________\r
-\r
-#include <TNamed.h>\r
-#include <TDatabasePDG.h>\r
-#include <TH1F.h>\r
-\r
-\r
-class TRandom3;\r
-class TF1;\r
-\r
-//_________________________________________________________________________________________________\r
-class AliDielectronBtoJPSItoEleCDFfitFCN : public TNamed {\r
- public:\r
- //\r
- AliDielectronBtoJPSItoEleCDFfitFCN();\r
- AliDielectronBtoJPSItoEleCDFfitFCN(const AliDielectronBtoJPSItoEleCDFfitFCN& source); \r
- AliDielectronBtoJPSItoEleCDFfitFCN& operator=(const AliDielectronBtoJPSItoEleCDFfitFCN& source); \r
- virtual ~AliDielectronBtoJPSItoEleCDFfitFCN();\r
-\r
- Double_t EvaluateLikelihood(const Double_t* pseudoproperdecaytime,\r
- const Double_t* invariantmass, const Double_t* pt, const Int_t* type, const Int_t ncand) const;\r
-\r
- // getters for parameters\r
- Double_t GetResWeight() const { return fParameters[0]; }\r
- Double_t GetFPlus() const { return fParameters[1]; }\r
- Double_t GetFMinus() const { return fParameters[2]; }\r
- Double_t GetFSym() const { return fParameters[3]; } \r
- Double_t GetFSym1() const { return fParameters[46]; }\r
- Double_t GetLamPlus() const { return fParameters[4]; }\r
- Double_t GetLamMinus() const { return fParameters[5]; }\r
- Double_t GetLamSym() const { return fParameters[6]; }\r
- Double_t GetLamSym1() const { return fParameters[45]; }\r
- Double_t GetFractionJpsiFromBeauty() const { return fParameters[7]; }\r
- Double_t GetFsig() const { return fParameters[8]; }\r
- Double_t GetCrystalBallMmean() const { return fParameters[9]; }\r
- Double_t GetCrystalBallNexp() const { return fParameters[10]; }\r
- Double_t GetCrystalBallSigma() const { return fParameters[11]; }\r
- Double_t GetCrystalBallAlpha() const { return fParameters[12]; }\r
- Double_t GetCrystalBallNorm() const { return fParameters[13]; }\r
- Double_t GetBkgInvMassNorm() const { return fParameters[14]; }\r
- Double_t GetBkgInvMassMean() const { return fParameters[15]; }\r
- Double_t GetBkgInvMassSlope() const { return fParameters[16]; } \r
- Double_t GetBkgInvMassConst() const { return fParameters[17]; } \r
- Double_t GetNormGaus1ResFunc(Int_t type) const { return fParameters[18+(2-type)*9]; }\r
- Double_t GetNormGaus2ResFunc(Int_t type) const { return fParameters[19+(2-type)*9]; }\r
- Double_t GetIntegralMassSig() const { return fintmMassSig; }\r
- Double_t GetIntegralMassBkg() const { return fintmMassBkg; }\r
- Double_t GetResMean1(Int_t type) const { return fParameters[20+(2-type)*9]; } \r
- Double_t GetResSigma1(Int_t type) const { return fParameters[21+(2-type)*9]; }\r
- Double_t GetResMean2(Int_t type) const { return fParameters[22+(2-type)*9]; }\r
- Double_t GetResSigma2(Int_t type) const { return fParameters[23+(2-type)*9]; }\r
- Double_t GetResAlfa(Int_t type) const { return fParameters[24+(2-type)*9]; } \r
- Double_t GetResLambda(Int_t type) const { return fParameters[25+(2-type)*9]; } \r
- Double_t GetResNormExp(Int_t type) const { return fParameters[26+(2-type)*9]; }\r
- Double_t GetPolyn4() const { return fParameters[47]; }\r
- Double_t GetPolyn5() const { return fParameters[48]; }\r
- Bool_t GetCrystalBallParam() const { return fCrystalBallParam; }\r
- Bool_t GetExponentialParam() const { return fExponentialParam; }\r
- TH1F * GetCsiMcHisto() const { return fhCsiMC; }\r
- Double_t GetResWeight(Int_t iW) const { return fWeightType[iW]; }\r
-\r
- // return pointer to likelihood functions \r
- TF1* GetCsiMC(Double_t xmin, Double_t xmax,Double_t normalization);\r
- TF1* GetResolutionFunc(Double_t xmin, Double_t xmax,Double_t normalization, Double_t pt, Int_t type=2);\r
- TF1* GetResolutionFuncAllTypes(Double_t xmin, Double_t xmax,Double_t normalization);\r
- TF1* GetFunB(Double_t xmin, Double_t xmax, Double_t normalization, Double_t pt, Int_t type=2, Int_t npx = 5000);\r
- TF1* GetFunBAllTypes(Double_t xmin, Double_t xmax, Double_t normalization);\r
- TF1* GetEvaluateCDFDecayTimeBkgDistr(Double_t xmin, Double_t xmax, Double_t normalization, Int_t type = 2, Double_t mass = 3.09, Double_t pt = 200.,Int_t npx = 5000);\r
- TF1* GetEvaluateCDFDecayTimeBkgDistrAllTypes(Double_t xmin, Double_t xmax, Double_t normalization);\r
- TF1* GetEvaluateCDFDecayTimeSigDistr(Double_t xmin, Double_t xmax, Double_t normalization, Double_t type);\r
- TF1* GetEvaluateCDFInvMassBkgDistr(Double_t mMin, Double_t mMax, Double_t normalization);\r
- TF1* GetEvaluateCDFInvMassSigDistr(Double_t mMin, Double_t mMax, Double_t normalization);\r
- TF1* GetEvaluateCDFInvMassTotalDistr(Double_t mMin, Double_t mMax, Double_t normalization);\r
- TF1* GetEvaluateCDFDecayTimeTotalDistr(Double_t xMin, Double_t xMax, Double_t normalization,Double_t pt = 200., Int_t type=2);\r
- TF1 *GetEvaluateCDFDecayTimeTotalDistrAllTypes(Double_t xMin, Double_t xMax, Double_t normalization);\r
-\r
- void SetResWeight(Double_t resWgt) {fParameters[0] = resWgt;}\r
- void SetFPlus(Double_t plus) {fParameters[1] = plus;}\r
- void SetFMinus(Double_t minus) {fParameters[2] = minus;}\r
- void SetFSym(Double_t sym) {fParameters[3] = sym;}\r
- void SetFSym1(Double_t sym) {fParameters[46] = sym;}\r
- void SetLamPlus(Double_t lamplus) {fParameters[4] = lamplus;}\r
- void SetLamMinus(Double_t lamminus) {fParameters[5] = lamminus;}\r
- void SetLamSym(Double_t lamsym) {fParameters[6] = lamsym;}\r
- void SetLamSym1(Double_t lamsym) {fParameters[45] = lamsym;}\r
- void SetFractionJpsiFromBeauty(Double_t B) {fParameters[7] = B;}\r
- void SetFsig(Double_t Fsig) {fParameters[8] = Fsig;}\r
- void SetCrystalBallMmean(Double_t CrystalBallMmean) {fParameters[9] = CrystalBallMmean;}\r
- void SetCrystalBallNexp(Double_t CrystalBallNexp) {fParameters[10] = CrystalBallNexp;}\r
- void SetCrystalBallSigma(Double_t CrystalBallSigma) {fParameters[11] = CrystalBallSigma;}\r
- void SetCrystalBallAlpha(Double_t CrystalBallAlpha) {fParameters[12] = CrystalBallAlpha;}\r
- void SetCrystalBallNorm(Double_t CrystalBallNorm) {fParameters[13] = CrystalBallNorm;}\r
- void SetBkgInvMassNorm(Double_t BkgInvMassNorm) {fParameters[14] = BkgInvMassNorm;}\r
- void SetBkgInvMassMean(Double_t BkgInvMassMean) {fParameters[15] = BkgInvMassMean;}\r
- void SetBkgInvMassSlope(Double_t BkgInvMassSlope) {fParameters[16] = BkgInvMassSlope;}\r
- void SetBkgInvMassConst(Double_t BkgInvMassConst) {fParameters[17] = BkgInvMassConst;}\r
- void SetBkgInvMassPolyn4(Double_t coeffPol4) {fParameters[47] = coeffPol4;}\r
- void SetBkgInvMassPolyn5(Double_t coeffPol5) {fParameters[48] = coeffPol5;}\r
- void SetNormGaus1ResFunc(Double_t norm1) {fParameters[18] = norm1;}\r
- void SetNormGaus2ResFunc(Double_t norm2) {fParameters[19] = norm2;}\r
- void SetAllParameters(const Double_t* parameters);\r
- void SetIntegralMassSig(Double_t integral) { fintmMassSig = integral; }\r
- void SetIntegralMassBkg(Double_t integral) { fintmMassBkg = integral; }\r
- void SetCsiMC(const TH1F* MCtemplate) {fhCsiMC = (TH1F*)MCtemplate->Clone("fhCsiMC");}\r
- void SetTemplateShift(Double_t shift = 0.){fShiftTemplate = shift;}\r
- \r
- void SetResolutionConstants(const Double_t* resolutionConst, Int_t type);\r
- void SetMassWndHigh(Double_t limit) { fMassWndHigh = TDatabasePDG::Instance()->GetParticle(443)->Mass() + limit ;}\r
- void SetMassWndLow(Double_t limit) { fMassWndLow = TDatabasePDG::Instance()->GetParticle(443)->Mass() - limit ;}\r
- void SetCrystalBallFunction(Bool_t okCB) {fCrystalBallParam = okCB;}\r
- void SetExponentialFunction(Bool_t okExp) {fExponentialParam = okExp;}\r
- \r
- void SetWeightType(Double_t wFF, Double_t wFS, Double_t wSS) {fWeightType[0]= wSS; fWeightType[1]= wFS; fWeightType[2]= wFF;}\r
-\r
- void SetChangeResolution(Double_t change){fChangeResolution = change;} \r
- void SetChangeMass(Double_t change){fChangeMass = change;} \r
- void ComputeMassIntegral(); \r
- void ReadMCtemplates(Int_t BinNum);\r
- void PrintStatus();\r
-\r
- //specific methods for multi-variational fit\r
- void SetBkgWeights(Double_t ***bkgWgt){for(int kpt=0; kpt<(fPtWindows->GetSize()-1); kpt++){for(int k=0; k<(fMassWindows->GetSize()-2); k++) { for(int ktype=0; ktype<3; ktype++) fWeights[k][kpt][ktype]=bkgWgt[k][kpt][ktype]; }}}\r
- \r
- void SetBkgFunction(Int_t massRange,Int_t type, Int_t ptB, TF1 *histBkg){\r
- fFunBkgSaved[ptB][massRange][type] = histBkg;\r
- }\r
- TF1 *GetBkgFunction(Int_t massRange, Int_t ptB, Int_t type) const {return fFunBkgSaved[ptB][massRange][type];} \r
- void SetFunBFunction(Int_t type, Int_t ptB, TF1 *histSec) { fFunBSaved[ptB][type] = histSec; }\r
- void SetBackgroundSpecificParameters(Int_t pt, Int_t mb, Int_t tp);\r
- void SetExtrapolationRegion(Int_t extrRegion){fSignalBinForExtrapolation = extrRegion;} void SetLoadFunction(Bool_t loadFunc) { fLoadFunctions = loadFunc;}\r
- void SetMultivariateFit(Bool_t multVar) { fMultivariate = multVar;}\r
- Bool_t GetMultivariate() const { return fMultivariate;} \r
- void SetFunctionsSaved(Int_t npxFunB=5000, Int_t npxFunBkg=5000, Double_t funBLimits = 20000., Double_t funBkgLimits = 40000., Int_t signalRegion=2);\r
- void SetResParams(Double_t ***pars){ fResParams = pars;}\r
- void SetBkgParams(Float_t ****pars){ fBkgParams = pars;}\r
- void SetMassWindows(TArrayD *msWnd){ fMassWindows = msWnd;}\r
- void SetPtWindows(TArrayD *ptWnd){ fPtWindows = ptWnd;}\r
- void InitializeFunctions(Int_t ptSize, Int_t massSize);\r
- Double_t EvaluateCDFInvMassSigDistr(Double_t m) const ;\r
- Double_t EvaluateCDFInvMassBkgDistr(Double_t m) const;\r
- Double_t ResolutionFunc(Double_t x, Double_t pt, Int_t type) const;\r
- Double_t EvaluateCDFDecayTimeBkgDistr(Double_t x, Int_t type, Double_t m=3.09, Double_t pt=200.) const ;\r
- \r
-\r
- private: \r
- Double_t fParameters[49]; /* par[0] = weightRes; \r
- par[1] = fPos;\r
- par[2] = fNeg;\r
- par[3] = fSym\r
- par[4] = fOneOvLamPlus;\r
- par[5] = fOneOvLamMinus;\r
- par[6] = fOneOvLamSym;\r
- par[7] = fFractionJpsiFromBeauty;\r
- par[8] = fFsig;\r
- par[9] = fCrystalBallMmean;\r
- par[10] = fCrystalBallNexp;\r
- par[11] = fCrystalBallSigma;\r
- par[12] = fCrystalBallAlpha;\r
- par[13] = fCrystalBallNorm;\r
- par[14] = fBkgNorm;\r
- par[15] = fBkgMean; \r
- par[16] = fBkgSlope;\r
- par[17] = fBkgConst;\r
- par[18] = norm1Gaus; // resolution param used for First-First\r
- par[19] = norm2Gaus;\r
- par[20] = fMean1ResFunc;\r
- par[21] = fSigma1ResFunc;\r
- par[22] = fMean2ResFunc;\r
- par[23] = fSigma2ResFunc;\r
- par[24] = fResAlfa; \r
- par[25] = fResLambda;\r
- par[26] = fResNormExp;\r
- par[27] = norm1Gaus; // resolution param used for First-Second\r
- par[28] = norm2Gaus;\r
- par[29] = fMean1ResFunc;\r
- par[30] = fSigma1ResFunc;\r
- par[31] = fMean2ResFunc;\r
- par[32] = fSigma2ResFunc;\r
- par[33] = fResAlfa; \r
- par[34] = fResLambda;\r
- par[35] = fResNormExp;\r
- par[36] = norm1Gaus; // resolution param used for Second-Second\r
- par[37] = norm2Gaus;\r
- par[38] = fMean1ResFunc;\r
- par[39] = fSigma1ResFunc;\r
- par[40] = fMean2ResFunc;\r
- par[41] = fSigma2ResFunc;\r
- par[42] = fResAlfa; \r
- par[43] = fResLambda;\r
- par[44] = fResNormExp; \r
- ------------------------------> parameters to describe x and m à la CDF\r
- // additional parameters below (added for PbPb analysis): if not used should be fixed\r
- // by the FitHandler pointer\r
- par[45] = fOneOvLamSym1; // additional parameter for background\r
- par[46] = fSym1; // additional parameter for background\r
- par[47] = fPolyn4; //additional parameter for inv. mass background\r
- par[48] = fPolyn5; //additional parameter for inv. mass background */\r
- \r
- Double_t fFPlus; // parameter of the log-likelihood function\r
- Double_t fFMinus; // slopes of the x distributions of the background \r
- Double_t fFSym; // functions \r
-\r
- Double_t fintmMassSig; // integral of invariant mass distribution for the signal\r
- Double_t fintmMassBkg; // integral of invariant mass distribution for the bkg\r
-\r
- TH1F *fhCsiMC; // X distribution used as MC template for JPSI from B\r
-\r
- Double_t fShiftTemplate; // to shift the MC template\r
- Double_t fMassWndHigh; // JPSI Mass window higher limit\r
- Double_t fMassWndLow; // JPSI Mass window lower limit\r
- Bool_t fCrystalBallParam; // Boolean to switch to Crystall Ball parameterisation\r
-\r
- Double_t fWeightType[3]; // vector with weights of candidates types (used to draw functions) \r
- Double_t fChangeResolution; // constant to change the RMS of the resolution function\r
- Double_t fChangeMass; // constant to change the RMS of the signal mass function\r
- \r
- // data members for multivariate fit\r
- Double_t ***fWeights; // weights to interpolate bkg shape in pt, mass, type bins under signal region\r
- Bool_t fLoadFunctions; // boolean to load functions saved \r
- Bool_t fMultivariate; // switch-on multivariate fit\r
- TF1 ***fFunBSaved; // pointers to save functions for x of non-prompt J/psi in pt, mass, type bins\r
- TF1 ****fFunBkgSaved; // pointers to save functions for x of background in pt, mass, type bins\r
- Double_t ***fResParams; // resolution function parameters in pt and type bins\r
- Float_t ****fBkgParams; // x background parameters in pt, mass, type bins\r
- TArrayD *fMassWindows; // limits for invariant mass bins\r
- TArrayD *fPtWindows; // limits for pt bins\r
- Bool_t fExponentialParam; // Boolean to switch to Exponential parameterisation\r
- Double_t fSignalBinForExtrapolation; // inv. mass region in which extrapolate the background shape\r
- // starting from background shapes in the near inv. mass regions\r
-\r
-\r
- Double_t EvaluateCDFfunc(Double_t x, Double_t m, Double_t pt, Int_t type) const ;\r
- Double_t EvaluateCDFfuncNorm(Double_t x, Double_t m, Double_t pt, Int_t type) const ;\r
- Double_t EvaluateCDFfuncSignalPart(Double_t x, Double_t m, Double_t pt, Int_t type) const ; // Signal part \r
- Double_t EvaluateCDFDecayTimeSigDistr(Double_t x, Double_t pt, Int_t type) const ;\r
- Double_t EvaluateCDFDecayTimeSigDistrFunc(const Double_t* x, const Double_t *par) const { return par[0]*EvaluateCDFDecayTimeSigDistr(x[0],par[1],(Int_t)par[2]);}\r
- Double_t EvaluateCDFInvMassSigDistrFunc(const Double_t* x, const Double_t *par) const {return par[0]*EvaluateCDFInvMassSigDistr(x[0])/fintmMassSig;}\r
- Double_t EvaluateCDFfuncBkgPart(Double_t x,Double_t m, Double_t pt, Int_t type) const ; // Background part\r
- Double_t EvaluateCDFDecayTimeBkgDistrFunc(const Double_t* x, const Double_t *par) const { return EvaluateCDFDecayTimeBkgDistr(x[0],(Int_t)par[1],par[2],par[3])*par[0];}\r
- Double_t EvaluateCDFDecayTimeBkgDistrFuncAllTypes(const Double_t* x, const Double_t *par) const {return (fWeightType[2]*EvaluateCDFDecayTimeBkgDistr(x[0],2)+fWeightType[1]*EvaluateCDFDecayTimeBkgDistr(x[0],1)+fWeightType[0]*EvaluateCDFDecayTimeBkgDistr(x[0],0))*par[0];}\r
- Double_t EvaluateCDFInvMassBkgDistrFunc(const Double_t* x, const Double_t *par) const {return par[0]*EvaluateCDFInvMassBkgDistr(x[0])/fintmMassBkg;} \r
- \r
- Double_t EvaluateCDFInvMassTotalDistr(const Double_t* x, const Double_t *par) const;\r
- Double_t EvaluateCDFDecayTimeTotalDistr(const Double_t* x, const Double_t *par) const; \r
- ////\r
- Double_t EvaluateCDFDecayTimeTotalDistrAllTypes(const Double_t* x, const Double_t *par) const;\r
-\r
- Double_t FunB(Double_t x, Double_t pt, Int_t type) const;\r
- Double_t FunBfunc(const Double_t *x, const Double_t *par) const {return FunB(x[0],par[1],(Int_t)par[2])*par[0];}\r
- Double_t FunBfuncAllTypes(const Double_t *x, const Double_t *par) const {return (fWeightType[2]*FunB(x[0],200.,2)+fWeightType[1]*FunB(x[0],200.,1)+fWeightType[0]*FunB(x[0],200.,0))*par[0];}\r
- Double_t FunP(Double_t x, Double_t pt,Int_t type) const ;\r
- Double_t CsiMC(Double_t x) const;\r
- Double_t CsiMCfunc(const Double_t* x, const Double_t *par) const { return CsiMC(x[0])*par[0];}\r
- Double_t FunBkgPos(Double_t x, Double_t pt, Int_t type) const ;\r
- Double_t FunBkgNeg(Double_t x, Double_t pt, Int_t type) const ;\r
- Double_t FunBkgSym(Double_t x, Double_t pt, Int_t type) const ;\r
- Double_t FunBkgSym1(Double_t x, Double_t pt, Int_t type) const ;\r
- Double_t ResolutionFuncf(const Double_t* x, const Double_t *par) const { return ResolutionFunc(x[0],par[1],(Int_t)par[2])*par[0];}\r
- Double_t ResolutionFuncAllTypes(const Double_t* x, const Double_t *par) const { return (fWeightType[2]*ResolutionFunc(x[0],200.,2)+fWeightType[1]*ResolutionFunc(x[0],200.,1)+fWeightType[0]*ResolutionFunc(x[0],200.,0))*par[0]; } \r
-\r
- // private methods for multivariate fit \r
- Double_t EvaluateCDFDecayTimeBkgDistrSaved(Double_t x, Int_t type, Double_t m=3.09, Double_t pt = 200.) const ;\r
- Double_t EvaluateCDFDecayTimeBkgDistrDifferential(Double_t x, Int_t type, Double_t m=3.09, Double_t pt = 200.) const;\r
- Double_t FunBsaved(Double_t x, Double_t pt, Int_t type) const;\r
-\r
- ClassDef (AliDielectronBtoJPSItoEleCDFfitFCN,1); // Unbinned log-likelihood fit \r
-\r
-};\r
-\r
-#endif\r
+#ifndef ALIDIELECTRONBTOJPSITOELECDFFITFCN_H
+#define ALIDIELECTRONBTOJPSITOELECDFFITFCN_H
+/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//_________________________________________________________________________
+// Class AliDielectronBtoJPSItoEleCDFfitFCN
+// Definition of main function used in
+// unbinned log-likelihood fit for
+// the channel B -> JPsi + X -> e+e- + X
+//
+// Origin: C.Di Giglio
+// Contact: Carmelo.Digiglio@ba.infn.it , Giuseppe.Bruno@ba.infn.it
+//_________________________________________________________________________
+
+#include <TNamed.h>
+#include <TDatabasePDG.h>
+#include <TH1F.h>
+
+
+class TRandom3;
+class TF1;
+
+//_________________________________________________________________________________________________
+class AliDielectronBtoJPSItoEleCDFfitFCN : public TNamed {
+ public:
+ //
+ AliDielectronBtoJPSItoEleCDFfitFCN();
+ AliDielectronBtoJPSItoEleCDFfitFCN(const AliDielectronBtoJPSItoEleCDFfitFCN& source);
+ AliDielectronBtoJPSItoEleCDFfitFCN& operator=(const AliDielectronBtoJPSItoEleCDFfitFCN& source);
+ virtual ~AliDielectronBtoJPSItoEleCDFfitFCN();
+
+ Double_t EvaluateLikelihood(const Double_t* pseudoproperdecaytime,
+ const Double_t* invariantmass, const Double_t* pt, const Int_t* type, const Int_t ncand) const;
+
+ // getters for parameters
+ Double_t GetResWeight() const { return fParameters[0]; }
+ Double_t GetFPlus() const { return fParameters[1]; }
+ Double_t GetFMinus() const { return fParameters[2]; }
+ Double_t GetFSym() const { return fParameters[3]; }
+ Double_t GetFSym1() const { return fParameters[46]; }
+ Double_t GetLamPlus() const { return fParameters[4]; }
+ Double_t GetLamMinus() const { return fParameters[5]; }
+ Double_t GetLamSym() const { return fParameters[6]; }
+ Double_t GetLamSym1() const { return fParameters[45]; }
+ Double_t GetFractionJpsiFromBeauty() const { return fParameters[7]; }
+ Double_t GetFsig() const { return fParameters[8]; }
+ Double_t GetCrystalBallMmean() const { return fParameters[9]; }
+ Double_t GetCrystalBallNexp() const { return fParameters[10]; }
+ Double_t GetCrystalBallSigma() const { return fParameters[11]; }
+ Double_t GetCrystalBallAlpha() const { return fParameters[12]; }
+ Double_t GetCrystalBallNorm() const { return fParameters[13]; }
+ Double_t GetBkgInvMassNorm() const { return fParameters[14]; }
+ Double_t GetBkgInvMassMean() const { return fParameters[15]; }
+ Double_t GetBkgInvMassSlope() const { return fParameters[16]; }
+ Double_t GetBkgInvMassConst() const { return fParameters[17]; }
+ Double_t GetNormGaus1ResFunc(Int_t type) const { return fParameters[18+(2-type)*9]; }
+ Double_t GetNormGaus2ResFunc(Int_t type) const { return fParameters[19+(2-type)*9]; }
+ Double_t GetIntegralMassSig() const { return fintmMassSig; }
+ Double_t GetIntegralMassBkg() const { return fintmMassBkg; }
+ Double_t GetResMean1(Int_t type) const { return fParameters[20+(2-type)*9]; }
+ Double_t GetResSigma1(Int_t type) const { return fParameters[21+(2-type)*9]; }
+ Double_t GetResMean2(Int_t type) const { return fParameters[22+(2-type)*9]; }
+ Double_t GetResSigma2(Int_t type) const { return fParameters[23+(2-type)*9]; }
+ Double_t GetResAlfa(Int_t type) const { return fParameters[24+(2-type)*9]; }
+ Double_t GetResLambda(Int_t type) const { return fParameters[25+(2-type)*9]; }
+ Double_t GetResNormExp(Int_t type) const { return fParameters[26+(2-type)*9]; }
+ Double_t GetPolyn4() const { return fParameters[47]; }
+ Double_t GetPolyn5() const { return fParameters[48]; }
+ Bool_t GetCrystalBallParam() const { return fCrystalBallParam; }
+ Bool_t GetExponentialParam() const { return fExponentialParam; }
+ TH1F * GetCsiMcHisto() const { return fhCsiMC; }
+ Double_t GetResWeight(Int_t iW) const { return fWeightType[iW]; }
+
+ // return pointer to likelihood functions
+ TF1* GetCsiMC(Double_t xmin, Double_t xmax,Double_t normalization);
+ TF1* GetResolutionFunc(Double_t xmin, Double_t xmax,Double_t normalization, Double_t pt, Int_t type=2);
+ TF1* GetResolutionFuncAllTypes(Double_t xmin, Double_t xmax,Double_t normalization);
+ TF1* GetFunB(Double_t xmin, Double_t xmax, Double_t normalization, Double_t pt, Int_t type=2, Int_t npx = 5000);
+ TF1* GetFunBAllTypes(Double_t xmin, Double_t xmax, Double_t normalization);
+ TF1* GetEvaluateCDFDecayTimeBkgDistr(Double_t xmin, Double_t xmax, Double_t normalization, Int_t type = 2, Double_t mass = 3.09, Double_t pt = 200.,Int_t npx = 5000);
+ TF1* GetEvaluateCDFDecayTimeBkgDistrAllTypes(Double_t xmin, Double_t xmax, Double_t normalization);
+ TF1* GetEvaluateCDFDecayTimeSigDistr(Double_t xmin, Double_t xmax, Double_t normalization, Double_t type);
+ TF1* GetEvaluateCDFInvMassBkgDistr(Double_t mMin, Double_t mMax, Double_t normalization);
+ TF1* GetEvaluateCDFInvMassSigDistr(Double_t mMin, Double_t mMax, Double_t normalization);
+ TF1* GetEvaluateCDFInvMassTotalDistr(Double_t mMin, Double_t mMax, Double_t normalization);
+ TF1* GetEvaluateCDFDecayTimeTotalDistr(Double_t xMin, Double_t xMax, Double_t normalization,Double_t pt = 200., Int_t type=2);
+ TF1 *GetEvaluateCDFDecayTimeTotalDistrAllTypes(Double_t xMin, Double_t xMax, Double_t normalization);
+
+ void SetResWeight(Double_t resWgt) {fParameters[0] = resWgt;}
+ void SetFPlus(Double_t plus) {fParameters[1] = plus;}
+ void SetFMinus(Double_t minus) {fParameters[2] = minus;}
+ void SetFSym(Double_t sym) {fParameters[3] = sym;}
+ void SetFSym1(Double_t sym) {fParameters[46] = sym;}
+ void SetLamPlus(Double_t lamplus) {fParameters[4] = lamplus;}
+ void SetLamMinus(Double_t lamminus) {fParameters[5] = lamminus;}
+ void SetLamSym(Double_t lamsym) {fParameters[6] = lamsym;}
+ void SetLamSym1(Double_t lamsym) {fParameters[45] = lamsym;}
+ void SetFractionJpsiFromBeauty(Double_t B) {fParameters[7] = B;}
+ void SetFsig(Double_t Fsig) {fParameters[8] = Fsig;}
+ void SetCrystalBallMmean(Double_t CrystalBallMmean) {fParameters[9] = CrystalBallMmean;}
+ void SetCrystalBallNexp(Double_t CrystalBallNexp) {fParameters[10] = CrystalBallNexp;}
+ void SetCrystalBallSigma(Double_t CrystalBallSigma) {fParameters[11] = CrystalBallSigma;}
+ void SetCrystalBallAlpha(Double_t CrystalBallAlpha) {fParameters[12] = CrystalBallAlpha;}
+ void SetCrystalBallNorm(Double_t CrystalBallNorm) {fParameters[13] = CrystalBallNorm;}
+ void SetBkgInvMassNorm(Double_t BkgInvMassNorm) {fParameters[14] = BkgInvMassNorm;}
+ void SetBkgInvMassMean(Double_t BkgInvMassMean) {fParameters[15] = BkgInvMassMean;}
+ void SetBkgInvMassSlope(Double_t BkgInvMassSlope) {fParameters[16] = BkgInvMassSlope;}
+ void SetBkgInvMassConst(Double_t BkgInvMassConst) {fParameters[17] = BkgInvMassConst;}
+ void SetBkgInvMassPolyn4(Double_t coeffPol4) {fParameters[47] = coeffPol4;}
+ void SetBkgInvMassPolyn5(Double_t coeffPol5) {fParameters[48] = coeffPol5;}
+ void SetNormGaus1ResFunc(Double_t norm1) {fParameters[18] = norm1;}
+ void SetNormGaus2ResFunc(Double_t norm2) {fParameters[19] = norm2;}
+ void SetAllParameters(const Double_t* parameters);
+ void SetIntegralMassSig(Double_t integral) { fintmMassSig = integral; }
+ void SetIntegralMassBkg(Double_t integral) { fintmMassBkg = integral; }
+ void SetCsiMC(const TH1F* MCtemplate) {fhCsiMC = (TH1F*)MCtemplate->Clone("fhCsiMC");}
+ void SetTemplateShift(Double_t shift = 0.){fShiftTemplate = shift;}
+
+ void SetResolutionConstants(const Double_t* resolutionConst, Int_t type);
+ void SetMassWndHigh(Double_t limit) { fMassWndHigh = TDatabasePDG::Instance()->GetParticle(443)->Mass() + limit ;}
+ void SetMassWndLow(Double_t limit) { fMassWndLow = TDatabasePDG::Instance()->GetParticle(443)->Mass() - limit ;}
+ void SetCrystalBallFunction(Bool_t okCB) {fCrystalBallParam = okCB;}
+ void SetExponentialFunction(Bool_t okExp) {fExponentialParam = okExp;}
+
+ void SetWeightType(Double_t wFF, Double_t wFS, Double_t wSS) {fWeightType[0]= wSS; fWeightType[1]= wFS; fWeightType[2]= wFF;}
+
+ void SetChangeResolution(Double_t change){fChangeResolution = change;}
+ void SetChangeMass(Double_t change){fChangeMass = change;}
+ void ComputeMassIntegral();
+ void ReadMCtemplates(Int_t BinNum);
+ void PrintStatus();
+
+ //specific methods for multi-variational fit
+ void SetBkgWeights(Double_t ***bkgWgt){for(int kpt=0; kpt<(fPtWindows->GetSize()-1); kpt++){for(int k=0; k<(fMassWindows->GetSize()-2); k++) { for(int ktype=0; ktype<3; ktype++) fWeights[k][kpt][ktype]=bkgWgt[k][kpt][ktype]; }}}
+
+ void SetBkgFunction(Int_t massRange,Int_t type, Int_t ptB, TF1 *histBkg){
+ fFunBkgSaved[ptB][massRange][type] = histBkg;
+ }
+ TF1 *GetBkgFunction(Int_t massRange, Int_t ptB, Int_t type) const {return fFunBkgSaved[ptB][massRange][type];}
+ void SetFunBFunction(Int_t type, Int_t ptB, TF1 *histSec) { fFunBSaved[ptB][type] = histSec; }
+ void SetBackgroundSpecificParameters(Int_t pt, Int_t mb, Int_t tp);
+ void SetExtrapolationRegion(Int_t extrRegion){fSignalBinForExtrapolation = extrRegion;} void SetLoadFunction(Bool_t loadFunc) { fLoadFunctions = loadFunc;}
+ void SetMultivariateFit(Bool_t multVar) { fMultivariate = multVar;}
+ Bool_t GetMultivariate() const { return fMultivariate;}
+ void SetFunctionsSaved(Int_t npxFunB=5000, Int_t npxFunBkg=5000, Double_t funBLimits = 20000., Double_t funBkgLimits = 40000., Int_t signalRegion=2);
+ void SetResParams(Double_t ***pars){ fResParams = pars;}
+ void SetBkgParams(Float_t ****pars){ fBkgParams = pars;}
+ void SetMassWindows(TArrayD *msWnd){ fMassWindows = msWnd;}
+ void SetPtWindows(TArrayD *ptWnd){ fPtWindows = ptWnd;}
+ void InitializeFunctions(Int_t ptSize, Int_t massSize);
+ Double_t EvaluateCDFInvMassSigDistr(Double_t m) const ;
+ Double_t EvaluateCDFInvMassBkgDistr(Double_t m) const;
+ Double_t ResolutionFunc(Double_t x, Double_t pt, Int_t type) const;
+ Double_t EvaluateCDFDecayTimeBkgDistr(Double_t x, Int_t type, Double_t m=3.09, Double_t pt=200.) const ;
+
+
+ private:
+ Double_t fParameters[49]; /* par[0] = weightRes;
+ par[1] = fPos;
+ par[2] = fNeg;
+ par[3] = fSym
+ par[4] = fOneOvLamPlus;
+ par[5] = fOneOvLamMinus;
+ par[6] = fOneOvLamSym;
+ par[7] = fFractionJpsiFromBeauty;
+ par[8] = fFsig;
+ par[9] = fCrystalBallMmean;
+ par[10] = fCrystalBallNexp;
+ par[11] = fCrystalBallSigma;
+ par[12] = fCrystalBallAlpha;
+ par[13] = fCrystalBallNorm;
+ par[14] = fBkgNorm;
+ par[15] = fBkgMean;
+ par[16] = fBkgSlope;
+ par[17] = fBkgConst;
+ par[18] = norm1Gaus; // resolution param used for First-First
+ par[19] = norm2Gaus;
+ par[20] = fMean1ResFunc;
+ par[21] = fSigma1ResFunc;
+ par[22] = fMean2ResFunc;
+ par[23] = fSigma2ResFunc;
+ par[24] = fResAlfa;
+ par[25] = fResLambda;
+ par[26] = fResNormExp;
+ par[27] = norm1Gaus; // resolution param used for First-Second
+ par[28] = norm2Gaus;
+ par[29] = fMean1ResFunc;
+ par[30] = fSigma1ResFunc;
+ par[31] = fMean2ResFunc;
+ par[32] = fSigma2ResFunc;
+ par[33] = fResAlfa;
+ par[34] = fResLambda;
+ par[35] = fResNormExp;
+ par[36] = norm1Gaus; // resolution param used for Second-Second
+ par[37] = norm2Gaus;
+ par[38] = fMean1ResFunc;
+ par[39] = fSigma1ResFunc;
+ par[40] = fMean2ResFunc;
+ par[41] = fSigma2ResFunc;
+ par[42] = fResAlfa;
+ par[43] = fResLambda;
+ par[44] = fResNormExp;
+ ------------------------------> parameters to describe x and m à la CDF
+ // additional parameters below (added for PbPb analysis): if not used should be fixed
+ // by the FitHandler pointer
+ par[45] = fOneOvLamSym1; // additional parameter for background
+ par[46] = fSym1; // additional parameter for background
+ par[47] = fPolyn4; //additional parameter for inv. mass background
+ par[48] = fPolyn5; //additional parameter for inv. mass background */
+
+ Double_t fFPlus; // parameter of the log-likelihood function
+ Double_t fFMinus; // slopes of the x distributions of the background
+ Double_t fFSym; // functions
+
+ Double_t fintmMassSig; // integral of invariant mass distribution for the signal
+ Double_t fintmMassBkg; // integral of invariant mass distribution for the bkg
+
+ TH1F *fhCsiMC; // X distribution used as MC template for JPSI from B
+
+ Double_t fShiftTemplate; // to shift the MC template
+ Double_t fMassWndHigh; // JPSI Mass window higher limit
+ Double_t fMassWndLow; // JPSI Mass window lower limit
+ Bool_t fCrystalBallParam; // Boolean to switch to Crystall Ball parameterisation
+
+ Double_t fWeightType[3]; // vector with weights of candidates types (used to draw functions)
+ Double_t fChangeResolution; // constant to change the RMS of the resolution function
+ Double_t fChangeMass; // constant to change the RMS of the signal mass function
+
+ // data members for multivariate fit
+ Double_t ***fWeights; // weights to interpolate bkg shape in pt, mass, type bins under signal region
+ Bool_t fLoadFunctions; // boolean to load functions saved
+ Bool_t fMultivariate; // switch-on multivariate fit
+ TF1 ***fFunBSaved; // pointers to save functions for x of non-prompt J/psi in pt, mass, type bins
+ TF1 ****fFunBkgSaved; // pointers to save functions for x of background in pt, mass, type bins
+ Double_t ***fResParams; // resolution function parameters in pt and type bins
+ Float_t ****fBkgParams; // x background parameters in pt, mass, type bins
+ TArrayD *fMassWindows; // limits for invariant mass bins
+ TArrayD *fPtWindows; // limits for pt bins
+ Bool_t fExponentialParam; // Boolean to switch to Exponential parameterisation
+ Double_t fSignalBinForExtrapolation; // inv. mass region in which extrapolate the background shape
+ // starting from background shapes in the near inv. mass regions
+
+
+ Double_t EvaluateCDFfunc(Double_t x, Double_t m, Double_t pt, Int_t type) const ;
+ Double_t EvaluateCDFfuncNorm(Double_t x, Double_t m, Double_t pt, Int_t type) const ;
+ Double_t EvaluateCDFfuncSignalPart(Double_t x, Double_t m, Double_t pt, Int_t type) const ; // Signal part
+ Double_t EvaluateCDFDecayTimeSigDistr(Double_t x, Double_t pt, Int_t type) const ;
+ Double_t EvaluateCDFDecayTimeSigDistrFunc(const Double_t* x, const Double_t *par) const { return par[0]*EvaluateCDFDecayTimeSigDistr(x[0],par[1],(Int_t)par[2]);}
+ Double_t EvaluateCDFInvMassSigDistrFunc(const Double_t* x, const Double_t *par) const {return par[0]*EvaluateCDFInvMassSigDistr(x[0])/fintmMassSig;}
+ Double_t EvaluateCDFfuncBkgPart(Double_t x,Double_t m, Double_t pt, Int_t type) const ; // Background part
+ Double_t EvaluateCDFDecayTimeBkgDistrFunc(const Double_t* x, const Double_t *par) const { return EvaluateCDFDecayTimeBkgDistr(x[0],(Int_t)par[1],par[2],par[3])*par[0];}
+ Double_t EvaluateCDFDecayTimeBkgDistrFuncAllTypes(const Double_t* x, const Double_t *par) const {return (fWeightType[2]*EvaluateCDFDecayTimeBkgDistr(x[0],2)+fWeightType[1]*EvaluateCDFDecayTimeBkgDistr(x[0],1)+fWeightType[0]*EvaluateCDFDecayTimeBkgDistr(x[0],0))*par[0];}
+ Double_t EvaluateCDFInvMassBkgDistrFunc(const Double_t* x, const Double_t *par) const {return par[0]*EvaluateCDFInvMassBkgDistr(x[0])/fintmMassBkg;}
+
+ Double_t EvaluateCDFInvMassTotalDistr(const Double_t* x, const Double_t *par) const;
+ Double_t EvaluateCDFDecayTimeTotalDistr(const Double_t* x, const Double_t *par) const;
+ ////
+ Double_t EvaluateCDFDecayTimeTotalDistrAllTypes(const Double_t* x, const Double_t *par) const;
+
+ Double_t FunB(Double_t x, Double_t pt, Int_t type) const;
+ Double_t FunBfunc(const Double_t *x, const Double_t *par) const {return FunB(x[0],par[1],(Int_t)par[2])*par[0];}
+ Double_t FunBfuncAllTypes(const Double_t *x, const Double_t *par) const {return (fWeightType[2]*FunB(x[0],200.,2)+fWeightType[1]*FunB(x[0],200.,1)+fWeightType[0]*FunB(x[0],200.,0))*par[0];}
+ Double_t FunP(Double_t x, Double_t pt,Int_t type) const ;
+ Double_t CsiMC(Double_t x) const;
+ Double_t CsiMCfunc(const Double_t* x, const Double_t *par) const { return CsiMC(x[0])*par[0];}
+ Double_t FunBkgPos(Double_t x, Double_t pt, Int_t type) const ;
+ Double_t FunBkgNeg(Double_t x, Double_t pt, Int_t type) const ;
+ Double_t FunBkgSym(Double_t x, Double_t pt, Int_t type) const ;
+ Double_t FunBkgSym1(Double_t x, Double_t pt, Int_t type) const ;
+ Double_t ResolutionFuncf(const Double_t* x, const Double_t *par) const { return ResolutionFunc(x[0],par[1],(Int_t)par[2])*par[0];}
+ Double_t ResolutionFuncAllTypes(const Double_t* x, const Double_t *par) const { return (fWeightType[2]*ResolutionFunc(x[0],200.,2)+fWeightType[1]*ResolutionFunc(x[0],200.,1)+fWeightType[0]*ResolutionFunc(x[0],200.,0))*par[0]; }
+
+ // private methods for multivariate fit
+ Double_t EvaluateCDFDecayTimeBkgDistrSaved(Double_t x, Int_t type, Double_t m=3.09, Double_t pt = 200.) const ;
+ Double_t EvaluateCDFDecayTimeBkgDistrDifferential(Double_t x, Int_t type, Double_t m=3.09, Double_t pt = 200.) const;
+ Double_t FunBsaved(Double_t x, Double_t pt, Int_t type) const;
+
+ ClassDef (AliDielectronBtoJPSItoEleCDFfitFCN,1); // Unbinned log-likelihood fit
+
+};
+
+#endif
-#ifndef ALIDIELECTRONBTOJPSITOELECDFFITHANDLER_H\r
-#define ALIDIELECTRONBTOJPSITOELECDFFITHANDLER_H\r
-/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-//___________________________________________________________________________\r
-// Class AliDielectronBtoJPSItoEleCDFfitHandler\r
-// Class to perform unbinned log-likelihood fit\r
-// \r
-// Origin: C. Di Giglio\r
-// Contact: Carmelo.Digiglio@ba.infn.it; Giuseppe.Bruno@ba.infn.it\r
-//____________________________________________________________________________\r
-\r
-#include <TNamed.h>\r
-#include <TBits.h>\r
-#include <TGraph.h>\r
-#include <TFitter.h>\r
-\r
-class AliDielectronBtoJPSItoEleCDFfitFCN ;\r
-\r
-class AliDielectronBtoJPSItoEleCDFfitHandler : public TNamed {\r
- public:\r
- //\r
- AliDielectronBtoJPSItoEleCDFfitHandler();\r
- AliDielectronBtoJPSItoEleCDFfitHandler& operator= (const AliDielectronBtoJPSItoEleCDFfitHandler& c);\r
- AliDielectronBtoJPSItoEleCDFfitHandler(const AliDielectronBtoJPSItoEleCDFfitHandler& c);\r
- AliDielectronBtoJPSItoEleCDFfitHandler(Double_t* decaytime, Double_t* invariantmass, Double_t *pt, Int_t *type, Int_t ncand);\r
- ~AliDielectronBtoJPSItoEleCDFfitHandler(); \r
- Double_t Up() const { return fUp; }\r
- void SetErrorDef(Double_t up) {fUp = up;}\r
- void SetPrintStatus(Bool_t okPrintStatus) { fPrintStatus = okPrintStatus; } \r
- Bool_t GetPrintStatus() const { return fPrintStatus ; }\r
- void SetParamStartValues (Double_t*);\r
- Double_t* GetStartParamValues() { return fParamStartValues; }\r
- TBits GetFixedParamList() const { return fIsParamFixed; }\r
- TFitter *GetFitter() const {return fitter;}\r
- Double_t GetParameter(Int_t numPar) const {return fitter->GetParameter(numPar);}\r
- Double_t GetParameterError(Int_t numPar) const {return fitter->GetParError(numPar);} \r
-\r
- void FixParam(UInt_t param, Bool_t value) { fIsParamFixed.SetBitNumber(param,value); }\r
- void FixAllParam(Bool_t value) { for(UInt_t par=0;par<49;par++) fIsParamFixed.SetBitNumber(par,value); }\r
- Bool_t IsParamFixed(UInt_t param) { return fIsParamFixed.TestBitNumber(param); }\r
- void SetResolutionConstants(Double_t* resolutionConst, Int_t type);\r
- void SetCrystalBallFunction(Bool_t okCB);\r
- void SetExponentialFunction(Bool_t okEpx);\r
- void SetMassWndHigh(Double_t limit);\r
- void SetMassWndLow(Double_t limit);\r
-\r
- Double_t operator()(const Double_t* par) const ;\r
- void CdfFCN(Int_t & /* npar */, Double_t * /* gin */, Double_t &f, Double_t *par, Int_t /* iflag */);\r
-\r
- Double_t* Decaytime() const { return fX; }\r
- Double_t* InvariantMass() const { return fM; }\r
- Double_t* TransverseMom() const { return fPt; }\r
- Int_t* TypeCand() const { return fType;}\r
- AliDielectronBtoJPSItoEleCDFfitFCN* LikelihoodPointer() const { return fLikely; }\r
- Int_t DoMinimization(Int_t step = 0);\r
- \r
-\r
- private:\r
- //\r
- TBits fIsParamFixed; //array of bits: 0 = param free; 1 = param fixed;\r
- Bool_t fPrintStatus; //flag to enable the prit out of the algorithm at each step\r
- Double_t fParamStartValues[49]; //array of parameters input value\r
- Double_t fUp; //error definition \r
- Double_t* fX; //pseudo-proper decay time X\r
- Double_t* fM; //invariant mass M\r
- Double_t* fPt; //invariant mass M\r
- Int_t* fType; //candidate type\r
- AliDielectronBtoJPSItoEleCDFfitFCN* fLikely; //Log likelihood function\r
- Int_t fNcand; //number of candidates\r
- TGraph* fContPlot1; //contour plot \r
- TGraph* fContPlot2; //contour plot \r
- TGraph* fContPlot3; //contour plot \r
- TFitter *fitter; //pointer to TFitter object \r
- //\r
- ClassDef(AliDielectronBtoJPSItoEleCDFfitHandler,1);\r
-\r
-}; \r
-#endif\r
+#ifndef ALIDIELECTRONBTOJPSITOELECDFFITHANDLER_H
+#define ALIDIELECTRONBTOJPSITOELECDFFITHANDLER_H
+/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//___________________________________________________________________________
+// Class AliDielectronBtoJPSItoEleCDFfitHandler
+// Class to perform unbinned log-likelihood fit
+//
+// Origin: C. Di Giglio
+// Contact: Carmelo.Digiglio@ba.infn.it; Giuseppe.Bruno@ba.infn.it
+//____________________________________________________________________________
+
+#include <TNamed.h>
+#include <TBits.h>
+#include <TGraph.h>
+#include <TFitter.h>
+
+class AliDielectronBtoJPSItoEleCDFfitFCN ;
+
+class AliDielectronBtoJPSItoEleCDFfitHandler : public TNamed {
+ public:
+ //
+ AliDielectronBtoJPSItoEleCDFfitHandler();
+ AliDielectronBtoJPSItoEleCDFfitHandler& operator= (const AliDielectronBtoJPSItoEleCDFfitHandler& c);
+ AliDielectronBtoJPSItoEleCDFfitHandler(const AliDielectronBtoJPSItoEleCDFfitHandler& c);
+ AliDielectronBtoJPSItoEleCDFfitHandler(Double_t* decaytime, Double_t* invariantmass, Double_t *pt, Int_t *type, Int_t ncand);
+ ~AliDielectronBtoJPSItoEleCDFfitHandler();
+ Double_t Up() const { return fUp; }
+ void SetErrorDef(Double_t up) {fUp = up;}
+ void SetPrintStatus(Bool_t okPrintStatus) { fPrintStatus = okPrintStatus; }
+ Bool_t GetPrintStatus() const { return fPrintStatus ; }
+ void SetParamStartValues (Double_t*);
+ Double_t* GetStartParamValues() { return fParamStartValues; }
+ TBits GetFixedParamList() const { return fIsParamFixed; }
+ TFitter *GetFitter() const {return fitter;}
+ Double_t GetParameter(Int_t numPar) const {return fitter->GetParameter(numPar);}
+ Double_t GetParameterError(Int_t numPar) const {return fitter->GetParError(numPar);}
+
+ void FixParam(UInt_t param, Bool_t value) { fIsParamFixed.SetBitNumber(param,value); }
+ void FixAllParam(Bool_t value) { for(UInt_t par=0;par<49;par++) fIsParamFixed.SetBitNumber(par,value); }
+ Bool_t IsParamFixed(UInt_t param) { return fIsParamFixed.TestBitNumber(param); }
+ void SetResolutionConstants(Double_t* resolutionConst, Int_t type);
+ void SetCrystalBallFunction(Bool_t okCB);
+ void SetExponentialFunction(Bool_t okEpx);
+ void SetMassWndHigh(Double_t limit);
+ void SetMassWndLow(Double_t limit);
+
+ Double_t operator()(const Double_t* par) const ;
+ void CdfFCN(Int_t & /* npar */, Double_t * /* gin */, Double_t &f, Double_t *par, Int_t /* iflag */);
+
+ Double_t* Decaytime() const { return fX; }
+ Double_t* InvariantMass() const { return fM; }
+ Double_t* TransverseMom() const { return fPt; }
+ Int_t* TypeCand() const { return fType;}
+ AliDielectronBtoJPSItoEleCDFfitFCN* LikelihoodPointer() const { return fLikely; }
+ Int_t DoMinimization(Int_t step = 0);
+
+
+ private:
+ //
+ TBits fIsParamFixed; //array of bits: 0 = param free; 1 = param fixed;
+ Bool_t fPrintStatus; //flag to enable the prit out of the algorithm at each step
+ Double_t fParamStartValues[49]; //array of parameters input value
+ Double_t fUp; //error definition
+ Double_t* fX; //pseudo-proper decay time X
+ Double_t* fM; //invariant mass M
+ Double_t* fPt; //invariant mass M
+ Int_t* fType; //candidate type
+ AliDielectronBtoJPSItoEleCDFfitFCN* fLikely; //Log likelihood function
+ Int_t fNcand; //number of candidates
+ TGraph* fContPlot1; //contour plot
+ TGraph* fContPlot2; //contour plot
+ TGraph* fContPlot3; //contour plot
+ TFitter *fitter; //pointer to TFitter object
+ //
+ ClassDef(AliDielectronBtoJPSItoEleCDFfitHandler,1);
+
+};
+#endif
-AliAnalysisTask *AddTask_oezdemir_pp2012(Bool_t getFromAlien=kFALSE){\r
-\r
-\r
- //get the current analysis manager\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTask_oezdemir_pp2012", "No analysis manager found.");\r
- return 0;\r
- }\r
-\r
-//Get the current train configuration\r
- TString trainConfig=gSystem->Getenv("CONFIG_FILE");\r
- TString configBasePath("$TRAIN_ROOT/oezdemir_LOWMASS/");\r
- TString trainRoot=gSystem->Getenv("TRAIN_ROOT");\r
- if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";\r
-\r
- if (getFromAlien &&\r
- (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/m/mozdemir/PWGDQ/dielectron/macrosLMEE/Configpp2012Oezdemir.C"))\r
- ) {\r
- configBasePath=Form("%s/",gSystem->pwd());\r
- }\r
-\r
- TString configFile("Configpp2012Oezdemir.C");\r
-\r
- TString configFilePath(configBasePath+configFile);\r
-\r
- //Do we have an MC handler?\r
- Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);\r
- \r
- \r
- //create task and add it to the manager\r
- AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");\r
- if (!hasMC) task->UsePhysicsSelection();\r
-\r
-//Add event filter\r
-AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");\r
-eventCuts->SetRequireVertex();\r
-eventCuts->SetVertexZ(-10.,10.);\r
-eventCuts->SetMinVtxContributors(1);\r
-\r
- task->SetEventFilter(eventCuts);\r
- //2012 Min Bias?\r
- task->SetTriggerMask(AliVEvent::kINT7+AliVEvent::kMB+AliVEvent::kINT8);\r
-\r
- mgr->AddTask(task);\r
-\r
-\r
- //load dielectron configuration file\r
- gROOT->LoadMacro(configFilePath.Data());\r
-\r
- //If MC available decide which pdg codes are tested:\r
-\r
- AliDielectron *lowmass0=Configpp2012Oezdemir(0,hasMC);\r
- task->AddDielectron(lowmass0);\r
- printf("add: %s\n",lowmass0->GetName());\r
-\r
- //create output container\r
- AliAnalysisDataContainer *coutput1 =\r
- mgr->CreateContainer("oezdemir_pp2012_tree",\r
- TTree::Class(),\r
- AliAnalysisManager::kExchangeContainer,\r
- "LMEEoutput.root");\r
- \r
- AliAnalysisDataContainer *cOutputHist1 =\r
- mgr->CreateContainer("oezdemir_pp2012_out",\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- "LMEEoutput.root");\r
-\r
- AliAnalysisDataContainer *cOutputHist2 =\r
- mgr->CreateContainer("oezdemir_pp2012_CF",\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- "LMEEoutput.root");\r
-\r
- AliAnalysisDataContainer *cOutputHist3 =\r
- mgr->CreateContainer("oezdemir_pp2012_EventStat",\r
- TH1D::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- "LMEEoutput.root");\r
-\r
- \r
- mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(task, 0, coutput1 );\r
- mgr->ConnectOutput(task, 1, cOutputHist1);\r
- mgr->ConnectOutput(task, 2, cOutputHist2);\r
- mgr->ConnectOutput(task, 3, cOutputHist3);\r
-\r
- return task;\r
-}\r
+AliAnalysisTask *AddTask_oezdemir_pp2012(Bool_t getFromAlien=kFALSE){
+
+
+ //get the current analysis manager
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTask_oezdemir_pp2012", "No analysis manager found.");
+ return 0;
+ }
+
+//Get the current train configuration
+ TString trainConfig=gSystem->Getenv("CONFIG_FILE");
+ TString configBasePath("$TRAIN_ROOT/oezdemir_LOWMASS/");
+ TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
+ if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";
+
+ if (getFromAlien &&
+ (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/m/mozdemir/PWGDQ/dielectron/macrosLMEE/Configpp2012Oezdemir.C"))
+ ) {
+ configBasePath=Form("%s/",gSystem->pwd());
+ }
+
+ TString configFile("Configpp2012Oezdemir.C");
+
+ TString configFilePath(configBasePath+configFile);
+
+ //Do we have an MC handler?
+ Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
+
+
+ //create task and add it to the manager
+ AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
+ if (!hasMC) task->UsePhysicsSelection();
+
+//Add event filter
+AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
+eventCuts->SetRequireVertex();
+eventCuts->SetVertexZ(-10.,10.);
+eventCuts->SetMinVtxContributors(1);
+
+ task->SetEventFilter(eventCuts);
+ //2012 Min Bias?
+ task->SetTriggerMask(AliVEvent::kINT7+AliVEvent::kMB+AliVEvent::kINT8);
+
+ mgr->AddTask(task);
+
+
+ //load dielectron configuration file
+ gROOT->LoadMacro(configFilePath.Data());
+
+ //If MC available decide which pdg codes are tested:
+
+ AliDielectron *lowmass0=Configpp2012Oezdemir(0,hasMC);
+ task->AddDielectron(lowmass0);
+ printf("add: %s\n",lowmass0->GetName());
+
+ //create output container
+ AliAnalysisDataContainer *coutput1 =
+ mgr->CreateContainer("oezdemir_pp2012_tree",
+ TTree::Class(),
+ AliAnalysisManager::kExchangeContainer,
+ "LMEEoutput.root");
+
+ AliAnalysisDataContainer *cOutputHist1 =
+ mgr->CreateContainer("oezdemir_pp2012_out",
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ "LMEEoutput.root");
+
+ AliAnalysisDataContainer *cOutputHist2 =
+ mgr->CreateContainer("oezdemir_pp2012_CF",
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ "LMEEoutput.root");
+
+ AliAnalysisDataContainer *cOutputHist3 =
+ mgr->CreateContainer("oezdemir_pp2012_EventStat",
+ TH1D::Class(),
+ AliAnalysisManager::kOutputContainer,
+ "LMEEoutput.root");
+
+
+ mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(task, 0, coutput1 );
+ mgr->ConnectOutput(task, 1, cOutputHist1);
+ mgr->ConnectOutput(task, 2, cOutputHist2);
+ mgr->ConnectOutput(task, 3, cOutputHist3);
+
+ return task;
+}
-AliAnalysisTask *AddTask_shin_pPb(){\r
- //get the current analysis manager\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTask_shin_pPb", "No analysis manager found.");\r
- return 0;\r
- }\r
-\r
-\r
- //Do we have an MC handler?\r
- Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);\r
- \r
- //Get the current train configuration\r
- // TString trainConfig=gSystem->Getenv("CONFIG_FILE");\r
- \r
- //set config file name\r
- TString configBasePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/");\r
- TString configFile("Config_shin_pPb.C");\r
- TString configFilePath(configBasePath+configFile);\r
-\r
- // TString list=gSystem->Getenv("LIST");\r
- //create task and add it to the manager\r
- AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDieData");\r
- if (!hasMC ) task->UsePhysicsSelection();\r
- task->SetTriggerMask(AliVEvent::kINT7); \r
- mgr->AddTask(task);\r
-\r
- \r
- //load dielectron configuration file\r
- gROOT->LoadMacro(configFilePath.Data());\r
- \r
- //add dielectron analysis with different cuts to the task\r
- for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file\r
- AliDielectron *dile=Config_shin_pPb(i);\r
- if (!dile) continue;\r
- task->AddDielectron(dile);\r
- }\r
- \r
- //Add event filter\r
- AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");\r
- eventCuts->SetRequireVertex();\r
- eventCuts->SetMinVtxContributors(1);\r
- eventCuts->SetVertexZ(-10.,10.);\r
- task->SetEventFilter(eventCuts);\r
- \r
- //create output container\r
- TString containerName = "hayashi_lowmass.root";\r
- AliAnalysisDataContainer *coutput1 =\r
- mgr->CreateContainer("tree_lowmass",\r
- TTree::Class(),\r
- AliAnalysisManager::kExchangeContainer,\r
- containerName.Data());\r
- \r
- AliAnalysisDataContainer *cOutputHist1 =\r
- mgr->CreateContainer("Histos_diel_lowmass",\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- containerName.Data());\r
-\r
- AliAnalysisDataContainer *cOutputHist2 =\r
- mgr->CreateContainer("CF_diel_lowmass",\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- containerName.Data());\r
- \r
- AliAnalysisDataContainer *cOutputHist3 =\r
- mgr->CreateContainer("sweber_EventStat",\r
- TH1D::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- containerName.Data());\r
- \r
- mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(task, 0, coutput1 );\r
- mgr->ConnectOutput(task, 1, cOutputHist1);\r
- mgr->ConnectOutput(task, 2, cOutputHist2);\r
- mgr->ConnectOutput(task, 3, cOutputHist3);\r
- \r
- return task;\r
-}\r
+AliAnalysisTask *AddTask_shin_pPb(){
+ //get the current analysis manager
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTask_shin_pPb", "No analysis manager found.");
+ return 0;
+ }
+
+
+ //Do we have an MC handler?
+ Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
+
+ //Get the current train configuration
+ // TString trainConfig=gSystem->Getenv("CONFIG_FILE");
+
+ //set config file name
+ TString configBasePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/");
+ TString configFile("Config_shin_pPb.C");
+ TString configFilePath(configBasePath+configFile);
+
+ // TString list=gSystem->Getenv("LIST");
+ //create task and add it to the manager
+ AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDieData");
+ if (!hasMC ) task->UsePhysicsSelection();
+ task->SetTriggerMask(AliVEvent::kINT7);
+ mgr->AddTask(task);
+
+
+ //load dielectron configuration file
+ gROOT->LoadMacro(configFilePath.Data());
+
+ //add dielectron analysis with different cuts to the task
+ for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file
+ AliDielectron *dile=Config_shin_pPb(i);
+ if (!dile) continue;
+ task->AddDielectron(dile);
+ }
+
+ //Add event filter
+ AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
+ eventCuts->SetRequireVertex();
+ eventCuts->SetMinVtxContributors(1);
+ eventCuts->SetVertexZ(-10.,10.);
+ task->SetEventFilter(eventCuts);
+
+ //create output container
+ TString containerName = "hayashi_lowmass.root";
+ AliAnalysisDataContainer *coutput1 =
+ mgr->CreateContainer("tree_lowmass",
+ TTree::Class(),
+ AliAnalysisManager::kExchangeContainer,
+ containerName.Data());
+
+ AliAnalysisDataContainer *cOutputHist1 =
+ mgr->CreateContainer("Histos_diel_lowmass",
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data());
+
+ AliAnalysisDataContainer *cOutputHist2 =
+ mgr->CreateContainer("CF_diel_lowmass",
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data());
+
+ AliAnalysisDataContainer *cOutputHist3 =
+ mgr->CreateContainer("sweber_EventStat",
+ TH1D::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data());
+
+ mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(task, 0, coutput1 );
+ mgr->ConnectOutput(task, 1, cOutputHist1);
+ mgr->ConnectOutput(task, 2, cOutputHist2);
+ mgr->ConnectOutput(task, 3, cOutputHist3);
+
+ return task;
+}
-AliAnalysisTask *AddTask_shin_pPbTRD(){\r
- //get the current analysis manager\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTask_sweber_JPsi_pPb_TRDtrigger", "No analysis manager found.");\r
- return 0;\r
- }\r
-\r
-\r
- //Do we have an MC handler?\r
- Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);\r
- \r
- //Get the current train configuration\r
- // TString trainConfig=gSystem->Getenv("CONFIG_FILE");\r
- \r
- //set config file name\r
- TString configBasePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/");\r
- TString configFile("Config_shin_pPbTRD.C");\r
- TString configFilePath(configBasePath+configFile);\r
-\r
-\r
-\r
-\r
- // TString list=gSystem->Getenv("LIST");\r
- //create task and add it to the manager\r
- AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDieDataTRDtrigger");\r
- if (!hasMC ) task->UsePhysicsSelection();//taking out for testing\r
- task->SetTriggerMask(AliVEvent::kTRD); \r
- task->SetFiredTriggerName("CINT7WUHJT-B-NOPF-CENT",kTRUE);\r
- //task->SetTRDtrigger(3);\r
- // task->SetFiredTriggerName("HQU",kFALSE);//take not kTRUE in order not to get both triggers, exclude (since not yet otherwise possible)\r
- //\r
- //not yet implemented to get a logical or of 2 different trigger classes, therefore exclude HJT, not exactly what I want... \r
- // if (list.Contains("LHC11d")) task->SetTriggerMask(AliVEvent::kEMCEJE+AliVEvent::kEMC7+AliVEvent::kEMCEGA);\r
- //if (list.Contains("LHC12h")) task->SetTRDtrigger(1+2);\r
- mgr->AddTask(task);\r
-\r
- \r
- //load dielectron configuration file\r
- gROOT->LoadMacro(configFilePath.Data());\r
- \r
- //add dielectron analysis with different cuts to the task\r
- for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file\r
- AliDielectron *dile=Config_shin_pPbTRD(i);\r
- if (!dile) continue;\r
- task->AddDielectron(dile);\r
- }\r
- \r
- //Add event filter\r
- AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");\r
- eventCuts->SetRequireVertex();//NOTE: all of these cuts can for some reasons not be applied to self-filtered AODs by mwinn in \r
- //(list/hera/alice/mwinn/mwinn/train/lists/...)\r
- eventCuts->SetMinVtxContributors(1);\r
- eventCuts->SetVertexZ(-10.,10.);\r
- task->SetEventFilter(eventCuts);\r
-\r
- \r
- //create output container\r
- TString containerName = "hayashi_lowmass.root";\r
- AliAnalysisDataContainer *coutput1 =\r
- mgr->CreateContainer("tree_lowmass",\r
- TTree::Class(),\r
- AliAnalysisManager::kExchangeContainer,\r
- containerName.Data());\r
- \r
- AliAnalysisDataContainer *cOutputHist1 =\r
- mgr->CreateContainer("Histos_diel_lowmass",\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- containerName.Data());\r
-\r
- AliAnalysisDataContainer *cOutputHist2 =\r
- mgr->CreateContainer("CF_diel_lowmass",\r
- TList::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- containerName.Data());\r
- \r
- AliAnalysisDataContainer *cOutputHist3 =\r
- mgr->CreateContainer("sweber_EventStat",\r
- TH1D::Class(),\r
- AliAnalysisManager::kOutputContainer,\r
- containerName.Data());\r
- \r
- mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(task, 0, coutput1 );\r
- mgr->ConnectOutput(task, 1, cOutputHist1);\r
- mgr->ConnectOutput(task, 2, cOutputHist2);\r
- mgr->ConnectOutput(task, 3, cOutputHist3);\r
- \r
- return task;\r
-}\r
+AliAnalysisTask *AddTask_shin_pPbTRD(){
+ //get the current analysis manager
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTask_sweber_JPsi_pPb_TRDtrigger", "No analysis manager found.");
+ return 0;
+ }
+
+
+ //Do we have an MC handler?
+ Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
+
+ //Get the current train configuration
+ // TString trainConfig=gSystem->Getenv("CONFIG_FILE");
+
+ //set config file name
+ TString configBasePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/");
+ TString configFile("Config_shin_pPbTRD.C");
+ TString configFilePath(configBasePath+configFile);
+
+
+
+
+ // TString list=gSystem->Getenv("LIST");
+ //create task and add it to the manager
+ AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDieDataTRDtrigger");
+ if (!hasMC ) task->UsePhysicsSelection();//taking out for testing
+ task->SetTriggerMask(AliVEvent::kTRD);
+ task->SetFiredTriggerName("CINT7WUHJT-B-NOPF-CENT",kTRUE);
+ //task->SetTRDtrigger(3);
+ // task->SetFiredTriggerName("HQU",kFALSE);//take not kTRUE in order not to get both triggers, exclude (since not yet otherwise possible)
+ //
+ //not yet implemented to get a logical or of 2 different trigger classes, therefore exclude HJT, not exactly what I want...
+ // if (list.Contains("LHC11d")) task->SetTriggerMask(AliVEvent::kEMCEJE+AliVEvent::kEMC7+AliVEvent::kEMCEGA);
+ //if (list.Contains("LHC12h")) task->SetTRDtrigger(1+2);
+ mgr->AddTask(task);
+
+
+ //load dielectron configuration file
+ gROOT->LoadMacro(configFilePath.Data());
+
+ //add dielectron analysis with different cuts to the task
+ for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file
+ AliDielectron *dile=Config_shin_pPbTRD(i);
+ if (!dile) continue;
+ task->AddDielectron(dile);
+ }
+
+ //Add event filter
+ AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
+ eventCuts->SetRequireVertex();//NOTE: all of these cuts can for some reasons not be applied to self-filtered AODs by mwinn in
+ //(list/hera/alice/mwinn/mwinn/train/lists/...)
+ eventCuts->SetMinVtxContributors(1);
+ eventCuts->SetVertexZ(-10.,10.);
+ task->SetEventFilter(eventCuts);
+
+
+ //create output container
+ TString containerName = "hayashi_lowmass.root";
+ AliAnalysisDataContainer *coutput1 =
+ mgr->CreateContainer("tree_lowmass",
+ TTree::Class(),
+ AliAnalysisManager::kExchangeContainer,
+ containerName.Data());
+
+ AliAnalysisDataContainer *cOutputHist1 =
+ mgr->CreateContainer("Histos_diel_lowmass",
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data());
+
+ AliAnalysisDataContainer *cOutputHist2 =
+ mgr->CreateContainer("CF_diel_lowmass",
+ TList::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data());
+
+ AliAnalysisDataContainer *cOutputHist3 =
+ mgr->CreateContainer("sweber_EventStat",
+ TH1D::Class(),
+ AliAnalysisManager::kOutputContainer,
+ containerName.Data());
+
+ mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(task, 0, coutput1 );
+ mgr->ConnectOutput(task, 1, cOutputHist1);
+ mgr->ConnectOutput(task, 2, cOutputHist2);
+ mgr->ConnectOutput(task, 3, cOutputHist3);
+
+ return task;
+}
-void InitHistograms(AliDielectron *die, Int_t cutDefinition);\r
-void InitCF(AliDielectron* die, Int_t cutDefinition);\r
-\r
-//void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);\r
-\r
-void SetupTrackCuts(AliDielectron*die, Int_t cutDefinition);\r
-void SetupPairCuts(AliDielectron*die, Int_t cutDefinition);\r
-\r
-\r
-Bool_t kRot = 0;\r
-Bool_t kMix = 1;\r
-\r
-//start systematics\r
-TString names= ("Phiv;Pt10;Open;Mass");\r
-TObjArray *arrNames=names.Tokenize(";");\r
-const Int_t nDie=arrNames->GetEntriesFast();\r
-\r
-AliDielectron* Config_shin_pPbTRD(Int_t cutDefinition=1)\r
-{\r
- //\r
- // Setup the instance of AliDielectron\r
- //\r
- \r
- // create the actual framework object\r
- TString name=Form("%02d",cutDefinition);\r
- if (cutDefinition<arrNames->GetEntriesFast()){\r
- name=arrNames->At(cutDefinition)->GetName();\r
- }\r
- AliDielectron *die =\r
- new AliDielectron(Form("%s",name.Data()),\r
- Form("Track cuts: %s",name.Data()));\r
- \r
- \r
- if(kRot){\r
- AliDielectronTrackRotator *rot = new AliDielectronTrackRotator;\r
- rot->SetConeAnglePhi(TMath::Pi());\r
- rot->SetIterations(10);\r
- die->SetTrackRotator(rot);\r
- }//kRot\r
- \r
- \r
- if(kMix){\r
- AliDielectronMixingHandler *mix = new AliDielectronMixingHandler;\r
- mix->SetMixType(AliDielectronMixingHandler::kAll);\r
- mix->AddVariable(AliDielectronVarManager::kZvPrim,"-10., -7.5, -5., -2.5 , 0., 2.5, 5., 7.5 , 10.");\r
- mix->SetDepth(10);\r
- die->SetMixingHandler(mix);\r
- }//kMix\r
- \r
- \r
- // set track cuts\r
- SetupTrackCuts(die,cutDefinition);\r
- SetupPairCuts(die,cutDefinition);\r
- \r
- // histogram setup\r
- // only if an AliDielectronHistos object is attached to the\r
- // dielectron framework histograms will be filled\r
- InitHistograms(die,cutDefinition);\r
- // if(cutDefinition==0){\r
- // InitCF(die,cutDefinition);\r
- //}\r
-\r
- return die;\r
- \r
-}\r
-\r
-//______________________________________________________________________________________\r
-void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)\r
-{\r
- //\r
- // Setup the track cuts\r
- //\r
- //pairing with TLorentzVector\r
- // die->SetUseKF(kFALSE);\r
- //options\r
- die->SetPreFilterAllSigns();\r
- \r
- \r
-\r
- AliDielectronVarCuts *varkinCuts = new AliDielectronVarCuts("trackkine","trackkine");\r
- varkinCuts->AddCut(AliDielectronVarManager::kPt,0.4,100.);\r
- if(cutDefinition==2){\r
- varkinCuts->AddCut(AliDielectronVarManager::kPt,1.,100.);\r
- }\r
- // if(cutDefinition==3){\r
- // varkinCuts->AddCut(AliDielectronVarManager::kPt,1.,100.);\r
- // }\r
- varkinCuts->AddCut(AliDielectronVarManager::kEta,-0.8,0.8);\r
- die->GetTrackFilter().AddCuts(varkinCuts);\r
- \r
- AliDielectronTrackCuts *TrackCuts = new AliDielectronTrackCuts("StandardCuts","StandardCut");\r
- //refit\r
- TrackCuts->SetRequireTPCRefit(kTRUE);\r
- TrackCuts->SetRequireITSRefit(kTRUE);\r
- //SPD require\r
- // if(cutDefinition == 0 )\r
- TrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);\r
- die->GetTrackFilter().AddCuts(TrackCuts);\r
- \r
-\r
- AliDielectronVarCuts *varCuts = new AliDielectronVarCuts("trackkineandTPCQ","trackkine_and_TPC");\r
- varCuts->AddCut(AliDielectronVarManager::kPt,0.2,100.);\r
- varCuts->AddCut(AliDielectronVarManager::kEta,-0.8,0.8);\r
- varCuts->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);\r
- varCuts->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);\r
- varCuts->AddCut(AliDielectronVarManager::kKinkIndex0,0.);\r
- \r
- varCuts->AddCut(AliDielectronVarManager::kNclsITS,3.,7.);\r
- \r
- varCuts->AddCut(AliDielectronVarManager::kNclsTPC,80.,500.);\r
- varCuts->AddCut(AliDielectronVarManager::kNFclsTPCr,100.,500.); // or NFclsTPCr?\r
- varCuts->AddCut(AliDielectronVarManager::kNFclsTPCfCross,0.5,500.);\r
- varCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);\r
- die->GetTrackFilter().AddCuts(varCuts);\r
- \r
- // if(cutDefinition > 2){\r
- AliDielectronPID *pid = new AliDielectronPID("pid","pid"); \r
- pid->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-1.5,3.,0.2,100.,kFALSE);\r
- pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-100.,3.,0.2,100.,kTRUE);\r
- pid->AddCut(AliDielectronPID::kTOF,AliPID::kElectron,-3.,3.,0.4, 5., kFALSE);\r
- die->GetTrackFilter().AddCuts(pid);\r
- // }\r
- \r
- // }\r
- // if(cutDefinition>0){\r
- \r
- AliDielectronV0Cuts *gammaV0Cuts = new AliDielectronV0Cuts("V0","V0");\r
- gammaV0Cuts->SetPdgCodes(22,11,11);\r
- gammaV0Cuts->SetDefaultPID(16);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kCosPointingAngle, TMath::Cos(0.02), 1.0, kFALSE);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kChi2NDF, 0.0, 10.0, kFALSE);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kLegDist, 0.0, 0.25, kFALSE);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kR, 3.0, 90.0, kFALSE);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kPsiPair, 0.0, 0.05, kFALSE);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kM, 0.0, 0.05, kFALSE);\r
- // gammaV0Cuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0.0, 0.1, kFALSE);\r
- gammaV0Cuts->AddCut(AliDielectronVarManager::kArmPt, 0.0, 0.05, kFALSE);\r
- // gammaV0Cuts->AddCut(AliDielectronVarManager::kArmAlpha, -0.35, 0.35, kFALSE); // not sure if it works as expected\r
- gammaV0Cuts->SetExcludeTracks(kTRUE);\r
- gammaV0Cuts->Print();\r
- \r
- // const Double_t |cutAlphaG| < 0.35; && const Double_t cutQTG < 0.05;\r
- // const Double_t |cutAlphaG2|[2] = {0.6, 0.8}; && const Double_t cutQTG2 < 0.04;\r
- \r
- // if(cuts)\r
- // ((AliDielectronCutGroup*)cuts)->AddCut(gammaV0Cuts);\r
- // else\r
- die->GetTrackFilter().AddCuts(gammaV0Cuts);\r
- \r
- \r
- // }\r
- \r
-}\r
-//----------------------------------Pair Cut-------------------------------------------\r
-void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)\r
-{\r
- // if(cutDefinition > ){\r
- AliDielectronVarCuts *PhiV = new AliDielectronVarCuts("PhiV","PhiV");//mass and Phiv together\r
- PhiV->AddCut(AliDielectronVarManager::kM, 0. , 0.05);\r
- PhiV->AddCut(AliDielectronVarManager::kPhivPair, 2.5 , 3.2);\r
- die->GetPairPreFilter().AddCuts(PhiV);\r
- // }\r
- if(cutDefinition==2){\r
- AliDielectronVarCuts *Open = new AliDielectronVarCuts("Open","Open");//mass and Phiv together\r
- Open->AddCut(AliDielectronVarManager::kM, 0. , 0.1);\r
- Open->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.1);\r
- die->GetPairPreFilter().AddCuts(Open);\r
- \r
- }\r
- if(cutDefinition==3){\r
- AliDielectronVarCuts *Mcut = new AliDielectronVarCuts("Mcut","Mcut");//mass and Phiv together\r
- Mcut->AddCut(AliDielectronVarManager::kM, 0. , 0.1);\r
- // Open->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.1);\r
- die->GetPairPreFilter().AddCuts(Mcut);\r
- \r
- }\r
- \r
-}\r
-\r
-//______________________________________________________________________________________\r
-void InitHistograms(AliDielectron *die, Int_t cutDefinition)\r
-{\r
- //\r
- // Initialise the histograms\r
- //\r
- \r
- //Setup histogram classes\r
- AliDielectronHistos *histos=\r
- new AliDielectronHistos(die->GetName(),\r
- die->GetTitle());\r
- \r
- //Initialise histogram classes\r
- histos->SetReservedWords("Track;Pair");\r
- \r
- //Event class\r
- histos->AddClass("Event");\r
- \r
- //Track classes\r
- //to fill also track info from 2nd event loop until 2\r
- for (Int_t i=0; i<2; ++i){\r
- histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));\r
- }\r
- \r
- //Pair classes\r
- // to fill also mixed event histograms loop until 10\r
- for (Int_t i=0; i<3; ++i){\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));\r
- }\r
-\r
- // histos->AddClass(Form("Pair_%s","lowMassDiele"));\r
-\r
- if(kMix){\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(3))); //ME ++\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(4)));//ME -+\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(6)));//ME +-\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(7))); // ME --\r
- }\r
-\r
- if(kRot)histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(10)));//Rot\r
-\r
-\r
- //add histograms to event class\r
- histos->UserHistogram("Event","nEvents","Number of processed events after cuts;Number events",1,0,1,AliDielectronVarManager::kNevents);\r
- histos->UserHistogram("Event","ZVertex","ZVertex;ZVertex/cm",480,-12.,12.,AliDielectronVarManager::kZvPrim);\r
- histos->UserHistogram("Event","nESDTracks","ESD tracks;ESD tracks;Number events",100,0,200,AliDielectronVarManager::kTracks);\r
- histos->UserHistogram("Event","Nacc","Number of accepted tracks;Number events",100,0,200,AliDielectronVarManager::kNacc);\r
- histos->UserHistogram("Event","NVtxContrib","Number of Vertex Contributor;NVtx;Number events",100,0,100,AliDielectronVarManager::kNVtxContrib);\r
-\r
-\r
- //add histograms to Track classes\r
- histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",1000,0.,10.,AliDielectronVarManager::kPt);\r
- // histos->UserHistogram("Track","Pt_bin2","Pt;Pt [GeV];#tracks",\r
- // "0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.,2.,3.,4.,5.,6.,8.,10"\r
- // ,AliDielectronVarManager::kPt);\r
- // histos->UserHistogram("Track","Eta","Eta; Eta ;#tracks",100,-1.,1.,AliDielectronVarManager::kEta);\r
- // histos->UserHistogram("Track","Phi","Phi; Phi ;#tracks",640,0.,6.4,AliDielectronVarManager::kPhi);\r
-\r
- // histos->UserHistogram("Track","Pt_Eta_Phi","Pt",100,0.,10.,100,-1,1,320,0,6.4,AliDielectronVarManager::kPt,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);\r
-\r
- //histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTPC);\r
- //histos->UserHistogram("Track","nClsoverfindablecluster","Number of found Clusters TPC over findably ;TPC number cluster over findable;#tracks",160,0.0,1.1,AliDielectronVarManager::kNFclsTPCrFrac);\r
- //histos->UserHistogram("Track","Eta_phi","Eta vs Phi;Eta;Phi",100,-1.,1.,320,0.,6.4,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);\r
- histos->UserHistogram("Track","Eta_pt","Eta vs Pt;Eta;Pt",100,-1.,1.,500,0.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kPt);\r
- histos->UserHistogram("Track","Phi_pt","Eta vs Pt;Phi;Pt",640,0.,6.4,500,0.,10.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kPt);\r
- histos->UserHistogram("Track","Eta_Phi","Eta vs Phi;Phi;Pt",640,0.,6.4,200,-1.,1.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kEta);\r
- histos->UserHistogram("Track","TOFnSigma_MomEle","TOF number of sigmas Electrons vs Momentum;Mom;TOFsigmaEle",500,0.,5.,700,-30,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaEle);\r
- histos->UserHistogram("Track","TPCdEdx_P","dEdx;P [GeV];TPC signal (arb units) vs Momentum;Mom;TPCsignal", 1000,0,10.,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal);\r
- histos->UserHistogram("Track","TPCnSigma_P","TPC number of sigmas Electrons vs Eta;Eta;TPCsigmaEle",100,0.,10.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle);\r
- //histos->UserHistogram("Track","TPCnSigma_Eta","TPC number of sigmas Electrons vs Eta;Eta;TPCsigmaEle",800,-0.8.,0.8.,800,-40,40,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle);\r
- //histos->UserHistogram("Track","TPCdEdx_Eta","TPC dEdx vs Eta;Eta;TPCsigmaEle",800,-0.8,0.8,800,0,200,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCsignal);\r
- //histos->UserHistogram("Track","TPCnSigma_Phi","TPC number of sigmas Electrons vs Phi;Phi;TPCsigmaEle",640,0.,6.4,800,-40,40,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCnSigmaEle);\r
- // histos->UserHistogram("Track","TPCdEdx_Phi","TPC dEdx vs Phi;Phi;TPCsigmaEle",640,0.,6.4,800,0,200,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCsignal);\r
-\r
- \r
-\r
- //add histograms to Pair classes\r
-\r
- // histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- // 500,0,4,AliDielectronVarManager::kM);\r
-\r
- // histos->UserHistogram("Pair","InvMass_low","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- // 500,0,0.5,AliDielectronVarManager::kM);\r
- /*\r
- histos->UserHistogram("Pair","kDeltaEta","kDeltaEta;kDeltaEta;#pairs",\r
- 160,0.,1.6,AliDielectronVarManager::kDeltaEta);\r
- histos->UserHistogram("Pair","kDeltaPhi","kDeltaPhi;kDeltaPhi;#pairs",\r
- 320,0.,6.4,AliDielectronVarManager::kDeltaPhi);\r
- histos->UserHistogram("Pair","PhiV",";PhiV;#pairs",\r
- 320,0.,6.4,AliDielectronVarManager::kPhivPair);\r
- histos->UserHistogram("Pair","InvMass_bin2","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- "0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 , \r
- 0.4 , 0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,\r
- 0.95, 0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 , \r
- 2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 , \r
- 3.3 , 3.5, 3.75 , 4.0",AliDielectronVarManager::kM);\r
- histos->UserHistogram("Pair",\r
- "InvMass_Pt","InvMass_Pt;InvMass;Pt",\r
- 500, 0. , 4., 100 , 0., 5. ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kPt );\r
- */\r
- histos->UserHistogram("Pair",\r
- "InvMass_Pt","InvMass_Pt;InvMass;Pt",\r
- 400, 0. , 4., 1000 , 0., 10. ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kPt );\r
- histos->UserHistogram("Pair",\r
- "InvMass_Eta","InvMass_Eta;InvMass;Eta",\r
- 400, 0. , 4., 200 , -1., 1. ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kEta );\r
- histos->UserHistogram("Pair",\r
- "InvMass_PhivPair","InvMass_PhivPair;InvMass;PhivPair",\r
- 400, 0. , 4., 320 , 0., 3.2 ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kPhivPair );\r
- histos->UserHistogram("Pair",\r
- "InvMass_dPhi","InvMass_PhivPair;InvMass;PhivPair",\r
- 400, 0. , 4., 320 , 0., 3.2 ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kDeltaPhi );\r
- histos->UserHistogram("Pair",\r
- "InvMass_OpenAng","OpAngle_InvMass;Opening angle;Invariant Mass",\r
- 400 , 0. , 4. , 320, 0. , 3.2,\r
- AliDielectronVarManager::kM, AliDielectronVarManager::kOpeningAngle);\r
-\r
-\r
- /*\r
- histos->UserHistogram("Pair",\r
- "Y_PtPair","InvMass_PhivPair;InvMass;PhivPair",\r
- 120, -1.2. , 1.2, 100 , 0., 5. ,\r
- AliDielectronVarManager::kY , AliDielectronVarManager::kPt );\r
- histos->UserHistogram("Pair",\r
- "OpAngle","Opening angle;Opening angle;#pairs",\r
- 320, 0. , 3.2, \r
- AliDielectronVarManager::kOpeningAngle);\r
- histos->UserHistogram("Pair",\r
- "OpAngle_InvMass","OpAngle_InvMass;Opening angle;Invariant Mass",\r
- 320, 0. , 3.2, 500 , 0. , 4. ,\r
- AliDielectronVarManager::kOpeningAngle,AliDielectronVarManager::kM);\r
- histos->UserHistogram("Pair",\r
- "Phi","Phi;counts;Phi",\r
- 320, 0. , 6.4, AliDielectronVarManager::kPhi);\r
- histos->UserHistogram("Pair",\r
- "Y","Y;counts;Y",\r
- 120, -1.2 , 1.2, AliDielectronVarManager::kY);\r
- histos->UserHistogram("Pair",\r
- "Pt","Pt;counts;Pt",\r
- 500, 0 , 10, AliDielectronVarManager::kPt);\r
- */ \r
- die->SetHistogramManager(histos);\r
- \r
-}\r
-\r
-\r
-\r
-\r
-void InitCF(AliDielectron* die, Int_t cutDefinition)\r
-{\r
- //\r
- // Setup the CF Manager if needed\r
- //\r
- \r
- AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());\r
- \r
- //pair variables\r
- // cf->AddVariable(AliDielectronVarManager::kM,500,0.,4.);\r
- cf->AddVariable(AliDielectronVarManager::kM,"0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 , \r
- 0.4 , 0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,\r
- 0.95, 0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 , \r
- 2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 , \r
- 3.3 , 3.5, 3.75 , 4.0");//data\r
- cf->AddVariable(AliDielectronVarManager::kM,500,0.,5.);\r
- cf->AddVariable(AliDielectronVarManager::kM,500,0.,0.1);\r
- // cf->AddVariable(AliDielectronVarManager::kM,500,0.,0.1);\r
- cf->AddVariable(AliDielectronVarManager::kY,20,-1.,1.);\r
- cf->AddVariable(AliDielectronVarManager::kR,500,0.,100.);\r
- cf->AddVariable(AliDielectronVarManager::kPhi,32, 0., 3.2);\r
- cf->AddVariable(AliDielectronVarManager::kPt,100,0.,5.);\r
- cf->AddVariable(AliDielectronVarManager::kPt,"0.,0.2,0.3,0.4,0.5,0.6,0.8,1.0,1.25,1.5,1.75,2.0,3.,5.");\r
- cf->AddVariable(AliDielectronVarManager::kOpeningAngle,62,0.,6.2);\r
- cf->AddVariable(AliDielectronVarManager::kPhivPair,64, 0., 6.4);\r
- cf->AddVariable(AliDielectronVarManager::kPairType,4,-0.5,3.5);\r
-\r
-\r
- cf->AddVariable(AliDielectronVarManager::kEta,40,-1.,1.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kCharge,40,-2.,2.,kTRUE);\r
- //leg \r
- cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kPhi,36,0.,360.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kEta,100,-1.,1.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,20,-3.,4.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kTPCsignal,"40,50,55,60,65,68,70,72,75,80,90,100,110,120",kTRUE);\r
- // cf->AddVariable(AliDielectronVarManager::kTPCsignal,200,0.,200.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kNFclsTPCr,200,0.,200.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kNFclsTPCfCross,200,0.,2.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kTPCchi2Cl,200,0.,10.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kImpactParXY,400,-.5,.5,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kImpactParZ,400,-2.,2.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kNclsITS,10,0.,10.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kNFclsTPCrFrac,10,0.,1.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);\r
-\r
-\r
- if(cutDefinition==0){\r
- cf->SetStepForMCtruth();\r
- }\r
- cf->SetStepForAfterAllCuts();\r
- cf->SetStepsForSignal();\r
- die->SetCFManagerPair(cf);\r
-\r
-\r
- //primary\r
- AliDielectronSignalMC* DielePrimary=new\r
- AliDielectronSignalMC("Diele Primary","low mass primary dielectron pairs");\r
- DielePrimary->SetLegPDGs(11,-11);\r
- DielePrimary->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- DielePrimary->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- //DielePrimary->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(DielePrimary);\r
-\r
- // secondary \r
- AliDielectronSignalMC* secsec = new \r
- AliDielectronSignalMC("Secondarypairs","secondary electron pairs"); // pairs made from conversion (may be also from 2 different conversions)\r
- secsec->SetLegPDGs(11,-11);\r
- secsec->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- secsec->SetLegSources(AliDielectronSignalMC::kSecondary, AliDielectronSignalMC::kSecondary);\r
- // secsec->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(secsec);\r
- \r
- // secondary-primary\r
- AliDielectronSignalMC* DielePriSec=new\r
- AliDielectronSignalMC("Diele Prim-Sec","low mass prim-sec dielectron pairs");\r
- DielePriSec->SetLegPDGs(11,-11);\r
- DielePriSec->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- DielePriSec->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kSecondary);\r
- //DielePriSec->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(DielePriSec);\r
-\r
- /*\r
- AliDielectronSignalMC* DielePrimary=new\r
- AliDielectronSignalMC("Diele Primary","low mass primary dielectron pairs");\r
- DielePrimary->SetLegPDGs(11,-11);\r
- DielePrimary->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- DielePrimary->SetLegSources(AliDielectronSignalMC::kFinalState,\r
- AliDielectronSignalMC::kFinalState);\r
- DielePrimary->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- DielePrimary->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(DielePrimary);\r
- */\r
- \r
- AliDielectronSignalMC* pi0 = new AliDielectronSignalMC("pi0dalitz","pi0dalitz");\r
- pi0->SetLegPDGs(11,-11);\r
- pi0->SetMotherPDGs(111,111);\r
- pi0->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- pi0->SetLegSources(AliDielectronSignalMC::kFinalState,AliDielectronSignalMC::kFinalState);\r
- pi0->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- pi0->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- pi0->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(pi0);\r
-\r
- AliDielectronSignalMC* etaSig = new AliDielectronSignalMC("Eta", "etaSignal"); ///eta dalitz pairs \r
- etaSig->SetLegPDGs(11,-11);\r
- etaSig->SetMotherPDGs(221,221);\r
- etaSig->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- etaSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- etaSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);\r
- etaSig->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- etaSig->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- etaSig->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(etaSig);\r
-\r
- AliDielectronSignalMC* etaprimeSig = new AliDielectronSignalMC("Etaprime", "etaprimeSignal"); ///etaprime pairs \r
- etaprimeSig->SetLegPDGs(11,-11);\r
- etaprimeSig->SetMotherPDGs(331,331);\r
- etaprimeSig->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- etaprimeSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- etaprimeSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);\r
- etaprimeSig->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- etaprimeSig->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- etaprimeSig->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(etaprimeSig);\r
-\r
- AliDielectronSignalMC* rhoSig = new AliDielectronSignalMC("Rho", "rhoSignal"); ///rho pairs \r
- rhoSig->SetLegPDGs(11,-11);\r
- rhoSig->SetMotherPDGs(113,113);\r
- rhoSig->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- rhoSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- rhoSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);\r
- rhoSig->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- rhoSig->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- rhoSig->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(rhoSig);\r
-\r
- AliDielectronSignalMC* omegaSig = new AliDielectronSignalMC("Omega", "omegaSignal"); ///omega pairs \r
- omegaSig->SetLegPDGs(11,-11);\r
- omegaSig->SetMotherPDGs(223,223);\r
- omegaSig->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- omegaSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- omegaSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);\r
- omegaSig->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- omegaSig->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- omegaSig->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(omegaSig);\r
- \r
- AliDielectronSignalMC* phiSig = new AliDielectronSignalMC("Phi", "phiSignal"); ///phi pairs \r
- phiSig->SetLegPDGs(11,-11);\r
- phiSig->SetMotherPDGs(333,333);\r
- phiSig->SetMothersRelation(AliDielectronSignalMC::kSame);\r
- phiSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- phiSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);\r
- phiSig->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- phiSig->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- phiSig->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(phiSig);\r
-\r
- AliDielectronSignalMC* dieleOpenCharm = new AliDielectronSignalMC("dieleOpenCharm", "dieleOpenCharm");\r
- dieleOpenCharm->SetLegPDGs(11,-11);\r
- dieleOpenCharm->SetMotherPDGs(402,402);\r
- dieleOpenCharm->SetLegSources(AliDielectronSignalMC::kFinalState,AliDielectronSignalMC::kFinalState);\r
- dieleOpenCharm->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- dieleOpenCharm->SetCheckBothChargesMothers(kTRUE,kTRUE);\r
- dieleOpenCharm->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(dieleOpenCharm);\r
- \r
- AliDielectronSignalMC* diEleCharm = new AliDielectronSignalMC("diEleCharm","di-electrons from charm"); // dielectrons originating from charm hadrons (not neccessary from same mother)\r
- diEleCharm->SetLegPDGs(11,-11);\r
- diEleCharm->SetMotherPDGs(403,403);\r
- diEleCharm->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
- diEleCharm->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- diEleCharm->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(diEleCharm);\r
- \r
- \r
-}\r
-\r
-\r
-\r
-\r
-\r
+void InitHistograms(AliDielectron *die, Int_t cutDefinition);
+void InitCF(AliDielectron* die, Int_t cutDefinition);
+
+//void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
+
+void SetupTrackCuts(AliDielectron*die, Int_t cutDefinition);
+void SetupPairCuts(AliDielectron*die, Int_t cutDefinition);
+
+
+Bool_t kRot = 0;
+Bool_t kMix = 1;
+
+//start systematics
+TString names= ("Phiv;Pt10;Open;Mass");
+TObjArray *arrNames=names.Tokenize(";");
+const Int_t nDie=arrNames->GetEntriesFast();
+
+AliDielectron* Config_shin_pPbTRD(Int_t cutDefinition=1)
+{
+ //
+ // Setup the instance of AliDielectron
+ //
+
+ // create the actual framework object
+ TString name=Form("%02d",cutDefinition);
+ if (cutDefinition<arrNames->GetEntriesFast()){
+ name=arrNames->At(cutDefinition)->GetName();
+ }
+ AliDielectron *die =
+ new AliDielectron(Form("%s",name.Data()),
+ Form("Track cuts: %s",name.Data()));
+
+
+ if(kRot){
+ AliDielectronTrackRotator *rot = new AliDielectronTrackRotator;
+ rot->SetConeAnglePhi(TMath::Pi());
+ rot->SetIterations(10);
+ die->SetTrackRotator(rot);
+ }//kRot
+
+
+ if(kMix){
+ AliDielectronMixingHandler *mix = new AliDielectronMixingHandler;
+ mix->SetMixType(AliDielectronMixingHandler::kAll);
+ mix->AddVariable(AliDielectronVarManager::kZvPrim,"-10., -7.5, -5., -2.5 , 0., 2.5, 5., 7.5 , 10.");
+ mix->SetDepth(10);
+ die->SetMixingHandler(mix);
+ }//kMix
+
+
+ // set track cuts
+ SetupTrackCuts(die,cutDefinition);
+ SetupPairCuts(die,cutDefinition);
+
+ // histogram setup
+ // only if an AliDielectronHistos object is attached to the
+ // dielectron framework histograms will be filled
+ InitHistograms(die,cutDefinition);
+ // if(cutDefinition==0){
+ // InitCF(die,cutDefinition);
+ //}
+
+ return die;
+
+}
+
+//______________________________________________________________________________________
+void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
+{
+ //
+ // Setup the track cuts
+ //
+ //pairing with TLorentzVector
+ // die->SetUseKF(kFALSE);
+ //options
+ die->SetPreFilterAllSigns();
+
+
+
+ AliDielectronVarCuts *varkinCuts = new AliDielectronVarCuts("trackkine","trackkine");
+ varkinCuts->AddCut(AliDielectronVarManager::kPt,0.4,100.);
+ if(cutDefinition==2){
+ varkinCuts->AddCut(AliDielectronVarManager::kPt,1.,100.);
+ }
+ // if(cutDefinition==3){
+ // varkinCuts->AddCut(AliDielectronVarManager::kPt,1.,100.);
+ // }
+ varkinCuts->AddCut(AliDielectronVarManager::kEta,-0.8,0.8);
+ die->GetTrackFilter().AddCuts(varkinCuts);
+
+ AliDielectronTrackCuts *TrackCuts = new AliDielectronTrackCuts("StandardCuts","StandardCut");
+ //refit
+ TrackCuts->SetRequireTPCRefit(kTRUE);
+ TrackCuts->SetRequireITSRefit(kTRUE);
+ //SPD require
+ // if(cutDefinition == 0 )
+ TrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
+ die->GetTrackFilter().AddCuts(TrackCuts);
+
+
+ AliDielectronVarCuts *varCuts = new AliDielectronVarCuts("trackkineandTPCQ","trackkine_and_TPC");
+ varCuts->AddCut(AliDielectronVarManager::kPt,0.2,100.);
+ varCuts->AddCut(AliDielectronVarManager::kEta,-0.8,0.8);
+ varCuts->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+ varCuts->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+ varCuts->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
+
+ varCuts->AddCut(AliDielectronVarManager::kNclsITS,3.,7.);
+
+ varCuts->AddCut(AliDielectronVarManager::kNclsTPC,80.,500.);
+ varCuts->AddCut(AliDielectronVarManager::kNFclsTPCr,100.,500.); // or NFclsTPCr?
+ varCuts->AddCut(AliDielectronVarManager::kNFclsTPCfCross,0.5,500.);
+ varCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+ die->GetTrackFilter().AddCuts(varCuts);
+
+ // if(cutDefinition > 2){
+ AliDielectronPID *pid = new AliDielectronPID("pid","pid");
+ pid->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-1.5,3.,0.2,100.,kFALSE);
+ pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-100.,3.,0.2,100.,kTRUE);
+ pid->AddCut(AliDielectronPID::kTOF,AliPID::kElectron,-3.,3.,0.4, 5., kFALSE);
+ die->GetTrackFilter().AddCuts(pid);
+ // }
+
+ // }
+ // if(cutDefinition>0){
+
+ AliDielectronV0Cuts *gammaV0Cuts = new AliDielectronV0Cuts("V0","V0");
+ gammaV0Cuts->SetPdgCodes(22,11,11);
+ gammaV0Cuts->SetDefaultPID(16);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kCosPointingAngle, TMath::Cos(0.02), 1.0, kFALSE);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kChi2NDF, 0.0, 10.0, kFALSE);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kLegDist, 0.0, 0.25, kFALSE);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kR, 3.0, 90.0, kFALSE);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kPsiPair, 0.0, 0.05, kFALSE);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kM, 0.0, 0.05, kFALSE);
+ // gammaV0Cuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0.0, 0.1, kFALSE);
+ gammaV0Cuts->AddCut(AliDielectronVarManager::kArmPt, 0.0, 0.05, kFALSE);
+ // gammaV0Cuts->AddCut(AliDielectronVarManager::kArmAlpha, -0.35, 0.35, kFALSE); // not sure if it works as expected
+ gammaV0Cuts->SetExcludeTracks(kTRUE);
+ gammaV0Cuts->Print();
+
+ // const Double_t |cutAlphaG| < 0.35; && const Double_t cutQTG < 0.05;
+ // const Double_t |cutAlphaG2|[2] = {0.6, 0.8}; && const Double_t cutQTG2 < 0.04;
+
+ // if(cuts)
+ // ((AliDielectronCutGroup*)cuts)->AddCut(gammaV0Cuts);
+ // else
+ die->GetTrackFilter().AddCuts(gammaV0Cuts);
+
+
+ // }
+
+}
+//----------------------------------Pair Cut-------------------------------------------
+void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)
+{
+ // if(cutDefinition > ){
+ AliDielectronVarCuts *PhiV = new AliDielectronVarCuts("PhiV","PhiV");//mass and Phiv together
+ PhiV->AddCut(AliDielectronVarManager::kM, 0. , 0.05);
+ PhiV->AddCut(AliDielectronVarManager::kPhivPair, 2.5 , 3.2);
+ die->GetPairPreFilter().AddCuts(PhiV);
+ // }
+ if(cutDefinition==2){
+ AliDielectronVarCuts *Open = new AliDielectronVarCuts("Open","Open");//mass and Phiv together
+ Open->AddCut(AliDielectronVarManager::kM, 0. , 0.1);
+ Open->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.1);
+ die->GetPairPreFilter().AddCuts(Open);
+
+ }
+ if(cutDefinition==3){
+ AliDielectronVarCuts *Mcut = new AliDielectronVarCuts("Mcut","Mcut");//mass and Phiv together
+ Mcut->AddCut(AliDielectronVarManager::kM, 0. , 0.1);
+ // Open->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.1);
+ die->GetPairPreFilter().AddCuts(Mcut);
+
+ }
+
+}
+
+//______________________________________________________________________________________
+void InitHistograms(AliDielectron *die, Int_t cutDefinition)
+{
+ //
+ // Initialise the histograms
+ //
+
+ //Setup histogram classes
+ AliDielectronHistos *histos=
+ new AliDielectronHistos(die->GetName(),
+ die->GetTitle());
+
+ //Initialise histogram classes
+ histos->SetReservedWords("Track;Pair");
+
+ //Event class
+ histos->AddClass("Event");
+
+ //Track classes
+ //to fill also track info from 2nd event loop until 2
+ for (Int_t i=0; i<2; ++i){
+ histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));
+ }
+
+ //Pair classes
+ // to fill also mixed event histograms loop until 10
+ for (Int_t i=0; i<3; ++i){
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
+ }
+
+ // histos->AddClass(Form("Pair_%s","lowMassDiele"));
+
+ if(kMix){
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(3))); //ME ++
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(4)));//ME -+
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(6)));//ME +-
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(7))); // ME --
+ }
+
+ if(kRot)histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(10)));//Rot
+
+
+ //add histograms to event class
+ histos->UserHistogram("Event","nEvents","Number of processed events after cuts;Number events",1,0,1,AliDielectronVarManager::kNevents);
+ histos->UserHistogram("Event","ZVertex","ZVertex;ZVertex/cm",480,-12.,12.,AliDielectronVarManager::kZvPrim);
+ histos->UserHistogram("Event","nESDTracks","ESD tracks;ESD tracks;Number events",100,0,200,AliDielectronVarManager::kTracks);
+ histos->UserHistogram("Event","Nacc","Number of accepted tracks;Number events",100,0,200,AliDielectronVarManager::kNacc);
+ histos->UserHistogram("Event","NVtxContrib","Number of Vertex Contributor;NVtx;Number events",100,0,100,AliDielectronVarManager::kNVtxContrib);
+
+
+ //add histograms to Track classes
+ histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",1000,0.,10.,AliDielectronVarManager::kPt);
+ // histos->UserHistogram("Track","Pt_bin2","Pt;Pt [GeV];#tracks",
+ // "0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.,2.,3.,4.,5.,6.,8.,10"
+ // ,AliDielectronVarManager::kPt);
+ // histos->UserHistogram("Track","Eta","Eta; Eta ;#tracks",100,-1.,1.,AliDielectronVarManager::kEta);
+ // histos->UserHistogram("Track","Phi","Phi; Phi ;#tracks",640,0.,6.4,AliDielectronVarManager::kPhi);
+
+ // histos->UserHistogram("Track","Pt_Eta_Phi","Pt",100,0.,10.,100,-1,1,320,0,6.4,AliDielectronVarManager::kPt,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+
+ //histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTPC);
+ //histos->UserHistogram("Track","nClsoverfindablecluster","Number of found Clusters TPC over findably ;TPC number cluster over findable;#tracks",160,0.0,1.1,AliDielectronVarManager::kNFclsTPCrFrac);
+ //histos->UserHistogram("Track","Eta_phi","Eta vs Phi;Eta;Phi",100,-1.,1.,320,0.,6.4,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+ histos->UserHistogram("Track","Eta_pt","Eta vs Pt;Eta;Pt",100,-1.,1.,500,0.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kPt);
+ histos->UserHistogram("Track","Phi_pt","Eta vs Pt;Phi;Pt",640,0.,6.4,500,0.,10.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kPt);
+ histos->UserHistogram("Track","Eta_Phi","Eta vs Phi;Phi;Pt",640,0.,6.4,200,-1.,1.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kEta);
+ histos->UserHistogram("Track","TOFnSigma_MomEle","TOF number of sigmas Electrons vs Momentum;Mom;TOFsigmaEle",500,0.,5.,700,-30,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaEle);
+ histos->UserHistogram("Track","TPCdEdx_P","dEdx;P [GeV];TPC signal (arb units) vs Momentum;Mom;TPCsignal", 1000,0,10.,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal);
+ histos->UserHistogram("Track","TPCnSigma_P","TPC number of sigmas Electrons vs Eta;Eta;TPCsigmaEle",100,0.,10.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle);
+ //histos->UserHistogram("Track","TPCnSigma_Eta","TPC number of sigmas Electrons vs Eta;Eta;TPCsigmaEle",800,-0.8.,0.8.,800,-40,40,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle);
+ //histos->UserHistogram("Track","TPCdEdx_Eta","TPC dEdx vs Eta;Eta;TPCsigmaEle",800,-0.8,0.8,800,0,200,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCsignal);
+ //histos->UserHistogram("Track","TPCnSigma_Phi","TPC number of sigmas Electrons vs Phi;Phi;TPCsigmaEle",640,0.,6.4,800,-40,40,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCnSigmaEle);
+ // histos->UserHistogram("Track","TPCdEdx_Phi","TPC dEdx vs Phi;Phi;TPCsigmaEle",640,0.,6.4,800,0,200,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCsignal);
+
+
+
+ //add histograms to Pair classes
+
+ // histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
+ // 500,0,4,AliDielectronVarManager::kM);
+
+ // histos->UserHistogram("Pair","InvMass_low","Inv.Mass;Inv. Mass [GeV];#pairs",
+ // 500,0,0.5,AliDielectronVarManager::kM);
+ /*
+ histos->UserHistogram("Pair","kDeltaEta","kDeltaEta;kDeltaEta;#pairs",
+ 160,0.,1.6,AliDielectronVarManager::kDeltaEta);
+ histos->UserHistogram("Pair","kDeltaPhi","kDeltaPhi;kDeltaPhi;#pairs",
+ 320,0.,6.4,AliDielectronVarManager::kDeltaPhi);
+ histos->UserHistogram("Pair","PhiV",";PhiV;#pairs",
+ 320,0.,6.4,AliDielectronVarManager::kPhivPair);
+ histos->UserHistogram("Pair","InvMass_bin2","Inv.Mass;Inv. Mass [GeV];#pairs",
+ "0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 ,
+ 0.4 , 0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,
+ 0.95, 0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 ,
+ 2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 ,
+ 3.3 , 3.5, 3.75 , 4.0",AliDielectronVarManager::kM);
+ histos->UserHistogram("Pair",
+ "InvMass_Pt","InvMass_Pt;InvMass;Pt",
+ 500, 0. , 4., 100 , 0., 5. ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kPt );
+ */
+ histos->UserHistogram("Pair",
+ "InvMass_Pt","InvMass_Pt;InvMass;Pt",
+ 400, 0. , 4., 1000 , 0., 10. ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kPt );
+ histos->UserHistogram("Pair",
+ "InvMass_Eta","InvMass_Eta;InvMass;Eta",
+ 400, 0. , 4., 200 , -1., 1. ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kEta );
+ histos->UserHistogram("Pair",
+ "InvMass_PhivPair","InvMass_PhivPair;InvMass;PhivPair",
+ 400, 0. , 4., 320 , 0., 3.2 ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kPhivPair );
+ histos->UserHistogram("Pair",
+ "InvMass_dPhi","InvMass_PhivPair;InvMass;PhivPair",
+ 400, 0. , 4., 320 , 0., 3.2 ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kDeltaPhi );
+ histos->UserHistogram("Pair",
+ "InvMass_OpenAng","OpAngle_InvMass;Opening angle;Invariant Mass",
+ 400 , 0. , 4. , 320, 0. , 3.2,
+ AliDielectronVarManager::kM, AliDielectronVarManager::kOpeningAngle);
+
+
+ /*
+ histos->UserHistogram("Pair",
+ "Y_PtPair","InvMass_PhivPair;InvMass;PhivPair",
+ 120, -1.2. , 1.2, 100 , 0., 5. ,
+ AliDielectronVarManager::kY , AliDielectronVarManager::kPt );
+ histos->UserHistogram("Pair",
+ "OpAngle","Opening angle;Opening angle;#pairs",
+ 320, 0. , 3.2,
+ AliDielectronVarManager::kOpeningAngle);
+ histos->UserHistogram("Pair",
+ "OpAngle_InvMass","OpAngle_InvMass;Opening angle;Invariant Mass",
+ 320, 0. , 3.2, 500 , 0. , 4. ,
+ AliDielectronVarManager::kOpeningAngle,AliDielectronVarManager::kM);
+ histos->UserHistogram("Pair",
+ "Phi","Phi;counts;Phi",
+ 320, 0. , 6.4, AliDielectronVarManager::kPhi);
+ histos->UserHistogram("Pair",
+ "Y","Y;counts;Y",
+ 120, -1.2 , 1.2, AliDielectronVarManager::kY);
+ histos->UserHistogram("Pair",
+ "Pt","Pt;counts;Pt",
+ 500, 0 , 10, AliDielectronVarManager::kPt);
+ */
+ die->SetHistogramManager(histos);
+
+}
+
+
+
+
+void InitCF(AliDielectron* die, Int_t cutDefinition)
+{
+ //
+ // Setup the CF Manager if needed
+ //
+
+ AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
+
+ //pair variables
+ // cf->AddVariable(AliDielectronVarManager::kM,500,0.,4.);
+ cf->AddVariable(AliDielectronVarManager::kM,"0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 ,
+ 0.4 , 0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,
+ 0.95, 0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 ,
+ 2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 ,
+ 3.3 , 3.5, 3.75 , 4.0");//data
+ cf->AddVariable(AliDielectronVarManager::kM,500,0.,5.);
+ cf->AddVariable(AliDielectronVarManager::kM,500,0.,0.1);
+ // cf->AddVariable(AliDielectronVarManager::kM,500,0.,0.1);
+ cf->AddVariable(AliDielectronVarManager::kY,20,-1.,1.);
+ cf->AddVariable(AliDielectronVarManager::kR,500,0.,100.);
+ cf->AddVariable(AliDielectronVarManager::kPhi,32, 0., 3.2);
+ cf->AddVariable(AliDielectronVarManager::kPt,100,0.,5.);
+ cf->AddVariable(AliDielectronVarManager::kPt,"0.,0.2,0.3,0.4,0.5,0.6,0.8,1.0,1.25,1.5,1.75,2.0,3.,5.");
+ cf->AddVariable(AliDielectronVarManager::kOpeningAngle,62,0.,6.2);
+ cf->AddVariable(AliDielectronVarManager::kPhivPair,64, 0., 6.4);
+ cf->AddVariable(AliDielectronVarManager::kPairType,4,-0.5,3.5);
+
+
+ cf->AddVariable(AliDielectronVarManager::kEta,40,-1.,1.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kCharge,40,-2.,2.,kTRUE);
+ //leg
+ cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kPhi,36,0.,360.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kEta,100,-1.,1.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,20,-3.,4.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kTPCsignal,"40,50,55,60,65,68,70,72,75,80,90,100,110,120",kTRUE);
+ // cf->AddVariable(AliDielectronVarManager::kTPCsignal,200,0.,200.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kNFclsTPCr,200,0.,200.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kNFclsTPCfCross,200,0.,2.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kTPCchi2Cl,200,0.,10.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kImpactParXY,400,-.5,.5,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kImpactParZ,400,-2.,2.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kNclsITS,10,0.,10.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kNFclsTPCrFrac,10,0.,1.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
+
+
+ if(cutDefinition==0){
+ cf->SetStepForMCtruth();
+ }
+ cf->SetStepForAfterAllCuts();
+ cf->SetStepsForSignal();
+ die->SetCFManagerPair(cf);
+
+
+ //primary
+ AliDielectronSignalMC* DielePrimary=new
+ AliDielectronSignalMC("Diele Primary","low mass primary dielectron pairs");
+ DielePrimary->SetLegPDGs(11,-11);
+ DielePrimary->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ DielePrimary->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ //DielePrimary->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(DielePrimary);
+
+ // secondary
+ AliDielectronSignalMC* secsec = new
+ AliDielectronSignalMC("Secondarypairs","secondary electron pairs"); // pairs made from conversion (may be also from 2 different conversions)
+ secsec->SetLegPDGs(11,-11);
+ secsec->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ secsec->SetLegSources(AliDielectronSignalMC::kSecondary, AliDielectronSignalMC::kSecondary);
+ // secsec->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(secsec);
+
+ // secondary-primary
+ AliDielectronSignalMC* DielePriSec=new
+ AliDielectronSignalMC("Diele Prim-Sec","low mass prim-sec dielectron pairs");
+ DielePriSec->SetLegPDGs(11,-11);
+ DielePriSec->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ DielePriSec->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kSecondary);
+ //DielePriSec->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(DielePriSec);
+
+ /*
+ AliDielectronSignalMC* DielePrimary=new
+ AliDielectronSignalMC("Diele Primary","low mass primary dielectron pairs");
+ DielePrimary->SetLegPDGs(11,-11);
+ DielePrimary->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ DielePrimary->SetLegSources(AliDielectronSignalMC::kFinalState,
+ AliDielectronSignalMC::kFinalState);
+ DielePrimary->SetMothersRelation(AliDielectronSignalMC::kSame);
+ DielePrimary->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(DielePrimary);
+ */
+
+ AliDielectronSignalMC* pi0 = new AliDielectronSignalMC("pi0dalitz","pi0dalitz");
+ pi0->SetLegPDGs(11,-11);
+ pi0->SetMotherPDGs(111,111);
+ pi0->SetMothersRelation(AliDielectronSignalMC::kSame);
+ pi0->SetLegSources(AliDielectronSignalMC::kFinalState,AliDielectronSignalMC::kFinalState);
+ pi0->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ pi0->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ pi0->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(pi0);
+
+ AliDielectronSignalMC* etaSig = new AliDielectronSignalMC("Eta", "etaSignal"); ///eta dalitz pairs
+ etaSig->SetLegPDGs(11,-11);
+ etaSig->SetMotherPDGs(221,221);
+ etaSig->SetMothersRelation(AliDielectronSignalMC::kSame);
+ etaSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ etaSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);
+ etaSig->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ etaSig->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ etaSig->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(etaSig);
+
+ AliDielectronSignalMC* etaprimeSig = new AliDielectronSignalMC("Etaprime", "etaprimeSignal"); ///etaprime pairs
+ etaprimeSig->SetLegPDGs(11,-11);
+ etaprimeSig->SetMotherPDGs(331,331);
+ etaprimeSig->SetMothersRelation(AliDielectronSignalMC::kSame);
+ etaprimeSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ etaprimeSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);
+ etaprimeSig->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ etaprimeSig->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ etaprimeSig->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(etaprimeSig);
+
+ AliDielectronSignalMC* rhoSig = new AliDielectronSignalMC("Rho", "rhoSignal"); ///rho pairs
+ rhoSig->SetLegPDGs(11,-11);
+ rhoSig->SetMotherPDGs(113,113);
+ rhoSig->SetMothersRelation(AliDielectronSignalMC::kSame);
+ rhoSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ rhoSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);
+ rhoSig->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ rhoSig->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ rhoSig->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(rhoSig);
+
+ AliDielectronSignalMC* omegaSig = new AliDielectronSignalMC("Omega", "omegaSignal"); ///omega pairs
+ omegaSig->SetLegPDGs(11,-11);
+ omegaSig->SetMotherPDGs(223,223);
+ omegaSig->SetMothersRelation(AliDielectronSignalMC::kSame);
+ omegaSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ omegaSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);
+ omegaSig->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ omegaSig->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ omegaSig->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(omegaSig);
+
+ AliDielectronSignalMC* phiSig = new AliDielectronSignalMC("Phi", "phiSignal"); ///phi pairs
+ phiSig->SetLegPDGs(11,-11);
+ phiSig->SetMotherPDGs(333,333);
+ phiSig->SetMothersRelation(AliDielectronSignalMC::kSame);
+ phiSig->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ phiSig->SetMotherSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kPrimary);
+ phiSig->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ phiSig->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ phiSig->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(phiSig);
+
+ AliDielectronSignalMC* dieleOpenCharm = new AliDielectronSignalMC("dieleOpenCharm", "dieleOpenCharm");
+ dieleOpenCharm->SetLegPDGs(11,-11);
+ dieleOpenCharm->SetMotherPDGs(402,402);
+ dieleOpenCharm->SetLegSources(AliDielectronSignalMC::kFinalState,AliDielectronSignalMC::kFinalState);
+ dieleOpenCharm->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ dieleOpenCharm->SetCheckBothChargesMothers(kTRUE,kTRUE);
+ dieleOpenCharm->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(dieleOpenCharm);
+
+ AliDielectronSignalMC* diEleCharm = new AliDielectronSignalMC("diEleCharm","di-electrons from charm"); // dielectrons originating from charm hadrons (not neccessary from same mother)
+ diEleCharm->SetLegPDGs(11,-11);
+ diEleCharm->SetMotherPDGs(403,403);
+ diEleCharm->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+ diEleCharm->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ diEleCharm->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(diEleCharm);
+
+
+}
+
+
+
+
+
- void InitHistograms(AliDielectron *die, Int_t cutDefinition);\r
- void InitCF(AliDielectron* die, Int_t cutDefinition);\r
-\r
- void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);\r
- void SetupPairCuts(AliDielectron *die, Int_t cutDefinition);\r
-\r
- void EnableMC();\r
- AliESDtrackCuts *SetupESDtrackCuts(Int_t cutDefinition);\r
-\r
- TString names=("MixEvt");\r
- TObjArray *arrNames=names.Tokenize(";");\r
- const Int_t nDie=arrNames->GetEntries();\r
- Bool_t MCenabled=kFALSE;\r
-\r
- Bool_t kMix = 1; \r
-\r
- AliDielectron* Configpp2012Oezdemir(Int_t cutDefinition,Bool_t hasMC=kFALSE)\r
- {\r
- //\r
- // Setup the instance of AliDielectron\r
- //\r
- \r
- MCenabled=hasMC;\r
- \r
- // create the actual framework object\r
- \r
- TString name=Form("%02d",cutDefinition);\r
- if ((cutDefinition)<arrNames->GetEntriesFast()){\r
- name=arrNames->At((cutDefinition))->GetName();\r
- }\r
-\r
- //thisCut only relevant for MC:\r
- AliDielectron *die =\r
- new AliDielectron(Form\r
- ("%s",name.Data()),\r
- Form("Track cuts: %s",name.Data()));\r
- \r
- if(kMix){\r
- AliDielectronMixingHandler *mix = new AliDielectronMixingHandler;\r
- mix->SetMixType(AliDielectronMixingHandler::kAll);\r
- mix->AddVariable(AliDielectronVarManager::kZvPrim,"-10., -7.5, -5., -2.5 , 0., 2.5, 5., 7.5 , 10.");\r
- mix->AddVariable(AliDielectronVarManager::kNacc,"0,10000");\r
- mix->SetDepth(10);\r
- die->SetMixingHandler(mix);\r
- }\r
- \r
- // cut setup\r
- SetupTrackCuts(die,cutDefinition);\r
- SetupPairCuts(die,cutDefinition);\r
- \r
- // histogram setup\r
- // only if an AliDielectronHistos object is attached to the\r
- // dielectron framework histograms will be filled\r
- //\r
- InitHistograms(die,cutDefinition);\r
-\r
- // the last definition uses no cuts and only the QA histograms should be filled!\r
- //InitCF(die,cutDefinition);\r
-\r
- return die;\r
- }\r
-\r
- //______________________________________________________________________________________\r
- void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)\r
- {\r
- //\r
- // Setup the track cuts\r
- //\r
- //\r
- //___________________________________________\r
- AliDielectronPID *pidTT = new AliDielectronPID("TPC-TOF","TPC-TOF");\r
- pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-1.5,3.,0.2,100.,kFALSE);\r
- pidTT->AddCut( AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.4 , 5., kFALSE );\r
- pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-100.,4.,0.2,100.,kTRUE);\r
-\r
- //___________________________________________\r
- AliDielectronPID *pidTOF = new AliDielectronPID("TOF","TOF");\r
- pidTOF->AddCut( AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.4 , 5., kFALSE );\r
- // \r
- // =============CREATE GROUPS FOR ==============\r
- //\r
-\r
- //Config 0: TPC-TOF \r
- AliDielectronCutGroup* cgTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);\r
- cgTrackFilterPIDTPC->AddCut(SetupESDtrackCuts(cutDefinition));\r
- cgTrackFilterPIDTPC->AddCut(pidTT);\r
-\r
- //Config 1: TOF\r
- AliDielectronCutGroup* cgTrackFilterPIDTOF = new AliDielectronCutGroup("cgPIDTOF","cgPIDTOF",AliDielectronCutGroup::kCompAND);\r
- cgTrackFilterPIDTOF->AddCut(SetupESDtrackCuts(cutDefinition));\r
- cgTrackFilterPIDTOF->AddCut(pidTOF);\r
-\r
- //Config 2: no PID\r
- AliDielectronCutGroup* cgTrackFilternoPID = new AliDielectronCutGroup("cgnoPID","cgnoPID",AliDielectronCutGroup::kCompAND);\r
- cgTrackFilternoPID->AddCut(SetupESDtrackCuts(cutDefinition));\r
-\r
- //Correct BG scheme for Combinatorial BG \r
- //die->SetPreFilterUnlikeOnly();\r
- die->SetPreFilterAllSigns();\r
- die->SetUseKF(kFALSE);\r
-\r
- if ( cutDefinition ==0 ) {\r
- die->GetTrackFilter().AddCuts(cgTrackFilterPIDTPC); \r
- }\r
-\r
- }\r
- //______________________________________________________________________________________\r
-\r
- void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)\r
- {\r
- //\r
- // Setup the pair cuts\r
- //\r
- \r
- \r
- if(cutDefinition == 0){\r
-\r
- AliDielectronTrackCuts *noconv=new AliDielectronTrackCuts("noConv","conversion tagging");\r
- noconv->SetV0DaughterCut(AliPID::kElectron,kTRUE);\r
- die->GetTrackFilter().AddCuts(noconv);\r
- \r
- //pair rapidity\r
-// AliDielectronVarCuts *RapidityCut=new AliDielectronVarCuts("RapidityCut","RapidityCut");\r
-// RapidityCut->AddCut(AliDielectronVarManager::kY, -0.8 , 0.8);\r
-// die->GetPairFilter().AddCuts(RapidityCut); \r
-\r
- AliDielectronVarCuts *PhiV = new AliDielectronVarCuts("PhiV","PhiV");//mass and Phiv together\r
- PhiV->AddCut(AliDielectronVarManager::kM, 0.0 , 0.05);\r
- PhiV->AddCut(AliDielectronVarManager::kPhivPair, 2.5 , 3.2 );\r
- die->GetPairPreFilter().AddCuts(PhiV);\r
- /*\r
- AliDielectronVarCuts *PhiV2 = new AliDielectronVarCuts("PhiV2","PhiV2");//mass and Phiv together\r
- PhiV2->AddCut(AliDielectronVarManager::kM, 0.05 , 1000.);\r
-\r
- AliDielectronCutGroup* pairCutsCG2 =new AliDielectronCutGroup("pairCutsCG2","pairCutsCG2",AliDielectronCutGroup::kCompOR);\r
- pairCutsCG2->AddCut(PhiV);\r
- pairCutsCG2->AddCut(PhiV2);\r
- die->GetPairFilter().AddCuts(pairCutsCG2);\r
- */\r
- /*\r
- if (MCenabled) {\r
- AliDielectronVarCuts *mcpid =new AliDielectronVarCuts("mcpid","mcpid");\r
- mcpid->SetCutType(AliDielectronVarCuts::kAny);\r
- mcpid->AddCut(AliDielectronVarManager::kPdgCode, 11);\r
- mcpid->AddCut(AliDielectronVarManager::kPdgCode, -11);\r
- die->GetTrackFilter().AddCuts(mcpid);\r
-\r
- AliDielectronVarCuts *MCnoConv =new AliDielectronVarCuts("MCnoConv","MCnoConv");\r
- MCnoConv->AddCut(AliDielectronVarManager::kPdgCodeMother, 22,kTRUE);\r
- die->GetTrackFilter().AddCuts(MCnoConv);\r
- }\r
- */ \r
- }\r
-\r
- }\r
-\r
- //______________________________________________________________________________________\r
- AliESDtrackCuts *SetupESDtrackCuts(Int_t cutDefinition)\r
- {\r
- //\r
- // Setup default AliESDtrackCuts\r
- //\r
- AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;\r
- \r
- esdTrackCuts->SetMaxDCAToVertexZ(3.0);\r
- esdTrackCuts->SetMaxDCAToVertexXY(1.0); \r
-\r
- esdTrackCuts->SetPtRange( 0.2 , 100.0);\r
- esdTrackCuts->SetEtaRange( -0.8 , 0.8 );\r
- esdTrackCuts->SetRequireSigmaToVertex(kFALSE);\r
- esdTrackCuts->SetAcceptKinkDaughters(kFALSE);\r
- esdTrackCuts->SetDCAToVertex2D(kFALSE);\r
-\r
- esdTrackCuts->SetRequireITSRefit(kTRUE);\r
- esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst); //Base\r
- esdTrackCuts->SetMinNClustersITS(3); //Base\r
-\r
- esdTrackCuts->SetRequireTPCRefit(kTRUE);\r
- esdTrackCuts->SetMinNClustersTPC(80); //Base\r
-\r
- esdTrackCuts->SetMinNCrossedRowsTPC(100); //Base\r
-\r
- esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);\r
- esdTrackCuts->SetMaxChi2PerClusterTPC(4);\r
-\r
- return esdTrackCuts;\r
- }\r
-\r
- //______________________________________________________________________________________\r
-\r
-void InitHistograms(AliDielectron *die, Int_t cutDefinition)\r
- {\r
- //\r
- // Initialise the histograms\r
- //\r
- \r
- //Setup histogram classes\r
- AliDielectronHistos *histos=\r
- new AliDielectronHistos(die->GetName(),\r
- die->GetTitle());\r
- \r
-\r
-\r
- //Initialise histogram classes\r
- histos->SetReservedWords("Track;Pair");\r
- //histos->SetReservedWords("Track"); \r
-\r
- //Event class\r
- histos->AddClass("Event");\r
- \r
-\r
- //Track classes\r
- //to fill also track info from 2nd event loop until 2\r
- for (Int_t i=0; i<2; ++i){\r
- histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));\r
- }\r
- \r
- //Pair classes\r
- // to fill also mixed event histograms loop until 10\r
-\r
- for (Int_t i=0; i<3; ++i){\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));\r
-\r
- }\r
-\r
- if(kMix){\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(3))); //ME ++\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(4)));//ME -+\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(6)));//ME +-\r
- histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(7))); // ME --\r
- }\r
-\r
-\r
- //add histograms to event class\r
- histos->UserHistogram("Event","nEvents","Number of processed events after cuts;Number events",1,0,1,AliDielectronVarManager::kNevents);\r
- histos->UserHistogram("Event","ZVertex","ZVertex;ZVertex/cm",480,-12.,12.,AliDielectronVarManager::kZvPrim);\r
- histos->UserHistogram("Event","nESDTracks","ESD tracks;ESD tracks;Number events",100,0,200,AliDielectronVarManager::kTracks);\r
- histos->UserHistogram("Event","Nacc","Number of accepted tracks;Number events",100,0,200,AliDielectronVarManager::kNacc);\r
- histos->UserHistogram("Event","NVtxContrib","Number of Vertex Contributor;NVtx;Number events",100,0,100,AliDielectronVarManager::kNVtxContrib);\r
-\r
-\r
- //add histograms to Track classes\r
- histos->UserHistogram("Track","P","P;P [GeV];#tracks",500,0.,10.,AliDielectronVarManager::kPIn);\r
- histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",500,0.,10.,AliDielectronVarManager::kPt);\r
- histos->UserHistogram("Track","Eta","Eta; Eta ;#tracks",100,-1.,1.,AliDielectronVarManager::kEta);\r
- histos->UserHistogram("Track","Phi","Phi; Phi ;#tracks",640,0.,6.4,AliDielectronVarManager::kPhi);\r
-\r
-\r
- histos->UserHistogram("Track","Eta_phi","Eta vs Phi;Eta;Phi",100,-1.,1.,320,0.,6.4,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);\r
- histos->UserHistogram("Track","Eta_pt","Eta vs Pt;Eta;Pt",100,-1.,1.,500,0.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kPt);\r
- histos->UserHistogram("Track","ImpParXY_Pt","ImpParXY_Pt; Pt; ÍmpParXY",500,0.,10.,500,-5.,5.,AliDielectronVarManager::kPt,AliDielectronVarManager::kImpactParXY);\r
- histos->UserHistogram("Track","ImpParZ_Pt","ImpParZ_Pt; Pt; ÍmpParZ",500,0.,10.,500,-5.,5.,AliDielectronVarManager::kPt,AliDielectronVarManager::kImpactParZ);\r
- \r
-\r
- //track checks (ITS)\r
- histos->UserHistogram("Track","ITSchi2Cl_Mom","ITS Chi2 vs Momentum;Mom;ITS chi2",500,0.,5.,50,0.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSchi2Cl);\r
- histos->UserHistogram("Track","NclsITS_Mom",";Mom;kNclsITS",500,0.,5.,7,0,7,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsITS);\r
-\r
- //track checks (TPC)\r
- histos->UserHistogram("Track","TPCsignalNfrac_Mom",";fraction TPCSignalN/TPCncls vs Momentum;Mom;TPCSignalN/TPCncls",500,0.,5.,60,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignalNfrac);\r
- histos->UserHistogram("Track","TPCchi2Cl_Mom","TPC Chi2 vs Momentum;Mom;TPC Chi2",500,0.,10.,100,0,5,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCchi2Cl);\r
- histos->UserHistogram("Track","TPCclsDiff_Mom","kTPCclsDiff vs Momentum;Mom;kTPCclsDiff",500,0.,10.,100,-10,10,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCclsDiff);\r
- histos->UserHistogram("Track","FindableTPCcls_Mom","kNFclsTPC vs Momentum;Mom;kNFclsTPC",500,0.,10.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNFclsTPC);\r
- histos->UserHistogram("Track","TPCcls_Mom","kNclsTPC vs Momentum;Mom;kNclsTPC",500,0.,10.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsTPC);\r
- histos->UserHistogram("Track","kNclsSFracTPC_Mom","kNclsSFracTPC vs Momentum;Mom;kTPCclsSFrac",500,0.,10.,1000,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsSFracTPC);\r
- histos->UserHistogram("Track","kNFclsTPCrFrac_Mom","kNFclsTPCrFrac vs Momentum;Mom;kNFclsTPCrFrac",500,0.,10.,60,0.,1.2.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNFclsTPCrFrac);\r
-\r
- //track checks (TOF)\r
- histos->UserHistogram("Track","TOFbeta_Mom","kTOFbeta vs Momentum;Mom;TOFbeta",500,0.,5.,120,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta);\r
- histos->UserHistogram("Track","TOFPIDBit_Mom","kTOFPIDBit vs Momentum;Mom;TOFPIDbit",500,0.,5.,2,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFPIDBit);\r
-\r
- //track checks (PID)\r
- histos->UserHistogram("Track","ITSnSigma_MomPio","ITS number of sigmas Pion vs Momentum;Mom;ITSsigmaPion",500,0.,5.,1000,-20,20,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaPio);\r
- histos->UserHistogram("Track","TPCnSigma_MomPio","TPC number of sigmas Pions vs Momentum;Mom;TPCsigmaPion",500,0.,5.,1000,-20,20,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio);\r
-\r
- histos->UserHistogram("Track","ITSnSigma_MomEle","ITS number of sigmas Electrons vs Momentum;Mom;ITSsigmaEle",500,0.,5.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaEle);\r
- histos->UserHistogram("Track","TPCnSigma_MomEle","TPC number of sigmas Electrons vs Momentum;Mom;TPCsigmaEle",1000,0.,10.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle);\r
- histos->UserHistogram("Track","TOFnSigma_MomEle","TOF number of sigmas Electrons vs Momentum;Mom;TOFsigmaEle",500,0.,5.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaEle);\r
-\r
- histos->UserHistogram("Track","ITSdEdx_P","dEdx;P [GeV];ITS signal (arb units) vs Momentum;Mom;ITSsignal", 500,0,5,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal);\r
- histos->UserHistogram("Track","TPCdEdx_P","dEdx;P [GeV];TPC signal (arb units) vs Momentum;Mom;TPCsignal", 500,0,10.,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal);\r
-\r
- //\r
- //add histograms to Pair classes\r
- //\r
-\r
- histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- 500,0,4,AliDielectronVarManager::kM);\r
-\r
- histos->UserHistogram("Pair","InvMass_low","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- 500,0,0.5,AliDielectronVarManager::kM);\r
-\r
- histos->UserHistogram("Pair","InvMass10","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- 500,0.,5.,AliDielectronVarManager::kM);\r
-\r
- histos->UserHistogram("Pair","kDeltaEta","kDeltaEta;kDeltaEta;#pairs",\r
- 160,0.,1.6,AliDielectronVarManager::kDeltaEta);\r
-\r
- histos->UserHistogram("Pair","kDeltaEta_low","kDeltaEta;kDeltaEta;#pairs",\r
- 500,0.,0.5,AliDielectronVarManager::kDeltaEta);\r
-\r
- histos->UserHistogram("Pair","kDeltaPhi","kDeltaPhi;kDeltaPhi;#pairs",\r
- 320,0.,6.4,AliDielectronVarManager::kDeltaPhi);\r
-\r
- histos->UserHistogram("Pair",\r
- "kDeltaEta_kDeltaPhi","kDeltaEta_kDeltaPhi;kDeltaEta;kDeltaPhi",\r
- 160, 0. , 1.6, 320 , 0., 6.4 ,\r
- AliDielectronVarManager::kDeltaEta , AliDielectronVarManager::kDeltaPhi );\r
-\r
- histos->UserHistogram("Pair","PhiV",";PhiV;#pairs",\r
- 320,0.,6.4,AliDielectronVarManager::kPhivPair);\r
-\r
-\r
- histos->UserHistogram("Pair","PhiV_Pt",";Pt;PhiV",\r
- 100,0.,10.,320,0.,6.4,AliDielectronVarManager::kPt,AliDielectronVarManager::kPhivPair);\r
-\r
- histos->UserHistogram("Pair","InvMass_bin2","Inv.Mass;Inv. Mass [GeV];#pairs",\r
- "0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 , \r
- 0.4 , 0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,\r
- 0.95, 0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 , \r
- 2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 , \r
- 3.3 , 3.5, 3.75 , 4.0",AliDielectronVarManager::kM);\r
-\r
-\r
- histos->UserHistogram("Pair",\r
- "InvMass_Pt","InvMass_Pt;InvMass;Pt",\r
- 500, 0. , 4., 100 , 0., 5. ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kPt );\r
-\r
- histos->UserHistogram("Pair",\r
- "InvMass_PhivPair","InvMass_PhivPair;InvMass;PhivPair",\r
- 500, 0. , 4., 320 , 0., 3.2 ,\r
- AliDielectronVarManager::kM , AliDielectronVarManager::kPhivPair );\r
-\r
- histos->UserHistogram("Pair",\r
- "OpAngle","Opening angle;Opening angle;#pairs",\r
- 320, 0. , 3.2, \r
- AliDielectronVarManager::kOpeningAngle);\r
-\r
- histos->UserHistogram("Pair",\r
- "OpAngle_InvMass","OpAngle_InvMass;Opening angle;Invariant Mass",\r
- 320, 0. , 3.2, 500 , 0. , 4. ,\r
- AliDielectronVarManager::kOpeningAngle,AliDielectronVarManager::kM);\r
-\r
-\r
- histos->UserHistogram("Pair",\r
- "Phi","Phi;counts;Phi",\r
- 320, 0. , 6.4, AliDielectronVarManager::kPhi);\r
-\r
- histos->UserHistogram("Pair",\r
- "Y","Y;counts;Y",\r
- 120, -1.2 , 1.2, AliDielectronVarManager::kY);\r
-\r
- die->SetHistogramManager(histos);\r
-\r
-}\r
-\r
-\r
-void InitCF(AliDielectron* die, Int_t cutDefinition)\r
-{\r
- //\r
- // Setupd the CF Manager if needed\r
- //\r
- AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());\r
- \r
- //pair variables\r
- cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.);\r
- //cf->AddVariable(AliDielectronVarManager::kP,200,0,20);\r
- //cf->AddVariable(AliDielectronVarManager::kPhi,64, -3.2, 3.2);\r
- cf->AddVariable(AliDielectronVarManager::kY,40,-2.,2.);\r
- cf->AddVariable(AliDielectronVarManager::kM,500,0.,4.); \r
- //cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);\r
- //cf->AddVariable(AliDielectronVarManager::kOpeningAngle,315,0,3.15);\r
- //cf->AddVariable(AliDielectronVarManager::kDeltaEta,200,-2,2);\r
- //cf->AddVariable(AliDielectronVarManager::kDeltaPhi,100,0,3.15);\r
- //cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10);\r
- cf->AddVariable(AliDielectronVarManager::kNumberOfDaughters,5,0,5);\r
- //leg variables\r
- cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kP,200,0.,20.,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kY,40,-2.,2.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kEta,20,-1.,1.,kTRUE);\r
- cf->AddVariable(AliDielectronVarManager::kPhi,100,0.,3.15,kTRUE);\r
-// cf->AddVariable(AliDielectronVarManager::kITSsignal,1000,0.0.,1000.,kTRUE);\r
-// cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10,kTRUE);\r
-// cf->AddVariable(AliDielectronVarManager::kNumberOfDaughters,11,0,10,kTRUE);\r
- \r
- //only in this case write MC truth info\r
- \r
- if (MCenabled) {\r
- cf->SetStepForMCtruth();\r
- //cf->SetStepsForMCtruthOnly();\r
- //cf->SetStepForNoCutsMCmotherPid();\r
- cout << "MC ENABLED ------------------------------------------------------" << endl;\r
- //cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);\r
- //cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);\r
- }\r
-\r
- //cf->SetStepsForEachCut();\r
- //cf->SetStepForPreFilter();\r
- cf->SetStepForAfterAllCuts();\r
- //cf->SetStepsForBackground();\r
- cf->SetStepsForSignal();\r
- \r
- die->SetCFManagerPair(cf);\r
-\r
-/*\r
-\r
- AliDielectronSignalMC* lowMassDiele=new\r
- AliDielectronSignalMC("lowMassDiele","low mass dielectron pairs");\r
- lowMassDiele->SetLegPDGs(11,-11);\r
- lowMassDiele->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- lowMassDiele->SetLegSources(AliDielectronSignalMC::kPrimary,\r
- AliDielectronSignalMC::kPrimary);\r
- lowMassDiele->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(lowMassDiele);\r
-\r
- AliDielectronSignalMC* secondary=new\r
- AliDielectronSignalMC("secondary","secondary electrons pairs");\r
- secondary->SetLegPDGs(11,-11);\r
- secondary->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- secondary->SetLegSources(AliDielectronSignalMC::kSecondary,\r
- AliDielectronSignalMC::kSecondary);\r
- die->AddSignalMC(secondary);\r
-\r
- AliDielectronSignalMC* eleFromConversions=new\r
- AliDielectronSignalMC("eleFromConversions","conversion electrons");\r
- eleFromConversions->SetLegPDGs(11,-11);\r
- eleFromConversions->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- eleFromConversions->SetLegSources(AliDielectronSignalMC::kSecondary,\r
- AliDielectronSignalMC::kSecondary);\r
- eleFromConversions->SetMotherPDGs(22,22); // 22- photon\r
- die->AddSignalMC(eleFromConversions);\r
-\r
- AliDielectronSignalMC* misIdPions=new\r
- AliDielectronSignalMC("misIdPions","mis id. pion pairs");\r
- misIdPions->SetLegPDGs(211,-211);\r
- misIdPions->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- die->AddSignalMC(misIdPions);\r
-\r
- AliDielectronSignalMC* dalitzDecays=new\r
- AliDielectronSignalMC("dalitzDecays","dalitz Pairs");\r
- dalitzDecays->SetLegPDGs(11,-11);\r
- dalitzDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
- dalitzDecays->SetLegSources(AliDielectronSignalMC::kSecondary,\r
- AliDielectronSignalMC::kSecondary);\r
- dalitzDecays->SetMotherPDGs(111,111);\r
- dalitzDecays->SetFillPureMCStep(kTRUE);\r
- die->AddSignalMC(dalitzDecays);\r
-*/\r
-\r
-AliDielectronSignalMC* PhiDecays= new AliDielectronSignalMC("PhiDecays","Phi Pairs");\r
-PhiDecays->SetLegPDGs(11,-11);\r
-PhiDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
-PhiDecays->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
-PhiDecays->SetMotherPDGs(333,333);\r
-PhiDecays->SetMothersRelation(AliDielectronSignalMC::kSame); \r
-PhiDecays->SetFillPureMCStep(kTRUE);\r
-die->AddSignalMC(PhiDecays);\r
-\r
-AliDielectronSignalMC* OmegaDecays= new AliDielectronSignalMC("OmegaDecays","Omega Pairs");\r
-OmegaDecays->SetLegPDGs(11,-11);\r
-OmegaDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
-OmegaDecays->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
-OmegaDecays->SetMotherPDGs(223,223);\r
-OmegaDecays->SetMothersRelation(AliDielectronSignalMC::kSame);\r
-OmegaDecays->SetDalitz(AliDielectronSignalMC::kIsNotDalitz); \r
-OmegaDecays->SetFillPureMCStep(kTRUE);\r
-die->AddSignalMC(OmegaDecays);\r
-\r
-/*\r
-AliDielectronSignalMC* RhoDecays= new AliDielectronSignalMC("RhoDecays","Rho Pairs");\r
-RhoDecays->SetLegPDGs(11,-11);\r
-RhoDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
-RhoDecays->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
-RhoDecays->SetMotherPDGs(113,113);\r
-RhoDecays->SetMothersRelation(AliDielectronSignalMC::kSame); \r
-RhoDecays->SetFillPureMCStep(kTRUE);\r
-die->AddSignalMC(RhoDecays);\r
-\r
-AliDielectronSignalMC* DieleConti= new AliDielectronSignalMC("DieleConti","low mass ee pairs");\r
-DieleConti->SetLegPDGs(11,-11);\r
-DieleConti->SetMotherPDGs(0,0,22,22);\r
-DieleConti->SetCheckBothChargesLegs(kTRUE,kTRUE);\r
-DieleConti->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);\r
-DieleConti->SetMothersRelation(AliDielectronSignalMC::kSame);\r
-DieleConti->SetFillPureMCStep(kTRUE);\r
-die->AddSignalMC(DieleConti);*/\r
-\r
-\r
-}\r
-\r
-//--------------------------------------\r
- void EnableMC() {\r
- MCenabled=kTRUE;\r
- }\r
+ void InitHistograms(AliDielectron *die, Int_t cutDefinition);
+ void InitCF(AliDielectron* die, Int_t cutDefinition);
+
+ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
+ void SetupPairCuts(AliDielectron *die, Int_t cutDefinition);
+
+ void EnableMC();
+ AliESDtrackCuts *SetupESDtrackCuts(Int_t cutDefinition);
+
+ TString names=("MixEvt");
+ TObjArray *arrNames=names.Tokenize(";");
+ const Int_t nDie=arrNames->GetEntries();
+ Bool_t MCenabled=kFALSE;
+
+ Bool_t kMix = 1;
+
+ AliDielectron* Configpp2012Oezdemir(Int_t cutDefinition,Bool_t hasMC=kFALSE)
+ {
+ //
+ // Setup the instance of AliDielectron
+ //
+
+ MCenabled=hasMC;
+
+ // create the actual framework object
+
+ TString name=Form("%02d",cutDefinition);
+ if ((cutDefinition)<arrNames->GetEntriesFast()){
+ name=arrNames->At((cutDefinition))->GetName();
+ }
+
+ //thisCut only relevant for MC:
+ AliDielectron *die =
+ new AliDielectron(Form
+ ("%s",name.Data()),
+ Form("Track cuts: %s",name.Data()));
+
+ if(kMix){
+ AliDielectronMixingHandler *mix = new AliDielectronMixingHandler;
+ mix->SetMixType(AliDielectronMixingHandler::kAll);
+ mix->AddVariable(AliDielectronVarManager::kZvPrim,"-10., -7.5, -5., -2.5 , 0., 2.5, 5., 7.5 , 10.");
+ mix->AddVariable(AliDielectronVarManager::kNacc,"0,10000");
+ mix->SetDepth(10);
+ die->SetMixingHandler(mix);
+ }
+
+ // cut setup
+ SetupTrackCuts(die,cutDefinition);
+ SetupPairCuts(die,cutDefinition);
+
+ // histogram setup
+ // only if an AliDielectronHistos object is attached to the
+ // dielectron framework histograms will be filled
+ //
+ InitHistograms(die,cutDefinition);
+
+ // the last definition uses no cuts and only the QA histograms should be filled!
+ //InitCF(die,cutDefinition);
+
+ return die;
+ }
+
+ //______________________________________________________________________________________
+ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
+ {
+ //
+ // Setup the track cuts
+ //
+ //
+ //___________________________________________
+ AliDielectronPID *pidTT = new AliDielectronPID("TPC-TOF","TPC-TOF");
+ pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-1.5,3.,0.2,100.,kFALSE);
+ pidTT->AddCut( AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.4 , 5., kFALSE );
+ pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-100.,4.,0.2,100.,kTRUE);
+
+ //___________________________________________
+ AliDielectronPID *pidTOF = new AliDielectronPID("TOF","TOF");
+ pidTOF->AddCut( AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.4 , 5., kFALSE );
+ //
+ // =============CREATE GROUPS FOR ==============
+ //
+
+ //Config 0: TPC-TOF
+ AliDielectronCutGroup* cgTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
+ cgTrackFilterPIDTPC->AddCut(SetupESDtrackCuts(cutDefinition));
+ cgTrackFilterPIDTPC->AddCut(pidTT);
+
+ //Config 1: TOF
+ AliDielectronCutGroup* cgTrackFilterPIDTOF = new AliDielectronCutGroup("cgPIDTOF","cgPIDTOF",AliDielectronCutGroup::kCompAND);
+ cgTrackFilterPIDTOF->AddCut(SetupESDtrackCuts(cutDefinition));
+ cgTrackFilterPIDTOF->AddCut(pidTOF);
+
+ //Config 2: no PID
+ AliDielectronCutGroup* cgTrackFilternoPID = new AliDielectronCutGroup("cgnoPID","cgnoPID",AliDielectronCutGroup::kCompAND);
+ cgTrackFilternoPID->AddCut(SetupESDtrackCuts(cutDefinition));
+
+ //Correct BG scheme for Combinatorial BG
+ //die->SetPreFilterUnlikeOnly();
+ die->SetPreFilterAllSigns();
+ die->SetUseKF(kFALSE);
+
+ if ( cutDefinition ==0 ) {
+ die->GetTrackFilter().AddCuts(cgTrackFilterPIDTPC);
+ }
+
+ }
+ //______________________________________________________________________________________
+
+ void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)
+ {
+ //
+ // Setup the pair cuts
+ //
+
+
+ if(cutDefinition == 0){
+
+ AliDielectronTrackCuts *noconv=new AliDielectronTrackCuts("noConv","conversion tagging");
+ noconv->SetV0DaughterCut(AliPID::kElectron,kTRUE);
+ die->GetTrackFilter().AddCuts(noconv);
+
+ //pair rapidity
+// AliDielectronVarCuts *RapidityCut=new AliDielectronVarCuts("RapidityCut","RapidityCut");
+// RapidityCut->AddCut(AliDielectronVarManager::kY, -0.8 , 0.8);
+// die->GetPairFilter().AddCuts(RapidityCut);
+
+ AliDielectronVarCuts *PhiV = new AliDielectronVarCuts("PhiV","PhiV");//mass and Phiv together
+ PhiV->AddCut(AliDielectronVarManager::kM, 0.0 , 0.05);
+ PhiV->AddCut(AliDielectronVarManager::kPhivPair, 2.5 , 3.2 );
+ die->GetPairPreFilter().AddCuts(PhiV);
+ /*
+ AliDielectronVarCuts *PhiV2 = new AliDielectronVarCuts("PhiV2","PhiV2");//mass and Phiv together
+ PhiV2->AddCut(AliDielectronVarManager::kM, 0.05 , 1000.);
+
+ AliDielectronCutGroup* pairCutsCG2 =new AliDielectronCutGroup("pairCutsCG2","pairCutsCG2",AliDielectronCutGroup::kCompOR);
+ pairCutsCG2->AddCut(PhiV);
+ pairCutsCG2->AddCut(PhiV2);
+ die->GetPairFilter().AddCuts(pairCutsCG2);
+ */
+ /*
+ if (MCenabled) {
+ AliDielectronVarCuts *mcpid =new AliDielectronVarCuts("mcpid","mcpid");
+ mcpid->SetCutType(AliDielectronVarCuts::kAny);
+ mcpid->AddCut(AliDielectronVarManager::kPdgCode, 11);
+ mcpid->AddCut(AliDielectronVarManager::kPdgCode, -11);
+ die->GetTrackFilter().AddCuts(mcpid);
+
+ AliDielectronVarCuts *MCnoConv =new AliDielectronVarCuts("MCnoConv","MCnoConv");
+ MCnoConv->AddCut(AliDielectronVarManager::kPdgCodeMother, 22,kTRUE);
+ die->GetTrackFilter().AddCuts(MCnoConv);
+ }
+ */
+ }
+
+ }
+
+ //______________________________________________________________________________________
+ AliESDtrackCuts *SetupESDtrackCuts(Int_t cutDefinition)
+ {
+ //
+ // Setup default AliESDtrackCuts
+ //
+ AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;
+
+ esdTrackCuts->SetMaxDCAToVertexZ(3.0);
+ esdTrackCuts->SetMaxDCAToVertexXY(1.0);
+
+ esdTrackCuts->SetPtRange( 0.2 , 100.0);
+ esdTrackCuts->SetEtaRange( -0.8 , 0.8 );
+ esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
+ esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
+ esdTrackCuts->SetDCAToVertex2D(kFALSE);
+
+ esdTrackCuts->SetRequireITSRefit(kTRUE);
+ esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst); //Base
+ esdTrackCuts->SetMinNClustersITS(3); //Base
+
+ esdTrackCuts->SetRequireTPCRefit(kTRUE);
+ esdTrackCuts->SetMinNClustersTPC(80); //Base
+
+ esdTrackCuts->SetMinNCrossedRowsTPC(100); //Base
+
+ esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
+ esdTrackCuts->SetMaxChi2PerClusterTPC(4);
+
+ return esdTrackCuts;
+ }
+
+ //______________________________________________________________________________________
+
+void InitHistograms(AliDielectron *die, Int_t cutDefinition)
+ {
+ //
+ // Initialise the histograms
+ //
+
+ //Setup histogram classes
+ AliDielectronHistos *histos=
+ new AliDielectronHistos(die->GetName(),
+ die->GetTitle());
+
+
+
+ //Initialise histogram classes
+ histos->SetReservedWords("Track;Pair");
+ //histos->SetReservedWords("Track");
+
+ //Event class
+ histos->AddClass("Event");
+
+
+ //Track classes
+ //to fill also track info from 2nd event loop until 2
+ for (Int_t i=0; i<2; ++i){
+ histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));
+ }
+
+ //Pair classes
+ // to fill also mixed event histograms loop until 10
+
+ for (Int_t i=0; i<3; ++i){
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
+
+ }
+
+ if(kMix){
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(3))); //ME ++
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(4)));//ME -+
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(6)));//ME +-
+ histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(7))); // ME --
+ }
+
+
+ //add histograms to event class
+ histos->UserHistogram("Event","nEvents","Number of processed events after cuts;Number events",1,0,1,AliDielectronVarManager::kNevents);
+ histos->UserHistogram("Event","ZVertex","ZVertex;ZVertex/cm",480,-12.,12.,AliDielectronVarManager::kZvPrim);
+ histos->UserHistogram("Event","nESDTracks","ESD tracks;ESD tracks;Number events",100,0,200,AliDielectronVarManager::kTracks);
+ histos->UserHistogram("Event","Nacc","Number of accepted tracks;Number events",100,0,200,AliDielectronVarManager::kNacc);
+ histos->UserHistogram("Event","NVtxContrib","Number of Vertex Contributor;NVtx;Number events",100,0,100,AliDielectronVarManager::kNVtxContrib);
+
+
+ //add histograms to Track classes
+ histos->UserHistogram("Track","P","P;P [GeV];#tracks",500,0.,10.,AliDielectronVarManager::kPIn);
+ histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",500,0.,10.,AliDielectronVarManager::kPt);
+ histos->UserHistogram("Track","Eta","Eta; Eta ;#tracks",100,-1.,1.,AliDielectronVarManager::kEta);
+ histos->UserHistogram("Track","Phi","Phi; Phi ;#tracks",640,0.,6.4,AliDielectronVarManager::kPhi);
+
+
+ histos->UserHistogram("Track","Eta_phi","Eta vs Phi;Eta;Phi",100,-1.,1.,320,0.,6.4,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+ histos->UserHistogram("Track","Eta_pt","Eta vs Pt;Eta;Pt",100,-1.,1.,500,0.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kPt);
+ histos->UserHistogram("Track","ImpParXY_Pt","ImpParXY_Pt; Pt; ÍmpParXY",500,0.,10.,500,-5.,5.,AliDielectronVarManager::kPt,AliDielectronVarManager::kImpactParXY);
+ histos->UserHistogram("Track","ImpParZ_Pt","ImpParZ_Pt; Pt; ÍmpParZ",500,0.,10.,500,-5.,5.,AliDielectronVarManager::kPt,AliDielectronVarManager::kImpactParZ);
+
+
+ //track checks (ITS)
+ histos->UserHistogram("Track","ITSchi2Cl_Mom","ITS Chi2 vs Momentum;Mom;ITS chi2",500,0.,5.,50,0.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSchi2Cl);
+ histos->UserHistogram("Track","NclsITS_Mom",";Mom;kNclsITS",500,0.,5.,7,0,7,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsITS);
+
+ //track checks (TPC)
+ histos->UserHistogram("Track","TPCsignalNfrac_Mom",";fraction TPCSignalN/TPCncls vs Momentum;Mom;TPCSignalN/TPCncls",500,0.,5.,60,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignalNfrac);
+ histos->UserHistogram("Track","TPCchi2Cl_Mom","TPC Chi2 vs Momentum;Mom;TPC Chi2",500,0.,10.,100,0,5,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCchi2Cl);
+ histos->UserHistogram("Track","TPCclsDiff_Mom","kTPCclsDiff vs Momentum;Mom;kTPCclsDiff",500,0.,10.,100,-10,10,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCclsDiff);
+ histos->UserHistogram("Track","FindableTPCcls_Mom","kNFclsTPC vs Momentum;Mom;kNFclsTPC",500,0.,10.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNFclsTPC);
+ histos->UserHistogram("Track","TPCcls_Mom","kNclsTPC vs Momentum;Mom;kNclsTPC",500,0.,10.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsTPC);
+ histos->UserHistogram("Track","kNclsSFracTPC_Mom","kNclsSFracTPC vs Momentum;Mom;kTPCclsSFrac",500,0.,10.,1000,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsSFracTPC);
+ histos->UserHistogram("Track","kNFclsTPCrFrac_Mom","kNFclsTPCrFrac vs Momentum;Mom;kNFclsTPCrFrac",500,0.,10.,60,0.,1.2.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNFclsTPCrFrac);
+
+ //track checks (TOF)
+ histos->UserHistogram("Track","TOFbeta_Mom","kTOFbeta vs Momentum;Mom;TOFbeta",500,0.,5.,120,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta);
+ histos->UserHistogram("Track","TOFPIDBit_Mom","kTOFPIDBit vs Momentum;Mom;TOFPIDbit",500,0.,5.,2,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFPIDBit);
+
+ //track checks (PID)
+ histos->UserHistogram("Track","ITSnSigma_MomPio","ITS number of sigmas Pion vs Momentum;Mom;ITSsigmaPion",500,0.,5.,1000,-20,20,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaPio);
+ histos->UserHistogram("Track","TPCnSigma_MomPio","TPC number of sigmas Pions vs Momentum;Mom;TPCsigmaPion",500,0.,5.,1000,-20,20,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio);
+
+ histos->UserHistogram("Track","ITSnSigma_MomEle","ITS number of sigmas Electrons vs Momentum;Mom;ITSsigmaEle",500,0.,5.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaEle);
+ histos->UserHistogram("Track","TPCnSigma_MomEle","TPC number of sigmas Electrons vs Momentum;Mom;TPCsigmaEle",1000,0.,10.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle);
+ histos->UserHistogram("Track","TOFnSigma_MomEle","TOF number of sigmas Electrons vs Momentum;Mom;TOFsigmaEle",500,0.,5.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaEle);
+
+ histos->UserHistogram("Track","ITSdEdx_P","dEdx;P [GeV];ITS signal (arb units) vs Momentum;Mom;ITSsignal", 500,0,5,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal);
+ histos->UserHistogram("Track","TPCdEdx_P","dEdx;P [GeV];TPC signal (arb units) vs Momentum;Mom;TPCsignal", 500,0,10.,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal);
+
+ //
+ //add histograms to Pair classes
+ //
+
+ histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
+ 500,0,4,AliDielectronVarManager::kM);
+
+ histos->UserHistogram("Pair","InvMass_low","Inv.Mass;Inv. Mass [GeV];#pairs",
+ 500,0,0.5,AliDielectronVarManager::kM);
+
+ histos->UserHistogram("Pair","InvMass10","Inv.Mass;Inv. Mass [GeV];#pairs",
+ 500,0.,5.,AliDielectronVarManager::kM);
+
+ histos->UserHistogram("Pair","kDeltaEta","kDeltaEta;kDeltaEta;#pairs",
+ 160,0.,1.6,AliDielectronVarManager::kDeltaEta);
+
+ histos->UserHistogram("Pair","kDeltaEta_low","kDeltaEta;kDeltaEta;#pairs",
+ 500,0.,0.5,AliDielectronVarManager::kDeltaEta);
+
+ histos->UserHistogram("Pair","kDeltaPhi","kDeltaPhi;kDeltaPhi;#pairs",
+ 320,0.,6.4,AliDielectronVarManager::kDeltaPhi);
+
+ histos->UserHistogram("Pair",
+ "kDeltaEta_kDeltaPhi","kDeltaEta_kDeltaPhi;kDeltaEta;kDeltaPhi",
+ 160, 0. , 1.6, 320 , 0., 6.4 ,
+ AliDielectronVarManager::kDeltaEta , AliDielectronVarManager::kDeltaPhi );
+
+ histos->UserHistogram("Pair","PhiV",";PhiV;#pairs",
+ 320,0.,6.4,AliDielectronVarManager::kPhivPair);
+
+
+ histos->UserHistogram("Pair","PhiV_Pt",";Pt;PhiV",
+ 100,0.,10.,320,0.,6.4,AliDielectronVarManager::kPt,AliDielectronVarManager::kPhivPair);
+
+ histos->UserHistogram("Pair","InvMass_bin2","Inv.Mass;Inv. Mass [GeV];#pairs",
+ "0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 ,
+ 0.4 , 0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,
+ 0.95, 0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 ,
+ 2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 ,
+ 3.3 , 3.5, 3.75 , 4.0",AliDielectronVarManager::kM);
+
+
+ histos->UserHistogram("Pair",
+ "InvMass_Pt","InvMass_Pt;InvMass;Pt",
+ 500, 0. , 4., 100 , 0., 5. ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kPt );
+
+ histos->UserHistogram("Pair",
+ "InvMass_PhivPair","InvMass_PhivPair;InvMass;PhivPair",
+ 500, 0. , 4., 320 , 0., 3.2 ,
+ AliDielectronVarManager::kM , AliDielectronVarManager::kPhivPair );
+
+ histos->UserHistogram("Pair",
+ "OpAngle","Opening angle;Opening angle;#pairs",
+ 320, 0. , 3.2,
+ AliDielectronVarManager::kOpeningAngle);
+
+ histos->UserHistogram("Pair",
+ "OpAngle_InvMass","OpAngle_InvMass;Opening angle;Invariant Mass",
+ 320, 0. , 3.2, 500 , 0. , 4. ,
+ AliDielectronVarManager::kOpeningAngle,AliDielectronVarManager::kM);
+
+
+ histos->UserHistogram("Pair",
+ "Phi","Phi;counts;Phi",
+ 320, 0. , 6.4, AliDielectronVarManager::kPhi);
+
+ histos->UserHistogram("Pair",
+ "Y","Y;counts;Y",
+ 120, -1.2 , 1.2, AliDielectronVarManager::kY);
+
+ die->SetHistogramManager(histos);
+
+}
+
+
+void InitCF(AliDielectron* die, Int_t cutDefinition)
+{
+ //
+ // Setupd the CF Manager if needed
+ //
+ AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
+
+ //pair variables
+ cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.);
+ //cf->AddVariable(AliDielectronVarManager::kP,200,0,20);
+ //cf->AddVariable(AliDielectronVarManager::kPhi,64, -3.2, 3.2);
+ cf->AddVariable(AliDielectronVarManager::kY,40,-2.,2.);
+ cf->AddVariable(AliDielectronVarManager::kM,500,0.,4.);
+ //cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);
+ //cf->AddVariable(AliDielectronVarManager::kOpeningAngle,315,0,3.15);
+ //cf->AddVariable(AliDielectronVarManager::kDeltaEta,200,-2,2);
+ //cf->AddVariable(AliDielectronVarManager::kDeltaPhi,100,0,3.15);
+ //cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10);
+ cf->AddVariable(AliDielectronVarManager::kNumberOfDaughters,5,0,5);
+ //leg variables
+ cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kP,200,0.,20.,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kY,40,-2.,2.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kEta,20,-1.,1.,kTRUE);
+ cf->AddVariable(AliDielectronVarManager::kPhi,100,0.,3.15,kTRUE);
+// cf->AddVariable(AliDielectronVarManager::kITSsignal,1000,0.0.,1000.,kTRUE);
+// cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10,kTRUE);
+// cf->AddVariable(AliDielectronVarManager::kNumberOfDaughters,11,0,10,kTRUE);
+
+ //only in this case write MC truth info
+
+ if (MCenabled) {
+ cf->SetStepForMCtruth();
+ //cf->SetStepsForMCtruthOnly();
+ //cf->SetStepForNoCutsMCmotherPid();
+ cout << "MC ENABLED ------------------------------------------------------" << endl;
+ //cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
+ //cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
+ }
+
+ //cf->SetStepsForEachCut();
+ //cf->SetStepForPreFilter();
+ cf->SetStepForAfterAllCuts();
+ //cf->SetStepsForBackground();
+ cf->SetStepsForSignal();
+
+ die->SetCFManagerPair(cf);
+
+/*
+
+ AliDielectronSignalMC* lowMassDiele=new
+ AliDielectronSignalMC("lowMassDiele","low mass dielectron pairs");
+ lowMassDiele->SetLegPDGs(11,-11);
+ lowMassDiele->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ lowMassDiele->SetLegSources(AliDielectronSignalMC::kPrimary,
+ AliDielectronSignalMC::kPrimary);
+ lowMassDiele->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(lowMassDiele);
+
+ AliDielectronSignalMC* secondary=new
+ AliDielectronSignalMC("secondary","secondary electrons pairs");
+ secondary->SetLegPDGs(11,-11);
+ secondary->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ secondary->SetLegSources(AliDielectronSignalMC::kSecondary,
+ AliDielectronSignalMC::kSecondary);
+ die->AddSignalMC(secondary);
+
+ AliDielectronSignalMC* eleFromConversions=new
+ AliDielectronSignalMC("eleFromConversions","conversion electrons");
+ eleFromConversions->SetLegPDGs(11,-11);
+ eleFromConversions->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ eleFromConversions->SetLegSources(AliDielectronSignalMC::kSecondary,
+ AliDielectronSignalMC::kSecondary);
+ eleFromConversions->SetMotherPDGs(22,22); // 22- photon
+ die->AddSignalMC(eleFromConversions);
+
+ AliDielectronSignalMC* misIdPions=new
+ AliDielectronSignalMC("misIdPions","mis id. pion pairs");
+ misIdPions->SetLegPDGs(211,-211);
+ misIdPions->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ die->AddSignalMC(misIdPions);
+
+ AliDielectronSignalMC* dalitzDecays=new
+ AliDielectronSignalMC("dalitzDecays","dalitz Pairs");
+ dalitzDecays->SetLegPDGs(11,-11);
+ dalitzDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);
+ dalitzDecays->SetLegSources(AliDielectronSignalMC::kSecondary,
+ AliDielectronSignalMC::kSecondary);
+ dalitzDecays->SetMotherPDGs(111,111);
+ dalitzDecays->SetFillPureMCStep(kTRUE);
+ die->AddSignalMC(dalitzDecays);
+*/
+
+AliDielectronSignalMC* PhiDecays= new AliDielectronSignalMC("PhiDecays","Phi Pairs");
+PhiDecays->SetLegPDGs(11,-11);
+PhiDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);
+PhiDecays->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+PhiDecays->SetMotherPDGs(333,333);
+PhiDecays->SetMothersRelation(AliDielectronSignalMC::kSame);
+PhiDecays->SetFillPureMCStep(kTRUE);
+die->AddSignalMC(PhiDecays);
+
+AliDielectronSignalMC* OmegaDecays= new AliDielectronSignalMC("OmegaDecays","Omega Pairs");
+OmegaDecays->SetLegPDGs(11,-11);
+OmegaDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);
+OmegaDecays->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+OmegaDecays->SetMotherPDGs(223,223);
+OmegaDecays->SetMothersRelation(AliDielectronSignalMC::kSame);
+OmegaDecays->SetDalitz(AliDielectronSignalMC::kIsNotDalitz);
+OmegaDecays->SetFillPureMCStep(kTRUE);
+die->AddSignalMC(OmegaDecays);
+
+/*
+AliDielectronSignalMC* RhoDecays= new AliDielectronSignalMC("RhoDecays","Rho Pairs");
+RhoDecays->SetLegPDGs(11,-11);
+RhoDecays->SetCheckBothChargesLegs(kTRUE,kTRUE);
+RhoDecays->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+RhoDecays->SetMotherPDGs(113,113);
+RhoDecays->SetMothersRelation(AliDielectronSignalMC::kSame);
+RhoDecays->SetFillPureMCStep(kTRUE);
+die->AddSignalMC(RhoDecays);
+
+AliDielectronSignalMC* DieleConti= new AliDielectronSignalMC("DieleConti","low mass ee pairs");
+DieleConti->SetLegPDGs(11,-11);
+DieleConti->SetMotherPDGs(0,0,22,22);
+DieleConti->SetCheckBothChargesLegs(kTRUE,kTRUE);
+DieleConti->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
+DieleConti->SetMothersRelation(AliDielectronSignalMC::kSame);
+DieleConti->SetFillPureMCStep(kTRUE);
+die->AddSignalMC(DieleConti);*/
+
+
+}
+
+//--------------------------------------
+ void EnableMC() {
+ MCenabled=kTRUE;
+ }
-#ifndef AliAnalysisTaskEMCALPhoton_h\r
-#define AliAnalysisTaskEMCALPhoton_h\r
-\r
-// $Id$\r
-\r
-class TH1;\r
-class TH2;\r
-class TObjArray;\r
-class AliESDEvent;\r
-class AliMCEvent;\r
-class AliStack;\r
-class AliESDtrack;\r
-class AliESDtrackCuts;\r
-class AliESDCaloCells;\r
-class AliAODEvent;\r
-class AliAODCaloCells;\r
-class AliEMCALGeometry;\r
-class AliOADBContainer;\r
-class AliVCluster;\r
-class AliVCaloCells;\r
-class AliAnalysisTaskEMCALClusterizeFast;\r
-class TParticle;\r
-class TGeoHMatrix;\r
-class AliPhotonHeaderObj;\r
-class AliPhotonConvObj;\r
-class AliPhotonClusterObj;\r
-class AliPhotonCellObj;\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-\r
-class AliAnalysisTaskEMCALPhoton : public AliAnalysisTaskSE {\r
- public:\r
- AliAnalysisTaskEMCALPhoton();\r
- AliAnalysisTaskEMCALPhoton(const char *name);\r
- virtual ~AliAnalysisTaskEMCALPhoton() {}\r
-\r
- void UserCreateOutputObjects();\r
- void UserExec(Option_t *option);\r
- void Terminate(Option_t *);\r
-\r
- void SetTrackCuts(AliESDtrackCuts *c) { fTrCuts = c; }\r
- void SetPrimTrackCuts(AliESDtrackCuts *c) { fPrTrCuts = c; }\r
- void SetTimeResTOF(Float_t tr = 130.) { fTimeResTOF = tr; }\r
- void SetMipResponseTPC(Float_t mr = 47.9) { fMipResponseTPC = mr; }\r
- void SetGeoName(const char *n) { fGeoName = n; }\r
- void SetPeriod(const char *n) { fPeriod = n; }\r
- void SetTrainMode(Bool_t t) { fIsTrain = t; }\r
- void SetGridMode(Bool_t g) { fIsGrid = g; }\r
- void SetClusThreshold(Double_t et) { fClusThresh = et; }\r
- void SetClusterizer(AliAnalysisTaskEMCALClusterizeFast *c) { fClusterizer = c; }\r
- void SetMcMode(Bool_t mc) { fIsMC = mc; }\r
- void SetDebugMode(Bool_t d) { fDebug = d; }\r
- void SetRedoV0(Bool_t v) { fRedoV0 = v; }\r
- void FindConversions();\r
- void FillMyCells();\r
- void FillMyClusters();\r
- void FillMyAltClusters();\r
- void FillIsoTracks();\r
- void FillMcPart( Int_t itrack, Int_t label);\r
- void GetMcParts();\r
- Double_t GetMcIsolation( Int_t itrack, Double_t radius, Double_t pt) const;\r
- Double_t GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;\r
- Double_t GetPhiBandEt(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;\r
- // Double_t GetPhiBandEt(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;\r
- Double_t GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax);\r
- Double_t GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const; \r
- \r
- protected:\r
- AliESDtrackCuts *fTrCuts; // track cuts\r
- AliESDtrackCuts *fPrTrCuts; // primary track cuts\r
- TObjArray *fSelTracks; //!pointer to selected inclusive tracks\r
- TObjArray *fSelPrimTracks; //!pointer to selected primary tracks\r
- TClonesArray *fTracks; //!track input array\r
- TClonesArray *fPhotConvArray; //!array of AliPhotonConvObj\r
- TClonesArray *fMyClusts; //!array of AliPhotonClusterObj\r
- TClonesArray *fMyAltClusts; //!array of AliPhotonClusterObj from the alternative clusterizer\r
- TClonesArray *fMyCells; //!array of AliPhotonCellObj\r
- TClonesArray *fMyTracks; //!array of AliPhotonTrackObj\r
- TClonesArray *fMyMcParts; //!array of AliPhotonMcPartObj\r
- AliPhotonHeaderObj *fHeader; //!\r
- AliOADBContainer *fOADBContainer; //!OADB container used to load misalignment matrices\r
- TClonesArray *fCaloClusters; //!pointer to EMCal clusters\r
- TClonesArray *fCaloClustersNew; //!pointer to EMCal clusters v2\r
- TClonesArray *fAODMCParticles; //!MC particles array for AOD analysis\r
- AliVCaloCells *fVCells; //!pointer to EMCal cells \r
- AliEMCALGeometry *fGeom; // geometry utils\r
- Float_t fTimeResTOF; //TOF time resolution for track PID\r
- Float_t fMipResponseTPC; //TPC mip response for track pid\r
- TString fGeoName; // geometry name (def = EMCAL_FIRSTYEARV1)\r
- TString fPeriod; // string to the LHC period\r
- Bool_t fIsTrain; //variable to set train mode\r
- Bool_t fIsMC; //variable to switch mcparts branch on/off\r
- Bool_t fDebug; //variable to switch debug on/off\r
- Bool_t fRedoV0; //variable to recalculate V0s - must be off for A-A collisions\r
- Bool_t fIsGrid; //variable to set grid mode\r
- Double_t fClusThresh; //!energy threshold for cluster be saved\r
- AliAnalysisTaskEMCALClusterizeFast *fClusterizer; //!pointer for alternative clusterizer\r
- TString fCaloClustersName; //alternative clusterizer name\r
-\r
- \r
- \r
- private:\r
- AliESDEvent *fESD; //! ESD object\r
- AliAODEvent *fAOD; //! AOD object\r
- AliVEvent *fVev; //!virtual event obj \r
- AliMCEvent *fMCEvent; //! MC event object\r
- AliStack *fStack; //!MC particles stack object\r
- TGeoHMatrix *fGeomMatrix[12];//! Geometry misalignment matrices for EMCal\r
- \r
- TList *fOutputList; //! Output list\r
- TTree *fTree; //!output tree\r
- Int_t fMyMcIndex; //!counter of the saved mc particlesx\r
- \r
- //conversion histograms\r
- TH2F *fNV0sBefAndAftRerun; //!check the number of V0s before and after rerun\r
- TH2F *fConversionVtxXY; //! X x Y of found conversion vertices\r
- TH1F *fInvMassV0; //!invariant mass from v0->GetEffMass()\r
- TH1F *fInvMassV0KF; //!invariant mass from the v0 tracks\r
- TH1F *fInvMassV0SS; //!invariant mass from the tracks in the "dirty" finder\r
- TH2F *fDedxPAll; //!dE/dx vs p of all selected tracks\r
- \r
-\r
- \r
- AliAnalysisTaskEMCALPhoton(const AliAnalysisTaskEMCALPhoton&); // not implemented\r
- AliAnalysisTaskEMCALPhoton& operator=(const AliAnalysisTaskEMCALPhoton&); // not implemented\r
- \r
- ClassDef(AliAnalysisTaskEMCALPhoton, 1); // example of analysis\r
-};\r
-\r
-#endif\r
-\r
-#ifndef AliPhotonObjs_h\r
-#define AliPhotonObjs_h\r
-\r
-class AliPhotonHeaderObj : public TObject\r
-{\r
- public: AliPhotonHeaderObj() :\r
- TObject(), fInputFileName(""), fTrClassMask(0), fTrCluster(0), fV0Cent(0), fV0(0), fCl1Cent(0), \r
- fCl1(0), fTrCent(0), fTr(0), fNClus(0), fNCells(0), fTrackMult(0), fNMcParts(0) {;}\r
- public:\r
- TString fInputFileName; // used for normalization purposes in MC productions\r
- ULong64_t fTrClassMask; // trigger class mask\r
- UChar_t fTrCluster; // trigger cluster mask\r
- Double32_t fV0Cent; //[0,0,16] v0 cent\r
- Double32_t fV0; //[0,0,16] v0 result used for cent \r
- Double32_t fCl1Cent; //[0,0,16] cl1 cent\r
- Double32_t fCl1; //[0,0,16] cl1 result used for cent \r
- Double32_t fTrCent; //[0,0,16] tr cent\r
- Double32_t fTr; //[0,0,16] tr result used for cent \r
- Int_t fNClus;\r
- Int_t fNCells;\r
- Int_t fTrackMult;\r
- Int_t fNMcParts;\r
-\r
- ClassDef(AliPhotonHeaderObj,5)\r
-};\r
-\r
-class AliPhotonConvObj : public TObject\r
-{\r
- public: AliPhotonConvObj() : \r
- TObject(), fPt(0), fEta(0), fPhi(0), fVR(0), fVEta(0), fVPhi(0), fMass(0), fMcLabel(-1),\r
- fNegPt(0), fNegEta(0), fNegPhi(0), fNegDedx(0), fNegMcLabel(-1),\r
- fPosPt(0), fPosEta(0), fPosPhi(0), fPosDedx(0), fPosMcLabel(-1) {;}\r
- public:\r
- Double32_t fPt; //[0,0,16] pt\r
- Double32_t fEta; //[0,0,16] eta\r
- Double32_t fPhi; //[0,0,16] phi\r
- Double32_t fVR; //[0,0,16] prod r (cylinder)\r
- Double32_t fVEta; //[0,0,16] prod eta\r
- Double32_t fVPhi; //[0,0,16] prod phi\r
- Double32_t fMass; //[0,0,16] if correctly filled, should be <50 MeV\r
- Short_t fMcLabel; //corresponding MC label\r
-\r
- //negative daughter\r
- Double32_t fNegPt; //[0,0,16] pt\r
- Double32_t fNegEta; //[0,0,16] eta\r
- Double32_t fNegPhi; //[0,0,16] phi\r
- Double32_t fNegDedx; //[0,0,16] if correctly filled, should be <50 MeV\r
- Short_t fNegMcLabel; //corresponding MC label\r
-\r
- //positive daughter\r
- Double32_t fPosPt; //[0,0,16] pt\r
- Double32_t fPosEta; //[0,0,16] eta\r
- Double32_t fPosPhi; //[0,0,16] phi\r
- Double32_t fPosDedx; //[0,0,16] if correctly filled, should be <50 MeV\r
- Short_t fPosMcLabel; //corresponding MC label\r
-\r
- ClassDef(AliPhotonConvObj,1) // conversion class\r
-\r
-};\r
-class AliPhotonClusterObj : public TObject\r
-{\r
- public: AliPhotonClusterObj() : \r
- TObject(), fE(0), fEt(0), fR(0), fEta(0), fPhi(0), fN(0),fEmax(0),fTmax(0), fIdmax(0), fEcross(0),fDisp(-1), \r
- fM20(-1), fM02(-1),fTrDEta(0), fTrDPhi(0), fTrEp(-1), fTrDedx(-1), fTrIso01(0), fTrIso02(0), fTrIso03(0), fTrIso04(0), \r
- fTrPhiBand01(0), fTrPhiBand02(0), fTrPhiBand03(0), fTrPhiBand04(0), fCellsAbsId(""),fMcLabel(-1)\r
- {;}\r
- public:\r
- Double32_t fE;\r
- Double32_t fEt;\r
- Double32_t fR;\r
- Double32_t fEta;\r
- Double32_t fPhi;\r
- UShort_t fN;\r
- Double_t fEmax;\r
- Double_t fTmax;\r
- Short_t fIdmax;\r
- Double_t fEcross;\r
- Double32_t fDisp;\r
- Double32_t fM20;\r
- Double32_t fM02;\r
- Double32_t fTrDEta;\r
- Double32_t fTrDPhi;\r
- Double32_t fTrEp;\r
- Double32_t fTrDedx;\r
- Double32_t fTrIso01;\r
- Double32_t fTrIso02;\r
- Double32_t fTrIso03;\r
- Double32_t fTrIso04;\r
- Double32_t fTrPhiBand01;\r
- Double32_t fTrPhiBand02;\r
- Double32_t fTrPhiBand03;\r
- Double32_t fTrPhiBand04;\r
- TString fCellsAbsId; //cluster cells absid\r
- Short_t fMcLabel;\r
- \r
- \r
- \r
- ClassDef(AliPhotonClusterObj,6) // cluster class\r
-\r
-};\r
-\r
-class AliPhotonCellObj : public TObject\r
-{\r
- public: AliPhotonCellObj() : \r
- TObject(), fAbsID(-1), fE(0), fEt(0), fEta(0), fPhi(0), fTime(0)\r
- {;}\r
- public:\r
- Short_t fAbsID;\r
- Double32_t fE;\r
- Double32_t fEt;\r
- Double32_t fEta;\r
- Double32_t fPhi;\r
- Double32_t fTime;\r
- \r
- \r
- \r
- ClassDef(AliPhotonCellObj,1) // cell class\r
-\r
-};\r
-\r
-class AliPhotonTrackObj : public TObject\r
-{\r
- public: AliPhotonTrackObj() :\r
- TObject(), fPt(0), fEta(0), fPhi(0), fDedx(0), fCharge(0), fMcLabel(-1) {;}\r
- public:\r
- Double32_t fPt;\r
- Double32_t fEta;\r
- Double32_t fPhi;\r
- Double32_t fDedx;\r
- Short_t fCharge;\r
- Short_t fMcLabel;\r
-\r
- ClassDef(AliPhotonTrackObj,3)\r
-};\r
-\r
-class AliPhotonMcPartObj : public TObject\r
-{\r
- public: AliPhotonMcPartObj() :\r
- TObject(), fLabel(-1), fPdg(0), fPt(0), fEta(0), fPhi(0), \r
- fVR(0), fVEta(0), fVPhi(0), fMother(-1), fFirstD(-1),\r
- fLastD(-1), fStatus(-1), fIso(-1), fIso3(-1) {;}\r
- public:\r
- Short_t fLabel;\r
- Short_t fPdg;\r
- Double32_t fPt;\r
- Double32_t fEta;\r
- Double32_t fPhi;\r
- Double32_t fVR;\r
- Double32_t fVEta;\r
- Double32_t fVPhi;\r
- Short_t fMother;\r
- Short_t fFirstD;\r
- Short_t fLastD;\r
- Short_t fStatus;\r
- Double32_t fIso;\r
- Double32_t fIso3; //in cone of radius 0.3\r
-\r
- ClassDef(AliPhotonMcPartObj,3)\r
-};\r
-\r
-#endif\r
+#ifndef AliAnalysisTaskEMCALPhoton_h
+#define AliAnalysisTaskEMCALPhoton_h
+
+// $Id$
+
+class TH1;
+class TH2;
+class TObjArray;
+class AliESDEvent;
+class AliMCEvent;
+class AliStack;
+class AliESDtrack;
+class AliESDtrackCuts;
+class AliESDCaloCells;
+class AliAODEvent;
+class AliAODCaloCells;
+class AliEMCALGeometry;
+class AliOADBContainer;
+class AliVCluster;
+class AliVCaloCells;
+class AliAnalysisTaskEMCALClusterizeFast;
+class TParticle;
+class TGeoHMatrix;
+class AliPhotonHeaderObj;
+class AliPhotonConvObj;
+class AliPhotonClusterObj;
+class AliPhotonCellObj;
+
+#include "AliAnalysisTaskSE.h"
+
+class AliAnalysisTaskEMCALPhoton : public AliAnalysisTaskSE {
+ public:
+ AliAnalysisTaskEMCALPhoton();
+ AliAnalysisTaskEMCALPhoton(const char *name);
+ virtual ~AliAnalysisTaskEMCALPhoton() {}
+
+ void UserCreateOutputObjects();
+ void UserExec(Option_t *option);
+ void Terminate(Option_t *);
+
+ void SetTrackCuts(AliESDtrackCuts *c) { fTrCuts = c; }
+ void SetPrimTrackCuts(AliESDtrackCuts *c) { fPrTrCuts = c; }
+ void SetTimeResTOF(Float_t tr = 130.) { fTimeResTOF = tr; }
+ void SetMipResponseTPC(Float_t mr = 47.9) { fMipResponseTPC = mr; }
+ void SetGeoName(const char *n) { fGeoName = n; }
+ void SetPeriod(const char *n) { fPeriod = n; }
+ void SetTrainMode(Bool_t t) { fIsTrain = t; }
+ void SetGridMode(Bool_t g) { fIsGrid = g; }
+ void SetClusThreshold(Double_t et) { fClusThresh = et; }
+ void SetClusterizer(AliAnalysisTaskEMCALClusterizeFast *c) { fClusterizer = c; }
+ void SetMcMode(Bool_t mc) { fIsMC = mc; }
+ void SetDebugMode(Bool_t d) { fDebug = d; }
+ void SetRedoV0(Bool_t v) { fRedoV0 = v; }
+ void FindConversions();
+ void FillMyCells();
+ void FillMyClusters();
+ void FillMyAltClusters();
+ void FillIsoTracks();
+ void FillMcPart( Int_t itrack, Int_t label);
+ void GetMcParts();
+ Double_t GetMcIsolation( Int_t itrack, Double_t radius, Double_t pt) const;
+ Double_t GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;
+ Double_t GetPhiBandEt(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;
+ // Double_t GetPhiBandEt(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;
+ Double_t GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax);
+ Double_t GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const;
+
+ protected:
+ AliESDtrackCuts *fTrCuts; // track cuts
+ AliESDtrackCuts *fPrTrCuts; // primary track cuts
+ TObjArray *fSelTracks; //!pointer to selected inclusive tracks
+ TObjArray *fSelPrimTracks; //!pointer to selected primary tracks
+ TClonesArray *fTracks; //!track input array
+ TClonesArray *fPhotConvArray; //!array of AliPhotonConvObj
+ TClonesArray *fMyClusts; //!array of AliPhotonClusterObj
+ TClonesArray *fMyAltClusts; //!array of AliPhotonClusterObj from the alternative clusterizer
+ TClonesArray *fMyCells; //!array of AliPhotonCellObj
+ TClonesArray *fMyTracks; //!array of AliPhotonTrackObj
+ TClonesArray *fMyMcParts; //!array of AliPhotonMcPartObj
+ AliPhotonHeaderObj *fHeader; //!
+ AliOADBContainer *fOADBContainer; //!OADB container used to load misalignment matrices
+ TClonesArray *fCaloClusters; //!pointer to EMCal clusters
+ TClonesArray *fCaloClustersNew; //!pointer to EMCal clusters v2
+ TClonesArray *fAODMCParticles; //!MC particles array for AOD analysis
+ AliVCaloCells *fVCells; //!pointer to EMCal cells
+ AliEMCALGeometry *fGeom; // geometry utils
+ Float_t fTimeResTOF; //TOF time resolution for track PID
+ Float_t fMipResponseTPC; //TPC mip response for track pid
+ TString fGeoName; // geometry name (def = EMCAL_FIRSTYEARV1)
+ TString fPeriod; // string to the LHC period
+ Bool_t fIsTrain; //variable to set train mode
+ Bool_t fIsMC; //variable to switch mcparts branch on/off
+ Bool_t fDebug; //variable to switch debug on/off
+ Bool_t fRedoV0; //variable to recalculate V0s - must be off for A-A collisions
+ Bool_t fIsGrid; //variable to set grid mode
+ Double_t fClusThresh; //!energy threshold for cluster be saved
+ AliAnalysisTaskEMCALClusterizeFast *fClusterizer; //!pointer for alternative clusterizer
+ TString fCaloClustersName; //alternative clusterizer name
+
+
+
+ private:
+ AliESDEvent *fESD; //! ESD object
+ AliAODEvent *fAOD; //! AOD object
+ AliVEvent *fVev; //!virtual event obj
+ AliMCEvent *fMCEvent; //! MC event object
+ AliStack *fStack; //!MC particles stack object
+ TGeoHMatrix *fGeomMatrix[12];//! Geometry misalignment matrices for EMCal
+
+ TList *fOutputList; //! Output list
+ TTree *fTree; //!output tree
+ Int_t fMyMcIndex; //!counter of the saved mc particlesx
+
+ //conversion histograms
+ TH2F *fNV0sBefAndAftRerun; //!check the number of V0s before and after rerun
+ TH2F *fConversionVtxXY; //! X x Y of found conversion vertices
+ TH1F *fInvMassV0; //!invariant mass from v0->GetEffMass()
+ TH1F *fInvMassV0KF; //!invariant mass from the v0 tracks
+ TH1F *fInvMassV0SS; //!invariant mass from the tracks in the "dirty" finder
+ TH2F *fDedxPAll; //!dE/dx vs p of all selected tracks
+
+
+
+ AliAnalysisTaskEMCALPhoton(const AliAnalysisTaskEMCALPhoton&); // not implemented
+ AliAnalysisTaskEMCALPhoton& operator=(const AliAnalysisTaskEMCALPhoton&); // not implemented
+
+ ClassDef(AliAnalysisTaskEMCALPhoton, 1); // example of analysis
+};
+
+#endif
+
+#ifndef AliPhotonObjs_h
+#define AliPhotonObjs_h
+
+class AliPhotonHeaderObj : public TObject
+{
+ public: AliPhotonHeaderObj() :
+ TObject(), fInputFileName(""), fTrClassMask(0), fTrCluster(0), fV0Cent(0), fV0(0), fCl1Cent(0),
+ fCl1(0), fTrCent(0), fTr(0), fNClus(0), fNCells(0), fTrackMult(0), fNMcParts(0) {;}
+ public:
+ TString fInputFileName; // used for normalization purposes in MC productions
+ ULong64_t fTrClassMask; // trigger class mask
+ UChar_t fTrCluster; // trigger cluster mask
+ Double32_t fV0Cent; //[0,0,16] v0 cent
+ Double32_t fV0; //[0,0,16] v0 result used for cent
+ Double32_t fCl1Cent; //[0,0,16] cl1 cent
+ Double32_t fCl1; //[0,0,16] cl1 result used for cent
+ Double32_t fTrCent; //[0,0,16] tr cent
+ Double32_t fTr; //[0,0,16] tr result used for cent
+ Int_t fNClus;
+ Int_t fNCells;
+ Int_t fTrackMult;
+ Int_t fNMcParts;
+
+ ClassDef(AliPhotonHeaderObj,5)
+};
+
+class AliPhotonConvObj : public TObject
+{
+ public: AliPhotonConvObj() :
+ TObject(), fPt(0), fEta(0), fPhi(0), fVR(0), fVEta(0), fVPhi(0), fMass(0), fMcLabel(-1),
+ fNegPt(0), fNegEta(0), fNegPhi(0), fNegDedx(0), fNegMcLabel(-1),
+ fPosPt(0), fPosEta(0), fPosPhi(0), fPosDedx(0), fPosMcLabel(-1) {;}
+ public:
+ Double32_t fPt; //[0,0,16] pt
+ Double32_t fEta; //[0,0,16] eta
+ Double32_t fPhi; //[0,0,16] phi
+ Double32_t fVR; //[0,0,16] prod r (cylinder)
+ Double32_t fVEta; //[0,0,16] prod eta
+ Double32_t fVPhi; //[0,0,16] prod phi
+ Double32_t fMass; //[0,0,16] if correctly filled, should be <50 MeV
+ Short_t fMcLabel; //corresponding MC label
+
+ //negative daughter
+ Double32_t fNegPt; //[0,0,16] pt
+ Double32_t fNegEta; //[0,0,16] eta
+ Double32_t fNegPhi; //[0,0,16] phi
+ Double32_t fNegDedx; //[0,0,16] if correctly filled, should be <50 MeV
+ Short_t fNegMcLabel; //corresponding MC label
+
+ //positive daughter
+ Double32_t fPosPt; //[0,0,16] pt
+ Double32_t fPosEta; //[0,0,16] eta
+ Double32_t fPosPhi; //[0,0,16] phi
+ Double32_t fPosDedx; //[0,0,16] if correctly filled, should be <50 MeV
+ Short_t fPosMcLabel; //corresponding MC label
+
+ ClassDef(AliPhotonConvObj,1) // conversion class
+
+};
+class AliPhotonClusterObj : public TObject
+{
+ public: AliPhotonClusterObj() :
+ TObject(), fE(0), fEt(0), fR(0), fEta(0), fPhi(0), fN(0),fEmax(0),fTmax(0), fIdmax(0), fEcross(0),fDisp(-1),
+ fM20(-1), fM02(-1),fTrDEta(0), fTrDPhi(0), fTrEp(-1), fTrDedx(-1), fTrIso01(0), fTrIso02(0), fTrIso03(0), fTrIso04(0),
+ fTrPhiBand01(0), fTrPhiBand02(0), fTrPhiBand03(0), fTrPhiBand04(0), fCellsAbsId(""),fMcLabel(-1)
+ {;}
+ public:
+ Double32_t fE;
+ Double32_t fEt;
+ Double32_t fR;
+ Double32_t fEta;
+ Double32_t fPhi;
+ UShort_t fN;
+ Double_t fEmax;
+ Double_t fTmax;
+ Short_t fIdmax;
+ Double_t fEcross;
+ Double32_t fDisp;
+ Double32_t fM20;
+ Double32_t fM02;
+ Double32_t fTrDEta;
+ Double32_t fTrDPhi;
+ Double32_t fTrEp;
+ Double32_t fTrDedx;
+ Double32_t fTrIso01;
+ Double32_t fTrIso02;
+ Double32_t fTrIso03;
+ Double32_t fTrIso04;
+ Double32_t fTrPhiBand01;
+ Double32_t fTrPhiBand02;
+ Double32_t fTrPhiBand03;
+ Double32_t fTrPhiBand04;
+ TString fCellsAbsId; //cluster cells absid
+ Short_t fMcLabel;
+
+
+
+ ClassDef(AliPhotonClusterObj,6) // cluster class
+
+};
+
+class AliPhotonCellObj : public TObject
+{
+ public: AliPhotonCellObj() :
+ TObject(), fAbsID(-1), fE(0), fEt(0), fEta(0), fPhi(0), fTime(0)
+ {;}
+ public:
+ Short_t fAbsID;
+ Double32_t fE;
+ Double32_t fEt;
+ Double32_t fEta;
+ Double32_t fPhi;
+ Double32_t fTime;
+
+
+
+ ClassDef(AliPhotonCellObj,1) // cell class
+
+};
+
+class AliPhotonTrackObj : public TObject
+{
+ public: AliPhotonTrackObj() :
+ TObject(), fPt(0), fEta(0), fPhi(0), fDedx(0), fCharge(0), fMcLabel(-1) {;}
+ public:
+ Double32_t fPt;
+ Double32_t fEta;
+ Double32_t fPhi;
+ Double32_t fDedx;
+ Short_t fCharge;
+ Short_t fMcLabel;
+
+ ClassDef(AliPhotonTrackObj,3)
+};
+
+class AliPhotonMcPartObj : public TObject
+{
+ public: AliPhotonMcPartObj() :
+ TObject(), fLabel(-1), fPdg(0), fPt(0), fEta(0), fPhi(0),
+ fVR(0), fVEta(0), fVPhi(0), fMother(-1), fFirstD(-1),
+ fLastD(-1), fStatus(-1), fIso(-1), fIso3(-1) {;}
+ public:
+ Short_t fLabel;
+ Short_t fPdg;
+ Double32_t fPt;
+ Double32_t fEta;
+ Double32_t fPhi;
+ Double32_t fVR;
+ Double32_t fVEta;
+ Double32_t fVPhi;
+ Short_t fMother;
+ Short_t fFirstD;
+ Short_t fLastD;
+ Short_t fStatus;
+ Double32_t fIso;
+ Double32_t fIso3; //in cone of radius 0.3
+
+ ClassDef(AliPhotonMcPartObj,3)
+};
+
+#endif
-/* This file is property of and copyright *\r
- * ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-/// @file AliAnaConvCorrPhoton.h\r
-/// @author Svein Lindal\r
-/// @brief Base class for analysis of correlations between conversion particles and charged tracks\r
-\r
-#ifndef ALIANACONVCORRBASE_CXX\r
-#define ALIANACONVCORRBASE_CXX\r
-\r
-#include "Rtypes.h"\r
-#include "TMath.h"\r
-#include "TList.h"\r
-#include "TH1.h"\r
-#include <THnSparse.h>\r
-\r
-class AliAODConversionParticle;\r
-class TClonesArray;\r
-class TString;\r
-\r
-class AliAnaConvCorrBase : public TNamed {\r
-\r
-public:\r
-\r
- \r
-\r
- //Constructor / desctructor\r
- AliAnaConvCorrBase(TString name, TString title); \r
- virtual ~AliAnaConvCorrBase();\r
- \r
- //CreateHistograms\r
- void CreateBaseHistograms();\r
- //To be overrriden by children. Should always call CreateBaseHistograms()\r
- virtual void CreateHistograms();\r
- \r
- //Get list of histograms\r
- TList * GetHistograms() const { return fHistograms;}\r
-\r
- //Add histogram to list\r
- void AddHistogram(TH1 * histogram) { fHistograms->Add(dynamic_cast<TObject*>(histogram));}\r
-\r
- void AddAxis(TAxis * axis) { fAxesList.Add(axis); }\r
-\r
- ///Get the distance in phi between trigger particle and correlated particle\r
- Float_t GetDPhi(Float_t dPhi) { \r
- if ( dPhi < 3*TMath::PiOver2() && dPhi > - TMath::PiOver2() ) return dPhi;\r
- else return ( (dPhi>0)? dPhi - TMath::TwoPi() : dPhi + TMath::TwoPi() ); \r
- }\r
-\r
- void CorrelateWithTracks(AliAODConversionParticle * particle, TObjArray * tracks, const Int_t tIDs[4], Float_t cent, Float_t vtxz);\r
- void FillCounters(TObjArray * particles, TObjArray * tracks, Float_t cent, Float_t vtxz);\r
-\r
- TAxis& GetAxistPt() { return fAxistPt; }\r
- TAxis& GetAxiscPt() { return fAxiscPt; }\r
- TAxis& GetAxisdEta() { return fAxisdEta; }\r
- TAxis& GetAxisdPhi() { return fAxisdPhi; }\r
- TAxis& GetAxisIso() { return fAxisIso; }\r
- TAxis& GetAxisCent() { return fAxisCent; }\r
- TAxis& GetAxisZ() { return fAxisZ; }\r
- TAxis& GetAxisTrigEta() { return fAxisTrigEta; }\r
- TAxis& GetAxisAssEta() { return fAxisAssEta; }\r
- TAxis& GetAxisMEPhi() { return fAxisMEPhi; }\r
-\r
- TList& GetAxisList() { return fAxesList; }\r
- TList& GetTrackAxisList() { return fTrackAxisList; }\r
- TList& GetTrigAxisList() { return fTrigAxisList; }\r
-\r
-\r
-protected:\r
-\r
- THnSparseF * CreateSparse(TString name, TString title, TList * axes);\r
-\r
-private:\r
-\r
- void SetUpDefaultBins();\r
- \r
- //TString fName; //name of analysis\r
- TList * fHistograms; //List of histograms\r
- TList fAxesList; //List over axes to be used in sparse\r
- TList fTrigAxisList; //list\r
- TList fTrackAxisList; //list\r
-\r
- TAxis fAxistPt; //Pt axis\r
- TAxis fAxiscPt; //correlated particle pt axis\r
- TAxis fAxisdEta; //delta eta axis\r
- TAxis fAxisdPhi; //delta phi axis\r
- TAxis fAxisIso; //Isolated particle axis\r
- TAxis fAxisCent; //Centrality\r
- TAxis fAxisZ; //vtx\r
- \r
- TAxis fAxisTrigEta ; //Eta axis for ME\r
- TAxis fAxisAssEta ; //Eta axis for ME\r
- TAxis fAxisMEPhi ; //Phi axis for ME\r
-\r
- THnSparseF * fCorrSparse; // Sparse for corr\r
- THnSparseF * fTrigSparse; // ME Sparse\r
- THnSparseF * fTrackSparse; //Track Sparse\r
-\r
- //Default constructor prohibited\r
- AliAnaConvCorrBase(); //not implemented\r
- AliAnaConvCorrBase(const AliAnaConvCorrBase&); // not implemented\r
- AliAnaConvCorrBase& operator=(const AliAnaConvCorrBase&); // not implemented\r
-\r
- ClassDef(AliAnaConvCorrBase, 7); // example of analysis\r
-\r
-};\r
-\r
-#endif\r
+/* This file is property of and copyright *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/// @file AliAnaConvCorrPhoton.h
+/// @author Svein Lindal
+/// @brief Base class for analysis of correlations between conversion particles and charged tracks
+
+#ifndef ALIANACONVCORRBASE_CXX
+#define ALIANACONVCORRBASE_CXX
+
+#include "Rtypes.h"
+#include "TMath.h"
+#include "TList.h"
+#include "TH1.h"
+#include <THnSparse.h>
+
+class AliAODConversionParticle;
+class TClonesArray;
+class TString;
+
+class AliAnaConvCorrBase : public TNamed {
+
+public:
+
+
+
+ //Constructor / desctructor
+ AliAnaConvCorrBase(TString name, TString title);
+ virtual ~AliAnaConvCorrBase();
+
+ //CreateHistograms
+ void CreateBaseHistograms();
+ //To be overrriden by children. Should always call CreateBaseHistograms()
+ virtual void CreateHistograms();
+
+ //Get list of histograms
+ TList * GetHistograms() const { return fHistograms;}
+
+ //Add histogram to list
+ void AddHistogram(TH1 * histogram) { fHistograms->Add(dynamic_cast<TObject*>(histogram));}
+
+ void AddAxis(TAxis * axis) { fAxesList.Add(axis); }
+
+ ///Get the distance in phi between trigger particle and correlated particle
+ Float_t GetDPhi(Float_t dPhi) {
+ if ( dPhi < 3*TMath::PiOver2() && dPhi > - TMath::PiOver2() ) return dPhi;
+ else return ( (dPhi>0)? dPhi - TMath::TwoPi() : dPhi + TMath::TwoPi() );
+ }
+
+ void CorrelateWithTracks(AliAODConversionParticle * particle, TObjArray * tracks, const Int_t tIDs[4], Float_t cent, Float_t vtxz);
+ void FillCounters(TObjArray * particles, TObjArray * tracks, Float_t cent, Float_t vtxz);
+
+ TAxis& GetAxistPt() { return fAxistPt; }
+ TAxis& GetAxiscPt() { return fAxiscPt; }
+ TAxis& GetAxisdEta() { return fAxisdEta; }
+ TAxis& GetAxisdPhi() { return fAxisdPhi; }
+ TAxis& GetAxisIso() { return fAxisIso; }
+ TAxis& GetAxisCent() { return fAxisCent; }
+ TAxis& GetAxisZ() { return fAxisZ; }
+ TAxis& GetAxisTrigEta() { return fAxisTrigEta; }
+ TAxis& GetAxisAssEta() { return fAxisAssEta; }
+ TAxis& GetAxisMEPhi() { return fAxisMEPhi; }
+
+ TList& GetAxisList() { return fAxesList; }
+ TList& GetTrackAxisList() { return fTrackAxisList; }
+ TList& GetTrigAxisList() { return fTrigAxisList; }
+
+
+protected:
+
+ THnSparseF * CreateSparse(TString name, TString title, TList * axes);
+
+private:
+
+ void SetUpDefaultBins();
+
+ //TString fName; //name of analysis
+ TList * fHistograms; //List of histograms
+ TList fAxesList; //List over axes to be used in sparse
+ TList fTrigAxisList; //list
+ TList fTrackAxisList; //list
+
+ TAxis fAxistPt; //Pt axis
+ TAxis fAxiscPt; //correlated particle pt axis
+ TAxis fAxisdEta; //delta eta axis
+ TAxis fAxisdPhi; //delta phi axis
+ TAxis fAxisIso; //Isolated particle axis
+ TAxis fAxisCent; //Centrality
+ TAxis fAxisZ; //vtx
+
+ TAxis fAxisTrigEta ; //Eta axis for ME
+ TAxis fAxisAssEta ; //Eta axis for ME
+ TAxis fAxisMEPhi ; //Phi axis for ME
+
+ THnSparseF * fCorrSparse; // Sparse for corr
+ THnSparseF * fTrigSparse; // ME Sparse
+ THnSparseF * fTrackSparse; //Track Sparse
+
+ //Default constructor prohibited
+ AliAnaConvCorrBase(); //not implemented
+ AliAnaConvCorrBase(const AliAnaConvCorrBase&); // not implemented
+ AliAnaConvCorrBase& operator=(const AliAnaConvCorrBase&); // not implemented
+
+ ClassDef(AliAnaConvCorrBase, 7); // example of analysis
+
+};
+
+#endif
-/* This file is property of and copyright *\r
- * ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-/// @file AliAnaConvCorrPion.h\r
-/// @author Svein Lindal\r
-/// @brief Class used to find correlations between pions and charged tracks\r
-\r
-\r
-#ifndef ALIANACONVCORRPION_CXX\r
-#define ALIANACONVCORRPION_CXX\r
-\r
-#include "AliAnaConvCorrBase.h"\r
-class TH2D;\r
-//#include "THnSparse.h"\r
-\r
-//class AliAODConversionPhoton;\r
-class TClonesArray;\r
-\r
-class AliAnaConvCorrPion : public AliAnaConvCorrBase {\r
-\r
-public:\r
-\r
- AliAnaConvCorrPion(); \r
- AliAnaConvCorrPion(TString name, TString title);\r
- virtual ~AliAnaConvCorrPion();\r
-\r
- TAxis& GetAxisM() { return fAxisM; }\r
- void CreateHistograms();\r
- void FillTriggerCounters(const AliAODConversionParticle * particle);\r
- \r
- private:\r
-\r
- void InitMassAxis();\r
- TH2D * hTriggerPtvsMass; //Histograms containing number of triggers in various bins\r
- TAxis fAxisM; //Mass axis\r
-\r
- AliAnaConvCorrPion(const AliAnaConvCorrPion&); // not implemented\r
- AliAnaConvCorrPion& operator=(const AliAnaConvCorrPion&); // not implemented\r
- ClassDef(AliAnaConvCorrPion, 3); //\r
-\r
-};\r
-\r
-#endif\r
+/* This file is property of and copyright *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/// @file AliAnaConvCorrPion.h
+/// @author Svein Lindal
+/// @brief Class used to find correlations between pions and charged tracks
+
+
+#ifndef ALIANACONVCORRPION_CXX
+#define ALIANACONVCORRPION_CXX
+
+#include "AliAnaConvCorrBase.h"
+class TH2D;
+//#include "THnSparse.h"
+
+//class AliAODConversionPhoton;
+class TClonesArray;
+
+class AliAnaConvCorrPion : public AliAnaConvCorrBase {
+
+public:
+
+ AliAnaConvCorrPion();
+ AliAnaConvCorrPion(TString name, TString title);
+ virtual ~AliAnaConvCorrPion();
+
+ TAxis& GetAxisM() { return fAxisM; }
+ void CreateHistograms();
+ void FillTriggerCounters(const AliAODConversionParticle * particle);
+
+ private:
+
+ void InitMassAxis();
+ TH2D * hTriggerPtvsMass; //Histograms containing number of triggers in various bins
+ TAxis fAxisM; //Mass axis
+
+ AliAnaConvCorrPion(const AliAnaConvCorrPion&); // not implemented
+ AliAnaConvCorrPion& operator=(const AliAnaConvCorrPion&); // not implemented
+ ClassDef(AliAnaConvCorrPion, 3); //
+
+};
+
+#endif
-\r
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Authors: Svein Lindal, Daniel Lohner *\r
- * Version 1.0 *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-////////////////////////////////////////////////\r
-//--------------------------------------------- \r
-// Class handling all kinds of selection cuts for\r
-// Gamma Conversion analysis\r
-//---------------------------------------------\r
-////////////////////////////////////////////////\r
-\r
-\r
-#include "AliDalitzElectronCuts.h"\r
-#include "AliAODConversionPhoton.h"\r
-#include "AliKFVertex.h"\r
-#include "AliAODTrack.h"\r
-#include "AliESDtrack.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliInputEventHandler.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliAODHandler.h"\r
-#include "AliPIDResponse.h"\r
-#include "TH1.h"\r
-#include "TH2.h"\r
-#include "AliStack.h"\r
-#include "TObjString.h"\r
-#include "AliAODEvent.h"\r
-#include "AliESDEvent.h"\r
-#include "TList.h"\r
-class iostream;\r
-\r
-using namespace std;\r
-\r
-ClassImp(AliDalitzElectronCuts)\r
-\r
-\r
-const char* AliDalitzElectronCuts::fgkCutNames[AliDalitzElectronCuts::kNCuts] = {\r
-"GoodId",\r
-"ededxSigmaITSCut",\r
-"ededxSigmaTPCCut",\r
-"pidedxSigmaTPCCut",\r
-"piMinMomdedxSigmaTPCCut",\r
-"piMaxMomdedxSigmaTPCCut",\r
-"LowPRejectionSigmaCut",\r
-"kTOFelectronPID",\r
-"clsITSCut",\r
-"clsTPCCut",\r
-"EtaCut",\r
-"PsiPair",\r
-"RejectSharedElecGamma",\r
-"BackgroundScheme",\r
-"NumberOfRotations",\r
-"PtCut",\r
-"DCAcut",\r
-"MassCut",\r
-"kWeights"\r
-};\r
-\r
-//________________________________________________________________________\r
-AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title) : AliAnalysisCuts(name,title),\r
- fHistograms(NULL),\r
- fPIDResponse(NULL),\r
- fesdTrackCuts(NULL),\r
- fEtaCut(0.9),\r
- fEtaShift(0.0),\r
- fDoEtaCut(kFALSE),\r
- fPtCut(0.0),\r
- fRadiusCut(1000.0),\r
- fPsiPairCut(0.45),\r
- fDeltaPhiCutMin(0.),\r
- fDeltaPhiCutMax(0.12),\r
- fMinClsTPC(0), // minimum clusters in the TPC\r
- fMinClsTPCToF(0), // minimum clusters to findable clusters\r
- fDodEdxSigmaITSCut(kFALSE),\r
- fDodEdxSigmaTPCCut(kTRUE),\r
- fDoTOFsigmaCut(kFALSE), // RRnewTOF\r
- fDoRejectSharedElecGamma(kFALSE),\r
- fDoPsiPairCut(kFALSE),\r
- fPIDnSigmaAboveElectronLineITS(100),\r
- fPIDnSigmaBelowElectronLineITS(-100),\r
- fPIDnSigmaAboveElectronLineTPC(100),\r
- fPIDnSigmaBelowElectronLineTPC(-100),\r
- fPIDnSigmaAbovePionLineTPC(0),\r
- fPIDnSigmaAbovePionLineTPCHighPt(-100),\r
- fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF\r
- fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF\r
- fPIDMinPnSigmaAbovePionLineTPC(0),\r
- fPIDMaxPnSigmaAbovePionLineTPC(0),\r
- fDoKaonRejectionLowP(kFALSE),\r
- fDoProtonRejectionLowP(kFALSE),\r
- fDoPionRejectionLowP(kFALSE),\r
- fPIDnSigmaAtLowPAroundKaonLine(0),\r
- fPIDnSigmaAtLowPAroundProtonLine(0),\r
- fPIDnSigmaAtLowPAroundPionLine(0),\r
- fPIDMinPKaonRejectionLowP(1.5),\r
- fPIDMinPProtonRejectionLowP(2.0),\r
- fPIDMinPPionRejectionLowP(0.5),\r
- fUseCorrectedTPCClsInfo(kFALSE),\r
- fUseTOFpid(kFALSE),\r
- fRequireTOF(kFALSE),\r
- fUseTrackMultiplicityForBG(kFALSE),\r
- fBKGMethod(0),\r
- fnumberOfRotationEventsForBG(0),\r
- fDoMassCut(kFALSE),\r
- fMassCutLowPt(999.),\r
- fMassCutHighPt(999.),\r
- fMassCutPtMin(-100.0),\r
- fDoWeights(kFALSE),\r
- fCutString(NULL),\r
- hCutIndex(NULL),\r
- hdEdxCuts(NULL),\r
- hITSdEdxbefore(NULL),\r
- hITSdEdxafter(NULL),\r
- hTPCdEdxbefore(NULL),\r
- hTPCdEdxafter(NULL),\r
- hTPCdEdxSignalbefore(NULL),\r
- hTPCdEdxSignalafter(NULL),\r
- hTOFbefore(NULL),\r
- hTOFafter(NULL),\r
- hTrackDCAxyPtbefore(NULL),\r
- hTrackDCAxyPtafter(NULL),\r
- hTrackDCAzPtbefore(NULL),\r
- hTrackDCAzPtafter(NULL),\r
- hTrackNFindClsPtTPCbefore(NULL),\r
- hTrackNFindClsPtTPCafter(NULL)\r
- {\r
- InitPIDResponse();\r
- for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}\r
- fCutString=new TObjString((GetCutNumber()).Data());\r
-\r
- //fesdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");\r
- // Using standard function for setting Cuts\r
- Bool_t selectPrimaries=kFALSE;\r
- fesdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);\r
-}\r
-\r
-//________________________________________________________________________\r
-AliDalitzElectronCuts::~AliDalitzElectronCuts() {\r
- // Destructor\r
- //Deleting fHistograms leads to seg fault it it's added to output collection of a task\r
- // if(fHistograms)\r
- // delete fHistograms;\r
- // fHistograms = NULL;\r
-\r
- if(fCutString != NULL){\r
- delete fCutString;\r
- fCutString = NULL;\r
- }\r
-\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliDalitzElectronCuts::InitCutHistograms(TString name, Bool_t preCut,TString cutNumber){\r
-\r
- // Initialize Cut Histograms for QA (only initialized and filled if function is called)\r
-\r
- TString cutName = "";\r
- \r
- if( cutNumber==""){\r
- cutName = GetCutNumber().Data();\r
- }\r
- else {\r
- cutName = cutNumber.Data();\r
- } \r
-\r
- if(fHistograms != NULL){\r
- delete fHistograms;\r
- fHistograms=NULL;\r
- }\r
- if(fHistograms==NULL){\r
- fHistograms=new TList();\r
- if(name=="")fHistograms->SetName(Form("ElectronCuts_%s",cutName.Data()));\r
- else fHistograms->SetName(Form("%s_%s",name.Data(),cutName.Data()));\r
- }\r
-\r
-\r
- hCutIndex=new TH1F(Form("IsElectronSelected %s",cutName.Data()),"IsElectronSelected",10,-0.5,9.5);\r
- hCutIndex->GetXaxis()->SetBinLabel(kElectronIn+1,"in");\r
- hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");\r
- hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");\r
- hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");\r
- hCutIndex->GetXaxis()->SetBinLabel(kElectronOut+1,"out");\r
- fHistograms->Add(hCutIndex);\r
-\r
-\r
-\r
- // dEdx Cuts\r
- hdEdxCuts=new TH1F(Form("dEdxCuts %s",cutName.Data()),"dEdxCuts",10,-0.5,9.5);\r
- hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(2,"ITSelectron");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCelectron");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpion");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCpionhighp");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCkaonlowprej");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCprotonlowprej");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(8,"TPCpionlowprej");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(9,"TOFelectron");\r
- hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");\r
- fHistograms->Add(hdEdxCuts);\r
- \r
-\r
-\r
- TAxis *AxisBeforeITS = NULL;\r
- TAxis *AxisBeforedEdx = NULL;\r
- TAxis *AxisBeforeTOF = NULL;\r
- TAxis *AxisBeforedEdxSignal = NULL;\r
-\r
- if(preCut){\r
-\r
-\r
- hITSdEdxbefore=new TH2F(Form("Electron_ITS_before %s",cutName.Data()),"ITS dEdx electron before" ,150,0.05,20,400,-10,10);\r
- fHistograms->Add(hITSdEdxbefore);\r
- AxisBeforeITS = hITSdEdxbefore->GetXaxis();\r
-\r
- hTPCdEdxbefore=new TH2F(Form("Electron_dEdx_before %s",cutName.Data()),"dEdx electron before" ,150,0.05,20,400,-10,10);\r
- fHistograms->Add(hTPCdEdxbefore);\r
- AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();\r
-\r
- hTPCdEdxSignalbefore=new TH2F(Form("Electron_dEdxSignal_before %s",cutName.Data()),"dEdx electron signal before" ,150,0.05,20.0,800,0.0,200);\r
- fHistograms->Add(hTPCdEdxSignalbefore);\r
- AxisBeforedEdxSignal = hTPCdEdxSignalbefore->GetXaxis();\r
-\r
- hTOFbefore=new TH2F(Form("Electron_TOF_before %s",cutName.Data()),"TOF electron before" ,150,0.05,20,400,-6,10);\r
- fHistograms->Add(hTOFbefore);\r
- AxisBeforeTOF = hTOFbefore->GetXaxis();\r
- \r
- hTrackDCAxyPtbefore = new TH2F(Form("hTrack_DCAxy_Pt_before %s",cutName.Data()),"DCAxy Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);\r
- fHistograms->Add(hTrackDCAxyPtbefore); \r
- \r
- hTrackDCAzPtbefore = new TH2F(Form("hTrack_DCAz_Pt_before %s",cutName.Data()), "DCAz Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);\r
- fHistograms->Add(hTrackDCAzPtbefore); \r
- \r
- hTrackNFindClsPtTPCbefore = new TH2F(Form("hTrack_NFindCls_Pt_TPC_before %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt before",100,0,1,400,0.,10.);\r
- fHistograms->Add(hTrackNFindClsPtTPCbefore); \r
- \r
- \r
-\r
- }\r
-\r
-\r
- hITSdEdxafter=new TH2F(Form("Electron_ITS_after %s",cutName.Data()),"ITS dEdx electron after" ,150,0.05,20,400, -10,10);\r
- fHistograms->Add(hITSdEdxafter);\r
-\r
- hTPCdEdxafter=new TH2F(Form("Electron_dEdx_after %s",cutName.Data()),"dEdx electron after" ,150,0.05,20,400, -10,10);\r
- fHistograms->Add(hTPCdEdxafter);\r
-\r
- hTPCdEdxSignalafter=new TH2F(Form("Electron_dEdxSignal_after %s",cutName.Data()),"dEdx electron signal after" ,150,0.05,20.0,800,0.0,200);\r
- fHistograms->Add(hTPCdEdxSignalafter);\r
-\r
- hTOFafter=new TH2F(Form("Electron_TOF_after %s",cutName.Data()),"TOF electron after" ,150,0.05,20,400,-6,10);\r
- fHistograms->Add(hTOFafter);\r
- \r
- hTrackDCAxyPtafter = new TH2F(Form("hTrack_DCAxy_Pt_after %s",cutName.Data()),"DCAxy Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);\r
- fHistograms->Add(hTrackDCAxyPtafter); \r
- \r
- hTrackDCAzPtafter = new TH2F(Form("hTrack_DCAz_Pt_after %s",cutName.Data()), "DCAz Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);\r
- fHistograms->Add(hTrackDCAzPtafter); \r
- \r
- hTrackNFindClsPtTPCafter = new TH2F(Form("hTrack_NFindCls_Pt_TPC_after %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt after",100,0,1,400,0.,10.);\r
- fHistograms->Add(hTrackNFindClsPtTPCafter); \r
- \r
- \r
-\r
- TAxis *AxisAfter = hTPCdEdxafter->GetXaxis(); \r
- Int_t bins = AxisAfter->GetNbins();\r
- Double_t from = AxisAfter->GetXmin();\r
- Double_t to = AxisAfter->GetXmax();\r
- Double_t *newBins = new Double_t[bins+1];\r
- newBins[0] = from;\r
- Double_t factor = TMath::Power(to/from, 1./bins);\r
- for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];\r
- AxisAfter->Set(bins, newBins);\r
- AxisAfter = hTOFafter->GetXaxis(); \r
- AxisAfter->Set(bins, newBins);\r
- AxisAfter = hITSdEdxafter->GetXaxis();\r
- AxisAfter->Set(bins,newBins); \r
- AxisAfter = hTPCdEdxSignalafter->GetXaxis();\r
- AxisAfter->Set(bins,newBins);\r
- \r
- if(preCut){\r
- AxisBeforeITS->Set(bins, newBins);\r
- AxisBeforedEdx->Set(bins, newBins);\r
- AxisBeforedEdxSignal->Set(bins,newBins);\r
- AxisBeforeTOF->Set(bins, newBins);\r
- \r
- }\r
- delete [] newBins;\r
-\r
- \r
- // Event Cuts and Info\r
-}\r
-\r
-\r
-//________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::InitPIDResponse(){\r
-\r
-// Set Pointer to AliPIDResponse\r
-\r
- AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
-\r
- if(man) {\r
-\r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());\r
- fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();\r
- if(fPIDResponse)return kTRUE;\r
-\r
- }\r
-\r
- return kFALSE;\r
-}\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::ElectronIsSelectedMC(Int_t labelParticle,AliStack *fMCStack)\r
-{ \r
- if( labelParticle < 0 || labelParticle >= fMCStack->GetNtrack() ) return kFALSE;\r
- if( fMCStack->IsPhysicalPrimary(labelParticle) == kFALSE ) return kFALSE; //Ask Ana\r
-\r
- TParticle* particle = fMCStack->Particle(labelParticle);\r
-\r
- if( TMath::Abs( particle->GetPdgCode() ) != 11 ) return kFALSE;\r
- \r
- if( fDoEtaCut ){\r
- if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )\r
- return kFALSE;\r
- }\r
- \r
-\r
-return kTRUE;\r
-}\r
-\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::ElectronIsSelected(AliESDtrack* lTrack)\r
-{\r
- //Selection of Reconstructed electrons\r
- \r
- \r
- Float_t b[2];\r
- Float_t bCov[3];\r
- lTrack->GetImpactParameters(b,bCov);\r
- \r
- if (bCov[0]<=0 || bCov[2]<=0) {\r
- AliDebug(1, "Estimated b resolution lower or equal zero!");\r
- bCov[0]=0; bCov[2]=0;\r
- }\r
- \r
- \r
-\r
- Float_t dcaToVertexXY = b[0];\r
- Float_t dcaToVertexZ = b[1];\r
- Double_t clsToF = GetNFindableClustersTPC(lTrack);\r
- \r
- if( hTrackDCAxyPtbefore) hTrackDCAxyPtbefore->Fill(dcaToVertexXY,lTrack->Pt());\r
- if( hTrackDCAzPtbefore ) hTrackDCAzPtbefore->Fill( dcaToVertexZ, lTrack->Pt());\r
- if( hTrackNFindClsPtTPCbefore ) hTrackNFindClsPtTPCbefore->Fill( clsToF, lTrack->Pt());\r
- \r
- \r
-\r
- if(hCutIndex)hCutIndex->Fill(kElectronIn);\r
-\r
- if (lTrack == NULL){\r
- if(hCutIndex)hCutIndex->Fill(kNoTracks);\r
- return kFALSE; \r
- } \r
- \r
- if ( ! lTrack->GetConstrainedParam() ){\r
- return kFALSE;\r
- }\r
- AliVTrack * track = dynamic_cast<AliVTrack*>(lTrack);\r
-\r
-\r
- // Track Cuts\r
- if( !TrackIsSelected(lTrack) ){\r
- if(hCutIndex)hCutIndex->Fill(kTrackCuts);\r
- return kFALSE;\r
- }\r
-\r
-\r
- // dEdx Cuts\r
- if( ! dEdxCuts( track ) ) {\r
- if(hCutIndex)hCutIndex->Fill(kdEdxCuts);\r
- return kFALSE;\r
-\r
- }\r
-\r
- //Electron passed the cuts\r
- if(hCutIndex)hCutIndex->Fill(kElectronOut);\r
- \r
- if( hTrackDCAxyPtafter) hTrackDCAxyPtafter->Fill(dcaToVertexXY,lTrack->Pt());\r
- if( hTrackDCAzPtafter ) hTrackDCAzPtafter->Fill(dcaToVertexZ,lTrack->Pt());\r
- if( hTrackNFindClsPtTPCafter ) hTrackNFindClsPtTPCafter->Fill( clsToF, lTrack->Pt());\r
-\r
-\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::TrackIsSelected(AliESDtrack* lTrack) {\r
- // Track Selection for Photon Reconstruction\r
- \r
- \r
- Double_t clsToF = GetNFindableClustersTPC(lTrack);\r
- \r
-\r
- if( ! fesdTrackCuts->AcceptTrack(lTrack) ){\r
-\r
- return kFALSE;\r
- }\r
- \r
- if( fDoEtaCut ) {\r
- if( lTrack->Eta() > (fEtaCut + fEtaShift) || lTrack->Eta() < (-fEtaCut + fEtaShift) ) {\r
- return kFALSE;\r
- }\r
- }\r
- \r
- \r
- if( lTrack->Pt() < fPtCut ) {\r
- \r
- return kFALSE;\r
- \r
- }\r
-\r
- \r
-\r
- if( clsToF < fMinClsTPCToF){\r
- return kFALSE;\r
- }\r
-\r
- \r
-\r
- return kTRUE;\r
-}\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::dEdxCuts(AliVTrack *fCurrentTrack){\r
-\r
- // Electron Identification Cuts for Photon reconstruction\r
-\r
- if(!fPIDResponse){ InitPIDResponse(); }// Try to reinitialize PID Response\r
- if(!fPIDResponse){ AliError("No PID Response"); return kFALSE;}// if still missing fatal error\r
-\r
-\r
-\r
- //cout<<"dEdxCuts: //////////////////////////////////////////////////////////////////////////"<<endl;\r
-\r
-\r
-\r
- Int_t cutIndex=0;\r
-\r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- if(hITSdEdxbefore)hITSdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron));\r
- if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));\r
- if(hTPCdEdxSignalbefore)hTPCdEdxSignalbefore->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));\r
-\r
-\r
- cutIndex++;\r
-\r
-\r
- if( fDodEdxSigmaITSCut == kTRUE ){\r
-\r
-\r
- if( fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLineITS ||\r
- fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kElectron)> fPIDnSigmaAboveElectronLineITS ){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- \r
- }\r
- \r
- if(hITSdEdxafter)hITSdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron));\r
- \r
- \r
- cutIndex++;\r
- \r
- \r
- if(fDodEdxSigmaTPCCut == kTRUE){\r
- \r
- \r
- // TPC Electron Line\r
- if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLineTPC ||\r
- fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLineTPC){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- cutIndex++;\r
- \r
- // TPC Pion Line\r
- if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLineTPC && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLineTPC ){\r
- if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLineTPC &&\r
- fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLineTPC &&\r
- fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineTPC){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- }\r
- cutIndex++;\r
- \r
- // High Pt Pion rej\r
- if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLineTPC ){\r
- if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLineTPC &&\r
- fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLineTPC&&\r
- fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineTPCHighPt){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- }\r
- \r
- cutIndex++;\r
- }\r
-\r
- else{ cutIndex+=3; }\r
-\r
-\r
- if( fDoKaonRejectionLowP == kTRUE ){\r
-\r
- if( fCurrentTrack->P() < fPIDMinPKaonRejectionLowP ){\r
- \r
- if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- \r
- return kFALSE;\r
- }\r
- }\r
- }\r
- cutIndex++;\r
- \r
- if( fDoProtonRejectionLowP == kTRUE ){\r
- \r
- if( fCurrentTrack->P() < fPIDMinPProtonRejectionLowP ){\r
- if( TMath::Abs( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- }\r
- }\r
- cutIndex++;\r
- \r
- if(fDoPionRejectionLowP == kTRUE){\r
- if( fCurrentTrack->P() < fPIDMinPPionRejectionLowP ){\r
- if( TMath::Abs( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)) < fPIDnSigmaAtLowPAroundPionLine ){\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- }\r
- }\r
- cutIndex++;\r
- \r
- \r
- if( ( fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid ) && ( !( fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch) ) ){\r
- if(hTOFbefore) hTOFbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));\r
- if(fUseTOFpid){\r
- if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||\r
- fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){\r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- }\r
- if(hTOFafter)hTOFafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));\r
- }\r
- else if ( fRequireTOF == kTRUE ) {\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- return kFALSE;\r
- }\r
- cutIndex++;\r
- \r
- if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);\r
- if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));\r
- if(hTPCdEdxSignalafter)hTPCdEdxSignalafter->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));\r
- \r
- return kTRUE;\r
-}\r
-///________________________________________________________________________\r
-\r
-\r
-AliVTrack *AliDalitzElectronCuts::GetTrack(AliVEvent * event, Int_t label){\r
- //Returns pointer to the track with given ESD label\r
- //(Important for AOD implementation, since Track array in AOD data is different\r
- //from ESD array, but ESD tracklabels are stored in AOD Tracks)\r
-\r
- AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);\r
- if(esdEvent) {\r
- if(label > event->GetNumberOfTracks() ) return NULL;\r
- AliESDtrack * track = esdEvent->GetTrack(label);\r
- return track;\r
- \r
- } else { \r
- for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {\r
- AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));\r
- \r
- if(track) { \r
- if(track->GetID() == label) {\r
- return track;\r
- }\r
- }\r
- }\r
- }\r
- \r
- cout << "track not found " << label << " " << event->GetNumberOfTracks() << endl;\r
- return NULL;\r
-}\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::RejectSharedElecGamma(TList *photons, Int_t indexEle){\r
-\r
-\r
- for(Int_t i = 0;i<photons->GetEntries();i++){\r
-\r
- AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);\r
-\r
- Int_t posLabel = photonComp->GetTrackLabelPositive();\r
- Int_t negLabel = photonComp->GetTrackLabelNegative();\r
-\r
- if( (photonComp->GetConversionRadius() < fRadiusCut) && (posLabel == indexEle || negLabel == indexEle) ){\r
- return kFALSE;\r
- }\r
- }\r
-\r
- return kTRUE;\r
-}\r
-Bool_t AliDalitzElectronCuts::MassCut(Double_t pi0CandidatePt , Double_t vphotonCandidateMass){\r
- \r
- if( pi0CandidatePt < fMassCutPtMin ){\r
- \r
- if( vphotonCandidateMass < fMassCutLowPt ){\r
- return kTRUE;\r
- }\r
- \r
- }\r
- else{\r
- \r
- if( vphotonCandidateMass < fMassCutHighPt ){\r
- return kTRUE;\r
- }\r
- \r
- }\r
- \r
- return kFALSE;\r
- \r
-}\r
-\r
-Double_t AliDalitzElectronCuts::GetNFindableClustersTPC(AliESDtrack* lTrack){\r
- \r
- \r
- Double_t clsToF=0;\r
-\r
-\r
- if ( !fUseCorrectedTPCClsInfo ){\r
- if(lTrack->GetTPCNclsF()!=0){\r
-\r
- clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();\r
- }// Ncluster/Nfindablecluster\r
- }\r
- else {\r
-\r
- //clsToF = lTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));\r
- clsToF = lTrack->GetTPCClusterInfo(2,0); //NOTE ask friederike\r
- \r
- }\r
- \r
- return clsToF;\r
- \r
-}\r
-\r
-/*\r
-Double_t AliDalitzElectronCuts::GetPsiPair( const AliESDtrack *trackPos, const AliESDtrack *trackNeg )\r
-{\r
-//\r
-// This angle is a measure for the contribution of the opening in polar\r
-// direction ??0 to the opening angle ?? Pair\r
-//\r
-// Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC\r
-// Master Thesis. Thorsten Dahms. 2005\r
-// https://twiki.cern.ch/twiki/pub/ALICE/GammaPhysicsPublications/tdahms_thesis.pdf\r
-//\r
- Double_t momPos[3];\r
- Double_t momNeg[3];\r
- if( trackPos->GetConstrainedPxPyPz(momPos) == 0 ) trackPos->GetPxPyPz( momPos );\r
- if( trackNeg->GetConstrainedPxPyPz(momNeg) == 0 ) trackNeg->GetPxPyPz( momNeg );\r
-\r
- TVector3 posDaughter;\r
- TVector3 negDaughter;\r
-\r
- posDaughter.SetXYZ( momPos[0], momPos[1], momPos[2] );\r
- negDaughter.SetXYZ( momNeg[0], momNeg[1], momNeg[2] );\r
-\r
- Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();\r
- Double_t openingAngle = posDaughter.Angle( negDaughter ); //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );\r
-\r
- if( openingAngle < 1e-20 ) return 0.;\r
-\r
- Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );\r
-\r
- return psiAngle;\r
-}*/\r
-\r
-Bool_t AliDalitzElectronCuts::IsFromGammaConversion( Double_t psiPair, Double_t deltaPhi )\r
-{\r
-//\r
-// Returns true if it is a gamma conversion according to psi pair value\r
-//\r
- return ( (deltaPhi > fDeltaPhiCutMin && deltaPhi < fDeltaPhiCutMax) &&\r
- TMath::Abs(psiPair) < ( fPsiPairCut - fPsiPairCut/fDeltaPhiCutMax * deltaPhi ) );\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::UpdateCutString(cutIds cutID, Int_t value) {\r
-///Update the cut string (if it has been created yet)\r
-\r
- if(fCutString && fCutString->GetString().Length() == kNCuts) {\r
-// cout << "Updating cut id in spot number " << cutID << " to " << value << endl;\r
- fCutString->SetString(GetCutNumber());\r
- } else {\r
-// cout << "fCutString not yet initialized, will not be updated" << endl;\r
- return kFALSE;\r
- }\r
- // cout << fCutString->GetString().Data() << endl;\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {\r
- // Initialize Cuts from a given Cut string\r
-\r
-// out<<"Set Cut Number: "<<analysisCutSelection.Data()<<endl;\r
- AliInfo(Form("Set ElectronCuts Number: %s",analysisCutSelection.Data()));\r
- \r
- if(analysisCutSelection.Length()!=kNCuts) {\r
- AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));\r
- return kFALSE;\r
- }\r
- if(!analysisCutSelection.IsDigit()){\r
- AliError("Cut selection contains characters");\r
- return kFALSE;\r
- }\r
- \r
- const char *cutSelection = analysisCutSelection.Data();\r
- #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'\r
- for(Int_t ii=0;ii<kNCuts;ii++){\r
- ASSIGNARRAY(ii);\r
- }\r
-\r
- // TestFlag\r
- if(fCuts[0] !=9){\r
- AliError("Analysis Cut Selection does not start with 9");\r
- PrintCuts();\r
- return kFALSE;\r
- }\r
-\r
- // Set Individual Cuts\r
- for(Int_t ii=0;ii<kNCuts;ii++){\r
- if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;\r
- }\r
-\r
- //PrintCuts();\r
-\r
- return kTRUE;\r
-}\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetCut(cutIds cutID, const Int_t value) {\r
- ///Set individual cut ID\r
-\r
- //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;\r
-\r
- switch (cutID) {\r
- case kgoodId:\r
- fCuts[kgoodId] = value;\r
- if(value != 9) {\r
- cout << "Error:: First value of cut string is wrong, aborting!!" << endl;\r
- return kFALSE;\r
- } else {\r
- return kTRUE;\r
- }\r
-\r
- case kededxSigmaITSCut:\r
- if( SetITSdEdxCutElectronLine(value)) { //NOTE SetITSdEdxCutElectronLine: To be implemented \r
- fCuts[kededxSigmaITSCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
-\r
- case kededxSigmaTPCCut:\r
- if( SetTPCdEdxCutElectronLine(value)) { //NOTE SetITSdEdxCutElectronLine: To be implemented \r
- fCuts[kededxSigmaTPCCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kpidedxSigmaTPCCut:\r
- if( SetTPCdEdxCutPionLine(value)) { //NOTE SetITSdEdxCutPionLine: To be implemented\r
- fCuts[kpidedxSigmaTPCCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kpiMinMomdedxSigmaTPCCut:\r
- if( SetMinMomPiondEdxTPCCut(value)) {\r
- fCuts[kpiMinMomdedxSigmaTPCCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kpiMaxMomdedxSigmaTPCCut:\r
- if( SetMaxMomPiondEdxTPCCut(value)) {\r
- fCuts[kpiMaxMomdedxSigmaTPCCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kLowPRejectionSigmaCut:\r
- if( SetLowPRejectionCuts(value) ) {\r
- fCuts[kLowPRejectionSigmaCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- \r
- case kTOFelectronPID:\r
- if( SetTOFElectronPIDCut(value)) {\r
- fCuts[kTOFelectronPID] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- case kclsITSCut:\r
- if( SetITSClusterCut(value) ) {\r
- fCuts[kclsITSCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE; \r
- } else return kFALSE;\r
- case kclsTPCCut:\r
- if( SetTPCClusterCut(value)) {\r
- fCuts[kclsTPCCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case ketaCut:\r
- if( SetEtaCut(value)) {\r
- fCuts[ketaCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- case kptCut: \r
- if( SetPtCut(value)) {\r
- fCuts[kptCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kDCACut:\r
- if( SetDCACut(value)) {\r
- fCuts[kDCACut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- \r
- case kPsiPair:\r
- if( SetPsiPairCut(value)) {\r
- fCuts[kPsiPair] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kRejectSharedElecGamma:\r
- if( SetRejectSharedElecGamma(value)) {\r
- fCuts[kRejectSharedElecGamma] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kBackgroundScheme:\r
- if( SetBackgroundScheme(value)) {\r
- fCuts[kBackgroundScheme] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
-\r
- case kNumberOfRotations:\r
- if( SetNumberOfRotations(value)) {\r
- fCuts[kNumberOfRotations] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- case kmassCut:\r
- if( SetMassCut(value)) {\r
- fCuts[kmassCut] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- case kWeights:\r
- if( SetDoWeights(value)) {\r
- fCuts[kWeights] = value;\r
- UpdateCutString(cutID, value);\r
- return kTRUE;\r
- } else return kFALSE;\r
- \r
- \r
- case kNCuts:\r
- cout << "Error:: Cut id out of range"<< endl;\r
- return kFALSE;\r
- }\r
- \r
- cout << "Error:: Cut id " << cutID << " not recognized "<< endl;\r
- return kFALSE;\r
-\r
- //PrintCuts();\r
- \r
-}\r
-\r
-///________________________________________________________________________\r
-\r
-void AliDalitzElectronCuts::PrintCuts() {\r
- // Print out current Cut Selection\r
- for(Int_t ic = 0; ic < kNCuts; ic++) {\r
- printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);\r
- }\r
-\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetITSdEdxCutElectronLine(Int_t ededxSigmaCut)\r
-{ // Set Cut\r
-\r
- switch(ededxSigmaCut){\r
-\r
- case 0: \r
- fDodEdxSigmaITSCut = kFALSE;\r
- fPIDnSigmaBelowElectronLineITS=-100;\r
- fPIDnSigmaAboveElectronLineITS= 100;\r
- break;\r
- case 1: // -10,10\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-10;\r
- fPIDnSigmaAboveElectronLineITS=10;\r
- break;\r
- case 2: // -6,7\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-6;\r
- fPIDnSigmaAboveElectronLineITS=7;\r
- break;\r
- case 3: // -5,5\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-5;\r
- fPIDnSigmaAboveElectronLineITS=5;\r
- break;\r
- case 4: // -4,5\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-4;\r
- fPIDnSigmaAboveElectronLineITS=5;\r
- break;\r
- case 5: // -3,5\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-3;\r
- fPIDnSigmaAboveElectronLineITS=5;\r
- break;\r
- case 6: // -4,4\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-4;\r
- fPIDnSigmaAboveElectronLineITS=4;\r
- break;\r
- case 7: // -2.5,4\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-2.5;\r
- fPIDnSigmaAboveElectronLineITS=4;\r
- break;\r
- case 8: // -2,3.5\r
- fDodEdxSigmaITSCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineITS=-2;\r
- fPIDnSigmaAboveElectronLineITS=3.5;\r
- break;\r
- default:\r
- cout<<"Warning: ITSdEdxCutElectronLine not defined"<<ededxSigmaCut<<endl;\r
- return kFALSE;\r
- \r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)\r
-{ // Set Cut\r
- switch(ededxSigmaCut){\r
-\r
- case 0: fDodEdxSigmaTPCCut = kFALSE;\r
- fPIDnSigmaBelowElectronLineTPC=-10;\r
- fPIDnSigmaAboveElectronLineTPC=10;\r
- break;\r
- case 1: // -10,10\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-10;\r
- fPIDnSigmaAboveElectronLineTPC=10;\r
- break;\r
- case 2: // -6,7\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-6;\r
- fPIDnSigmaAboveElectronLineTPC=7;\r
- break;\r
- case 3: // -5,5\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-5;\r
- fPIDnSigmaAboveElectronLineTPC=5;\r
- break;\r
- case 4: // -4,5\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-4;\r
- fPIDnSigmaAboveElectronLineTPC=5;\r
- break; \r
- case 5: // -3,5\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-3;\r
- fPIDnSigmaAboveElectronLineTPC=5;\r
- break;\r
- case 6: // -4,4\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-4;\r
- fPIDnSigmaAboveElectronLineTPC=4;\r
- break;\r
- case 7: // -2.5,4\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-2.5;\r
- fPIDnSigmaAboveElectronLineTPC=4;\r
- break;\r
- case 8: // -2,3.5\r
- fDodEdxSigmaTPCCut = kTRUE;\r
- fPIDnSigmaBelowElectronLineTPC=-2;\r
- fPIDnSigmaAboveElectronLineTPC=3.5;\r
- break;\r
- default:\r
- cout<<"Warning: TPCdEdxCutElectronLine not defined"<<ededxSigmaCut<<endl;\r
- return kFALSE;\r
- \r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)\r
-{ // Set Cut\r
-\r
- switch(pidedxSigmaCut){\r
- \r
- case 0: fPIDnSigmaAbovePionLineTPC= 0;\r
- fPIDnSigmaAbovePionLineTPCHighPt=-100;\r
- break;\r
- case 1: // -10\r
- fPIDnSigmaAbovePionLineTPC=3.0; //Update Sep-05-2013 from -10 to 3\r
- fPIDnSigmaAbovePionLineTPCHighPt=-10;\r
- break;\r
- case 2: // 1\r
- fPIDnSigmaAbovePionLineTPC=2; //Update Sep-09-2013 from -1 to 2\r
- fPIDnSigmaAbovePionLineTPCHighPt=-1; //Update Sep-09-2013 from -10 to -1\r
- break;\r
- case 3: // 0\r
- fPIDnSigmaAbovePionLineTPC=2; //Update Sep-09-2013 from 0 to 2\r
- fPIDnSigmaAbovePionLineTPCHighPt=0; //Update Sep-09-2013 from -10 to 0\r
- break;\r
- case 4: // 1\r
- fPIDnSigmaAbovePionLineTPC=1;\r
- fPIDnSigmaAbovePionLineTPCHighPt=-10;\r
- break;\r
- case 5: // 1\r
- fPIDnSigmaAbovePionLineTPC=2.;\r
- fPIDnSigmaAbovePionLineTPCHighPt=-10;\r
- break;\r
- case 6: // 1\r
- fPIDnSigmaAbovePionLineTPC=2.5;\r
- fPIDnSigmaAbovePionLineTPCHighPt=-10;\r
- break;\r
- case 7:\r
- fPIDnSigmaAbovePionLineTPC = 2.0; // We need a bit less tight cut on dE/dx //Updated from 3.0 and -10 to +2.0 , +2.0 \r
- fPIDnSigmaAbovePionLineTPCHighPt = 2.0;\r
- break;\r
- case 8: // 1\r
- fPIDnSigmaAbovePionLineTPC = 1.5; // Updated May-16-2013 from 3.5 and -10 to +1.5, +1\r
- fPIDnSigmaAbovePionLineTPCHighPt = 1.0;\r
- break;\r
- case 9: // 1\r
- fPIDnSigmaAbovePionLineTPC=1.5;\r
- fPIDnSigmaAbovePionLineTPCHighPt=-1.0;\r
- break;\r
- default:\r
- cout<<"Warning: pidedxSigmaCut not defined "<<pidedxSigmaCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetMinMomPiondEdxTPCCut(Int_t piMomdedxSigmaCut)\r
-{ // Set Cut\r
- switch(piMomdedxSigmaCut){\r
- \r
- case 0: fPIDMinPnSigmaAbovePionLineTPC=0.;\r
- break;\r
- case 1: // 50.0 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=50.;\r
- break;\r
- case 2: // 20.0 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=20.;\r
- break;\r
- case 3: // 1.5 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=1.5;\r
- break;\r
- case 4: // 1. GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=1.;\r
- break; \r
- case 5: // 0.5 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=0.5;\r
- break;\r
- case 6: // 0.4 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=0.4;\r
- break; \r
- case 7: // 0.3 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=0.3;\r
- break;\r
- case 8: // 0.25 GeV\r
- fPIDMinPnSigmaAbovePionLineTPC=0.25;\r
- break;\r
- default:\r
- cout<<"Warning: piMomdedxSigmaCut not defined "<<piMomdedxSigmaCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetITSClusterCut(Int_t clsITSCut){\r
-\r
- \r
- if( !fesdTrackCuts ) {\r
-\r
- cout<<"Warning: AliESDtrackCut is not initialized "<<endl;\r
- return kFALSE;\r
- }\r
-\r
- switch(clsITSCut){\r
-\r
- case 0: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);\r
- break;\r
- case 1: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);\r
- break; //1 hit first layer of SPD\r
- case 2: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
- break; //1 hit in any layer of SPD\r
- case 3: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);\r
- fesdTrackCuts->SetMinNClustersITS(4);\r
- // 4 hits in total in the ITS. At least 1 hit in the first layer of SPD \r
- break;\r
- case 4: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
- fesdTrackCuts->SetMinNClustersITS(3);\r
- // 3 hits in total in the ITS. At least 1 hit in any layer of SPD\r
- break;\r
- case 5: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
- fesdTrackCuts->SetMinNClustersITS(4);\r
- // 4 hits in total in the ITS. At least 1 hit in any layer of SPD\r
- break;\r
- case 6: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);\r
- fesdTrackCuts->SetMinNClustersITS(5);\r
- // 5 hits in total in the ITS. At least 1 hit in any layer of SPD\r
- break;\r
- default:\r
- cout<<"Warning: clsITSCut not defined "<<clsITSCut<<endl;\r
- return kFALSE;\r
- }\r
- \r
-return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetTPCClusterCut(Int_t clsTPCCut)\r
-{ // Set Cut\r
- switch(clsTPCCut){\r
- case 0: // 0\r
- fMinClsTPC= 0.;\r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- break;\r
- case 1: // 70\r
- fMinClsTPC= 70.;\r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- break;\r
- case 2: // 80\r
- fMinClsTPC= 80.;\r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- break;\r
- case 3: // 100\r
- fMinClsTPC= 100.;\r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- break;\r
- case 4: // 0% of findable clusters\r
- fMinClsTPC= 70.; \r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- fMinClsTPCToF= 0.0;\r
- fUseCorrectedTPCClsInfo=0;\r
- break;\r
- case 5: // 35% of findable clusters\r
- fMinClsTPC = 70.; \r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- fMinClsTPCToF= 0.35;\r
- fUseCorrectedTPCClsInfo=0;\r
- break;\r
- case 6: // 60% of findable clusters\r
- fMinClsTPC= 70.; \r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- fMinClsTPCToF= 0.6;\r
- fUseCorrectedTPCClsInfo=0;\r
- break;\r
- case 7: // 70% of findable clusters\r
- fMinClsTPC= 70.; \r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- fMinClsTPCToF= 0.7;\r
- fUseCorrectedTPCClsInfo=0;\r
- break;\r
- case 8: fMinClsTPC = 0.; \r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- fMinClsTPCToF= 0.35;\r
- fUseCorrectedTPCClsInfo=0;\r
- break;\r
- case 9: // 35% of findable clusters\r
- fMinClsTPC = 70.; \r
- fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);\r
- fMinClsTPCToF= 0.35;\r
- fUseCorrectedTPCClsInfo=1;\r
- break;\r
- \r
- default:\r
- cout<<"Warning: clsTPCCut not defined "<<clsTPCCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetEtaCut(Int_t etaCut)\r
-{ \r
- // Set eta Cut\r
- switch(etaCut){\r
- case 0: \r
- fEtaCut = 100.;\r
- fDoEtaCut = kFALSE;\r
- break;\r
- case 1: // 1.4\r
- fEtaCut = 1.4;\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 2: // 1.2\r
- fEtaCut = 1.2;\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 3: // 0.9\r
- fEtaCut = 0.9;\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 4: // 0.8\r
- fEtaCut = 0.8;\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 5: // 0.75\r
- fEtaCut = 0.75;\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 6: //0.6\r
- fEtaCut = 0.6; //changed from 0.4 to 0.6 2013.06.10\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 7: //0.5\r
- fEtaCut = 0.5; //changed from 0.3 to 0.5 2013.06.10\r
- fDoEtaCut = kTRUE;\r
- break;\r
- case 8: fEtaCut = 0.4;\r
- fDoEtaCut = kTRUE;\r
- break;\r
- default:\r
- cout<<"Warning: EtaCut not defined "<<etaCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetPtCut(Int_t ptCut)\r
-{ \r
- // Set Pt Cut\r
- //0.1GeV, 0.125 GeV, 0.15 GeV\r
- \r
- switch(ptCut){\r
- \r
- case 0: fPtCut = 0.075; \r
- break;\r
- case 1: // 0.1\r
- fPtCut = 0.1; \r
- break;\r
- case 2: // 0.125 GeV\r
- fPtCut = 0.125; \r
- break;\r
- case 3: // 0.15 GeV\r
- fPtCut = 0.15;\r
- break;\r
- default:\r
- cout<<"Warning: PtCut not defined "<<ptCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetDCACut(Int_t dcaCut)\r
-{ \r
- // Set DCA Cut\r
- \r
- if( !fesdTrackCuts ) {\r
-\r
- cout<<"Warning: AliESDtrackCut is not initialized "<<endl;\r
- return kFALSE;\r
- }\r
- \r
- switch(dcaCut){\r
- \r
- case 0: \r
- //Open cuts//\r
- fesdTrackCuts->SetMaxDCAToVertexZ(1000);\r
- fesdTrackCuts->SetMaxDCAToVertexXY(1000);\r
- fesdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);\r
- break;\r
- \r
- case 1: \r
- fesdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");\r
- fesdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);\r
- \r
- break;\r
- case 2: fesdTrackCuts->SetMaxDCAToVertexZ(2);\r
- fesdTrackCuts->SetMaxDCAToVertexXY(1);\r
- fesdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);\r
- break; \r
- \r
- default:\r
- cout<<"Warning: dcaCut not defined "<<dcaCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-\r
-\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetMaxMomPiondEdxTPCCut(Int_t piMaxMomdedxSigmaCut)\r
-{ // Set Cut\r
- switch(piMaxMomdedxSigmaCut){\r
-\r
- case 0: \r
- fPIDMaxPnSigmaAbovePionLineTPC=0.;\r
- break;\r
- case 1: // 100. GeV\r
- fPIDMaxPnSigmaAbovePionLineTPC=100.;\r
- break;\r
- case 2: // 5. GeV\r
- fPIDMaxPnSigmaAbovePionLineTPC=5.;\r
- break;\r
- case 3: // 4. GeV\r
- fPIDMaxPnSigmaAbovePionLineTPC=4.;\r
- break;\r
- case 4: // 3.5 GeV\r
- fPIDMaxPnSigmaAbovePionLineTPC=3.5;\r
- break;\r
- case 5: // 3. GeV\r
- fPIDMaxPnSigmaAbovePionLineTPC=3.;\r
- break;\r
- default:\r
- cout<<"Warning: piMaxMomdedxSigmaCut not defined "<<piMaxMomdedxSigmaCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)\r
-{ // Set Cut\r
- switch(LowPRejectionSigmaCut){\r
- case 0: //\r
- fDoKaonRejectionLowP=kFALSE;\r
- fDoProtonRejectionLowP=kFALSE;\r
- fDoPionRejectionLowP=kFALSE;\r
- fPIDnSigmaAtLowPAroundKaonLine=0;\r
- fPIDnSigmaAtLowPAroundProtonLine=0;\r
- fPIDnSigmaAtLowPAroundPionLine=0;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 1: //\r
- fDoKaonRejectionLowP=kTRUE;\r
- fDoProtonRejectionLowP=kTRUE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=0.5;\r
- fPIDnSigmaAtLowPAroundProtonLine=0.5;\r
- fPIDnSigmaAtLowPAroundPionLine=0.5;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 2: //\r
- fDoKaonRejectionLowP=kTRUE;\r
- fDoProtonRejectionLowP=kTRUE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=1.0;\r
- fPIDnSigmaAtLowPAroundProtonLine=1.0;\r
- fPIDnSigmaAtLowPAroundPionLine=1.0;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 3: //\r
- fDoKaonRejectionLowP=kTRUE;\r
- fDoProtonRejectionLowP=kTRUE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=1.5;\r
- fPIDnSigmaAtLowPAroundProtonLine=1.5;\r
- fPIDnSigmaAtLowPAroundPionLine=1.5;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 4: //\r
- fDoKaonRejectionLowP=kTRUE;\r
- fDoProtonRejectionLowP=kTRUE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=2.0;\r
- fPIDnSigmaAtLowPAroundProtonLine=2.0;\r
- fPIDnSigmaAtLowPAroundPionLine=2.0;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 5: //\r
- fDoKaonRejectionLowP=kTRUE;\r
- fDoProtonRejectionLowP=kTRUE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=2.0;\r
- fPIDnSigmaAtLowPAroundProtonLine=2.0;\r
- fPIDnSigmaAtLowPAroundPionLine=2.5;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 6: //\r
- fDoKaonRejectionLowP=kTRUE;\r
- fDoProtonRejectionLowP=kTRUE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=0.;\r
- fPIDnSigmaAtLowPAroundProtonLine=0.;\r
- fPIDnSigmaAtLowPAroundPionLine=2.;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 7: //\r
- fDoKaonRejectionLowP=kFALSE;\r
- fDoProtonRejectionLowP=kFALSE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=0.0;\r
- fPIDnSigmaAtLowPAroundProtonLine=0.0;\r
- fPIDnSigmaAtLowPAroundPionLine=1.0;\r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break;\r
- case 8:\r
- fDoKaonRejectionLowP=kFALSE;\r
- fDoProtonRejectionLowP=kFALSE;\r
- fDoPionRejectionLowP=kTRUE;\r
- fPIDnSigmaAtLowPAroundKaonLine=0.;\r
- fPIDnSigmaAtLowPAroundProtonLine=0.;\r
- fPIDnSigmaAtLowPAroundPionLine=0.5; \r
- fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;\r
- break; \r
- default:\r
- cout<<"Warning: LowPRejectionSigmaCut not defined "<<LowPRejectionSigmaCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){\r
- // Set Cut\r
- switch(TOFelectronPID){ // RRnewTOF start //////////////////////////////////////////////////////////////////////////\r
- case 0: // no cut\r
- fRequireTOF = kFALSE;\r
- fUseTOFpid = kFALSE;\r
- fTofPIDnSigmaBelowElectronLine=-100;\r
- fTofPIDnSigmaAboveElectronLine=100;\r
- break;\r
- case 1: // -7,7\r
- fRequireTOF = kFALSE;\r
- fUseTOFpid = kTRUE;\r
- fTofPIDnSigmaBelowElectronLine=-7;\r
- fTofPIDnSigmaAboveElectronLine=7;\r
- break;\r
- case 2: // -5,5\r
- fRequireTOF = kFALSE;\r
- fUseTOFpid = kTRUE;\r
- fTofPIDnSigmaBelowElectronLine=-5;\r
- fTofPIDnSigmaAboveElectronLine=5;\r
- break;\r
- case 3: // -3,5\r
- fRequireTOF = kFALSE;\r
- fUseTOFpid = kTRUE;\r
- fTofPIDnSigmaBelowElectronLine=-3;\r
- fTofPIDnSigmaAboveElectronLine=5;\r
- break;\r
- case 4: // -2,3\r
- fRequireTOF = kFALSE;\r
- fUseTOFpid = kTRUE;\r
- fTofPIDnSigmaBelowElectronLine=-2;\r
- fTofPIDnSigmaAboveElectronLine=3;\r
- break;\r
- case 5: // -3, 3 TOF mandatory\r
- fRequireTOF = kTRUE;\r
- fUseTOFpid = kTRUE;\r
- fTofPIDnSigmaBelowElectronLine= -3;\r
- fTofPIDnSigmaAboveElectronLine= 3;\r
- break;\r
- default:\r
- cout<<"Warning: TOFElectronCut not defined "<<TOFelectronPID<<endl;\r
- return kFALSE;\r
- } //////////////////////// RRnewTOF end //////////////////////////////////////////////////////////////////////////\r
- return kTRUE;\r
-}\r
-///_______________________________________________________________________________\r
-\r
-Bool_t AliDalitzElectronCuts::SetPsiPairCut(Int_t psiCut) {\r
- \r
-\r
- switch(psiCut) {\r
- case 0:\r
- fDoPsiPairCut = kFALSE;\r
- fPsiPairCut = 10000.; //\r
- fDeltaPhiCutMin = -1000.;\r
- fDeltaPhiCutMax = 1000.;\r
- \r
- break;\r
- case 1:\r
- fDoPsiPairCut = kTRUE;\r
- fPsiPairCut = 0.45; // Standard\r
- fDeltaPhiCutMin = 0.0;\r
- fDeltaPhiCutMax = 0.12;\r
- break;\r
- case 2:\r
- fDoPsiPairCut = kTRUE;\r
- fPsiPairCut = 0.60; \r
- fDeltaPhiCutMin = 0.0;\r
- fDeltaPhiCutMax = 0.12;\r
- break;\r
- case 3:\r
- fDoPsiPairCut = kTRUE;\r
- fPsiPairCut = 0.52;\r
- fDeltaPhiCutMin = 0.0;\r
- fDeltaPhiCutMax = 0.12;\r
- break;\r
- case 4:\r
- fDoPsiPairCut = kTRUE;\r
- fPsiPairCut = 0.30;\r
- fDeltaPhiCutMin = 0.0;\r
- fDeltaPhiCutMax = 0.12;\r
- break;\r
- \r
- default:\r
- cout<<"Warning: PsiPairCut not defined "<<fPsiPairCut<<endl;\r
- return kFALSE;\r
- }\r
-\r
- return kTRUE;\r
-}\r
-\r
-///_______________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetRejectSharedElecGamma(Int_t RCut) {\r
- \r
-\r
- switch(RCut) {\r
- case 0:\r
- fDoRejectSharedElecGamma = kFALSE;\r
- fRadiusCut = 10000; // \r
- break;\r
- case 1:\r
- fDoRejectSharedElecGamma = kTRUE;\r
- fRadiusCut = 2.0; // cm \r
- break;\r
- case 2:\r
- fDoRejectSharedElecGamma = kTRUE;\r
- fRadiusCut = 3.0; // Standard\r
- break;\r
- case 3:\r
- fDoRejectSharedElecGamma = kTRUE;\r
- fRadiusCut = 4.0; // \r
- break;\r
- case 4:\r
- fDoRejectSharedElecGamma = kTRUE;\r
- fRadiusCut = 5.0; // \r
- break;\r
- case 5:\r
- fDoRejectSharedElecGamma = kTRUE;\r
- fRadiusCut = 10.0; // \r
- break;\r
- case 6:\r
- fDoRejectSharedElecGamma = kTRUE;\r
- fRadiusCut = 15.0; // \r
- break;\r
- default:\r
- cout<<"Warning: PsiPairCut not defined "<<fDoRejectSharedElecGamma<<endl;\r
- return kFALSE;\r
- }\r
-\r
- return kTRUE;\r
-}\r
-///__________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetBackgroundScheme(Int_t BackgroundScheme){\r
-\r
- // Set Cut\r
- switch(BackgroundScheme){\r
-\r
- case 0: //Rotation\r
- fBKGMethod = 0;\r
- fUseTrackMultiplicityForBG = kFALSE;\r
- break;\r
- case 1: // mixed event with V0 multiplicity\r
- fBKGMethod = 1;\r
- fUseTrackMultiplicityForBG = kFALSE;\r
- break;\r
- case 2: // mixed event with track multiplicity\r
- fUseTrackMultiplicityForBG = kTRUE;\r
- fBKGMethod = 1;\r
- break;\r
- case 3: //Rotation\r
- fUseTrackMultiplicityForBG = kFALSE;\r
- fBKGMethod = 2;\r
- break;\r
- case 4: //Rotation\r
- fUseTrackMultiplicityForBG = kTRUE;\r
- fBKGMethod = 2;\r
- break;\r
- case 5: fUseTrackMultiplicityForBG = kTRUE;\r
- fBKGMethod = 3;\r
- break;\r
-\r
- default:\r
- cout<<"Warning: BackgroundScheme not defined "<<BackgroundScheme<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetNumberOfRotations(Int_t NumberOfRotations)\r
-{ // Set Cut\r
- switch(NumberOfRotations){\r
- case 0:\r
- fnumberOfRotationEventsForBG = 5;\r
- break;\r
- case 1:\r
- fnumberOfRotationEventsForBG = 10;\r
- break;\r
- case 2:\r
- fnumberOfRotationEventsForBG = 15;\r
- break;\r
- case 3:\r
- fnumberOfRotationEventsForBG = 20;\r
- break;\r
- case 4:\r
- fnumberOfRotationEventsForBG = 2;\r
- break;\r
- case 5:\r
- fnumberOfRotationEventsForBG = 50;\r
- break;\r
- case 6:\r
- fnumberOfRotationEventsForBG = 80;\r
- break;\r
- case 7:\r
- fnumberOfRotationEventsForBG = 100;\r
- break;\r
- default:\r
- cout<<"Warning: NumberOfRotations not defined "<<NumberOfRotations<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-\r
-\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetDoWeights(Int_t opc)\r
-{ // Set Cut\r
- switch(opc){\r
- \r
- case 0: fDoWeights = kFALSE;\r
- break;\r
- case 1: fDoWeights = kTRUE;\r
- break; \r
- default:\r
- cout<<"Warning: Weights option not defined "<<opc<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-///________________________________________________________________________\r
-Bool_t AliDalitzElectronCuts::SetMassCut(Int_t massCut)\r
-{ // Set Cut\r
- switch(massCut){\r
- \r
- case 0:\r
- \r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 999.; //GeV/c^2\r
- fMassCutHighPt = 999.; //GeV/c^2\r
- fDoMassCut = kFALSE; \r
- break;\r
- case 1:\r
- //fMassCut = 0.135; //GeV/c^2\r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 0.135; //GeV/c^2\r
- fMassCutHighPt = 0.135; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break; \r
- case 2:\r
- //fMassCut = 0.100; //GeV/c^2\r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 0.100; //GeV/c^2\r
- fMassCutHighPt = 0.100; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break;\r
- case 3:\r
- //fMassCut = 0.075; //GeV/c^2\r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 0.075; //GeV/c^2\r
- fMassCutHighPt = 0.075; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break;\r
- case 4:\r
- //fMassCut = 0.050; //GeV/c^2\r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 0.050; //GeV/c^2\r
- fMassCutHighPt = 0.050; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break;\r
- case 5:\r
- \r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 0.035; //GeV/c^2\r
- fMassCutHighPt = 0.035; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break;\r
- case 6:\r
- fMassCutPtMin = -999.; //GeV\r
- fMassCutLowPt = 0.015; //GeV/c^2\r
- fMassCutHighPt = 0.015; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break;\r
- case 7: fMassCutPtMin = 1.0; //GeV\r
- fMassCutLowPt = 0.015; //GeV/c^2\r
- fMassCutHighPt = 0.035; //GeV/c^2\r
- fDoMassCut = kTRUE;\r
- break;\r
- default:\r
- cout<<"Warning: MassCut not defined "<<massCut<<endl;\r
- return kFALSE;\r
- }\r
- return kTRUE;\r
-}\r
-\r
-\r
-\r
-///________________________________________________________________________\r
-TString AliDalitzElectronCuts::GetCutNumber(){\r
- // returns TString with current cut number\r
- TString a(kNCuts);\r
- for(Int_t ii=0;ii<kNCuts;ii++){\r
- a.Append(Form("%d",fCuts[ii]));\r
- }\r
- return a;\r
-}\r
-\r
-\r
-///________________________________________________________________________\r
-AliDalitzElectronCuts* AliDalitzElectronCuts::GetStandardCuts2010PbPb(){\r
- //Create and return standard 2010 PbPb cuts\r
- AliDalitzElectronCuts *cuts=new AliDalitzElectronCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");\r
- if(!cuts->InitializeCutsFromCutString("9069640364102")){\r
- cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}\r
- return cuts;\r
-}\r
-\r
-///________________________________________________________________________\r
-AliDalitzElectronCuts* AliDalitzElectronCuts::GetStandardCuts2010pp(){\r
- //Create and return standard 2010 PbPb cuts\r
- AliDalitzElectronCuts *cuts=new AliDalitzElectronCuts("StandardCuts2010pp","StandardCuts2010pp");\r
- \r
- if(!cuts->InitializeCutsFromCutString("9069640364102")){\r
- cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}\r
- return cuts;\r
-}\r
-\r
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Authors: Svein Lindal, Daniel Lohner *
+ * Version 1.0 *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+////////////////////////////////////////////////
+//---------------------------------------------
+// Class handling all kinds of selection cuts for
+// Gamma Conversion analysis
+//---------------------------------------------
+////////////////////////////////////////////////
+
+
+#include "AliDalitzElectronCuts.h"
+#include "AliAODConversionPhoton.h"
+#include "AliKFVertex.h"
+#include "AliAODTrack.h"
+#include "AliESDtrack.h"
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+#include "AliMCEventHandler.h"
+#include "AliAODHandler.h"
+#include "AliPIDResponse.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "AliStack.h"
+#include "TObjString.h"
+#include "AliAODEvent.h"
+#include "AliESDEvent.h"
+#include "TList.h"
+class iostream;
+
+using namespace std;
+
+ClassImp(AliDalitzElectronCuts)
+
+
+const char* AliDalitzElectronCuts::fgkCutNames[AliDalitzElectronCuts::kNCuts] = {
+"GoodId",
+"ededxSigmaITSCut",
+"ededxSigmaTPCCut",
+"pidedxSigmaTPCCut",
+"piMinMomdedxSigmaTPCCut",
+"piMaxMomdedxSigmaTPCCut",
+"LowPRejectionSigmaCut",
+"kTOFelectronPID",
+"clsITSCut",
+"clsTPCCut",
+"EtaCut",
+"PsiPair",
+"RejectSharedElecGamma",
+"BackgroundScheme",
+"NumberOfRotations",
+"PtCut",
+"DCAcut",
+"MassCut",
+"kWeights"
+};
+
+//________________________________________________________________________
+AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title) : AliAnalysisCuts(name,title),
+ fHistograms(NULL),
+ fPIDResponse(NULL),
+ fesdTrackCuts(NULL),
+ fEtaCut(0.9),
+ fEtaShift(0.0),
+ fDoEtaCut(kFALSE),
+ fPtCut(0.0),
+ fRadiusCut(1000.0),
+ fPsiPairCut(0.45),
+ fDeltaPhiCutMin(0.),
+ fDeltaPhiCutMax(0.12),
+ fMinClsTPC(0), // minimum clusters in the TPC
+ fMinClsTPCToF(0), // minimum clusters to findable clusters
+ fDodEdxSigmaITSCut(kFALSE),
+ fDodEdxSigmaTPCCut(kTRUE),
+ fDoTOFsigmaCut(kFALSE), // RRnewTOF
+ fDoRejectSharedElecGamma(kFALSE),
+ fDoPsiPairCut(kFALSE),
+ fPIDnSigmaAboveElectronLineITS(100),
+ fPIDnSigmaBelowElectronLineITS(-100),
+ fPIDnSigmaAboveElectronLineTPC(100),
+ fPIDnSigmaBelowElectronLineTPC(-100),
+ fPIDnSigmaAbovePionLineTPC(0),
+ fPIDnSigmaAbovePionLineTPCHighPt(-100),
+ fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF
+ fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF
+ fPIDMinPnSigmaAbovePionLineTPC(0),
+ fPIDMaxPnSigmaAbovePionLineTPC(0),
+ fDoKaonRejectionLowP(kFALSE),
+ fDoProtonRejectionLowP(kFALSE),
+ fDoPionRejectionLowP(kFALSE),
+ fPIDnSigmaAtLowPAroundKaonLine(0),
+ fPIDnSigmaAtLowPAroundProtonLine(0),
+ fPIDnSigmaAtLowPAroundPionLine(0),
+ fPIDMinPKaonRejectionLowP(1.5),
+ fPIDMinPProtonRejectionLowP(2.0),
+ fPIDMinPPionRejectionLowP(0.5),
+ fUseCorrectedTPCClsInfo(kFALSE),
+ fUseTOFpid(kFALSE),
+ fRequireTOF(kFALSE),
+ fUseTrackMultiplicityForBG(kFALSE),
+ fBKGMethod(0),
+ fnumberOfRotationEventsForBG(0),
+ fDoMassCut(kFALSE),
+ fMassCutLowPt(999.),
+ fMassCutHighPt(999.),
+ fMassCutPtMin(-100.0),
+ fDoWeights(kFALSE),
+ fCutString(NULL),
+ hCutIndex(NULL),
+ hdEdxCuts(NULL),
+ hITSdEdxbefore(NULL),
+ hITSdEdxafter(NULL),
+ hTPCdEdxbefore(NULL),
+ hTPCdEdxafter(NULL),
+ hTPCdEdxSignalbefore(NULL),
+ hTPCdEdxSignalafter(NULL),
+ hTOFbefore(NULL),
+ hTOFafter(NULL),
+ hTrackDCAxyPtbefore(NULL),
+ hTrackDCAxyPtafter(NULL),
+ hTrackDCAzPtbefore(NULL),
+ hTrackDCAzPtafter(NULL),
+ hTrackNFindClsPtTPCbefore(NULL),
+ hTrackNFindClsPtTPCafter(NULL)
+ {
+ InitPIDResponse();
+ for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
+ fCutString=new TObjString((GetCutNumber()).Data());
+
+ //fesdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
+ // Using standard function for setting Cuts
+ Bool_t selectPrimaries=kFALSE;
+ fesdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+}
+
+//________________________________________________________________________
+AliDalitzElectronCuts::~AliDalitzElectronCuts() {
+ // Destructor
+ //Deleting fHistograms leads to seg fault it it's added to output collection of a task
+ // if(fHistograms)
+ // delete fHistograms;
+ // fHistograms = NULL;
+
+ if(fCutString != NULL){
+ delete fCutString;
+ fCutString = NULL;
+ }
+
+
+}
+
+//________________________________________________________________________
+void AliDalitzElectronCuts::InitCutHistograms(TString name, Bool_t preCut,TString cutNumber){
+
+ // Initialize Cut Histograms for QA (only initialized and filled if function is called)
+
+ TString cutName = "";
+
+ if( cutNumber==""){
+ cutName = GetCutNumber().Data();
+ }
+ else {
+ cutName = cutNumber.Data();
+ }
+
+ if(fHistograms != NULL){
+ delete fHistograms;
+ fHistograms=NULL;
+ }
+ if(fHistograms==NULL){
+ fHistograms=new TList();
+ if(name=="")fHistograms->SetName(Form("ElectronCuts_%s",cutName.Data()));
+ else fHistograms->SetName(Form("%s_%s",name.Data(),cutName.Data()));
+ }
+
+
+ hCutIndex=new TH1F(Form("IsElectronSelected %s",cutName.Data()),"IsElectronSelected",10,-0.5,9.5);
+ hCutIndex->GetXaxis()->SetBinLabel(kElectronIn+1,"in");
+ hCutIndex->GetXaxis()->SetBinLabel(kNoTracks+1,"no tracks");
+ hCutIndex->GetXaxis()->SetBinLabel(kTrackCuts+1,"Track cuts");
+ hCutIndex->GetXaxis()->SetBinLabel(kdEdxCuts+1,"dEdx");
+ hCutIndex->GetXaxis()->SetBinLabel(kElectronOut+1,"out");
+ fHistograms->Add(hCutIndex);
+
+
+
+ // dEdx Cuts
+ hdEdxCuts=new TH1F(Form("dEdxCuts %s",cutName.Data()),"dEdxCuts",10,-0.5,9.5);
+ hdEdxCuts->GetXaxis()->SetBinLabel(1,"in");
+ hdEdxCuts->GetXaxis()->SetBinLabel(2,"ITSelectron");
+ hdEdxCuts->GetXaxis()->SetBinLabel(3,"TPCelectron");
+ hdEdxCuts->GetXaxis()->SetBinLabel(4,"TPCpion");
+ hdEdxCuts->GetXaxis()->SetBinLabel(5,"TPCpionhighp");
+ hdEdxCuts->GetXaxis()->SetBinLabel(6,"TPCkaonlowprej");
+ hdEdxCuts->GetXaxis()->SetBinLabel(7,"TPCprotonlowprej");
+ hdEdxCuts->GetXaxis()->SetBinLabel(8,"TPCpionlowprej");
+ hdEdxCuts->GetXaxis()->SetBinLabel(9,"TOFelectron");
+ hdEdxCuts->GetXaxis()->SetBinLabel(10,"out");
+ fHistograms->Add(hdEdxCuts);
+
+
+
+ TAxis *AxisBeforeITS = NULL;
+ TAxis *AxisBeforedEdx = NULL;
+ TAxis *AxisBeforeTOF = NULL;
+ TAxis *AxisBeforedEdxSignal = NULL;
+
+ if(preCut){
+
+
+ hITSdEdxbefore=new TH2F(Form("Electron_ITS_before %s",cutName.Data()),"ITS dEdx electron before" ,150,0.05,20,400,-10,10);
+ fHistograms->Add(hITSdEdxbefore);
+ AxisBeforeITS = hITSdEdxbefore->GetXaxis();
+
+ hTPCdEdxbefore=new TH2F(Form("Electron_dEdx_before %s",cutName.Data()),"dEdx electron before" ,150,0.05,20,400,-10,10);
+ fHistograms->Add(hTPCdEdxbefore);
+ AxisBeforedEdx = hTPCdEdxbefore->GetXaxis();
+
+ hTPCdEdxSignalbefore=new TH2F(Form("Electron_dEdxSignal_before %s",cutName.Data()),"dEdx electron signal before" ,150,0.05,20.0,800,0.0,200);
+ fHistograms->Add(hTPCdEdxSignalbefore);
+ AxisBeforedEdxSignal = hTPCdEdxSignalbefore->GetXaxis();
+
+ hTOFbefore=new TH2F(Form("Electron_TOF_before %s",cutName.Data()),"TOF electron before" ,150,0.05,20,400,-6,10);
+ fHistograms->Add(hTOFbefore);
+ AxisBeforeTOF = hTOFbefore->GetXaxis();
+
+ hTrackDCAxyPtbefore = new TH2F(Form("hTrack_DCAxy_Pt_before %s",cutName.Data()),"DCAxy Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);
+ fHistograms->Add(hTrackDCAxyPtbefore);
+
+ hTrackDCAzPtbefore = new TH2F(Form("hTrack_DCAz_Pt_before %s",cutName.Data()), "DCAz Vs Pt of tracks before",800,-4.0,4.0,400,0.,10.);
+ fHistograms->Add(hTrackDCAzPtbefore);
+
+ hTrackNFindClsPtTPCbefore = new TH2F(Form("hTrack_NFindCls_Pt_TPC_before %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt before",100,0,1,400,0.,10.);
+ fHistograms->Add(hTrackNFindClsPtTPCbefore);
+
+
+
+ }
+
+
+ hITSdEdxafter=new TH2F(Form("Electron_ITS_after %s",cutName.Data()),"ITS dEdx electron after" ,150,0.05,20,400, -10,10);
+ fHistograms->Add(hITSdEdxafter);
+
+ hTPCdEdxafter=new TH2F(Form("Electron_dEdx_after %s",cutName.Data()),"dEdx electron after" ,150,0.05,20,400, -10,10);
+ fHistograms->Add(hTPCdEdxafter);
+
+ hTPCdEdxSignalafter=new TH2F(Form("Electron_dEdxSignal_after %s",cutName.Data()),"dEdx electron signal after" ,150,0.05,20.0,800,0.0,200);
+ fHistograms->Add(hTPCdEdxSignalafter);
+
+ hTOFafter=new TH2F(Form("Electron_TOF_after %s",cutName.Data()),"TOF electron after" ,150,0.05,20,400,-6,10);
+ fHistograms->Add(hTOFafter);
+
+ hTrackDCAxyPtafter = new TH2F(Form("hTrack_DCAxy_Pt_after %s",cutName.Data()),"DCAxy Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);
+ fHistograms->Add(hTrackDCAxyPtafter);
+
+ hTrackDCAzPtafter = new TH2F(Form("hTrack_DCAz_Pt_after %s",cutName.Data()), "DCAz Vs Pt of tracks after",800,-4.0,4.0,400,0.,10.);
+ fHistograms->Add(hTrackDCAzPtafter);
+
+ hTrackNFindClsPtTPCafter = new TH2F(Form("hTrack_NFindCls_Pt_TPC_after %s",cutName.Data()),"Track: N Findable Cls TPC Vs Pt after",100,0,1,400,0.,10.);
+ fHistograms->Add(hTrackNFindClsPtTPCafter);
+
+
+
+ TAxis *AxisAfter = hTPCdEdxafter->GetXaxis();
+ Int_t bins = AxisAfter->GetNbins();
+ Double_t from = AxisAfter->GetXmin();
+ Double_t to = AxisAfter->GetXmax();
+ Double_t *newBins = new Double_t[bins+1];
+ newBins[0] = from;
+ Double_t factor = TMath::Power(to/from, 1./bins);
+ for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
+ AxisAfter->Set(bins, newBins);
+ AxisAfter = hTOFafter->GetXaxis();
+ AxisAfter->Set(bins, newBins);
+ AxisAfter = hITSdEdxafter->GetXaxis();
+ AxisAfter->Set(bins,newBins);
+ AxisAfter = hTPCdEdxSignalafter->GetXaxis();
+ AxisAfter->Set(bins,newBins);
+
+ if(preCut){
+ AxisBeforeITS->Set(bins, newBins);
+ AxisBeforedEdx->Set(bins, newBins);
+ AxisBeforedEdxSignal->Set(bins,newBins);
+ AxisBeforeTOF->Set(bins, newBins);
+
+ }
+ delete [] newBins;
+
+
+ // Event Cuts and Info
+}
+
+
+//________________________________________________________________________
+Bool_t AliDalitzElectronCuts::InitPIDResponse(){
+
+// Set Pointer to AliPIDResponse
+
+ AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+
+ if(man) {
+
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+ fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
+ if(fPIDResponse)return kTRUE;
+
+ }
+
+ return kFALSE;
+}
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::ElectronIsSelectedMC(Int_t labelParticle,AliStack *fMCStack)
+{
+ if( labelParticle < 0 || labelParticle >= fMCStack->GetNtrack() ) return kFALSE;
+ if( fMCStack->IsPhysicalPrimary(labelParticle) == kFALSE ) return kFALSE; //Ask Ana
+
+ TParticle* particle = fMCStack->Particle(labelParticle);
+
+ if( TMath::Abs( particle->GetPdgCode() ) != 11 ) return kFALSE;
+
+ if( fDoEtaCut ){
+ if( particle->Eta() > (fEtaCut + fEtaShift) || particle->Eta() < (-fEtaCut + fEtaShift) )
+ return kFALSE;
+ }
+
+
+return kTRUE;
+}
+
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::ElectronIsSelected(AliESDtrack* lTrack)
+{
+ //Selection of Reconstructed electrons
+
+
+ Float_t b[2];
+ Float_t bCov[3];
+ lTrack->GetImpactParameters(b,bCov);
+
+ if (bCov[0]<=0 || bCov[2]<=0) {
+ AliDebug(1, "Estimated b resolution lower or equal zero!");
+ bCov[0]=0; bCov[2]=0;
+ }
+
+
+
+ Float_t dcaToVertexXY = b[0];
+ Float_t dcaToVertexZ = b[1];
+ Double_t clsToF = GetNFindableClustersTPC(lTrack);
+
+ if( hTrackDCAxyPtbefore) hTrackDCAxyPtbefore->Fill(dcaToVertexXY,lTrack->Pt());
+ if( hTrackDCAzPtbefore ) hTrackDCAzPtbefore->Fill( dcaToVertexZ, lTrack->Pt());
+ if( hTrackNFindClsPtTPCbefore ) hTrackNFindClsPtTPCbefore->Fill( clsToF, lTrack->Pt());
+
+
+
+ if(hCutIndex)hCutIndex->Fill(kElectronIn);
+
+ if (lTrack == NULL){
+ if(hCutIndex)hCutIndex->Fill(kNoTracks);
+ return kFALSE;
+ }
+
+ if ( ! lTrack->GetConstrainedParam() ){
+ return kFALSE;
+ }
+ AliVTrack * track = dynamic_cast<AliVTrack*>(lTrack);
+
+
+ // Track Cuts
+ if( !TrackIsSelected(lTrack) ){
+ if(hCutIndex)hCutIndex->Fill(kTrackCuts);
+ return kFALSE;
+ }
+
+
+ // dEdx Cuts
+ if( ! dEdxCuts( track ) ) {
+ if(hCutIndex)hCutIndex->Fill(kdEdxCuts);
+ return kFALSE;
+
+ }
+
+ //Electron passed the cuts
+ if(hCutIndex)hCutIndex->Fill(kElectronOut);
+
+ if( hTrackDCAxyPtafter) hTrackDCAxyPtafter->Fill(dcaToVertexXY,lTrack->Pt());
+ if( hTrackDCAzPtafter ) hTrackDCAzPtafter->Fill(dcaToVertexZ,lTrack->Pt());
+ if( hTrackNFindClsPtTPCafter ) hTrackNFindClsPtTPCafter->Fill( clsToF, lTrack->Pt());
+
+
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::TrackIsSelected(AliESDtrack* lTrack) {
+ // Track Selection for Photon Reconstruction
+
+
+ Double_t clsToF = GetNFindableClustersTPC(lTrack);
+
+
+ if( ! fesdTrackCuts->AcceptTrack(lTrack) ){
+
+ return kFALSE;
+ }
+
+ if( fDoEtaCut ) {
+ if( lTrack->Eta() > (fEtaCut + fEtaShift) || lTrack->Eta() < (-fEtaCut + fEtaShift) ) {
+ return kFALSE;
+ }
+ }
+
+
+ if( lTrack->Pt() < fPtCut ) {
+
+ return kFALSE;
+
+ }
+
+
+
+ if( clsToF < fMinClsTPCToF){
+ return kFALSE;
+ }
+
+
+
+ return kTRUE;
+}
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::dEdxCuts(AliVTrack *fCurrentTrack){
+
+ // Electron Identification Cuts for Photon reconstruction
+
+ if(!fPIDResponse){ InitPIDResponse(); }// Try to reinitialize PID Response
+ if(!fPIDResponse){ AliError("No PID Response"); return kFALSE;}// if still missing fatal error
+
+
+
+ //cout<<"dEdxCuts: //////////////////////////////////////////////////////////////////////////"<<endl;
+
+
+
+ Int_t cutIndex=0;
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ if(hITSdEdxbefore)hITSdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron));
+ if(hTPCdEdxbefore)hTPCdEdxbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
+ if(hTPCdEdxSignalbefore)hTPCdEdxSignalbefore->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));
+
+
+ cutIndex++;
+
+
+ if( fDodEdxSigmaITSCut == kTRUE ){
+
+
+ if( fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLineITS ||
+ fPIDResponse->NumberOfSigmasITS(fCurrentTrack,AliPID::kElectron)> fPIDnSigmaAboveElectronLineITS ){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+
+ }
+
+ if(hITSdEdxafter)hITSdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasITS(fCurrentTrack, AliPID::kElectron));
+
+
+ cutIndex++;
+
+
+ if(fDodEdxSigmaTPCCut == kTRUE){
+
+
+ // TPC Electron Line
+ if( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLineTPC ||
+ fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLineTPC){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ cutIndex++;
+
+ // TPC Pion Line
+ if( fCurrentTrack->P()>fPIDMinPnSigmaAbovePionLineTPC && fCurrentTrack->P()<fPIDMaxPnSigmaAbovePionLineTPC ){
+ if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLineTPC &&
+ fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLineTPC &&
+ fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineTPC){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ }
+ cutIndex++;
+
+ // High Pt Pion rej
+ if( fCurrentTrack->P()>fPIDMaxPnSigmaAbovePionLineTPC ){
+ if(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLineTPC &&
+ fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLineTPC&&
+ fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineTPCHighPt){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ }
+
+ cutIndex++;
+ }
+
+ else{ cutIndex+=3; }
+
+
+ if( fDoKaonRejectionLowP == kTRUE ){
+
+ if( fCurrentTrack->P() < fPIDMinPKaonRejectionLowP ){
+
+ if( TMath::Abs(fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+
+ return kFALSE;
+ }
+ }
+ }
+ cutIndex++;
+
+ if( fDoProtonRejectionLowP == kTRUE ){
+
+ if( fCurrentTrack->P() < fPIDMinPProtonRejectionLowP ){
+ if( TMath::Abs( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ }
+ }
+ cutIndex++;
+
+ if(fDoPionRejectionLowP == kTRUE){
+ if( fCurrentTrack->P() < fPIDMinPPionRejectionLowP ){
+ if( TMath::Abs( fPIDResponse->NumberOfSigmasTPC(fCurrentTrack,AliPID::kPion)) < fPIDnSigmaAtLowPAroundPionLine ){
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ }
+ }
+ cutIndex++;
+
+
+ if( ( fCurrentTrack->GetStatus() & AliESDtrack::kTOFpid ) && ( !( fCurrentTrack->GetStatus() & AliESDtrack::kTOFmismatch) ) ){
+ if(hTOFbefore) hTOFbefore->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
+ if(fUseTOFpid){
+ if(fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)>fTofPIDnSigmaAboveElectronLine ||
+ fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron)<fTofPIDnSigmaBelowElectronLine ){
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ }
+ if(hTOFafter)hTOFafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
+ }
+ else if ( fRequireTOF == kTRUE ) {
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ return kFALSE;
+ }
+ cutIndex++;
+
+ if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+ if(hTPCdEdxafter)hTPCdEdxafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTPC(fCurrentTrack, AliPID::kElectron));
+ if(hTPCdEdxSignalafter)hTPCdEdxSignalafter->Fill(fCurrentTrack->P(),TMath::Abs(fCurrentTrack->GetTPCsignal()));
+
+ return kTRUE;
+}
+///________________________________________________________________________
+
+
+AliVTrack *AliDalitzElectronCuts::GetTrack(AliVEvent * event, Int_t label){
+ //Returns pointer to the track with given ESD label
+ //(Important for AOD implementation, since Track array in AOD data is different
+ //from ESD array, but ESD tracklabels are stored in AOD Tracks)
+
+ AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(event);
+ if(esdEvent) {
+ if(label > event->GetNumberOfTracks() ) return NULL;
+ AliESDtrack * track = esdEvent->GetTrack(label);
+ return track;
+
+ } else {
+ for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
+ AliVTrack * track = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
+
+ if(track) {
+ if(track->GetID() == label) {
+ return track;
+ }
+ }
+ }
+ }
+
+ cout << "track not found " << label << " " << event->GetNumberOfTracks() << endl;
+ return NULL;
+}
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::RejectSharedElecGamma(TList *photons, Int_t indexEle){
+
+
+ for(Int_t i = 0;i<photons->GetEntries();i++){
+
+ AliAODConversionPhoton *photonComp = (AliAODConversionPhoton*) photons->At(i);
+
+ Int_t posLabel = photonComp->GetTrackLabelPositive();
+ Int_t negLabel = photonComp->GetTrackLabelNegative();
+
+ if( (photonComp->GetConversionRadius() < fRadiusCut) && (posLabel == indexEle || negLabel == indexEle) ){
+ return kFALSE;
+ }
+ }
+
+ return kTRUE;
+}
+Bool_t AliDalitzElectronCuts::MassCut(Double_t pi0CandidatePt , Double_t vphotonCandidateMass){
+
+ if( pi0CandidatePt < fMassCutPtMin ){
+
+ if( vphotonCandidateMass < fMassCutLowPt ){
+ return kTRUE;
+ }
+
+ }
+ else{
+
+ if( vphotonCandidateMass < fMassCutHighPt ){
+ return kTRUE;
+ }
+
+ }
+
+ return kFALSE;
+
+}
+
+Double_t AliDalitzElectronCuts::GetNFindableClustersTPC(AliESDtrack* lTrack){
+
+
+ Double_t clsToF=0;
+
+
+ if ( !fUseCorrectedTPCClsInfo ){
+ if(lTrack->GetTPCNclsF()!=0){
+
+ clsToF = (Double_t)lTrack->GetNcls(1)/(Double_t)lTrack->GetTPCNclsF();
+ }// Ncluster/Nfindablecluster
+ }
+ else {
+
+ //clsToF = lTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(photon->GetConversionRadius()));
+ clsToF = lTrack->GetTPCClusterInfo(2,0); //NOTE ask friederike
+
+ }
+
+ return clsToF;
+
+}
+
+/*
+Double_t AliDalitzElectronCuts::GetPsiPair( const AliESDtrack *trackPos, const AliESDtrack *trackNeg )
+{
+//
+// This angle is a measure for the contribution of the opening in polar
+// direction ??0 to the opening angle ?? Pair
+//
+// Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC
+// Master Thesis. Thorsten Dahms. 2005
+// https://twiki.cern.ch/twiki/pub/ALICE/GammaPhysicsPublications/tdahms_thesis.pdf
+//
+ Double_t momPos[3];
+ Double_t momNeg[3];
+ if( trackPos->GetConstrainedPxPyPz(momPos) == 0 ) trackPos->GetPxPyPz( momPos );
+ if( trackNeg->GetConstrainedPxPyPz(momNeg) == 0 ) trackNeg->GetPxPyPz( momNeg );
+
+ TVector3 posDaughter;
+ TVector3 negDaughter;
+
+ posDaughter.SetXYZ( momPos[0], momPos[1], momPos[2] );
+ negDaughter.SetXYZ( momNeg[0], momNeg[1], momNeg[2] );
+
+ Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();
+ Double_t openingAngle = posDaughter.Angle( negDaughter ); //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );
+
+ if( openingAngle < 1e-20 ) return 0.;
+
+ Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
+
+ return psiAngle;
+}*/
+
+Bool_t AliDalitzElectronCuts::IsFromGammaConversion( Double_t psiPair, Double_t deltaPhi )
+{
+//
+// Returns true if it is a gamma conversion according to psi pair value
+//
+ return ( (deltaPhi > fDeltaPhiCutMin && deltaPhi < fDeltaPhiCutMax) &&
+ TMath::Abs(psiPair) < ( fPsiPairCut - fPsiPairCut/fDeltaPhiCutMax * deltaPhi ) );
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::UpdateCutString(cutIds cutID, Int_t value) {
+///Update the cut string (if it has been created yet)
+
+ if(fCutString && fCutString->GetString().Length() == kNCuts) {
+// cout << "Updating cut id in spot number " << cutID << " to " << value << endl;
+ fCutString->SetString(GetCutNumber());
+ } else {
+// cout << "fCutString not yet initialized, will not be updated" << endl;
+ return kFALSE;
+ }
+ // cout << fCutString->GetString().Data() << endl;
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
+ // Initialize Cuts from a given Cut string
+
+// out<<"Set Cut Number: "<<analysisCutSelection.Data()<<endl;
+ AliInfo(Form("Set ElectronCuts Number: %s",analysisCutSelection.Data()));
+
+ if(analysisCutSelection.Length()!=kNCuts) {
+ AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
+ return kFALSE;
+ }
+ if(!analysisCutSelection.IsDigit()){
+ AliError("Cut selection contains characters");
+ return kFALSE;
+ }
+
+ const char *cutSelection = analysisCutSelection.Data();
+ #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
+ for(Int_t ii=0;ii<kNCuts;ii++){
+ ASSIGNARRAY(ii);
+ }
+
+ // TestFlag
+ if(fCuts[0] !=9){
+ AliError("Analysis Cut Selection does not start with 9");
+ PrintCuts();
+ return kFALSE;
+ }
+
+ // Set Individual Cuts
+ for(Int_t ii=0;ii<kNCuts;ii++){
+ if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
+ }
+
+ //PrintCuts();
+
+ return kTRUE;
+}
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetCut(cutIds cutID, const Int_t value) {
+ ///Set individual cut ID
+
+ //cout << "Updating cut " << fgkCutNames[cutID] << " (" << cutID << ") to " << value << endl;
+
+ switch (cutID) {
+ case kgoodId:
+ fCuts[kgoodId] = value;
+ if(value != 9) {
+ cout << "Error:: First value of cut string is wrong, aborting!!" << endl;
+ return kFALSE;
+ } else {
+ return kTRUE;
+ }
+
+ case kededxSigmaITSCut:
+ if( SetITSdEdxCutElectronLine(value)) { //NOTE SetITSdEdxCutElectronLine: To be implemented
+ fCuts[kededxSigmaITSCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kededxSigmaTPCCut:
+ if( SetTPCdEdxCutElectronLine(value)) { //NOTE SetITSdEdxCutElectronLine: To be implemented
+ fCuts[kededxSigmaTPCCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kpidedxSigmaTPCCut:
+ if( SetTPCdEdxCutPionLine(value)) { //NOTE SetITSdEdxCutPionLine: To be implemented
+ fCuts[kpidedxSigmaTPCCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kpiMinMomdedxSigmaTPCCut:
+ if( SetMinMomPiondEdxTPCCut(value)) {
+ fCuts[kpiMinMomdedxSigmaTPCCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kpiMaxMomdedxSigmaTPCCut:
+ if( SetMaxMomPiondEdxTPCCut(value)) {
+ fCuts[kpiMaxMomdedxSigmaTPCCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kLowPRejectionSigmaCut:
+ if( SetLowPRejectionCuts(value) ) {
+ fCuts[kLowPRejectionSigmaCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+
+ case kTOFelectronPID:
+ if( SetTOFElectronPIDCut(value)) {
+ fCuts[kTOFelectronPID] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+ case kclsITSCut:
+ if( SetITSClusterCut(value) ) {
+ fCuts[kclsITSCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+ case kclsTPCCut:
+ if( SetTPCClusterCut(value)) {
+ fCuts[kclsTPCCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case ketaCut:
+ if( SetEtaCut(value)) {
+ fCuts[ketaCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+ case kptCut:
+ if( SetPtCut(value)) {
+ fCuts[kptCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kDCACut:
+ if( SetDCACut(value)) {
+ fCuts[kDCACut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+
+ case kPsiPair:
+ if( SetPsiPairCut(value)) {
+ fCuts[kPsiPair] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kRejectSharedElecGamma:
+ if( SetRejectSharedElecGamma(value)) {
+ fCuts[kRejectSharedElecGamma] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kBackgroundScheme:
+ if( SetBackgroundScheme(value)) {
+ fCuts[kBackgroundScheme] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kNumberOfRotations:
+ if( SetNumberOfRotations(value)) {
+ fCuts[kNumberOfRotations] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+ case kmassCut:
+ if( SetMassCut(value)) {
+ fCuts[kmassCut] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+ case kWeights:
+ if( SetDoWeights(value)) {
+ fCuts[kWeights] = value;
+ UpdateCutString(cutID, value);
+ return kTRUE;
+ } else return kFALSE;
+
+
+ case kNCuts:
+ cout << "Error:: Cut id out of range"<< endl;
+ return kFALSE;
+ }
+
+ cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
+ return kFALSE;
+
+ //PrintCuts();
+
+}
+
+///________________________________________________________________________
+
+void AliDalitzElectronCuts::PrintCuts() {
+ // Print out current Cut Selection
+ for(Int_t ic = 0; ic < kNCuts; ic++) {
+ printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
+ }
+
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetITSdEdxCutElectronLine(Int_t ededxSigmaCut)
+{ // Set Cut
+
+ switch(ededxSigmaCut){
+
+ case 0:
+ fDodEdxSigmaITSCut = kFALSE;
+ fPIDnSigmaBelowElectronLineITS=-100;
+ fPIDnSigmaAboveElectronLineITS= 100;
+ break;
+ case 1: // -10,10
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-10;
+ fPIDnSigmaAboveElectronLineITS=10;
+ break;
+ case 2: // -6,7
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-6;
+ fPIDnSigmaAboveElectronLineITS=7;
+ break;
+ case 3: // -5,5
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-5;
+ fPIDnSigmaAboveElectronLineITS=5;
+ break;
+ case 4: // -4,5
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-4;
+ fPIDnSigmaAboveElectronLineITS=5;
+ break;
+ case 5: // -3,5
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-3;
+ fPIDnSigmaAboveElectronLineITS=5;
+ break;
+ case 6: // -4,4
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-4;
+ fPIDnSigmaAboveElectronLineITS=4;
+ break;
+ case 7: // -2.5,4
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-2.5;
+ fPIDnSigmaAboveElectronLineITS=4;
+ break;
+ case 8: // -2,3.5
+ fDodEdxSigmaITSCut = kTRUE;
+ fPIDnSigmaBelowElectronLineITS=-2;
+ fPIDnSigmaAboveElectronLineITS=3.5;
+ break;
+ default:
+ cout<<"Warning: ITSdEdxCutElectronLine not defined"<<ededxSigmaCut<<endl;
+ return kFALSE;
+
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut)
+{ // Set Cut
+ switch(ededxSigmaCut){
+
+ case 0: fDodEdxSigmaTPCCut = kFALSE;
+ fPIDnSigmaBelowElectronLineTPC=-10;
+ fPIDnSigmaAboveElectronLineTPC=10;
+ break;
+ case 1: // -10,10
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-10;
+ fPIDnSigmaAboveElectronLineTPC=10;
+ break;
+ case 2: // -6,7
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-6;
+ fPIDnSigmaAboveElectronLineTPC=7;
+ break;
+ case 3: // -5,5
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-5;
+ fPIDnSigmaAboveElectronLineTPC=5;
+ break;
+ case 4: // -4,5
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-4;
+ fPIDnSigmaAboveElectronLineTPC=5;
+ break;
+ case 5: // -3,5
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-3;
+ fPIDnSigmaAboveElectronLineTPC=5;
+ break;
+ case 6: // -4,4
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-4;
+ fPIDnSigmaAboveElectronLineTPC=4;
+ break;
+ case 7: // -2.5,4
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-2.5;
+ fPIDnSigmaAboveElectronLineTPC=4;
+ break;
+ case 8: // -2,3.5
+ fDodEdxSigmaTPCCut = kTRUE;
+ fPIDnSigmaBelowElectronLineTPC=-2;
+ fPIDnSigmaAboveElectronLineTPC=3.5;
+ break;
+ default:
+ cout<<"Warning: TPCdEdxCutElectronLine not defined"<<ededxSigmaCut<<endl;
+ return kFALSE;
+
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut)
+{ // Set Cut
+
+ switch(pidedxSigmaCut){
+
+ case 0: fPIDnSigmaAbovePionLineTPC= 0;
+ fPIDnSigmaAbovePionLineTPCHighPt=-100;
+ break;
+ case 1: // -10
+ fPIDnSigmaAbovePionLineTPC=3.0; //Update Sep-05-2013 from -10 to 3
+ fPIDnSigmaAbovePionLineTPCHighPt=-10;
+ break;
+ case 2: // 1
+ fPIDnSigmaAbovePionLineTPC=2; //Update Sep-09-2013 from -1 to 2
+ fPIDnSigmaAbovePionLineTPCHighPt=-1; //Update Sep-09-2013 from -10 to -1
+ break;
+ case 3: // 0
+ fPIDnSigmaAbovePionLineTPC=2; //Update Sep-09-2013 from 0 to 2
+ fPIDnSigmaAbovePionLineTPCHighPt=0; //Update Sep-09-2013 from -10 to 0
+ break;
+ case 4: // 1
+ fPIDnSigmaAbovePionLineTPC=1;
+ fPIDnSigmaAbovePionLineTPCHighPt=-10;
+ break;
+ case 5: // 1
+ fPIDnSigmaAbovePionLineTPC=2.;
+ fPIDnSigmaAbovePionLineTPCHighPt=-10;
+ break;
+ case 6: // 1
+ fPIDnSigmaAbovePionLineTPC=2.5;
+ fPIDnSigmaAbovePionLineTPCHighPt=-10;
+ break;
+ case 7:
+ fPIDnSigmaAbovePionLineTPC = 2.0; // We need a bit less tight cut on dE/dx //Updated from 3.0 and -10 to +2.0 , +2.0
+ fPIDnSigmaAbovePionLineTPCHighPt = 2.0;
+ break;
+ case 8: // 1
+ fPIDnSigmaAbovePionLineTPC = 1.5; // Updated May-16-2013 from 3.5 and -10 to +1.5, +1
+ fPIDnSigmaAbovePionLineTPCHighPt = 1.0;
+ break;
+ case 9: // 1
+ fPIDnSigmaAbovePionLineTPC=1.5;
+ fPIDnSigmaAbovePionLineTPCHighPt=-1.0;
+ break;
+ default:
+ cout<<"Warning: pidedxSigmaCut not defined "<<pidedxSigmaCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetMinMomPiondEdxTPCCut(Int_t piMomdedxSigmaCut)
+{ // Set Cut
+ switch(piMomdedxSigmaCut){
+
+ case 0: fPIDMinPnSigmaAbovePionLineTPC=0.;
+ break;
+ case 1: // 50.0 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=50.;
+ break;
+ case 2: // 20.0 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=20.;
+ break;
+ case 3: // 1.5 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=1.5;
+ break;
+ case 4: // 1. GeV
+ fPIDMinPnSigmaAbovePionLineTPC=1.;
+ break;
+ case 5: // 0.5 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=0.5;
+ break;
+ case 6: // 0.4 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=0.4;
+ break;
+ case 7: // 0.3 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=0.3;
+ break;
+ case 8: // 0.25 GeV
+ fPIDMinPnSigmaAbovePionLineTPC=0.25;
+ break;
+ default:
+ cout<<"Warning: piMomdedxSigmaCut not defined "<<piMomdedxSigmaCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetITSClusterCut(Int_t clsITSCut){
+
+
+ if( !fesdTrackCuts ) {
+
+ cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
+ return kFALSE;
+ }
+
+ switch(clsITSCut){
+
+ case 0: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
+ break;
+ case 1: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
+ break; //1 hit first layer of SPD
+ case 2: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+ break; //1 hit in any layer of SPD
+ case 3: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
+ fesdTrackCuts->SetMinNClustersITS(4);
+ // 4 hits in total in the ITS. At least 1 hit in the first layer of SPD
+ break;
+ case 4: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+ fesdTrackCuts->SetMinNClustersITS(3);
+ // 3 hits in total in the ITS. At least 1 hit in any layer of SPD
+ break;
+ case 5: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+ fesdTrackCuts->SetMinNClustersITS(4);
+ // 4 hits in total in the ITS. At least 1 hit in any layer of SPD
+ break;
+ case 6: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+ fesdTrackCuts->SetMinNClustersITS(5);
+ // 5 hits in total in the ITS. At least 1 hit in any layer of SPD
+ break;
+ default:
+ cout<<"Warning: clsITSCut not defined "<<clsITSCut<<endl;
+ return kFALSE;
+ }
+
+return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetTPCClusterCut(Int_t clsTPCCut)
+{ // Set Cut
+ switch(clsTPCCut){
+ case 0: // 0
+ fMinClsTPC= 0.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ break;
+ case 1: // 70
+ fMinClsTPC= 70.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ break;
+ case 2: // 80
+ fMinClsTPC= 80.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ break;
+ case 3: // 100
+ fMinClsTPC= 100.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ break;
+ case 4: // 0% of findable clusters
+ fMinClsTPC= 70.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ fMinClsTPCToF= 0.0;
+ fUseCorrectedTPCClsInfo=0;
+ break;
+ case 5: // 35% of findable clusters
+ fMinClsTPC = 70.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ fMinClsTPCToF= 0.35;
+ fUseCorrectedTPCClsInfo=0;
+ break;
+ case 6: // 60% of findable clusters
+ fMinClsTPC= 70.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ fMinClsTPCToF= 0.6;
+ fUseCorrectedTPCClsInfo=0;
+ break;
+ case 7: // 70% of findable clusters
+ fMinClsTPC= 70.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ fMinClsTPCToF= 0.7;
+ fUseCorrectedTPCClsInfo=0;
+ break;
+ case 8: fMinClsTPC = 0.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ fMinClsTPCToF= 0.35;
+ fUseCorrectedTPCClsInfo=0;
+ break;
+ case 9: // 35% of findable clusters
+ fMinClsTPC = 70.;
+ fesdTrackCuts->SetMinNClustersTPC(fMinClsTPC);
+ fMinClsTPCToF= 0.35;
+ fUseCorrectedTPCClsInfo=1;
+ break;
+
+ default:
+ cout<<"Warning: clsTPCCut not defined "<<clsTPCCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetEtaCut(Int_t etaCut)
+{
+ // Set eta Cut
+ switch(etaCut){
+ case 0:
+ fEtaCut = 100.;
+ fDoEtaCut = kFALSE;
+ break;
+ case 1: // 1.4
+ fEtaCut = 1.4;
+ fDoEtaCut = kTRUE;
+ break;
+ case 2: // 1.2
+ fEtaCut = 1.2;
+ fDoEtaCut = kTRUE;
+ break;
+ case 3: // 0.9
+ fEtaCut = 0.9;
+ fDoEtaCut = kTRUE;
+ break;
+ case 4: // 0.8
+ fEtaCut = 0.8;
+ fDoEtaCut = kTRUE;
+ break;
+ case 5: // 0.75
+ fEtaCut = 0.75;
+ fDoEtaCut = kTRUE;
+ break;
+ case 6: //0.6
+ fEtaCut = 0.6; //changed from 0.4 to 0.6 2013.06.10
+ fDoEtaCut = kTRUE;
+ break;
+ case 7: //0.5
+ fEtaCut = 0.5; //changed from 0.3 to 0.5 2013.06.10
+ fDoEtaCut = kTRUE;
+ break;
+ case 8: fEtaCut = 0.4;
+ fDoEtaCut = kTRUE;
+ break;
+ default:
+ cout<<"Warning: EtaCut not defined "<<etaCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetPtCut(Int_t ptCut)
+{
+ // Set Pt Cut
+ //0.1GeV, 0.125 GeV, 0.15 GeV
+
+ switch(ptCut){
+
+ case 0: fPtCut = 0.075;
+ break;
+ case 1: // 0.1
+ fPtCut = 0.1;
+ break;
+ case 2: // 0.125 GeV
+ fPtCut = 0.125;
+ break;
+ case 3: // 0.15 GeV
+ fPtCut = 0.15;
+ break;
+ default:
+ cout<<"Warning: PtCut not defined "<<ptCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetDCACut(Int_t dcaCut)
+{
+ // Set DCA Cut
+
+ if( !fesdTrackCuts ) {
+
+ cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
+ return kFALSE;
+ }
+
+ switch(dcaCut){
+
+ case 0:
+ //Open cuts//
+ fesdTrackCuts->SetMaxDCAToVertexZ(1000);
+ fesdTrackCuts->SetMaxDCAToVertexXY(1000);
+ fesdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
+ break;
+
+ case 1:
+ fesdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
+ fesdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
+
+ break;
+ case 2: fesdTrackCuts->SetMaxDCAToVertexZ(2);
+ fesdTrackCuts->SetMaxDCAToVertexXY(1);
+ fesdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
+ break;
+
+ default:
+ cout<<"Warning: dcaCut not defined "<<dcaCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+
+
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetMaxMomPiondEdxTPCCut(Int_t piMaxMomdedxSigmaCut)
+{ // Set Cut
+ switch(piMaxMomdedxSigmaCut){
+
+ case 0:
+ fPIDMaxPnSigmaAbovePionLineTPC=0.;
+ break;
+ case 1: // 100. GeV
+ fPIDMaxPnSigmaAbovePionLineTPC=100.;
+ break;
+ case 2: // 5. GeV
+ fPIDMaxPnSigmaAbovePionLineTPC=5.;
+ break;
+ case 3: // 4. GeV
+ fPIDMaxPnSigmaAbovePionLineTPC=4.;
+ break;
+ case 4: // 3.5 GeV
+ fPIDMaxPnSigmaAbovePionLineTPC=3.5;
+ break;
+ case 5: // 3. GeV
+ fPIDMaxPnSigmaAbovePionLineTPC=3.;
+ break;
+ default:
+ cout<<"Warning: piMaxMomdedxSigmaCut not defined "<<piMaxMomdedxSigmaCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
+{ // Set Cut
+ switch(LowPRejectionSigmaCut){
+ case 0: //
+ fDoKaonRejectionLowP=kFALSE;
+ fDoProtonRejectionLowP=kFALSE;
+ fDoPionRejectionLowP=kFALSE;
+ fPIDnSigmaAtLowPAroundKaonLine=0;
+ fPIDnSigmaAtLowPAroundProtonLine=0;
+ fPIDnSigmaAtLowPAroundPionLine=0;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 1: //
+ fDoKaonRejectionLowP=kTRUE;
+ fDoProtonRejectionLowP=kTRUE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=0.5;
+ fPIDnSigmaAtLowPAroundProtonLine=0.5;
+ fPIDnSigmaAtLowPAroundPionLine=0.5;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 2: //
+ fDoKaonRejectionLowP=kTRUE;
+ fDoProtonRejectionLowP=kTRUE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=1.0;
+ fPIDnSigmaAtLowPAroundProtonLine=1.0;
+ fPIDnSigmaAtLowPAroundPionLine=1.0;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 3: //
+ fDoKaonRejectionLowP=kTRUE;
+ fDoProtonRejectionLowP=kTRUE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=1.5;
+ fPIDnSigmaAtLowPAroundProtonLine=1.5;
+ fPIDnSigmaAtLowPAroundPionLine=1.5;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 4: //
+ fDoKaonRejectionLowP=kTRUE;
+ fDoProtonRejectionLowP=kTRUE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=2.0;
+ fPIDnSigmaAtLowPAroundProtonLine=2.0;
+ fPIDnSigmaAtLowPAroundPionLine=2.0;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 5: //
+ fDoKaonRejectionLowP=kTRUE;
+ fDoProtonRejectionLowP=kTRUE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=2.0;
+ fPIDnSigmaAtLowPAroundProtonLine=2.0;
+ fPIDnSigmaAtLowPAroundPionLine=2.5;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 6: //
+ fDoKaonRejectionLowP=kTRUE;
+ fDoProtonRejectionLowP=kTRUE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=0.;
+ fPIDnSigmaAtLowPAroundProtonLine=0.;
+ fPIDnSigmaAtLowPAroundPionLine=2.;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 7: //
+ fDoKaonRejectionLowP=kFALSE;
+ fDoProtonRejectionLowP=kFALSE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=0.0;
+ fPIDnSigmaAtLowPAroundProtonLine=0.0;
+ fPIDnSigmaAtLowPAroundPionLine=1.0;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ case 8:
+ fDoKaonRejectionLowP=kFALSE;
+ fDoProtonRejectionLowP=kFALSE;
+ fDoPionRejectionLowP=kTRUE;
+ fPIDnSigmaAtLowPAroundKaonLine=0.;
+ fPIDnSigmaAtLowPAroundProtonLine=0.;
+ fPIDnSigmaAtLowPAroundPionLine=0.5;
+ fPIDMinPPionRejectionLowP = fPIDMinPnSigmaAbovePionLineTPC;
+ break;
+ default:
+ cout<<"Warning: LowPRejectionSigmaCut not defined "<<LowPRejectionSigmaCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
+ // Set Cut
+ switch(TOFelectronPID){ // RRnewTOF start //////////////////////////////////////////////////////////////////////////
+ case 0: // no cut
+ fRequireTOF = kFALSE;
+ fUseTOFpid = kFALSE;
+ fTofPIDnSigmaBelowElectronLine=-100;
+ fTofPIDnSigmaAboveElectronLine=100;
+ break;
+ case 1: // -7,7
+ fRequireTOF = kFALSE;
+ fUseTOFpid = kTRUE;
+ fTofPIDnSigmaBelowElectronLine=-7;
+ fTofPIDnSigmaAboveElectronLine=7;
+ break;
+ case 2: // -5,5
+ fRequireTOF = kFALSE;
+ fUseTOFpid = kTRUE;
+ fTofPIDnSigmaBelowElectronLine=-5;
+ fTofPIDnSigmaAboveElectronLine=5;
+ break;
+ case 3: // -3,5
+ fRequireTOF = kFALSE;
+ fUseTOFpid = kTRUE;
+ fTofPIDnSigmaBelowElectronLine=-3;
+ fTofPIDnSigmaAboveElectronLine=5;
+ break;
+ case 4: // -2,3
+ fRequireTOF = kFALSE;
+ fUseTOFpid = kTRUE;
+ fTofPIDnSigmaBelowElectronLine=-2;
+ fTofPIDnSigmaAboveElectronLine=3;
+ break;
+ case 5: // -3, 3 TOF mandatory
+ fRequireTOF = kTRUE;
+ fUseTOFpid = kTRUE;
+ fTofPIDnSigmaBelowElectronLine= -3;
+ fTofPIDnSigmaAboveElectronLine= 3;
+ break;
+ default:
+ cout<<"Warning: TOFElectronCut not defined "<<TOFelectronPID<<endl;
+ return kFALSE;
+ } //////////////////////// RRnewTOF end //////////////////////////////////////////////////////////////////////////
+ return kTRUE;
+}
+///_______________________________________________________________________________
+
+Bool_t AliDalitzElectronCuts::SetPsiPairCut(Int_t psiCut) {
+
+
+ switch(psiCut) {
+ case 0:
+ fDoPsiPairCut = kFALSE;
+ fPsiPairCut = 10000.; //
+ fDeltaPhiCutMin = -1000.;
+ fDeltaPhiCutMax = 1000.;
+
+ break;
+ case 1:
+ fDoPsiPairCut = kTRUE;
+ fPsiPairCut = 0.45; // Standard
+ fDeltaPhiCutMin = 0.0;
+ fDeltaPhiCutMax = 0.12;
+ break;
+ case 2:
+ fDoPsiPairCut = kTRUE;
+ fPsiPairCut = 0.60;
+ fDeltaPhiCutMin = 0.0;
+ fDeltaPhiCutMax = 0.12;
+ break;
+ case 3:
+ fDoPsiPairCut = kTRUE;
+ fPsiPairCut = 0.52;
+ fDeltaPhiCutMin = 0.0;
+ fDeltaPhiCutMax = 0.12;
+ break;
+ case 4:
+ fDoPsiPairCut = kTRUE;
+ fPsiPairCut = 0.30;
+ fDeltaPhiCutMin = 0.0;
+ fDeltaPhiCutMax = 0.12;
+ break;
+
+ default:
+ cout<<"Warning: PsiPairCut not defined "<<fPsiPairCut<<endl;
+ return kFALSE;
+ }
+
+ return kTRUE;
+}
+
+///_______________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetRejectSharedElecGamma(Int_t RCut) {
+
+
+ switch(RCut) {
+ case 0:
+ fDoRejectSharedElecGamma = kFALSE;
+ fRadiusCut = 10000; //
+ break;
+ case 1:
+ fDoRejectSharedElecGamma = kTRUE;
+ fRadiusCut = 2.0; // cm
+ break;
+ case 2:
+ fDoRejectSharedElecGamma = kTRUE;
+ fRadiusCut = 3.0; // Standard
+ break;
+ case 3:
+ fDoRejectSharedElecGamma = kTRUE;
+ fRadiusCut = 4.0; //
+ break;
+ case 4:
+ fDoRejectSharedElecGamma = kTRUE;
+ fRadiusCut = 5.0; //
+ break;
+ case 5:
+ fDoRejectSharedElecGamma = kTRUE;
+ fRadiusCut = 10.0; //
+ break;
+ case 6:
+ fDoRejectSharedElecGamma = kTRUE;
+ fRadiusCut = 15.0; //
+ break;
+ default:
+ cout<<"Warning: PsiPairCut not defined "<<fDoRejectSharedElecGamma<<endl;
+ return kFALSE;
+ }
+
+ return kTRUE;
+}
+///__________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetBackgroundScheme(Int_t BackgroundScheme){
+
+ // Set Cut
+ switch(BackgroundScheme){
+
+ case 0: //Rotation
+ fBKGMethod = 0;
+ fUseTrackMultiplicityForBG = kFALSE;
+ break;
+ case 1: // mixed event with V0 multiplicity
+ fBKGMethod = 1;
+ fUseTrackMultiplicityForBG = kFALSE;
+ break;
+ case 2: // mixed event with track multiplicity
+ fUseTrackMultiplicityForBG = kTRUE;
+ fBKGMethod = 1;
+ break;
+ case 3: //Rotation
+ fUseTrackMultiplicityForBG = kFALSE;
+ fBKGMethod = 2;
+ break;
+ case 4: //Rotation
+ fUseTrackMultiplicityForBG = kTRUE;
+ fBKGMethod = 2;
+ break;
+ case 5: fUseTrackMultiplicityForBG = kTRUE;
+ fBKGMethod = 3;
+ break;
+
+ default:
+ cout<<"Warning: BackgroundScheme not defined "<<BackgroundScheme<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetNumberOfRotations(Int_t NumberOfRotations)
+{ // Set Cut
+ switch(NumberOfRotations){
+ case 0:
+ fnumberOfRotationEventsForBG = 5;
+ break;
+ case 1:
+ fnumberOfRotationEventsForBG = 10;
+ break;
+ case 2:
+ fnumberOfRotationEventsForBG = 15;
+ break;
+ case 3:
+ fnumberOfRotationEventsForBG = 20;
+ break;
+ case 4:
+ fnumberOfRotationEventsForBG = 2;
+ break;
+ case 5:
+ fnumberOfRotationEventsForBG = 50;
+ break;
+ case 6:
+ fnumberOfRotationEventsForBG = 80;
+ break;
+ case 7:
+ fnumberOfRotationEventsForBG = 100;
+ break;
+ default:
+ cout<<"Warning: NumberOfRotations not defined "<<NumberOfRotations<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+
+
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetDoWeights(Int_t opc)
+{ // Set Cut
+ switch(opc){
+
+ case 0: fDoWeights = kFALSE;
+ break;
+ case 1: fDoWeights = kTRUE;
+ break;
+ default:
+ cout<<"Warning: Weights option not defined "<<opc<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetMassCut(Int_t massCut)
+{ // Set Cut
+ switch(massCut){
+
+ case 0:
+
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 999.; //GeV/c^2
+ fMassCutHighPt = 999.; //GeV/c^2
+ fDoMassCut = kFALSE;
+ break;
+ case 1:
+ //fMassCut = 0.135; //GeV/c^2
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 0.135; //GeV/c^2
+ fMassCutHighPt = 0.135; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ case 2:
+ //fMassCut = 0.100; //GeV/c^2
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 0.100; //GeV/c^2
+ fMassCutHighPt = 0.100; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ case 3:
+ //fMassCut = 0.075; //GeV/c^2
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 0.075; //GeV/c^2
+ fMassCutHighPt = 0.075; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ case 4:
+ //fMassCut = 0.050; //GeV/c^2
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 0.050; //GeV/c^2
+ fMassCutHighPt = 0.050; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ case 5:
+
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 0.035; //GeV/c^2
+ fMassCutHighPt = 0.035; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ case 6:
+ fMassCutPtMin = -999.; //GeV
+ fMassCutLowPt = 0.015; //GeV/c^2
+ fMassCutHighPt = 0.015; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ case 7: fMassCutPtMin = 1.0; //GeV
+ fMassCutLowPt = 0.015; //GeV/c^2
+ fMassCutHighPt = 0.035; //GeV/c^2
+ fDoMassCut = kTRUE;
+ break;
+ default:
+ cout<<"Warning: MassCut not defined "<<massCut<<endl;
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+
+
+///________________________________________________________________________
+TString AliDalitzElectronCuts::GetCutNumber(){
+ // returns TString with current cut number
+ TString a(kNCuts);
+ for(Int_t ii=0;ii<kNCuts;ii++){
+ a.Append(Form("%d",fCuts[ii]));
+ }
+ return a;
+}
+
+
+///________________________________________________________________________
+AliDalitzElectronCuts* AliDalitzElectronCuts::GetStandardCuts2010PbPb(){
+ //Create and return standard 2010 PbPb cuts
+ AliDalitzElectronCuts *cuts=new AliDalitzElectronCuts("StandardCuts2010PbPb","StandardCuts2010PbPb");
+ if(!cuts->InitializeCutsFromCutString("9069640364102")){
+ cout<<"Warning: Initialization of Standardcuts2010PbPb failed"<<endl;}
+ return cuts;
+}
+
+///________________________________________________________________________
+AliDalitzElectronCuts* AliDalitzElectronCuts::GetStandardCuts2010pp(){
+ //Create and return standard 2010 PbPb cuts
+ AliDalitzElectronCuts *cuts=new AliDalitzElectronCuts("StandardCuts2010pp","StandardCuts2010pp");
+
+ if(!cuts->InitializeCutsFromCutString("9069640364102")){
+ cout<<"Warning: Initialization of Standardcuts2010pp failed"<<endl;}
+ return cuts;
+}
+
-#ifndef AliAnalysisTaskPi0_cxx\r
-#define AliAnalysisTaskPi0_cxx\r
-\r
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-/* $Id$ */\r
-\r
-// Analysis task for pi0 and eta meson analysis in pp collisions\r
-// Authors: Yuri Kharlov, Dmitri Peressounko\r
-\r
-class TObjArray;\r
-class TH1F;\r
-class TH2I;\r
-class TH2F;\r
-class TH3F;\r
-class AliESDtrackCuts;\r
-class AliPHOSGeometry;\r
-class AliTriggerAnalysis;\r
-\r
-#include "TH2I.h"\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliLog.h"\r
-\r
-class AliAnalysisTaskPi0 : public AliAnalysisTaskSE {\r
-public:\r
- AliAnalysisTaskPi0(const char *name = "AliAnalysisTaskPi0");\r
- virtual ~AliAnalysisTaskPi0() {}\r
- \r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- void SetBCgap(const Double_t bcgap) {fBCgap = bcgap;}\r
- void SetRecalib(const Int_t mod, const Double_t recalib)\r
- {\r
- if (mod<1 || mod>5) AliFatal(Form("Wrong module number: %d",mod));\r
- else fRecalib[mod-1] = recalib;\r
- }\r
- void SetPHOSBadMap(Int_t mod,TH2I * h)\r
- {\r
- if(fPHOSBadMap[mod]) delete fPHOSBadMap[mod] ;\r
- fPHOSBadMap[mod]=new TH2I(*h) ;\r
- printf("Set %s \n",fPHOSBadMap[mod]->GetName());\r
- }\r
- \r
-private:\r
- AliAnalysisTaskPi0(const AliAnalysisTaskPi0&); // not implemented\r
- AliAnalysisTaskPi0& operator=(const AliAnalysisTaskPi0&); // not implemented\r
- Bool_t IsGoodChannel(const char * det, Int_t mod,Int_t ix, Int_t iz);\r
- void FillHistogram(const char * key,Double_t x) const ; //Fill 1D histogram witn name key\r
- void FillHistogram(const char * key,Double_t x, Double_t y) const ; //Fill 2D histogram witn name key\r
- void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ; //Fill 3D histogram witn name key\r
- Bool_t TestLambda(Double_t l1,Double_t l2) ;\r
- Int_t TestBC(Double_t tof) ;\r
- \r
-private:\r
- AliESDtrackCuts *fESDtrackCuts; // Track cut\r
- TList * fOutputContainer; //final histogram container\r
- TList * fPHOSEvents[10][2] ; //Container for PHOS photons\r
- TClonesArray * fPHOSEvent ; //PHOS photons in current event\r
- \r
- Int_t fnCINT1B; // Number of CINT1B triggers\r
- Int_t fnCINT1A; // Number of CINT1A triggers\r
- Int_t fnCINT1C; // Number of CINT1C triggers\r
- Int_t fnCINT1E; // Number of CINT1E triggers\r
-\r
- Double_t fBCgap; // time gap between BC in seconds\r
- Double_t fRecalib[5]; // Correction for abs.calibration per module\r
-\r
- TH2I *fPHOSBadMap[6] ; //Container for PHOS bad channels map\r
-\r
- AliPHOSGeometry *fPHOSGeo; // PHOS geometry\r
- Int_t fEventCounter; // number of analyzed events\r
- AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation\r
-\r
- ClassDef(AliAnalysisTaskPi0, 3); // PHOS analysis task\r
-};\r
-\r
-#endif\r
+#ifndef AliAnalysisTaskPi0_cxx
+#define AliAnalysisTaskPi0_cxx
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+/* $Id$ */
+
+// Analysis task for pi0 and eta meson analysis in pp collisions
+// Authors: Yuri Kharlov, Dmitri Peressounko
+
+class TObjArray;
+class TH1F;
+class TH2I;
+class TH2F;
+class TH3F;
+class AliESDtrackCuts;
+class AliPHOSGeometry;
+class AliTriggerAnalysis;
+
+#include "TH2I.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliLog.h"
+
+class AliAnalysisTaskPi0 : public AliAnalysisTaskSE {
+public:
+ AliAnalysisTaskPi0(const char *name = "AliAnalysisTaskPi0");
+ virtual ~AliAnalysisTaskPi0() {}
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ void SetBCgap(const Double_t bcgap) {fBCgap = bcgap;}
+ void SetRecalib(const Int_t mod, const Double_t recalib)
+ {
+ if (mod<1 || mod>5) AliFatal(Form("Wrong module number: %d",mod));
+ else fRecalib[mod-1] = recalib;
+ }
+ void SetPHOSBadMap(Int_t mod,TH2I * h)
+ {
+ if(fPHOSBadMap[mod]) delete fPHOSBadMap[mod] ;
+ fPHOSBadMap[mod]=new TH2I(*h) ;
+ printf("Set %s \n",fPHOSBadMap[mod]->GetName());
+ }
+
+private:
+ AliAnalysisTaskPi0(const AliAnalysisTaskPi0&); // not implemented
+ AliAnalysisTaskPi0& operator=(const AliAnalysisTaskPi0&); // not implemented
+ Bool_t IsGoodChannel(const char * det, Int_t mod,Int_t ix, Int_t iz);
+ void FillHistogram(const char * key,Double_t x) const ; //Fill 1D histogram witn name key
+ void FillHistogram(const char * key,Double_t x, Double_t y) const ; //Fill 2D histogram witn name key
+ void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ; //Fill 3D histogram witn name key
+ Bool_t TestLambda(Double_t l1,Double_t l2) ;
+ Int_t TestBC(Double_t tof) ;
+
+private:
+ AliESDtrackCuts *fESDtrackCuts; // Track cut
+ TList * fOutputContainer; //final histogram container
+ TList * fPHOSEvents[10][2] ; //Container for PHOS photons
+ TClonesArray * fPHOSEvent ; //PHOS photons in current event
+
+ Int_t fnCINT1B; // Number of CINT1B triggers
+ Int_t fnCINT1A; // Number of CINT1A triggers
+ Int_t fnCINT1C; // Number of CINT1C triggers
+ Int_t fnCINT1E; // Number of CINT1E triggers
+
+ Double_t fBCgap; // time gap between BC in seconds
+ Double_t fRecalib[5]; // Correction for abs.calibration per module
+
+ TH2I *fPHOSBadMap[6] ; //Container for PHOS bad channels map
+
+ AliPHOSGeometry *fPHOSGeo; // PHOS geometry
+ Int_t fEventCounter; // number of analyzed events
+ AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
+
+ ClassDef(AliAnalysisTaskPi0, 3); // PHOS analysis task
+};
+
+#endif
-void MakeFinalSpectrum()\r
-{\r
- //-----------------------------------------------------------------------------\r
- // This macro takes the raw pi0 spectrum from LHC11a_FitResult_20130314.root,\r
- // correct it for feed down, then for efficiency,\r
- // adds all systematic errors and produces the production invariant spectrum\r
- //--\r
- // Last modification: 06.07.2012 by Yuri Kharlov\r
- //-----------------------------------------------------------------------------\r
-\r
- TFile *f = new TFile("LHC11a_FitResult_20130913.root");\r
- TH1D * nr1CB = (TH1D*)f->Get("Mix_CB_yr1") ;\r
- TH1D * nr1intCB = (TH1D*)f->Get("Mix_CB_yr1int") ;\r
- TH1D * nr2CB = (TH1D*)f->Get("Mix_CB_yr2") ;\r
- TH1D * nr2intCB = (TH1D*)f->Get("Mix_CB_yr2int") ;\r
-\r
- TH1D * nr1GS = (TH1D*)f->Get("Mix_yr1") ;\r
- TH1D * nr1intGS = (TH1D*)f->Get("Mix_yr1int") ;\r
- TH1D * nr2GS = (TH1D*)f->Get("Mix_yr2") ;\r
- TH1D * nr2intGS = (TH1D*)f->Get("Mix_yr2int") ;\r
-\r
- //Divide by bin width\r
- for(Int_t i=1;i<= nr1CB->GetNbinsX();i++){\r
- nr1CB ->SetBinContent(i,nr1CB->GetBinContent(i)/nr1CB->GetXaxis()->GetBinWidth(i)) ;\r
- nr1CB ->SetBinError (i,nr1CB->GetBinError(i)/nr1CB->GetXaxis()->GetBinWidth(i)) ;\r
- nr1intCB->SetBinContent(i,nr1intCB->GetBinContent(i)/nr1intCB->GetXaxis()->GetBinWidth(i)) ;\r
- nr1intCB->SetBinError (i,nr1intCB->GetBinError(i)/nr1intCB->GetXaxis()->GetBinWidth(i)) ;\r
- nr2CB ->SetBinContent(i,nr2CB->GetBinContent(i)/nr2CB->GetXaxis()->GetBinWidth(i)) ;\r
- nr2CB ->SetBinError (i,nr2CB->GetBinError(i)/nr2CB->GetXaxis()->GetBinWidth(i)) ;\r
- nr2intCB->SetBinContent(i,nr2intCB->GetBinContent(i)/nr2intCB->GetXaxis()->GetBinWidth(i)) ;\r
- nr2intCB->SetBinError (i,nr2intCB->GetBinError(i)/nr2intCB->GetXaxis()->GetBinWidth(i)) ;\r
-\r
- nr1GS ->SetBinContent(i,nr1GS->GetBinContent(i)/nr1GS->GetXaxis()->GetBinWidth(i)) ;\r
- nr1GS ->SetBinError (i,nr1GS->GetBinError(i)/nr1GS->GetXaxis()->GetBinWidth(i)) ;\r
- nr1intGS->SetBinContent(i,nr1intGS->GetBinContent(i)/nr1intGS->GetXaxis()->GetBinWidth(i)) ;\r
- nr1intGS->SetBinError (i,nr1intGS->GetBinError(i)/nr1intGS->GetXaxis()->GetBinWidth(i)) ;\r
- nr2GS ->SetBinContent(i,nr2GS->GetBinContent(i)/nr2GS->GetXaxis()->GetBinWidth(i)) ;\r
- nr2GS ->SetBinError (i,nr2GS->GetBinError(i)/nr2GS->GetXaxis()->GetBinWidth(i)) ;\r
- nr2intGS->SetBinContent(i,nr2intGS->GetBinContent(i)/nr2intGS->GetXaxis()->GetBinWidth(i)) ;\r
- nr2intGS->SetBinError (i,nr2intGS->GetBinError(i)/nr2intGS->GetXaxis()->GetBinWidth(i)) ;\r
- }\r
-\r
- // feed down correction\r
-\r
- TF1 *fKaonContaminationToPi0 = new TF1("kaonCont","1./(1.-1.33*1.2*exp(-2.95-0.16*x))",0.,30.);\r
- nr1GS ->Divide(fKaonContaminationToPi0);\r
- nr1intGS->Divide(fKaonContaminationToPi0);\r
- nr2GS ->Divide(fKaonContaminationToPi0);\r
- nr2intGS->Divide(fKaonContaminationToPi0);\r
- nr1CB ->Divide(fKaonContaminationToPi0);\r
- nr2CB ->Divide(fKaonContaminationToPi0);\r
- nr1intCB->Divide(fKaonContaminationToPi0);\r
- nr2intCB->Divide(fKaonContaminationToPi0);\r
-\r
- // SPD pileup correction\r
-\r
- TF1 *fSPDpileup = new TF1("SPDpileup","0.988",0.,30.);\r
- nr1GS ->Multiply(fSPDpileup);\r
- nr1intGS->Multiply(fSPDpileup);\r
- nr2GS ->Multiply(fSPDpileup);\r
- nr2intGS->Multiply(fSPDpileup);\r
- nr1CB ->Multiply(fSPDpileup);\r
- nr2CB ->Multiply(fSPDpileup);\r
- nr1intCB->Multiply(fSPDpileup);\r
- nr2intCB->Multiply(fSPDpileup);\r
-\r
- //correct for efficiency\r
- TFile *fEff = new TFile("Pi0_efficiency_LHC11a__20131029_Mall.root") ;\r
-\r
- TF1 * effGS=fEff->Get("eff_Pi0_Gaus_2760GeV") ;\r
- TF1 * effCB=fEff->Get("eff_Pi0_CB_2760GeV") ;\r
- effGS ->SetRange(0.,25.) ;\r
- effCB ->SetRange(0.,25.) ;\r
-\r
- nr1GS ->Divide(effGS) ;\r
- nr1intGS->Divide(effGS) ;\r
- nr2GS ->Divide(effGS) ;\r
- nr2intGS->Divide(effGS) ;\r
- nr1CB ->Divide(effCB) ;\r
- nr2CB ->Divide(effCB) ;\r
- nr1intCB->Divide(effCB) ;\r
- nr2intCB->Divide(effCB) ;\r
-\r
- //make 1/pt\r
- for(Int_t i=1;i<=nr1CB->GetNbinsX();i++){\r
- Double_t pt = TMath::TwoPi()*nr1CB->GetXaxis()->GetBinCenter(i);\r
- nr1CB ->SetBinContent(i,nr1CB ->GetBinContent(i)/pt) ;\r
- nr1CB ->SetBinError (i,nr1CB ->GetBinError(i) /pt) ;\r
- nr1intCB->SetBinContent(i,nr1intCB->GetBinContent(i)/pt) ;\r
- nr1intCB->SetBinError (i,nr1intCB->GetBinError(i) /pt) ;\r
- nr2CB ->SetBinContent(i,nr2CB ->GetBinContent(i)/pt) ;\r
- nr2CB ->SetBinError (i,nr2CB ->GetBinError(i) /pt) ;\r
- nr2intCB->SetBinContent(i,nr2intCB->GetBinContent(i)/pt) ;\r
- nr2intCB->SetBinError (i,nr2intCB->GetBinError(i) /pt) ;\r
-\r
- nr1GS ->SetBinContent(i,nr1GS ->GetBinContent(i)/pt) ;\r
- nr1GS ->SetBinError (i,nr1GS ->GetBinError(i) /pt) ;\r
- nr1intGS->SetBinContent(i,nr1intGS->GetBinContent(i)/pt) ;\r
- nr1intGS->SetBinError (i,nr1intGS->GetBinError(i) /pt) ;\r
- nr2GS ->SetBinContent(i,nr2GS ->GetBinContent(i)/pt) ;\r
- nr2GS ->SetBinError (i,nr2GS ->GetBinError(i) /pt) ;\r
- nr2intGS->SetBinContent(i,nr2intGS->GetBinContent(i)/pt) ;\r
- nr2intGS->SetBinError (i,nr2intGS->GetBinError(i) /pt) ;\r
- }\r
-\r
- //For the final spectrum we take average of fits\r
- //with numerical integration of entries in signal\r
- \r
- TH1D * hStat = (TH1D*)nr2intCB->Clone("hPi02760GeVStat") ;\r
- TH1D * hSys = (TH1D*)hStat ->Clone("hPi02760GeVSys") ;\r
- TH1D * hSys2 = (TH1D*)hStat ->Clone("hPi02760GeVSysTypeB") ;\r
- TH1D * hSys3 = (TH1D*)hStat ->Clone("hPi02760GeVSysTypeC") ;\r
- hStat->SetAxisRange(0.,14.9,"X");\r
- hSys ->SetAxisRange(0.,14.9,"X");\r
-\r
- //For systematic error estimate take largest deviation\r
- //of integrated yeilds (note, they are efficiency corrected)\r
- for(Int_t i=1;i<=nr1CB->GetNbinsX();i++){\r
- Double_t mean= hStat->GetBinContent(i) ;\r
- Double_t dev = TMath::Max(\r
- TMath::Max(TMath::Abs(nr1intCB->GetBinContent(i)-mean),\r
- TMath::Abs(nr2intCB->GetBinContent(i)-mean)),\r
- TMath::Max(TMath::Abs(nr1intGS->GetBinContent(i)-mean),\r
- TMath::Abs(nr2intGS->GetBinContent(i)-mean))\r
- );\r
- hSys ->SetBinError(i,dev) ;\r
- hSys2->SetBinError(i,dev) ;\r
- }\r
-\r
- //Add other sys errors\r
- TF1 * globalE = new TF1("globalE","1.-((x+1.354)/(x*1.002+1.354))^6.18 ",1.,30.) ; \r
- TF1 * conv = new TF1("conversion","0.035",0.,30.) ;\r
- TF1 * accept = new TF1("accept" ,"0.01" ,0.,30.) ;\r
- TF1 * pileup = new TF1("pileup" ,"0.004",0.,30.) ;\r
- TF1 * calib = new TF1("calib" ,"0.005",0.,30.) ;\r
- TF1 * modDiff = new TF1("modDiff" ,"0.04",0.,30.) ;\r
- // TF1 * modDiff = new TF1("modDiff" ,"16.9*exp(-4.5*x)+0.033",0.,30.) ;\r
- TF1 * tofCut = new TF1("tofCut" ,"0.0105" ,0.,30.) ;\r
-\r
- //Borya's estimate of non-linearity (found for pp @ 7 TeV)\r
- TF1 * nonlin= new TF1("nl","0.015+7.38*exp(-x/0.24)",0.,30.) ;\r
-\r
- //Draw sys errors\r
- TH1D * hRelSysRaw = (TH1D*)hSys->Clone("RelSysRaw") ;\r
- hRelSysRaw->SetTitle("Summary of systematic errors");\r
- for(Int_t i=1;i<=hSys->GetNbinsX();i++){\r
- Double_t mean= hSys->GetBinContent(i) ;\r
- Double_t a=hSys->GetBinError(i) ;\r
- if(mean>0)\r
- hRelSysRaw->SetBinContent(i,a/mean) ;\r
- else\r
- hRelSysRaw->SetBinContent(i,0.) ;\r
- hRelSysRaw->SetBinError(i,0.) ;\r
- }\r
-\r
- //Add errors in sys errors\r
-\r
- TH1D * hRelSysTot = (TH1D*)hSys->Clone("RelSys") ;\r
- hRelSysTot->SetTitle("Summary of systematic uncertainties");\r
-\r
- for(Int_t i=1;i<=hSys->GetNbinsX();i++){\r
- Double_t pt = hSys->GetXaxis()->GetBinCenter(i) ;\r
- Double_t mean = hSys->GetBinContent(i) ;\r
- Double_t a = hSys->GetBinError(i) ;\r
- // Double_t b = mean * hSysErrModules->GetBinContent(i) ;\r
- Double_t tot= mean*mean*nonlin ->Eval(pt)*nonlin ->Eval(pt) \r
- +mean*mean*conv ->Eval(pt)*conv ->Eval(pt)\r
- +mean*mean*accept ->Eval(pt)*accept ->Eval(pt)\r
- +mean*mean*pileup ->Eval(pt)*pileup ->Eval(pt)\r
- +mean*mean*calib ->Eval(pt)*calib ->Eval(pt)\r
- +mean*mean*modDiff->Eval(pt)*modDiff->Eval(pt)\r
- +mean*mean*tofCut ->Eval(pt)*tofCut ->Eval(pt)\r
- +mean*mean*globalE->Eval(pt)*globalE->Eval(pt); \r
- Double_t raa= mean*mean*nonlin->Eval(pt)*nonlin->Eval(pt) \r
- +mean*mean*pileup->Eval(pt)*pileup->Eval(pt)\r
- +mean*mean*calib ->Eval(pt)*calib ->Eval(pt); \r
- hSys3->SetBinError(i,TMath::Sqrt(tot)) ;\r
- // hSys->SetBinError(i,TMath::Sqrt(tot + a*a + b*b)) ;\r
- hSys2->SetBinError(i,TMath::Sqrt(raa + a*a)) ;\r
- hSys ->SetBinError(i,TMath::Sqrt(tot + a*a)) ;\r
- \r
- a = hSys->GetBinError(i) ;\r
- printf("i=%d, %g+-%g\n",i,mean,a);\r
- if(mean>0)\r
- hRelSysTot->SetBinContent(i,a/mean) ;\r
- else {\r
- hRelSysTot->SetBinContent(i,0.) ;\r
- hRelSysTot->SetBinError(i,0.) ;\r
- }\r
- }\r
-\r
- // TFile *fSysErrModules = TFile::Open("PHOS_sysErr_modules.root");\r
- // TH1D* hSysErrModules = (TH1D*)fSysErrModules->Get("hSyserr");\r
-\r
- gStyle->SetOptStat(0);\r
- TCanvas * c = new TCanvas("c","SysErrors") ;\r
- c->SetLogy();\r
- c->cd() ;\r
- gPad->SetRightMargin(0.02);\r
- gPad->SetTopMargin(0.07);\r
- hRelSysTot->SetAxisRange(0.8 ,11.9,"X");\r
- hRelSysTot->SetAxisRange(0.0031,0.45,"Y");\r
- hRelSysTot->GetYaxis()->SetMoreLogLabels();\r
- hRelSysTot->GetYaxis()->SetNoExponent();\r
- hRelSysTot->SetNdivisions(520,"X");\r
- hRelSysTot->SetLineColor(1) ;\r
- hRelSysTot->SetLineWidth(2) ;\r
- hRelSysRaw->SetLineColor(2) ;\r
- hRelSysRaw->SetLineWidth(2) ;\r
- globalE->SetLineColor(kGreen+2) ;\r
- nonlin ->SetLineColor(4) ;\r
- conv ->SetLineColor(6) ;\r
- accept ->SetLineColor(kOrange) ;\r
- pileup ->SetLineColor(42);\r
- calib ->SetLineColor(44);\r
- calib ->SetLineStyle(2);\r
- modDiff->SetLineColor(52);\r
- modDiff->SetLineStyle(2);\r
- tofCut ->SetLineColor(53);\r
- tofCut ->SetLineStyle(3);\r
- // hSysErrModules->SetLineColor(kOrange+2);\r
- // hSysErrModules->SetLineStyle(2);\r
- hRelSysTot->SetXTitle("p_{T} (GeV/c)") ;\r
- hRelSysTot->SetYTitle("Rel.syst.error") ;\r
- hRelSysTot->GetYaxis()->SetTitleOffset(1.2) ;\r
- hRelSysTot->Draw("hist") ;\r
- hRelSysRaw->Draw("h same") ;\r
- globalE->Draw("same") ; \r
- nonlin ->Draw("same") ;\r
- conv ->Draw("same") ;\r
- accept ->Draw("same") ;\r
- pileup ->Draw("same");\r
- calib ->Draw("same");\r
- modDiff->Draw("same");\r
- tofCut ->Draw("same");\r
- // hSysErrModules->Draw("same ][");\r
- TLegend * l = new TLegend(0.57,0.62,0.85,0.925) ;\r
- l->SetFillColor(kWhite);\r
- l->SetBorderSize(0);\r
- l->AddEntry(hRelSysTot,"Total uncertainty","l") ;\r
- l->AddEntry(hRelSysRaw,"Raw extraction","l") ;\r
- l->AddEntry(conv ,"Conversion","l") ;\r
- l->AddEntry(nonlin ,"Non-linearity","l") ;\r
- l->AddEntry(accept ,"Acceptance","l");\r
- l->AddEntry(pileup ,"Pileup","l");\r
- l->AddEntry(calib ,"Rel.calib.","l");\r
- l->AddEntry(modDiff,"Per-module yield","l");\r
- l->AddEntry(tofCut ,"Timing cut","l");\r
- // l->AddEntry(hSysErrModules,"Intermodule spectra","l");\r
- l->AddEntry(globalE,"Global E scale","l") ;\r
- l->Draw() ;\r
-\r
- c->Print("LHC11a_SysErrors.eps");\r
-\r
- hStat->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, stat.err.");\r
- hStat->SetXTitle("p_{T}, GeV/c");\r
- hStat->SetYTitle("1/N_{ev} 1/(2#pi p_{T}) d^{2}N/dydp_{T} (GeV^{-2}c^{2})");\r
- hSys ->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, total syst.err.");\r
- hSys ->SetXTitle("p_{T}, GeV/c");\r
- hSys ->SetYTitle("1/N_{ev} 1/(2#pi p_{T}) d^{2}N/dydp_{T} (GeV^{-2}c^{2})");\r
- hSys2->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, syst.err. for R_{AA}");\r
- hSys3->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, apparatus syst.err.");\r
- hSys ->SetFillColor(kBlue-10) ;\r
- hSys ->SetNdivisions(520,"X");\r
-\r
- hSysFinal = (TH1F*)hSys->Clone("hSysFinal");\r
- hSysFinal ->SetTitle("Production #pi^{0} yield, pp @ 2.76 TeV, 07.11.2013");\r
- hSysFinal ->GetYaxis()->SetTitleOffset(1.2);\r
- hStat->GetYaxis()->SetTitleOffset(1.2);\r
- hSysFinal ->SetAxisRange(0.8,9.9,"X");\r
-\r
- TCanvas *c2 = new TCanvas("c2","Production spectrum");\r
- gPad->SetRightMargin(0.02);\r
- gPad->SetTopMargin(0.07);\r
- gPad->SetGridx();\r
- gPad->SetGridy();\r
- c2->SetLogy();\r
- hSysFinal->Draw("E2") ;\r
- hStat->SetMarkerStyle(20) ;\r
- hStat->SetMarkerColor(4) ;\r
- hStat->SetLineColor(4) ;\r
- hStat->Draw("same") ;\r
- \r
- // //Apply bin width correction\r
- // TH1D * hBWcorr = BinWidthCorrection(hStat) ;\r
- // hSys->Divide(hBWcorr) ;\r
- // hSys2->Divide(hBWcorr) ;\r
- // hSys3->Divide(hBWcorr) ;\r
- // hStat->Divide(hBWcorr) ;\r
-\r
- c2->Print("LHC11a_pi0Spectrum.eps");\r
-\r
- TF1 *tsallis = FitTsallis(hStat,hSys);\r
- \r
- TFile fout("PHOS_pi0_2760eV_noBinWidthCorr_20131112.root","recreate") ;\r
- hSys ->Write() ;\r
- hSys2 ->Write() ;\r
- hSys3 ->Write() ;\r
- hStat ->Write() ;\r
- tsallis->Write() ;\r
- fout.Close() ;\r
-\r
-\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-TF1 *FitTsallis(TH1D* hStat, TH1D* hSys)\r
-{\r
- TF1 * fit = new TF1("Tsalis","[0]/2./3.1415*([2]-1.)*([2]-2.)/([2]*[1]*([2]*[1]+0.135*([2]-2.)))*(1.+(sqrt(x*x+0.135*0.135)-0.135)/([2]*[1]))^-[2]",0.5,25.) ;\r
- fit->SetParameters(10.,0.2,8.) ;\r
- fit->SetLineColor(kBlack) ;\r
- fit->SetLineWidth(2) ;\r
- fit->SetParName(0,"dN/dy") ;\r
- fit->SetParName(1,"T") ;\r
- fit->SetParName(2,"n") ;\r
- \r
- TH1D * hSysRatio = (TH1D*)hSys ->Clone("RatioSys") ;\r
- TH1D * hStatRatio = (TH1D*)hStat->Clone("RatioStat") ;\r
-\r
- TH1D * hsum = (TH1D*)hStat->Clone("sum") ;\r
- for(Int_t i=1; i<=hsum->GetNbinsX();i++){\r
- Double_t a=hSys->GetBinError(i) ;\r
- Double_t b=hStat->GetBinError(i) ;\r
- hsum->SetBinError(i,TMath::Sqrt(a*a+b*b)) ;\r
- }\r
- hsum->SetStats(1) ;\r
- hsum->Fit(fit,"Q") ;\r
- Double_t meanPt=fit->Moment(1,1.,10.) ;\r
- printf("<pt>=%f \n",meanPt) ;\r
-\r
- hSysRatio ->Divide(fit) ;\r
- hStatRatio->Divide(fit) ;\r
-\r
- return fit;\r
-}\r
-//-----------------------------------------------------------------------------\r
-TH1D * BinWidthCorrection(TH1D * h){\r
- //We apply bin width a-la PHENIX \r
- //Use Tsalis fit to calculate shift in y direction\r
- \r
- TF1 * fit = new TF1("hag","[0]*(([2]*[1]+sqrt(x*x+0.135*0.135))/([2]*[1]+0.135))^-[2]",0.5,25.) ;\r
- fit->SetParameters(10.,0.2,8.) ;\r
- TCanvas * corr = new TCanvas("BWcorr","Bin width correction") ;\r
- Int_t col[6]={kRed,kOrange,kMagenta,kGreen,kCyan,kBlue} ;\r
- TH1D * hcorr[20] ;\r
- char key[55] ;\r
- Double_t rMax=10 ;\r
- Int_t iteration=0 ;\r
- TH1D * htmp = (TH1D*)h->Clone("tmp") ;\r
- while(iteration<6){\r
- printf(" Iteration %d: rMax=%f \n",iteration, rMax) ;\r
- htmp->Fit(fit,"N") ;\r
- sprintf(key,"Ineration%d",iteration) ;\r
- hcorr[iteration]=(TH1D*)h->Clone(key);\r
- rMax= 0; \r
- for(Int_t i=1;i<=h->GetNbinsX();i++){\r
- Double_t a=h->GetXaxis()->GetBinLowEdge(i) ;\r
- Double_t b=h->GetXaxis()->GetBinUpEdge(i) ;\r
- Double_t r=fit->Integral(a,b)/(b-a)/fit->Eval(0.5*(a+b)) ;\r
- hcorr[iteration]->SetBinContent(i,r) ;\r
- hcorr[iteration]->SetBinError(i,0.) ;\r
- if(rMax<r)rMax=r ;\r
- }\r
- delete htmp ;\r
- htmp = (TH1D*)h->Clone("tmp") ;\r
- htmp->Divide(hcorr[iteration]) ;\r
- corr->cd() ;\r
- hcorr[iteration]->SetLineColor(col[iteration]);\r
- if(iteration==0)\r
- hcorr[iteration]->Draw() ;\r
- else\r
- hcorr[iteration]->Draw("same") ;\r
- corr->Update() ;\r
- iteration++ ;\r
- } \r
-\r
- hcorr[5]->SetTitle("Bin-width correction for #pi^{0} spectrum");\r
- hcorr[5]->SetYTitle("Bin-width corrected / uncorrected");\r
- TFile fout("PHOS_pi0_7TeV_BinWidthCorrection.root","recreate") ;\r
- hcorr[5]->Write();\r
- fout.Close();\r
-\r
- return hcorr[5] ;\r
-}\r
+void MakeFinalSpectrum()
+{
+ //-----------------------------------------------------------------------------
+ // This macro takes the raw pi0 spectrum from LHC11a_FitResult_20130314.root,
+ // correct it for feed down, then for efficiency,
+ // adds all systematic errors and produces the production invariant spectrum
+ //--
+ // Last modification: 06.07.2012 by Yuri Kharlov
+ //-----------------------------------------------------------------------------
+
+ TFile *f = new TFile("LHC11a_FitResult_20130913.root");
+ TH1D * nr1CB = (TH1D*)f->Get("Mix_CB_yr1") ;
+ TH1D * nr1intCB = (TH1D*)f->Get("Mix_CB_yr1int") ;
+ TH1D * nr2CB = (TH1D*)f->Get("Mix_CB_yr2") ;
+ TH1D * nr2intCB = (TH1D*)f->Get("Mix_CB_yr2int") ;
+
+ TH1D * nr1GS = (TH1D*)f->Get("Mix_yr1") ;
+ TH1D * nr1intGS = (TH1D*)f->Get("Mix_yr1int") ;
+ TH1D * nr2GS = (TH1D*)f->Get("Mix_yr2") ;
+ TH1D * nr2intGS = (TH1D*)f->Get("Mix_yr2int") ;
+
+ //Divide by bin width
+ for(Int_t i=1;i<= nr1CB->GetNbinsX();i++){
+ nr1CB ->SetBinContent(i,nr1CB->GetBinContent(i)/nr1CB->GetXaxis()->GetBinWidth(i)) ;
+ nr1CB ->SetBinError (i,nr1CB->GetBinError(i)/nr1CB->GetXaxis()->GetBinWidth(i)) ;
+ nr1intCB->SetBinContent(i,nr1intCB->GetBinContent(i)/nr1intCB->GetXaxis()->GetBinWidth(i)) ;
+ nr1intCB->SetBinError (i,nr1intCB->GetBinError(i)/nr1intCB->GetXaxis()->GetBinWidth(i)) ;
+ nr2CB ->SetBinContent(i,nr2CB->GetBinContent(i)/nr2CB->GetXaxis()->GetBinWidth(i)) ;
+ nr2CB ->SetBinError (i,nr2CB->GetBinError(i)/nr2CB->GetXaxis()->GetBinWidth(i)) ;
+ nr2intCB->SetBinContent(i,nr2intCB->GetBinContent(i)/nr2intCB->GetXaxis()->GetBinWidth(i)) ;
+ nr2intCB->SetBinError (i,nr2intCB->GetBinError(i)/nr2intCB->GetXaxis()->GetBinWidth(i)) ;
+
+ nr1GS ->SetBinContent(i,nr1GS->GetBinContent(i)/nr1GS->GetXaxis()->GetBinWidth(i)) ;
+ nr1GS ->SetBinError (i,nr1GS->GetBinError(i)/nr1GS->GetXaxis()->GetBinWidth(i)) ;
+ nr1intGS->SetBinContent(i,nr1intGS->GetBinContent(i)/nr1intGS->GetXaxis()->GetBinWidth(i)) ;
+ nr1intGS->SetBinError (i,nr1intGS->GetBinError(i)/nr1intGS->GetXaxis()->GetBinWidth(i)) ;
+ nr2GS ->SetBinContent(i,nr2GS->GetBinContent(i)/nr2GS->GetXaxis()->GetBinWidth(i)) ;
+ nr2GS ->SetBinError (i,nr2GS->GetBinError(i)/nr2GS->GetXaxis()->GetBinWidth(i)) ;
+ nr2intGS->SetBinContent(i,nr2intGS->GetBinContent(i)/nr2intGS->GetXaxis()->GetBinWidth(i)) ;
+ nr2intGS->SetBinError (i,nr2intGS->GetBinError(i)/nr2intGS->GetXaxis()->GetBinWidth(i)) ;
+ }
+
+ // feed down correction
+
+ TF1 *fKaonContaminationToPi0 = new TF1("kaonCont","1./(1.-1.33*1.2*exp(-2.95-0.16*x))",0.,30.);
+ nr1GS ->Divide(fKaonContaminationToPi0);
+ nr1intGS->Divide(fKaonContaminationToPi0);
+ nr2GS ->Divide(fKaonContaminationToPi0);
+ nr2intGS->Divide(fKaonContaminationToPi0);
+ nr1CB ->Divide(fKaonContaminationToPi0);
+ nr2CB ->Divide(fKaonContaminationToPi0);
+ nr1intCB->Divide(fKaonContaminationToPi0);
+ nr2intCB->Divide(fKaonContaminationToPi0);
+
+ // SPD pileup correction
+
+ TF1 *fSPDpileup = new TF1("SPDpileup","0.988",0.,30.);
+ nr1GS ->Multiply(fSPDpileup);
+ nr1intGS->Multiply(fSPDpileup);
+ nr2GS ->Multiply(fSPDpileup);
+ nr2intGS->Multiply(fSPDpileup);
+ nr1CB ->Multiply(fSPDpileup);
+ nr2CB ->Multiply(fSPDpileup);
+ nr1intCB->Multiply(fSPDpileup);
+ nr2intCB->Multiply(fSPDpileup);
+
+ //correct for efficiency
+ TFile *fEff = new TFile("Pi0_efficiency_LHC11a__20131029_Mall.root") ;
+
+ TF1 * effGS=fEff->Get("eff_Pi0_Gaus_2760GeV") ;
+ TF1 * effCB=fEff->Get("eff_Pi0_CB_2760GeV") ;
+ effGS ->SetRange(0.,25.) ;
+ effCB ->SetRange(0.,25.) ;
+
+ nr1GS ->Divide(effGS) ;
+ nr1intGS->Divide(effGS) ;
+ nr2GS ->Divide(effGS) ;
+ nr2intGS->Divide(effGS) ;
+ nr1CB ->Divide(effCB) ;
+ nr2CB ->Divide(effCB) ;
+ nr1intCB->Divide(effCB) ;
+ nr2intCB->Divide(effCB) ;
+
+ //make 1/pt
+ for(Int_t i=1;i<=nr1CB->GetNbinsX();i++){
+ Double_t pt = TMath::TwoPi()*nr1CB->GetXaxis()->GetBinCenter(i);
+ nr1CB ->SetBinContent(i,nr1CB ->GetBinContent(i)/pt) ;
+ nr1CB ->SetBinError (i,nr1CB ->GetBinError(i) /pt) ;
+ nr1intCB->SetBinContent(i,nr1intCB->GetBinContent(i)/pt) ;
+ nr1intCB->SetBinError (i,nr1intCB->GetBinError(i) /pt) ;
+ nr2CB ->SetBinContent(i,nr2CB ->GetBinContent(i)/pt) ;
+ nr2CB ->SetBinError (i,nr2CB ->GetBinError(i) /pt) ;
+ nr2intCB->SetBinContent(i,nr2intCB->GetBinContent(i)/pt) ;
+ nr2intCB->SetBinError (i,nr2intCB->GetBinError(i) /pt) ;
+
+ nr1GS ->SetBinContent(i,nr1GS ->GetBinContent(i)/pt) ;
+ nr1GS ->SetBinError (i,nr1GS ->GetBinError(i) /pt) ;
+ nr1intGS->SetBinContent(i,nr1intGS->GetBinContent(i)/pt) ;
+ nr1intGS->SetBinError (i,nr1intGS->GetBinError(i) /pt) ;
+ nr2GS ->SetBinContent(i,nr2GS ->GetBinContent(i)/pt) ;
+ nr2GS ->SetBinError (i,nr2GS ->GetBinError(i) /pt) ;
+ nr2intGS->SetBinContent(i,nr2intGS->GetBinContent(i)/pt) ;
+ nr2intGS->SetBinError (i,nr2intGS->GetBinError(i) /pt) ;
+ }
+
+ //For the final spectrum we take average of fits
+ //with numerical integration of entries in signal
+
+ TH1D * hStat = (TH1D*)nr2intCB->Clone("hPi02760GeVStat") ;
+ TH1D * hSys = (TH1D*)hStat ->Clone("hPi02760GeVSys") ;
+ TH1D * hSys2 = (TH1D*)hStat ->Clone("hPi02760GeVSysTypeB") ;
+ TH1D * hSys3 = (TH1D*)hStat ->Clone("hPi02760GeVSysTypeC") ;
+ hStat->SetAxisRange(0.,14.9,"X");
+ hSys ->SetAxisRange(0.,14.9,"X");
+
+ //For systematic error estimate take largest deviation
+ //of integrated yeilds (note, they are efficiency corrected)
+ for(Int_t i=1;i<=nr1CB->GetNbinsX();i++){
+ Double_t mean= hStat->GetBinContent(i) ;
+ Double_t dev = TMath::Max(
+ TMath::Max(TMath::Abs(nr1intCB->GetBinContent(i)-mean),
+ TMath::Abs(nr2intCB->GetBinContent(i)-mean)),
+ TMath::Max(TMath::Abs(nr1intGS->GetBinContent(i)-mean),
+ TMath::Abs(nr2intGS->GetBinContent(i)-mean))
+ );
+ hSys ->SetBinError(i,dev) ;
+ hSys2->SetBinError(i,dev) ;
+ }
+
+ //Add other sys errors
+ TF1 * globalE = new TF1("globalE","1.-((x+1.354)/(x*1.002+1.354))^6.18 ",1.,30.) ;
+ TF1 * conv = new TF1("conversion","0.035",0.,30.) ;
+ TF1 * accept = new TF1("accept" ,"0.01" ,0.,30.) ;
+ TF1 * pileup = new TF1("pileup" ,"0.004",0.,30.) ;
+ TF1 * calib = new TF1("calib" ,"0.005",0.,30.) ;
+ TF1 * modDiff = new TF1("modDiff" ,"0.04",0.,30.) ;
+ // TF1 * modDiff = new TF1("modDiff" ,"16.9*exp(-4.5*x)+0.033",0.,30.) ;
+ TF1 * tofCut = new TF1("tofCut" ,"0.0105" ,0.,30.) ;
+
+ //Borya's estimate of non-linearity (found for pp @ 7 TeV)
+ TF1 * nonlin= new TF1("nl","0.015+7.38*exp(-x/0.24)",0.,30.) ;
+
+ //Draw sys errors
+ TH1D * hRelSysRaw = (TH1D*)hSys->Clone("RelSysRaw") ;
+ hRelSysRaw->SetTitle("Summary of systematic errors");
+ for(Int_t i=1;i<=hSys->GetNbinsX();i++){
+ Double_t mean= hSys->GetBinContent(i) ;
+ Double_t a=hSys->GetBinError(i) ;
+ if(mean>0)
+ hRelSysRaw->SetBinContent(i,a/mean) ;
+ else
+ hRelSysRaw->SetBinContent(i,0.) ;
+ hRelSysRaw->SetBinError(i,0.) ;
+ }
+
+ //Add errors in sys errors
+
+ TH1D * hRelSysTot = (TH1D*)hSys->Clone("RelSys") ;
+ hRelSysTot->SetTitle("Summary of systematic uncertainties");
+
+ for(Int_t i=1;i<=hSys->GetNbinsX();i++){
+ Double_t pt = hSys->GetXaxis()->GetBinCenter(i) ;
+ Double_t mean = hSys->GetBinContent(i) ;
+ Double_t a = hSys->GetBinError(i) ;
+ // Double_t b = mean * hSysErrModules->GetBinContent(i) ;
+ Double_t tot= mean*mean*nonlin ->Eval(pt)*nonlin ->Eval(pt)
+ +mean*mean*conv ->Eval(pt)*conv ->Eval(pt)
+ +mean*mean*accept ->Eval(pt)*accept ->Eval(pt)
+ +mean*mean*pileup ->Eval(pt)*pileup ->Eval(pt)
+ +mean*mean*calib ->Eval(pt)*calib ->Eval(pt)
+ +mean*mean*modDiff->Eval(pt)*modDiff->Eval(pt)
+ +mean*mean*tofCut ->Eval(pt)*tofCut ->Eval(pt)
+ +mean*mean*globalE->Eval(pt)*globalE->Eval(pt);
+ Double_t raa= mean*mean*nonlin->Eval(pt)*nonlin->Eval(pt)
+ +mean*mean*pileup->Eval(pt)*pileup->Eval(pt)
+ +mean*mean*calib ->Eval(pt)*calib ->Eval(pt);
+ hSys3->SetBinError(i,TMath::Sqrt(tot)) ;
+ // hSys->SetBinError(i,TMath::Sqrt(tot + a*a + b*b)) ;
+ hSys2->SetBinError(i,TMath::Sqrt(raa + a*a)) ;
+ hSys ->SetBinError(i,TMath::Sqrt(tot + a*a)) ;
+
+ a = hSys->GetBinError(i) ;
+ printf("i=%d, %g+-%g\n",i,mean,a);
+ if(mean>0)
+ hRelSysTot->SetBinContent(i,a/mean) ;
+ else {
+ hRelSysTot->SetBinContent(i,0.) ;
+ hRelSysTot->SetBinError(i,0.) ;
+ }
+ }
+
+ // TFile *fSysErrModules = TFile::Open("PHOS_sysErr_modules.root");
+ // TH1D* hSysErrModules = (TH1D*)fSysErrModules->Get("hSyserr");
+
+ gStyle->SetOptStat(0);
+ TCanvas * c = new TCanvas("c","SysErrors") ;
+ c->SetLogy();
+ c->cd() ;
+ gPad->SetRightMargin(0.02);
+ gPad->SetTopMargin(0.07);
+ hRelSysTot->SetAxisRange(0.8 ,11.9,"X");
+ hRelSysTot->SetAxisRange(0.0031,0.45,"Y");
+ hRelSysTot->GetYaxis()->SetMoreLogLabels();
+ hRelSysTot->GetYaxis()->SetNoExponent();
+ hRelSysTot->SetNdivisions(520,"X");
+ hRelSysTot->SetLineColor(1) ;
+ hRelSysTot->SetLineWidth(2) ;
+ hRelSysRaw->SetLineColor(2) ;
+ hRelSysRaw->SetLineWidth(2) ;
+ globalE->SetLineColor(kGreen+2) ;
+ nonlin ->SetLineColor(4) ;
+ conv ->SetLineColor(6) ;
+ accept ->SetLineColor(kOrange) ;
+ pileup ->SetLineColor(42);
+ calib ->SetLineColor(44);
+ calib ->SetLineStyle(2);
+ modDiff->SetLineColor(52);
+ modDiff->SetLineStyle(2);
+ tofCut ->SetLineColor(53);
+ tofCut ->SetLineStyle(3);
+ // hSysErrModules->SetLineColor(kOrange+2);
+ // hSysErrModules->SetLineStyle(2);
+ hRelSysTot->SetXTitle("p_{T} (GeV/c)") ;
+ hRelSysTot->SetYTitle("Rel.syst.error") ;
+ hRelSysTot->GetYaxis()->SetTitleOffset(1.2) ;
+ hRelSysTot->Draw("hist") ;
+ hRelSysRaw->Draw("h same") ;
+ globalE->Draw("same") ;
+ nonlin ->Draw("same") ;
+ conv ->Draw("same") ;
+ accept ->Draw("same") ;
+ pileup ->Draw("same");
+ calib ->Draw("same");
+ modDiff->Draw("same");
+ tofCut ->Draw("same");
+ // hSysErrModules->Draw("same ][");
+ TLegend * l = new TLegend(0.57,0.62,0.85,0.925) ;
+ l->SetFillColor(kWhite);
+ l->SetBorderSize(0);
+ l->AddEntry(hRelSysTot,"Total uncertainty","l") ;
+ l->AddEntry(hRelSysRaw,"Raw extraction","l") ;
+ l->AddEntry(conv ,"Conversion","l") ;
+ l->AddEntry(nonlin ,"Non-linearity","l") ;
+ l->AddEntry(accept ,"Acceptance","l");
+ l->AddEntry(pileup ,"Pileup","l");
+ l->AddEntry(calib ,"Rel.calib.","l");
+ l->AddEntry(modDiff,"Per-module yield","l");
+ l->AddEntry(tofCut ,"Timing cut","l");
+ // l->AddEntry(hSysErrModules,"Intermodule spectra","l");
+ l->AddEntry(globalE,"Global E scale","l") ;
+ l->Draw() ;
+
+ c->Print("LHC11a_SysErrors.eps");
+
+ hStat->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, stat.err.");
+ hStat->SetXTitle("p_{T}, GeV/c");
+ hStat->SetYTitle("1/N_{ev} 1/(2#pi p_{T}) d^{2}N/dydp_{T} (GeV^{-2}c^{2})");
+ hSys ->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, total syst.err.");
+ hSys ->SetXTitle("p_{T}, GeV/c");
+ hSys ->SetYTitle("1/N_{ev} 1/(2#pi p_{T}) d^{2}N/dydp_{T} (GeV^{-2}c^{2})");
+ hSys2->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, syst.err. for R_{AA}");
+ hSys3->SetTitle("Normalized production #pi^{0} yield, pp @ 2.76 TeV, apparatus syst.err.");
+ hSys ->SetFillColor(kBlue-10) ;
+ hSys ->SetNdivisions(520,"X");
+
+ hSysFinal = (TH1F*)hSys->Clone("hSysFinal");
+ hSysFinal ->SetTitle("Production #pi^{0} yield, pp @ 2.76 TeV, 07.11.2013");
+ hSysFinal ->GetYaxis()->SetTitleOffset(1.2);
+ hStat->GetYaxis()->SetTitleOffset(1.2);
+ hSysFinal ->SetAxisRange(0.8,9.9,"X");
+
+ TCanvas *c2 = new TCanvas("c2","Production spectrum");
+ gPad->SetRightMargin(0.02);
+ gPad->SetTopMargin(0.07);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ c2->SetLogy();
+ hSysFinal->Draw("E2") ;
+ hStat->SetMarkerStyle(20) ;
+ hStat->SetMarkerColor(4) ;
+ hStat->SetLineColor(4) ;
+ hStat->Draw("same") ;
+
+ // //Apply bin width correction
+ // TH1D * hBWcorr = BinWidthCorrection(hStat) ;
+ // hSys->Divide(hBWcorr) ;
+ // hSys2->Divide(hBWcorr) ;
+ // hSys3->Divide(hBWcorr) ;
+ // hStat->Divide(hBWcorr) ;
+
+ c2->Print("LHC11a_pi0Spectrum.eps");
+
+ TF1 *tsallis = FitTsallis(hStat,hSys);
+
+ TFile fout("PHOS_pi0_2760eV_noBinWidthCorr_20131112.root","recreate") ;
+ hSys ->Write() ;
+ hSys2 ->Write() ;
+ hSys3 ->Write() ;
+ hStat ->Write() ;
+ tsallis->Write() ;
+ fout.Close() ;
+
+
+}
+
+//-----------------------------------------------------------------------------
+TF1 *FitTsallis(TH1D* hStat, TH1D* hSys)
+{
+ TF1 * fit = new TF1("Tsalis","[0]/2./3.1415*([2]-1.)*([2]-2.)/([2]*[1]*([2]*[1]+0.135*([2]-2.)))*(1.+(sqrt(x*x+0.135*0.135)-0.135)/([2]*[1]))^-[2]",0.5,25.) ;
+ fit->SetParameters(10.,0.2,8.) ;
+ fit->SetLineColor(kBlack) ;
+ fit->SetLineWidth(2) ;
+ fit->SetParName(0,"dN/dy") ;
+ fit->SetParName(1,"T") ;
+ fit->SetParName(2,"n") ;
+
+ TH1D * hSysRatio = (TH1D*)hSys ->Clone("RatioSys") ;
+ TH1D * hStatRatio = (TH1D*)hStat->Clone("RatioStat") ;
+
+ TH1D * hsum = (TH1D*)hStat->Clone("sum") ;
+ for(Int_t i=1; i<=hsum->GetNbinsX();i++){
+ Double_t a=hSys->GetBinError(i) ;
+ Double_t b=hStat->GetBinError(i) ;
+ hsum->SetBinError(i,TMath::Sqrt(a*a+b*b)) ;
+ }
+ hsum->SetStats(1) ;
+ hsum->Fit(fit,"Q") ;
+ Double_t meanPt=fit->Moment(1,1.,10.) ;
+ printf("<pt>=%f \n",meanPt) ;
+
+ hSysRatio ->Divide(fit) ;
+ hStatRatio->Divide(fit) ;
+
+ return fit;
+}
+//-----------------------------------------------------------------------------
+TH1D * BinWidthCorrection(TH1D * h){
+ //We apply bin width a-la PHENIX
+ //Use Tsalis fit to calculate shift in y direction
+
+ TF1 * fit = new TF1("hag","[0]*(([2]*[1]+sqrt(x*x+0.135*0.135))/([2]*[1]+0.135))^-[2]",0.5,25.) ;
+ fit->SetParameters(10.,0.2,8.) ;
+ TCanvas * corr = new TCanvas("BWcorr","Bin width correction") ;
+ Int_t col[6]={kRed,kOrange,kMagenta,kGreen,kCyan,kBlue} ;
+ TH1D * hcorr[20] ;
+ char key[55] ;
+ Double_t rMax=10 ;
+ Int_t iteration=0 ;
+ TH1D * htmp = (TH1D*)h->Clone("tmp") ;
+ while(iteration<6){
+ printf(" Iteration %d: rMax=%f \n",iteration, rMax) ;
+ htmp->Fit(fit,"N") ;
+ sprintf(key,"Ineration%d",iteration) ;
+ hcorr[iteration]=(TH1D*)h->Clone(key);
+ rMax= 0;
+ for(Int_t i=1;i<=h->GetNbinsX();i++){
+ Double_t a=h->GetXaxis()->GetBinLowEdge(i) ;
+ Double_t b=h->GetXaxis()->GetBinUpEdge(i) ;
+ Double_t r=fit->Integral(a,b)/(b-a)/fit->Eval(0.5*(a+b)) ;
+ hcorr[iteration]->SetBinContent(i,r) ;
+ hcorr[iteration]->SetBinError(i,0.) ;
+ if(rMax<r)rMax=r ;
+ }
+ delete htmp ;
+ htmp = (TH1D*)h->Clone("tmp") ;
+ htmp->Divide(hcorr[iteration]) ;
+ corr->cd() ;
+ hcorr[iteration]->SetLineColor(col[iteration]);
+ if(iteration==0)
+ hcorr[iteration]->Draw() ;
+ else
+ hcorr[iteration]->Draw("same") ;
+ corr->Update() ;
+ iteration++ ;
+ }
+
+ hcorr[5]->SetTitle("Bin-width correction for #pi^{0} spectrum");
+ hcorr[5]->SetYTitle("Bin-width corrected / uncorrected");
+ TFile fout("PHOS_pi0_7TeV_BinWidthCorrection.root","recreate") ;
+ hcorr[5]->Write();
+ fout.Close();
+
+ return hcorr[5] ;
+}
-void makeMmixPU_CB(const TString histoFile="LHC11a_pass4_20130913.root",\r
- const Int_t nSigma=2,\r
- const char* module="A10")\r
-{\r
- //Fit Real/Mixed ratio, normalize Mixed and subtract it from Real.\r
- // The pi0 peak if fitted by the Crystal Ball function, \r
- // the background is fitted by pol1 or pol2\r
-\r
- TString hMassName;\r
- TFile * file = new TFile(histoFile) ;\r
- THashList *hList = (THashList*)file->Get("histESD");\r
- char key[125] ;\r
- hMassName = "hMassPt";\r
- hMassName += module;\r
- TH2F * h = (TH2F*)hList->FindObject(hMassName) ;\r
-\r
- hMassName = "hMiMassPt";\r
- hMassName += module;\r
- TH2F * hm = (TH2F*)hList->FindObject(hMassName) ;\r
-\r
- TH1F * hev = (TH1F*)hList->FindObject("hSelEvents") ;\r
-\r
- // Array of pt bins\r
- Int_t nPadX = 6, nPadY = 3;\r
- Int_t nbin=18 ;\r
- Double_t xa[]={0.6,0.8,1.,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,3.0,3.5,4.0,5.,6.,8.,10.,12.} ;\r
- PPRstyle();\r
- gStyle->SetPadLeftMargin(0.16);\r
- gStyle->SetPadRightMargin(0.01);\r
- gStyle->SetPadTopMargin(0.02);\r
- gStyle->SetPadBottomMargin(0.11);\r
- gStyle->SetTitleX(0.80);\r
- gStyle->SetTitleY(0.98);\r
- \r
- //Fit real only \r
- //Linear Bg\r
- char key2[155];\r
- sprintf(key,"Mix_CB") ;\r
- sprintf(key2,"%s_mr1",key) ;\r
- TH1D * mr1 = new TH1D(key2,"Mass",nbin,xa) ;\r
- sprintf(key2,"%s_sr1",key) ;\r
- TH1D * sr1 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_rms1",key) ;\r
- TH1D * rms1 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_nnr1",key) ;\r
- TH1D * nnr1 = new TH1D(key2,"Mass",nbin,xa) ;\r
- sprintf(key2,"%s_ar1",key) ;\r
- TH1D * ar1 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_yr1",key) ;\r
- TH1D * nr1 = new TH1D(key2,"Raw yield",nbin,xa) ;\r
- sprintf(key2,"%s_yr1int",key) ;\r
- TH1D * nr1int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;\r
-\r
- //Quadratic Bg\r
- sprintf(key2,"%s_mr2",key) ;\r
- TH1D * mr2 = new TH1D(key2,"Mass",nbin,xa) ;\r
- sprintf(key2,"%s_sr2",key) ;\r
- TH1D * sr2 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_rms2",key) ;\r
- TH1D * rms2 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_nnr2",key) ;\r
- TH1D * nnr2 = new TH1D(key2,"Mass",nbin,xa) ;\r
- sprintf(key2,"%s_ar2",key) ;\r
- TH1D * ar2 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_yr2",key) ;\r
- TH1D * nr2 = new TH1D(key2,"Raw yield",nbin,xa) ;\r
- sprintf(key2,"%s_yr2int",key) ;\r
- TH1D * nr2int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;\r
-\r
-\r
- TF1 * fit1 = new TF1("fit",CB,0.,1.,7) ;\r
- fit->SetParName(0,"A") ;\r
- fit->SetParName(1,"m_{0}") ;\r
- fit->SetParName(2,"#sigma") ;\r
- fit->SetParName(3,"a_{0}") ;\r
- fit->SetParName(4,"a_{1}") ;\r
- fit->SetLineWidth(2) ;\r
- fit->SetLineColor(2) ;\r
-\r
- TF1 * fgs = new TF1("gs",CBs,0.,1.,5) ;\r
- fgs->SetLineColor(2) ;\r
- fgs->SetLineWidth(1) ;\r
-\r
- TF1 * fit2 = new TF1("fit2",CB2,0.,1.,8) ;\r
- fit2->SetParName(0,"A") ;\r
- fit2->SetParName(1,"m_{0}") ;\r
- fit2->SetParName(2,"#sigma") ;\r
- fit2->SetParName(3,"a_{0}") ;\r
- fit2->SetParName(4,"a_{1}") ;\r
- fit2->SetLineWidth(2) ;\r
- fit2->SetLineColor(4) ;\r
- fit2->SetLineStyle(2) ;\r
-\r
- TF1 * fbg1 = new TF1("bg1",BG1,0.,1.,2) ;\r
- TF1 * fbg2 = new TF1("bg2",BG2,0.,1.,3) ;\r
-\r
- TCanvas * c3 = new TCanvas("mggFit1_CB_Signal","mggFitCB",10,10,1400,800) ;\r
- c3->Divide(nPadX,nPadY) ;\r
-\r
- TCanvas * cReal = new TCanvas("cReal","Mgg real events",10,10,1400,800) ;\r
- cReal->Divide(nPadX,nPadY) ;\r
-\r
- TCanvas * c1 = new TCanvas("mggFit1_CB","mggFit1",10,10,1400,800) ;\r
- c1->Divide(nPadX,nPadY) ;\r
- c1->cd(0) ; \r
- TCanvas * c2=0,*c4=0,*c5=0,*c6=0 ; \r
-\r
- TAxis * pta=h->GetYaxis() ;\r
- TAxis * ma=h->GetXaxis() ;\r
- for(Int_t i=1;i<=nbin;i++){\r
- c1->cd(i) ;\r
- Int_t imin=pta->FindBin(xa[i-1]+0.0001);\r
- Int_t imax=pta->FindBin(xa[i]-0.0001) ;\r
- Double_t pt=(xa[i]+xa[i-1])/2. ;\r
- TH1D * hp = h->ProjectionX("re",imin,imax) ;\r
- hp->Sumw2() ;\r
- hp->SetNdivisions(505,"X");\r
- TH1D * hpm= hm->ProjectionX("mi",imin,imax) ;\r
- hpm->Sumw2() ;\r
- hpm->SetNdivisions(505,"X");\r
- if(i<15){\r
- hp ->Rebin(2) ;\r
- hpm->Rebin(2) ;\r
- }\r
- else{\r
- hp ->Rebin(5) ;\r
- hpm->Rebin(5) ;\r
- }\r
- hp ->SetNdivisions(506);\r
- hpm->SetNdivisions(506);\r
- hp ->SetLabelSize(0.05,"X");\r
- hpm->SetLabelSize(0.05,"X");\r
- hp ->SetTitleSize(0.00,"X");\r
- hpm->SetTitleSize(0.00,"X");\r
- hp ->SetLabelSize(0.05,"Y");\r
- hpm->SetLabelSize(0.05,"Y");\r
- hp ->SetTitleSize(0.05,"Y");\r
- hpm->SetTitleSize(0.05,"Y");\r
- hp ->SetTitleOffset(1.0,"X");\r
- hpm->SetTitleOffset(1.0,"X");\r
- if (i>12) {\r
- hp ->SetLabelSize(0.05,"X");\r
- hpm->SetLabelSize(0.05,"X");\r
- hp ->SetTitleSize(0.05,"X");\r
- hpm->SetTitleSize(0.05,"X");\r
- hp ->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");\r
- hpm->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");\r
- }\r
- // //Asign errors to the zero bins\r
- // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hp->GetBinContent(ib)==0)hp->SetBinError(ib,1.);}\r
- // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hpm->GetBinContent(ib)==0)hpm->SetBinError(ib,1.);}\r
-\r
- TH1D * hpm2 = (TH1D*)hpm->Clone("Bg1") ;\r
- TH1D * hpcopy = (TH1D*)hp ->Clone("hpcopy") ;\r
- TH1D * hp2 = (TH1D*)hp ->Clone("hp2") ;\r
- TH1D * hpReal = (TH1D*)hp ->Clone("hpReal") ;\r
- hpcopy->Divide(hpm) ;\r
- sprintf(key,"%3.1f<p_{T}<%3.1f GeV/c",xa[i-1],xa[i]) ;\r
- hpcopy->SetTitle(key) ;\r
- hpReal->SetTitle(key) ;\r
- hpReal->SetLineWidth(2);\r
- hpcopy->SetMarkerStyle(20) ;\r
- hpcopy->SetMarkerSize(0.7) ;\r
-\r
- Double_t mInit = 0.136., wInit = 0.005;\r
- if(i==1) {\r
- mInit = 0.139;\r
- wInit = 0.007;\r
- }\r
- if(i==2) {\r
- mInit = 0.136;\r
- wInit = 0.007;\r
- }\r
- fit1->SetParameters(0.001,mInit,wInit,9.,0.5,0.0013,0.) ;\r
- fit1->SetParLimits(2,0.003,0.010) ;\r
- fit1->SetParLimits(1,0.132,0.139) ;\r
- fit1->SetParLimits(0,0.,1e+6) ;\r
-// fit1->SetParLimits(3,0.,10.) ;\r
-// fit1->SetParLimits(4,0.,1e+2) ;\r
- fit1->FixParameter(3,1.60) ;\r
- fit1->FixParameter(4,1.27) ;\r
-\r
- //Select fitting range\r
- Double_t rangeMin=0.06 ;\r
- Double_t rangeMax=0.22 ;\r
- if(i>=16)rangeMax=0.3 ; //More points to fix background\r
- hpcopy->Fit(fit1,"NQ","",rangeMin,rangeMax) ;\r
- hpcopy->Fit(fit1,"MQ","",rangeMin,rangeMax) ;\r
-\r
- fit2->SetParameters(fit1->GetParameters()) ;\r
- fit2->SetParameter(2,wInit);\r
- fit2->SetParLimits(2,0.003,0.008) ;\r
- fit2->SetParLimits(1,0.130,0.142) ;\r
- fit2->SetParLimits(0,0.,1e+6) ;\r
-// fit2->SetParLimits(3,0.,10.) ;\r
-// fit2->SetParLimits(4,0.,1e+2) ;\r
- fit2->FixParameter(3,1.60) ;\r
- fit2->FixParameter(4,1.27) ;\r
- fit2->SetParameter(7,0.) ;\r
-\r
- hpcopy->Fit(fit2,"+NQ","",rangeMin,rangeMax) ;\r
- hpcopy->Fit(fit2,"+MQ","",rangeMin,rangeMax) ;\r
-\r
- c1->cd(i) ;\r
- hpcopy->SetAxisRange(0.065,0.229,"X") ;\r
- hpcopy->Draw() ;\r
-\r
- cReal->cd(i) ;\r
- hpReal->SetAxisRange(0.065,0.229,"X") ;\r
- hpReal->Draw("ehist") ;\r
-\r
- fbg1->SetParameters(fit1->GetParameter(5),fit1->GetParameter(6)); \r
- fbg2->SetParameters(fit2->GetParameter(5),fit2->GetParameter(6),fit2->GetParameter(7)); \r
- Double_t intRangeMin = PeakPosition(pt)-nSigma*PeakWidth(pt) ;\r
- Double_t intRangeMax = PeakPosition(pt)+nSigma*PeakWidth(pt) ;\r
- Int_t intBinMin = hp->GetXaxis()->FindBin(intRangeMin) ;\r
- Int_t intBinMax = hp->GetXaxis()->FindBin(intRangeMax) ;\r
- Double_t errStat = hpm->Integral(intBinMin,intBinMax); \r
-\r
- hpm ->Multiply(fbg1) ;\r
- hpm2->Multiply(fbg2) ;\r
- hp ->Add(hpm,-1.) ;\r
- hp2 ->Add(hpm2,-1.) ;\r
-\r
- c3->cd(i) ;\r
-\r
- if(i<15)\r
- fgs->SetParameters(hp->Integral(32,36)/5.,fit1->GetParameter(1),fit1->GetParameter(2),fit1->GetParameter(3),fit1->GetParameter(4)) ;\r
- else\r
- fgs->SetParameters(hp->Integral(13,15)/3.,fit1->GetParameter(1),fit1->GetParameter(2),fit1->GetParameter(3),fit1->GetParameter(4)) ;\r
-// fgs->SetParameters(hp->Integral(13,15)/3.,0.135,0.008,0.7,2.) ;\r
-\r
- fgs->SetParLimits(0,0.,1e+06) ;\r
- fgs->SetParLimits(1,0.130,0.142) ;\r
- fgs->SetParLimits(2,0.003,0.008) ;\r
- fgs->FixParameter(3,1.60) ;\r
- fgs->FixParameter(4,1.27) ;\r
- \r
- hp->Fit(fgs,"Q","",rangeMin,rangeMax) ; \r
- hp->SetMaximum(hp2->GetMaximum()*1.1) ;\r
- hp->SetMinimum(hp2->GetMinimum()*1.1) ;\r
- hp->SetMarkerStyle(20) ;\r
- hp->SetMarkerSize(0.7) ;\r
- mr1->SetBinContent (i,fgs->GetParameter(1)) ;\r
- mr1->SetBinError (i,fgs->GetParError(1)) ;\r
- sr1->SetBinContent (i,TMath::Abs(fgs->GetParameter(2))) ;\r
- sr1->SetBinError (i,fgs->GetParError(2)) ;\r
- nnr1->SetBinContent(i,fgs->GetParameter(3)) ;\r
- nnr1->SetBinError (i,fgs->GetParError(3)) ;\r
- ar1->SetBinContent (i,fgs->GetParameter(4)) ;\r
- ar1->SetBinError (i,fgs->GetParError(4)) ;\r
-\r
- Double_t y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;\r
- nr1->SetBinContent(i,y) ;\r
- if(y>0)\r
- rms1->SetBinContent(i,fgs->CentralMoment(2.,0.05,0.2)) ;\r
- Double_t ey=0 ;\r
- if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){\r
- Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;\r
- Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;\r
- ey=y*TMath::Sqrt(en*en+es*es) ;\r
- }\r
- nr1->SetBinError(i,ey) ;\r
-\r
- Double_t npiInt=hp->Integral(intBinMin,intBinMax) ;\r
- Double_t norm=fbg1->GetParameter(0) ;\r
- Double_t normErr=fbg1->GetParError(0) ;\r
- if(npiInt>0.){\r
- nr1int->SetBinContent(i,npiInt) ;\r
- nr1int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;\r
- }\r
-\r
- hp2->GetXaxis()->SetRangeUser(0.05,0.25) ;\r
- hp2->SetMaximum(hp2->GetMaximum()*1.1) ;\r
- hp2->SetMinimum(hp2->GetMinimum()*1.1) ;\r
- hp2->SetMarkerStyle(20) ;\r
- hp2->SetMarkerSize(0.7) ;\r
-\r
- hp2->Fit(fgs,"Q","",rangeMin,rangeMax) ;\r
- mr2->SetBinContent (i,fgs->GetParameter(1)) ;\r
- mr2->SetBinError (i,fgs->GetParError(1)) ;\r
- sr2->SetBinContent (i,TMath::Abs(fgs->GetParameter(2))) ;\r
- sr2->SetBinError (i,fgs->GetParError(2)) ;\r
- nnr2->SetBinContent(i,fgs->GetParameter(3)) ;\r
- nnr2->SetBinError (i,fgs->GetParError(3)) ;\r
- ar2->SetBinContent (i,fgs->GetParameter(4)) ;\r
- ar2->SetBinError (i,fgs->GetParError(4)) ;\r
-\r
- y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;\r
- nr2->SetBinContent(i,y) ;\r
- ey=0 ;\r
- if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){\r
- Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;\r
- Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;\r
- ey=y*TMath::Sqrt(en*en+es*es) ;\r
- }\r
- nr2->SetBinError(i,ey) ;\r
- npiInt=hp2->Integral(intBinMin,intBinMax) ;\r
- norm=fbg2->GetParameter(0) ;\r
- normErr=fbg2->GetParError(0) ;\r
- if(npiInt>0.){\r
- nr2int->SetBinContent(i,npiInt) ;\r
- nr2int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;\r
- } \r
-\r
- hp2->SetTitle(key) ;\r
- hp2->SetAxisRange(0.065,0.229,"X") ;\r
- hp2->Draw() ;\r
- delete hp ;\r
-// delete hp2 ;\r
-// delete hpcopy ;\r
- delete hpm ;\r
- delete hpm2 ;\r
- c1->Update() ;\r
- c3->Update() ;\r
- cReal->Update() ;\r
- }\r
-\r
- if (c3) c3->Print("Pi0_Signal_CB.eps") ;\r
- if (c1) c1->Print("Pi0_Ratio_CB.eps") ;\r
- if (cReal) cReal->Print("Pi0_InvMass_CB.eps") ;\r
-\r
- //Normalize by the number of non-pileup events\r
- Double_t nMBOR = hev->GetBinContent(2); // MBOR events pass4\r
- // Double_t nPU = hev->GetBinContent(7);\r
- // Double_t nMBOR = hev->GetBinContent(1); // MBOR events pass3\r
- // Double_t nPU = hev->GetBinContent(6);\r
- Double_t nevents = nMBOR;\r
- // Double_t nevents = nMBOR - nPU;\r
- printf("==============\nN events = %d\n==============\n",nevents);\r
-\r
- nr1 ->Scale(1./nevents) ;\r
- nr1int->Scale(1./nevents) ;\r
- nr2 ->Scale(1./nevents) ;\r
- nr2int->Scale(1./nevents) ;\r
-\r
-\r
- TFile fout("LHC11a_FitResult.root","update");\r
- mr1 ->Write(0,TObject::kOverwrite) ;\r
- sr1 ->Write(0,TObject::kOverwrite) ;\r
- rms1 ->Write(0,TObject::kOverwrite) ;\r
- nnr1 ->Write(0,TObject::kOverwrite) ;\r
- ar1 ->Write(0,TObject::kOverwrite) ;\r
- nr1 ->Write(0,TObject::kOverwrite) ;\r
- nr1int->Write(0,TObject::kOverwrite) ;\r
- mr2 ->Write(0,TObject::kOverwrite) ;\r
- sr2 ->Write(0,TObject::kOverwrite) ;\r
- rms2 ->Write(0,TObject::kOverwrite) ;\r
- nnr2 ->Write(0,TObject::kOverwrite) ;\r
- ar2 ->Write(0,TObject::kOverwrite) ;\r
- nr2 ->Write(0,TObject::kOverwrite) ;\r
- nr2int->Write(0,TObject::kOverwrite) ;\r
- fout.Close() ;\r
-\r
-}\r
-\r
-\r
-//-----------------------------------------------------------------------------\r
-const Double_t kMean=0.135 ; //Approximate peak position to facilitate error estimate\r
-\r
-Double_t PeakPosition(Double_t pt){\r
- //Fit to the measured peak position\r
- // return 4.99292e-003*exp(-pt*9.32300e-001)+1.34944e-001 ;\r
- return 0.57*exp(-pt*7.62)+0.13592 ;\r
-}\r
-Double_t PeakWidth(Double_t pt){\r
- //fit to the measured peak width\r
- return 1.60935e-02*exp(-pt*2.25609e+00)+4.65743e-03 ;\r
- // return 0.0068 ;\r
-}\r
- \r
-Double_t CB(Double_t * x, Double_t * par){\r
- Double_t m=par[1] ;\r
- Double_t s=par[2] ;\r
- Double_t n=par[3] ;\r
- Double_t a=par[4] ;\r
- Double_t dx=(x[0]-m)/s ;\r
- if(dx>-a)\r
- return par[0]*exp(-dx*dx/2.)+par[5]+par[6]*(x[0]-kMean) ;\r
- else{\r
- Double_t A=TMath::Power((n/TMath::Abs(a)),n)*TMath::Exp(-a*a/2) ;\r
- Double_t B=n/TMath::Abs(a)-TMath::Abs(a) ;\r
- return par[0]*A*TMath::Power((B-dx),-n)+par[5]+par[6]*(x[0]-kMean) ;\r
- }\r
-\r
-}\r
-Double_t CB2(Double_t * x, Double_t * par){\r
- Double_t m=par[1] ;\r
- Double_t s=par[2] ;\r
- Double_t n=par[3] ;\r
- Double_t a=par[4] ;\r
- Double_t dx=(x[0]-m)/s ;\r
- if(dx>-a)\r
- return par[0]*exp(-dx*dx/2.)+par[5]+par[6]*(x[0]-kMean)+par[7]*(x[0]-kMean)*(x[0]-kMean) ;\r
- else{\r
- Double_t A=TMath::Power((n/TMath::Abs(a)),n)*TMath::Exp(-a*a/2) ;\r
- Double_t B=n/TMath::Abs(a)-TMath::Abs(a) ;\r
- return par[0]*A*TMath::Power((B-dx),-n)+par[5]+par[6]*(x[0]-kMean)+par[7]*(x[0]-kMean)*(x[0]-kMean) ;\r
- }\r
-\r
-}\r
-Double_t CBs(Double_t * x, Double_t * par){\r
- Double_t m=par[1] ;\r
- Double_t s=par[2] ;\r
- Double_t n=par[3] ;\r
- Double_t a=par[4] ;\r
- Double_t dx=(x[0]-m)/s ;\r
- if(dx>-a)\r
- return par[0]*exp(-dx*dx/2.) ;\r
- else{\r
- Double_t A=TMath::Power((n/TMath::Abs(a)),n)*TMath::Exp(-a*a/2) ;\r
- Double_t B=n/TMath::Abs(a)-TMath::Abs(a) ;\r
- return par[0]*A*TMath::Power((B-dx),-n) ;\r
- }\r
-}\r
-Double_t BG1(Double_t * x, Double_t * par){\r
- //Normalizatino of Mixed\r
- return par[0]+par[1]*(x[0]-kMean) ;\r
-}\r
-Double_t BG2(Double_t * x, Double_t * par){\r
- //Another normalization of Mixed\r
- return par[0]+par[1]*(x[0]-kMean)+par[2]*(x[0]-kMean)*(x[0]-kMean) ;\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-PPRstyle()\r
-{\r
-\r
- //////////////////////////////////////////////////////////////////////\r
- //\r
- // ROOT style macro for the TRD TDR\r
- //\r
- //////////////////////////////////////////////////////////////////////\r
-\r
- gStyle->SetPalette(1);\r
- gStyle->SetCanvasBorderMode(-1);\r
- gStyle->SetCanvasBorderSize(1);\r
- gStyle->SetCanvasColor(10);\r
-\r
- gStyle->SetFrameFillColor(10);\r
- gStyle->SetFrameBorderSize(1);\r
- gStyle->SetFrameBorderMode(-1);\r
- gStyle->SetFrameLineWidth(1.2);\r
- gStyle->SetFrameLineColor(1);\r
-\r
- gStyle->SetHistFillColor(0);\r
- gStyle->SetHistLineWidth(1);\r
- gStyle->SetHistLineColor(1);\r
-\r
- gStyle->SetPadColor(10);\r
- gStyle->SetPadBorderSize(1);\r
- gStyle->SetPadBorderMode(-1);\r
-\r
- gStyle->SetStatColor(10);\r
- gStyle->SetTitleColor(kBlack,"X");\r
- gStyle->SetTitleColor(kBlack,"Y");\r
-\r
- gStyle->SetLabelSize(0.04,"X");\r
- gStyle->SetLabelSize(0.04,"Y");\r
- gStyle->SetLabelSize(0.04,"Z");\r
- gStyle->SetTitleSize(0.04,"X");\r
- gStyle->SetTitleSize(0.04,"Y");\r
- gStyle->SetTitleSize(0.04,"Z");\r
- gStyle->SetTitleFont(42,"X");\r
- gStyle->SetTitleFont(42,"Y");\r
- gStyle->SetTitleFont(42,"X");\r
- gStyle->SetLabelFont(42,"X");\r
- gStyle->SetLabelFont(42,"Y");\r
- gStyle->SetLabelFont(42,"Z");\r
- gStyle->SetStatFont(42);\r
-\r
- gStyle->SetTitleOffset(1.0,"X");\r
- gStyle->SetTitleOffset(1.4,"Y");\r
-\r
- gStyle->SetFillColor(kWhite);\r
- gStyle->SetTitleFillColor(kWhite);\r
-\r
- gStyle->SetOptDate(0);\r
- gStyle->SetOptTitle(1);\r
- gStyle->SetOptStat(0);\r
- gStyle->SetOptFit(0);\r
-\r
-}\r
-\r
+void makeMmixPU_CB(const TString histoFile="LHC11a_pass4_20130913.root",
+ const Int_t nSigma=2,
+ const char* module="A10")
+{
+ //Fit Real/Mixed ratio, normalize Mixed and subtract it from Real.
+ // The pi0 peak if fitted by the Crystal Ball function,
+ // the background is fitted by pol1 or pol2
+
+ TString hMassName;
+ TFile * file = new TFile(histoFile) ;
+ THashList *hList = (THashList*)file->Get("histESD");
+ char key[125] ;
+ hMassName = "hMassPt";
+ hMassName += module;
+ TH2F * h = (TH2F*)hList->FindObject(hMassName) ;
+
+ hMassName = "hMiMassPt";
+ hMassName += module;
+ TH2F * hm = (TH2F*)hList->FindObject(hMassName) ;
+
+ TH1F * hev = (TH1F*)hList->FindObject("hSelEvents") ;
+
+ // Array of pt bins
+ Int_t nPadX = 6, nPadY = 3;
+ Int_t nbin=18 ;
+ Double_t xa[]={0.6,0.8,1.,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,3.0,3.5,4.0,5.,6.,8.,10.,12.} ;
+ PPRstyle();
+ gStyle->SetPadLeftMargin(0.16);
+ gStyle->SetPadRightMargin(0.01);
+ gStyle->SetPadTopMargin(0.02);
+ gStyle->SetPadBottomMargin(0.11);
+ gStyle->SetTitleX(0.80);
+ gStyle->SetTitleY(0.98);
+
+ //Fit real only
+ //Linear Bg
+ char key2[155];
+ sprintf(key,"Mix_CB") ;
+ sprintf(key2,"%s_mr1",key) ;
+ TH1D * mr1 = new TH1D(key2,"Mass",nbin,xa) ;
+ sprintf(key2,"%s_sr1",key) ;
+ TH1D * sr1 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_rms1",key) ;
+ TH1D * rms1 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_nnr1",key) ;
+ TH1D * nnr1 = new TH1D(key2,"Mass",nbin,xa) ;
+ sprintf(key2,"%s_ar1",key) ;
+ TH1D * ar1 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_yr1",key) ;
+ TH1D * nr1 = new TH1D(key2,"Raw yield",nbin,xa) ;
+ sprintf(key2,"%s_yr1int",key) ;
+ TH1D * nr1int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;
+
+ //Quadratic Bg
+ sprintf(key2,"%s_mr2",key) ;
+ TH1D * mr2 = new TH1D(key2,"Mass",nbin,xa) ;
+ sprintf(key2,"%s_sr2",key) ;
+ TH1D * sr2 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_rms2",key) ;
+ TH1D * rms2 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_nnr2",key) ;
+ TH1D * nnr2 = new TH1D(key2,"Mass",nbin,xa) ;
+ sprintf(key2,"%s_ar2",key) ;
+ TH1D * ar2 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_yr2",key) ;
+ TH1D * nr2 = new TH1D(key2,"Raw yield",nbin,xa) ;
+ sprintf(key2,"%s_yr2int",key) ;
+ TH1D * nr2int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;
+
+
+ TF1 * fit1 = new TF1("fit",CB,0.,1.,7) ;
+ fit->SetParName(0,"A") ;
+ fit->SetParName(1,"m_{0}") ;
+ fit->SetParName(2,"#sigma") ;
+ fit->SetParName(3,"a_{0}") ;
+ fit->SetParName(4,"a_{1}") ;
+ fit->SetLineWidth(2) ;
+ fit->SetLineColor(2) ;
+
+ TF1 * fgs = new TF1("gs",CBs,0.,1.,5) ;
+ fgs->SetLineColor(2) ;
+ fgs->SetLineWidth(1) ;
+
+ TF1 * fit2 = new TF1("fit2",CB2,0.,1.,8) ;
+ fit2->SetParName(0,"A") ;
+ fit2->SetParName(1,"m_{0}") ;
+ fit2->SetParName(2,"#sigma") ;
+ fit2->SetParName(3,"a_{0}") ;
+ fit2->SetParName(4,"a_{1}") ;
+ fit2->SetLineWidth(2) ;
+ fit2->SetLineColor(4) ;
+ fit2->SetLineStyle(2) ;
+
+ TF1 * fbg1 = new TF1("bg1",BG1,0.,1.,2) ;
+ TF1 * fbg2 = new TF1("bg2",BG2,0.,1.,3) ;
+
+ TCanvas * c3 = new TCanvas("mggFit1_CB_Signal","mggFitCB",10,10,1400,800) ;
+ c3->Divide(nPadX,nPadY) ;
+
+ TCanvas * cReal = new TCanvas("cReal","Mgg real events",10,10,1400,800) ;
+ cReal->Divide(nPadX,nPadY) ;
+
+ TCanvas * c1 = new TCanvas("mggFit1_CB","mggFit1",10,10,1400,800) ;
+ c1->Divide(nPadX,nPadY) ;
+ c1->cd(0) ;
+ TCanvas * c2=0,*c4=0,*c5=0,*c6=0 ;
+
+ TAxis * pta=h->GetYaxis() ;
+ TAxis * ma=h->GetXaxis() ;
+ for(Int_t i=1;i<=nbin;i++){
+ c1->cd(i) ;
+ Int_t imin=pta->FindBin(xa[i-1]+0.0001);
+ Int_t imax=pta->FindBin(xa[i]-0.0001) ;
+ Double_t pt=(xa[i]+xa[i-1])/2. ;
+ TH1D * hp = h->ProjectionX("re",imin,imax) ;
+ hp->Sumw2() ;
+ hp->SetNdivisions(505,"X");
+ TH1D * hpm= hm->ProjectionX("mi",imin,imax) ;
+ hpm->Sumw2() ;
+ hpm->SetNdivisions(505,"X");
+ if(i<15){
+ hp ->Rebin(2) ;
+ hpm->Rebin(2) ;
+ }
+ else{
+ hp ->Rebin(5) ;
+ hpm->Rebin(5) ;
+ }
+ hp ->SetNdivisions(506);
+ hpm->SetNdivisions(506);
+ hp ->SetLabelSize(0.05,"X");
+ hpm->SetLabelSize(0.05,"X");
+ hp ->SetTitleSize(0.00,"X");
+ hpm->SetTitleSize(0.00,"X");
+ hp ->SetLabelSize(0.05,"Y");
+ hpm->SetLabelSize(0.05,"Y");
+ hp ->SetTitleSize(0.05,"Y");
+ hpm->SetTitleSize(0.05,"Y");
+ hp ->SetTitleOffset(1.0,"X");
+ hpm->SetTitleOffset(1.0,"X");
+ if (i>12) {
+ hp ->SetLabelSize(0.05,"X");
+ hpm->SetLabelSize(0.05,"X");
+ hp ->SetTitleSize(0.05,"X");
+ hpm->SetTitleSize(0.05,"X");
+ hp ->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");
+ hpm->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");
+ }
+ // //Asign errors to the zero bins
+ // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hp->GetBinContent(ib)==0)hp->SetBinError(ib,1.);}
+ // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hpm->GetBinContent(ib)==0)hpm->SetBinError(ib,1.);}
+
+ TH1D * hpm2 = (TH1D*)hpm->Clone("Bg1") ;
+ TH1D * hpcopy = (TH1D*)hp ->Clone("hpcopy") ;
+ TH1D * hp2 = (TH1D*)hp ->Clone("hp2") ;
+ TH1D * hpReal = (TH1D*)hp ->Clone("hpReal") ;
+ hpcopy->Divide(hpm) ;
+ sprintf(key,"%3.1f<p_{T}<%3.1f GeV/c",xa[i-1],xa[i]) ;
+ hpcopy->SetTitle(key) ;
+ hpReal->SetTitle(key) ;
+ hpReal->SetLineWidth(2);
+ hpcopy->SetMarkerStyle(20) ;
+ hpcopy->SetMarkerSize(0.7) ;
+
+ Double_t mInit = 0.136., wInit = 0.005;
+ if(i==1) {
+ mInit = 0.139;
+ wInit = 0.007;
+ }
+ if(i==2) {
+ mInit = 0.136;
+ wInit = 0.007;
+ }
+ fit1->SetParameters(0.001,mInit,wInit,9.,0.5,0.0013,0.) ;
+ fit1->SetParLimits(2,0.003,0.010) ;
+ fit1->SetParLimits(1,0.132,0.139) ;
+ fit1->SetParLimits(0,0.,1e+6) ;
+// fit1->SetParLimits(3,0.,10.) ;
+// fit1->SetParLimits(4,0.,1e+2) ;
+ fit1->FixParameter(3,1.60) ;
+ fit1->FixParameter(4,1.27) ;
+
+ //Select fitting range
+ Double_t rangeMin=0.06 ;
+ Double_t rangeMax=0.22 ;
+ if(i>=16)rangeMax=0.3 ; //More points to fix background
+ hpcopy->Fit(fit1,"NQ","",rangeMin,rangeMax) ;
+ hpcopy->Fit(fit1,"MQ","",rangeMin,rangeMax) ;
+
+ fit2->SetParameters(fit1->GetParameters()) ;
+ fit2->SetParameter(2,wInit);
+ fit2->SetParLimits(2,0.003,0.008) ;
+ fit2->SetParLimits(1,0.130,0.142) ;
+ fit2->SetParLimits(0,0.,1e+6) ;
+// fit2->SetParLimits(3,0.,10.) ;
+// fit2->SetParLimits(4,0.,1e+2) ;
+ fit2->FixParameter(3,1.60) ;
+ fit2->FixParameter(4,1.27) ;
+ fit2->SetParameter(7,0.) ;
+
+ hpcopy->Fit(fit2,"+NQ","",rangeMin,rangeMax) ;
+ hpcopy->Fit(fit2,"+MQ","",rangeMin,rangeMax) ;
+
+ c1->cd(i) ;
+ hpcopy->SetAxisRange(0.065,0.229,"X") ;
+ hpcopy->Draw() ;
+
+ cReal->cd(i) ;
+ hpReal->SetAxisRange(0.065,0.229,"X") ;
+ hpReal->Draw("ehist") ;
+
+ fbg1->SetParameters(fit1->GetParameter(5),fit1->GetParameter(6));
+ fbg2->SetParameters(fit2->GetParameter(5),fit2->GetParameter(6),fit2->GetParameter(7));
+ Double_t intRangeMin = PeakPosition(pt)-nSigma*PeakWidth(pt) ;
+ Double_t intRangeMax = PeakPosition(pt)+nSigma*PeakWidth(pt) ;
+ Int_t intBinMin = hp->GetXaxis()->FindBin(intRangeMin) ;
+ Int_t intBinMax = hp->GetXaxis()->FindBin(intRangeMax) ;
+ Double_t errStat = hpm->Integral(intBinMin,intBinMax);
+
+ hpm ->Multiply(fbg1) ;
+ hpm2->Multiply(fbg2) ;
+ hp ->Add(hpm,-1.) ;
+ hp2 ->Add(hpm2,-1.) ;
+
+ c3->cd(i) ;
+
+ if(i<15)
+ fgs->SetParameters(hp->Integral(32,36)/5.,fit1->GetParameter(1),fit1->GetParameter(2),fit1->GetParameter(3),fit1->GetParameter(4)) ;
+ else
+ fgs->SetParameters(hp->Integral(13,15)/3.,fit1->GetParameter(1),fit1->GetParameter(2),fit1->GetParameter(3),fit1->GetParameter(4)) ;
+// fgs->SetParameters(hp->Integral(13,15)/3.,0.135,0.008,0.7,2.) ;
+
+ fgs->SetParLimits(0,0.,1e+06) ;
+ fgs->SetParLimits(1,0.130,0.142) ;
+ fgs->SetParLimits(2,0.003,0.008) ;
+ fgs->FixParameter(3,1.60) ;
+ fgs->FixParameter(4,1.27) ;
+
+ hp->Fit(fgs,"Q","",rangeMin,rangeMax) ;
+ hp->SetMaximum(hp2->GetMaximum()*1.1) ;
+ hp->SetMinimum(hp2->GetMinimum()*1.1) ;
+ hp->SetMarkerStyle(20) ;
+ hp->SetMarkerSize(0.7) ;
+ mr1->SetBinContent (i,fgs->GetParameter(1)) ;
+ mr1->SetBinError (i,fgs->GetParError(1)) ;
+ sr1->SetBinContent (i,TMath::Abs(fgs->GetParameter(2))) ;
+ sr1->SetBinError (i,fgs->GetParError(2)) ;
+ nnr1->SetBinContent(i,fgs->GetParameter(3)) ;
+ nnr1->SetBinError (i,fgs->GetParError(3)) ;
+ ar1->SetBinContent (i,fgs->GetParameter(4)) ;
+ ar1->SetBinError (i,fgs->GetParError(4)) ;
+
+ Double_t y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;
+ nr1->SetBinContent(i,y) ;
+ if(y>0)
+ rms1->SetBinContent(i,fgs->CentralMoment(2.,0.05,0.2)) ;
+ Double_t ey=0 ;
+ if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){
+ Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;
+ Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;
+ ey=y*TMath::Sqrt(en*en+es*es) ;
+ }
+ nr1->SetBinError(i,ey) ;
+
+ Double_t npiInt=hp->Integral(intBinMin,intBinMax) ;
+ Double_t norm=fbg1->GetParameter(0) ;
+ Double_t normErr=fbg1->GetParError(0) ;
+ if(npiInt>0.){
+ nr1int->SetBinContent(i,npiInt) ;
+ nr1int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;
+ }
+
+ hp2->GetXaxis()->SetRangeUser(0.05,0.25) ;
+ hp2->SetMaximum(hp2->GetMaximum()*1.1) ;
+ hp2->SetMinimum(hp2->GetMinimum()*1.1) ;
+ hp2->SetMarkerStyle(20) ;
+ hp2->SetMarkerSize(0.7) ;
+
+ hp2->Fit(fgs,"Q","",rangeMin,rangeMax) ;
+ mr2->SetBinContent (i,fgs->GetParameter(1)) ;
+ mr2->SetBinError (i,fgs->GetParError(1)) ;
+ sr2->SetBinContent (i,TMath::Abs(fgs->GetParameter(2))) ;
+ sr2->SetBinError (i,fgs->GetParError(2)) ;
+ nnr2->SetBinContent(i,fgs->GetParameter(3)) ;
+ nnr2->SetBinError (i,fgs->GetParError(3)) ;
+ ar2->SetBinContent (i,fgs->GetParameter(4)) ;
+ ar2->SetBinError (i,fgs->GetParError(4)) ;
+
+ y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;
+ nr2->SetBinContent(i,y) ;
+ ey=0 ;
+ if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){
+ Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;
+ Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;
+ ey=y*TMath::Sqrt(en*en+es*es) ;
+ }
+ nr2->SetBinError(i,ey) ;
+ npiInt=hp2->Integral(intBinMin,intBinMax) ;
+ norm=fbg2->GetParameter(0) ;
+ normErr=fbg2->GetParError(0) ;
+ if(npiInt>0.){
+ nr2int->SetBinContent(i,npiInt) ;
+ nr2int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;
+ }
+
+ hp2->SetTitle(key) ;
+ hp2->SetAxisRange(0.065,0.229,"X") ;
+ hp2->Draw() ;
+ delete hp ;
+// delete hp2 ;
+// delete hpcopy ;
+ delete hpm ;
+ delete hpm2 ;
+ c1->Update() ;
+ c3->Update() ;
+ cReal->Update() ;
+ }
+
+ if (c3) c3->Print("Pi0_Signal_CB.eps") ;
+ if (c1) c1->Print("Pi0_Ratio_CB.eps") ;
+ if (cReal) cReal->Print("Pi0_InvMass_CB.eps") ;
+
+ //Normalize by the number of non-pileup events
+ Double_t nMBOR = hev->GetBinContent(2); // MBOR events pass4
+ // Double_t nPU = hev->GetBinContent(7);
+ // Double_t nMBOR = hev->GetBinContent(1); // MBOR events pass3
+ // Double_t nPU = hev->GetBinContent(6);
+ Double_t nevents = nMBOR;
+ // Double_t nevents = nMBOR - nPU;
+ printf("==============\nN events = %d\n==============\n",nevents);
+
+ nr1 ->Scale(1./nevents) ;
+ nr1int->Scale(1./nevents) ;
+ nr2 ->Scale(1./nevents) ;
+ nr2int->Scale(1./nevents) ;
+
+
+ TFile fout("LHC11a_FitResult.root","update");
+ mr1 ->Write(0,TObject::kOverwrite) ;
+ sr1 ->Write(0,TObject::kOverwrite) ;
+ rms1 ->Write(0,TObject::kOverwrite) ;
+ nnr1 ->Write(0,TObject::kOverwrite) ;
+ ar1 ->Write(0,TObject::kOverwrite) ;
+ nr1 ->Write(0,TObject::kOverwrite) ;
+ nr1int->Write(0,TObject::kOverwrite) ;
+ mr2 ->Write(0,TObject::kOverwrite) ;
+ sr2 ->Write(0,TObject::kOverwrite) ;
+ rms2 ->Write(0,TObject::kOverwrite) ;
+ nnr2 ->Write(0,TObject::kOverwrite) ;
+ ar2 ->Write(0,TObject::kOverwrite) ;
+ nr2 ->Write(0,TObject::kOverwrite) ;
+ nr2int->Write(0,TObject::kOverwrite) ;
+ fout.Close() ;
+
+}
+
+
+//-----------------------------------------------------------------------------
+const Double_t kMean=0.135 ; //Approximate peak position to facilitate error estimate
+
+Double_t PeakPosition(Double_t pt){
+ //Fit to the measured peak position
+ // return 4.99292e-003*exp(-pt*9.32300e-001)+1.34944e-001 ;
+ return 0.57*exp(-pt*7.62)+0.13592 ;
+}
+Double_t PeakWidth(Double_t pt){
+ //fit to the measured peak width
+ return 1.60935e-02*exp(-pt*2.25609e+00)+4.65743e-03 ;
+ // return 0.0068 ;
+}
+
+Double_t CB(Double_t * x, Double_t * par){
+ Double_t m=par[1] ;
+ Double_t s=par[2] ;
+ Double_t n=par[3] ;
+ Double_t a=par[4] ;
+ Double_t dx=(x[0]-m)/s ;
+ if(dx>-a)
+ return par[0]*exp(-dx*dx/2.)+par[5]+par[6]*(x[0]-kMean) ;
+ else{
+ Double_t A=TMath::Power((n/TMath::Abs(a)),n)*TMath::Exp(-a*a/2) ;
+ Double_t B=n/TMath::Abs(a)-TMath::Abs(a) ;
+ return par[0]*A*TMath::Power((B-dx),-n)+par[5]+par[6]*(x[0]-kMean) ;
+ }
+
+}
+Double_t CB2(Double_t * x, Double_t * par){
+ Double_t m=par[1] ;
+ Double_t s=par[2] ;
+ Double_t n=par[3] ;
+ Double_t a=par[4] ;
+ Double_t dx=(x[0]-m)/s ;
+ if(dx>-a)
+ return par[0]*exp(-dx*dx/2.)+par[5]+par[6]*(x[0]-kMean)+par[7]*(x[0]-kMean)*(x[0]-kMean) ;
+ else{
+ Double_t A=TMath::Power((n/TMath::Abs(a)),n)*TMath::Exp(-a*a/2) ;
+ Double_t B=n/TMath::Abs(a)-TMath::Abs(a) ;
+ return par[0]*A*TMath::Power((B-dx),-n)+par[5]+par[6]*(x[0]-kMean)+par[7]*(x[0]-kMean)*(x[0]-kMean) ;
+ }
+
+}
+Double_t CBs(Double_t * x, Double_t * par){
+ Double_t m=par[1] ;
+ Double_t s=par[2] ;
+ Double_t n=par[3] ;
+ Double_t a=par[4] ;
+ Double_t dx=(x[0]-m)/s ;
+ if(dx>-a)
+ return par[0]*exp(-dx*dx/2.) ;
+ else{
+ Double_t A=TMath::Power((n/TMath::Abs(a)),n)*TMath::Exp(-a*a/2) ;
+ Double_t B=n/TMath::Abs(a)-TMath::Abs(a) ;
+ return par[0]*A*TMath::Power((B-dx),-n) ;
+ }
+}
+Double_t BG1(Double_t * x, Double_t * par){
+ //Normalizatino of Mixed
+ return par[0]+par[1]*(x[0]-kMean) ;
+}
+Double_t BG2(Double_t * x, Double_t * par){
+ //Another normalization of Mixed
+ return par[0]+par[1]*(x[0]-kMean)+par[2]*(x[0]-kMean)*(x[0]-kMean) ;
+}
+
+//-----------------------------------------------------------------------------
+PPRstyle()
+{
+
+ //////////////////////////////////////////////////////////////////////
+ //
+ // ROOT style macro for the TRD TDR
+ //
+ //////////////////////////////////////////////////////////////////////
+
+ gStyle->SetPalette(1);
+ gStyle->SetCanvasBorderMode(-1);
+ gStyle->SetCanvasBorderSize(1);
+ gStyle->SetCanvasColor(10);
+
+ gStyle->SetFrameFillColor(10);
+ gStyle->SetFrameBorderSize(1);
+ gStyle->SetFrameBorderMode(-1);
+ gStyle->SetFrameLineWidth(1.2);
+ gStyle->SetFrameLineColor(1);
+
+ gStyle->SetHistFillColor(0);
+ gStyle->SetHistLineWidth(1);
+ gStyle->SetHistLineColor(1);
+
+ gStyle->SetPadColor(10);
+ gStyle->SetPadBorderSize(1);
+ gStyle->SetPadBorderMode(-1);
+
+ gStyle->SetStatColor(10);
+ gStyle->SetTitleColor(kBlack,"X");
+ gStyle->SetTitleColor(kBlack,"Y");
+
+ gStyle->SetLabelSize(0.04,"X");
+ gStyle->SetLabelSize(0.04,"Y");
+ gStyle->SetLabelSize(0.04,"Z");
+ gStyle->SetTitleSize(0.04,"X");
+ gStyle->SetTitleSize(0.04,"Y");
+ gStyle->SetTitleSize(0.04,"Z");
+ gStyle->SetTitleFont(42,"X");
+ gStyle->SetTitleFont(42,"Y");
+ gStyle->SetTitleFont(42,"X");
+ gStyle->SetLabelFont(42,"X");
+ gStyle->SetLabelFont(42,"Y");
+ gStyle->SetLabelFont(42,"Z");
+ gStyle->SetStatFont(42);
+
+ gStyle->SetTitleOffset(1.0,"X");
+ gStyle->SetTitleOffset(1.4,"Y");
+
+ gStyle->SetFillColor(kWhite);
+ gStyle->SetTitleFillColor(kWhite);
+
+ gStyle->SetOptDate(0);
+ gStyle->SetOptTitle(1);
+ gStyle->SetOptStat(0);
+ gStyle->SetOptFit(0);
+
+}
+
-//-----------------------------------------------------------------------------\r
-void makeMmixPU_GS(const TString histoFile="LHC11a_pass4_20130913.root",\r
- const Int_t nSigma=2,\r
- const char* module="A10")\r
-{\r
- //Fit Real/Mixed ratio, normalize Mixed and subtract it from Real.\r
- // The pi0 peak if fitted by the Gaussian function, \r
- // the background is fitted by pol1 or pol2\r
-\r
- TString hMassName;\r
- TFile * file = new TFile(histoFile) ;\r
- THashList *hList = (THashList*)file->Get("histESD");\r
- char key[125] ;\r
- hMassName = "hMassPt";\r
- hMassName += module;\r
- TH2F * h = (TH2F*)hList->FindObject(hMassName) ;\r
-\r
- hMassName = "hMiMassPt";\r
- hMassName += module;\r
- TH2F * hm = (TH2F*)hList->FindObject(hMassName) ;\r
-\r
- TH1F * hev = (TH1F*)hList->FindObject("hSelEvents") ;\r
-\r
- // Array of pt bins\r
- Int_t nbin=18 ;\r
- Double_t xa[]={0.6,0.8,1.,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,3.0,3.5,4.0,5.,6.,8.,10.,12.} ;\r
- PPRstyle();\r
- gStyle->SetPadLeftMargin(0.16);\r
- gStyle->SetPadRightMargin(0.01);\r
- gStyle->SetPadTopMargin(0.02);\r
- gStyle->SetPadBottomMargin(0.11);\r
- gStyle->SetTitleX(0.80);\r
- gStyle->SetTitleY(0.98);\r
-\r
- //Fit real only \r
- //Linear Bg\r
- char key2[155];\r
- sprintf(key,"Mix") ;\r
- sprintf(key2,"%s_mr1",key) ;\r
- TH1D * mr1 = new TH1D(key2,"Mass",nbin,xa) ;\r
- sprintf(key2,"%s_sr1",key) ;\r
- TH1D * sr1 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_ar1",key) ;\r
- TH1D * ar1 = new TH1D(key2,"a",nbin,xa) ;\r
- sprintf(key2,"%s_br1",key) ;\r
- TH1D * br1 = new TH1D(key2,"a",nbin,xa) ;\r
- sprintf(key2,"%s_yr1",key) ;\r
- TH1D * nr1 = new TH1D(key2,"Raw yield",nbin,xa) ;\r
- sprintf(key2,"%s_yr1int",key) ;\r
- TH1D * nr1int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;\r
-\r
- //Quadratic Bg\r
- sprintf(key2,"%s_mr2",key) ;\r
- TH1D * mr2 = new TH1D(key2,"Mass",nbin,xa) ;\r
- sprintf(key2,"%s_sr2",key) ;\r
- TH1D * sr2 = new TH1D(key2,"Width",nbin,xa) ;\r
- sprintf(key2,"%s_ar2",key) ;\r
- TH1D * ar2 = new TH1D(key2,"a",nbin,xa) ;\r
- sprintf(key2,"%s_br2",key) ;\r
- TH1D * br2 = new TH1D(key2,"a",nbin,xa) ;\r
- sprintf(key2,"%s_cr2",key) ;\r
- TH1D * cr2 = new TH1D(key2,"a",nbin,xa) ;\r
- sprintf(key2,"%s_yr2",key) ;\r
- TH1D * nr2 = new TH1D(key2,"Raw yield",nbin,xa) ;\r
- sprintf(key2,"%s_yr2int",key) ;\r
- TH1D * nr2int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;\r
-\r
- TF1 * fit1 = new TF1("fit",CB,0.,1.,5) ;\r
- fit->SetParName(0,"A") ;\r
- fit->SetParName(1,"m_{0}") ;\r
- fit->SetParName(2,"#sigma") ;\r
- fit->SetParName(3,"a_{0}") ;\r
- fit->SetParName(4,"a_{1}") ;\r
- fit->SetLineWidth(2) ;\r
- fit->SetLineColor(2) ;\r
- TF1 * fgs = new TF1("gs",CBs,0.,1.,3) ;\r
- fgs->SetLineColor(2) ;\r
- fgs->SetLineWidth(1) ;\r
-\r
- TF1 * fit2 = new TF1("fit2",CB2,0.,1.,6) ;\r
- fit2->SetParName(0,"A") ;\r
- fit2->SetParName(1,"m_{0}") ;\r
- fit2->SetParName(2,"#sigma") ;\r
- fit2->SetParName(3,"a_{0}") ;\r
- fit2->SetParName(4,"a_{1}") ;\r
- fit2->SetLineWidth(2) ;\r
- fit2->SetLineColor(4) ;\r
- fit2->SetLineStyle(2) ;\r
- TF1 * fbg1 = new TF1("bg1",BG1,0.,1.,2) ;\r
- TF1 * fbg2 = new TF1("bg2",BG2,0.,1.,3) ;\r
-\r
- TCanvas * c3 = new TCanvas("mggFit1_Signal","mggFitCB",10,10,1400,800) ;\r
- c3->Divide(6,3) ;\r
-\r
- TCanvas * cReal = new TCanvas("cReal","Mgg real events",10,10,1400,800) ;\r
- cReal->Divide(6,3) ;\r
-\r
- TCanvas * c1 = new TCanvas("mggFit1","mggFit1",10,10,1400,800) ;\r
- c1->Divide(6,3) ;\r
- c1->cd(0) ;\r
- TCanvas * c2=0,*c4=0,*c5=0,*c6=0 ; \r
-\r
- TAxis * pta=h->GetYaxis() ;\r
- TAxis * ma=h->GetXaxis() ;\r
- for(Int_t i=1;i<=nbin;i++){\r
- c1->cd(i) ;\r
- Int_t imin=pta->FindBin(xa[i-1]+0.0001);\r
- Int_t imax=pta->FindBin(xa[i]-0.0001) ;\r
- Double_t pt=(xa[i]+xa[i-1])/2. ;\r
- TH1D * hp = h->ProjectionX(Form("re%d",i),imin,imax) ;\r
- hp->Sumw2() ;\r
- TH1D * hpm= hm->ProjectionX(Form("mi%d",i),imin,imax) ;\r
- hpm->Sumw2() ;\r
- if(i<15){\r
- hp ->Rebin(2) ;\r
- hpm->Rebin(2) ;\r
- }\r
- else{\r
- hp ->Rebin(5) ;\r
- hpm->Rebin(5) ;\r
- }\r
- hp ->SetNdivisions(506);\r
- hpm->SetNdivisions(506);\r
- hp ->SetLabelSize(0.05,"X");\r
- hpm->SetLabelSize(0.05,"X");\r
- hp ->SetTitleSize(0.00,"X");\r
- hpm->SetTitleSize(0.00,"X");\r
- hp ->SetLabelSize(0.05,"Y");\r
- hpm->SetLabelSize(0.05,"Y");\r
- hp ->SetTitleSize(0.05,"Y");\r
- hpm->SetTitleSize(0.05,"Y");\r
- hp ->SetTitleOffset(1.0,"X");\r
- hpm->SetTitleOffset(1.0,"X");\r
- if (i>12) {\r
- hp ->SetLabelSize(0.05,"X");\r
- hpm->SetLabelSize(0.05,"X");\r
- hp ->SetTitleSize(0.05,"X");\r
- hpm->SetTitleSize(0.05,"X");\r
- hp ->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");\r
- hpm->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");\r
- }\r
-\r
- // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hp ->GetBinContent(ib)==0)hp ->SetBinError(ib,1.);}\r
- // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hpm->GetBinContent(ib)==0)hpm->SetBinError(ib,1.);}\r
- TH1D * hpm2 = (TH1D*)hpm->Clone("Bg1") ;\r
- TH1D * hpcopy = (TH1D*)hp ->Clone("hpcopy") ;\r
- TH1D * hp2 = (TH1D*)hp ->Clone("hp2") ;\r
- TH1D * hpReal = (TH1D*)hp ->Clone("hpReal") ;\r
- hpcopy->Divide(hpm) ;\r
- sprintf(key,"%3.1f<p_{t}<%3.1f GeV/c",xa[i-1],xa[i]) ;\r
- hpcopy->SetTitle(key) ;\r
- hpReal->SetTitle(key) ;\r
- hpReal->SetLineWidth(2);\r
- hpcopy->SetMarkerStyle(20) ;\r
- hpcopy->SetMarkerSize(0.7) ;\r
- \r
- fit1->SetParameters(TMath::Min(0.3,0.001*i*i),0.136,0.0077,0.0013,-0.0007) ;\r
- fit1->SetParLimits(2,0.003,0.010) ;\r
- fit1->SetParLimits(1,0.132,0.139) ;\r
- fit1->SetParLimits(0,0.,1.) ;\r
-\r
- Double_t rangeMin=0.06 ;\r
- Double_t rangeMax=0.22 ;\r
- if(i>=16)rangeMax=0.3 ; //More points to fix background\r
- hpcopy->Fit(fit1,"NQ","",rangeMin,rangeMax) ;\r
- hpcopy->Fit(fit1,"MQ","",rangeMin,rangeMax) ;\r
- // hpcopy->Fit(fit1,"LQ","",rangeMin,rangeMax) ;\r
- ar1->SetBinContent(i,fit1->GetParameter(3)) ;\r
- ar1->SetBinError (i,fit1->GetParError (3)) ;\r
- br1->SetBinContent(i,fit1->GetParameter(4)) ;\r
- br1->SetBinError (i,fit1->GetParError (4)) ;\r
-\r
- fit2->SetParameters(fit1->GetParameters()) ;\r
- fit2->SetParLimits(2,0.003,0.010) ;\r
- fit2->SetParLimits(1,0.132,0.139) ;\r
- fit2->SetParLimits(0,0.,1.) ;\r
- fit2->SetParameter(5,0.) ;\r
-\r
- hpcopy->Fit(fit2,"+NQ","",rangeMin,rangeMax) ;\r
- hpcopy->Fit(fit2,"+MQ","",rangeMin,rangeMax) ;\r
- // hpcopy->Fit(fit2,"+LQ","",rangeMin,rangeMax) ;\r
- ar2->SetBinContent(i,fit2->GetParameter(3)) ;\r
- ar2->SetBinError (i,fit2->GetParError (3)) ;\r
- br2->SetBinContent(i,fit2->GetParameter(4)) ;\r
- br2->SetBinError (i,fit2->GetParError (4)) ;\r
- cr2->SetBinContent(i,fit2->GetParameter(5)) ;\r
- cr2->SetBinError (i,fit2->GetParError (5)) ;\r
-\r
- c1->cd(i) ;\r
- hpcopy->SetAxisRange(0.065,0.229,"X") ;\r
- hpcopy->Draw() ;\r
-\r
- cReal->cd(i) ;\r
- hpReal->SetAxisRange(0.065,0.229,"X") ;\r
- hpReal->Draw("ehist") ;\r
-\r
- fbg1->SetParameters(fit1->GetParameter(3),fit1->GetParameter(4)); \r
- fbg2->SetParameters(fit2->GetParameter(3),fit2->GetParameter(4),fit2->GetParameter(5)); \r
-\r
- Double_t intRangeMin = PeakPosition(pt)-nSigma*PeakWidth(pt) ;\r
- Double_t intRangeMax = PeakPosition(pt)+nSigma*PeakWidth(pt) ;\r
- Int_t intBinMin = hp->GetXaxis()->FindBin(intRangeMin) ;\r
- Int_t intBinMax = hp->GetXaxis()->FindBin(intRangeMax) ;\r
- Double_t errStat = hpm->Integral(intBinMin,intBinMax); \r
-\r
- hpm ->Multiply(fbg1) ;\r
- hpm2->Multiply(fbg2) ;\r
- hp ->Add(hpm,-1.) ;\r
- hp2 ->Add(hpm2,-1.) ;\r
-\r
- c3->cd(i) ;\r
- \r
- if(i<15)\r
- fgs->SetParameters(hp->Integral(32,36)/5.,fit1->GetParameter(1),fit1->GetParameter(2)) ;\r
- else\r
- fgs->SetParameters(hp->Integral(13,15)/3.,0.136,0.005) ;\r
- fgs->SetParLimits(2,0.003,0.010) ;\r
- fgs->SetParLimits(1,0.132,0.142) ;\r
- fgs->SetParLimits(0,0.,1.e+6) ;\r
- \r
- hp->Fit(fgs,"Q","",rangeMin,rangeMax) ; \r
- hp->SetMaximum(hp2->GetMaximum()*1.1) ;\r
- hp->SetMinimum(hp2->GetMinimum()*1.1) ;\r
- hp->SetMarkerStyle(20) ;\r
- hp->SetMarkerSize(0.7) ;\r
- mr1->SetBinContent(i,fgs->GetParameter(1)) ;\r
- mr1->SetBinError (i,fgs->GetParError(1)) ;\r
- sr1->SetBinContent(i,TMath::Abs(fgs->GetParameter(2))) ;\r
- sr1->SetBinError (i,fgs->GetParError(2)) ;\r
-\r
- Double_t y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;\r
- nr1->SetBinContent(i,y) ;\r
- Double_t ey=0 ;\r
- if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){\r
- Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;\r
- Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;\r
- ey=y*TMath::Sqrt(en*en+es*es) ;\r
- }\r
- nr1->SetBinError(i,ey) ;\r
-\r
- Double_t npiInt=hp->Integral(intBinMin,intBinMax) ;\r
- Double_t norm=fbg1->GetParameter(0) ;\r
- Double_t normErr=fbg1->GetParError(0) ;\r
- if(npiInt>0.){\r
- nr1int->SetBinContent(i,npiInt) ;\r
- nr1int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;\r
- }\r
- hp2->GetXaxis()->SetRangeUser(0.06,0.229) ;\r
- hp2->SetMaximum(hp2->GetMaximum()*1.1) ;\r
- hp2->SetMinimum(hp2->GetMinimum()*1.1) ;\r
- hp2->SetMarkerStyle(20) ;\r
- hp2->SetMarkerSize(0.7) ;\r
-\r
- hp2->Fit(fgs,"Q","",rangeMin,rangeMax) ;\r
- mr2->SetBinContent(i,fgs->GetParameter(1)) ;\r
- mr2->SetBinError (i,fgs->GetParError(1)) ;\r
- sr2->SetBinContent(i,TMath::Abs(fgs->GetParameter(2))) ;\r
- sr2->SetBinError (i,fgs->GetParError(2)) ;\r
- y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;\r
- nr2->SetBinContent(i,y) ;\r
- ey=0 ;\r
- if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){\r
- Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;\r
- Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;\r
- ey=y*TMath::Sqrt(en*en+es*es) ;\r
- }\r
- nr2->SetBinError(i,ey) ;\r
- npiInt=hp2->Integral(intBinMin,intBinMax) ;\r
- norm=fbg2->GetParameter(0) ;\r
- normErr=fbg2->GetParError(0) ;\r
- if(npiInt>0.){\r
- nr2int->SetBinContent(i,npiInt) ;\r
- nr2int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;\r
- } \r
- hp2->SetTitle(key) ;\r
- hp2->SetAxisRange(0.065,0.229,"X") ;\r
- hp2->Draw() ;\r
- hp ->Draw("same") ;\r
- delete hpm ;\r
- delete hpm2 ;\r
- c1->Update() ;\r
- c3->Update() ;\r
- cReal->Update() ;\r
- }\r
-\r
- if (c3) c3->Print("Pi0_Signal_Gaus.eps") ;\r
- if (c1) c1->Print("Pi0_Ratio_Gaus.eps") ;\r
- if (cReal) cReal->Print("Pi0_InvMass_Gaus.eps") ;\r
-\r
- //Normalize by the number of events\r
- Double_t nMBOR = hev->GetBinContent(2); // MBOR events pass4\r
- Double_t nevents = nMBOR;\r
- printf("==============\nN events = %d\n==============\n",nevents);\r
-\r
- nr1 ->Scale(1./nevents) ;\r
- nr1int->Scale(1./nevents) ;\r
- nr2 ->Scale(1./nevents) ;\r
- nr2int->Scale(1./nevents) ;\r
-\r
-\r
- TFile fout("LHC11a_FitResult.root","update");\r
- mr1->Write(0,TObject::kOverwrite) ;\r
- sr1->Write(0,TObject::kOverwrite) ;\r
- ar1->Write(0,TObject::kOverwrite) ;\r
- br1->Write(0,TObject::kOverwrite) ;\r
- nr1->Write(0,TObject::kOverwrite) ;\r
- nr1int->Write(0,TObject::kOverwrite) ;\r
- ar2->Write(0,TObject::kOverwrite) ;\r
- br2->Write(0,TObject::kOverwrite) ;\r
- cr2->Write(0,TObject::kOverwrite) ;\r
- mr2->Write(0,TObject::kOverwrite) ;\r
- sr2->Write(0,TObject::kOverwrite) ;\r
- nr2->Write(0,TObject::kOverwrite) ;\r
- nr2int->Write(0,TObject::kOverwrite) ;\r
- fout.Close() ;\r
-\r
-}\r
-\r
-//-----------------------------------------------------------------------------\r
-const Double_t kMean=0.135 ; //Approximate peak position to facilitate error estimate\r
-\r
-Double_t PeakPosition(Double_t pt){\r
- //Fit to the measured peak position\r
- return 0.454*exp(-pt*7.13)+0.13569 ;\r
-}\r
-Double_t PeakWidth(Double_t pt){\r
- //fit to the measured peak width\r
- return 1.69e-02*exp(-pt*2.82)+4.93e-03 ;\r
-}\r
- \r
-Double_t CB(Double_t * x, Double_t * par){\r
- //Parameterization of Real/Mixed ratio\r
- Double_t m=par[1] ;\r
- Double_t s=par[2] ;\r
- Double_t dx=(x[0]-m)/s ;\r
- return par[0]*exp(-dx*dx/2.)+par[3]+par[4]*(x[0]-kMean) ;\r
-}\r
-Double_t CB2(Double_t * x, Double_t * par){\r
- //Another parameterization of Real/Mixed ratio\r
- Double_t m=par[1] ;\r
- Double_t s=par[2] ;\r
- Double_t dx=(x[0]-m)/s ;\r
- return par[0]*exp(-dx*dx/2.)+par[3]+par[4]*(x[0]-kMean)+par[5]*(x[0]-kMean)*(x[0]-kMean) ;\r
-}\r
-Double_t CBs(Double_t * x, Double_t * par){\r
- //Parameterizatin of signal\r
- Double_t m=par[1] ;\r
- Double_t s=par[2] ;\r
- Double_t dx=(x[0]-m)/s ;\r
- return par[0]*exp(-dx*dx/2.) ;\r
-}\r
-Double_t BG1(Double_t * x, Double_t * par){\r
- //Normalizatino of Mixed\r
- return par[0]+par[1]*(x[0]-kMean) ;\r
-}\r
-Double_t BG2(Double_t * x, Double_t * par){\r
- //Another normalization of Mixed\r
- return par[0]+par[1]*(x[0]-kMean)+par[2]*(x[0]-kMean)*(x[0]-kMean) ;\r
-}\r
-\r
-\r
-//-----------------------------------------------------------------------------\r
-PPRstyle()\r
-{\r
-\r
- //////////////////////////////////////////////////////////////////////\r
- //\r
- // ROOT style macro for the TRD TDR\r
- //\r
- //////////////////////////////////////////////////////////////////////\r
-\r
- gStyle->SetPalette(1);\r
- gStyle->SetCanvasBorderMode(-1);\r
- gStyle->SetCanvasBorderSize(1);\r
- gStyle->SetCanvasColor(10);\r
-\r
- gStyle->SetFrameFillColor(10);\r
- gStyle->SetFrameBorderSize(1);\r
- gStyle->SetFrameBorderMode(-1);\r
- gStyle->SetFrameLineWidth(1.2);\r
- gStyle->SetFrameLineColor(1);\r
-\r
- gStyle->SetHistFillColor(0);\r
- gStyle->SetHistLineWidth(1);\r
- gStyle->SetHistLineColor(1);\r
-\r
- gStyle->SetPadColor(10);\r
- gStyle->SetPadBorderSize(1);\r
- gStyle->SetPadBorderMode(-1);\r
-\r
- gStyle->SetStatColor(10);\r
- gStyle->SetTitleColor(kBlack,"X");\r
- gStyle->SetTitleColor(kBlack,"Y");\r
-\r
- gStyle->SetLabelSize(0.04,"X");\r
- gStyle->SetLabelSize(0.04,"Y");\r
- gStyle->SetLabelSize(0.04,"Z");\r
- gStyle->SetTitleSize(0.04,"X");\r
- gStyle->SetTitleSize(0.04,"Y");\r
- gStyle->SetTitleSize(0.04,"Z");\r
- gStyle->SetTitleFont(42,"X");\r
- gStyle->SetTitleFont(42,"Y");\r
- gStyle->SetTitleFont(42,"X");\r
- gStyle->SetLabelFont(42,"X");\r
- gStyle->SetLabelFont(42,"Y");\r
- gStyle->SetLabelFont(42,"Z");\r
- gStyle->SetStatFont(42);\r
-\r
- gStyle->SetTitleOffset(1.0,"X");\r
- gStyle->SetTitleOffset(1.4,"Y");\r
-\r
- gStyle->SetFillColor(kWhite);\r
- gStyle->SetTitleFillColor(kWhite);\r
-\r
- gStyle->SetOptDate(0);\r
- gStyle->SetOptTitle(1);\r
- gStyle->SetOptStat(0);\r
- gStyle->SetOptFit(0);\r
-\r
-}\r
-\r
+//-----------------------------------------------------------------------------
+void makeMmixPU_GS(const TString histoFile="LHC11a_pass4_20130913.root",
+ const Int_t nSigma=2,
+ const char* module="A10")
+{
+ //Fit Real/Mixed ratio, normalize Mixed and subtract it from Real.
+ // The pi0 peak if fitted by the Gaussian function,
+ // the background is fitted by pol1 or pol2
+
+ TString hMassName;
+ TFile * file = new TFile(histoFile) ;
+ THashList *hList = (THashList*)file->Get("histESD");
+ char key[125] ;
+ hMassName = "hMassPt";
+ hMassName += module;
+ TH2F * h = (TH2F*)hList->FindObject(hMassName) ;
+
+ hMassName = "hMiMassPt";
+ hMassName += module;
+ TH2F * hm = (TH2F*)hList->FindObject(hMassName) ;
+
+ TH1F * hev = (TH1F*)hList->FindObject("hSelEvents") ;
+
+ // Array of pt bins
+ Int_t nbin=18 ;
+ Double_t xa[]={0.6,0.8,1.,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,3.0,3.5,4.0,5.,6.,8.,10.,12.} ;
+ PPRstyle();
+ gStyle->SetPadLeftMargin(0.16);
+ gStyle->SetPadRightMargin(0.01);
+ gStyle->SetPadTopMargin(0.02);
+ gStyle->SetPadBottomMargin(0.11);
+ gStyle->SetTitleX(0.80);
+ gStyle->SetTitleY(0.98);
+
+ //Fit real only
+ //Linear Bg
+ char key2[155];
+ sprintf(key,"Mix") ;
+ sprintf(key2,"%s_mr1",key) ;
+ TH1D * mr1 = new TH1D(key2,"Mass",nbin,xa) ;
+ sprintf(key2,"%s_sr1",key) ;
+ TH1D * sr1 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_ar1",key) ;
+ TH1D * ar1 = new TH1D(key2,"a",nbin,xa) ;
+ sprintf(key2,"%s_br1",key) ;
+ TH1D * br1 = new TH1D(key2,"a",nbin,xa) ;
+ sprintf(key2,"%s_yr1",key) ;
+ TH1D * nr1 = new TH1D(key2,"Raw yield",nbin,xa) ;
+ sprintf(key2,"%s_yr1int",key) ;
+ TH1D * nr1int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;
+
+ //Quadratic Bg
+ sprintf(key2,"%s_mr2",key) ;
+ TH1D * mr2 = new TH1D(key2,"Mass",nbin,xa) ;
+ sprintf(key2,"%s_sr2",key) ;
+ TH1D * sr2 = new TH1D(key2,"Width",nbin,xa) ;
+ sprintf(key2,"%s_ar2",key) ;
+ TH1D * ar2 = new TH1D(key2,"a",nbin,xa) ;
+ sprintf(key2,"%s_br2",key) ;
+ TH1D * br2 = new TH1D(key2,"a",nbin,xa) ;
+ sprintf(key2,"%s_cr2",key) ;
+ TH1D * cr2 = new TH1D(key2,"a",nbin,xa) ;
+ sprintf(key2,"%s_yr2",key) ;
+ TH1D * nr2 = new TH1D(key2,"Raw yield",nbin,xa) ;
+ sprintf(key2,"%s_yr2int",key) ;
+ TH1D * nr2int = new TH1D(key2,"Raw yield, integrated",nbin,xa) ;
+
+ TF1 * fit1 = new TF1("fit",CB,0.,1.,5) ;
+ fit->SetParName(0,"A") ;
+ fit->SetParName(1,"m_{0}") ;
+ fit->SetParName(2,"#sigma") ;
+ fit->SetParName(3,"a_{0}") ;
+ fit->SetParName(4,"a_{1}") ;
+ fit->SetLineWidth(2) ;
+ fit->SetLineColor(2) ;
+ TF1 * fgs = new TF1("gs",CBs,0.,1.,3) ;
+ fgs->SetLineColor(2) ;
+ fgs->SetLineWidth(1) ;
+
+ TF1 * fit2 = new TF1("fit2",CB2,0.,1.,6) ;
+ fit2->SetParName(0,"A") ;
+ fit2->SetParName(1,"m_{0}") ;
+ fit2->SetParName(2,"#sigma") ;
+ fit2->SetParName(3,"a_{0}") ;
+ fit2->SetParName(4,"a_{1}") ;
+ fit2->SetLineWidth(2) ;
+ fit2->SetLineColor(4) ;
+ fit2->SetLineStyle(2) ;
+ TF1 * fbg1 = new TF1("bg1",BG1,0.,1.,2) ;
+ TF1 * fbg2 = new TF1("bg2",BG2,0.,1.,3) ;
+
+ TCanvas * c3 = new TCanvas("mggFit1_Signal","mggFitCB",10,10,1400,800) ;
+ c3->Divide(6,3) ;
+
+ TCanvas * cReal = new TCanvas("cReal","Mgg real events",10,10,1400,800) ;
+ cReal->Divide(6,3) ;
+
+ TCanvas * c1 = new TCanvas("mggFit1","mggFit1",10,10,1400,800) ;
+ c1->Divide(6,3) ;
+ c1->cd(0) ;
+ TCanvas * c2=0,*c4=0,*c5=0,*c6=0 ;
+
+ TAxis * pta=h->GetYaxis() ;
+ TAxis * ma=h->GetXaxis() ;
+ for(Int_t i=1;i<=nbin;i++){
+ c1->cd(i) ;
+ Int_t imin=pta->FindBin(xa[i-1]+0.0001);
+ Int_t imax=pta->FindBin(xa[i]-0.0001) ;
+ Double_t pt=(xa[i]+xa[i-1])/2. ;
+ TH1D * hp = h->ProjectionX(Form("re%d",i),imin,imax) ;
+ hp->Sumw2() ;
+ TH1D * hpm= hm->ProjectionX(Form("mi%d",i),imin,imax) ;
+ hpm->Sumw2() ;
+ if(i<15){
+ hp ->Rebin(2) ;
+ hpm->Rebin(2) ;
+ }
+ else{
+ hp ->Rebin(5) ;
+ hpm->Rebin(5) ;
+ }
+ hp ->SetNdivisions(506);
+ hpm->SetNdivisions(506);
+ hp ->SetLabelSize(0.05,"X");
+ hpm->SetLabelSize(0.05,"X");
+ hp ->SetTitleSize(0.00,"X");
+ hpm->SetTitleSize(0.00,"X");
+ hp ->SetLabelSize(0.05,"Y");
+ hpm->SetLabelSize(0.05,"Y");
+ hp ->SetTitleSize(0.05,"Y");
+ hpm->SetTitleSize(0.05,"Y");
+ hp ->SetTitleOffset(1.0,"X");
+ hpm->SetTitleOffset(1.0,"X");
+ if (i>12) {
+ hp ->SetLabelSize(0.05,"X");
+ hpm->SetLabelSize(0.05,"X");
+ hp ->SetTitleSize(0.05,"X");
+ hpm->SetTitleSize(0.05,"X");
+ hp ->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");
+ hpm->SetXTitle("m_{#gamma#gamma} (GeV/c^{2})");
+ }
+
+ // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hp ->GetBinContent(ib)==0)hp ->SetBinError(ib,1.);}
+ // for(Int_t ib=1; ib<=hp->GetNbinsX();ib++){if(hpm->GetBinContent(ib)==0)hpm->SetBinError(ib,1.);}
+ TH1D * hpm2 = (TH1D*)hpm->Clone("Bg1") ;
+ TH1D * hpcopy = (TH1D*)hp ->Clone("hpcopy") ;
+ TH1D * hp2 = (TH1D*)hp ->Clone("hp2") ;
+ TH1D * hpReal = (TH1D*)hp ->Clone("hpReal") ;
+ hpcopy->Divide(hpm) ;
+ sprintf(key,"%3.1f<p_{t}<%3.1f GeV/c",xa[i-1],xa[i]) ;
+ hpcopy->SetTitle(key) ;
+ hpReal->SetTitle(key) ;
+ hpReal->SetLineWidth(2);
+ hpcopy->SetMarkerStyle(20) ;
+ hpcopy->SetMarkerSize(0.7) ;
+
+ fit1->SetParameters(TMath::Min(0.3,0.001*i*i),0.136,0.0077,0.0013,-0.0007) ;
+ fit1->SetParLimits(2,0.003,0.010) ;
+ fit1->SetParLimits(1,0.132,0.139) ;
+ fit1->SetParLimits(0,0.,1.) ;
+
+ Double_t rangeMin=0.06 ;
+ Double_t rangeMax=0.22 ;
+ if(i>=16)rangeMax=0.3 ; //More points to fix background
+ hpcopy->Fit(fit1,"NQ","",rangeMin,rangeMax) ;
+ hpcopy->Fit(fit1,"MQ","",rangeMin,rangeMax) ;
+ // hpcopy->Fit(fit1,"LQ","",rangeMin,rangeMax) ;
+ ar1->SetBinContent(i,fit1->GetParameter(3)) ;
+ ar1->SetBinError (i,fit1->GetParError (3)) ;
+ br1->SetBinContent(i,fit1->GetParameter(4)) ;
+ br1->SetBinError (i,fit1->GetParError (4)) ;
+
+ fit2->SetParameters(fit1->GetParameters()) ;
+ fit2->SetParLimits(2,0.003,0.010) ;
+ fit2->SetParLimits(1,0.132,0.139) ;
+ fit2->SetParLimits(0,0.,1.) ;
+ fit2->SetParameter(5,0.) ;
+
+ hpcopy->Fit(fit2,"+NQ","",rangeMin,rangeMax) ;
+ hpcopy->Fit(fit2,"+MQ","",rangeMin,rangeMax) ;
+ // hpcopy->Fit(fit2,"+LQ","",rangeMin,rangeMax) ;
+ ar2->SetBinContent(i,fit2->GetParameter(3)) ;
+ ar2->SetBinError (i,fit2->GetParError (3)) ;
+ br2->SetBinContent(i,fit2->GetParameter(4)) ;
+ br2->SetBinError (i,fit2->GetParError (4)) ;
+ cr2->SetBinContent(i,fit2->GetParameter(5)) ;
+ cr2->SetBinError (i,fit2->GetParError (5)) ;
+
+ c1->cd(i) ;
+ hpcopy->SetAxisRange(0.065,0.229,"X") ;
+ hpcopy->Draw() ;
+
+ cReal->cd(i) ;
+ hpReal->SetAxisRange(0.065,0.229,"X") ;
+ hpReal->Draw("ehist") ;
+
+ fbg1->SetParameters(fit1->GetParameter(3),fit1->GetParameter(4));
+ fbg2->SetParameters(fit2->GetParameter(3),fit2->GetParameter(4),fit2->GetParameter(5));
+
+ Double_t intRangeMin = PeakPosition(pt)-nSigma*PeakWidth(pt) ;
+ Double_t intRangeMax = PeakPosition(pt)+nSigma*PeakWidth(pt) ;
+ Int_t intBinMin = hp->GetXaxis()->FindBin(intRangeMin) ;
+ Int_t intBinMax = hp->GetXaxis()->FindBin(intRangeMax) ;
+ Double_t errStat = hpm->Integral(intBinMin,intBinMax);
+
+ hpm ->Multiply(fbg1) ;
+ hpm2->Multiply(fbg2) ;
+ hp ->Add(hpm,-1.) ;
+ hp2 ->Add(hpm2,-1.) ;
+
+ c3->cd(i) ;
+
+ if(i<15)
+ fgs->SetParameters(hp->Integral(32,36)/5.,fit1->GetParameter(1),fit1->GetParameter(2)) ;
+ else
+ fgs->SetParameters(hp->Integral(13,15)/3.,0.136,0.005) ;
+ fgs->SetParLimits(2,0.003,0.010) ;
+ fgs->SetParLimits(1,0.132,0.142) ;
+ fgs->SetParLimits(0,0.,1.e+6) ;
+
+ hp->Fit(fgs,"Q","",rangeMin,rangeMax) ;
+ hp->SetMaximum(hp2->GetMaximum()*1.1) ;
+ hp->SetMinimum(hp2->GetMinimum()*1.1) ;
+ hp->SetMarkerStyle(20) ;
+ hp->SetMarkerSize(0.7) ;
+ mr1->SetBinContent(i,fgs->GetParameter(1)) ;
+ mr1->SetBinError (i,fgs->GetParError(1)) ;
+ sr1->SetBinContent(i,TMath::Abs(fgs->GetParameter(2))) ;
+ sr1->SetBinError (i,fgs->GetParError(2)) ;
+
+ Double_t y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;
+ nr1->SetBinContent(i,y) ;
+ Double_t ey=0 ;
+ if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){
+ Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;
+ Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;
+ ey=y*TMath::Sqrt(en*en+es*es) ;
+ }
+ nr1->SetBinError(i,ey) ;
+
+ Double_t npiInt=hp->Integral(intBinMin,intBinMax) ;
+ Double_t norm=fbg1->GetParameter(0) ;
+ Double_t normErr=fbg1->GetParError(0) ;
+ if(npiInt>0.){
+ nr1int->SetBinContent(i,npiInt) ;
+ nr1int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;
+ }
+ hp2->GetXaxis()->SetRangeUser(0.06,0.229) ;
+ hp2->SetMaximum(hp2->GetMaximum()*1.1) ;
+ hp2->SetMinimum(hp2->GetMinimum()*1.1) ;
+ hp2->SetMarkerStyle(20) ;
+ hp2->SetMarkerSize(0.7) ;
+
+ hp2->Fit(fgs,"Q","",rangeMin,rangeMax) ;
+ mr2->SetBinContent(i,fgs->GetParameter(1)) ;
+ mr2->SetBinError (i,fgs->GetParError(1)) ;
+ sr2->SetBinContent(i,TMath::Abs(fgs->GetParameter(2))) ;
+ sr2->SetBinError (i,fgs->GetParError(2)) ;
+ y=fgs->Integral(intRangeMin,intRangeMax)/hp->GetXaxis()->GetBinWidth(1) ;
+ nr2->SetBinContent(i,y) ;
+ ey=0 ;
+ if(fgs->GetParameter(0)!=0. && fgs->GetParameter(2)!=0.){
+ Double_t en=fgs->GetParError(0)/fgs->GetParameter(0) ;
+ Double_t es=fgs->GetParError(2)/fgs->GetParameter(2) ;
+ ey=y*TMath::Sqrt(en*en+es*es) ;
+ }
+ nr2->SetBinError(i,ey) ;
+ npiInt=hp2->Integral(intBinMin,intBinMax) ;
+ norm=fbg2->GetParameter(0) ;
+ normErr=fbg2->GetParError(0) ;
+ if(npiInt>0.){
+ nr2int->SetBinContent(i,npiInt) ;
+ nr2int->SetBinError(i,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;
+ }
+ hp2->SetTitle(key) ;
+ hp2->SetAxisRange(0.065,0.229,"X") ;
+ hp2->Draw() ;
+ hp ->Draw("same") ;
+ delete hpm ;
+ delete hpm2 ;
+ c1->Update() ;
+ c3->Update() ;
+ cReal->Update() ;
+ }
+
+ if (c3) c3->Print("Pi0_Signal_Gaus.eps") ;
+ if (c1) c1->Print("Pi0_Ratio_Gaus.eps") ;
+ if (cReal) cReal->Print("Pi0_InvMass_Gaus.eps") ;
+
+ //Normalize by the number of events
+ Double_t nMBOR = hev->GetBinContent(2); // MBOR events pass4
+ Double_t nevents = nMBOR;
+ printf("==============\nN events = %d\n==============\n",nevents);
+
+ nr1 ->Scale(1./nevents) ;
+ nr1int->Scale(1./nevents) ;
+ nr2 ->Scale(1./nevents) ;
+ nr2int->Scale(1./nevents) ;
+
+
+ TFile fout("LHC11a_FitResult.root","update");
+ mr1->Write(0,TObject::kOverwrite) ;
+ sr1->Write(0,TObject::kOverwrite) ;
+ ar1->Write(0,TObject::kOverwrite) ;
+ br1->Write(0,TObject::kOverwrite) ;
+ nr1->Write(0,TObject::kOverwrite) ;
+ nr1int->Write(0,TObject::kOverwrite) ;
+ ar2->Write(0,TObject::kOverwrite) ;
+ br2->Write(0,TObject::kOverwrite) ;
+ cr2->Write(0,TObject::kOverwrite) ;
+ mr2->Write(0,TObject::kOverwrite) ;
+ sr2->Write(0,TObject::kOverwrite) ;
+ nr2->Write(0,TObject::kOverwrite) ;
+ nr2int->Write(0,TObject::kOverwrite) ;
+ fout.Close() ;
+
+}
+
+//-----------------------------------------------------------------------------
+const Double_t kMean=0.135 ; //Approximate peak position to facilitate error estimate
+
+Double_t PeakPosition(Double_t pt){
+ //Fit to the measured peak position
+ return 0.454*exp(-pt*7.13)+0.13569 ;
+}
+Double_t PeakWidth(Double_t pt){
+ //fit to the measured peak width
+ return 1.69e-02*exp(-pt*2.82)+4.93e-03 ;
+}
+
+Double_t CB(Double_t * x, Double_t * par){
+ //Parameterization of Real/Mixed ratio
+ Double_t m=par[1] ;
+ Double_t s=par[2] ;
+ Double_t dx=(x[0]-m)/s ;
+ return par[0]*exp(-dx*dx/2.)+par[3]+par[4]*(x[0]-kMean) ;
+}
+Double_t CB2(Double_t * x, Double_t * par){
+ //Another parameterization of Real/Mixed ratio
+ Double_t m=par[1] ;
+ Double_t s=par[2] ;
+ Double_t dx=(x[0]-m)/s ;
+ return par[0]*exp(-dx*dx/2.)+par[3]+par[4]*(x[0]-kMean)+par[5]*(x[0]-kMean)*(x[0]-kMean) ;
+}
+Double_t CBs(Double_t * x, Double_t * par){
+ //Parameterizatin of signal
+ Double_t m=par[1] ;
+ Double_t s=par[2] ;
+ Double_t dx=(x[0]-m)/s ;
+ return par[0]*exp(-dx*dx/2.) ;
+}
+Double_t BG1(Double_t * x, Double_t * par){
+ //Normalizatino of Mixed
+ return par[0]+par[1]*(x[0]-kMean) ;
+}
+Double_t BG2(Double_t * x, Double_t * par){
+ //Another normalization of Mixed
+ return par[0]+par[1]*(x[0]-kMean)+par[2]*(x[0]-kMean)*(x[0]-kMean) ;
+}
+
+
+//-----------------------------------------------------------------------------
+PPRstyle()
+{
+
+ //////////////////////////////////////////////////////////////////////
+ //
+ // ROOT style macro for the TRD TDR
+ //
+ //////////////////////////////////////////////////////////////////////
+
+ gStyle->SetPalette(1);
+ gStyle->SetCanvasBorderMode(-1);
+ gStyle->SetCanvasBorderSize(1);
+ gStyle->SetCanvasColor(10);
+
+ gStyle->SetFrameFillColor(10);
+ gStyle->SetFrameBorderSize(1);
+ gStyle->SetFrameBorderMode(-1);
+ gStyle->SetFrameLineWidth(1.2);
+ gStyle->SetFrameLineColor(1);
+
+ gStyle->SetHistFillColor(0);
+ gStyle->SetHistLineWidth(1);
+ gStyle->SetHistLineColor(1);
+
+ gStyle->SetPadColor(10);
+ gStyle->SetPadBorderSize(1);
+ gStyle->SetPadBorderMode(-1);
+
+ gStyle->SetStatColor(10);
+ gStyle->SetTitleColor(kBlack,"X");
+ gStyle->SetTitleColor(kBlack,"Y");
+
+ gStyle->SetLabelSize(0.04,"X");
+ gStyle->SetLabelSize(0.04,"Y");
+ gStyle->SetLabelSize(0.04,"Z");
+ gStyle->SetTitleSize(0.04,"X");
+ gStyle->SetTitleSize(0.04,"Y");
+ gStyle->SetTitleSize(0.04,"Z");
+ gStyle->SetTitleFont(42,"X");
+ gStyle->SetTitleFont(42,"Y");
+ gStyle->SetTitleFont(42,"X");
+ gStyle->SetLabelFont(42,"X");
+ gStyle->SetLabelFont(42,"Y");
+ gStyle->SetLabelFont(42,"Z");
+ gStyle->SetStatFont(42);
+
+ gStyle->SetTitleOffset(1.0,"X");
+ gStyle->SetTitleOffset(1.4,"Y");
+
+ gStyle->SetFillColor(kWhite);
+ gStyle->SetTitleFillColor(kWhite);
+
+ gStyle->SetOptDate(0);
+ gStyle->SetOptTitle(1);
+ gStyle->SetOptStat(0);
+ gStyle->SetOptFit(0);
+
+}
+
-/**************************************************************************\r
- * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-/* $Id$ */\r
-\r
-////////////////////////////////////////////////////////////////////////\r
-//\r
-// Base class for cuts on Associated tracks for HF Correlation analysis\r
-//\r
-// Author: S.Bjelogrlic (Utrecht) sandro.bjelogrlic@cern.ch\r
-////////////////////////////////////////////////////////////////////////\r
-#include <Riostream.h>\r
-#include "AliHFAssociatedTrackCuts.h"\r
-#include "AliAODPidHF.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliESDtrack.h"\r
-#include "AliESDVertex.h"\r
-#include "AliAODv0.h"\r
-#include "AliAODVertex.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliInputEventHandler.h"\r
-#include "TString.h"\r
-\r
-using std::cout;\r
-using std::endl;\r
-\r
-ClassImp(AliHFAssociatedTrackCuts)\r
-\r
-//--------------------------------------------------------------------------\r
-AliHFAssociatedTrackCuts::AliHFAssociatedTrackCuts():\r
-AliAnalysisCuts(),\r
-fESDTrackCuts(0),\r
-fPidObj(0),\r
- fEffWeights(0),\r
-\r
-fTrigEffWeightsvspt(0),\r
-fTrigEffWeightsvsptB(0),\r
-fTrigEffWeights(0),\r
-fTrigEffWeightsB(0),\r
-fPoolMaxNEvents(0), \r
-fPoolMinNTracks(0), \r
-fMinEventsToMix(0),\r
-fNzVtxBins(0), \r
-fNzVtxBinsDim(0), \r
-fZvtxBins(0), \r
-fNCentBins(0), \r
-fNCentBinsDim(0), \r
-fCentBins(0),\r
-\r
-fNofMCEventType(0),\r
-fMCEventType(0),\r
-\r
-fNTrackCuts(0),\r
-fAODTrackCuts(0),\r
-fTrackCutsNames(0),\r
-fNvZeroCuts(0),\r
-fAODvZeroCuts(0),\r
-fvZeroCutsNames(0),\r
-fBit(-1),\r
-fCharge(0),\r
-fDescription("")\r
-\r
-{\r
- //\r
- //default constructor\r
- //\r
- //\r
- //default constructor\r
- //\r
- \r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-AliHFAssociatedTrackCuts::AliHFAssociatedTrackCuts(const char* name, const char* title):\r
-AliAnalysisCuts(name,title),\r
-fESDTrackCuts(0),\r
-fPidObj(0),\r
-fEffWeights(0),\r
-fTrigEffWeightsvspt(0),\r
-fTrigEffWeightsvsptB(0),\r
-fTrigEffWeights(0),\r
-fTrigEffWeightsB(0),\r
-fPoolMaxNEvents(0), \r
-fPoolMinNTracks(0), \r
-fMinEventsToMix(0),\r
-fNzVtxBins(0), \r
-fNzVtxBinsDim(0), \r
-fZvtxBins(0), \r
-fNCentBins(0), \r
-fNCentBinsDim(0), \r
-fCentBins(0),\r
-\r
-fNofMCEventType(0),\r
-fMCEventType(0),\r
-\r
-fNTrackCuts(0),\r
-fAODTrackCuts(0),\r
-fTrackCutsNames(0),\r
-fNvZeroCuts(0),\r
-fAODvZeroCuts(0),\r
-fvZeroCutsNames(0),\r
-fBit(-1),\r
-fCharge(0),\r
-fDescription("")\r
-\r
-{\r
- //\r
- //default constructor\r
- //\r
- \r
-}\r
-//--------------------------------------------------------------------------\r
-AliHFAssociatedTrackCuts::AliHFAssociatedTrackCuts(const AliHFAssociatedTrackCuts &source) :\r
-AliAnalysisCuts(source),\r
-fESDTrackCuts(source.fESDTrackCuts),\r
-fPidObj(source.fPidObj),\r
-fEffWeights(source.fEffWeights),\r
-fTrigEffWeightsvspt(source.fTrigEffWeightsvspt),\r
-fTrigEffWeightsvsptB(source.fTrigEffWeightsvsptB),\r
-fTrigEffWeights(source.fTrigEffWeights),\r
-fTrigEffWeightsB(source.fTrigEffWeightsB),\r
-\r
-fPoolMaxNEvents(source.fPoolMaxNEvents), \r
-fPoolMinNTracks(source.fPoolMinNTracks), \r
-fMinEventsToMix(source.fMinEventsToMix),\r
-fNzVtxBins(source.fNzVtxBins), \r
-fNzVtxBinsDim(source.fNzVtxBinsDim), \r
-fZvtxBins(source.fZvtxBins), \r
-fNCentBins(source.fNCentBins), \r
-fNCentBinsDim(source.fNCentBinsDim), \r
-fCentBins(source.fCentBins),\r
-\r
-fNofMCEventType(source.fNofMCEventType),\r
-fMCEventType(source.fMCEventType),\r
-\r
-fNTrackCuts(source.fNTrackCuts),\r
-fAODTrackCuts(source.fAODTrackCuts),\r
-fTrackCutsNames(source.fTrackCutsNames),\r
-fNvZeroCuts(source.fNvZeroCuts),\r
-fAODvZeroCuts(source.fAODvZeroCuts),\r
-fvZeroCutsNames(source.fvZeroCutsNames),\r
-fBit(source.fBit),\r
-fCharge(source.fCharge),\r
-fDescription(source.fDescription)\r
-{\r
- //\r
- // copy constructor\r
- //\r
- \r
-\r
- AliInfo("AliHFAssociatedTrackCuts::Copy constructor ");\r
- if(source.fESDTrackCuts) AddTrackCuts(source.fESDTrackCuts);\r
- if(source.fAODTrackCuts) SetAODTrackCuts(source.fAODTrackCuts);\r
- if(source.fAODvZeroCuts) SetAODvZeroCuts(source.fAODvZeroCuts);\r
- if(source.fPidObj) SetPidHF(source.fPidObj);\r
- if(source.fEffWeights) SetEfficiencyWeightMap(source.fEffWeights);\r
- if(source.fTrigEffWeightsvspt) SetTriggerEffWeightMapvspt(source.fTrigEffWeightsvspt);\r
- if(source.fTrigEffWeightsvsptB) SetTriggerEffWeightMapvsptB(source.fTrigEffWeightsvsptB);\r
- if(source.fTrigEffWeights) SetTriggerEffWeightMap(source.fTrigEffWeights);\r
- if(source.fTrigEffWeightsB)SetTriggerEffWeightMapB(source.fTrigEffWeightsB);\r
- \r
- \r
-}\r
-//--------------------------------------------------------------------------\r
-AliHFAssociatedTrackCuts &AliHFAssociatedTrackCuts::operator=(const AliHFAssociatedTrackCuts &source)\r
-{\r
- //\r
- // assignment operator\r
- // \r
- if(&source == this) return *this;\r
- \r
- AliAnalysisCuts::operator=(source);\r
- fESDTrackCuts=source.fESDTrackCuts;\r
- fPidObj=source.fPidObj;\r
- fEffWeights=source.fEffWeights;\r
- fTrigEffWeightsvspt=source.fTrigEffWeightsvspt;\r
- fTrigEffWeightsvsptB=source.fTrigEffWeightsvsptB;\r
- fTrigEffWeights=source.fTrigEffWeights;\r
- fTrigEffWeightsB=source.fTrigEffWeightsB;\r
- fNTrackCuts=source.fNTrackCuts;\r
- fAODTrackCuts=source.fAODTrackCuts;\r
- fTrackCutsNames=source.fTrackCutsNames;\r
- fNvZeroCuts=source.fNvZeroCuts;\r
- fAODvZeroCuts=source.fAODvZeroCuts;\r
- fvZeroCutsNames=source.fvZeroCutsNames;\r
- fBit=source.fBit;\r
- fCharge=source.fCharge;\r
- \r
- return *this;\r
-\r
-}\r
-\r
-\r
-//--------------------------------------------------------------------------\r
-AliHFAssociatedTrackCuts::~AliHFAssociatedTrackCuts()\r
-{\r
- if(fESDTrackCuts) {delete fESDTrackCuts; fESDTrackCuts = 0;}\r
- if(fPidObj) {delete fPidObj; fPidObj = 0;}\r
- if(fEffWeights){delete fEffWeights;fEffWeights=0;}\r
- if(fTrigEffWeightsvspt){delete fTrigEffWeightsvspt;fTrigEffWeightsvspt=0;}\r
- if(fTrigEffWeightsvsptB){delete fTrigEffWeightsvsptB;fTrigEffWeightsvsptB=0;}\r
- if(fTrigEffWeights){delete fTrigEffWeights;fTrigEffWeights=0;}\r
- if(fTrigEffWeightsB){delete fTrigEffWeightsB;fTrigEffWeightsB=0;}\r
- if(fZvtxBins) {delete[] fZvtxBins; fZvtxBins=0;} \r
- if(fCentBins) {delete[] fCentBins; fCentBins=0;}\r
- if(fAODTrackCuts) {delete[] fAODTrackCuts; fAODTrackCuts=0;}\r
- if(fTrackCutsNames) {delete[] fTrackCutsNames; fTrackCutsNames=0;}\r
- if(fAODvZeroCuts){delete[] fAODvZeroCuts; fAODvZeroCuts=0;}\r
- if(fvZeroCutsNames) {delete[] fvZeroCutsNames; fvZeroCutsNames=0;}\r
-\r
- \r
-}\r
-//--------------------------------------------------------------------------\r
-Bool_t AliHFAssociatedTrackCuts::IsInAcceptance()\r
-{\r
- printf("Careful: method AliHFAssociatedTrackCuts::IsInAcceptance is not implemented yet \n");\r
- return kFALSE;\r
-}\r
-//--------------------------------------------------------------------------\r
-Bool_t AliHFAssociatedTrackCuts::IsHadronSelected(AliAODTrack * track,const AliESDVertex *primary, Double_t magfield)\r
-{\r
- \r
- AliESDtrack esdtrack(track);\r
- if(primary){// needed to calculate impact parameters\r
- // needed to calculate the impact parameters\r
- esdtrack.RelateToVertex(primary,magfield,3.); \r
- }\r
- // set the TPC cluster info\r
- esdtrack.SetTPCClusterMap(track->GetTPCClusterMap());\r
- esdtrack.SetTPCSharedMap(track->GetTPCSharedMap());\r
- esdtrack.SetTPCPointsF(track->GetTPCNclsF());\r
- \r
- if(!fESDTrackCuts->IsSelected(&esdtrack)) return kFALSE;\r
- \r
- if(fBit>-1 && !track->TestFilterBit(fBit)) return kFALSE; // check the filter bit\r
- \r
- return kTRUE;\r
- \r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-Bool_t AliHFAssociatedTrackCuts::CheckHadronKinematic(Double_t pt, Double_t d0) \r
-{\r
- \r
- \r
- \r
- if(pt < fAODTrackCuts[0]) return kFALSE;\r
- if(pt > fAODTrackCuts[1]) return kFALSE;\r
- if(d0 < fAODTrackCuts[2]) return kFALSE;\r
- if(d0 > fAODTrackCuts[3]) return kFALSE;\r
- \r
- return kTRUE;\r
-\r
- \r
-}\r
-//--------------------------------------------------------------------------\r
-\r
-Bool_t AliHFAssociatedTrackCuts::Charge(Short_t charge, AliAODTrack* track) \r
-{// charge is the charge to compare to (for example, a daughter of a D meson)\r
- \r
- if(!fCharge) return kTRUE; // if fCharge is set to 0 (no selection on the charge), returns always true\r
- if(track->Charge()!= fCharge*charge) return kFALSE;\r
- return kTRUE;\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-Bool_t AliHFAssociatedTrackCuts::CheckKaonCompatibility(AliAODTrack * track, Bool_t useMc, TClonesArray* mcArray, Int_t method)\r
-{\r
- Bool_t isKaon = kFALSE;\r
- \r
- if(useMc) { // on MC\r
- Int_t hadLabel = track->GetLabel();\r
- if(hadLabel < 0) return kFALSE;\r
- AliAODMCParticle* hadron = dynamic_cast<AliAODMCParticle*>(mcArray->At(hadLabel)); \r
- if(hadron){\r
- Int_t pdg = TMath::Abs(hadron->GetPdgCode()); \r
- if (pdg == 321) isKaon = kTRUE;\r
- }\r
- }\r
- \r
- if(!useMc) { // on DATA\r
- switch(method) {\r
- case(1): {\r
- Bool_t isKTPC=kFALSE;\r
- Bool_t isPiTPC=kFALSE;\r
- Bool_t isPTPC=kFALSE;\r
- Bool_t isKTOF=kFALSE;\r
- Bool_t isPiTOF=kFALSE;\r
- Bool_t isPTOF=kFALSE;\r
- \r
- Bool_t KaonHyp = kFALSE;\r
- Bool_t PionHyp = kFALSE;\r
- Bool_t ProtonHyp = kFALSE;\r
- \r
- if(fPidObj->CheckStatus(track,"TOF")) {\r
- isKTOF=fPidObj->IsKaonRaw(track,"TOF");\r
- isPiTOF=fPidObj->IsPionRaw(track,"TOF");\r
- isPTOF=fPidObj->IsProtonRaw(track,"TOF");\r
- }\r
- if(fPidObj->CheckStatus(track,"TPC")){\r
- isKTPC=fPidObj->IsKaonRaw(track,"TPC");\r
- isPiTPC=fPidObj->IsPionRaw(track,"TPC");\r
- isPTPC=fPidObj->IsProtonRaw(track,"TPC"); \r
- }\r
- \r
- if (isKTOF && isKTPC) KaonHyp = kTRUE;\r
- if (isPiTOF && isPiTPC) PionHyp = kTRUE;\r
- if (isPTOF && isPTPC) ProtonHyp = kTRUE;\r
- \r
- if(KaonHyp && !PionHyp && !ProtonHyp) isKaon = kTRUE; \r
- break;\r
- }\r
- case(2): {\r
- if(fPidObj->MakeRawPid(track,3)>=1) isKaon = kTRUE;\r
- break;\r
- }\r
- }\r
- }\r
- \r
- return isKaon;\r
- \r
-}\r
-//--------------------------------------------------------------------------\r
-Bool_t AliHFAssociatedTrackCuts::IsKZeroSelected(AliAODv0 *vzero, AliAODVertex *vtx1)\r
-{\r
- \r
- if(vzero->DcaV0Daughters()>fAODvZeroCuts[0]) return kFALSE;\r
- if(vzero->Chi2V0()>fAODvZeroCuts[1]) return kFALSE;\r
- if(vzero->DecayLength(vtx1) < fAODvZeroCuts[2]) return kFALSE;\r
- if(vzero->DecayLength(vtx1) > fAODvZeroCuts[3]) return kFALSE;\r
- if(vzero->OpenAngleV0() > fAODvZeroCuts[4]) return kFALSE;\r
- if(vzero->Pt() < fAODvZeroCuts[5]) return kFALSE;\r
- if(TMath::Abs(vzero->Eta()) > fAODvZeroCuts[6]) return kFALSE;\r
-\r
- \r
- return kTRUE;\r
-}\r
-//--------------------------------------------------------------------------\r
-Bool_t *AliHFAssociatedTrackCuts::IsMCpartFromHF(Int_t label, TClonesArray*mcArray){\r
- // Check origin in MC\r
-\r
- AliAODMCParticle* mcParticle;\r
- Int_t pdgCode = -1;\r
- \r
- Bool_t isCharmy = kFALSE;\r
- Bool_t isBeauty = kFALSE;\r
- Bool_t isD = kFALSE;\r
- Bool_t isB = kFALSE;\r
- \r
- Bool_t *originvect = new Bool_t[4];\r
- \r
- originvect[0] = kFALSE;\r
- originvect[1] = kFALSE;\r
- originvect[2] = kFALSE;\r
- originvect[3] = kFALSE;\r
-\r
- if (label<0) return originvect;\r
- \r
- while(pdgCode!=2212){ // loops back to the collision to check the particle source\r
-\r
- mcParticle = dynamic_cast<AliAODMCParticle*>(mcArray->At(label));\r
- if(!mcParticle) {AliError("NO MC PARTICLE"); break;}\r
- pdgCode = TMath::Abs(mcParticle->GetPdgCode());\r
-\r
- label = mcParticle->GetMother();\r
-\r
-\r
- if((pdgCode>=400 && pdgCode <500) || (pdgCode>=4000 && pdgCode<5000 )) isD = kTRUE;\r
- if((pdgCode>=500 && pdgCode <600) || (pdgCode>=5000 && pdgCode<6000 )) {isD = kFALSE; isB = kTRUE;}\r
-\r
-\r
- if(pdgCode == 4) isCharmy = kTRUE;\r
- if(pdgCode == 5) {isBeauty = kTRUE; isCharmy = kFALSE;}\r
- if(label<0) break;\r
-\r
- }\r
-\r
- \r
- originvect[0] = isCharmy;\r
- originvect[1] = isBeauty;\r
- originvect[2] = isD;\r
- originvect[3] = isB;\r
- \r
- \r
- return originvect;\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-Bool_t AliHFAssociatedTrackCuts::InvMassDstarRejection(AliAODRecoDecayHF2Prong* d, AliAODTrack *track, Int_t hypD0) const {\r
- //\r
- // Calculates invmass of track+D0 and rejects if compatible with D*\r
- // (to remove pions from D*)\r
- // \r
- Double_t nsigma = 3.;\r
- \r
- Double_t mD0, mD0bar;\r
- d->InvMassD0(mD0,mD0bar);\r
- \r
- Double_t invmassDstar1 = 0, invmassDstar2 = 0; \r
- Double_t e1Pi = d->EProng(0,211), e2K = d->EProng(1,321); //hyp 1 (pi,K) - D0\r
- Double_t e1K = d->EProng(0,321), e2Pi = d->EProng(1,211); //hyp 2 (K,pi) - D0bar\r
- Double_t psum2 = (d->Px()+track->Px())*(d->Px()+track->Px())\r
- +(d->Py()+track->Py())*(d->Py()+track->Py())\r
- +(d->Pz()+track->Pz())*(d->Pz()+track->Pz());\r
- \r
- switch(hypD0) {\r
- case 1:\r
- invmassDstar1 = TMath::Sqrt(pow(e1Pi+e2K+track->E(0.1396),2.)-psum2);\r
- if ((TMath::Abs(invmassDstar1-mD0)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;\r
- break;\r
- case 2:\r
- invmassDstar2 = TMath::Sqrt(pow(e2Pi+e1K+track->E(0.1396),2.)-psum2);\r
- if ((TMath::Abs(invmassDstar2-mD0bar)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;\r
- break;\r
- case 3:\r
- invmassDstar1 = TMath::Sqrt(pow(e1Pi+e2K+track->E(0.1396),2.)-psum2);\r
- invmassDstar2 = TMath::Sqrt(pow(e2Pi+e1K+track->E(0.1396),2.)-psum2);\r
- if ((TMath::Abs(invmassDstar1-mD0)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;\r
- if ((TMath::Abs(invmassDstar2-mD0bar)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;\r
- break;\r
- }\r
- \r
- return kTRUE;\r
-}\r
-//________________________________________________________\r
-void AliHFAssociatedTrackCuts::SetMCEventTypes(Int_t *MCEventTypeArray)\r
-// set the array of event types you want to process in MonteCarlo (gluon splitting, pair production etc.)\r
-{\r
- if(!fMCEventType) fMCEventType = new Int_t[fNofMCEventType];\r
- \r
- for(Int_t k=0; k<fNofMCEventType; k++){\r
- fMCEventType[k] = MCEventTypeArray[k];\r
- }\r
- return; \r
-}\r
-\r
-//________________________________________________________\r
-void AliHFAssociatedTrackCuts::SetAODTrackCuts(Float_t *cutsarray)\r
-{\r
- if(!fAODTrackCuts) fAODTrackCuts = new Float_t[fNTrackCuts];\r
- for(Int_t i =0; i<fNTrackCuts; i++){\r
- fAODTrackCuts[i] = cutsarray[i];\r
- }\r
- SetTrackCutsNames();\r
- return;\r
-}\r
-//________________________________________________________\r
-void AliHFAssociatedTrackCuts::SetTrackCutsNames(/*TString *namearray*/){\r
- \r
- fTrackCutsNames = new TString[4];\r
- fTrackCutsNames[0]= "associated track:: pt min [GeV/c]................: ";\r
- fTrackCutsNames[1]= "associated track:: pt max [GeV/c]................: ";\r
- fTrackCutsNames[2]= "associated track:: d0 min [cm]...................: ";\r
- fTrackCutsNames[3]= "associated track:: d0 max [cm]...................: ";\r
- \r
-\r
- \r
- return;\r
-}\r
-//--------------------------------------------------------------------------\r
-void AliHFAssociatedTrackCuts::SetAODvZeroCuts(Float_t *cutsarray)\r
-{\r
- \r
-\r
- if(!fAODvZeroCuts) fAODvZeroCuts = new Float_t[fNvZeroCuts];\r
- for(Int_t i =0; i<fNvZeroCuts; i++){\r
- fAODvZeroCuts[i] = cutsarray[i];\r
- }\r
- SetvZeroCutsNames();\r
- return;\r
-}\r
-//--------------------------------------------------------------------------\r
-void AliHFAssociatedTrackCuts::SetvZeroCutsNames(/*TString *namearray*/){\r
- \r
- fvZeroCutsNames = new TString[7];\r
- fvZeroCutsNames[0] = "vZero:: max DCA between two daughters [cm].......: ";\r
- fvZeroCutsNames[1] = "vZero:: max fit Chi Square between two daughters.: ";\r
- fvZeroCutsNames[2] = "vZero:: min decay length [cm]....................: ";\r
- fvZeroCutsNames[3] = "vZero:: max decay length [cm]....................: ";\r
- fvZeroCutsNames[4] = "vZero:: max opening angle between daughters [rad]: ";\r
- fvZeroCutsNames[5] = "vZero:: pt min [Gev/c]...........................: ";\r
- fvZeroCutsNames[6] = "vZero:: |Eta| range <............................: ";\r
- \r
- \r
- return;\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-void AliHFAssociatedTrackCuts::SetPidAssociated()\r
-{\r
- //setting PidResponse\r
- if(fPidObj->GetOldPid()==kFALSE && fPidObj->GetPidResponse()==0x0){\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();\r
- AliPIDResponse *pidResp=inputHandler->GetPIDResponse();\r
- fPidObj->SetPidResponse(pidResp);\r
- }\r
-}\r
-//--------------------------------------------------------------------------\r
-\r
-void AliHFAssociatedTrackCuts::Print(Option_t *option) const\r
-{\r
- /// overloaded from TObject: print info\r
- if (strcmp(option, "parameters")==0) {\r
- PrintPoolParameters();\r
- return;\r
- } else if (strcmp(option, "selectedMC")==0) {\r
- PrintSelectedMCevents();\r
- return;\r
- }\r
- PrintAll();\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-Int_t AliHFAssociatedTrackCuts::GetPoolBin(Double_t multorcent, Double_t zVtx) const\r
-{\r
- \r
- Int_t poolbin = -1;\r
- Int_t centbin = -1;\r
- Int_t zvtxbin = -1;\r
- \r
- \r
- if(multorcent <fCentBins[0]) return poolbin;\r
- if(zVtx <fZvtxBins[0]) return poolbin;\r
- \r
- \r
- for (Int_t i=0;i<fNCentBins;i++){\r
- if(multorcent<fCentBins[i+1]) {\r
- centbin=i;\r
- break;\r
- }\r
- }\r
- \r
- for (Int_t i=0;i<fNzVtxBins;i++){\r
- if(zVtx<fZvtxBins[i+1]) {\r
- zvtxbin=i;\r
- break;\r
- }\r
- }\r
-\r
- poolbin = centbin + zvtxbin*fNzVtxBins;\r
- \r
- return poolbin;\r
-}\r
-//--------------------------------------------------------------------------\r
-void AliHFAssociatedTrackCuts::PrintAll() const\r
-{\r
- \r
- if(fDescription){\r
- printf("=================================================");\r
- printf("\nAdditional description\n");\r
- std::cout << fDescription << std::endl;\r
- printf("\n");\r
- }\r
- printf("\n=================================================");\r
- if(fESDTrackCuts){\r
- printf("\nCuts for the associated track: \n \n");\r
- \r
- printf("ITS Refit........................................: %s\n",fESDTrackCuts->GetRequireITSRefit() ? "Yes" : "No");\r
- printf("TPC Refit........................................: %s\n",fESDTrackCuts->GetRequireTPCRefit() ? "Yes" : "No");\r
- printf("ITS SA...........................................: %s\n",fESDTrackCuts->GetRequireITSStandAlone() ? "Yes" : "No");\r
- printf("TPC SA...........................................: %s\n",fESDTrackCuts->GetRequireTPCStandAlone() ? "Yes" : "No");\r
- printf("Min number of ITS clusters.......................: %d\n",fESDTrackCuts->GetMinNClustersITS());\r
- printf("Min number of TPC clusters.......................: %d\n",fESDTrackCuts->GetMinNClusterTPC());\r
- Int_t spd = fESDTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD);\r
- if(spd==0) std::cout << "SPD..............................................: kOff" << std::endl;\r
- if(spd==1) std::cout << "SPD..............................................: kNone" << std::endl;\r
- if(spd==2) std::cout << "SPD..............................................: kAny" << std::endl;\r
- if(spd==3) std::cout << "SPD..............................................: kFirst" << std::endl;\r
- if(spd==4) std::cout << "SPD..............................................: kOnlyFirst" << std::endl;\r
- if(spd==5) std::cout << "SPD..............................................: kSecond" << std::endl;\r
- if(spd==6) std::cout << "SPD..............................................: kOnlySecond" << std::endl;\r
- if(spd==7) std::cout << "SPD..............................................: kBoth" << std::endl;\r
- }\r
- else printf("\nNo Cuts for Associated Tracks\n");\r
- std::cout << "Filter Bit.......................................: " << fBit << std::endl;\r
- std::cout << "Charge...........................................: " << fCharge << std::endl;\r
- \r
- if(fAODTrackCuts){\r
- for(Int_t j=0;j<fNTrackCuts;j++){\r
- std::cout << fTrackCutsNames[j] << fAODTrackCuts[j] << std::endl;\r
- }\r
- }\r
-\r
- if(fAODvZeroCuts){\r
- printf("\n");\r
- printf("=================================================");\r
- printf("\nCuts for the K0 candidates: \n \n");\r
- for(Int_t k=0;k<fNvZeroCuts;k++){\r
- std::cout << fvZeroCutsNames[k] << fAODvZeroCuts[k] << std::endl;\r
- }\r
- }\r
- else printf("\nNo Cuts for the K0 candidates\n");\r
- std::cout << " " << std::endl;\r
- PrintPoolParameters();\r
- PrintSelectedMCevents();\r
-\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-void AliHFAssociatedTrackCuts::PrintPoolParameters() const\r
-{ \r
- printf("=================================================");\r
- printf("\nEvent Pool settings: \n \n");\r
- \r
- printf("Number of zVtx Bins: %d\n", fNzVtxBins);\r
- printf("\nzVtx Bins:\n");\r
- //Double_t zVtxbinLims[fNzVtxBins+1] = fNzVtxBins;\r
- for(Int_t k=0; k<fNzVtxBins; k++){\r
- printf("Bin %d..............................................: %.1f - %.1f cm\n", k, fZvtxBins[k], fZvtxBins[k+1]); \r
- }\r
- printf("\n");\r
- printf("\nNumber of Centrality(multiplicity) Bins: %d\n", fNCentBins);\r
- printf("\nCentrality(multiplicity) Bins:\n");\r
- for(Int_t k=0; k<fNCentBins; k++){\r
- printf("Bin %d..............................................: %.1f - %.1f\n", k, fCentBins[k], fCentBins[k+1]);\r
- }\r
-\r
- \r
- \r
-}\r
-//--------------------------------------------------------------------------\r
-\r
-Double_t AliHFAssociatedTrackCuts::GetTrackWeight(Double_t pt, Double_t eta,Double_t zvtx){\r
- if(!fEffWeights)return 1.;\r
- \r
- Int_t bin=fEffWeights->FindBin(pt,eta,zvtx);\r
- if(fEffWeights->IsBinUnderflow(bin)||fEffWeights->IsBinOverflow(bin))return 1.;\r
- return fEffWeights->GetBinContent(bin);\r
-\r
-}\r
-\r
-\r
-//--------------------------------------------------------------------------\r
-Double_t AliHFAssociatedTrackCuts::GetTrigWeight(Double_t pt, Double_t mult){\r
- \r
- \r
- \r
- if(fTrigEffWeightsvspt){\r
- Int_t bin=fTrigEffWeightsvspt->FindBin(pt);\r
- if(fTrigEffWeightsvspt->IsBinUnderflow(bin)||fTrigEffWeightsvspt->IsBinOverflow(bin))return 1.;\r
- return fTrigEffWeightsvspt->GetBinContent(bin);\r
- \r
- }\r
- \r
- if(fTrigEffWeights){\r
- Int_t bin=fTrigEffWeights->FindBin(pt,mult);\r
- if(fTrigEffWeights->IsBinUnderflow(bin)||fTrigEffWeights->IsBinOverflow(bin))return 1.;\r
- return fTrigEffWeights->GetBinContent(bin);\r
- \r
- }\r
- \r
- //if(!fTrigEffWeights && !fTrigEffWeightsvspt)return 1.;\r
- \r
- return 1.;\r
- \r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-Double_t AliHFAssociatedTrackCuts::GetTrigWeightB(Double_t pt, Double_t mult){\r
- \r
- if(fTrigEffWeightsvsptB){\r
- Int_t bin=fTrigEffWeightsvsptB->FindBin(pt);\r
- if(fTrigEffWeightsvsptB->IsBinUnderflow(bin)||fTrigEffWeightsvsptB->IsBinOverflow(bin))return 1.;\r
- return fTrigEffWeightsvsptB->GetBinContent(bin);\r
- \r
- }\r
- \r
- if(fTrigEffWeightsB){\r
- Int_t bin=fTrigEffWeightsB->FindBin(pt,mult);\r
- if(fTrigEffWeightsB->IsBinUnderflow(bin)||fTrigEffWeightsB->IsBinOverflow(bin))return 1.;\r
- return fTrigEffWeightsB->GetBinContent(bin);\r
- \r
- }\r
- \r
- // if(!fTrigEffWeightsB && !fTrigEffWeightsvsptB)return 1.;\r
- return 1;\r
-}\r
-//--------------------------------------------------------------------------\r
-void AliHFAssociatedTrackCuts::PrintSelectedMCevents() const\r
-{\r
- printf("\n=================================================");\r
- \r
- printf("\nSelected MC events: \n \n");\r
- printf("Number of selected events: %d\n",fNofMCEventType);\r
- \r
- for(Int_t k=0; k<fNofMCEventType; k++){\r
- if(fMCEventType[k]==28) printf("=> Flavour excitation \n"); \r
- if(fMCEventType[k]==53) printf("=> Pair creation \n"); \r
- if(fMCEventType[k]==68) printf("=> Gluon splitting \n"); \r
- }\r
- \r
- printf("\n");\r
- for(Int_t k=0; k<fNofMCEventType; k++){\r
- printf("MC process code %d \n",fMCEventType[k]); \r
- }\r
- \r
- printf("\n");\r
- \r
- \r
- \r
- \r
-}\r
-\r
-\r
+/**************************************************************************
+ * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////
+//
+// Base class for cuts on Associated tracks for HF Correlation analysis
+//
+// Author: S.Bjelogrlic (Utrecht) sandro.bjelogrlic@cern.ch
+////////////////////////////////////////////////////////////////////////
+#include <Riostream.h>
+#include "AliHFAssociatedTrackCuts.h"
+#include "AliAODPidHF.h"
+#include "AliESDtrackCuts.h"
+#include "AliESDtrack.h"
+#include "AliESDVertex.h"
+#include "AliAODv0.h"
+#include "AliAODVertex.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+#include "TString.h"
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliHFAssociatedTrackCuts)
+
+//--------------------------------------------------------------------------
+AliHFAssociatedTrackCuts::AliHFAssociatedTrackCuts():
+AliAnalysisCuts(),
+fESDTrackCuts(0),
+fPidObj(0),
+ fEffWeights(0),
+
+fTrigEffWeightsvspt(0),
+fTrigEffWeightsvsptB(0),
+fTrigEffWeights(0),
+fTrigEffWeightsB(0),
+fPoolMaxNEvents(0),
+fPoolMinNTracks(0),
+fMinEventsToMix(0),
+fNzVtxBins(0),
+fNzVtxBinsDim(0),
+fZvtxBins(0),
+fNCentBins(0),
+fNCentBinsDim(0),
+fCentBins(0),
+
+fNofMCEventType(0),
+fMCEventType(0),
+
+fNTrackCuts(0),
+fAODTrackCuts(0),
+fTrackCutsNames(0),
+fNvZeroCuts(0),
+fAODvZeroCuts(0),
+fvZeroCutsNames(0),
+fBit(-1),
+fCharge(0),
+fDescription("")
+
+{
+ //
+ //default constructor
+ //
+ //
+ //default constructor
+ //
+
+}
+
+//--------------------------------------------------------------------------
+AliHFAssociatedTrackCuts::AliHFAssociatedTrackCuts(const char* name, const char* title):
+AliAnalysisCuts(name,title),
+fESDTrackCuts(0),
+fPidObj(0),
+fEffWeights(0),
+fTrigEffWeightsvspt(0),
+fTrigEffWeightsvsptB(0),
+fTrigEffWeights(0),
+fTrigEffWeightsB(0),
+fPoolMaxNEvents(0),
+fPoolMinNTracks(0),
+fMinEventsToMix(0),
+fNzVtxBins(0),
+fNzVtxBinsDim(0),
+fZvtxBins(0),
+fNCentBins(0),
+fNCentBinsDim(0),
+fCentBins(0),
+
+fNofMCEventType(0),
+fMCEventType(0),
+
+fNTrackCuts(0),
+fAODTrackCuts(0),
+fTrackCutsNames(0),
+fNvZeroCuts(0),
+fAODvZeroCuts(0),
+fvZeroCutsNames(0),
+fBit(-1),
+fCharge(0),
+fDescription("")
+
+{
+ //
+ //default constructor
+ //
+
+}
+//--------------------------------------------------------------------------
+AliHFAssociatedTrackCuts::AliHFAssociatedTrackCuts(const AliHFAssociatedTrackCuts &source) :
+AliAnalysisCuts(source),
+fESDTrackCuts(source.fESDTrackCuts),
+fPidObj(source.fPidObj),
+fEffWeights(source.fEffWeights),
+fTrigEffWeightsvspt(source.fTrigEffWeightsvspt),
+fTrigEffWeightsvsptB(source.fTrigEffWeightsvsptB),
+fTrigEffWeights(source.fTrigEffWeights),
+fTrigEffWeightsB(source.fTrigEffWeightsB),
+
+fPoolMaxNEvents(source.fPoolMaxNEvents),
+fPoolMinNTracks(source.fPoolMinNTracks),
+fMinEventsToMix(source.fMinEventsToMix),
+fNzVtxBins(source.fNzVtxBins),
+fNzVtxBinsDim(source.fNzVtxBinsDim),
+fZvtxBins(source.fZvtxBins),
+fNCentBins(source.fNCentBins),
+fNCentBinsDim(source.fNCentBinsDim),
+fCentBins(source.fCentBins),
+
+fNofMCEventType(source.fNofMCEventType),
+fMCEventType(source.fMCEventType),
+
+fNTrackCuts(source.fNTrackCuts),
+fAODTrackCuts(source.fAODTrackCuts),
+fTrackCutsNames(source.fTrackCutsNames),
+fNvZeroCuts(source.fNvZeroCuts),
+fAODvZeroCuts(source.fAODvZeroCuts),
+fvZeroCutsNames(source.fvZeroCutsNames),
+fBit(source.fBit),
+fCharge(source.fCharge),
+fDescription(source.fDescription)
+{
+ //
+ // copy constructor
+ //
+
+
+ AliInfo("AliHFAssociatedTrackCuts::Copy constructor ");
+ if(source.fESDTrackCuts) AddTrackCuts(source.fESDTrackCuts);
+ if(source.fAODTrackCuts) SetAODTrackCuts(source.fAODTrackCuts);
+ if(source.fAODvZeroCuts) SetAODvZeroCuts(source.fAODvZeroCuts);
+ if(source.fPidObj) SetPidHF(source.fPidObj);
+ if(source.fEffWeights) SetEfficiencyWeightMap(source.fEffWeights);
+ if(source.fTrigEffWeightsvspt) SetTriggerEffWeightMapvspt(source.fTrigEffWeightsvspt);
+ if(source.fTrigEffWeightsvsptB) SetTriggerEffWeightMapvsptB(source.fTrigEffWeightsvsptB);
+ if(source.fTrigEffWeights) SetTriggerEffWeightMap(source.fTrigEffWeights);
+ if(source.fTrigEffWeightsB)SetTriggerEffWeightMapB(source.fTrigEffWeightsB);
+
+
+}
+//--------------------------------------------------------------------------
+AliHFAssociatedTrackCuts &AliHFAssociatedTrackCuts::operator=(const AliHFAssociatedTrackCuts &source)
+{
+ //
+ // assignment operator
+ //
+ if(&source == this) return *this;
+
+ AliAnalysisCuts::operator=(source);
+ fESDTrackCuts=source.fESDTrackCuts;
+ fPidObj=source.fPidObj;
+ fEffWeights=source.fEffWeights;
+ fTrigEffWeightsvspt=source.fTrigEffWeightsvspt;
+ fTrigEffWeightsvsptB=source.fTrigEffWeightsvsptB;
+ fTrigEffWeights=source.fTrigEffWeights;
+ fTrigEffWeightsB=source.fTrigEffWeightsB;
+ fNTrackCuts=source.fNTrackCuts;
+ fAODTrackCuts=source.fAODTrackCuts;
+ fTrackCutsNames=source.fTrackCutsNames;
+ fNvZeroCuts=source.fNvZeroCuts;
+ fAODvZeroCuts=source.fAODvZeroCuts;
+ fvZeroCutsNames=source.fvZeroCutsNames;
+ fBit=source.fBit;
+ fCharge=source.fCharge;
+
+ return *this;
+
+}
+
+
+//--------------------------------------------------------------------------
+AliHFAssociatedTrackCuts::~AliHFAssociatedTrackCuts()
+{
+ if(fESDTrackCuts) {delete fESDTrackCuts; fESDTrackCuts = 0;}
+ if(fPidObj) {delete fPidObj; fPidObj = 0;}
+ if(fEffWeights){delete fEffWeights;fEffWeights=0;}
+ if(fTrigEffWeightsvspt){delete fTrigEffWeightsvspt;fTrigEffWeightsvspt=0;}
+ if(fTrigEffWeightsvsptB){delete fTrigEffWeightsvsptB;fTrigEffWeightsvsptB=0;}
+ if(fTrigEffWeights){delete fTrigEffWeights;fTrigEffWeights=0;}
+ if(fTrigEffWeightsB){delete fTrigEffWeightsB;fTrigEffWeightsB=0;}
+ if(fZvtxBins) {delete[] fZvtxBins; fZvtxBins=0;}
+ if(fCentBins) {delete[] fCentBins; fCentBins=0;}
+ if(fAODTrackCuts) {delete[] fAODTrackCuts; fAODTrackCuts=0;}
+ if(fTrackCutsNames) {delete[] fTrackCutsNames; fTrackCutsNames=0;}
+ if(fAODvZeroCuts){delete[] fAODvZeroCuts; fAODvZeroCuts=0;}
+ if(fvZeroCutsNames) {delete[] fvZeroCutsNames; fvZeroCutsNames=0;}
+
+
+}
+//--------------------------------------------------------------------------
+Bool_t AliHFAssociatedTrackCuts::IsInAcceptance()
+{
+ printf("Careful: method AliHFAssociatedTrackCuts::IsInAcceptance is not implemented yet \n");
+ return kFALSE;
+}
+//--------------------------------------------------------------------------
+Bool_t AliHFAssociatedTrackCuts::IsHadronSelected(AliAODTrack * track,const AliESDVertex *primary, Double_t magfield)
+{
+
+ AliESDtrack esdtrack(track);
+ if(primary){// needed to calculate impact parameters
+ // needed to calculate the impact parameters
+ esdtrack.RelateToVertex(primary,magfield,3.);
+ }
+ // set the TPC cluster info
+ esdtrack.SetTPCClusterMap(track->GetTPCClusterMap());
+ esdtrack.SetTPCSharedMap(track->GetTPCSharedMap());
+ esdtrack.SetTPCPointsF(track->GetTPCNclsF());
+
+ if(!fESDTrackCuts->IsSelected(&esdtrack)) return kFALSE;
+
+ if(fBit>-1 && !track->TestFilterBit(fBit)) return kFALSE; // check the filter bit
+
+ return kTRUE;
+
+}
+
+//--------------------------------------------------------------------------
+Bool_t AliHFAssociatedTrackCuts::CheckHadronKinematic(Double_t pt, Double_t d0)
+{
+
+
+
+ if(pt < fAODTrackCuts[0]) return kFALSE;
+ if(pt > fAODTrackCuts[1]) return kFALSE;
+ if(d0 < fAODTrackCuts[2]) return kFALSE;
+ if(d0 > fAODTrackCuts[3]) return kFALSE;
+
+ return kTRUE;
+
+
+}
+//--------------------------------------------------------------------------
+
+Bool_t AliHFAssociatedTrackCuts::Charge(Short_t charge, AliAODTrack* track)
+{// charge is the charge to compare to (for example, a daughter of a D meson)
+
+ if(!fCharge) return kTRUE; // if fCharge is set to 0 (no selection on the charge), returns always true
+ if(track->Charge()!= fCharge*charge) return kFALSE;
+ return kTRUE;
+}
+
+//--------------------------------------------------------------------------
+Bool_t AliHFAssociatedTrackCuts::CheckKaonCompatibility(AliAODTrack * track, Bool_t useMc, TClonesArray* mcArray, Int_t method)
+{
+ Bool_t isKaon = kFALSE;
+
+ if(useMc) { // on MC
+ Int_t hadLabel = track->GetLabel();
+ if(hadLabel < 0) return kFALSE;
+ AliAODMCParticle* hadron = dynamic_cast<AliAODMCParticle*>(mcArray->At(hadLabel));
+ if(hadron){
+ Int_t pdg = TMath::Abs(hadron->GetPdgCode());
+ if (pdg == 321) isKaon = kTRUE;
+ }
+ }
+
+ if(!useMc) { // on DATA
+ switch(method) {
+ case(1): {
+ Bool_t isKTPC=kFALSE;
+ Bool_t isPiTPC=kFALSE;
+ Bool_t isPTPC=kFALSE;
+ Bool_t isKTOF=kFALSE;
+ Bool_t isPiTOF=kFALSE;
+ Bool_t isPTOF=kFALSE;
+
+ Bool_t KaonHyp = kFALSE;
+ Bool_t PionHyp = kFALSE;
+ Bool_t ProtonHyp = kFALSE;
+
+ if(fPidObj->CheckStatus(track,"TOF")) {
+ isKTOF=fPidObj->IsKaonRaw(track,"TOF");
+ isPiTOF=fPidObj->IsPionRaw(track,"TOF");
+ isPTOF=fPidObj->IsProtonRaw(track,"TOF");
+ }
+ if(fPidObj->CheckStatus(track,"TPC")){
+ isKTPC=fPidObj->IsKaonRaw(track,"TPC");
+ isPiTPC=fPidObj->IsPionRaw(track,"TPC");
+ isPTPC=fPidObj->IsProtonRaw(track,"TPC");
+ }
+
+ if (isKTOF && isKTPC) KaonHyp = kTRUE;
+ if (isPiTOF && isPiTPC) PionHyp = kTRUE;
+ if (isPTOF && isPTPC) ProtonHyp = kTRUE;
+
+ if(KaonHyp && !PionHyp && !ProtonHyp) isKaon = kTRUE;
+ break;
+ }
+ case(2): {
+ if(fPidObj->MakeRawPid(track,3)>=1) isKaon = kTRUE;
+ break;
+ }
+ }
+ }
+
+ return isKaon;
+
+}
+//--------------------------------------------------------------------------
+Bool_t AliHFAssociatedTrackCuts::IsKZeroSelected(AliAODv0 *vzero, AliAODVertex *vtx1)
+{
+
+ if(vzero->DcaV0Daughters()>fAODvZeroCuts[0]) return kFALSE;
+ if(vzero->Chi2V0()>fAODvZeroCuts[1]) return kFALSE;
+ if(vzero->DecayLength(vtx1) < fAODvZeroCuts[2]) return kFALSE;
+ if(vzero->DecayLength(vtx1) > fAODvZeroCuts[3]) return kFALSE;
+ if(vzero->OpenAngleV0() > fAODvZeroCuts[4]) return kFALSE;
+ if(vzero->Pt() < fAODvZeroCuts[5]) return kFALSE;
+ if(TMath::Abs(vzero->Eta()) > fAODvZeroCuts[6]) return kFALSE;
+
+
+ return kTRUE;
+}
+//--------------------------------------------------------------------------
+Bool_t *AliHFAssociatedTrackCuts::IsMCpartFromHF(Int_t label, TClonesArray*mcArray){
+ // Check origin in MC
+
+ AliAODMCParticle* mcParticle;
+ Int_t pdgCode = -1;
+
+ Bool_t isCharmy = kFALSE;
+ Bool_t isBeauty = kFALSE;
+ Bool_t isD = kFALSE;
+ Bool_t isB = kFALSE;
+
+ Bool_t *originvect = new Bool_t[4];
+
+ originvect[0] = kFALSE;
+ originvect[1] = kFALSE;
+ originvect[2] = kFALSE;
+ originvect[3] = kFALSE;
+
+ if (label<0) return originvect;
+
+ while(pdgCode!=2212){ // loops back to the collision to check the particle source
+
+ mcParticle = dynamic_cast<AliAODMCParticle*>(mcArray->At(label));
+ if(!mcParticle) {AliError("NO MC PARTICLE"); break;}
+ pdgCode = TMath::Abs(mcParticle->GetPdgCode());
+
+ label = mcParticle->GetMother();
+
+
+ if((pdgCode>=400 && pdgCode <500) || (pdgCode>=4000 && pdgCode<5000 )) isD = kTRUE;
+ if((pdgCode>=500 && pdgCode <600) || (pdgCode>=5000 && pdgCode<6000 )) {isD = kFALSE; isB = kTRUE;}
+
+
+ if(pdgCode == 4) isCharmy = kTRUE;
+ if(pdgCode == 5) {isBeauty = kTRUE; isCharmy = kFALSE;}
+ if(label<0) break;
+
+ }
+
+
+ originvect[0] = isCharmy;
+ originvect[1] = isBeauty;
+ originvect[2] = isD;
+ originvect[3] = isB;
+
+
+ return originvect;
+}
+
+//--------------------------------------------------------------------------
+Bool_t AliHFAssociatedTrackCuts::InvMassDstarRejection(AliAODRecoDecayHF2Prong* d, AliAODTrack *track, Int_t hypD0) const {
+ //
+ // Calculates invmass of track+D0 and rejects if compatible with D*
+ // (to remove pions from D*)
+ //
+ Double_t nsigma = 3.;
+
+ Double_t mD0, mD0bar;
+ d->InvMassD0(mD0,mD0bar);
+
+ Double_t invmassDstar1 = 0, invmassDstar2 = 0;
+ Double_t e1Pi = d->EProng(0,211), e2K = d->EProng(1,321); //hyp 1 (pi,K) - D0
+ Double_t e1K = d->EProng(0,321), e2Pi = d->EProng(1,211); //hyp 2 (K,pi) - D0bar
+ Double_t psum2 = (d->Px()+track->Px())*(d->Px()+track->Px())
+ +(d->Py()+track->Py())*(d->Py()+track->Py())
+ +(d->Pz()+track->Pz())*(d->Pz()+track->Pz());
+
+ switch(hypD0) {
+ case 1:
+ invmassDstar1 = TMath::Sqrt(pow(e1Pi+e2K+track->E(0.1396),2.)-psum2);
+ if ((TMath::Abs(invmassDstar1-mD0)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;
+ break;
+ case 2:
+ invmassDstar2 = TMath::Sqrt(pow(e2Pi+e1K+track->E(0.1396),2.)-psum2);
+ if ((TMath::Abs(invmassDstar2-mD0bar)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;
+ break;
+ case 3:
+ invmassDstar1 = TMath::Sqrt(pow(e1Pi+e2K+track->E(0.1396),2.)-psum2);
+ invmassDstar2 = TMath::Sqrt(pow(e2Pi+e1K+track->E(0.1396),2.)-psum2);
+ if ((TMath::Abs(invmassDstar1-mD0)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;
+ if ((TMath::Abs(invmassDstar2-mD0bar)-0.14543) < nsigma*800.*pow(10.,-6.)) return kFALSE;
+ break;
+ }
+
+ return kTRUE;
+}
+//________________________________________________________
+void AliHFAssociatedTrackCuts::SetMCEventTypes(Int_t *MCEventTypeArray)
+// set the array of event types you want to process in MonteCarlo (gluon splitting, pair production etc.)
+{
+ if(!fMCEventType) fMCEventType = new Int_t[fNofMCEventType];
+
+ for(Int_t k=0; k<fNofMCEventType; k++){
+ fMCEventType[k] = MCEventTypeArray[k];
+ }
+ return;
+}
+
+//________________________________________________________
+void AliHFAssociatedTrackCuts::SetAODTrackCuts(Float_t *cutsarray)
+{
+ if(!fAODTrackCuts) fAODTrackCuts = new Float_t[fNTrackCuts];
+ for(Int_t i =0; i<fNTrackCuts; i++){
+ fAODTrackCuts[i] = cutsarray[i];
+ }
+ SetTrackCutsNames();
+ return;
+}
+//________________________________________________________
+void AliHFAssociatedTrackCuts::SetTrackCutsNames(/*TString *namearray*/){
+
+ fTrackCutsNames = new TString[4];
+ fTrackCutsNames[0]= "associated track:: pt min [GeV/c]................: ";
+ fTrackCutsNames[1]= "associated track:: pt max [GeV/c]................: ";
+ fTrackCutsNames[2]= "associated track:: d0 min [cm]...................: ";
+ fTrackCutsNames[3]= "associated track:: d0 max [cm]...................: ";
+
+
+
+ return;
+}
+//--------------------------------------------------------------------------
+void AliHFAssociatedTrackCuts::SetAODvZeroCuts(Float_t *cutsarray)
+{
+
+
+ if(!fAODvZeroCuts) fAODvZeroCuts = new Float_t[fNvZeroCuts];
+ for(Int_t i =0; i<fNvZeroCuts; i++){
+ fAODvZeroCuts[i] = cutsarray[i];
+ }
+ SetvZeroCutsNames();
+ return;
+}
+//--------------------------------------------------------------------------
+void AliHFAssociatedTrackCuts::SetvZeroCutsNames(/*TString *namearray*/){
+
+ fvZeroCutsNames = new TString[7];
+ fvZeroCutsNames[0] = "vZero:: max DCA between two daughters [cm].......: ";
+ fvZeroCutsNames[1] = "vZero:: max fit Chi Square between two daughters.: ";
+ fvZeroCutsNames[2] = "vZero:: min decay length [cm]....................: ";
+ fvZeroCutsNames[3] = "vZero:: max decay length [cm]....................: ";
+ fvZeroCutsNames[4] = "vZero:: max opening angle between daughters [rad]: ";
+ fvZeroCutsNames[5] = "vZero:: pt min [Gev/c]...........................: ";
+ fvZeroCutsNames[6] = "vZero:: |Eta| range <............................: ";
+
+
+ return;
+}
+
+//--------------------------------------------------------------------------
+void AliHFAssociatedTrackCuts::SetPidAssociated()
+{
+ //setting PidResponse
+ if(fPidObj->GetOldPid()==kFALSE && fPidObj->GetPidResponse()==0x0){
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
+ AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
+ fPidObj->SetPidResponse(pidResp);
+ }
+}
+//--------------------------------------------------------------------------
+
+void AliHFAssociatedTrackCuts::Print(Option_t *option) const
+{
+ /// overloaded from TObject: print info
+ if (strcmp(option, "parameters")==0) {
+ PrintPoolParameters();
+ return;
+ } else if (strcmp(option, "selectedMC")==0) {
+ PrintSelectedMCevents();
+ return;
+ }
+ PrintAll();
+}
+
+//--------------------------------------------------------------------------
+Int_t AliHFAssociatedTrackCuts::GetPoolBin(Double_t multorcent, Double_t zVtx) const
+{
+
+ Int_t poolbin = -1;
+ Int_t centbin = -1;
+ Int_t zvtxbin = -1;
+
+
+ if(multorcent <fCentBins[0]) return poolbin;
+ if(zVtx <fZvtxBins[0]) return poolbin;
+
+
+ for (Int_t i=0;i<fNCentBins;i++){
+ if(multorcent<fCentBins[i+1]) {
+ centbin=i;
+ break;
+ }
+ }
+
+ for (Int_t i=0;i<fNzVtxBins;i++){
+ if(zVtx<fZvtxBins[i+1]) {
+ zvtxbin=i;
+ break;
+ }
+ }
+
+ poolbin = centbin + zvtxbin*fNzVtxBins;
+
+ return poolbin;
+}
+//--------------------------------------------------------------------------
+void AliHFAssociatedTrackCuts::PrintAll() const
+{
+
+ if(fDescription){
+ printf("=================================================");
+ printf("\nAdditional description\n");
+ std::cout << fDescription << std::endl;
+ printf("\n");
+ }
+ printf("\n=================================================");
+ if(fESDTrackCuts){
+ printf("\nCuts for the associated track: \n \n");
+
+ printf("ITS Refit........................................: %s\n",fESDTrackCuts->GetRequireITSRefit() ? "Yes" : "No");
+ printf("TPC Refit........................................: %s\n",fESDTrackCuts->GetRequireTPCRefit() ? "Yes" : "No");
+ printf("ITS SA...........................................: %s\n",fESDTrackCuts->GetRequireITSStandAlone() ? "Yes" : "No");
+ printf("TPC SA...........................................: %s\n",fESDTrackCuts->GetRequireTPCStandAlone() ? "Yes" : "No");
+ printf("Min number of ITS clusters.......................: %d\n",fESDTrackCuts->GetMinNClustersITS());
+ printf("Min number of TPC clusters.......................: %d\n",fESDTrackCuts->GetMinNClusterTPC());
+ Int_t spd = fESDTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD);
+ if(spd==0) std::cout << "SPD..............................................: kOff" << std::endl;
+ if(spd==1) std::cout << "SPD..............................................: kNone" << std::endl;
+ if(spd==2) std::cout << "SPD..............................................: kAny" << std::endl;
+ if(spd==3) std::cout << "SPD..............................................: kFirst" << std::endl;
+ if(spd==4) std::cout << "SPD..............................................: kOnlyFirst" << std::endl;
+ if(spd==5) std::cout << "SPD..............................................: kSecond" << std::endl;
+ if(spd==6) std::cout << "SPD..............................................: kOnlySecond" << std::endl;
+ if(spd==7) std::cout << "SPD..............................................: kBoth" << std::endl;
+ }
+ else printf("\nNo Cuts for Associated Tracks\n");
+ std::cout << "Filter Bit.......................................: " << fBit << std::endl;
+ std::cout << "Charge...........................................: " << fCharge << std::endl;
+
+ if(fAODTrackCuts){
+ for(Int_t j=0;j<fNTrackCuts;j++){
+ std::cout << fTrackCutsNames[j] << fAODTrackCuts[j] << std::endl;
+ }
+ }
+
+ if(fAODvZeroCuts){
+ printf("\n");
+ printf("=================================================");
+ printf("\nCuts for the K0 candidates: \n \n");
+ for(Int_t k=0;k<fNvZeroCuts;k++){
+ std::cout << fvZeroCutsNames[k] << fAODvZeroCuts[k] << std::endl;
+ }
+ }
+ else printf("\nNo Cuts for the K0 candidates\n");
+ std::cout << " " << std::endl;
+ PrintPoolParameters();
+ PrintSelectedMCevents();
+
+}
+
+//--------------------------------------------------------------------------
+void AliHFAssociatedTrackCuts::PrintPoolParameters() const
+{
+ printf("=================================================");
+ printf("\nEvent Pool settings: \n \n");
+
+ printf("Number of zVtx Bins: %d\n", fNzVtxBins);
+ printf("\nzVtx Bins:\n");
+ //Double_t zVtxbinLims[fNzVtxBins+1] = fNzVtxBins;
+ for(Int_t k=0; k<fNzVtxBins; k++){
+ printf("Bin %d..............................................: %.1f - %.1f cm\n", k, fZvtxBins[k], fZvtxBins[k+1]);
+ }
+ printf("\n");
+ printf("\nNumber of Centrality(multiplicity) Bins: %d\n", fNCentBins);
+ printf("\nCentrality(multiplicity) Bins:\n");
+ for(Int_t k=0; k<fNCentBins; k++){
+ printf("Bin %d..............................................: %.1f - %.1f\n", k, fCentBins[k], fCentBins[k+1]);
+ }
+
+
+
+}
+//--------------------------------------------------------------------------
+
+Double_t AliHFAssociatedTrackCuts::GetTrackWeight(Double_t pt, Double_t eta,Double_t zvtx){
+ if(!fEffWeights)return 1.;
+
+ Int_t bin=fEffWeights->FindBin(pt,eta,zvtx);
+ if(fEffWeights->IsBinUnderflow(bin)||fEffWeights->IsBinOverflow(bin))return 1.;
+ return fEffWeights->GetBinContent(bin);
+
+}
+
+
+//--------------------------------------------------------------------------
+Double_t AliHFAssociatedTrackCuts::GetTrigWeight(Double_t pt, Double_t mult){
+
+
+
+ if(fTrigEffWeightsvspt){
+ Int_t bin=fTrigEffWeightsvspt->FindBin(pt);
+ if(fTrigEffWeightsvspt->IsBinUnderflow(bin)||fTrigEffWeightsvspt->IsBinOverflow(bin))return 1.;
+ return fTrigEffWeightsvspt->GetBinContent(bin);
+
+ }
+
+ if(fTrigEffWeights){
+ Int_t bin=fTrigEffWeights->FindBin(pt,mult);
+ if(fTrigEffWeights->IsBinUnderflow(bin)||fTrigEffWeights->IsBinOverflow(bin))return 1.;
+ return fTrigEffWeights->GetBinContent(bin);
+
+ }
+
+ //if(!fTrigEffWeights && !fTrigEffWeightsvspt)return 1.;
+
+ return 1.;
+
+}
+
+//--------------------------------------------------------------------------
+Double_t AliHFAssociatedTrackCuts::GetTrigWeightB(Double_t pt, Double_t mult){
+
+ if(fTrigEffWeightsvsptB){
+ Int_t bin=fTrigEffWeightsvsptB->FindBin(pt);
+ if(fTrigEffWeightsvsptB->IsBinUnderflow(bin)||fTrigEffWeightsvsptB->IsBinOverflow(bin))return 1.;
+ return fTrigEffWeightsvsptB->GetBinContent(bin);
+
+ }
+
+ if(fTrigEffWeightsB){
+ Int_t bin=fTrigEffWeightsB->FindBin(pt,mult);
+ if(fTrigEffWeightsB->IsBinUnderflow(bin)||fTrigEffWeightsB->IsBinOverflow(bin))return 1.;
+ return fTrigEffWeightsB->GetBinContent(bin);
+
+ }
+
+ // if(!fTrigEffWeightsB && !fTrigEffWeightsvsptB)return 1.;
+ return 1;
+}
+//--------------------------------------------------------------------------
+void AliHFAssociatedTrackCuts::PrintSelectedMCevents() const
+{
+ printf("\n=================================================");
+
+ printf("\nSelected MC events: \n \n");
+ printf("Number of selected events: %d\n",fNofMCEventType);
+
+ for(Int_t k=0; k<fNofMCEventType; k++){
+ if(fMCEventType[k]==28) printf("=> Flavour excitation \n");
+ if(fMCEventType[k]==53) printf("=> Pair creation \n");
+ if(fMCEventType[k]==68) printf("=> Gluon splitting \n");
+ }
+
+ printf("\n");
+ for(Int_t k=0; k<fNofMCEventType; k++){
+ printf("MC process code %d \n",fMCEventType[k]);
+ }
+
+ printf("\n");
+
+
+
+
+}
+
+
-#ifndef AliHFAssociatedTrackCuts_H\r
-#define AliHFAssociatedTrackCuts_H\r
-/**************************************************************************\r
- * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-/* $Id$ */\r
-\r
-////////////////////////////////////////////////////////////////////////\r
-//\r
-// Base class for cuts on Associated tracks for HF Correlation analysis\r
-//\r
-// Author: S.Bjelogrlic (Utrecht) sandro.bjelogrlic@cern.ch\r
-////////////////////////////////////////////////////////////////////////\r
-\r
-#include <TString.h>\r
-#include "AliAnalysisCuts.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliESDVertex.h"\r
-#include "AliAODPidHF.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODRecoDecayHF2Prong.h"\r
-#include <TClonesArray.h>\r
-#include <TH3D.h>\r
-\r
-\r
-class AliAODTrack;\r
-class AliAODEvent;\r
-\r
-\r
-//\r
-class AliHFAssociatedTrackCuts : public AliAnalysisCuts\r
-{\r
- public: \r
- AliHFAssociatedTrackCuts();\r
- AliHFAssociatedTrackCuts(const char* name, const char* title);\r
- \r
- \r
- AliHFAssociatedTrackCuts(const AliHFAssociatedTrackCuts& source);\r
- AliHFAssociatedTrackCuts& operator=(const AliHFAssociatedTrackCuts& source);\r
- \r
- virtual ~AliHFAssociatedTrackCuts(); // destructor\r
- Bool_t IsSelected(TList* list) {if(list) return kTRUE; return kFALSE;};\r
- Bool_t IsSelected(TObject* obj) {if(obj) return kTRUE; return kFALSE;};\r
- Bool_t IsInAcceptance();\r
- Bool_t IsHadronSelected(AliAODTrack * track,const AliESDVertex *primary=0x0, Double_t magfield=0);\r
- Bool_t CheckHadronKinematic(Double_t pt, Double_t d0); \r
- Bool_t Charge(Short_t charge, AliAODTrack* track);\r
- Bool_t CheckKaonCompatibility(AliAODTrack * track, Bool_t useMc, TClonesArray* mcArray, Int_t method=1);\r
- Bool_t IsKZeroSelected(AliAODv0 *vzero, AliAODVertex *vtx1);\r
- Bool_t *IsMCpartFromHF(Int_t label, TClonesArray*mcArray);\r
- Bool_t InvMassDstarRejection(AliAODRecoDecayHF2Prong* d, AliAODTrack *track, Int_t hypD0) const;\r
- void SetPidAssociated(); \r
- \r
- // getters\r
- AliESDtrackCuts * GetESDTrackCuts() const {return fESDTrackCuts;}\r
- AliAODPidHF * GetPIDObject() const {return fPidObj;}\r
- TH3D * GetEfficiencyWeight() const {return fEffWeights;}\r
- \r
- Int_t GetMaxNEventsInPool() const {return fPoolMaxNEvents;}\r
- Int_t GetMinNTracksInPool() const {return fPoolMinNTracks;}\r
- Int_t GetMinEventsToMix() const {return fMinEventsToMix;}\r
- Int_t GetNZvtxPoolBins() const {return fNzVtxBins;}\r
- Double_t *GetZvtxPoolBins() const {return fZvtxBins;}\r
- Int_t GetNCentPoolBins() const {return fNCentBins;}\r
- Double_t *GetCentPoolBins() const {return fCentBins;}\r
- \r
- Int_t GetNofMCEventType() const {return fNofMCEventType;}\r
- Int_t *GetMCEventType() const {return fMCEventType;}\r
- Int_t GetPoolBin(Double_t multorcent, Double_t zVtx) const;\r
- \r
- Int_t GetNTrackCuts() const {return fNTrackCuts;}\r
- Float_t* GetAODTrackCuts() const {return fAODTrackCuts;}\r
- TString * GetTrackCutNames() const {return fTrackCutsNames;}\r
- Int_t GetNvZeroCuts() const {return fNvZeroCuts;}\r
- Float_t * GetAODvZeroCuts() const {return fAODvZeroCuts;}\r
- TString * GetvZeroCutNames() const {return fvZeroCutsNames;}\r
- Int_t GetFilterBit() const {return fBit;}\r
- Short_t GetCharge() const {return fCharge;}\r
- TString GetDescription() const {return fDescription;}\r
- \r
-\r
- \r
- \r
- \r
- void AddTrackCuts(const AliESDtrackCuts *cuts) {\r
- delete fESDTrackCuts; \r
- fESDTrackCuts=new AliESDtrackCuts(*cuts); \r
- return;\r
- }\r
- \r
- void AddDescription(TString description){fDescription=description;}\r
- \r
- //setters\r
- //event pool settings\r
- void SetMaxNEventsInPool(Int_t events){fPoolMaxNEvents=events;}\r
- void SetMinNTracksInPool(Int_t tracks){fPoolMinNTracks=tracks;}\r
- void SetMinEventsToMix(Int_t events){fMinEventsToMix=events;}\r
- \r
- void SetNofPoolBins(Int_t Nzvtxbins, Int_t Ncentbins){\r
- fNzVtxBins=Nzvtxbins;\r
- fNzVtxBinsDim=Nzvtxbins+1;\r
- \r
- fNCentBins=Ncentbins;\r
- fNCentBinsDim=Ncentbins+1;\r
- }\r
- \r
- void SetPoolBins(Double_t *ZvtxBins, Double_t* CentBins){\r
- fZvtxBins=ZvtxBins; \r
- fCentBins=CentBins;\r
- }\r
- \r
- // set MC events to process\r
- \r
- void SetNofMCEventTypes(Int_t k) {fNofMCEventType=k;}\r
- void SetMCEventTypes(Int_t *MCEventTypeArray);\r
- \r
- //cut settings\r
- void SetAODTrackCuts(Float_t *cutsarray);\r
- void SetTrackCutsNames(/*TString *namearray*/);\r
- void SetAODvZeroCuts(Float_t *cutsarray);\r
- void SetvZeroCutsNames(/*TString *namearray*/);\r
- void SetPidHF(AliAODPidHF* pid) {fPidObj = pid; return;}\r
- void SetCharge(Short_t charge) {fCharge = charge;}\r
- void SetFilterBit(Int_t bit) {fBit = bit;}\r
- void SetEfficiencyWeightMap(TH3D *hMap){if(fEffWeights)delete fEffWeights;fEffWeights=(TH3D*)hMap->Clone();}\r
- \r
- void SetTriggerEffWeightMapvspt(TH1D* hTrigMap) {if(fTrigEffWeightsvspt) delete fTrigEffWeightsvspt; fTrigEffWeightsvspt=(TH1D*)hTrigMap->Clone();}\r
- void SetTriggerEffWeightMapvsptB(TH1D* hTrigMapB) {if(fTrigEffWeightsvsptB) delete fTrigEffWeightsvsptB; fTrigEffWeightsvsptB=(TH1D*)hTrigMapB->Clone();}\r
- \r
- void SetTriggerEffWeightMap(TH2D* hTrigMap) {if(fTrigEffWeights) delete fTrigEffWeights; fTrigEffWeights=(TH2D*)hTrigMap->Clone();}\r
- void SetTriggerEffWeightMapB(TH2D* hTrigMapB) {if(fTrigEffWeightsB) delete fTrigEffWeightsB; fTrigEffWeightsB=(TH2D*)hTrigMapB->Clone();}\r
- \r
- \r
- Double_t GetTrackWeight(Double_t pt, Double_t eta,Double_t zvtx);\r
- Double_t GetTrigWeight(Double_t pt, Double_t mult=0);\r
- Double_t GetTrigWeightB(Double_t pt, Double_t mult=0);\r
- \r
- Bool_t IsTrackEffMap(){if(fEffWeights) return kTRUE; else return kFALSE;}\r
- Bool_t IsTrigEffMap1D(){ if(fTrigEffWeightsvspt) return kTRUE; else return kFALSE;}\r
- Bool_t IsTrigEffMap1DB(){ if(fTrigEffWeightsvsptB) return kTRUE; else return kFALSE;}\r
- Bool_t IsTrigEffMap2D(){ if(fTrigEffWeights) return kTRUE; else return kFALSE;}\r
- Bool_t IsTrigEffMap2DB(){ if(fTrigEffWeightsB) return kTRUE; else return kFALSE;}\r
- \r
- \r
- void Print(Option_t *option) const;\r
- virtual void PrintAll() const;\r
- virtual void PrintPoolParameters() const;\r
- virtual void PrintSelectedMCevents() const;\r
-\r
- \r
- \r
- \r
- void SetNVarsTrack(Int_t nVars){fNTrackCuts=nVars;}\r
- void SetNVarsVzero(Int_t nVars){fNvZeroCuts=nVars;}\r
- \r
- \r
- \r
-private:\r
- AliESDtrackCuts *fESDTrackCuts; // track cut object\r
- AliAODPidHF * fPidObj; /// PID object\r
- TH3D *fEffWeights; // weight map (pt,eta,zvtx) to account for single track efficiency\r
- TH1D *fTrigEffWeightsvspt; // weight map (pt,mult) to account for trigger efficiency (on data, from c)\r
- TH1D *fTrigEffWeightsvsptB; // weight map (pt,mult) to account for trigger efficiency (from b)\r
- TH2D *fTrigEffWeights; // weight map (pt,mult) to account for trigger efficiency (on data, from c)\r
- TH2D *fTrigEffWeightsB; // weight map (pt,mult) to account for trigger efficiency (from b)\r
- Int_t fPoolMaxNEvents; // set maximum number of events in the pool\r
- Int_t fPoolMinNTracks; // se minimum number of tracks in the pool\r
- Int_t fMinEventsToMix; // set the minimum number of events you wanna mix\r
- \r
- Int_t fNzVtxBins; // number of z vrtx bins\r
- Int_t fNzVtxBinsDim; // number of z vrtx bins +1 : necessary to initialize correctly the array\r
- Double_t* fZvtxBins; // [fNzVtxBinsDim]\r
- \r
- \r
- Int_t fNCentBins; //number of centrality bins\r
- Int_t fNCentBinsDim; //number of centrality bins bins +1 : necessary to initialize correctly the array\r
- Double_t* fCentBins; // [fNCentBinsDim]\r
- \r
- Int_t fNofMCEventType;// number of event types to be selected in MC simultaneously;\r
- Int_t *fMCEventType;//[fNofMCEventType]\r
- \r
- Int_t fNTrackCuts; // array dimension\r
- Float_t* fAODTrackCuts;//[fNTrackCuts]\r
- TString * fTrackCutsNames;//[fNTrackCuts]\r
- Int_t fNvZeroCuts;// array dimension\r
- Float_t *fAODvZeroCuts;//[fNvZeroCuts]\r
- TString * fvZeroCutsNames;//[fNvZeroCuts]\r
- Int_t fBit; // filterBit\r
- Short_t fCharge; // charge (+1 or -1)\r
- TString fDescription; // additional description to the cuts\r
- \r
- \r
- ClassDef(AliHFAssociatedTrackCuts,6);\r
-};\r
-\r
-\r
-#endif\r
+#ifndef AliHFAssociatedTrackCuts_H
+#define AliHFAssociatedTrackCuts_H
+/**************************************************************************
+ * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////
+//
+// Base class for cuts on Associated tracks for HF Correlation analysis
+//
+// Author: S.Bjelogrlic (Utrecht) sandro.bjelogrlic@cern.ch
+////////////////////////////////////////////////////////////////////////
+
+#include <TString.h>
+#include "AliAnalysisCuts.h"
+#include "AliESDtrackCuts.h"
+#include "AliESDVertex.h"
+#include "AliAODPidHF.h"
+#include "AliAODEvent.h"
+#include "AliAODRecoDecayHF2Prong.h"
+#include <TClonesArray.h>
+#include <TH3D.h>
+
+
+class AliAODTrack;
+class AliAODEvent;
+
+
+//
+class AliHFAssociatedTrackCuts : public AliAnalysisCuts
+{
+ public:
+ AliHFAssociatedTrackCuts();
+ AliHFAssociatedTrackCuts(const char* name, const char* title);
+
+
+ AliHFAssociatedTrackCuts(const AliHFAssociatedTrackCuts& source);
+ AliHFAssociatedTrackCuts& operator=(const AliHFAssociatedTrackCuts& source);
+
+ virtual ~AliHFAssociatedTrackCuts(); // destructor
+ Bool_t IsSelected(TList* list) {if(list) return kTRUE; return kFALSE;};
+ Bool_t IsSelected(TObject* obj) {if(obj) return kTRUE; return kFALSE;};
+ Bool_t IsInAcceptance();
+ Bool_t IsHadronSelected(AliAODTrack * track,const AliESDVertex *primary=0x0, Double_t magfield=0);
+ Bool_t CheckHadronKinematic(Double_t pt, Double_t d0);
+ Bool_t Charge(Short_t charge, AliAODTrack* track);
+ Bool_t CheckKaonCompatibility(AliAODTrack * track, Bool_t useMc, TClonesArray* mcArray, Int_t method=1);
+ Bool_t IsKZeroSelected(AliAODv0 *vzero, AliAODVertex *vtx1);
+ Bool_t *IsMCpartFromHF(Int_t label, TClonesArray*mcArray);
+ Bool_t InvMassDstarRejection(AliAODRecoDecayHF2Prong* d, AliAODTrack *track, Int_t hypD0) const;
+ void SetPidAssociated();
+
+ // getters
+ AliESDtrackCuts * GetESDTrackCuts() const {return fESDTrackCuts;}
+ AliAODPidHF * GetPIDObject() const {return fPidObj;}
+ TH3D * GetEfficiencyWeight() const {return fEffWeights;}
+
+ Int_t GetMaxNEventsInPool() const {return fPoolMaxNEvents;}
+ Int_t GetMinNTracksInPool() const {return fPoolMinNTracks;}
+ Int_t GetMinEventsToMix() const {return fMinEventsToMix;}
+ Int_t GetNZvtxPoolBins() const {return fNzVtxBins;}
+ Double_t *GetZvtxPoolBins() const {return fZvtxBins;}
+ Int_t GetNCentPoolBins() const {return fNCentBins;}
+ Double_t *GetCentPoolBins() const {return fCentBins;}
+
+ Int_t GetNofMCEventType() const {return fNofMCEventType;}
+ Int_t *GetMCEventType() const {return fMCEventType;}
+ Int_t GetPoolBin(Double_t multorcent, Double_t zVtx) const;
+
+ Int_t GetNTrackCuts() const {return fNTrackCuts;}
+ Float_t* GetAODTrackCuts() const {return fAODTrackCuts;}
+ TString * GetTrackCutNames() const {return fTrackCutsNames;}
+ Int_t GetNvZeroCuts() const {return fNvZeroCuts;}
+ Float_t * GetAODvZeroCuts() const {return fAODvZeroCuts;}
+ TString * GetvZeroCutNames() const {return fvZeroCutsNames;}
+ Int_t GetFilterBit() const {return fBit;}
+ Short_t GetCharge() const {return fCharge;}
+ TString GetDescription() const {return fDescription;}
+
+
+
+
+
+ void AddTrackCuts(const AliESDtrackCuts *cuts) {
+ delete fESDTrackCuts;
+ fESDTrackCuts=new AliESDtrackCuts(*cuts);
+ return;
+ }
+
+ void AddDescription(TString description){fDescription=description;}
+
+ //setters
+ //event pool settings
+ void SetMaxNEventsInPool(Int_t events){fPoolMaxNEvents=events;}
+ void SetMinNTracksInPool(Int_t tracks){fPoolMinNTracks=tracks;}
+ void SetMinEventsToMix(Int_t events){fMinEventsToMix=events;}
+
+ void SetNofPoolBins(Int_t Nzvtxbins, Int_t Ncentbins){
+ fNzVtxBins=Nzvtxbins;
+ fNzVtxBinsDim=Nzvtxbins+1;
+
+ fNCentBins=Ncentbins;
+ fNCentBinsDim=Ncentbins+1;
+ }
+
+ void SetPoolBins(Double_t *ZvtxBins, Double_t* CentBins){
+ fZvtxBins=ZvtxBins;
+ fCentBins=CentBins;
+ }
+
+ // set MC events to process
+
+ void SetNofMCEventTypes(Int_t k) {fNofMCEventType=k;}
+ void SetMCEventTypes(Int_t *MCEventTypeArray);
+
+ //cut settings
+ void SetAODTrackCuts(Float_t *cutsarray);
+ void SetTrackCutsNames(/*TString *namearray*/);
+ void SetAODvZeroCuts(Float_t *cutsarray);
+ void SetvZeroCutsNames(/*TString *namearray*/);
+ void SetPidHF(AliAODPidHF* pid) {fPidObj = pid; return;}
+ void SetCharge(Short_t charge) {fCharge = charge;}
+ void SetFilterBit(Int_t bit) {fBit = bit;}
+ void SetEfficiencyWeightMap(TH3D *hMap){if(fEffWeights)delete fEffWeights;fEffWeights=(TH3D*)hMap->Clone();}
+
+ void SetTriggerEffWeightMapvspt(TH1D* hTrigMap) {if(fTrigEffWeightsvspt) delete fTrigEffWeightsvspt; fTrigEffWeightsvspt=(TH1D*)hTrigMap->Clone();}
+ void SetTriggerEffWeightMapvsptB(TH1D* hTrigMapB) {if(fTrigEffWeightsvsptB) delete fTrigEffWeightsvsptB; fTrigEffWeightsvsptB=(TH1D*)hTrigMapB->Clone();}
+
+ void SetTriggerEffWeightMap(TH2D* hTrigMap) {if(fTrigEffWeights) delete fTrigEffWeights; fTrigEffWeights=(TH2D*)hTrigMap->Clone();}
+ void SetTriggerEffWeightMapB(TH2D* hTrigMapB) {if(fTrigEffWeightsB) delete fTrigEffWeightsB; fTrigEffWeightsB=(TH2D*)hTrigMapB->Clone();}
+
+
+ Double_t GetTrackWeight(Double_t pt, Double_t eta,Double_t zvtx);
+ Double_t GetTrigWeight(Double_t pt, Double_t mult=0);
+ Double_t GetTrigWeightB(Double_t pt, Double_t mult=0);
+
+ Bool_t IsTrackEffMap(){if(fEffWeights) return kTRUE; else return kFALSE;}
+ Bool_t IsTrigEffMap1D(){ if(fTrigEffWeightsvspt) return kTRUE; else return kFALSE;}
+ Bool_t IsTrigEffMap1DB(){ if(fTrigEffWeightsvsptB) return kTRUE; else return kFALSE;}
+ Bool_t IsTrigEffMap2D(){ if(fTrigEffWeights) return kTRUE; else return kFALSE;}
+ Bool_t IsTrigEffMap2DB(){ if(fTrigEffWeightsB) return kTRUE; else return kFALSE;}
+
+
+ void Print(Option_t *option) const;
+ virtual void PrintAll() const;
+ virtual void PrintPoolParameters() const;
+ virtual void PrintSelectedMCevents() const;
+
+
+
+
+ void SetNVarsTrack(Int_t nVars){fNTrackCuts=nVars;}
+ void SetNVarsVzero(Int_t nVars){fNvZeroCuts=nVars;}
+
+
+
+private:
+ AliESDtrackCuts *fESDTrackCuts; // track cut object
+ AliAODPidHF * fPidObj; /// PID object
+ TH3D *fEffWeights; // weight map (pt,eta,zvtx) to account for single track efficiency
+ TH1D *fTrigEffWeightsvspt; // weight map (pt,mult) to account for trigger efficiency (on data, from c)
+ TH1D *fTrigEffWeightsvsptB; // weight map (pt,mult) to account for trigger efficiency (from b)
+ TH2D *fTrigEffWeights; // weight map (pt,mult) to account for trigger efficiency (on data, from c)
+ TH2D *fTrigEffWeightsB; // weight map (pt,mult) to account for trigger efficiency (from b)
+ Int_t fPoolMaxNEvents; // set maximum number of events in the pool
+ Int_t fPoolMinNTracks; // se minimum number of tracks in the pool
+ Int_t fMinEventsToMix; // set the minimum number of events you wanna mix
+
+ Int_t fNzVtxBins; // number of z vrtx bins
+ Int_t fNzVtxBinsDim; // number of z vrtx bins +1 : necessary to initialize correctly the array
+ Double_t* fZvtxBins; // [fNzVtxBinsDim]
+
+
+ Int_t fNCentBins; //number of centrality bins
+ Int_t fNCentBinsDim; //number of centrality bins bins +1 : necessary to initialize correctly the array
+ Double_t* fCentBins; // [fNCentBinsDim]
+
+ Int_t fNofMCEventType;// number of event types to be selected in MC simultaneously;
+ Int_t *fMCEventType;//[fNofMCEventType]
+
+ Int_t fNTrackCuts; // array dimension
+ Float_t* fAODTrackCuts;//[fNTrackCuts]
+ TString * fTrackCutsNames;//[fNTrackCuts]
+ Int_t fNvZeroCuts;// array dimension
+ Float_t *fAODvZeroCuts;//[fNvZeroCuts]
+ TString * fvZeroCutsNames;//[fNvZeroCuts]
+ Int_t fBit; // filterBit
+ Short_t fCharge; // charge (+1 or -1)
+ TString fDescription; // additional description to the cuts
+
+
+ ClassDef(AliHFAssociatedTrackCuts,6);
+};
+
+
+#endif
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-//\r
-//\r
-// Base class for Heavy Flavour Correlations Analysis\r
-// Single Event and Mixed Event Analysis are implemented\r
-//\r
-//-----------------------------------------------------------------------\r
-// \r
-//\r
-// Author S.Bjelogrlic\r
-// Utrecht University \r
-// sandro.bjelogrlic@cern.ch\r
-//\r
-//-----------------------------------------------------------------------\r
-\r
-/* $Id$ */\r
-\r
-#include <TParticle.h>\r
-#include <TVector3.h>\r
-#include <TChain.h>\r
-#include "TROOT.h"\r
-#include "AliHFCorrelator.h"\r
-#include "AliRDHFCutsDStartoKpipi.h"\r
-#include "AliHFAssociatedTrackCuts.h"\r
-#include "AliEventPoolManager.h"\r
-#include "AliReducedParticle.h"\r
-#include "AliCentrality.h"\r
-#include "AliAODMCParticle.h"\r
-\r
-using std::cout;\r
-using std::endl;\r
-\r
-//_____________________________________________________\r
-AliHFCorrelator::AliHFCorrelator() :\r
-//\r
-// default constructor\r
-//\r
-TNamed(),\r
-fPoolMgr(0x0), \r
-fPool(0x0),\r
-fhadcuts(0x0),\r
-fAODEvent(0x0),\r
-fAssociatedTracks(0x0),\r
-fmcArray(0x0),\r
-fReducedPart(0x0),\r
-fD0cand(0x0), \r
-fhypD0(0), \r
-fDCharge(0),\r
-\r
-fmixing(kFALSE),\r
-fmontecarlo(kFALSE),\r
-fsystem(kFALSE),\r
-fUseReco(kTRUE),\r
-fselect(kUndefined),\r
-\r
-fUseImpactParameter(0),\r
-fPIDmode(0),\r
-\r
-fNofTracks(0),\r
-fPoolContent(0),\r
-\r
-fPhiMin(0),\r
-fPhiMax(0),\r
-\r
-fPtTrigger(0),\r
-fPhiTrigger(0),\r
-fEtaTrigger(0),\r
-\r
-\r
-fDeltaPhi(0),\r
-fDeltaEta(0),\r
-fk0InvMass(0)\r
-\r
-{\r
- // default constructor \r
-}\r
-\r
-\r
-\r
-//_____________________________________________________\r
-AliHFCorrelator::AliHFCorrelator(const Char_t* name, AliHFAssociatedTrackCuts *cuts, Bool_t ppOrPbPb) :\r
-TNamed(name,"title"),\r
-fPoolMgr(0x0), \r
-fPool(0x0),\r
-fhadcuts(0x0),\r
-fAODEvent(0x0),\r
-fAssociatedTracks(0x0),\r
-fmcArray(0x0),\r
-fReducedPart(0x0),\r
-fD0cand(0x0), \r
-fhypD0(0),\r
-fDCharge(0),\r
-\r
-fmixing(kFALSE),\r
-fmontecarlo(kFALSE),\r
-fsystem(ppOrPbPb),\r
-fUseReco(kTRUE),\r
-fselect(kUndefined),\r
-fUseImpactParameter(0),\r
-fPIDmode(0),\r
-\r
-fNofTracks(0),\r
-fPoolContent(0),\r
-\r
-fPhiMin(0),\r
-fPhiMax(0),\r
-\r
-fPtTrigger(0),\r
-fPhiTrigger(0),\r
-fEtaTrigger(0),\r
-\r
-\r
-fDeltaPhi(0),\r
-fDeltaEta(0),\r
-fk0InvMass(0)\r
-{\r
- fhadcuts = cuts; \r
-}\r
-\r
-//_____________________________________________________\r
-AliHFCorrelator::~AliHFCorrelator() \r
-{\r
-//\r
-// destructor\r
-// \r
- \r
- if(fPoolMgr) {delete fPoolMgr; fPoolMgr=0;} \r
- if(fPool) {delete fPool; fPool=0;}\r
- if(fhadcuts) {delete fhadcuts; fhadcuts=0;}\r
- if(fAODEvent) {delete fAODEvent; fAODEvent=0;}\r
- if(fAssociatedTracks) {delete fAssociatedTracks; fAssociatedTracks=0;}\r
- if(fmcArray) {delete fmcArray; fmcArray=0;}\r
- if(fReducedPart) {delete fReducedPart; fReducedPart=0;}\r
- if(fD0cand) {delete fD0cand; fD0cand=0;}\r
- \r
- \r
- if(fNofTracks) fNofTracks = 0;\r
- \r
- if(fPhiMin) fPhiMin = 0;\r
- if(fPhiMax) fPhiMax = 0;\r
- \r
- if(fPtTrigger) fPtTrigger=0;\r
- if(fPhiTrigger) fPhiTrigger=0;\r
- if(fEtaTrigger) fEtaTrigger=0;\r
- \r
- if(fDeltaPhi) fDeltaPhi=0;\r
- if(fDeltaEta) fDeltaEta=0;\r
- \r
- if(fk0InvMass) fk0InvMass=0;\r
- \r
-}\r
-//_____________________________________________________\r
-Bool_t AliHFCorrelator::DefineEventPool(){\r
- // definition of the Pool Manager for Event Mixing\r
- \r
-\r
- Int_t MaxNofEvents = fhadcuts->GetMaxNEventsInPool();\r
- Int_t MinNofTracks = fhadcuts->GetMinNTracksInPool();\r
- Int_t NofCentBins = fhadcuts->GetNCentPoolBins();\r
- Double_t * CentBins = fhadcuts->GetCentPoolBins();\r
- Int_t NofZVrtxBins = fhadcuts->GetNZvtxPoolBins();\r
- Double_t *ZVrtxBins = fhadcuts->GetZvtxPoolBins();\r
- \r
- \r
- fPoolMgr = new AliEventPoolManager(MaxNofEvents, MinNofTracks, NofCentBins, CentBins, NofZVrtxBins, ZVrtxBins);\r
- if(!fPoolMgr) return kFALSE;\r
- return kTRUE;\r
-}\r
-//_____________________________________________________\r
-Bool_t AliHFCorrelator::Initialize(){\r
- \r
- // std::cout << "AliHFCorrelator::Initialize"<< std::endl;\r
-// AliInfo("AliHFCorrelator::Initialize") ;\r
- if(!fAODEvent){\r
- AliInfo("No AOD event") ;\r
- return kFALSE;\r
- }\r
- //std::cout << "No AOD event" << std::endl;\r
- \r
- AliCentrality *centralityObj = 0;\r
- //Int_t multiplicity = -1;\r
- Double_t MultipOrCent = -1;\r
- \r
- // initialize the pool for event mixing\r
- if(!fsystem){ // pp\r
- //multiplicity = fAODEvent->GetNTracks();\r
- MultipOrCent = AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(fAODEvent,-1.,1.);\r
- // MultipOrCent = multiplicity; // convert from Int_t to Double_t\r
- // AliInfo(Form("Multiplicity is %f", MultipOrCent));\r
- }\r
- if(fsystem){ // PbPb\r
- \r
- centralityObj = fAODEvent->GetHeader()->GetCentralityP();\r
- MultipOrCent = centralityObj->GetCentralityPercentileUnchecked("V0M");\r
-// AliInfo(Form("Centrality is %f", MultipOrCent));\r
- }\r
- \r
- AliAODVertex *vtx = fAODEvent->GetPrimaryVertex();\r
- Double_t zvertex = vtx->GetZ(); // zvertex\r
- Double_t * CentBins = fhadcuts->GetCentPoolBins();\r
- Double_t poolmin=CentBins[0];\r
- Double_t poolmax=CentBins[fhadcuts->GetNCentPoolBins()];\r
-\r
- \r
- if(TMath::Abs(zvertex)>=10 || MultipOrCent>poolmax || MultipOrCent < poolmin) {\r
- if(!fsystem)AliInfo(Form("pp or pA Event with Zvertex = %.2f cm and multiplicity = %.0f out of pool bounds, SKIPPING",zvertex,MultipOrCent));\r
- if(fsystem) AliInfo(Form("PbPb Event with Zvertex = %.2f cm and centrality = %.1f out of pool bounds, SKIPPING",zvertex,MultipOrCent));\r
-\r
- return kFALSE;\r
- }\r
- \r
- fPool = fPoolMgr->GetEventPool(MultipOrCent, zvertex);\r
- \r
- if (!fPool){\r
- AliInfo(Form("No pool found for multiplicity = %f, zVtx = %f cm", MultipOrCent, zvertex));\r
- return kFALSE;\r
- }\r
- //fPool->PrintInfo();\r
- return kTRUE;\r
-}\r
-\r
-//_____________________________________________________\r
-Bool_t AliHFCorrelator::ProcessEventPool(){\r
- // analysis on Mixed Events\r
- //cout << "AliHFCorrelator::ProcessEventPool"<< endl;\r
- if(!fmixing) return kFALSE;\r
- if(!fPool->IsReady()) return kFALSE;\r
- if(fPool->GetCurrentNEvents()<fhadcuts->GetMinEventsToMix()) return kFALSE;\r
- // fPool->PrintInfo();\r
- fPoolContent = fPool->GetCurrentNEvents();\r
- \r
- return kTRUE;\r
- \r
-}\r
-\r
-//_____________________________________________________\r
-Bool_t AliHFCorrelator::ProcessAssociatedTracks(Int_t EventLoopIndex, const TObjArray* associatedTracks){\r
- // associatedTracks is not deleted, it should be (if needed) deleted in the user task\r
- \r
- if(!fmixing){ // analysis on Single Event\r
- if(fAssociatedTracks){\r
- fAssociatedTracks->Delete();\r
- delete fAssociatedTracks;\r
- } \r
- if(fselect==kHadron || fselect ==kKaon){\r
- fAssociatedTracks = AcceptAndReduceTracks(fAODEvent);\r
- fAssociatedTracks->SetOwner(kTRUE);\r
- }\r
- if(fselect==kKZero) {\r
- fAssociatedTracks = AcceptAndReduceKZero(fAODEvent);\r
- fAssociatedTracks->SetOwner(kTRUE);\r
- } \r
- if(fselect==kElectron && associatedTracks) {\r
- fAssociatedTracks=new TObjArray(*associatedTracks);// Maybe better to call the copy constructor\r
- fAssociatedTracks->SetOwner(kFALSE);\r
- }\r
- \r
- }\r
- \r
- if(fmixing) { // analysis on Mixed Events\r
- \r
- \r
- fAssociatedTracks = fPool->GetEvent(EventLoopIndex);\r
- \r
- \r
- \r
- \r
- } // end if mixing\r
- \r
- if(!fAssociatedTracks) return kFALSE;\r
- \r
- fNofTracks = fAssociatedTracks->GetEntriesFast(); \r
- \r
- return kTRUE;\r
- \r
-}\r
-//_____________________________________________________\r
-Bool_t AliHFCorrelator::Correlate(Int_t loopindex){\r
-\r
- if(loopindex >= fNofTracks) return kFALSE;\r
- if(!fAssociatedTracks) return kFALSE;\r
- \r
- fReducedPart = (AliReducedParticle*)fAssociatedTracks->At(loopindex);\r
- \r
-\r
- fDeltaPhi = SetCorrectPhiRange(fPhiTrigger - fReducedPart->Phi());\r
- \r
- fDeltaEta = fEtaTrigger - fReducedPart->Eta();\r
-\r
- return kTRUE;\r
- \r
-}\r
- \r
-//_____________________________________________________\r
-Bool_t AliHFCorrelator::PoolUpdate(const TObjArray* associatedTracks){\r
-\r
- if(!fmixing) return kFALSE;\r
- if(!fPool) return kFALSE;\r
- if(fmixing) { // update the pool for Event Mixing\r
- TObjArray* objArr = NULL;\r
- if(fselect==kHadron || fselect==kKaon) objArr = (TObjArray*)AcceptAndReduceTracks(fAODEvent);\r
- else if(fselect==kKZero) objArr = (TObjArray*)AcceptAndReduceKZero(fAODEvent);\r
- else if(fselect==kElectron && associatedTracks){\r
- objArr = new TObjArray(*associatedTracks);\r
- }\r
- else return kFALSE;\r
- if(objArr->GetEntriesFast()>0) fPool->UpdatePool(objArr); // updating the pool only if there are entries in the array\r
- }\r
- \r
- return kTRUE;\r
- \r
-}\r
- \r
-//_____________________________________________________\r
-Double_t AliHFCorrelator::SetCorrectPhiRange(Double_t phi){\r
- Double_t pi = TMath::Pi();\r
- \r
- if(phi<fPhiMin) phi = phi + 2*pi;\r
- if(phi>fPhiMax) phi = phi - 2*pi;\r
- \r
- return phi;\r
-}\r
-\r
-//_____________________________________________________\r
-TObjArray* AliHFCorrelator::AcceptAndReduceTracks(AliAODEvent* inputEvent){\r
-\r
- Double_t weight=1.;\r
- Int_t nTracks = inputEvent->GetNTracks();\r
- AliAODVertex * vtx = inputEvent->GetPrimaryVertex();\r
- Double_t pos[3],cov[6];\r
- vtx->GetXYZ(pos);\r
- vtx->GetCovarianceMatrix(cov);\r
- const AliESDVertex vESD(pos,cov,100.,100);\r
- \r
- Double_t Bz = inputEvent->GetMagneticField();\r
- \r
- \r
- TObjArray* tracksClone = new TObjArray;\r
- tracksClone->SetOwner(kTRUE);\r
- \r
- //*******************************************************\r
- // use reconstruction\r
- if(fUseReco){\r
- for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) {\r
- AliAODTrack* track = inputEvent->GetTrack(iTrack);\r
- if (!track) continue;\r
- if(!fhadcuts->IsHadronSelected(track,&vESD,Bz)) continue; // apply ESD level selections\r
- if(!fhadcuts->Charge(fDCharge,track)) continue; // apply selection on charge, if required\r
-\r
- Double_t pT = track->Pt();\r
- \r
- //compute impact parameter\r
- Double_t d0z0[2],covd0z0[3];\r
- Double_t d0=-999999.;\r
- if(fUseImpactParameter) track->PropagateToDCA(vtx,Bz,100,d0z0,covd0z0);\r
- else d0z0[0] = 1. ; // random number - be careful with the cuts you applied\r
- \r
- if(fUseImpactParameter==1) d0 = TMath::Abs(d0z0[0]); // use impact parameter\r
- if(fUseImpactParameter==2) { // use impact parameter over resolution\r
- if(TMath::Abs(covd0z0[0])>0.00000001) d0 = TMath::Abs(d0z0[0])/TMath::Sqrt(covd0z0[0]); \r
- else d0 = -1.; // if the resoultion is Zero, rejects the track - to be on the safe side\r
- \r
- }\r
- \r
- if(fmontecarlo) {// THIS TO BE CHECKED\r
- Int_t hadLabel = track->GetLabel();\r
- if(hadLabel < 0) continue; \r
- }\r
- \r
- if(!fhadcuts->CheckHadronKinematic(pT,d0)) continue; // apply kinematic cuts\r
- Bool_t rejectsoftpi = kTRUE;// TO BE CHECKED: DO WE WANT IT TO kTRUE AS A DEFAULT?\r
- if(fD0cand && !fmixing) rejectsoftpi = fhadcuts->InvMassDstarRejection(fD0cand,track,fhypD0); // TO BE CHECKED: WHY NOT FOR EM?\r
- \r
- \r
- if(fselect ==kKaon){ \r
- if(!fhadcuts->CheckKaonCompatibility(track,fmontecarlo,fmcArray,fPIDmode)) continue; // check if it is a Kaon - data and MC\r
- }\r
- weight=fhadcuts->GetTrackWeight(pT,track->Eta(),pos[2]);\r
- tracksClone->Add(new AliReducedParticle(track->Eta(), track->Phi(), pT,track->GetLabel(),track->GetID(),d0,rejectsoftpi,track->Charge(),weight));\r
- } // end loop on tracks\r
- } // end if use reconstruction kTRUE\r
- \r
- //*******************************************************\r
- \r
- //use MC truth\r
- if(fmontecarlo && !fUseReco){\r
- \r
- for (Int_t iPart=0; iPart<fmcArray->GetEntriesFast(); iPart++) { \r
- AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iPart));\r
- if (!mcPart) {\r
- AliWarning("MC Particle not found in tree, skipping"); \r
- continue;\r
- }\r
- if(!mcPart->Charge()) continue; // consider only charged tracks\r
- \r
- Int_t PDG =TMath::Abs(mcPart->PdgCode()); \r
-if(fselect ==kHadron) {if(!((PDG==321)||(PDG==211)||(PDG==2212)||(PDG==13)||(PDG==11))) continue;} // select only if kaon, pion, proton, muon or electron\r
- else if(fselect ==kKaon) {if(!(PDG==321)) continue;} // select only if kaon\r
- else if(fselect ==kElectron) {if(!(PDG==11)) continue;} // select only if electron\r
-\r
- Double_t pT = mcPart->Pt();\r
- Double_t d0 =1; // set 1 fot the moment - no displacement calculation implemented yet\r
- if(!fhadcuts->CheckHadronKinematic(pT,d0)) continue; // apply kinematic cuts\r
- \r
- tracksClone->Add(new AliReducedParticle(mcPart->Eta(), mcPart->Phi(), pT,iPart,-1,d0,kFALSE,mcPart->Charge()));\r
- }\r
- \r
- } // end if use MC truth\r
- \r
- \r
- return tracksClone;\r
-}\r
-\r
-//_____________________________________________________\r
-TObjArray* AliHFCorrelator::AcceptAndReduceKZero(AliAODEvent* inputEvent){\r
- \r
- Int_t nOfVZeros = inputEvent->GetNumberOfV0s();\r
- TObjArray* KZeroClone = new TObjArray;\r
- AliAODVertex *vertex1 = (AliAODVertex*)inputEvent->GetPrimaryVertex();\r
-\r
- // use reconstruction \r
- if(fUseReco){\r
- Int_t v0label = -1;\r
- Int_t pdgDgK0toPipi[2] = {211,211};\r
- Double_t mPDGK0=0.497614;//TDatabasePDG::Instance()->GetParticle(310)->Mass();\r
- const Int_t size = inputEvent->GetNumberOfV0s();\r
- Int_t prevnegID[size];\r
- Int_t prevposID[size];\r
- for(Int_t iv0 =0; iv0< nOfVZeros; iv0++){// loop on all v0 candidates\r
- AliAODv0 *v0 = (static_cast<AliAODEvent*> (inputEvent))->GetV0(iv0);\r
- if(!v0) {\r
- AliInfo(Form("is not a v0 at step, %d", iv0)) ;\r
- //cout << "is not a v0 at step " << iv0 << endl;\r
- continue;\r
- }\r
- \r
- if(!fhadcuts->IsKZeroSelected(v0,vertex1)) continue; // check if it is a k0\r
- \r
- // checks to avoid double counting\r
- Int_t negID = -999;\r
- Int_t posID = -998;\r
- //Int_t a = 0;\r
- prevnegID[iv0] = -997;\r
- prevposID[iv0]= -996;\r
- negID = v0->GetNegID();\r
- posID = v0->GetPosID();\r
- Bool_t DoubleCounting = kFALSE;\r
- \r
- for(Int_t k=0; k<iv0; k++){\r
- if(((negID==prevnegID[k])&&(posID==prevposID[k]))||((negID==prevposID[k])&&(posID==prevnegID[k]))){\r
- DoubleCounting = kTRUE;\r
- //a=k;\r
- break;\r
- }//end if\r
- } // end for\r
- \r
- if(DoubleCounting) continue;\r
- else{ \r
- prevposID[iv0] = posID; \r
- prevnegID[iv0] = negID;\r
- }\r
- \r
- if(fmontecarlo) v0label = v0->MatchToMC(310,fmcArray, 0, pdgDgK0toPipi); //match a K0 short\r
- Double_t k0pt = v0->Pt();\r
- Double_t k0eta = v0->Eta();\r
- Double_t k0Phi = v0->Phi();\r
- fk0InvMass = v0->MassK0Short(); \r
- \r
- //if (loopindex == 0) {\r
- // if(!plotassociation) ((TH2F*)fOutput->FindObject("KZeroSpectra"))->Fill(k0InvMass,k0pt); // spectra for all k0\r
- // if(plotassociation) ((TH2F*)fOutput->FindObject("KZeroSpectraifHF"))->Fill(k0InvMass,k0pt); // spectra for k0 in association with a D*\r
- //}\r
- // if there are more D* candidates per event, loopindex == 0 makes sure you fill the mass spectra only once!\r
- \r
- if(TMath::Abs(fk0InvMass-mPDGK0)>3*0.004) continue; // select candidates within 3 sigma\r
- KZeroClone->Add(new AliReducedParticle(k0eta,k0Phi,k0pt,v0label));\r
- \r
- }\r
- } // end if use reconstruction kTRUE\r
- \r
-\r
-\r
-//*********************************************************************//\r
- //use MC truth\r
- if(fmontecarlo && !fUseReco){\r
- \r
- for (Int_t iPart=0; iPart<fmcArray->GetEntriesFast(); iPart++) { \r
- AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iPart));\r
- if (!mcPart) {\r
- AliWarning("MC Particle not found in tree, skipping"); \r
- continue;\r
- }\r
- \r
- Int_t PDG =TMath::Abs(mcPart->PdgCode()); \r
- if(!(PDG==310)) continue; // select only if k0 short\r
- \r
- Double_t pT = mcPart->Pt();\r
- Double_t d0 =1; // set 1 fot the moment - no displacement calculation implemented yet\r
- if(!fhadcuts->CheckHadronKinematic(pT,d0)) continue; // apply kinematic cuts\r
- \r
- KZeroClone->Add(new AliReducedParticle(mcPart->Eta(), mcPart->Phi(), pT,iPart,-1,d0,kTRUE,mcPart->Charge()));\r
- }\r
- \r
- } // end if use MC truth\r
-\r
-\r
-\r
- return KZeroClone;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//
+//
+// Base class for Heavy Flavour Correlations Analysis
+// Single Event and Mixed Event Analysis are implemented
+//
+//-----------------------------------------------------------------------
+//
+//
+// Author S.Bjelogrlic
+// Utrecht University
+// sandro.bjelogrlic@cern.ch
+//
+//-----------------------------------------------------------------------
+
+/* $Id$ */
+
+#include <TParticle.h>
+#include <TVector3.h>
+#include <TChain.h>
+#include "TROOT.h"
+#include "AliHFCorrelator.h"
+#include "AliRDHFCutsDStartoKpipi.h"
+#include "AliHFAssociatedTrackCuts.h"
+#include "AliEventPoolManager.h"
+#include "AliReducedParticle.h"
+#include "AliCentrality.h"
+#include "AliAODMCParticle.h"
+
+using std::cout;
+using std::endl;
+
+//_____________________________________________________
+AliHFCorrelator::AliHFCorrelator() :
+//
+// default constructor
+//
+TNamed(),
+fPoolMgr(0x0),
+fPool(0x0),
+fhadcuts(0x0),
+fAODEvent(0x0),
+fAssociatedTracks(0x0),
+fmcArray(0x0),
+fReducedPart(0x0),
+fD0cand(0x0),
+fhypD0(0),
+fDCharge(0),
+
+fmixing(kFALSE),
+fmontecarlo(kFALSE),
+fsystem(kFALSE),
+fUseReco(kTRUE),
+fselect(kUndefined),
+
+fUseImpactParameter(0),
+fPIDmode(0),
+
+fNofTracks(0),
+fPoolContent(0),
+
+fPhiMin(0),
+fPhiMax(0),
+
+fPtTrigger(0),
+fPhiTrigger(0),
+fEtaTrigger(0),
+
+
+fDeltaPhi(0),
+fDeltaEta(0),
+fk0InvMass(0)
+
+{
+ // default constructor
+}
+
+
+
+//_____________________________________________________
+AliHFCorrelator::AliHFCorrelator(const Char_t* name, AliHFAssociatedTrackCuts *cuts, Bool_t ppOrPbPb) :
+TNamed(name,"title"),
+fPoolMgr(0x0),
+fPool(0x0),
+fhadcuts(0x0),
+fAODEvent(0x0),
+fAssociatedTracks(0x0),
+fmcArray(0x0),
+fReducedPart(0x0),
+fD0cand(0x0),
+fhypD0(0),
+fDCharge(0),
+
+fmixing(kFALSE),
+fmontecarlo(kFALSE),
+fsystem(ppOrPbPb),
+fUseReco(kTRUE),
+fselect(kUndefined),
+fUseImpactParameter(0),
+fPIDmode(0),
+
+fNofTracks(0),
+fPoolContent(0),
+
+fPhiMin(0),
+fPhiMax(0),
+
+fPtTrigger(0),
+fPhiTrigger(0),
+fEtaTrigger(0),
+
+
+fDeltaPhi(0),
+fDeltaEta(0),
+fk0InvMass(0)
+{
+ fhadcuts = cuts;
+}
+
+//_____________________________________________________
+AliHFCorrelator::~AliHFCorrelator()
+{
+//
+// destructor
+//
+
+ if(fPoolMgr) {delete fPoolMgr; fPoolMgr=0;}
+ if(fPool) {delete fPool; fPool=0;}
+ if(fhadcuts) {delete fhadcuts; fhadcuts=0;}
+ if(fAODEvent) {delete fAODEvent; fAODEvent=0;}
+ if(fAssociatedTracks) {delete fAssociatedTracks; fAssociatedTracks=0;}
+ if(fmcArray) {delete fmcArray; fmcArray=0;}
+ if(fReducedPart) {delete fReducedPart; fReducedPart=0;}
+ if(fD0cand) {delete fD0cand; fD0cand=0;}
+
+
+ if(fNofTracks) fNofTracks = 0;
+
+ if(fPhiMin) fPhiMin = 0;
+ if(fPhiMax) fPhiMax = 0;
+
+ if(fPtTrigger) fPtTrigger=0;
+ if(fPhiTrigger) fPhiTrigger=0;
+ if(fEtaTrigger) fEtaTrigger=0;
+
+ if(fDeltaPhi) fDeltaPhi=0;
+ if(fDeltaEta) fDeltaEta=0;
+
+ if(fk0InvMass) fk0InvMass=0;
+
+}
+//_____________________________________________________
+Bool_t AliHFCorrelator::DefineEventPool(){
+ // definition of the Pool Manager for Event Mixing
+
+
+ Int_t MaxNofEvents = fhadcuts->GetMaxNEventsInPool();
+ Int_t MinNofTracks = fhadcuts->GetMinNTracksInPool();
+ Int_t NofCentBins = fhadcuts->GetNCentPoolBins();
+ Double_t * CentBins = fhadcuts->GetCentPoolBins();
+ Int_t NofZVrtxBins = fhadcuts->GetNZvtxPoolBins();
+ Double_t *ZVrtxBins = fhadcuts->GetZvtxPoolBins();
+
+
+ fPoolMgr = new AliEventPoolManager(MaxNofEvents, MinNofTracks, NofCentBins, CentBins, NofZVrtxBins, ZVrtxBins);
+ if(!fPoolMgr) return kFALSE;
+ return kTRUE;
+}
+//_____________________________________________________
+Bool_t AliHFCorrelator::Initialize(){
+
+ // std::cout << "AliHFCorrelator::Initialize"<< std::endl;
+// AliInfo("AliHFCorrelator::Initialize") ;
+ if(!fAODEvent){
+ AliInfo("No AOD event") ;
+ return kFALSE;
+ }
+ //std::cout << "No AOD event" << std::endl;
+
+ AliCentrality *centralityObj = 0;
+ //Int_t multiplicity = -1;
+ Double_t MultipOrCent = -1;
+
+ // initialize the pool for event mixing
+ if(!fsystem){ // pp
+ //multiplicity = fAODEvent->GetNTracks();
+ MultipOrCent = AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(fAODEvent,-1.,1.);
+ // MultipOrCent = multiplicity; // convert from Int_t to Double_t
+ // AliInfo(Form("Multiplicity is %f", MultipOrCent));
+ }
+ if(fsystem){ // PbPb
+
+ centralityObj = fAODEvent->GetHeader()->GetCentralityP();
+ MultipOrCent = centralityObj->GetCentralityPercentileUnchecked("V0M");
+// AliInfo(Form("Centrality is %f", MultipOrCent));
+ }
+
+ AliAODVertex *vtx = fAODEvent->GetPrimaryVertex();
+ Double_t zvertex = vtx->GetZ(); // zvertex
+ Double_t * CentBins = fhadcuts->GetCentPoolBins();
+ Double_t poolmin=CentBins[0];
+ Double_t poolmax=CentBins[fhadcuts->GetNCentPoolBins()];
+
+
+ if(TMath::Abs(zvertex)>=10 || MultipOrCent>poolmax || MultipOrCent < poolmin) {
+ if(!fsystem)AliInfo(Form("pp or pA Event with Zvertex = %.2f cm and multiplicity = %.0f out of pool bounds, SKIPPING",zvertex,MultipOrCent));
+ if(fsystem) AliInfo(Form("PbPb Event with Zvertex = %.2f cm and centrality = %.1f out of pool bounds, SKIPPING",zvertex,MultipOrCent));
+
+ return kFALSE;
+ }
+
+ fPool = fPoolMgr->GetEventPool(MultipOrCent, zvertex);
+
+ if (!fPool){
+ AliInfo(Form("No pool found for multiplicity = %f, zVtx = %f cm", MultipOrCent, zvertex));
+ return kFALSE;
+ }
+ //fPool->PrintInfo();
+ return kTRUE;
+}
+
+//_____________________________________________________
+Bool_t AliHFCorrelator::ProcessEventPool(){
+ // analysis on Mixed Events
+ //cout << "AliHFCorrelator::ProcessEventPool"<< endl;
+ if(!fmixing) return kFALSE;
+ if(!fPool->IsReady()) return kFALSE;
+ if(fPool->GetCurrentNEvents()<fhadcuts->GetMinEventsToMix()) return kFALSE;
+ // fPool->PrintInfo();
+ fPoolContent = fPool->GetCurrentNEvents();
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________
+Bool_t AliHFCorrelator::ProcessAssociatedTracks(Int_t EventLoopIndex, const TObjArray* associatedTracks){
+ // associatedTracks is not deleted, it should be (if needed) deleted in the user task
+
+ if(!fmixing){ // analysis on Single Event
+ if(fAssociatedTracks){
+ fAssociatedTracks->Delete();
+ delete fAssociatedTracks;
+ }
+ if(fselect==kHadron || fselect ==kKaon){
+ fAssociatedTracks = AcceptAndReduceTracks(fAODEvent);
+ fAssociatedTracks->SetOwner(kTRUE);
+ }
+ if(fselect==kKZero) {
+ fAssociatedTracks = AcceptAndReduceKZero(fAODEvent);
+ fAssociatedTracks->SetOwner(kTRUE);
+ }
+ if(fselect==kElectron && associatedTracks) {
+ fAssociatedTracks=new TObjArray(*associatedTracks);// Maybe better to call the copy constructor
+ fAssociatedTracks->SetOwner(kFALSE);
+ }
+
+ }
+
+ if(fmixing) { // analysis on Mixed Events
+
+
+ fAssociatedTracks = fPool->GetEvent(EventLoopIndex);
+
+
+
+
+ } // end if mixing
+
+ if(!fAssociatedTracks) return kFALSE;
+
+ fNofTracks = fAssociatedTracks->GetEntriesFast();
+
+ return kTRUE;
+
+}
+//_____________________________________________________
+Bool_t AliHFCorrelator::Correlate(Int_t loopindex){
+
+ if(loopindex >= fNofTracks) return kFALSE;
+ if(!fAssociatedTracks) return kFALSE;
+
+ fReducedPart = (AliReducedParticle*)fAssociatedTracks->At(loopindex);
+
+
+ fDeltaPhi = SetCorrectPhiRange(fPhiTrigger - fReducedPart->Phi());
+
+ fDeltaEta = fEtaTrigger - fReducedPart->Eta();
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________
+Bool_t AliHFCorrelator::PoolUpdate(const TObjArray* associatedTracks){
+
+ if(!fmixing) return kFALSE;
+ if(!fPool) return kFALSE;
+ if(fmixing) { // update the pool for Event Mixing
+ TObjArray* objArr = NULL;
+ if(fselect==kHadron || fselect==kKaon) objArr = (TObjArray*)AcceptAndReduceTracks(fAODEvent);
+ else if(fselect==kKZero) objArr = (TObjArray*)AcceptAndReduceKZero(fAODEvent);
+ else if(fselect==kElectron && associatedTracks){
+ objArr = new TObjArray(*associatedTracks);
+ }
+ else return kFALSE;
+ if(objArr->GetEntriesFast()>0) fPool->UpdatePool(objArr); // updating the pool only if there are entries in the array
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________
+Double_t AliHFCorrelator::SetCorrectPhiRange(Double_t phi){
+ Double_t pi = TMath::Pi();
+
+ if(phi<fPhiMin) phi = phi + 2*pi;
+ if(phi>fPhiMax) phi = phi - 2*pi;
+
+ return phi;
+}
+
+//_____________________________________________________
+TObjArray* AliHFCorrelator::AcceptAndReduceTracks(AliAODEvent* inputEvent){
+
+ Double_t weight=1.;
+ Int_t nTracks = inputEvent->GetNTracks();
+ AliAODVertex * vtx = inputEvent->GetPrimaryVertex();
+ Double_t pos[3],cov[6];
+ vtx->GetXYZ(pos);
+ vtx->GetCovarianceMatrix(cov);
+ const AliESDVertex vESD(pos,cov,100.,100);
+
+ Double_t Bz = inputEvent->GetMagneticField();
+
+
+ TObjArray* tracksClone = new TObjArray;
+ tracksClone->SetOwner(kTRUE);
+
+ //*******************************************************
+ // use reconstruction
+ if(fUseReco){
+ for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) {
+ AliAODTrack* track = inputEvent->GetTrack(iTrack);
+ if (!track) continue;
+ if(!fhadcuts->IsHadronSelected(track,&vESD,Bz)) continue; // apply ESD level selections
+ if(!fhadcuts->Charge(fDCharge,track)) continue; // apply selection on charge, if required
+
+ Double_t pT = track->Pt();
+
+ //compute impact parameter
+ Double_t d0z0[2],covd0z0[3];
+ Double_t d0=-999999.;
+ if(fUseImpactParameter) track->PropagateToDCA(vtx,Bz,100,d0z0,covd0z0);
+ else d0z0[0] = 1. ; // random number - be careful with the cuts you applied
+
+ if(fUseImpactParameter==1) d0 = TMath::Abs(d0z0[0]); // use impact parameter
+ if(fUseImpactParameter==2) { // use impact parameter over resolution
+ if(TMath::Abs(covd0z0[0])>0.00000001) d0 = TMath::Abs(d0z0[0])/TMath::Sqrt(covd0z0[0]);
+ else d0 = -1.; // if the resoultion is Zero, rejects the track - to be on the safe side
+
+ }
+
+ if(fmontecarlo) {// THIS TO BE CHECKED
+ Int_t hadLabel = track->GetLabel();
+ if(hadLabel < 0) continue;
+ }
+
+ if(!fhadcuts->CheckHadronKinematic(pT,d0)) continue; // apply kinematic cuts
+ Bool_t rejectsoftpi = kTRUE;// TO BE CHECKED: DO WE WANT IT TO kTRUE AS A DEFAULT?
+ if(fD0cand && !fmixing) rejectsoftpi = fhadcuts->InvMassDstarRejection(fD0cand,track,fhypD0); // TO BE CHECKED: WHY NOT FOR EM?
+
+
+ if(fselect ==kKaon){
+ if(!fhadcuts->CheckKaonCompatibility(track,fmontecarlo,fmcArray,fPIDmode)) continue; // check if it is a Kaon - data and MC
+ }
+ weight=fhadcuts->GetTrackWeight(pT,track->Eta(),pos[2]);
+ tracksClone->Add(new AliReducedParticle(track->Eta(), track->Phi(), pT,track->GetLabel(),track->GetID(),d0,rejectsoftpi,track->Charge(),weight));
+ } // end loop on tracks
+ } // end if use reconstruction kTRUE
+
+ //*******************************************************
+
+ //use MC truth
+ if(fmontecarlo && !fUseReco){
+
+ for (Int_t iPart=0; iPart<fmcArray->GetEntriesFast(); iPart++) {
+ AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iPart));
+ if (!mcPart) {
+ AliWarning("MC Particle not found in tree, skipping");
+ continue;
+ }
+ if(!mcPart->Charge()) continue; // consider only charged tracks
+
+ Int_t PDG =TMath::Abs(mcPart->PdgCode());
+if(fselect ==kHadron) {if(!((PDG==321)||(PDG==211)||(PDG==2212)||(PDG==13)||(PDG==11))) continue;} // select only if kaon, pion, proton, muon or electron
+ else if(fselect ==kKaon) {if(!(PDG==321)) continue;} // select only if kaon
+ else if(fselect ==kElectron) {if(!(PDG==11)) continue;} // select only if electron
+
+ Double_t pT = mcPart->Pt();
+ Double_t d0 =1; // set 1 fot the moment - no displacement calculation implemented yet
+ if(!fhadcuts->CheckHadronKinematic(pT,d0)) continue; // apply kinematic cuts
+
+ tracksClone->Add(new AliReducedParticle(mcPart->Eta(), mcPart->Phi(), pT,iPart,-1,d0,kFALSE,mcPart->Charge()));
+ }
+
+ } // end if use MC truth
+
+
+ return tracksClone;
+}
+
+//_____________________________________________________
+TObjArray* AliHFCorrelator::AcceptAndReduceKZero(AliAODEvent* inputEvent){
+
+ Int_t nOfVZeros = inputEvent->GetNumberOfV0s();
+ TObjArray* KZeroClone = new TObjArray;
+ AliAODVertex *vertex1 = (AliAODVertex*)inputEvent->GetPrimaryVertex();
+
+ // use reconstruction
+ if(fUseReco){
+ Int_t v0label = -1;
+ Int_t pdgDgK0toPipi[2] = {211,211};
+ Double_t mPDGK0=0.497614;//TDatabasePDG::Instance()->GetParticle(310)->Mass();
+ const Int_t size = inputEvent->GetNumberOfV0s();
+ Int_t prevnegID[size];
+ Int_t prevposID[size];
+ for(Int_t iv0 =0; iv0< nOfVZeros; iv0++){// loop on all v0 candidates
+ AliAODv0 *v0 = (static_cast<AliAODEvent*> (inputEvent))->GetV0(iv0);
+ if(!v0) {
+ AliInfo(Form("is not a v0 at step, %d", iv0)) ;
+ //cout << "is not a v0 at step " << iv0 << endl;
+ continue;
+ }
+
+ if(!fhadcuts->IsKZeroSelected(v0,vertex1)) continue; // check if it is a k0
+
+ // checks to avoid double counting
+ Int_t negID = -999;
+ Int_t posID = -998;
+ //Int_t a = 0;
+ prevnegID[iv0] = -997;
+ prevposID[iv0]= -996;
+ negID = v0->GetNegID();
+ posID = v0->GetPosID();
+ Bool_t DoubleCounting = kFALSE;
+
+ for(Int_t k=0; k<iv0; k++){
+ if(((negID==prevnegID[k])&&(posID==prevposID[k]))||((negID==prevposID[k])&&(posID==prevnegID[k]))){
+ DoubleCounting = kTRUE;
+ //a=k;
+ break;
+ }//end if
+ } // end for
+
+ if(DoubleCounting) continue;
+ else{
+ prevposID[iv0] = posID;
+ prevnegID[iv0] = negID;
+ }
+
+ if(fmontecarlo) v0label = v0->MatchToMC(310,fmcArray, 0, pdgDgK0toPipi); //match a K0 short
+ Double_t k0pt = v0->Pt();
+ Double_t k0eta = v0->Eta();
+ Double_t k0Phi = v0->Phi();
+ fk0InvMass = v0->MassK0Short();
+
+ //if (loopindex == 0) {
+ // if(!plotassociation) ((TH2F*)fOutput->FindObject("KZeroSpectra"))->Fill(k0InvMass,k0pt); // spectra for all k0
+ // if(plotassociation) ((TH2F*)fOutput->FindObject("KZeroSpectraifHF"))->Fill(k0InvMass,k0pt); // spectra for k0 in association with a D*
+ //}
+ // if there are more D* candidates per event, loopindex == 0 makes sure you fill the mass spectra only once!
+
+ if(TMath::Abs(fk0InvMass-mPDGK0)>3*0.004) continue; // select candidates within 3 sigma
+ KZeroClone->Add(new AliReducedParticle(k0eta,k0Phi,k0pt,v0label));
+
+ }
+ } // end if use reconstruction kTRUE
+
+
+
+//*********************************************************************//
+ //use MC truth
+ if(fmontecarlo && !fUseReco){
+
+ for (Int_t iPart=0; iPart<fmcArray->GetEntriesFast(); iPart++) {
+ AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iPart));
+ if (!mcPart) {
+ AliWarning("MC Particle not found in tree, skipping");
+ continue;
+ }
+
+ Int_t PDG =TMath::Abs(mcPart->PdgCode());
+ if(!(PDG==310)) continue; // select only if k0 short
+
+ Double_t pT = mcPart->Pt();
+ Double_t d0 =1; // set 1 fot the moment - no displacement calculation implemented yet
+ if(!fhadcuts->CheckHadronKinematic(pT,d0)) continue; // apply kinematic cuts
+
+ KZeroClone->Add(new AliReducedParticle(mcPart->Eta(), mcPart->Phi(), pT,iPart,-1,d0,kTRUE,mcPart->Charge()));
+ }
+
+ } // end if use MC truth
+
+
+
+ return KZeroClone;
+}
-#ifndef AliHFCorrelator_H\r
-#define AliHFCorrelator_H\r
-\r
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//\r
-// Base class for Heavy Flavour Correlations Analysis\r
-// Single Event and Mixed Event Analysis are implemented\r
-//-----------------------------------------------------------------------\r
-// \r
-//\r
-// Author S.Bjelogrlic\r
-// Utrecht University \r
-// sandro.bjelogrlic@cern.ch\r
-//\r
-//-----------------------------------------------------------------------\r
-\r
-/* $Id$ */\r
-\r
-#include "AliHFAssociatedTrackCuts.h"\r
-#include "AliEventPoolManager.h"\r
-#include "AliVParticle.h"\r
-#include "AliReducedParticle.h"\r
-#include "AliVertexingHFUtils.h"\r
-\r
-\r
-class AliHFCorrelator : public TNamed\r
-{\r
- \r
- public:\r
- \r
- AliHFCorrelator();\r
- AliHFCorrelator(const Char_t* name, AliHFAssociatedTrackCuts *cuts, Bool_t ppOrPbPb);\r
- virtual ~AliHFCorrelator();\r
- \r
- // enum for setting which associated particle type to work with\r
- enum{\r
- kUndefined=0,\r
- kHadron=1,\r
- kKaon,\r
- kKZero,\r
- kElectron\r
- };\r
-\r
- //setters\r
- void SetDeltaPhiInterval (Double_t min, Double_t max){\r
- fPhiMin = min; fPhiMax = max;\r
- if(TMath::Abs(fPhiMin-fPhiMax) != 2*TMath::Pi()) AliInfo("AliHFCorrelator::Warning: the delta phi interval is not set to 2 Pi");\r
- }\r
- void SetEventMixing(Bool_t mixON){fmixing=mixON;}\r
- void SetTriggerParticleProperties(Double_t ptTrig, Double_t phiTrig, Double_t etaTrig)\r
- {fPtTrigger = ptTrig; fPhiTrigger = phiTrig; fEtaTrigger = etaTrig;}\r
- void SetTriggerParticleDaughterCharge(Short_t charge) {fDCharge=charge;}\r
- \r
- \r
- void SetAssociatedParticleType(Int_t type){fselect = type;}\r
- void SetAODEvent(AliAODEvent* inputevent){fAODEvent = inputevent;}\r
- void SetMCArray(TClonesArray* mcArray){fmcArray = mcArray;}\r
- void SetUseMC(Bool_t useMC){fmontecarlo = useMC;}\r
- void SetApplyDisplacementCut(Int_t applycut){fUseImpactParameter = applycut;}\r
- void SetPIDmode(Int_t mode){fPIDmode = mode;}\r
- \r
- void SetD0Properties(AliAODRecoDecayHF2Prong* d, Int_t D0hyp)\r
- {fD0cand = d; fhypD0 = D0hyp;}\r
- \r
- void SetUseReco(Bool_t useReco) {fUseReco = useReco;}\r
- \r
- \r
- \r
- Bool_t DefineEventPool(); // Definition of the Event pool parameters\r
- Bool_t Initialize(); // function that initlize everything for the analysis \r
- Bool_t ProcessEventPool(); // processes the event pool\r
- Bool_t ProcessAssociatedTracks(Int_t EventLoopIndex, const TObjArray* associatedTracks=NULL); //\r
- Bool_t Correlate(Int_t loopindex); // function that computes the correlations between the trigger particle and the track n. loopindex\r
- Bool_t PoolUpdate(const TObjArray* associatedTracks=NULL);// updates the event pool\r
- Double_t SetCorrectPhiRange(Double_t phi); // sets all the angles in the correct range\r
- void SetPidAssociated() {fhadcuts->SetPidAssociated();}\r
-\r
- //getters\r
- AliEventPool* GetPool() {return fPool;}\r
- TObjArray * GetTrackArray(){return fAssociatedTracks;}\r
- AliHFAssociatedTrackCuts* GetSelectionCuts() {return fhadcuts;}\r
- AliReducedParticle* GetAssociatedParticle() {return fReducedPart;}\r
- \r
- Int_t GetNofTracks(){return fNofTracks;}\r
- Int_t GetNofEventsInPool(){return fPoolContent;}\r
-\r
- Double_t GetDeltaPhi(){return fDeltaPhi;} // Delta Phi, needs to be called after the method correlate \r
- Double_t GetDeltaEta(){return fDeltaEta;} // Delta Eta\r
- \r
- Double_t GetAssociatedKZeroInvariantmass(){return fk0InvMass;}\r
- \r
- \r
- \r
- // methods to reduce the tracks to correlate with track selection cuts applied here\r
- TObjArray* AcceptAndReduceTracks(AliAODEvent* inputEvent); // selecting hadrons and kaons\r
- TObjArray* AcceptAndReduceKZero(AliAODEvent* inputEvent); // selecting kzeros\r
- \r
- \r
- private:\r
-\r
- AliHFCorrelator(const AliHFCorrelator& vtxr);\r
- AliHFCorrelator& operator=(const AliHFCorrelator& vtxr );\r
-\r
- AliEventPoolManager* fPoolMgr; //! event pool manager\r
- AliEventPool * fPool; //! Pool for event mixing\r
- AliHFAssociatedTrackCuts* fhadcuts;//! hadron cuts\r
- AliAODEvent * fAODEvent;//! AOD Event\r
- TObjArray* fAssociatedTracks; // Array of associated tracks\r
- TClonesArray* fmcArray; //mcarray\r
- AliReducedParticle * fReducedPart; // reduced AOD particle;\r
- AliAODRecoDecayHF2Prong* fD0cand; //D0 candidate\r
- Int_t fhypD0; //hypothesis necessary for\r
- Int_t fDCharge; // charge of a daughter of the D meson\r
- \r
- Bool_t fmixing;// switch for event mixing\r
- Bool_t fmontecarlo; // switch for MonteCarlo\r
- Bool_t fsystem; // select pp (kFALSE) or PbPb (kTRUE)\r
- Bool_t fUseReco; // switch to use reconstruction (kTRUE) or MC truth (kFALSE)\r
- \r
- Int_t fselect; // 1 for hadrons, 2 for kaons, 3 for KZeros\r
- Int_t fUseImpactParameter; // switch to use the impact parameter cut\r
- Int_t fPIDmode; // set the PID mode for Kaon identification\r
- \r
- Int_t fNofTracks; // number of tracks in track array\r
- Int_t fPoolContent; // n of events in pool\r
- \r
- Double_t fPhiMin; // min for phi\r
- Double_t fPhiMax; // max for phi\r
- \r
- Double_t fPtTrigger; // pt of the trigger D meson\r
- Double_t fPhiTrigger; // phi of the trigger D meson\r
- Double_t fEtaTrigger; // Eta of the trigger D meson\r
-\r
- \r
- Double_t fDeltaPhi; // delta phi between D meson and associated track\r
- Double_t fDeltaEta; // delta eta between D meson and associated track\r
- \r
- Double_t fk0InvMass; // KZero invariant mass\r
- \r
- \r
- ClassDef(AliHFCorrelator,3); // class for HF correlations \r
-};\r
-\r
-\r
-\r
-\r
-\r
-#endif\r
+#ifndef AliHFCorrelator_H
+#define AliHFCorrelator_H
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//
+// Base class for Heavy Flavour Correlations Analysis
+// Single Event and Mixed Event Analysis are implemented
+//-----------------------------------------------------------------------
+//
+//
+// Author S.Bjelogrlic
+// Utrecht University
+// sandro.bjelogrlic@cern.ch
+//
+//-----------------------------------------------------------------------
+
+/* $Id$ */
+
+#include "AliHFAssociatedTrackCuts.h"
+#include "AliEventPoolManager.h"
+#include "AliVParticle.h"
+#include "AliReducedParticle.h"
+#include "AliVertexingHFUtils.h"
+
+
+class AliHFCorrelator : public TNamed
+{
+
+ public:
+
+ AliHFCorrelator();
+ AliHFCorrelator(const Char_t* name, AliHFAssociatedTrackCuts *cuts, Bool_t ppOrPbPb);
+ virtual ~AliHFCorrelator();
+
+ // enum for setting which associated particle type to work with
+ enum{
+ kUndefined=0,
+ kHadron=1,
+ kKaon,
+ kKZero,
+ kElectron
+ };
+
+ //setters
+ void SetDeltaPhiInterval (Double_t min, Double_t max){
+ fPhiMin = min; fPhiMax = max;
+ if(TMath::Abs(fPhiMin-fPhiMax) != 2*TMath::Pi()) AliInfo("AliHFCorrelator::Warning: the delta phi interval is not set to 2 Pi");
+ }
+ void SetEventMixing(Bool_t mixON){fmixing=mixON;}
+ void SetTriggerParticleProperties(Double_t ptTrig, Double_t phiTrig, Double_t etaTrig)
+ {fPtTrigger = ptTrig; fPhiTrigger = phiTrig; fEtaTrigger = etaTrig;}
+ void SetTriggerParticleDaughterCharge(Short_t charge) {fDCharge=charge;}
+
+
+ void SetAssociatedParticleType(Int_t type){fselect = type;}
+ void SetAODEvent(AliAODEvent* inputevent){fAODEvent = inputevent;}
+ void SetMCArray(TClonesArray* mcArray){fmcArray = mcArray;}
+ void SetUseMC(Bool_t useMC){fmontecarlo = useMC;}
+ void SetApplyDisplacementCut(Int_t applycut){fUseImpactParameter = applycut;}
+ void SetPIDmode(Int_t mode){fPIDmode = mode;}
+
+ void SetD0Properties(AliAODRecoDecayHF2Prong* d, Int_t D0hyp)
+ {fD0cand = d; fhypD0 = D0hyp;}
+
+ void SetUseReco(Bool_t useReco) {fUseReco = useReco;}
+
+
+
+ Bool_t DefineEventPool(); // Definition of the Event pool parameters
+ Bool_t Initialize(); // function that initlize everything for the analysis
+ Bool_t ProcessEventPool(); // processes the event pool
+ Bool_t ProcessAssociatedTracks(Int_t EventLoopIndex, const TObjArray* associatedTracks=NULL); //
+ Bool_t Correlate(Int_t loopindex); // function that computes the correlations between the trigger particle and the track n. loopindex
+ Bool_t PoolUpdate(const TObjArray* associatedTracks=NULL);// updates the event pool
+ Double_t SetCorrectPhiRange(Double_t phi); // sets all the angles in the correct range
+ void SetPidAssociated() {fhadcuts->SetPidAssociated();}
+
+ //getters
+ AliEventPool* GetPool() {return fPool;}
+ TObjArray * GetTrackArray(){return fAssociatedTracks;}
+ AliHFAssociatedTrackCuts* GetSelectionCuts() {return fhadcuts;}
+ AliReducedParticle* GetAssociatedParticle() {return fReducedPart;}
+
+ Int_t GetNofTracks(){return fNofTracks;}
+ Int_t GetNofEventsInPool(){return fPoolContent;}
+
+ Double_t GetDeltaPhi(){return fDeltaPhi;} // Delta Phi, needs to be called after the method correlate
+ Double_t GetDeltaEta(){return fDeltaEta;} // Delta Eta
+
+ Double_t GetAssociatedKZeroInvariantmass(){return fk0InvMass;}
+
+
+
+ // methods to reduce the tracks to correlate with track selection cuts applied here
+ TObjArray* AcceptAndReduceTracks(AliAODEvent* inputEvent); // selecting hadrons and kaons
+ TObjArray* AcceptAndReduceKZero(AliAODEvent* inputEvent); // selecting kzeros
+
+
+ private:
+
+ AliHFCorrelator(const AliHFCorrelator& vtxr);
+ AliHFCorrelator& operator=(const AliHFCorrelator& vtxr );
+
+ AliEventPoolManager* fPoolMgr; //! event pool manager
+ AliEventPool * fPool; //! Pool for event mixing
+ AliHFAssociatedTrackCuts* fhadcuts;//! hadron cuts
+ AliAODEvent * fAODEvent;//! AOD Event
+ TObjArray* fAssociatedTracks; // Array of associated tracks
+ TClonesArray* fmcArray; //mcarray
+ AliReducedParticle * fReducedPart; // reduced AOD particle;
+ AliAODRecoDecayHF2Prong* fD0cand; //D0 candidate
+ Int_t fhypD0; //hypothesis necessary for
+ Int_t fDCharge; // charge of a daughter of the D meson
+
+ Bool_t fmixing;// switch for event mixing
+ Bool_t fmontecarlo; // switch for MonteCarlo
+ Bool_t fsystem; // select pp (kFALSE) or PbPb (kTRUE)
+ Bool_t fUseReco; // switch to use reconstruction (kTRUE) or MC truth (kFALSE)
+
+ Int_t fselect; // 1 for hadrons, 2 for kaons, 3 for KZeros
+ Int_t fUseImpactParameter; // switch to use the impact parameter cut
+ Int_t fPIDmode; // set the PID mode for Kaon identification
+
+ Int_t fNofTracks; // number of tracks in track array
+ Int_t fPoolContent; // n of events in pool
+
+ Double_t fPhiMin; // min for phi
+ Double_t fPhiMax; // max for phi
+
+ Double_t fPtTrigger; // pt of the trigger D meson
+ Double_t fPhiTrigger; // phi of the trigger D meson
+ Double_t fEtaTrigger; // Eta of the trigger D meson
+
+
+ Double_t fDeltaPhi; // delta phi between D meson and associated track
+ Double_t fDeltaEta; // delta eta between D meson and associated track
+
+ Double_t fk0InvMass; // KZero invariant mass
+
+
+ ClassDef(AliHFCorrelator,3); // class for HF correlations
+};
+
+
+
+
+
+#endif
- //DEFINITION OF A FEW CONSTANTS\r
-//----------------------------------------------------\r
-\r
-/* $Id$ */\r
-\r
-AliAnalysisTaskDStarCorrelations *AddTaskDStarCorrelations(AliAnalysisTaskDStarCorrelations::CollSyst syst, \r
- Bool_t theMCon, Bool_t mixing, Bool_t UseReco=kTRUE,Bool_t UseHadChannelinMC,Bool_t fullmode = kFALSE,Bool_t UseEffic=kFALSE,Bool_t UseDEffic = kFALSE,\r
- AliAnalysisTaskDStarCorrelations::DEffVariable var,\r
- Int_t trackselect =1, Int_t usedispl =0, Int_t nbins, Float_t DStarSigma, Float_t D0Sigma, Float_t D0SBSigmaLow, Float_t D0SBSigmaHigh, Float_t eta,\r
- TString DStarCutsFile, TString TrackCutsFile,\r
- Int_t tasknumber = 0)\r
-{\r
-\r
- \r
- \r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- ::Error(" AliAnalysisTaskDStarCorrelations", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
-\r
- cout << "==========================================================" << endl;\r
- cout << "Set Inputs : " << endl;\r
- cout << " " << endl;\r
- if(syst == AliAnalysisTaskDStarCorrelations::pp) cout << "Running on pp @ 7 TeV" << endl;\r
- if(syst == AliAnalysisTaskDStarCorrelations::pA) cout << "Running on pPb @ 5.02 TeV" << endl;\r
- if(syst == AliAnalysisTaskDStarCorrelations::AA) cout << "Running on PbPb @ 2.76 TeV" << endl;\r
- \r
- if(theMCon) cout << "Analysis on MonteCarlo" << endl;\r
- else cout << "Analysis on Data" << endl;\r
- \r
- if(mixing) cout << "Analysis on Mixed Events" << endl;\r
- else cout << "Analysis on Single Events" << endl;\r
- \r
- if(UseReco) cout << "Using Reconstructed objects" << endl;\r
- else cout << "Using Pure MC information " << endl;\r
-\r
- if(fullmode) cout << "Running in full mode" << endl;\r
- else cout << "Running in fast mode " << endl;\r
- \r
- if(UseEffic) cout << "Using single track efficiency map" << endl;\r
- else cout << "Not Using single track efficiency map " << endl;\r
- \r
- if(UseDEffic) cout << "Using Dmeson efficiency map" << endl;\r
- else cout << "Not Using Dmeson efficiency map " << endl;\r
- \r
- \r
- if(var == AliAnalysisTaskDStarCorrelations::kNone) cout << "Applying D Efficiency map vs pT " << endl;\r
- if(var == AliAnalysisTaskDStarCorrelations::kMult) cout << "Applying D Efficiency map vs pT vs Multiplicity" << endl;\r
- if(var == AliAnalysisTaskDStarCorrelations::kCentr) cout << "Applying D Efficiency map vs pT vs Centrality" << endl;\r
- if(var == AliAnalysisTaskDStarCorrelations::kRapidity) cout << "Applying D Efficiency map vs pT vs Rapidity" << endl;\r
- if(var == AliAnalysisTaskDStarCorrelations::kEta) cout << "Applying D Efficiency map vs pT vs Eta" << endl;\r
-\r
- if(trackselect == 1) cout << "Correlating with hadrons" << endl;\r
- if(trackselect == 2) cout << "Correlating with kaons" << endl;\r
- if(trackselect == 3) cout << "Correlating with kzeros" << endl;\r
- \r
- if(usedispl == 0) cout << "Not using displacement cut" << endl;\r
- if(usedispl == 1) cout << "Using absolute displacement cut" << endl;\r
- if(usedispl == 2) cout << "Using relative displacement cut" << endl;\r
- \r
- \r
- cout << "Number of bins in deltaphi = " << nbins << endl;\r
- \r
- cout << "N of Sigmas in D* selection =" << DStarSigma << endl;\r
- cout << "N of Sigmas in D0 selection = " << D0Sigma << endl;\r
- cout << "D0 Sidebands taken from = " << D0SBSigmaLow << " - " << D0SBSigmaHigh << " sigmas " << endl; endl;\r
- \r
- \r
- \r
- cout << "DStar cut object: " << DStarCutsFile << endl;\r
- cout << "Tracks cut object: " << TrackCutsFile << endl;\r
- \r
- \r
- cout << "==========================================================" << endl;\r
- //gSystem->Sleep(2000);\r
- \r
-// TString DCutObjPath = "CutObjects/DStar/";\r
- \r
- \r
-// ******************************** OPENING THE D* CUTS ************************************\r
- cout << "Getting D meson cut object from file \n" << DStarCutsFile.Data() << "\n " << endl;\r
- TFile* filecuts=TFile::Open(DStarCutsFile.Data());\r
- if(!filecuts->IsOpen()){\r
- cout<<"DStar cut object file not found: exit"<<endl;\r
- return;\r
- }\r
- \r
- AliRDHFCutsDStartoKpipi* RDHFDStartoKpipi=new AliRDHFCutsDStartoKpipi();\r
- RDHFDStartoKpipi = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");\r
- RDHFDStartoKpipi->SetName("DStartoKpipiCuts");\r
- \r
- // mm let's see if everything is ok\r
- if(!RDHFDStartoKpipi){\r
- cout<<"Specific AliRDHFCuts not found"<<endl;\r
- return;\r
- }\r
- \r
- \r
- // RDHFDStartoKpipi->SetTriggerClass("");\r
- // RDHFDStartoKpipi->SetTriggerMask(AliVEvent::kCentral);\r
- \r
- \r
- \r
-// ******************************** OPENING THE ASSOCIATED TRACK CUTS ************************************\r
- cout << "Getting associated track cut object from file \n" << TrackCutsFile.Data() << "\n " << endl;\r
- TFile* filecuts2=TFile::Open(TrackCutsFile.Data());\r
- if(!filecuts2->IsOpen()){\r
- cout<<"Track cut object file not found: exit"<<endl;\r
- return;\r
- }\r
- AliHFAssociatedTrackCuts* corrCuts=new AliHFAssociatedTrackCuts();\r
- corrCuts = (AliHFAssociatedTrackCuts*)filecuts2->Get("AssociatedCuts");\r
- corrCuts->SetName("AssociatedCuts");\r
- corrCuts->PrintAll();\r
- if(!corrCuts){\r
- cout<<"Specific associated track cuts not found"<<endl;\r
- return;\r
- }\r
- \r
-\r
-// ******************************** SELECTING THE MC PROCESS ************************************\r
-\r
- TString selectMCproc = "";\r
- \r
- Int_t NMCevents = corrCuts->GetNofMCEventType();\r
- for(Int_t k=0; k<NMCevents; k++){\r
- Int_t * MCEventType = corrCuts->GetMCEventType();\r
- selectMCproc += Form("%d",MCEventType[k]);\r
- }\r
-\r
- cout << "Select process string = " << selectMCproc << endl;\r
- \r
-\r
-\r
-// ******************************** CREATING THE TASK ************************************\r
- \r
- printf("CREATE TASK \n");\r
- // create the task\r
- AliAnalysisTaskDStarCorrelations *task = new AliAnalysisTaskDStarCorrelations("AliAnalysisTaskDStarCorrelations",RDHFDStartoKpipi,corrCuts,syst,fullmode);\r
- \r
- // Setters\r
-\r
- if(!theMCon) {\r
- printf("Analysis on Data - reconstruction only!");\r
- UseReco = kTRUE;\r
- printf("Analysis on Data - hadronic channel only!");\r
- UseHadChannelinMC = kFALSE;\r
- }\r
- \r
- \r
-\r
- \r
- \r
- task->SetNofPhiBins(nbins);\r
- task->SetMonteCarlo(theMCon);\r
- task->SetUseMixing(mixing);\r
- task->SetCorrelator(trackselect) ;\r
- task->SetUseDisplacement(usedispl);\r
- //task->SetCollSys(syst);\r
- task->SetLevelOfDebug(2);\r
- task->SetUseReconstruction(UseReco); // set kTRUE for Using Reconstruction, kFALSe for MC Truth\r
- task->SetDMesonSigmas(DStarSigma,D0Sigma,D0SBSigmaLow,D0SBSigmaHigh);\r
- //task->SetDMesonSigmas(sigmas);\r
- //task->SetDMesonSigmas(sigmas);\r
- task->SetUseEfficiencyCorrection(UseEffic);\r
- task->SetUseDmesonEfficiencyCorrection(UseDEffic);\r
- \r
- task->SetEfficiencyVariable(var);\r
- task->SetMaxDStarEta(eta);\r
- task->SetUseHadronicChannelAtKineLevel(UseHadChannelinMC);\r
- \r
-\r
- if(trackselect == 1) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged hadrons \n");\r
- else if(trackselect == 2) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged kaons \n");\r
- else if(trackselect == 3) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with reconstructed K0s \n");\r
- else Fatal(" AliAnalysisTaskDStarCorrelations","Nothing to correlate with!");\r
- if(mixing) Info (" AliAnalysisTaskDStarCorrelations","Event Mixing Analysis\n");\r
- if(!mixing) Info (" AliAnalysisTaskDStarCorrelations","Single Event Analysis \n");\r
-\r
- // Create and connect containers for input/output\r
- //TString dcavalue = " ";\r
- if(!theMCon) TString contname = "Data";\r
- if(theMCon) TString contname = "MonteCarlo";\r
- TString contname2 = "MC";\r
- if(trackselect ==1) TString particle = "Hadron";\r
- if(trackselect ==2) TString particle = "Kaon";\r
- if(trackselect ==3) TString particle = "KZero";\r
- \r
- TString cutname = "cuts" ;\r
- TString cutname2 = "hadroncuts" ;\r
- TString outputfile = AliAnalysisManager::GetCommonFileName();\r
- TString outputfileMC = AliAnalysisManager::GetCommonFileName();\r
- TString counter = "NormCounter";\r
- outputfile += ":PWGHF_HFCJ_";\r
- outputfileMC += ":PWGHF_HFCJ_";\r
- \r
- if(!mixing) {\r
- outputfile += "SE";\r
- outputfileMC += "SE";\r
- contname += "SE";\r
- contname2 += "SE";\r
- cutname += "SE";\r
- cutname2 += "SE";\r
- counter+= "SE";\r
- }\r
- if(mixing){\r
- outputfile += "ME";\r
- outputfileMC += "ME";\r
- contname += "ME";\r
- contname2 += "ME";\r
- cutname += "ME";\r
- cutname2 += "ME";\r
- counter+= "ME";\r
- }\r
- \r
-\r
- \r
- outputfile += "Dphi_DStar";\r
- outputfileMC += "Dphi_DStar";\r
- outputfile += particle;\r
- outputfileMC += particle;\r
- cutname += particle;\r
- cutname2 += particle;\r
- contname += particle;\r
- contname2 += particle;\r
- counter+= particle;\r
- \r
- if(UseEffic){\r
- outputfile += "_EffY_";\r
- outputfileMC += "_EffY_";\r
- contname += "_EffY_";\r
- contname2 += "_EffY_";\r
- cutname += "_EffY_";\r
- cutname2 += "_EffY_";\r
- counter+= "_EffY_";\r
- }\r
- \r
- if(!UseEffic){\r
- outputfile += "_EffN_";\r
- outputfileMC += "_EffN_";\r
- contname += "_EffN_";\r
- contname2 += "_EffN_";\r
- cutname += "_EffN_";\r
- cutname2 += "_EffN_";\r
- counter+= "_EffN_";\r
- }\r
- \r
- if(UseDEffic){\r
- TString string = "DEffY_";\r
- \r
- if(var == AliAnalysisTaskDStarCorrelations::kNone) string += "vsPt_";\r
- if(var == AliAnalysisTaskDStarCorrelations::kMult) string += "vsPtMult_";\r
- if(var == AliAnalysisTaskDStarCorrelations::kCentr) string += "vsPCentrt_";\r
- if(var == AliAnalysisTaskDStarCorrelations::kRapidity) string += "vsPtY_";\r
- if(var == AliAnalysisTaskDStarCorrelations::kEta) string += "vsPtEta_";\r
- \r
- outputfile += string;\r
- outputfileMC += string;\r
- contname += string;\r
- contname2 += string;\r
- cutname += string;\r
- cutname2 += string;\r
- counter+= string;\r
- }\r
- \r
- if(!UseDEffic){\r
- outputfile += "DEffN_";\r
- outputfileMC += "DEffN_";\r
- contname += "DEffN_";\r
- contname2 += "DEffN_";\r
- cutname += "DEffN_";\r
- cutname2 += "DEffN_";\r
- counter+= "DEffN_";\r
- }\r
- \r
- \r
- outputfile += Form("%d_bins_",nbins);\r
- outputfileMC += Form("%d_bins_",nbins);\r
- cutname += Form("%d_bins_",nbins);\r
- cutname2 += Form("%d_bins_",nbins);\r
- contname += Form("%d_bins_",nbins);\r
- contname2 += Form("%d_bins_",nbins);\r
- counter+= Form("%d_bins_",nbins);\r
- \r
- \r
- outputfile += Form("task_%d",tasknumber);\r
- outputfileMC += Form("task_%d",tasknumber);\r
- cutname += Form("task_%d",tasknumber);\r
- cutname2 += Form("task_%d",tasknumber);\r
- contname += Form("task_%d",tasknumber);\r
- contname2 += Form("task_%d",tasknumber);\r
- counter+= Form("task_%d",tasknumber);\r
- \r
-/* outputfile += TrackCutObjNamePrefix;\r
- outputfileMC += TrackCutObjNamePrefix;\r
- cutname += TrackCutObjNamePrefix;\r
- cutname2 += TrackCutObjNamePrefix;\r
- contname += TrackCutObjNamePrefix;\r
- contname2 += TrackCutObjNamePrefix;\r
- counter+= TrackCutObjNamePrefix;\r
-*/ \r
- outputfile += selectMCproc;\r
- outputfileMC += selectMCproc;\r
- cutname += selectMCproc;\r
- cutname2 += selectMCproc;\r
- contname += selectMCproc;\r
- contname2 += selectMCproc;\r
- counter+= selectMCproc;\r
- \r
- TString reco = "";\r
- \r
- if(UseReco) reco = "_reco";\r
- if(!UseReco) {\r
- if(UseHadChannelinMC) reco = "_MCTruthHadChan";\r
- if(!UseHadChannelinMC) reco = "_MCTruthAllChan";\r
- }\r
- outputfile += reco;\r
- outputfileMC += reco;\r
- cutname += reco;\r
- cutname2 += reco;\r
- contname += reco;\r
- contname2 += reco;\r
- counter+= reco;\r
- \r
- TString nsigma = Form("_%.0f_%.0f%.0f%.0f_sigmas",DStarSigma,D0Sigma,D0SBSigmaLow,D0SBSigmaHigh);\r
- \r
- //cout << "nsigma string = "<< nsigma << endl;\r
- \r
- outputfile += nsigma;\r
- outputfileMC += nsigma;\r
- cutname += nsigma;\r
- cutname2 += nsigma;\r
- contname += nsigma;\r
- contname2 += nsigma;\r
- counter+= nsigma;\r
- \r
- \r
- cout << contname << endl;\r
- cout << contname2 << endl;\r
- cout << cutname << endl;\r
- cout << cutname2 << endl;\r
- cout << counter << endl;\r
- cout << outputfile << endl;\r
- //return;\r
- \r
- mgr->AddTask(task);\r
- // ------ input data ------\r
- AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();\r
- \r
- // ----- output data -----\r
- \r
- // output TH1I for event counting\r
- \r
- //TLists\r
- AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());\r
- AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(contname2, TList::Class(),AliAnalysisManager::kOutputContainer,outputfileMC.Data());\r
- // Cut Objects\r
- AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(cutname,AliRDHFCutsDStartoKpipi::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts D\r
- AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(cutname2,AliHFAssociatedTrackCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts tracks\r
- // Normalization Counter\r
- AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(counter,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());\r
- \r
- \r
- mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(task,1,coutput1);\r
- mgr->ConnectOutput(task,2,coutput2);\r
- mgr->ConnectOutput(task,3,coutput3);\r
- mgr->ConnectOutput(task,4,coutput4);\r
- mgr->ConnectOutput(task,5,coutput5);\r
-\r
- return task ;\r
-\r
-}\r
-\r
+ //DEFINITION OF A FEW CONSTANTS
+//----------------------------------------------------
+
+/* $Id$ */
+
+AliAnalysisTaskDStarCorrelations *AddTaskDStarCorrelations(AliAnalysisTaskDStarCorrelations::CollSyst syst,
+ Bool_t theMCon, Bool_t mixing, Bool_t UseReco=kTRUE,Bool_t UseHadChannelinMC,Bool_t fullmode = kFALSE,Bool_t UseEffic=kFALSE,Bool_t UseDEffic = kFALSE,
+ AliAnalysisTaskDStarCorrelations::DEffVariable var,
+ Int_t trackselect =1, Int_t usedispl =0, Int_t nbins, Float_t DStarSigma, Float_t D0Sigma, Float_t D0SBSigmaLow, Float_t D0SBSigmaHigh, Float_t eta,
+ TString DStarCutsFile, TString TrackCutsFile,
+ Int_t tasknumber = 0)
+{
+
+
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error(" AliAnalysisTaskDStarCorrelations", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ cout << "==========================================================" << endl;
+ cout << "Set Inputs : " << endl;
+ cout << " " << endl;
+ if(syst == AliAnalysisTaskDStarCorrelations::pp) cout << "Running on pp @ 7 TeV" << endl;
+ if(syst == AliAnalysisTaskDStarCorrelations::pA) cout << "Running on pPb @ 5.02 TeV" << endl;
+ if(syst == AliAnalysisTaskDStarCorrelations::AA) cout << "Running on PbPb @ 2.76 TeV" << endl;
+
+ if(theMCon) cout << "Analysis on MonteCarlo" << endl;
+ else cout << "Analysis on Data" << endl;
+
+ if(mixing) cout << "Analysis on Mixed Events" << endl;
+ else cout << "Analysis on Single Events" << endl;
+
+ if(UseReco) cout << "Using Reconstructed objects" << endl;
+ else cout << "Using Pure MC information " << endl;
+
+ if(fullmode) cout << "Running in full mode" << endl;
+ else cout << "Running in fast mode " << endl;
+
+ if(UseEffic) cout << "Using single track efficiency map" << endl;
+ else cout << "Not Using single track efficiency map " << endl;
+
+ if(UseDEffic) cout << "Using Dmeson efficiency map" << endl;
+ else cout << "Not Using Dmeson efficiency map " << endl;
+
+
+ if(var == AliAnalysisTaskDStarCorrelations::kNone) cout << "Applying D Efficiency map vs pT " << endl;
+ if(var == AliAnalysisTaskDStarCorrelations::kMult) cout << "Applying D Efficiency map vs pT vs Multiplicity" << endl;
+ if(var == AliAnalysisTaskDStarCorrelations::kCentr) cout << "Applying D Efficiency map vs pT vs Centrality" << endl;
+ if(var == AliAnalysisTaskDStarCorrelations::kRapidity) cout << "Applying D Efficiency map vs pT vs Rapidity" << endl;
+ if(var == AliAnalysisTaskDStarCorrelations::kEta) cout << "Applying D Efficiency map vs pT vs Eta" << endl;
+
+ if(trackselect == 1) cout << "Correlating with hadrons" << endl;
+ if(trackselect == 2) cout << "Correlating with kaons" << endl;
+ if(trackselect == 3) cout << "Correlating with kzeros" << endl;
+
+ if(usedispl == 0) cout << "Not using displacement cut" << endl;
+ if(usedispl == 1) cout << "Using absolute displacement cut" << endl;
+ if(usedispl == 2) cout << "Using relative displacement cut" << endl;
+
+
+ cout << "Number of bins in deltaphi = " << nbins << endl;
+
+ cout << "N of Sigmas in D* selection =" << DStarSigma << endl;
+ cout << "N of Sigmas in D0 selection = " << D0Sigma << endl;
+ cout << "D0 Sidebands taken from = " << D0SBSigmaLow << " - " << D0SBSigmaHigh << " sigmas " << endl; endl;
+
+
+
+ cout << "DStar cut object: " << DStarCutsFile << endl;
+ cout << "Tracks cut object: " << TrackCutsFile << endl;
+
+
+ cout << "==========================================================" << endl;
+ //gSystem->Sleep(2000);
+
+// TString DCutObjPath = "CutObjects/DStar/";
+
+
+// ******************************** OPENING THE D* CUTS ************************************
+ cout << "Getting D meson cut object from file \n" << DStarCutsFile.Data() << "\n " << endl;
+ TFile* filecuts=TFile::Open(DStarCutsFile.Data());
+ if(!filecuts->IsOpen()){
+ cout<<"DStar cut object file not found: exit"<<endl;
+ return;
+ }
+
+ AliRDHFCutsDStartoKpipi* RDHFDStartoKpipi=new AliRDHFCutsDStartoKpipi();
+ RDHFDStartoKpipi = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");
+ RDHFDStartoKpipi->SetName("DStartoKpipiCuts");
+
+ // mm let's see if everything is ok
+ if(!RDHFDStartoKpipi){
+ cout<<"Specific AliRDHFCuts not found"<<endl;
+ return;
+ }
+
+
+ // RDHFDStartoKpipi->SetTriggerClass("");
+ // RDHFDStartoKpipi->SetTriggerMask(AliVEvent::kCentral);
+
+
+
+// ******************************** OPENING THE ASSOCIATED TRACK CUTS ************************************
+ cout << "Getting associated track cut object from file \n" << TrackCutsFile.Data() << "\n " << endl;
+ TFile* filecuts2=TFile::Open(TrackCutsFile.Data());
+ if(!filecuts2->IsOpen()){
+ cout<<"Track cut object file not found: exit"<<endl;
+ return;
+ }
+ AliHFAssociatedTrackCuts* corrCuts=new AliHFAssociatedTrackCuts();
+ corrCuts = (AliHFAssociatedTrackCuts*)filecuts2->Get("AssociatedCuts");
+ corrCuts->SetName("AssociatedCuts");
+ corrCuts->PrintAll();
+ if(!corrCuts){
+ cout<<"Specific associated track cuts not found"<<endl;
+ return;
+ }
+
+
+// ******************************** SELECTING THE MC PROCESS ************************************
+
+ TString selectMCproc = "";
+
+ Int_t NMCevents = corrCuts->GetNofMCEventType();
+ for(Int_t k=0; k<NMCevents; k++){
+ Int_t * MCEventType = corrCuts->GetMCEventType();
+ selectMCproc += Form("%d",MCEventType[k]);
+ }
+
+ cout << "Select process string = " << selectMCproc << endl;
+
+
+
+// ******************************** CREATING THE TASK ************************************
+
+ printf("CREATE TASK \n");
+ // create the task
+ AliAnalysisTaskDStarCorrelations *task = new AliAnalysisTaskDStarCorrelations("AliAnalysisTaskDStarCorrelations",RDHFDStartoKpipi,corrCuts,syst,fullmode);
+
+ // Setters
+
+ if(!theMCon) {
+ printf("Analysis on Data - reconstruction only!");
+ UseReco = kTRUE;
+ printf("Analysis on Data - hadronic channel only!");
+ UseHadChannelinMC = kFALSE;
+ }
+
+
+
+
+
+ task->SetNofPhiBins(nbins);
+ task->SetMonteCarlo(theMCon);
+ task->SetUseMixing(mixing);
+ task->SetCorrelator(trackselect) ;
+ task->SetUseDisplacement(usedispl);
+ //task->SetCollSys(syst);
+ task->SetLevelOfDebug(2);
+ task->SetUseReconstruction(UseReco); // set kTRUE for Using Reconstruction, kFALSe for MC Truth
+ task->SetDMesonSigmas(DStarSigma,D0Sigma,D0SBSigmaLow,D0SBSigmaHigh);
+ //task->SetDMesonSigmas(sigmas);
+ //task->SetDMesonSigmas(sigmas);
+ task->SetUseEfficiencyCorrection(UseEffic);
+ task->SetUseDmesonEfficiencyCorrection(UseDEffic);
+
+ task->SetEfficiencyVariable(var);
+ task->SetMaxDStarEta(eta);
+ task->SetUseHadronicChannelAtKineLevel(UseHadChannelinMC);
+
+
+ if(trackselect == 1) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged hadrons \n");
+ else if(trackselect == 2) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged kaons \n");
+ else if(trackselect == 3) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with reconstructed K0s \n");
+ else Fatal(" AliAnalysisTaskDStarCorrelations","Nothing to correlate with!");
+ if(mixing) Info (" AliAnalysisTaskDStarCorrelations","Event Mixing Analysis\n");
+ if(!mixing) Info (" AliAnalysisTaskDStarCorrelations","Single Event Analysis \n");
+
+ // Create and connect containers for input/output
+ //TString dcavalue = " ";
+ if(!theMCon) TString contname = "Data";
+ if(theMCon) TString contname = "MonteCarlo";
+ TString contname2 = "MC";
+ if(trackselect ==1) TString particle = "Hadron";
+ if(trackselect ==2) TString particle = "Kaon";
+ if(trackselect ==3) TString particle = "KZero";
+
+ TString cutname = "cuts" ;
+ TString cutname2 = "hadroncuts" ;
+ TString outputfile = AliAnalysisManager::GetCommonFileName();
+ TString outputfileMC = AliAnalysisManager::GetCommonFileName();
+ TString counter = "NormCounter";
+ outputfile += ":PWGHF_HFCJ_";
+ outputfileMC += ":PWGHF_HFCJ_";
+
+ if(!mixing) {
+ outputfile += "SE";
+ outputfileMC += "SE";
+ contname += "SE";
+ contname2 += "SE";
+ cutname += "SE";
+ cutname2 += "SE";
+ counter+= "SE";
+ }
+ if(mixing){
+ outputfile += "ME";
+ outputfileMC += "ME";
+ contname += "ME";
+ contname2 += "ME";
+ cutname += "ME";
+ cutname2 += "ME";
+ counter+= "ME";
+ }
+
+
+
+ outputfile += "Dphi_DStar";
+ outputfileMC += "Dphi_DStar";
+ outputfile += particle;
+ outputfileMC += particle;
+ cutname += particle;
+ cutname2 += particle;
+ contname += particle;
+ contname2 += particle;
+ counter+= particle;
+
+ if(UseEffic){
+ outputfile += "_EffY_";
+ outputfileMC += "_EffY_";
+ contname += "_EffY_";
+ contname2 += "_EffY_";
+ cutname += "_EffY_";
+ cutname2 += "_EffY_";
+ counter+= "_EffY_";
+ }
+
+ if(!UseEffic){
+ outputfile += "_EffN_";
+ outputfileMC += "_EffN_";
+ contname += "_EffN_";
+ contname2 += "_EffN_";
+ cutname += "_EffN_";
+ cutname2 += "_EffN_";
+ counter+= "_EffN_";
+ }
+
+ if(UseDEffic){
+ TString string = "DEffY_";
+
+ if(var == AliAnalysisTaskDStarCorrelations::kNone) string += "vsPt_";
+ if(var == AliAnalysisTaskDStarCorrelations::kMult) string += "vsPtMult_";
+ if(var == AliAnalysisTaskDStarCorrelations::kCentr) string += "vsPCentrt_";
+ if(var == AliAnalysisTaskDStarCorrelations::kRapidity) string += "vsPtY_";
+ if(var == AliAnalysisTaskDStarCorrelations::kEta) string += "vsPtEta_";
+
+ outputfile += string;
+ outputfileMC += string;
+ contname += string;
+ contname2 += string;
+ cutname += string;
+ cutname2 += string;
+ counter+= string;
+ }
+
+ if(!UseDEffic){
+ outputfile += "DEffN_";
+ outputfileMC += "DEffN_";
+ contname += "DEffN_";
+ contname2 += "DEffN_";
+ cutname += "DEffN_";
+ cutname2 += "DEffN_";
+ counter+= "DEffN_";
+ }
+
+
+ outputfile += Form("%d_bins_",nbins);
+ outputfileMC += Form("%d_bins_",nbins);
+ cutname += Form("%d_bins_",nbins);
+ cutname2 += Form("%d_bins_",nbins);
+ contname += Form("%d_bins_",nbins);
+ contname2 += Form("%d_bins_",nbins);
+ counter+= Form("%d_bins_",nbins);
+
+
+ outputfile += Form("task_%d",tasknumber);
+ outputfileMC += Form("task_%d",tasknumber);
+ cutname += Form("task_%d",tasknumber);
+ cutname2 += Form("task_%d",tasknumber);
+ contname += Form("task_%d",tasknumber);
+ contname2 += Form("task_%d",tasknumber);
+ counter+= Form("task_%d",tasknumber);
+
+/* outputfile += TrackCutObjNamePrefix;
+ outputfileMC += TrackCutObjNamePrefix;
+ cutname += TrackCutObjNamePrefix;
+ cutname2 += TrackCutObjNamePrefix;
+ contname += TrackCutObjNamePrefix;
+ contname2 += TrackCutObjNamePrefix;
+ counter+= TrackCutObjNamePrefix;
+*/
+ outputfile += selectMCproc;
+ outputfileMC += selectMCproc;
+ cutname += selectMCproc;
+ cutname2 += selectMCproc;
+ contname += selectMCproc;
+ contname2 += selectMCproc;
+ counter+= selectMCproc;
+
+ TString reco = "";
+
+ if(UseReco) reco = "_reco";
+ if(!UseReco) {
+ if(UseHadChannelinMC) reco = "_MCTruthHadChan";
+ if(!UseHadChannelinMC) reco = "_MCTruthAllChan";
+ }
+ outputfile += reco;
+ outputfileMC += reco;
+ cutname += reco;
+ cutname2 += reco;
+ contname += reco;
+ contname2 += reco;
+ counter+= reco;
+
+ TString nsigma = Form("_%.0f_%.0f%.0f%.0f_sigmas",DStarSigma,D0Sigma,D0SBSigmaLow,D0SBSigmaHigh);
+
+ //cout << "nsigma string = "<< nsigma << endl;
+
+ outputfile += nsigma;
+ outputfileMC += nsigma;
+ cutname += nsigma;
+ cutname2 += nsigma;
+ contname += nsigma;
+ contname2 += nsigma;
+ counter+= nsigma;
+
+
+ cout << contname << endl;
+ cout << contname2 << endl;
+ cout << cutname << endl;
+ cout << cutname2 << endl;
+ cout << counter << endl;
+ cout << outputfile << endl;
+ //return;
+
+ mgr->AddTask(task);
+ // ------ input data ------
+ AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
+
+ // ----- output data -----
+
+ // output TH1I for event counting
+
+ //TLists
+ AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
+ AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(contname2, TList::Class(),AliAnalysisManager::kOutputContainer,outputfileMC.Data());
+ // Cut Objects
+ AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(cutname,AliRDHFCutsDStartoKpipi::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts D
+ AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(cutname2,AliHFAssociatedTrackCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts tracks
+ // Normalization Counter
+ AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(counter,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
+
+
+ mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(task,1,coutput1);
+ mgr->ConnectOutput(task,2,coutput2);
+ mgr->ConnectOutput(task,3,coutput3);
+ mgr->ConnectOutput(task,4,coutput4);
+ mgr->ConnectOutput(task,5,coutput5);
+
+ return task ;
+
+}
+
-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-//\r
-// Flow task\r
-// \r
-// Authors:\r
-// Raphaelle Bailhache <R.Bailhache@gsi.de>\r
-// Theodor Rascanu <trascanu@stud.uni-frankfurt.de>\r
-//\r
-#include "TROOT.h"\r
-#include "TH1D.h"\r
-#include "TH2D.h"\r
-#include "TChain.h"\r
-#include "TVector2.h"\r
-#include "THnSparse.h"\r
-#include "TMath.h"\r
-#include "TRandom3.h"\r
-#include "TProfile.h"\r
-#include "TProfile2D.h"\r
-#include "TLorentzVector.h"\r
-#include "TParticle.h"\r
-#include "TF1.h"\r
-\r
-#include <TDirectory.h>\r
-#include <TTreeStream.h>\r
-\r
-#include "AliVEventHandler.h"\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliAnalysisManager.h"\r
-\r
-#include "AliVEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliMCEvent.h"\r
-#include "AliESD.h"\r
-#include "AliESDEvent.h"\r
-#include "AliPID.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliESDVZERO.h"\r
-#include "AliESDUtils.h"\r
-#include "AliMCParticle.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODVertex.h"\r
-#include "AliAODTrack.h"\r
-#include "AliVTrack.h"\r
-#include "AliESDtrack.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliAODTrack.h"\r
-#include "AliStack.h"\r
-#include "AliMCEvent.h"\r
-\r
-#include "AliFlowCandidateTrack.h"\r
-#include "AliFlowEvent.h"\r
-#include "AliFlowTrackCuts.h"\r
-#include "AliFlowVector.h"\r
-#include "AliFlowCommonConstants.h"\r
-#include "AliKFParticle.h"\r
-#include "AliKFVertex.h"\r
-\r
-#include "AliHFEcuts.h"\r
-#include "AliHFEpid.h"\r
-#include "AliHFEpidQAmanager.h"\r
-#include "AliHFEtools.h"\r
-#include "AliHFEVZEROEventPlane.h"\r
-\r
-#include "AliCentrality.h"\r
-#include "AliEventplane.h"\r
-#include "AliAnalysisTaskFlowTPCTOFEPSP.h"\r
-#include "AliAODMCHeader.h"\r
-#include "TClonesArray.h"\r
-#include "AliHFENonPhotonicElectron.h"\r
-\r
-ClassImp(AliAnalysisTaskFlowTPCTOFEPSP)\r
-\r
-//____________________________________________________________________\r
-AliAnalysisTaskFlowTPCTOFEPSP::AliAnalysisTaskFlowTPCTOFEPSP() :\r
- AliAnalysisTaskSE(),\r
- fListHist(0x0), \r
- fAODAnalysis(kFALSE),\r
- fFilter(1<<4),\r
- fAODMCHeader(NULL),\r
- fAODArrayMCInfo(NULL),\r
- fBackgroundSubtraction(NULL),\r
- fVZEROEventPlane(kFALSE),\r
- fVZEROEventPlaneA(kFALSE),\r
- fVZEROEventPlaneC(kFALSE),\r
- fSubEtaGapTPC(kFALSE),\r
- fEtaGap(0.0),\r
- fNbBinsCentralityQCumulant(4),\r
- fNbBinsPtQCumulant(12),\r
- fMinPtQCumulant(0.2),\r
- fMaxPtQCumulant(6.0),\r
- fAfterBurnerOn(kFALSE),\r
- fNonFlowNumberOfTrackClones(0),\r
- fV1(0.),\r
- fV2(0.),\r
- fV3(0.),\r
- fV4(0.),\r
- fV5(0.),\r
- fMaxNumberOfIterations(100),\r
- fPrecisionPhi(0.001),\r
- fUseMCReactionPlane(kFALSE),\r
- fSP(kFALSE),\r
- fMCPID(kFALSE),\r
- fNoPID(kFALSE),\r
- fChi2OverNDFCut(3.0),\r
- fMaxdca(3.0),\r
- fMaxopeningtheta(0.02),\r
- fMaxopeningphi(0.1),\r
- fMaxopening3D(0.1),\r
- fMaxInvmass(0.1),\r
- fSetMassConstraint(kFALSE),\r
- fMonitorEventPlane(kFALSE),\r
- fMonitorContamination(kFALSE),\r
- fMonitorPhotonic(kFALSE),\r
- fMonitorWithoutPID(kFALSE),\r
- fMonitorTrackCuts(kFALSE),\r
- fMonitorQCumulant(kFALSE),\r
- fcutsRP(0),\r
- fcutsPOI(0),\r
- fHFECuts(0),\r
- fPID(0),\r
- fPIDTOFOnly(0),\r
- fPIDqa(0),\r
- fflowEvent(NULL),\r
- fHFEBackgroundCuts(0),\r
- fPIDBackground(0),\r
- fPIDBackgroundqa(0),\r
- fAlgorithmMA(kTRUE),\r
- fArraytrack(NULL),\r
- fCounterPoolBackground(0),\r
- fHFEVZEROEventPlane(0x0),\r
- fHistEV(0),\r
- fHistPileUp(0),\r
- fPileUpCut(kFALSE),\r
- fEventPlane(0x0),\r
- fEventPlaneaftersubtraction(0x0),\r
- fFractionContamination(0x0),\r
- fContaminationv2(0x0),\r
- fCosSin2phiep(0x0),\r
- fCos2phie(0x0),\r
- fSin2phie(0x0),\r
- fCos2phiep(0x0),\r
- fSin2phiep(0x0),\r
- fSin2phiephiep(0x0),\r
- fCosResabc(0x0),\r
- fSinResabc(0x0),\r
- fProfileCosResab(0x0),\r
- fProfileCosResac(0x0),\r
- fProfileCosResbc(0x0),\r
- fCosRes(0x0),\r
- fSinRes(0x0),\r
- fProfileCosRes(0x0),\r
- fTrackingCuts(0x0),\r
- fDeltaPhiMapsBeforePID(0x0),\r
- fCosPhiMapsBeforePID(0x0),\r
- fDeltaPhiMaps(0x0),\r
- fDeltaPhiMapsContamination(0x0),\r
- fCosPhiMaps(0x0),\r
- fProfileCosPhiMaps(0x0),\r
- fDeltaPhiMapsTaggedPhotonic(0x0),\r
- //fCosPhiMapsTaggedPhotonic(0x0),\r
- fDeltaPhiMapsTaggedNonPhotonic(0x0),\r
- //fCosPhiMapsTaggedNonPhotonic(0x0),\r
- fDeltaPhiMapsTaggedPhotonicLS(0x0),\r
- //fCosPhiMapsTaggedPhotonicLS(0x0),\r
- fMCSourceDeltaPhiMaps(0x0),\r
- fOppSignDeltaPhiMaps(0x0),\r
- fSameSignDeltaPhiMaps(0x0),\r
- fOppSignAngle(0x0),\r
- fSameSignAngle(0x0),\r
- fDebugStreamer(0)\r
-{\r
- // Constructor\r
-\r
- for(Int_t k = 0; k < 10; k++) {\r
- fBinCentralityLess[k] = 0.0;\r
- }\r
- for(Int_t k = 0; k < 11; k++) {\r
- fContamination[k] = NULL;\r
- fv2contamination[k] = NULL;\r
- }\r
- \r
-}\r
-//______________________________________________________________________________\r
-AliAnalysisTaskFlowTPCTOFEPSP:: AliAnalysisTaskFlowTPCTOFEPSP(const char *name) :\r
- AliAnalysisTaskSE(name),\r
- fListHist(0x0),\r
- fAODAnalysis(kFALSE),\r
- fFilter(1<<4), \r
- fAODMCHeader(NULL),\r
- fAODArrayMCInfo(NULL),\r
- fBackgroundSubtraction(NULL),\r
- fVZEROEventPlane(kFALSE),\r
- fVZEROEventPlaneA(kFALSE),\r
- fVZEROEventPlaneC(kFALSE),\r
- fSubEtaGapTPC(kFALSE),\r
- fEtaGap(0.0),\r
- fNbBinsCentralityQCumulant(4),\r
- fNbBinsPtQCumulant(15),\r
- fMinPtQCumulant(0.0),\r
- fMaxPtQCumulant(6.0),\r
- fAfterBurnerOn(kFALSE),\r
- fNonFlowNumberOfTrackClones(0),\r
- fV1(0.),\r
- fV2(0.),\r
- fV3(0.),\r
- fV4(0.),\r
- fV5(0.),\r
- fMaxNumberOfIterations(100),\r
- fPrecisionPhi(0.001),\r
- fUseMCReactionPlane(kFALSE),\r
- fSP(kFALSE),\r
- fMCPID(kFALSE),\r
- fNoPID(kFALSE),\r
- fChi2OverNDFCut(3.0),\r
- fMaxdca(3.0),\r
- fMaxopeningtheta(0.02),\r
- fMaxopeningphi(0.1),\r
- fMaxopening3D(0.1),\r
- fMaxInvmass(0.1),\r
- fSetMassConstraint(kFALSE),\r
- fMonitorEventPlane(kFALSE),\r
- fMonitorContamination(kFALSE),\r
- fMonitorPhotonic(kFALSE),\r
- fMonitorWithoutPID(kFALSE),\r
- fMonitorTrackCuts(kFALSE),\r
- fMonitorQCumulant(kFALSE),\r
- fcutsRP(0),\r
- fcutsPOI(0),\r
- fHFECuts(0),\r
- fPID(0),\r
- fPIDTOFOnly(0),\r
- fPIDqa(0),\r
- fflowEvent(NULL),\r
- fHFEBackgroundCuts(0),\r
- fPIDBackground(0),\r
- fPIDBackgroundqa(0),\r
- fAlgorithmMA(kTRUE), \r
- fArraytrack(NULL),\r
- fCounterPoolBackground(0),\r
- fHFEVZEROEventPlane(0x0),\r
- fHistEV(0),\r
- fHistPileUp(0),\r
- fPileUpCut(kFALSE),\r
- fEventPlane(0x0),\r
- fEventPlaneaftersubtraction(0x0),\r
- fFractionContamination(0x0),\r
- fContaminationv2(0x0),\r
- fCosSin2phiep(0x0),\r
- fCos2phie(0x0),\r
- fSin2phie(0x0),\r
- fCos2phiep(0x0),\r
- fSin2phiep(0x0),\r
- fSin2phiephiep(0x0),\r
- fCosResabc(0x0),\r
- fSinResabc(0x0),\r
- fProfileCosResab(0x0),\r
- fProfileCosResac(0x0),\r
- fProfileCosResbc(0x0),\r
- fCosRes(0x0),\r
- fSinRes(0x0),\r
- fProfileCosRes(0x0),\r
- fTrackingCuts(0x0),\r
- fDeltaPhiMapsBeforePID(0x0),\r
- fCosPhiMapsBeforePID(0x0),\r
- fDeltaPhiMaps(0x0),\r
- fDeltaPhiMapsContamination(0x0),\r
- fCosPhiMaps(0x0),\r
- fProfileCosPhiMaps(0x0),\r
- fDeltaPhiMapsTaggedPhotonic(0x0),\r
- //fCosPhiMapsTaggedPhotonic(0x0),\r
- fDeltaPhiMapsTaggedNonPhotonic(0x0),\r
- //fCosPhiMapsTaggedNonPhotonic(0x0),\r
- fDeltaPhiMapsTaggedPhotonicLS(0x0),\r
- //fCosPhiMapsTaggedPhotonicLS(0x0),\r
- fMCSourceDeltaPhiMaps(0x0),\r
- fOppSignDeltaPhiMaps(0x0),\r
- fSameSignDeltaPhiMaps(0x0),\r
- fOppSignAngle(0x0),\r
- fSameSignAngle(0x0),\r
- fDebugStreamer(0)\r
-{\r
- //\r
- // named ctor\r
- //\r
- \r
- for(Int_t k = 0; k < 10; k++) {\r
- fBinCentralityLess[k] = 0.0;\r
- }\r
- fBinCentralityLess[0] = 0.0;\r
- fBinCentralityLess[1] = 20.0;\r
- fBinCentralityLess[2] = 40.0;\r
- fBinCentralityLess[3] = 60.0;\r
- fBinCentralityLess[4] = 80.0;\r
-\r
- for(Int_t k = 0; k < 11; k++) {\r
- fContamination[k] = NULL;\r
- fv2contamination[k] = NULL;\r
- }\r
- \r
- fPID = new AliHFEpid("hfePid");\r
- fPIDqa = new AliHFEpidQAmanager;\r
-\r
- fPIDBackground = new AliHFEpid("hfePidBackground");\r
- fPIDBackgroundqa = new AliHFEpidQAmanager;\r
-\r
- fPIDTOFOnly = new AliHFEpid("hfePidTOFOnly");\r
-\r
- DefineInput(0,TChain::Class());\r
- DefineOutput(1, TList::Class());\r
- //for(Int_t bincless = 0; bincless < fNbBinsCentralityQCumulant; bincless++) {\r
- // DefineOutput(bincless+2,AliFlowEventSimple::Class()); \r
- //}\r
- \r
-}\r
-//____________________________________________________________\r
-AliAnalysisTaskFlowTPCTOFEPSP::AliAnalysisTaskFlowTPCTOFEPSP(const AliAnalysisTaskFlowTPCTOFEPSP &ref):\r
- AliAnalysisTaskSE(ref),\r
- fListHist(NULL),\r
- fAODAnalysis(ref.fAODAnalysis), \r
- fFilter(ref.fFilter),\r
- fAODMCHeader(ref.fAODMCHeader),\r
- fAODArrayMCInfo(ref.fAODArrayMCInfo),\r
- fBackgroundSubtraction(ref.fBackgroundSubtraction),\r
- fVZEROEventPlane(ref.fVZEROEventPlane),\r
- fVZEROEventPlaneA(ref.fVZEROEventPlaneA),\r
- fVZEROEventPlaneC(ref.fVZEROEventPlaneC),\r
- fSubEtaGapTPC(ref.fSubEtaGapTPC),\r
- fEtaGap(ref.fEtaGap),\r
- fNbBinsCentralityQCumulant(ref.fNbBinsCentralityQCumulant),\r
- fNbBinsPtQCumulant(ref.fNbBinsPtQCumulant),\r
- fMinPtQCumulant(ref.fMinPtQCumulant),\r
- fMaxPtQCumulant(ref.fMaxPtQCumulant),\r
- fAfterBurnerOn(ref.fAfterBurnerOn),\r
- fNonFlowNumberOfTrackClones(ref.fNonFlowNumberOfTrackClones),\r
- fV1(ref.fV1),\r
- fV2(ref.fV2),\r
- fV3(ref.fV3),\r
- fV4(ref.fV4),\r
- fV5(ref.fV5),\r
- fMaxNumberOfIterations(ref.fMaxNumberOfIterations),\r
- fPrecisionPhi(ref.fPrecisionPhi),\r
- fUseMCReactionPlane(ref.fUseMCReactionPlane),\r
- fSP(ref.fSP),\r
- fMCPID(ref.fMCPID),\r
- fNoPID(ref.fNoPID),\r
- fChi2OverNDFCut(ref.fChi2OverNDFCut),\r
- fMaxdca(ref.fMaxdca),\r
- fMaxopeningtheta(ref.fMaxopeningtheta),\r
- fMaxopeningphi(ref.fMaxopeningphi),\r
- fMaxopening3D(ref.fMaxopening3D),\r
- fMaxInvmass(ref.fMaxInvmass),\r
- fSetMassConstraint(ref.fSetMassConstraint),\r
- fMonitorEventPlane(ref.fMonitorEventPlane),\r
- fMonitorContamination(ref.fMonitorContamination),\r
- fMonitorPhotonic(ref.fMonitorPhotonic),\r
- fMonitorWithoutPID(ref.fMonitorWithoutPID),\r
- fMonitorTrackCuts(ref.fMonitorTrackCuts),\r
- fMonitorQCumulant(ref.fMonitorQCumulant),\r
- fcutsRP(NULL),\r
- fcutsPOI(NULL),\r
- fHFECuts(NULL),\r
- fPID(NULL),\r
- fPIDTOFOnly(NULL),\r
- fPIDqa(NULL),\r
- fflowEvent(NULL),\r
- fHFEBackgroundCuts(NULL),\r
- fPIDBackground(NULL),\r
- fPIDBackgroundqa(NULL),\r
- fAlgorithmMA(ref.fAlgorithmMA),\r
- fArraytrack(NULL),\r
- fCounterPoolBackground(ref.fCounterPoolBackground),\r
- fHFEVZEROEventPlane(NULL),\r
- fHistEV(NULL),\r
- fHistPileUp(NULL),\r
- fPileUpCut(kFALSE),\r
- fEventPlane(NULL),\r
- fEventPlaneaftersubtraction(NULL),\r
- fFractionContamination(NULL),\r
- fContaminationv2(NULL),\r
- fCosSin2phiep(NULL),\r
- fCos2phie(NULL),\r
- fSin2phie(NULL),\r
- fCos2phiep(NULL),\r
- fSin2phiep(NULL),\r
- fSin2phiephiep(NULL),\r
- fCosResabc(NULL),\r
- fSinResabc(NULL),\r
- fProfileCosResab(NULL),\r
- fProfileCosResac(NULL),\r
- fProfileCosResbc(NULL),\r
- fCosRes(NULL),\r
- fSinRes(NULL),\r
- fProfileCosRes(NULL),\r
- fTrackingCuts(NULL),\r
- fDeltaPhiMapsBeforePID(NULL),\r
- fCosPhiMapsBeforePID(NULL),\r
- fDeltaPhiMaps(NULL),\r
- fDeltaPhiMapsContamination(NULL),\r
- fCosPhiMaps(NULL),\r
- fProfileCosPhiMaps(NULL),\r
- fDeltaPhiMapsTaggedPhotonic(NULL),\r
- //fCosPhiMapsTaggedPhotonic(NULL),\r
- fDeltaPhiMapsTaggedNonPhotonic(NULL),\r
- //fCosPhiMapsTaggedNonPhotonic(NULL),\r
- fDeltaPhiMapsTaggedPhotonicLS(NULL),\r
- //fCosPhiMapsTaggedPhotonicLS(NULL),\r
- fMCSourceDeltaPhiMaps(NULL),\r
- fOppSignDeltaPhiMaps(NULL),\r
- fSameSignDeltaPhiMaps(NULL),\r
- fOppSignAngle(NULL),\r
- fSameSignAngle(NULL),\r
- fDebugStreamer(0)\r
-{\r
- //\r
- // Copy Constructor\r
- //\r
-\r
- for(Int_t k = 0; k < 10; k++) {\r
- fBinCentralityLess[k] = 0.0;\r
- }\r
- for(Int_t k = 0; k < 11; k++) {\r
- fContamination[k] = NULL;\r
- fv2contamination[k] = NULL;\r
- }\r
- \r
-\r
- ref.Copy(*this);\r
-}\r
-\r
-//____________________________________________________________\r
-AliAnalysisTaskFlowTPCTOFEPSP &AliAnalysisTaskFlowTPCTOFEPSP::operator=(const AliAnalysisTaskFlowTPCTOFEPSP &ref){\r
- //\r
- // Assignment operator\r
- //\r
- if(this == &ref) \r
- ref.Copy(*this);\r
- return *this;\r
-}\r
-\r
-//____________________________________________________________\r
-void AliAnalysisTaskFlowTPCTOFEPSP::Copy(TObject &o) const {\r
- // \r
- // Copy into object o\r
- //\r
- AliAnalysisTaskFlowTPCTOFEPSP &target = dynamic_cast<AliAnalysisTaskFlowTPCTOFEPSP &>(o);\r
- target.fListHist = fListHist;\r
- target.fAODAnalysis = fAODAnalysis;\r
- target.fFilter = fFilter;\r
- target.fAODMCHeader = fAODMCHeader;\r
- target.fAODArrayMCInfo = fAODArrayMCInfo;\r
- target.fBackgroundSubtraction = fBackgroundSubtraction;\r
- target.fVZEROEventPlane = fVZEROEventPlane;\r
- target.fVZEROEventPlaneA = fVZEROEventPlaneA;\r
- target.fVZEROEventPlaneC = fVZEROEventPlaneC;\r
- target.fSubEtaGapTPC = fSubEtaGapTPC;\r
- target.fEtaGap = fEtaGap;\r
- target.fNbBinsCentralityQCumulant = fNbBinsCentralityQCumulant;\r
- target.fNbBinsPtQCumulant = fNbBinsPtQCumulant;\r
- target.fMinPtQCumulant = fMinPtQCumulant;\r
- target.fMaxPtQCumulant = fMaxPtQCumulant;\r
- target.fAfterBurnerOn = fAfterBurnerOn;\r
- target.fNonFlowNumberOfTrackClones = fNonFlowNumberOfTrackClones;\r
- target.fV1 = fV1;\r
- target.fV2 = fV2;\r
- target.fV3 = fV3;\r
- target.fV4 = fV4;\r
- target.fV5 = fV5;\r
- target.fMaxNumberOfIterations = fMaxNumberOfIterations;\r
- target.fPrecisionPhi = fPrecisionPhi;\r
- target.fUseMCReactionPlane = fUseMCReactionPlane;\r
- target.fSP = fSP;\r
- target.fMCPID = fMCPID;\r
- target.fNoPID = fNoPID;\r
- target.fChi2OverNDFCut = fChi2OverNDFCut;\r
- target.fMaxdca = fMaxdca;\r
- target.fMaxopeningtheta = fMaxopeningtheta;\r
- target.fMaxopeningphi = fMaxopeningphi;\r
- target.fMaxopening3D = fMaxopening3D;\r
- target.fMaxInvmass = fMaxInvmass;\r
- target.fSetMassConstraint = fSetMassConstraint;\r
- target.fMonitorEventPlane = fMonitorEventPlane;\r
- target.fMonitorContamination = fMonitorContamination;\r
- target.fMonitorPhotonic = fMonitorPhotonic;\r
- target.fMonitorWithoutPID = fMonitorWithoutPID;\r
- target.fMonitorTrackCuts = fMonitorTrackCuts;\r
- target.fMonitorQCumulant = fMonitorQCumulant;\r
- target.fcutsRP = fcutsRP;\r
- target.fcutsPOI = fcutsPOI;\r
- target.fHFECuts = fHFECuts;\r
- target.fPID = fPID;\r
- target.fPIDTOFOnly = fPIDTOFOnly;\r
- target.fPIDqa = fPIDqa;\r
- target.fflowEvent = fflowEvent;\r
- target.fHFEBackgroundCuts = fHFEBackgroundCuts; \r
- target.fPIDBackground = fPIDBackground; \r
- target.fPIDBackgroundqa = fPIDBackgroundqa; \r
- target.fAlgorithmMA = fAlgorithmMA; \r
- target.fArraytrack = fArraytrack; \r
- target.fCounterPoolBackground = fCounterPoolBackground; \r
- target.fHFEVZEROEventPlane = fHFEVZEROEventPlane; \r
- target.fHistEV=fHistEV; \r
- target.fHistPileUp=fHistPileUp; \r
- target.fPileUpCut=fPileUpCut; \r
- target.fEventPlane=fEventPlane; \r
- target.fEventPlaneaftersubtraction=fEventPlaneaftersubtraction; \r
- target.fFractionContamination=fFractionContamination; \r
- target.fContaminationv2=fContaminationv2; \r
- target.fCosSin2phiep=fCosSin2phiep; \r
- target.fCos2phie=fCos2phie; \r
- target.fSin2phie=fSin2phie; \r
- target.fCos2phiep=fCos2phiep; \r
- target.fSin2phiep=fSin2phiep; \r
- target.fSin2phiephiep=fSin2phiephiep; \r
- target.fCosResabc=fCosResabc; \r
- target.fSinResabc=fSinResabc; \r
- target.fProfileCosResab=fProfileCosResab; \r
- target.fProfileCosResac=fProfileCosResac; \r
- target.fProfileCosResbc=fProfileCosResbc; \r
- target.fCosRes=fCosRes; \r
- target.fSinRes=fSinRes; \r
- target.fProfileCosRes=fProfileCosRes; \r
- target.fTrackingCuts=fTrackingCuts; \r
- target.fDeltaPhiMapsBeforePID=fDeltaPhiMapsBeforePID; \r
- target.fCosPhiMapsBeforePID=fCosPhiMapsBeforePID; \r
- target.fDeltaPhiMaps=fDeltaPhiMaps; \r
- target.fDeltaPhiMapsContamination=fDeltaPhiMapsContamination; \r
- target.fCosPhiMaps=fCosPhiMaps; \r
- target.fProfileCosPhiMaps=fProfileCosPhiMaps; \r
- target.fDeltaPhiMapsTaggedPhotonic=fDeltaPhiMapsTaggedPhotonic; \r
- target.fDeltaPhiMapsTaggedNonPhotonic=fDeltaPhiMapsTaggedNonPhotonic; \r
- target.fDeltaPhiMapsTaggedPhotonicLS=fDeltaPhiMapsTaggedPhotonicLS; \r
- target.fMCSourceDeltaPhiMaps=fMCSourceDeltaPhiMaps; \r
- target.fOppSignDeltaPhiMaps=fOppSignDeltaPhiMaps; \r
- target.fSameSignDeltaPhiMaps=fSameSignDeltaPhiMaps; \r
- target.fOppSignAngle=fOppSignAngle; \r
- target.fSameSignAngle=fSameSignAngle; \r
- \r
- \r
- for(Int_t k = 0; k < 10; k++) {\r
- target.fBinCentralityLess[k] = fBinCentralityLess[k];\r
- }\r
- for(Int_t k = 0; k < 11; k++) {\r
- target.fContamination[k] = fContamination[k];\r
- target.fv2contamination[k] = fv2contamination[k];\r
- }\r
- target.fDebugStreamer=fDebugStreamer;\r
-}\r
-//____________________________________________________________\r
-AliAnalysisTaskFlowTPCTOFEPSP::~AliAnalysisTaskFlowTPCTOFEPSP(){\r
- //\r
- // Destructor\r
- //\r
- \r
-\r
- if(fArraytrack) delete fArraytrack;\r
- if(fListHist) delete fListHist;\r
- if(fcutsRP) delete fcutsRP;\r
- if(fcutsPOI) delete fcutsPOI;\r
- if(fHFECuts) delete fHFECuts;\r
- if(fPID) delete fPID;\r
- if(fPIDTOFOnly) delete fPIDTOFOnly;\r
- //if(fPIDqa) delete fPIDqa;\r
- if(fflowEvent) delete fflowEvent;\r
- if(fHFEBackgroundCuts) delete fHFEBackgroundCuts;\r
- if(fPIDBackground) delete fPIDBackground;\r
- //if(fBackgroundSubtraction) delete fBackgroundSubtraction;\r
- //if(fPIDBackgroundqa) delete fPIDBackgroundqa;\r
- //if(fHFEVZEROEventPlane) delete fHFEVZEROEventPlane;\r
- if ( fDebugStreamer ) delete fDebugStreamer;\r
- \r
-\r
-}\r
-//________________________________________________________________________\r
-void AliAnalysisTaskFlowTPCTOFEPSP::UserCreateOutputObjects()\r
-{\r
-\r
- //********************\r
- // Create histograms\r
- //********************\r
-\r
- //**************\r
- // Cuts\r
- //**************\r
-\r
- //---------Data selection----------\r
- //kMC, kGlobal, kTPCstandalone, kSPDtracklet, kPMD\r
- //AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;\r
- //AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kGlobal;\r
-\r
- //---------Parameter mixing--------\r
- //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt\r
- //AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;\r
- //AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: User create output objects");\r
-\r
-\r
- // AOD or ESD\r
- AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());\r
- if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){\r
- SetAODAnalysis(kTRUE);\r
- AliDebug(2,"Put AOD analysis on");\r
- } else {\r
- SetAODAnalysis(kFALSE);\r
- }\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: AOD ESD");\r
-\r
- // RP TRACK CUTS:\r
- fcutsRP = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010();\r
- fcutsRP->SetName("StandartTPC");\r
- fcutsRP->SetEtaRange(-0.9,0.9);\r
- fcutsRP->SetQA(kTRUE);\r
- //TList *qaCutsRP = fcutsRP->GetQA();\r
- //qaCutsRP->SetName("QA_StandartTPC_RP");\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cutsRP");\r
-\r
- //POI TRACK CUTS:\r
- fcutsPOI = new AliFlowTrackCuts("dummy");\r
- fcutsPOI->SetParamType(AliFlowTrackCuts::kGlobal);\r
- fcutsPOI->SetPtRange(+1,-1); // select nothing QUICK\r
- fcutsPOI->SetEtaRange(+1,-1); // select nothing VZERO\r
-\r
- if( fflowEvent ){ \r
- fflowEvent->~AliFlowEvent();\r
- new(fflowEvent) AliFlowEvent(fcutsRP,fcutsPOI);\r
- }\r
- else fflowEvent = new AliFlowEvent(fcutsRP,fcutsPOI);\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cutsPOI");\r
-\r
- // Flow\r
- AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();\r
- cc->SetNbinsMult(10000);\r
- cc->SetMultMin(0);\r
- cc->SetMultMax(10000.);\r
- cc->SetNbinsPt(fNbBinsPtQCumulant);\r
- cc->SetPtMin(fMinPtQCumulant);\r
- cc->SetPtMax(fMaxPtQCumulant);\r
- cc->SetNbinsPhi(180);\r
- cc->SetPhiMin(0.0);\r
- cc->SetPhiMax(TMath::TwoPi());\r
- cc->SetNbinsEta(200);\r
- cc->SetEtaMin(-0.9);\r
- cc->SetEtaMax(+0.9);\r
- cc->SetNbinsQ(500);\r
- cc->SetQMin(0.0);\r
- cc->SetQMax(3.0);\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: common constants");\r
-\r
- // HFE cuts\r
-\r
- if(!fHFECuts){\r
- fHFECuts = new AliHFEcuts;\r
- fHFECuts->CreateStandardCuts();\r
- }\r
- fHFECuts->Initialize();\r
- if(fAODAnalysis) fHFECuts->SetAOD(); \r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: HFE cuts");\r
-\r
-\r
- // PID HFE\r
- //fPID->SetHasMCData(HasMCData());\r
- if(!fPID) {\r
- fPID =new AliHFEpid("hfePid");\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid init 0");\r
- }\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid init 1");\r
- if(!fPID->GetNumberOfPIDdetectors()) fPID->AddDetector("TPC", 0);\r
- AliDebug(2,Form("AliAnalysisTaskFlowTPCTOFEPSP: GetNumber of PID detectors %d",fPID->GetNumberOfPIDdetectors()));\r
- fPID->InitializePID();\r
- fPIDqa->Initialize(fPID);\r
- fPID->SortDetectors();\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid and pidqa");\r
-\r
- if(!fPIDTOFOnly->GetNumberOfPIDdetectors()) {\r
- fPIDTOFOnly->AddDetector("TOF", 0);\r
- fPIDTOFOnly->ConfigureTOF(3.);\r
- }\r
- fPIDTOFOnly->InitializePID();\r
- fPIDTOFOnly->SortDetectors();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pidtof");\r
-\r
- // HFE Background cuts\r
-\r
- if(!fHFEBackgroundCuts){\r
- fHFEBackgroundCuts = new AliESDtrackCuts();\r
- fHFEBackgroundCuts->SetName("nackgroundcuts");\r
- //Configure Default Track Cuts\r
- fHFEBackgroundCuts->SetAcceptKinkDaughters(kFALSE);\r
- fHFEBackgroundCuts->SetRequireTPCRefit(kTRUE);\r
- fHFEBackgroundCuts->SetEtaRange(-0.9,0.9);\r
- fHFEBackgroundCuts->SetRequireSigmaToVertex(kTRUE);\r
- fHFEBackgroundCuts->SetMaxChi2PerClusterTPC(4.0);\r
- fHFEBackgroundCuts->SetMinNClustersTPC(50);\r
- fHFEBackgroundCuts->SetPtRange(0.3,1e10);\r
- }\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: hfe background");\r
-\r
- // PID background HFE\r
- if(!fPIDBackground->GetNumberOfPIDdetectors()) fPIDBackground->AddDetector("TPC", 0);\r
- fPIDBackground->InitializePID();\r
- fPIDBackgroundqa->Initialize(fPIDBackground);\r
- fPIDBackground->SortDetectors();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid background");\r
-\r
- if (fMonitorPhotonic) {\r
- if(!fBackgroundSubtraction) fBackgroundSubtraction = new AliHFENonPhotonicElectron();\r
- if(fAODAnalysis) fBackgroundSubtraction->SetAOD(kTRUE); \r
- fBackgroundSubtraction->Init();\r
- }\r
- \r
-\r
-\r
- //**************************\r
- // Bins for the THnSparse\r
- //**************************\r
-\r
- /*\r
- Int_t nBinsPt = 44;\r
- Double_t minPt = 0.1;\r
- Double_t maxPt = 20.0;\r
- Double_t binLimLogPt[nBinsPt+1];\r
- Double_t binLimPt[nBinsPt+1];\r
- for(Int_t i=0; i<=nBinsPt; i++) binLimLogPt[i]=(Double_t)TMath::Log10(minPt) + (TMath::Log10(maxPt)-TMath::Log10(minPt))/nBinsPt*(Double_t)i ;\r
- for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);\r
- */\r
-\r
- Int_t nBinsPt = 20;\r
- Double_t binLimPt[21] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2,\r
- 1.3, 1.4, 1.5, 2., 2.5, 3., 4., 6.};\r
-\r
- Int_t nBinsPtPlus = fNbBinsPtQCumulant;\r
- Double_t minPtPlus = fMinPtQCumulant;\r
- Double_t maxPtPlus = fMaxPtQCumulant;\r
- Double_t binLimPtPlus[nBinsPtPlus+1];\r
- for(Int_t i=0; i<=nBinsPtPlus; i++) binLimPtPlus[i]=(Double_t)minPtPlus + (maxPtPlus-minPtPlus)/nBinsPtPlus*(Double_t)i ;\r
-\r
- Int_t nBinsEta = 8;\r
- Double_t minEta = -0.8;\r
- Double_t maxEta = 0.8;\r
- Double_t binLimEta[nBinsEta+1];\r
- for(Int_t i=0; i<=nBinsEta; i++) binLimEta[i]=(Double_t)minEta + (maxEta-minEta)/nBinsEta*(Double_t)i ;\r
-\r
- Int_t nBinsStep = 6;\r
- Double_t minStep = 0.;\r
- Double_t maxStep = 6.;\r
- Double_t binLimStep[nBinsStep+1];\r
- for(Int_t i=0; i<=nBinsStep; i++) binLimStep[i]=(Double_t)minStep + (maxStep-minStep)/nBinsStep*(Double_t)i ;\r
-\r
- Int_t nBinsEtaLess = 2;\r
- Double_t binLimEtaLess[nBinsEtaLess+1];\r
- for(Int_t i=0; i<=nBinsEtaLess; i++) binLimEtaLess[i]=(Double_t)minEta + (maxEta-minEta)/nBinsEtaLess*(Double_t)i ;\r
- \r
- Int_t nBinsCos = 50;\r
- Double_t minCos = -1.0;\r
- Double_t maxCos = 1.0;\r
- Double_t binLimCos[nBinsCos+1];\r
- for(Int_t i=0; i<=nBinsCos; i++) binLimCos[i]=(Double_t)minCos + (maxCos-minCos)/nBinsCos*(Double_t)i ;\r
-\r
- // Int_t nBinsCosSP = 50;\r
- // Double_t minCosSP = -100.0;\r
- // Double_t maxCosSP = 100.0;\r
- // Double_t binLimCosSP[nBinsCosSP+1];\r
- // for(Int_t i=0; i<=nBinsCosSP; i++) binLimCosSP[i]=(Double_t)minCosSP + (maxCosSP-minCosSP)/nBinsCosSP*(Double_t)i ;\r
- \r
- Int_t nBinsC = 11;\r
- Double_t minC = 0.0;\r
- Double_t maxC = 11.0;\r
- Double_t binLimC[nBinsC+1];\r
- for(Int_t i=0; i<=nBinsC; i++) binLimC[i]=(Double_t)minC + (maxC-minC)/nBinsC*(Double_t)i ;\r
-\r
- Int_t nBinsCMore = 20;\r
- Double_t minCMore = 0.0;\r
- Double_t maxCMore = 20.0;\r
- Double_t binLimCMore[nBinsCMore+1];\r
- for(Int_t i=0; i<=nBinsCMore; i++) binLimCMore[i]=(Double_t)minCMore + (maxCMore-minCMore)/nBinsCMore*(Double_t)i ;\r
-\r
- Int_t nBinsCEvenMore = 100;\r
- Double_t minCEvenMore = 0.0;\r
- Double_t maxCEvenMore = 100.0;\r
- Double_t binLimCEvenMore[nBinsCEvenMore+1];\r
- for(Int_t i=0; i<=nBinsCEvenMore; i++) binLimCEvenMore[i]=(Double_t)minCEvenMore + (maxCEvenMore-minCEvenMore)/nBinsCEvenMore*(Double_t)i ;\r
-\r
- Int_t nBinsPhi = 8;\r
- Double_t minPhi = 0.0;\r
- Double_t maxPhi = TMath::Pi();\r
- Double_t binLimPhi[nBinsPhi+1];\r
- for(Int_t i=0; i<=nBinsPhi; i++) {\r
- binLimPhi[i]=(Double_t)minPhi + (maxPhi-minPhi)/nBinsPhi*(Double_t)i ;\r
- AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));\r
- }\r
-\r
- Int_t nBinsPhiLess = 2.0;\r
- Double_t minPhiLess = 0.0;\r
- Double_t maxPhiLess = 2.0;\r
- Double_t binLimPhiLess[nBinsPhiLess+1];\r
- for(Int_t i=0; i<=nBinsPhiLess; i++) {\r
- binLimPhiLess[i]=(Double_t)minPhiLess + (maxPhiLess-minPhiLess)/nBinsPhiLess*(Double_t)i ;\r
- }\r
-\r
- Int_t nBinsTPCdEdx = 140;\r
- Double_t minTPCdEdx = -12.0;\r
- Double_t maxTPCdEdx = 12.0;\r
- Double_t binLimTPCdEdx[nBinsTPCdEdx+1];\r
- for(Int_t i=0; i<=nBinsTPCdEdx; i++) {\r
- binLimTPCdEdx[i]=(Double_t)minTPCdEdx + (maxTPCdEdx-minTPCdEdx)/nBinsTPCdEdx*(Double_t)i ;\r
- }\r
-\r
- Int_t nBinsAngle = 40;\r
- Double_t minAngle = 0.0;\r
- Double_t maxAngle = 1.0;\r
- Double_t binLimAngle[nBinsAngle+1];\r
- for(Int_t i=0; i<=nBinsAngle; i++) {\r
- binLimAngle[i]=(Double_t)minAngle + (maxAngle-minAngle)/nBinsAngle*(Double_t)i ;\r
- AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));\r
- }\r
-\r
- Int_t nBinsCharge = 2;\r
- Double_t minCharge = -1.0;\r
- Double_t maxCharge = 1.0;\r
- Double_t binLimCharge[nBinsCharge+1];\r
- for(Int_t i=0; i<=nBinsCharge; i++) binLimCharge[i]=(Double_t)minCharge + (maxCharge-minCharge)/nBinsCharge*(Double_t)i ;\r
-\r
- Int_t nBinsSource = 10;\r
- Double_t minSource = 0.;\r
- Double_t maxSource = 10.;\r
- Double_t binLimSource[nBinsSource+1];\r
- for(Int_t i=0; i<=nBinsSource; i++) binLimSource[i]=(Double_t)minSource + (maxSource-minSource)/nBinsSource*(Double_t)i ;\r
-\r
- Int_t nBinsInvMass = 50;\r
- Double_t minInvMass = 0.;\r
- Double_t maxInvMass = 0.3;\r
- Double_t binLimInvMass[nBinsInvMass+1];\r
- for(Int_t i=0; i<=nBinsInvMass; i++) binLimInvMass[i]=(Double_t)minInvMass + (maxInvMass-minInvMass)/nBinsInvMass*(Double_t)i ;\r
-\r
- Int_t nBinsMult = 100;\r
- Double_t minMult = 0.;\r
- Double_t maxMult = 3000;\r
- Double_t binLimMult[nBinsMult+1];\r
- //for(Int_t i=0; i<=nBinsMult; i++) binLimMult[i]=TMath::Power((Double_t)minMult + (TMath::Sqrt(maxMult)-TMath::Sqrt(minMult))/nBinsMult*(Double_t)i,2);\r
- for(Int_t i=0; i<=nBinsMult; i++) binLimMult[i]=(Double_t)minMult + (maxMult-minMult)/nBinsMult*(Double_t)i;\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: variables");\r
- \r
- //******************\r
- // Histograms\r
- //******************\r
- \r
- fListHist = new TList();\r
- fListHist->SetOwner();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: list");\r
-\r
- // Minimum histos\r
-\r
- // Histos\r
- fHistEV = new TH2D("fHistEV", "events", 3, 0, 3, 3, 0,3);\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: histev");\r
-\r
- // V0 multiplicity vs # of tracks vs centraliy\r
- const Int_t nDimPU=4;\r
- Int_t nBinPU[nDimPU] = {nBinsCEvenMore,nBinsCEvenMore,nBinsMult,nBinsMult};\r
- fHistPileUp = new THnSparseF("PileUp","PileUp",nDimPU,nBinPU);\r
- fHistPileUp->SetBinEdges(0,binLimCEvenMore);\r
- fHistPileUp->SetBinEdges(1,binLimCEvenMore);\r
- fHistPileUp->SetBinEdges(2,binLimMult);\r
- fHistPileUp->SetBinEdges(3,binLimMult);\r
- fHistPileUp->Sumw2();\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: eventplane");\r
- \r
- // Event plane as function of phiep, centrality\r
- const Int_t nDima=4;\r
- Int_t nBina[nDima] = {nBinsPhi,nBinsPhi,nBinsPhi,nBinsC};\r
- fEventPlane = new THnSparseF("EventPlane","EventPlane",nDima,nBina);\r
- fEventPlane->SetBinEdges(0,binLimPhi);\r
- fEventPlane->SetBinEdges(1,binLimPhi);\r
- fEventPlane->SetBinEdges(2,binLimPhi);\r
- fEventPlane->SetBinEdges(3,binLimC);\r
- fEventPlane->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: eventplane");\r
-\r
- // Fraction of contamination, centrality\r
- const Int_t nDimcont=2;\r
- Int_t nBincont[nDimcont] = {nBinsPt,nBinsC};\r
- fFractionContamination = new THnSparseF("Contamination","Contamination",nDimcont,nBincont);\r
- fFractionContamination->SetBinEdges(0,binLimPt);\r
- fFractionContamination->SetBinEdges(1,binLimC);\r
- fFractionContamination->Sumw2();\r
- // \r
- fContaminationv2 = new TProfile2D("Contaminationv2","",nBinsC,binLimC,nBinsPt,binLimPt);\r
- fContaminationv2->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: fraction of contamination");\r
-\r
- // Resolution cosres_abc centrality\r
- const Int_t nDimfbis=4;\r
- Int_t nBinfbis[nDimfbis] = {nBinsCos,nBinsCos,nBinsCos,nBinsCMore};\r
- fCosResabc = new THnSparseF("CosRes_abc","CosRes_abc",nDimfbis,nBinfbis);\r
- fCosResabc->SetBinEdges(0,binLimCos);\r
- fCosResabc->SetBinEdges(1,binLimCos);\r
- fCosResabc->SetBinEdges(2,binLimCos);\r
- fCosResabc->SetBinEdges(3,binLimCMore);\r
- fCosResabc->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosresabc");\r
-\r
- // Resolution cosres centrality\r
- const Int_t nDimf=2;\r
- Int_t nBinf[nDimf] = {nBinsCos, nBinsCMore};\r
- fCosRes = new THnSparseF("CosRes","CosRes",nDimf,nBinf);\r
- fCosRes->SetBinEdges(0,binLimCos);\r
- fCosRes->SetBinEdges(1,binLimCMore);\r
- fCosRes->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosres");\r
-\r
- // Maps delta phi\r
- const Int_t nDimg=5;\r
- Int_t nBing[nDimg] = {nBinsPhi,nBinsC,nBinsPt, nBinsCharge,nBinsEtaLess};\r
- fDeltaPhiMaps = new THnSparseF("DeltaPhiMaps","DeltaPhiMaps",nDimg,nBing);\r
- fDeltaPhiMaps->SetBinEdges(0,binLimPhi);\r
- fDeltaPhiMaps->SetBinEdges(1,binLimC);\r
- fDeltaPhiMaps->SetBinEdges(2,binLimPt);\r
- fDeltaPhiMaps->SetBinEdges(3,binLimCharge);\r
- fDeltaPhiMaps->SetBinEdges(4,binLimEtaLess);\r
- fDeltaPhiMaps->Sumw2(); \r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimaps");\r
-\r
- // Maps cos phi\r
- const Int_t nDimh=5;\r
- Int_t nBinh[nDimh] = {nBinsCos,nBinsC,nBinsPt,nBinsCharge,nBinsEtaLess};\r
- fCosPhiMaps = new THnSparseF("CosPhiMaps","CosPhiMaps",nDimh,nBinh);\r
- fCosPhiMaps->SetBinEdges(0,binLimCos);\r
- fCosPhiMaps->SetBinEdges(1,binLimC);\r
- fCosPhiMaps->SetBinEdges(2,binLimPt);\r
- fCosPhiMaps->SetBinEdges(3,binLimCharge);\r
- fCosPhiMaps->SetBinEdges(4,binLimEtaLess);\r
- fCosPhiMaps->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosphimaps");\r
-\r
- //\r
- // fMonitorEventPlane\r
- //\r
- //\r
-\r
- if(fMonitorEventPlane) { \r
- // Event Plane after subtraction as function of phiep, centrality, pt, eta\r
- const Int_t nDimb=2;\r
- Int_t nBinb[nDimb] = {nBinsPhi, nBinsC};\r
- fEventPlaneaftersubtraction = new THnSparseF("EventPlane_aftersubtraction","EventPlane_aftersubtraction",nDimb,nBinb);\r
- fEventPlaneaftersubtraction->SetBinEdges(0,binLimPhi);\r
- fEventPlaneaftersubtraction->SetBinEdges(1,binLimC);\r
- fEventPlaneaftersubtraction->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: eventplane after sub");\r
- \r
- // Monitoring of the event Plane cos(2phi) sin(2phi) centrality\r
- const Int_t nDimi=3;\r
- Int_t nBini[nDimi] = {nBinsCos, nBinsCos, nBinsCMore};\r
- fCosSin2phiep = new THnSparseF("CosSin2phiep","CosSin2phiep",nDimi,nBini);\r
- fCosSin2phiep->SetBinEdges(0,binLimCos);\r
- fCosSin2phiep->SetBinEdges(1,binLimCos);\r
- fCosSin2phiep->SetBinEdges(2,binLimCMore);\r
- fCosSin2phiep->Sumw2();\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cossin2phiep");\r
- \r
- // Monitoring Event plane after subtraction of the track\r
- const Int_t nDime=4;\r
- Int_t nBine[nDime] = {nBinsCos, nBinsC, nBinsPt, nBinsEta};\r
- fCos2phie = new THnSparseF("cos2phie","cos2phie",nDime,nBine);\r
- fCos2phie->SetBinEdges(2,binLimPt);\r
- fCos2phie->SetBinEdges(3,binLimEta);\r
- fCos2phie->SetBinEdges(0,binLimCos);\r
- fCos2phie->SetBinEdges(1,binLimC);\r
- fCos2phie->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cos2phie");\r
- fSin2phie = new THnSparseF("sin2phie","sin2phie",nDime,nBine);\r
- fSin2phie->SetBinEdges(2,binLimPt);\r
- fSin2phie->SetBinEdges(3,binLimEta);\r
- fSin2phie->SetBinEdges(0,binLimCos);\r
- fSin2phie->SetBinEdges(1,binLimC);\r
- fSin2phie->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sin2phie");\r
- fCos2phiep = new THnSparseF("cos2phiep","cos2phiep",nDime,nBine);\r
- fCos2phiep->SetBinEdges(2,binLimPt);\r
- fCos2phiep->SetBinEdges(3,binLimEta);\r
- fCos2phiep->SetBinEdges(0,binLimCos);\r
- fCos2phiep->SetBinEdges(1,binLimC);\r
- fCos2phiep->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cos2phiep");\r
- fSin2phiep = new THnSparseF("sin2phiep","sin2phiep",nDime,nBine);\r
- fSin2phiep->SetBinEdges(2,binLimPt);\r
- fSin2phiep->SetBinEdges(3,binLimEta);\r
- fSin2phiep->SetBinEdges(0,binLimCos);\r
- fSin2phiep->SetBinEdges(1,binLimC);\r
- fSin2phiep->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sin2phiep");\r
- fSin2phiephiep = new THnSparseF("sin2phie_phiep","sin2phie_phiep",nDime,nBine);\r
- fSin2phiephiep->SetBinEdges(2,binLimPt);\r
- fSin2phiephiep->SetBinEdges(3,binLimEta);\r
- fSin2phiephiep->SetBinEdges(0,binLimCos);\r
- fSin2phiephiep->SetBinEdges(1,binLimC);\r
- fSin2phiephiep->Sumw2(); \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sin2phiephiep");\r
- \r
- const Int_t nDimfbiss=4;\r
- Int_t nBinfbiss[nDimfbiss] = {nBinsCos,nBinsCos,nBinsCos,nBinsC};\r
- fSinResabc = new THnSparseF("SinRes_abc","SinRes_abc",nDimfbiss,nBinfbiss);\r
- fSinResabc->SetBinEdges(0,binLimCos);\r
- fSinResabc->SetBinEdges(1,binLimCos);\r
- fSinResabc->SetBinEdges(2,binLimCos);\r
- fSinResabc->SetBinEdges(3,binLimC);\r
- fSinResabc->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sinresabc");\r
- \r
- // Profile cosres centrality with 3 subevents\r
- fProfileCosResab = new TProfile("ProfileCosRes_a_b","ProfileCosRes_a_b",nBinsCMore,binLimCMore);\r
- fProfileCosResab->Sumw2();\r
- fProfileCosResac = new TProfile("ProfileCosRes_a_c","ProfileCosRes_a_c",nBinsCMore,binLimCMore);\r
- fProfileCosResac->Sumw2();\r
- fProfileCosResbc = new TProfile("ProfileCosRes_b_c","ProfileCosRes_b_c",nBinsCMore,binLimCMore);\r
- fProfileCosResbc->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: profilecosresbc");\r
- \r
- //\r
- const Int_t nDimff=2;\r
- Int_t nBinff[nDimff] = {nBinsCos, nBinsC};\r
- fSinRes = new THnSparseF("SinRes","SinRes",nDimff,nBinff);\r
- fSinRes->SetBinEdges(0,binLimCos);\r
- fSinRes->SetBinEdges(1,binLimC);\r
- fSinRes->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sinres");\r
- \r
- // Profile cosres centrality\r
- fProfileCosRes = new TProfile("ProfileCosRes","ProfileCosRes",nBinsCMore,binLimCMore);\r
- fProfileCosRes->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: profilecosres");\r
- \r
- // Profile Maps cos phi\r
- fProfileCosPhiMaps = new TProfile2D("ProfileCosPhiMaps","ProfileCosPhiMaps",nBinsC,binLimC,nBinsPt,binLimPt);\r
- fProfileCosPhiMaps->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: profilecosphimaps");\r
-\r
- }\r
- //\r
- // fMonitorTrackCuts\r
- //\r
-\r
- if(fMonitorTrackCuts) {\r
- // Debugging tracking steps\r
- const Int_t nDimTrStep=2;\r
- Int_t nBinTrStep[nDimTrStep] = {nBinsPt,nBinsStep};\r
- fTrackingCuts = new THnSparseF("TrackingCuts","TrackingCuts",nDimTrStep,nBinTrStep);\r
- fTrackingCuts->SetBinEdges(0,binLimPt);\r
- fTrackingCuts->SetBinEdges(1,binLimStep);\r
- fTrackingCuts->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: trackingcuts");\r
- }\r
-\r
- //\r
- // fMonitorContamination\r
- //\r
-\r
- if(fMonitorContamination) { \r
- // Maps delta phi contamination\r
- const Int_t nDimgcont=4;\r
- Int_t nBingcont[nDimgcont] = {nBinsPhiLess,nBinsC,nBinsPt, nBinsTPCdEdx};\r
- fDeltaPhiMapsContamination = new THnSparseF("DeltaPhiMapsContamination","DeltaPhiMapsContamination",nDimgcont,nBingcont);\r
- fDeltaPhiMapsContamination->SetBinEdges(0,binLimPhiLess);\r
- fDeltaPhiMapsContamination->SetBinEdges(1,binLimC);\r
- fDeltaPhiMapsContamination->SetBinEdges(2,binLimPt);\r
- fDeltaPhiMapsContamination->SetBinEdges(3,binLimTPCdEdx);\r
- fDeltaPhiMapsContamination->Sumw2(); \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapscontamination");\r
-\r
- }\r
- //\r
- // fMonitorWithoutPID\r
- //\r
-\r
- if(fMonitorWithoutPID) {\r
- //\r
- const Int_t nDimgb=3;\r
- Int_t nBingb[nDimgb] = {nBinsPhi,nBinsC,nBinsPt};\r
- \r
- fDeltaPhiMapsBeforePID = new THnSparseF("DeltaPhiMapsBeforePID","DeltaPhiMapsBeforePID",nDimgb,nBingb);\r
- fDeltaPhiMapsBeforePID->SetBinEdges(0,binLimPhi);\r
- fDeltaPhiMapsBeforePID->SetBinEdges(1,binLimC);\r
- fDeltaPhiMapsBeforePID->SetBinEdges(2,binLimPt);\r
- fDeltaPhiMapsBeforePID->Sumw2(); \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapsbeforepid");\r
- \r
- const Int_t nDimhb=3;\r
- Int_t nBinhb[nDimhb] = {nBinsCos,nBinsC,nBinsPt};\r
- \r
- fCosPhiMapsBeforePID = new THnSparseF("CosPhiMapsBeforePID","CosPhiMapsBeforePID",nDimhb,nBinhb);\r
- fCosPhiMapsBeforePID->SetBinEdges(0,binLimCos);\r
- fCosPhiMapsBeforePID->SetBinEdges(1,binLimC);\r
- fCosPhiMapsBeforePID->SetBinEdges(2,binLimPt);\r
- fCosPhiMapsBeforePID->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosphimapsbeforepid");\r
- }\r
- //\r
- // fMonitorPhotonic\r
- //\r
-\r
- if(fMonitorPhotonic) {\r
- \r
- const Int_t nDimgbp=3;\r
- Int_t nBingbp[nDimgbp] = {nBinsPhi,nBinsC,nBinsPt};\r
- \r
- fDeltaPhiMapsTaggedPhotonic = new THnSparseF("DeltaPhiMapsTaggedPhotonic","DeltaPhiMapsTaggedPhotonic",nDimgbp,nBingbp);\r
- fDeltaPhiMapsTaggedPhotonic->SetBinEdges(0,binLimPhi);\r
- fDeltaPhiMapsTaggedPhotonic->SetBinEdges(1,binLimC);\r
- fDeltaPhiMapsTaggedPhotonic->SetBinEdges(2,binLimPt);\r
- fDeltaPhiMapsTaggedPhotonic->Sumw2(); \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapstaggedphotonic");\r
- \r
- fDeltaPhiMapsTaggedNonPhotonic = new THnSparseF("DeltaPhiMapsTaggedNonPhotonic","DeltaPhiMapsTaggedNonPhotonic",nDimgbp,nBingbp);\r
- fDeltaPhiMapsTaggedNonPhotonic->SetBinEdges(0,binLimPhi);\r
- fDeltaPhiMapsTaggedNonPhotonic->SetBinEdges(1,binLimC);\r
- fDeltaPhiMapsTaggedNonPhotonic->SetBinEdges(2,binLimPt);\r
- fDeltaPhiMapsTaggedNonPhotonic->Sumw2(); \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapstaggednonphotonic");\r
- \r
- fDeltaPhiMapsTaggedPhotonicLS = new THnSparseF("DeltaPhiMapsTaggedPhotonicLS","DeltaPhiMapsTaggedPhotonicLS",nDimgbp,nBingbp);\r
- fDeltaPhiMapsTaggedPhotonicLS->SetBinEdges(0,binLimPhi);\r
- fDeltaPhiMapsTaggedPhotonicLS->SetBinEdges(1,binLimC);\r
- fDeltaPhiMapsTaggedPhotonicLS->SetBinEdges(2,binLimPt);\r
- fDeltaPhiMapsTaggedPhotonicLS->Sumw2(); \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapstaggedphotonicls"); \r
-\r
- const Int_t nDimMCSource=3;\r
- Int_t nBinMCSource[nDimMCSource] = {nBinsC,nBinsPt,nBinsSource};\r
- fMCSourceDeltaPhiMaps = new THnSparseF("MCSourceDeltaPhiMaps","MCSourceDeltaPhiMaps",nDimMCSource,nBinMCSource);\r
- fMCSourceDeltaPhiMaps->SetBinEdges(0,binLimC);\r
- fMCSourceDeltaPhiMaps->SetBinEdges(1,binLimPt);\r
- fMCSourceDeltaPhiMaps->SetBinEdges(2,binLimSource);\r
- fMCSourceDeltaPhiMaps->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: mcsourcedeltaphimaps");\r
- \r
- // Maps invmass opposite\r
- const Int_t nDimOppSign=5;\r
- Int_t nBinOppSign[nDimOppSign] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource};\r
- fOppSignDeltaPhiMaps = new THnSparseF("OppSignDeltaPhiMaps","OppSignDeltaPhiMaps",nDimOppSign,nBinOppSign);\r
- fOppSignDeltaPhiMaps->SetBinEdges(0,binLimPhi);\r
- fOppSignDeltaPhiMaps->SetBinEdges(1,binLimC);\r
- fOppSignDeltaPhiMaps->SetBinEdges(2,binLimPt);\r
- fOppSignDeltaPhiMaps->SetBinEdges(3,binLimInvMass);\r
- fOppSignDeltaPhiMaps->SetBinEdges(4,binLimSource);\r
- fOppSignDeltaPhiMaps->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: oppsigndeltaphimaps");\r
- \r
- // Maps invmass same sign\r
- const Int_t nDimSameSign=5;\r
- Int_t nBinSameSign[nDimSameSign] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource};\r
- fSameSignDeltaPhiMaps = new THnSparseF("SameSignDeltaPhiMaps","SameSignDeltaPhiMaps",nDimSameSign,nBinSameSign);\r
- fSameSignDeltaPhiMaps->SetBinEdges(0,binLimPhi);\r
- fSameSignDeltaPhiMaps->SetBinEdges(1,binLimC);\r
- fSameSignDeltaPhiMaps->SetBinEdges(2,binLimPt);\r
- fSameSignDeltaPhiMaps->SetBinEdges(3,binLimInvMass);\r
- fSameSignDeltaPhiMaps->SetBinEdges(4,binLimSource);\r
- fSameSignDeltaPhiMaps->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: samesigndeltaphimaps");\r
- \r
- // Maps angle same sign\r
- const Int_t nDimAngleSameSign=3;\r
- Int_t nBinAngleSameSign[nDimAngleSameSign] = {nBinsAngle,nBinsC,nBinsSource};\r
- fSameSignAngle = new THnSparseF("SameSignAngleMaps","SameSignAngleMaps",nDimAngleSameSign,nBinAngleSameSign);\r
- fSameSignAngle->SetBinEdges(0,binLimAngle);\r
- fSameSignAngle->SetBinEdges(1,binLimC);\r
- fSameSignAngle->SetBinEdges(2,binLimSource);\r
- fSameSignAngle->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: samesignangle");\r
- \r
- // Maps angle opp sign\r
- const Int_t nDimAngleOppSign=3;\r
- Int_t nBinAngleOppSign[nDimAngleOppSign] = {nBinsAngle,nBinsC,nBinsSource};\r
- fOppSignAngle = new THnSparseF("OppSignAngleMaps","OppSignAngleMaps",nDimAngleOppSign,nBinAngleOppSign);\r
- fOppSignAngle->SetBinEdges(0,binLimAngle);\r
- fOppSignAngle->SetBinEdges(1,binLimC);\r
- fOppSignAngle->SetBinEdges(2,binLimSource);\r
- fOppSignAngle->Sumw2();\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: oppsignangle");\r
-\r
- }\r
-\r
- //**************************\r
- // Add to the list\r
- //******************************\r
-\r
- fListHist->Add(fHistEV);\r
- fListHist->Add(fHistPileUp);\r
- fListHist->Add(fEventPlane);\r
- fListHist->Add(fFractionContamination);\r
- fListHist->Add(fCosRes);\r
- fListHist->Add(fCosResabc);\r
- fListHist->Add(fCosPhiMaps);\r
- fListHist->Add(fDeltaPhiMaps);\r
- fListHist->Add(fPIDqa->MakeList("HFEpidQA"));\r
- fListHist->Add(fContaminationv2);\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add default");\r
-\r
- if(fMonitorEventPlane) {\r
- fListHist->Add(fProfileCosRes);\r
- fListHist->Add(fProfileCosResab);\r
- fListHist->Add(fProfileCosResac);\r
- fListHist->Add(fProfileCosResbc);\r
- fListHist->Add(fCosSin2phiep);\r
- fListHist->Add(fCos2phie);\r
- fListHist->Add(fSin2phie);\r
- fListHist->Add(fCos2phiep);\r
- fListHist->Add(fSin2phiep);\r
- fListHist->Add(fSin2phiephiep);\r
- fListHist->Add(fSinRes);\r
- fListHist->Add(fSinResabc);\r
- fListHist->Add(fProfileCosPhiMaps);\r
- }\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add monitor");\r
-\r
- if(fMonitorTrackCuts) fListHist->Add(fTrackingCuts);\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add monitortrackcuts");\r
-\r
- if(fMonitorContamination) {\r
- fListHist->Add(fDeltaPhiMapsContamination);\r
- }\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add deltaphimapscontamination");\r
-\r
- if(fMonitorWithoutPID) {\r
- fListHist->Add(fDeltaPhiMapsBeforePID);\r
- fListHist->Add(fCosPhiMapsBeforePID);\r
- }\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add without pid");\r
-\r
- if(fMonitorPhotonic) {\r
- fListHist->Add(fPIDBackgroundqa->MakeList("HFEpidBackgroundQA"));\r
- fListHist->Add(fDeltaPhiMapsTaggedPhotonic);\r
- fListHist->Add(fDeltaPhiMapsTaggedNonPhotonic);\r
- fListHist->Add(fDeltaPhiMapsTaggedPhotonicLS);\r
- fListHist->Add(fMCSourceDeltaPhiMaps);\r
- fListHist->Add(fOppSignDeltaPhiMaps);\r
- fListHist->Add(fSameSignDeltaPhiMaps);\r
- fListHist->Add(fSameSignAngle);\r
- fListHist->Add(fOppSignAngle);\r
- fListHist->Add(fBackgroundSubtraction->GetListOutput());\r
- }\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add photonic");\r
-\r
- if(fHFEVZEROEventPlane && fMonitorEventPlane) fListHist->Add(fHFEVZEROEventPlane->GetOutputList());\r
- \r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add event plane");\r
-\r
- fListHist->Print();\r
-\r
- PostData(1, fListHist);\r
- //for(Int_t bincless = 0; bincless < fNbBinsCentralityQCumulant; bincless++) {\r
- // PostData(bincless+2,fflowEvent); \r
- //}\r
-\r
- AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: post");\r
-\r
-\r
-}\r
- \r
-//________________________________________________________________________\r
-void AliAnalysisTaskFlowTPCTOFEPSP::UserExec(Option_t */*option*/)\r
-{\r
- //\r
- // Loop over event\r
- //\r
- \r
- \r
- Double_t massElectron = 0.000511;\r
- Double_t mcReactionPlane = 0.0;\r
-\r
- Float_t cntr = 0.0;\r
- Double_t binct = 11.5;\r
- Double_t binctMore = 20.5;\r
- Double_t binctLess = -0.5;\r
- Float_t binctt = -1.0;\r
- \r
- Double_t valuecossinephiep[3];\r
- Double_t valuensparsea[4];\r
- Double_t valuensparseabis[5];\r
- Double_t valuensparsee[4];\r
- Double_t valuensparsef[2];\r
- Double_t valuensparsefsin[2];\r
- Double_t valuensparsefbis[4];\r
- Double_t valuensparsefbissin[4];\r
- Double_t valuensparseg[5];\r
- Double_t valuensparseh[5];\r
- Double_t valuensparsehprofile[3];\r
- Double_t valuensparseMCSourceDeltaPhiMaps[3];\r
- Double_t valuetrackingcuts[2];\r
- Double_t valuedeltaphicontamination[4];\r
- Double_t valuefractioncont[2];\r
- \r
- AliMCEvent *mcEvent = MCEvent();\r
- AliMCParticle *mctrack = NULL;\r
-\r
- // MC info\r
- Bool_t mcthere = kTRUE;\r
- if(fAODAnalysis) {\r
- AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent);\r
- if(!aodE){\r
- // printf("testd\n");\r
- AliError("No AOD Event");\r
- return;\r
- }\r
- fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName()));\r
- if(!fAODMCHeader){ \r
- mcthere = kFALSE;\r
- }\r
- fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));\r
- if(!fAODArrayMCInfo){ \r
- mcthere = kFALSE;\r
- }\r
- else {\r
- fHFECuts->SetMCEvent(aodE);\r
- if(fMonitorPhotonic) fBackgroundSubtraction->SetAODArrayMCInfo(fAODArrayMCInfo);\r
- }\r
- }\r
- else {\r
- AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());\r
- if(!mcH) mcthere = kFALSE;\r
- else {\r
- if(fMonitorPhotonic) fBackgroundSubtraction->SetMCEvent(fMCEvent);\r
- }\r
- }\r
-\r
- \r
- /////////////////\r
- // centrality\r
- /////////////////\r
- \r
- //AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());\r
- //if(!esd) return;\r
- AliCentrality *centrality = fInputEvent->GetCentrality();\r
- //AliDebug(2,"Got the centrality");\r
- if(!centrality) return;\r
- cntr = centrality->GetCentralityPercentile("V0M");\r
- if((0.0< cntr) && (cntr<5.0)) binct = 0.5;\r
- if((5.0< cntr) && (cntr<10.0)) binct = 1.5;\r
- if((10.0< cntr) && (cntr<20.0)) binct = 2.5;\r
- if((20.0< cntr) && (cntr<30.0)) binct = 3.5;\r
- if((30.0< cntr) && (cntr<40.0)) binct = 4.5;\r
- if((40.0< cntr) && (cntr<50.0)) binct = 5.5;\r
- if((50.0< cntr) && (cntr<60.0)) binct = 6.5;\r
- if((60.0< cntr) && (cntr<70.0)) binct = 7.5;\r
- if((70.0< cntr) && (cntr<80.0)) binct = 8.5;\r
- if((80.0< cntr) && (cntr<90.0)) binct = 9.5;\r
- if((90.0< cntr) && (cntr<100.0)) binct = 10.5;\r
- \r
- if((0.< cntr) && (cntr < 20.)) binctt = 0.5;\r
- if((20.< cntr) && (cntr < 40.)) binctt = 1.5;\r
- if((40.< cntr) && (cntr < 80.)) binctt = 2.5;\r
-\r
- if((0.0< cntr) && (cntr<5.0)) binctMore = 0.5;\r
- if((5.0< cntr) && (cntr<10.0)) binctMore = 1.5;\r
- if((10.0< cntr) && (cntr<15.0)) binctMore = 2.5;\r
- if((15.0< cntr) && (cntr<20.0)) binctMore = 3.5;\r
- if((20.0< cntr) && (cntr<25.0)) binctMore = 4.5;\r
- if((25.0< cntr) && (cntr<30.0)) binctMore = 5.5;\r
- if((30.0< cntr) && (cntr<35.0)) binctMore = 6.5;\r
- if((35.0< cntr) && (cntr<40.0)) binctMore = 7.5;\r
- if((40.0< cntr) && (cntr<45.0)) binctMore = 8.5;\r
- if((45.0< cntr) && (cntr<50.0)) binctMore = 9.5;\r
- if((50.0< cntr) && (cntr<55.0)) binctMore = 10.5;\r
- if((55.0< cntr) && (cntr<60.0)) binctMore = 11.5;\r
- if((60.0< cntr) && (cntr<65.0)) binctMore = 12.5;\r
- if((65.0< cntr) && (cntr<70.0)) binctMore = 13.5;\r
- if((70.0< cntr) && (cntr<75.0)) binctMore = 14.5;\r
- if((75.0< cntr) && (cntr<80.0)) binctMore = 15.5;\r
- if((80.0< cntr) && (cntr<85.0)) binctMore = 16.5;\r
- if((85.0< cntr) && (cntr<90.0)) binctMore = 17.5;\r
- if((90.0< cntr) && (cntr<95.0)) binctMore = 18.5;\r
- if((95.0< cntr) && (cntr<100.0)) binctMore = 19.5;\r
-\r
- binctLess = cntr;\r
- \r
- \r
- if(binct > 11.0) return;\r
- \r
- // centrality\r
- valuensparsea[3] = binct; \r
- valuensparseabis[1] = binct; \r
- valuensparsee[1] = binct; \r
- valuensparsef[1] = binctMore; \r
- valuensparsefsin[1] = binct; \r
- valuensparsefbis[3] = binctMore; \r
- valuensparsefbissin[3] = binct; \r
- valuensparseg[1] = binct;\r
- valuensparseh[1] = binct; \r
- valuefractioncont[1] = binct;\r
- valuensparsehprofile[1] = binct; \r
- valuecossinephiep[2] = binctMore;\r
- valuensparseMCSourceDeltaPhiMaps[0] = binct;\r
- valuedeltaphicontamination[1] = binct;\r
- \r
- //////////////////////\r
- // run number\r
- //////////////////////\r
-\r
- Int_t runnumber = fInputEvent->GetRunNumber();\r
- AliDebug(2,Form("Run number %d",runnumber));\r
- \r
- if(!fPID->IsInitialized()){\r
- // Initialize PID with the given run number\r
- fPID->InitializePID(runnumber);\r
- }\r
- if(!fPIDTOFOnly->IsInitialized()){\r
- // Initialize PID with the given run number\r
- fPIDTOFOnly->InitializePID(runnumber);\r
- }\r
-\r
- //\r
- if(!fPIDBackground->IsInitialized()){\r
- // Initialize PID with the given run number\r
- fPIDBackground->InitializePID(runnumber);\r
- }\r
-\r
- fHFECuts->SetRecEvent(fInputEvent);\r
- if(mcEvent) fHFECuts->SetMCEvent(mcEvent);\r
-\r
-\r
- //////////\r
- // PID\r
- //////////\r
- \r
- AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();\r
- if(!pidResponse){\r
- AliDebug(2,"No PID response set");\r
- return;\r
- }\r
- fPID->SetPIDResponse(pidResponse);\r
- fPIDTOFOnly->SetPIDResponse(pidResponse);\r
- fPIDBackground->SetPIDResponse(pidResponse);\r
- if(fMonitorPhotonic) fBackgroundSubtraction->InitRun(fInputEvent,pidResponse);\r
-\r
- fHistEV->Fill(binctt,0.0);\r
-\r
- //////////////////\r
- // Event cut\r
- //////////////////\r
- if(!fHFECuts->CheckEventCuts("fEvRecCuts", fInputEvent)) {\r
- AliDebug(2,"Does not pass the event cut");\r
- PostData(1, fListHist);\r
- return;\r
- }\r
-\r
- fHistEV->Fill(binctt,1.0);\r
-\r
-\r
- ///////////////////////////////////////////////////////////\r
- // PileUpCut\r
- ///////////////////////////////////////////////////////////\r
-\r
- Float_t multTPC(0.); // tpc mult estimate\r
- Float_t multGlob(0.); // global multiplicity\r
- const Int_t nGoodTracks = fInputEvent->GetNumberOfTracks();\r
- for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult\r
- AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(fInputEvent->GetTrack(iTracks));\r
- if (!trackAOD) continue;\r
- if (!(trackAOD->TestFilterBit(1))) continue;\r
- if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.2)) continue;\r
- multTPC++;\r
- }\r
- for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult\r
- AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(fInputEvent->GetTrack(iTracks));\r
- if (!trackAOD) continue;\r
- if (!(trackAOD->TestFilterBit(16))) continue;\r
- if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.1)) continue;\r
- Double_t b[2] = {-99., -99.};\r
- Double_t bCov[3] = {-99., -99., -99.};\r
- if (!(trackAOD->PropagateToDCA(fInputEvent->GetPrimaryVertex(), fInputEvent->GetMagneticField(), 100., b, bCov))) continue;\r
- if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;\r
- multGlob++;\r
- } //track loop\r
-\r
- Double_t pileup[4];\r
- pileup[0]=fInputEvent->GetCentrality()->GetCentralityPercentile("V0M");\r
- pileup[1]=fInputEvent->GetCentrality()->GetCentralityPercentile("TRK");\r
- pileup[2]=multTPC;\r
- pileup[3]=multGlob;\r
- fHistPileUp->Fill(pileup);\r
-\r
- if(fPileUpCut){\r
- if (TMath::Abs(pileup[0]-pileup[1]) > 5) {\r
- AliDebug(2,"Does not pass the centrality correlation cut");\r
- return;\r
- }\r
- if(multTPC < (-36.81+1.48*multGlob) && multTPC > (63.03+1.78*multGlob)){\r
- AliDebug(2,"Does not pass the multiplicity correlation cut");\r
- return;\r
- }\r
- }\r
- \r
- // AliVVZERO* vzeroData=fInputEvent->GetVZEROData();\r
- // Double_t mult[3],multV0A(0),multV0C(0);\r
- // for(Int_t i=0; i<32; ++i) {\r
- // multV0A += vzeroData->GetMultiplicityV0A(i);\r
- // multV0C += vzeroData->GetMultiplicityV0C(i);\r
- // }\r
-\r
- // int ntrk=0;\r
- // for(Int_t k = 0; k < fInputEvent->GetNumberOfTracks(); k++){\r
- // AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);\r
- // if(!track) continue;\r
- // if(!(track->GetStatus()&AliVTrack::kITSrefit)) continue;\r
- // if(!(track->GetStatus()&AliVTrack::kTPCrefit)) continue;\r
- // ntrk++;\r
- // }\r
- \r
- // mult[0]=fInputEvent->GetNumberOfTracks();\r
- // mult[1]=multV0A+multV0C;\r
- // mult[2]=binctMore;\r
- // fHistPileUp->Fill(mult);\r
-\r
- // if(fUpperPileUpCut&&fLowerPileUpCut){\r
- // if((mult[0]<fLowerPileUpCut->Eval(mult[1])) || \r
- // (mult[0]>fUpperPileUpCut->Eval(mult[1]))){\r
- // AliDebug(2,"Does not pass the pileup cut");\r
- // PostData(1, fListHist);\r
- // return;\r
- // }\r
- // }\r
-\r
- //////////////////////////////////// \r
- // First method event plane\r
- ////////////////////////////////////\r
-\r
- AliEventplane* vEPa = fInputEvent->GetEventplane();\r
- Float_t eventPlanea = 0.0;\r
- Float_t eventPlaneTPC = 0.0;\r
- Float_t eventPlaneV0A = 0.0;\r
- Float_t eventPlaneV0C = 0.0;\r
- Float_t eventPlaneV0 = 0.0;\r
- TVector2 *qTPC = 0x0;\r
- TVector2 *qsub1a = 0x0;\r
- TVector2 *qsub2a = 0x0;\r
- TVector2 qV0A,qV0C,qV0,*qAna;\r
- \r
- // V0\r
-\r
- if(fHFEVZEROEventPlane && (!fAODAnalysis)){\r
-\r
- //AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());\r
- //if(!esd) return;\r
- \r
- fHFEVZEROEventPlane->ProcessEvent(fInputEvent);\r
- \r
- if(TMath::Abs(fHFEVZEROEventPlane->GetEventPlaneV0A()+100) < 0.0000001) eventPlaneV0A = -100.0;\r
- else {\r
- eventPlaneV0A = TVector2::Phi_0_2pi(fHFEVZEROEventPlane->GetEventPlaneV0A());\r
- if(eventPlaneV0A > TMath::Pi()) eventPlaneV0A = eventPlaneV0A - TMath::Pi();\r
- }\r
- \r
- if(TMath::Abs(fHFEVZEROEventPlane->GetEventPlaneV0C()+100) < 0.0000001) eventPlaneV0C = -100.0;\r
- else {\r
- eventPlaneV0C = TVector2::Phi_0_2pi(fHFEVZEROEventPlane->GetEventPlaneV0C());\r
- if(eventPlaneV0C > TMath::Pi()) eventPlaneV0C = eventPlaneV0C - TMath::Pi();\r
- }\r
-\r
- if(TMath::Abs(fHFEVZEROEventPlane->GetEventPlaneV0()+100) < 0.0000001) eventPlaneV0 = -100.0;\r
- else {\r
- eventPlaneV0 = TVector2::Phi_0_2pi(fHFEVZEROEventPlane->GetEventPlaneV0());\r
- if(eventPlaneV0 > TMath::Pi()) eventPlaneV0 = eventPlaneV0 - TMath::Pi();\r
- }\r
- \r
- }\r
- else {\r
-\r
- Double_t qVx, qVy; //TR: info\r
- eventPlaneV0 = TVector2::Phi_0_2pi(vEPa->CalculateVZEROEventPlane(fInputEvent,10,2,qVx,qVy));\r
- if(eventPlaneV0 > TMath::Pi()) eventPlaneV0 = eventPlaneV0 - TMath::Pi();\r
- qV0.Set(qVx,qVy);\r
- eventPlaneV0A = TVector2::Phi_0_2pi(vEPa->CalculateVZEROEventPlane(fInputEvent,8,2,qVx,qVy));\r
- if(eventPlaneV0A > TMath::Pi()) eventPlaneV0A = eventPlaneV0A - TMath::Pi();\r
- qV0A.Set(qVx,qVy);\r
- eventPlaneV0C = TVector2::Phi_0_2pi(vEPa->CalculateVZEROEventPlane(fInputEvent,9,2,qVx,qVy));\r
- if(eventPlaneV0C > TMath::Pi()) eventPlaneV0C = eventPlaneV0C - TMath::Pi();\r
- qV0C.Set(qVx,qVy);\r
-\r
- if(eventPlaneV0<-900) return;\r
- if(eventPlaneV0A<-900) return;\r
- if(eventPlaneV0C<-900) return;\r
-\r
-\r
- eventPlaneV0=TVector2::Phi_0_2pi(eventPlaneV0);\r
- eventPlaneV0A=TVector2::Phi_0_2pi(eventPlaneV0A);\r
- eventPlaneV0C=TVector2::Phi_0_2pi(eventPlaneV0C);\r
- }\r
-\r
-\r
- // TPC\r
-\r
- qTPC = vEPa->GetQVector(); \r
- Double_t qx = -1.0;\r
- Double_t qy = -1.0;\r
- if(qTPC) {\r
- qx = qTPC->X();\r
- qy = qTPC->Y();\r
- } \r
- TVector2 qVectorfortrack;\r
- qVectorfortrack.Set(qx,qy);\r
- eventPlaneTPC = TVector2::Phi_0_2pi(qVectorfortrack.Phi())/2.; \r
-\r
- // Choose the one used for v2\r
-\r
- if(fVZEROEventPlane){ //TR: info\r
- eventPlanea = eventPlaneV0;\r
- qAna = &qV0;\r
- }\r
- if(fVZEROEventPlaneA){\r
- eventPlanea = eventPlaneV0A;\r
- qAna = &qV0A;\r
- }\r
- if(fVZEROEventPlaneC){\r
- eventPlanea = eventPlaneV0C;\r
- qAna = &qV0C;\r
- }\r
- if(!fVZEROEventPlane){\r
- eventPlanea = eventPlaneTPC;\r
- qAna = &qV0C;\r
- }\r
-\r
- valuecossinephiep[0] = TMath::Cos(2*eventPlanea);\r
- valuecossinephiep[1] = TMath::Sin(2*eventPlanea);\r
-\r
- Float_t eventPlanesub1a = -100.0;\r
- Float_t eventPlanesub2a = -100.0;\r
- Double_t diffsub1sub2a = -100.0;\r
- Double_t diffsub1sub2asin = -100.0;\r
- Double_t diffsubasubb = -100.0;\r
- Double_t diffsubasubc = -100.0;\r
- Double_t diffsubbsubc = -100.0;\r
- Double_t diffsubasubbsin = -100.0;\r
- Double_t diffsubasubcsin = -100.0;\r
- Double_t diffsubbsubcsin = -100.0;\r
-\r
- // two sub event TPC\r
- qsub1a = vEPa->GetQsub1();\r
- qsub2a = vEPa->GetQsub2();\r
-\r
- /////////////////////////////////////////////////////////\r
- // Cut for event with event plane reconstructed by all\r
- ////////////////////////////////////////////////////////\r
- \r
- if((!qTPC) || (!qsub1a) || (!qsub2a)) {\r
- AliDebug(2,"No event plane");\r
- return;\r
- }\r
-\r
- eventPlanesub1a = TVector2::Phi_0_2pi(qsub1a->Phi())/2.;\r
- eventPlanesub2a = TVector2::Phi_0_2pi(qsub2a->Phi())/2.;\r
- diffsub1sub2a = TMath::Cos(2.*TVector2::Phi_0_2pi(qsub1a->Phi()/2.- qsub2a->Phi()/2.));\r
- diffsub1sub2asin = TMath::Sin(2.*TVector2::Phi_0_2pi(qsub1a->Phi()/2.- qsub2a->Phi()/2.));\r
-\r
-\r
- // if ( !fDebugStreamer ) {\r
- // //debug stream\r
- // TDirectory *backup = gDirectory;\r
- // fDebugStreamer = new TTreeSRedirector("TaskFlowTPCTOFEPSPdebug.root");\r
- // if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer\r
- // } \r
-\r
- // {\r
-\r
- // double v0nrom = TMath::Sqrt(qV0.X()*qV0.X()+qV0.Y()*qV0.Y());\r
- // double v0Anrom = TMath::Sqrt(qV0A.X()*qV0A.X()+qV0A.Y()*qV0A.Y());\r
- // double v0Cnrom = TMath::Sqrt(qV0C.X()*qV0C.X()+qV0C.Y()*qV0C.Y());\r
- // double sub1nrom = TMath::Sqrt(qsub1a->X()*qsub1a->X()+qsub1a->Y()*qsub1a->Y());\r
- // double sub2nrom = TMath::Sqrt(qsub2a->X()*qsub2a->X()+qsub2a->Y()*qsub2a->Y());\r
-\r
- // (* fDebugStreamer) << "UserExec" <<\r
- // "binct="<<binct<<\r
- // "qV0="<<v0nrom<<\r
- // "qV0A="<<v0Anrom<<\r
- // "qV0C="<<v0Cnrom<<\r
- // "qsub1a="<<sub1nrom<<\r
- // "qsub2a="<<sub2nrom<<\r
- // "\n";\r
- // }\r
-\r
- // three sub events in case of VZEROA and VZEROC\r
- if(!fSP){\r
- diffsubasubb = TMath::Cos(2.*(eventPlaneV0A - eventPlaneV0C)); //TR: \r
- diffsubasubc = TMath::Cos(2.*(eventPlaneV0A - eventPlaneTPC)); //TR: \r
- diffsubbsubc = TMath::Cos(2.*(eventPlaneV0C - eventPlaneTPC)); //TR: \r
- }\r
- else{\r
- if(fVZEROEventPlaneA){\r
- diffsubasubb = qV0A.X()*qV0C.X()+qV0A.Y()*qV0C.Y();\r
- diffsubasubc = qV0A.X()*qTPC->X()+qV0A.Y()*qTPC->Y();\r
- diffsubbsubc = qV0C.X()*qTPC->X()+qV0C.Y()*qTPC->Y();\r
- }\r
- else if(fVZEROEventPlaneC){\r
- diffsubasubb = qV0C.X()*qV0A.X()+qV0C.Y()*qV0A.Y();\r
- diffsubasubc = qV0C.X()*qTPC->X()+qV0C.Y()*qTPC->Y();\r
- diffsubbsubc = qV0A.X()*qTPC->X()+qV0A.Y()*qTPC->Y();\r
- }\r
- }\r
-\r
- diffsubasubbsin = TMath::Sin(2.*(eventPlaneV0A - eventPlaneV0C));\r
- diffsubasubcsin = TMath::Sin(2.*(eventPlaneV0A - eventPlaneTPC));\r
- diffsubbsubcsin = TMath::Sin(2.*(eventPlaneV0C - eventPlaneTPC));\r
- // three sub events in case of VZERO all\r
- if(fVZEROEventPlane && (!fVZEROEventPlaneA) && (!fVZEROEventPlaneC)) {\r
- if(!fSP){\r
- diffsubasubb = TMath::Cos(2.*(eventPlaneV0 - eventPlanesub1a)); //TR: \r
- diffsubasubc = TMath::Cos(2.*(eventPlaneV0 - eventPlanesub2a)); //TR: \r
- diffsubbsubc = TMath::Cos(2.*(eventPlanesub1a - eventPlanesub2a)); //TR: \r
- }\r
- else{\r
- diffsubasubb = qV0.X()*qsub1a->X()+qV0.Y()*qsub1a->Y(); \r
- diffsubasubc = qV0.X()*qsub2a->X()+qV0.Y()*qsub2a->Y(); \r
- diffsubbsubc = qsub1a->X()*qsub2a->X()+qsub1a->Y()*qsub2a->Y();\r
- }\r
- \r
- diffsubasubbsin = TMath::Sin(2.*(eventPlaneV0 - eventPlanesub1a));\r
- diffsubasubcsin = TMath::Sin(2.*(eventPlaneV0 - eventPlanesub2a));\r
- diffsubbsubcsin = TMath::Sin(2.*(eventPlanesub1a - eventPlanesub2a));\r
- }\r
- \r
- //////////////////////////////////////\r
- // AliFlowEvent and MC event plane\r
- /////////////////////////////////////\r
-\r
- Int_t nbtracks = fInputEvent->GetNumberOfTracks();\r
- AliDebug(2,Form("Number of tracks %d",nbtracks));\r
-\r
- if(fMonitorQCumulant) {\r
-\r
- fcutsRP->SetEvent( InputEvent(), MCEvent());\r
- fcutsPOI->SetEvent( InputEvent(), MCEvent());\r
- if( fflowEvent ){ \r
- fflowEvent->~AliFlowEvent();\r
- new(fflowEvent) AliFlowEvent(fcutsRP,fcutsPOI);\r
- }else fflowEvent = new AliFlowEvent(fcutsRP,fcutsPOI);\r
- if(mcEvent && mcEvent->GenEventHeader()) {\r
- fflowEvent->SetMCReactionPlaneAngle(mcEvent);\r
- //if reaction plane not set from elsewhere randomize it before adding flow\r
- //if (!fflowEvent->IsSetMCReactionPlaneAngle()) fflowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));\r
- mcReactionPlane = TVector2::Phi_0_2pi(fflowEvent->GetMCReactionPlaneAngle());\r
- if(mcReactionPlane > TMath::Pi()) mcReactionPlane = mcReactionPlane - TMath::Pi();\r
- AliDebug(2,Form("MC reaction plane %f",mcReactionPlane));\r
- }\r
- fflowEvent->SetReferenceMultiplicity( nbtracks );\r
- fflowEvent->DefineDeadZone(0,0,0,0);\r
- //fflowEvent.TagSubeventsInEta(-0.8,-0.1,0.1,0.8);\r
- \r
- ////////////////\r
- // MC\r
- ///////////////\r
- if(fUseMCReactionPlane) {\r
- eventPlanea = mcReactionPlane;\r
- diffsub1sub2a = 0.0;\r
- }\r
- }\r
-\r
- \r
- //////////////////////\r
- // Fill Histos\r
- //////////////////////\r
-\r
- fHistEV->Fill(binctt,2.0);\r
- \r
- // Fill\r
- valuensparsea[0] = eventPlaneV0A;\r
- valuensparsea[1] = eventPlaneV0C;\r
- valuensparsea[2] = eventPlaneTPC;\r
- if(fVZEROEventPlane && (!fVZEROEventPlaneA) && (!fVZEROEventPlaneC)) {\r
- // case VZERO all\r
- valuensparsea[0] = eventPlaneV0;\r
- valuensparsea[1] = eventPlanesub1a;\r
- valuensparsea[2] = eventPlanesub2a;\r
- } \r
- fEventPlane->Fill(&valuensparsea[0]);\r
-\r
- // Fill\r
- if(fMonitorEventPlane) fCosSin2phiep->Fill(&valuecossinephiep[0]);\r
- \r
- if(!fVZEROEventPlane) {\r
- valuensparsef[0] = diffsub1sub2a;\r
- fCosRes->Fill(&valuensparsef[0]);\r
- valuensparsefsin[0] = diffsub1sub2asin;\r
- if(fMonitorEventPlane) fSinRes->Fill(&valuensparsefsin[0]);\r
- if(fMonitorEventPlane) {\r
- fProfileCosRes->Fill(valuensparsef[1],valuensparsef[0]);\r
- }\r
- }\r
- else {\r
- valuensparsefbis[0] = diffsubasubb;\r
- valuensparsefbis[1] = diffsubasubc;\r
- valuensparsefbis[2] = diffsubbsubc;\r
- fCosResabc->Fill(&valuensparsefbis[0]); //TR: info\r
- valuensparsefbissin[0] = diffsubasubbsin;\r
- valuensparsefbissin[1] = diffsubbsubcsin;\r
- valuensparsefbissin[2] = diffsubasubcsin;\r
- if(fMonitorEventPlane) fSinResabc->Fill(&valuensparsefbissin[0]);\r
- if(fMonitorEventPlane) {\r
- fProfileCosResab->Fill(valuensparsefbis[3],valuensparsefbis[0]);\r
- fProfileCosResac->Fill(valuensparsefbis[3],valuensparsefbis[1]);\r
- fProfileCosResbc->Fill(valuensparsefbis[3],valuensparsefbis[2]);\r
- }\r
- }\r
- \r
- ////////////////////////////////////////\r
- // Loop to determine pool background\r
- /////////////////////////////////////////\r
- if(fMonitorPhotonic) {\r
-\r
- fBackgroundSubtraction->FillPoolAssociatedTracks(fInputEvent,binct);\r
- \r
- if( fArraytrack ){ \r
- fArraytrack->~TArrayI();\r
- new(fArraytrack) TArrayI(nbtracks);\r
- }\r
- else { \r
- fArraytrack = new TArrayI(nbtracks);\r
- }\r
- fCounterPoolBackground = 0;\r
- \r
- for(Int_t k = 0; k < nbtracks; k++){\r
- \r
- AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);\r
- if(!track) continue;\r
- \r
- // Track cuts\r
- Bool_t survivedbackground = kTRUE;\r
- if(fAODAnalysis) {\r
- AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);\r
- if(aodtrack) {\r
- AliESDtrack esdTrack(aodtrack);\r
- // set the TPC cluster info\r
- esdTrack.SetTPCClusterMap(aodtrack->GetTPCClusterMap());\r
- esdTrack.SetTPCSharedMap(aodtrack->GetTPCSharedMap());\r
- esdTrack.SetTPCPointsF(aodtrack->GetTPCNclsF());\r
- // needed to calculate the impact parameters\r
- AliAODEvent *aodeventu = dynamic_cast<AliAODEvent *>(fInputEvent);\r
- if(aodeventu) {\r
- AliAODVertex *vAOD = aodeventu->GetPrimaryVertex();\r
- Double_t bfield = aodeventu->GetMagneticField();\r
- Double_t pos[3],cov[6];\r
- vAOD->GetXYZ(pos);\r
- vAOD->GetCovarianceMatrix(cov);\r
- const AliESDVertex vESD(pos,cov,100.,100);\r
- esdTrack.RelateToVertex(&vESD,bfield,3.);\r
- } \r
- if(!fHFEBackgroundCuts->IsSelected(&esdTrack)) {\r
- survivedbackground = kFALSE;\r
- }\r
- }\r
- }\r
- else {\r
- AliESDtrack *esdtrack = dynamic_cast<AliESDtrack *>(track);\r
- if(esdtrack) {\r
- if(!fHFEBackgroundCuts->IsSelected(esdtrack)) survivedbackground = kFALSE;\r
- }\r
- }\r
- // PID\r
- if(survivedbackground) {\r
- // PID track cuts\r
- AliHFEpidObject hfetrack2;\r
- if(!fAODAnalysis) hfetrack2.SetAnalysisType(AliHFEpidObject::kESDanalysis);\r
- else hfetrack2.SetAnalysisType(AliHFEpidObject::kAODanalysis);\r
- hfetrack2.SetRecTrack(track);\r
- hfetrack2.SetCentrality((Int_t)binct);\r
- AliDebug(2,Form("centrality %f and %d",binct,hfetrack2.GetCentrality()));\r
- hfetrack2.SetPbPb();\r
- if(fPIDBackground->IsSelected(&hfetrack2,0x0,"recTrackCont",fPIDBackgroundqa)) {\r
- fArraytrack->AddAt(k,fCounterPoolBackground);\r
- fCounterPoolBackground++;\r
- AliDebug(2,Form("fCounterPoolBackground %d, track %d",fCounterPoolBackground,k));\r
- }\r
- }\r
- }\r
- }\r
-\r
- \r
- //////////////////////////\r
- // Loop over track\r
- //////////////////////////\r
- for(Int_t k = 0; k < nbtracks; k++){\r
- \r
- AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);\r
- if(!track) continue;\r
- \r
- if(fAODAnalysis) {\r
- AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);\r
- if(!aodtrack){\r
- AliError("AOD track is not there");\r
- continue;\r
- } \r
- AliDebug(2,"Find AOD track on");\r
- if(!(aodtrack->TestFilterBit(fFilter))) continue; // Only process AOD tracks where the HFE is set\r
- }\r
-\r
- \r
- valuetrackingcuts[0] = track->Pt(); \r
- valuetrackingcuts[1] = 0;\r
- \r
- // RecKine: ITSTPC cuts \r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);\r
- \r
- // RecPrim\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- valuetrackingcuts[1] = 1; \r
- if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]); \r
- \r
- // HFEcuts: ITS layers cuts\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- valuetrackingcuts[1] = 2; \r
- if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]); \r
- \r
- // HFE cuts: TOF and mismatch flag\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- valuetrackingcuts[1] = 3; \r
- if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]); \r
- \r
- // HFE cuts: TPC PID cleanup\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- valuetrackingcuts[1] = 4; \r
- if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]); \r
- \r
- // HFEcuts: Nb of tracklets TRD0\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- valuetrackingcuts[1] = 5; \r
- if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]); \r
- \r
- AliDebug(2,"Survived");\r
-\r
- /////////////////////////////////////////////////////////\r
- // Subtract candidate from TPC event plane\r
- ////////////////////////////////////////////////////////\r
- Float_t eventplanesubtracted = 0.0; \r
-\r
- if(!fVZEROEventPlane) {\r
- // Subtract the tracks from the event plane\r
- Double_t qX = qTPC->X() - vEPa->GetQContributionX(track); //Modify the components: subtract the track you want to look at with your analysis\r
- Double_t qY = qTPC->Y() - vEPa->GetQContributionY(track); //Modify the components: subtract the track you want to look at with your analysis\r
- TVector2 newQVectorfortrack;\r
- newQVectorfortrack.Set(qX,qY);\r
- eventplanesubtracted = TVector2::Phi_0_2pi(newQVectorfortrack.Phi())/2; \r
- }\r
- else eventplanesubtracted = eventPlanea;\r
-\r
- ///////////////////////////////////////////\r
- // Event plane\r
- //////////////////////////////////////////\r
- Bool_t fillEventPlane = kTRUE;\r
- if(!fVZEROEventPlane){\r
- if((!qsub1a) || (!qsub2a)) fillEventPlane = kFALSE;\r
- if(fSubEtaGapTPC) {\r
- if(track->Eta() < (- fEtaGap/2.)) eventplanesubtracted = eventPlanesub1a;\r
- else if(track->Eta() > (fEtaGap/2.)) eventplanesubtracted = eventPlanesub2a;\r
- else fillEventPlane = kFALSE;\r
- }\r
- }\r
-\r
- ///////////////\r
- // MC\r
- //////////////\r
- if(fUseMCReactionPlane) {\r
- eventplanesubtracted = mcReactionPlane;\r
- fillEventPlane = kTRUE;\r
- }\r
- \r
- //////////////////////////////////////////////////////////////////////////////\r
- ///////////////////////////AFTERBURNER\r
- Double_t phitrack = track->Phi(); \r
- if (fAfterBurnerOn)\r
- {\r
- phitrack = GetPhiAfterAddV2(track->Phi(),mcReactionPlane);\r
- }\r
- //////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
- ///////////////////////\r
- // Calculate deltaphi\r
- ///////////////////////\r
- \r
- // Suppose phi track is between 0.0 and phi\r
- Double_t deltaphi = TVector2::Phi_0_2pi(phitrack - eventplanesubtracted);\r
- if(deltaphi > TMath::Pi()) deltaphi = deltaphi - TMath::Pi();\r
-\r
- ////////////////////////////////\r
- // Determine the deltaphi bin\r
- ///////////////////////////////\r
-\r
- // in-plane\r
- if(((deltaphi<(TMath::Pi()/4.)) && (deltaphi>0.0)) || ((deltaphi>(3*TMath::Pi()/4.)) && (deltaphi<TMath::Pi()))) valuedeltaphicontamination[0] = 0.5;\r
- // out-of-plane\r
- if((deltaphi>(TMath::Pi()/4.)) && (deltaphi<(3*TMath::Pi()/4.))) valuedeltaphicontamination[0] = 1.5;\r
-\r
- ////////////////////////////////////////\r
- // Define variables\r
- ///////////////////////////////////////\r
-\r
-\r
- valuedeltaphicontamination[2] = track->Pt();\r
- valuensparsee[2] = track->Pt();\r
- valuensparsee[3] = track->Eta(); \r
- valuensparseg[2] = track->Pt();\r
- valuensparseh[2] = track->Pt();\r
- valuefractioncont[0] = track->Pt();\r
- valuensparsehprofile[2] = track->Pt();\r
- valuensparseMCSourceDeltaPhiMaps[1] = track->Pt();\r
- if(track->Charge() > 0.0) {\r
- valuensparseg[3] = 0.2;\r
- valuensparseh[3] = 0.2;\r
- }\r
- else {\r
- valuensparseg[3] = -0.2;\r
- valuensparseh[3] = -0.2;\r
- }\r
- valuensparseh[4] = track->Eta();\r
- valuensparseg[4] = track->Eta();\r
-\r
- AliDebug(2,Form("charge %d",(Int_t)track->Charge()));\r
-\r
- ////////////////////////\r
- // Fill before PID\r
- ///////////////////////\r
- \r
- if(fMonitorWithoutPID) { \r
- \r
- valuensparseg[0] = deltaphi;\r
- if(fillEventPlane) fDeltaPhiMapsBeforePID->Fill(&valuensparseg[0]);\r
- \r
- //\r
- valuensparseh[0] = TMath::Cos(2*TVector2::Phi_mpi_pi(phitrack-eventplanesubtracted));\r
- if(fillEventPlane) {\r
- fCosPhiMapsBeforePID->Fill(&valuensparseh[0]);\r
- }\r
- }\r
- \r
- ////////////////////////\r
- // Apply PID\r
- ////////////////////////\r
- if(!fNoPID) {\r
- // Apply PID for Data\r
- if(!fMCPID) {\r
- // pid object\r
- AliHFEpidObject hfetrack;\r
- if(!fAODAnalysis) hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);\r
- else hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);\r
- hfetrack.SetRecTrack(track);\r
- hfetrack.SetCentrality((Int_t)binct);\r
- AliDebug(2,Form("centrality %f and %d",binct,hfetrack.GetCentrality()));\r
- hfetrack.SetPbPb();\r
-\r
- // Only TOF PID\r
- if(fMonitorContamination) {\r
- if(fPIDTOFOnly->IsSelected(&hfetrack,0x0,"recTrackCont",0x0)) {\r
- Float_t nsigma = pidResponse->NumberOfSigmasTPC(track, AliPID::kElectron);\r
- valuedeltaphicontamination[3] = nsigma;\r
- fDeltaPhiMapsContamination->Fill(&valuedeltaphicontamination[0]);\r
- }\r
- }\r
-\r
- // Complete PID TOF+TPC\r
- if(!fPID->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqa)) {\r
- continue;\r
- }\r
- }\r
- else {\r
- if(!mcEvent) continue;\r
- if(!(mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel()))))) continue;\r
- AliDebug(2,Form("PdgCode %d",TMath::Abs(mctrack->Particle()->GetPdgCode())));\r
- if(TMath::Abs(mctrack->Particle()->GetPdgCode())!=11) continue;\r
- }\r
- }\r
-\r
-\r
- /////////////////////////////////////////////////////////////////////////////\r
- // Add candidate to AliFlowEvent for POI and subtract from RP if needed\r
- ////////////////////////////////////////////////////////////////////////////\r
- if(fMonitorQCumulant) {\r
- Int_t idtrack = static_cast<AliVTrack*>(track)->GetID();\r
- Bool_t found = kFALSE;\r
- Int_t numberoffound = 0;\r
- AliDebug(2,Form("A: Number of tracks %d",fflowEvent->NumberOfTracks()));\r
- for(Int_t iRPs=0; iRPs< fflowEvent->NumberOfTracks(); iRPs++) {\r
- AliFlowTrack *iRP = (AliFlowTrack*) (fflowEvent->GetTrack(iRPs));\r
- if(!iRP) continue;\r
- //if(!iRP->InRPSelection()) continue;\r
- if( TMath::Abs(idtrack) == TMath::Abs(iRP->GetID()) ) {\r
- iRP->SetForPOISelection(kTRUE);\r
- found = kTRUE;\r
- numberoffound ++;\r
- }\r
- }\r
- AliDebug(2,Form("Found %d mal",numberoffound));\r
- if(!found) {\r
- AliFlowCandidateTrack *sTrack = (AliFlowCandidateTrack*) MakeTrack(massElectron,track->Pt(),track->Phi(), track->Eta());\r
- sTrack->SetID(idtrack);\r
- fflowEvent->AddTrack(sTrack);\r
- AliDebug(2,"Add the track");\r
- }\r
- AliDebug(2,Form("B: Number of tracks %d",fflowEvent->NumberOfTracks()));\r
- }\r
- \r
- \r
- /////////////////////\r
- // Fill THnSparseF\r
- /////////////////////\r
-\r
- //\r
- valuensparseabis[0] = eventplanesubtracted;\r
- if((fillEventPlane) && (fMonitorEventPlane)) fEventPlaneaftersubtraction->Fill(&valuensparseabis[0]);\r
- \r
-\r
- if(fMonitorEventPlane) \r
- {\r
- //\r
- valuensparsee[0] = TMath::Cos(2*phitrack);\r
- fCos2phie->Fill(&valuensparsee[0]);\r
- valuensparsee[0] = TMath::Sin(2*phitrack);\r
- fSin2phie->Fill(&valuensparsee[0]);\r
- //\r
- valuensparsee[0] = TMath::Cos(2*eventplanesubtracted);\r
- if(fillEventPlane) fCos2phiep->Fill(&valuensparsee[0]);\r
- valuensparsee[0] = TMath::Sin(2*eventplanesubtracted);\r
- if(fillEventPlane) fSin2phiep->Fill(&valuensparsee[0]);\r
- valuensparsee[0] = TMath::Sin(2*TVector2::Phi_mpi_pi(phitrack-eventplanesubtracted));\r
- if(fillEventPlane) fSin2phiephiep->Fill(&valuensparsee[0]);\r
- //\r
- }\r
-\r
- // \r
- valuensparseg[0] = deltaphi;\r
- if(fillEventPlane) fDeltaPhiMaps->Fill(&valuensparseg[0]);\r
- \r
- //\r
- valuensparseh[0] = TMath::Cos(2*TVector2::Phi_mpi_pi(phitrack-eventplanesubtracted));\r
- if(fillEventPlane) {\r
- fCosPhiMaps->Fill(&valuensparseh[0]); //TR: fCosPhiQSum+=valuensparseh[0]*TMath:Sqrt(qAna->X()*qAna->X()+qAna->Y()*qAna->Y()); fCosPhiQN++;\r
- if((valuefractioncont[1] >=0) && (valuefractioncont[1] < 11)){\r
- if(fContamination[((Int_t)valuefractioncont[1])]){\r
- Double_t weight = fContamination[((Int_t)valuefractioncont[1])]->Eval(track->P());\r
- if(weight<0.0) weight=0.0;\r
- if(weight>1.0) weight=1.0;\r
- fFractionContamination->Fill(&valuefractioncont[0],weight);\r
- if(fv2contamination[((Int_t)valuefractioncont[1])]){\r
- Double_t v2 = fv2contamination[((Int_t)valuefractioncont[1])]->Eval(track->Pt());\r
- AliDebug(2,Form("value v2 %f, contamination %f and pt %f centrality %d\n",v2,weight,track->Pt(),(Int_t)valuefractioncont[1]));\r
- AliDebug(2,Form("Check for centrality 3: value v2 %f, contamination %f\n",fv2contamination[3]->Eval(track->Pt()),fContamination[3]->Eval(track->P())));\r
- AliDebug(2,Form("Check for centrality 4: value v2 %f, contamination %f\n",fv2contamination[4]->Eval(track->Pt()),fContamination[4]->Eval(track->P())));\r
- AliDebug(2,Form("Check for centrality 5: value v2 %f, contamination %f\n",fv2contamination[5]->Eval(track->Pt()),fContamination[5]->Eval(track->P())));\r
- fContaminationv2->Fill(valuefractioncont[1],valuefractioncont[0],v2,weight);\r
- }\r
- } \r
- }\r
- if(fMonitorEventPlane) {\r
- if(fSP)\r
- valuensparseh[0] *= TMath::Sqrt(qAna->X()*qAna->X()+qAna->Y()*qAna->Y());\r
- fProfileCosPhiMaps->Fill(valuensparsehprofile[1],valuensparsehprofile[2],valuensparseh[0]); //TR: info\r
- }\r
- }\r
-\r
- if(fMonitorPhotonic) {\r
- Int_t indexmother = -1;\r
- Int_t source = 1;\r
- if(mcthere) source = fBackgroundSubtraction->FindMother(mctrack->GetLabel(),indexmother);\r
- fBackgroundSubtraction->LookAtNonHFE(k, track, fInputEvent, 1, binct, deltaphi, source, indexmother);\r
- \r
- if((!fAODAnalysis && mcthere) || !mcthere) {\r
- // background\r
- source = 0;\r
- indexmother = -1;\r
- source = FindMother(TMath::Abs(track->GetLabel()),mcEvent, indexmother);\r
- valuensparseMCSourceDeltaPhiMaps[2] = source;\r
- if(mcEvent) fMCSourceDeltaPhiMaps->Fill(&valuensparseMCSourceDeltaPhiMaps[0]);\r
- //LookAtNonHFE(k,track,fInputEvent,mcEvent,binct,deltaphi,source,indexmother);\r
- Int_t taggedvalue = LookAtNonHFE(k,track,fInputEvent,mcEvent,binct,deltaphi,source,indexmother);\r
- if(fMonitorPhotonic) {\r
- // No opposite charge partner found in the invariant mass choosen\r
- if((taggedvalue!=2) && (taggedvalue!=6)) {\r
- //fDeltaPhiMapsTaggedNonPhotonic->Fill(&valuensparseg[0]);\r
- //fCosPhiMapsTaggedNonPhotonic->Fill(&valuensparseh[0]);\r
- }\r
- // One opposite charge partner found in the invariant mass choosen\r
- if((taggedvalue==2) || (taggedvalue==6)) {\r
- fDeltaPhiMapsTaggedPhotonic->Fill(&valuensparseg[0]);\r
- //fCosPhiMapsTaggedPhotonic->Fill(&valuensparseh[0]);\r
- }\r
- // One same charge partner found in the invariant mass choosen\r
- if((taggedvalue==4) || (taggedvalue==6)) {\r
- fDeltaPhiMapsTaggedPhotonicLS->Fill(&valuensparseg[0]);\r
- //fCosPhiMapsTaggedPhotonicLS->Fill(&valuensparseh[0]);\r
- }\r
- }\r
- }\r
- }\r
- \r
- }\r
-\r
- //////////////////////////////////////////////////////////////////////////////\r
- ///////////////////////////AFTERBURNER\r
- if (fAfterBurnerOn & fMonitorQCumulant)\r
- {\r
- fflowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow\r
- fflowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks\r
- }\r
- //////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-\r
- //for(Int_t bincless = 0; bincless < fNbBinsCentralityQCumulant; bincless++) {\r
- // if((fBinCentralityLess[bincless]< cntr) && (cntr < fBinCentralityLess[bincless+1])) PostData(bincless+2,fflowEvent);\r
- //}\r
-\r
- if(fMonitorPhotonic) {\r
- if(fArraytrack) {\r
- delete fArraytrack;\r
- fArraytrack = NULL;\r
- }\r
- }\r
-\r
- if(fMonitorPhotonic) fBackgroundSubtraction->CountPoolAssociated(fInputEvent,binct);\r
-\r
- PostData(1, fListHist);\r
- \r
-\r
- \r
-}\r
-//______________________________________________________________________________\r
-AliFlowCandidateTrack *AliAnalysisTaskFlowTPCTOFEPSP::MakeTrack( Double_t mass, \r
- Double_t pt, Double_t phi, Double_t eta) {\r
- //\r
- // Make Track (Not needed actually)\r
- //\r
-\r
- AliFlowCandidateTrack *sTrack = new AliFlowCandidateTrack();\r
- sTrack->SetMass(mass);\r
- sTrack->SetPt(pt);\r
- sTrack->SetPhi(phi);\r
- sTrack->SetEta(eta);\r
- sTrack->SetForPOISelection(kTRUE);\r
- sTrack->SetForRPSelection(kFALSE);\r
- return sTrack;\r
-}\r
-//_________________________________________________________________________________ \r
-Double_t AliAnalysisTaskFlowTPCTOFEPSP::GetPhiAfterAddV2(Double_t phi,Double_t reactionPlaneAngle) const\r
-{\r
- //\r
- // Adds v2, uses Newton-Raphson iteration\r
- //\r
- Double_t phiend=phi;\r
- Double_t phi0=phi;\r
- Double_t f=0.;\r
- Double_t fp=0.;\r
- Double_t phiprev=0.;\r
-\r
- for (Int_t i=0; i<fMaxNumberOfIterations; i++)\r
- {\r
- phiprev=phiend; //store last value for comparison\r
- f = phiend-phi0+fV2*TMath::Sin(2.*(phiend-reactionPlaneAngle));\r
- fp = 1.0+2.0*fV2*TMath::Cos(2.*(phiend-reactionPlaneAngle)); //first derivative\r
- phiend -= f/fp;\r
- if (TMath::AreEqualAbs(phiprev,phiend,fPrecisionPhi)) break;\r
- }\r
- return phiend;\r
-}\r
-//_____________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, AliMCEvent *mcEvent,Int_t binct,Double_t deltaphi,Int_t source,Int_t indexmother)\r
-{ \r
- //\r
- // Look At Non HFE\r
- //\r
-\r
- // return -1 if nothing\r
- // return 2 if opposite charge within the mass range found\r
- // return 4 if like charge within the mass range found\r
- // return 6 if opposite charge and like charge within the mass range found\r
- //\r
-\r
- Int_t taggedphotonic = -1;\r
-\r
- Bool_t oppositetaggedphotonic = kFALSE;\r
- Bool_t sametaggedphotonic = kFALSE;\r
-\r
- AliDebug(2,Form("fCounterPoolBackground %d in LookAtNonHFE!!!",fCounterPoolBackground));\r
- if(!fArraytrack) return taggedphotonic;\r
- AliDebug(2,Form("process track %d",iTrack1));\r
- \r
- TVector3 v3D1;\r
- TVector3 v3D2;\r
-\r
- Double_t valuensparseDeltaPhiMaps[5];\r
- Double_t valueangle[3];\r
-\r
- valuensparseDeltaPhiMaps[1] = binct;\r
- valuensparseDeltaPhiMaps[2] = track1->Pt();\r
- valuensparseDeltaPhiMaps[0] = deltaphi;\r
- valuensparseDeltaPhiMaps[4] = source;\r
- \r
- valueangle[2] = source;\r
- valueangle[1] = binct;\r
-\r
- // Pdg code\r
- Int_t pdg1 = CheckPdg(TMath::Abs(track1->GetLabel()),mcEvent);\r
- Int_t numberfound = 0;\r
-\r
- //Magnetic Field\r
- Double_t bfield = vEvent->GetMagneticField();\r
-\r
- // Get Primary vertex\r
- const AliVVertex *pVtx = vEvent->GetPrimaryVertex();\r
- \r
- for(Int_t idex = 0; idex < fCounterPoolBackground; idex++) \r
- {\r
-\r
- Int_t iTrack2 = fArraytrack->At(idex);\r
- AliDebug(2,Form("track %d",iTrack2));\r
- AliVTrack* track2 = (AliVTrack *) vEvent->GetTrack(iTrack2);\r
- if (!track2) \r
- {\r
- printf("ERROR: Could not receive track %d", iTrack2);\r
- continue;\r
- }\r
- if(iTrack2==iTrack1) continue;\r
- AliDebug(2,"Different");\r
-\r
- // Reset the MC info\r
- valueangle[2] = source;\r
- valuensparseDeltaPhiMaps[4] = source;\r
-\r
- // track cuts and PID already done\r
-\r
- // if MC look\r
- Int_t pdg2 = -100;\r
- if(mcEvent) {\r
- Int_t source2 = 0;\r
- Int_t indexmother2 = -1;\r
- source2 = FindMother(TMath::Abs(track2->GetLabel()),mcEvent, indexmother2);\r
- pdg2 = CheckPdg(TMath::Abs(track2->GetLabel()),mcEvent);\r
- if(source2 >=0 ) {\r
- if((indexmother2 == indexmother) && (source == source2) && ((pdg1*pdg2)<0.0)) {\r
- if(source == kElectronfromconversion) {\r
- valueangle[2] = kElectronfromconversionboth;\r
- valuensparseDeltaPhiMaps[4] = kElectronfromconversionboth;\r
- numberfound++;\r
- }\r
- if(source == kElectronfrompi0) {\r
- valueangle[2] = kElectronfrompi0both;\r
- valuensparseDeltaPhiMaps[4] = kElectronfrompi0both;\r
- }\r
- if(source == kElectronfrometa) {\r
- valueangle[2] = kElectronfrometaboth;\r
- valuensparseDeltaPhiMaps[4] = kElectronfrometaboth;\r
- }\r
- }\r
- }\r
- }\r
- \r
- if(fAlgorithmMA && (!fAODAnalysis))\r
- {\r
- // tracks\r
- AliESDtrack *esdtrack2 = dynamic_cast<AliESDtrack *>(track2); \r
- AliESDtrack *esdtrack1 = dynamic_cast<AliESDtrack *>(track1); \r
- if((!esdtrack2) || (!esdtrack1)) continue;\r
-\r
- //Variables\r
- Double_t p1[3];\r
- Double_t p2[3];\r
- Double_t xt1; //radial position track 1 at the DCA point\r
- Double_t xt2; //radial position track 2 at the DCA point\r
- //DCA track1-track2\r
- Double_t dca12 = esdtrack2->GetDCA(esdtrack1,bfield,xt2,xt1);\r
-\r
- // Cut dca\r
- if(dca12 > fMaxdca) continue;\r
- \r
- //Momento of the track extrapolated to DCA track-track \r
- //Track1\r
- Bool_t hasdcaT1 = esdtrack1->GetPxPyPzAt(xt1,bfield,p1);\r
- //Track2\r
- Bool_t hasdcaT2 = esdtrack2->GetPxPyPzAt(xt2,bfield,p2);\r
- \r
- if(!hasdcaT1 || !hasdcaT2) AliWarning("It could be a problem in the extrapolation");\r
- \r
- //track1-track2 Invariant Mass\r
- Double_t eMass = 0.000510998910; //Electron mass in GeV\r
- Double_t pP1 = sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]); //Track 1 momentum\r
- Double_t pP2 = sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]); //Track 2 momentum\r
- Double_t eE1 = TMath::Sqrt(pP1*pP1+eMass*eMass);\r
- Double_t eE2 = TMath::Sqrt(pP2*pP2+eMass*eMass);\r
- \r
- //TLorentzVector v1(p1[0],p1[1],p1[2],sqrt(eMass*eMass+pP1*pP1));\r
- //TLorentzVector v2(p2[0],p2[1],p2[2],sqrt(eMass*eMass+pP2*pP2));\r
- //Double_t imass = (v1+v2).M(); //Invariant Mass\r
- //Double_t angle3D = v1.Angle(v2.Vect()); //Opening Angle (Total Angle)\r
- \r
- // daughter\r
- v3D1.SetXYZ(p1[0],p1[1],p1[2]);\r
- v3D2.SetXYZ(p2[0],p2[1],p2[2]);\r
- Double_t openingangle = TVector2::Phi_0_2pi(v3D2.Angle(v3D1));\r
- \r
- // mother\r
- TVector3 motherrec = v3D1 + v3D2;\r
- Double_t invmass = TMath::Sqrt((eE1+eE2)*(eE1+eE2)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));\r
- \r
- // xy\r
- //TVector3 vectordiff = v3D1 - v3D2;\r
- //Double_t diffphi = TVector2::Phi_0_2pi(vectordiff.Phi());\r
- //Double_t massxy = TMath::Sqrt((eE1+eE2)*(eE1+eE2)-(pP1*pP1+pP2*pP2+2*pP1*pP2*TMath::Cos(diffphi)));\r
-\r
- // rz\r
- //Double_t difftheta = TVector2::Phi_0_2pi(vectordiff.Eta());\r
- //Double_t massrz = TMath::Sqrt((eE1+eE2)*(eE1+eE2)-(pP1*pP1+pP2*pP2+2*pP1*pP2*TMath::Cos(difftheta)));\r
- \r
-\r
- Float_t fCharge1 = track1->Charge();\r
- Float_t fCharge2 = track2->Charge();\r
-\r
- // Fill Histo\r
- //valueangle[0] = diffphi;\r
- //valueangle[1] = difftheta;\r
- valueangle[0] = openingangle;\r
- if((fCharge1*fCharge2)>0.0) fSameSignAngle->Fill(&valueangle[0]);\r
- else fOppSignAngle->Fill(&valueangle[0]);\r
-\r
- // Cut\r
- if(openingangle > fMaxopening3D) continue;\r
- //if(difftheta > fMaxopeningtheta) continue;\r
- //if(diffphi > fMaxopeningphi) continue;\r
-\r
- // Invmass\r
- valuensparseDeltaPhiMaps[3] = invmass;\r
- if((fCharge1*fCharge2)>0.0) fSameSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);\r
- else fOppSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);\r
- \r
- // Cut\r
- if(invmass < fMaxInvmass) {\r
- if((fCharge1*fCharge2)<0.0) oppositetaggedphotonic=kTRUE;\r
- if((fCharge1*fCharge2)>0.0) sametaggedphotonic=kTRUE;\r
- }\r
-\r
-\r
- }\r
- else \r
- {\r
- Int_t fPDGtrack1 = 11; \r
- Int_t fPDGtrack2 = 11;\r
- \r
- Float_t fCharge1 = track1->Charge();\r
- Float_t fCharge2 = track2->Charge();\r
- \r
- if(fCharge1>0) fPDGtrack1 = -11;\r
- if(fCharge2>0) fPDGtrack2 = -11;\r
- \r
- AliKFParticle ktrack1(*track1, fPDGtrack1);\r
- AliKFParticle ktrack2(*track2, fPDGtrack2);\r
- AliKFParticle recoGamma(ktrack1, ktrack2);\r
- \r
- //Reconstruction Cuts\r
- if(recoGamma.GetNDF()<1) continue;\r
- Double_t chi2OverNDF = recoGamma.GetChi2()/recoGamma.GetNDF();\r
- if(TMath::Sqrt(TMath::Abs(chi2OverNDF))>fChi2OverNDFCut) continue;\r
-\r
- // DCA\r
- //Double_t dca12 = ktrack1.GetDistanceFromParticle(ktrack2);\r
- //if(dca12 > fMaxdca) continue; \r
-\r
- // if set mass constraint\r
- if(fSetMassConstraint && pVtx) {\r
- AliKFVertex primV(*pVtx);\r
- primV += recoGamma;\r
- primV -= ktrack1;\r
- primV -= ktrack2;\r
- recoGamma.SetProductionVertex(primV);\r
- recoGamma.SetMassConstraint(0,0.0001);\r
- } \r
-\r
- //Invariant Mass\r
- Double_t imass; \r
- Double_t width;\r
- recoGamma.GetMass(imass,width);\r
- \r
- //Opening Angle (Total Angle)\r
- Double_t angle = ktrack1.GetAngle(ktrack2);\r
- valueangle[0] = angle;\r
- if((fCharge1*fCharge2)>0.0) fSameSignAngle->Fill(&valueangle[0]);\r
- else fOppSignAngle->Fill(&valueangle[0]);\r
-\r
- // Cut\r
- if(angle > fMaxopening3D) continue; \r
-\r
- // Invmass\r
- valuensparseDeltaPhiMaps[3] = imass;\r
- if((fCharge1*fCharge2)>0.0) fSameSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);\r
- else {\r
- fOppSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);\r
- /*\r
- if(valueangle[2] == kElectronfromconversionboth) {\r
- printf("Reconstructed charge1 %f, charge 2 %f and invmass %f",fCharge1,fCharge2,imass);\r
- printf("MC charge1 %d, charge 2 %d",pdg1,pdg2);\r
- printf("DCA %f",dca12);\r
- printf("Number of found %d",numberfound);\r
- }\r
- */\r
- }\r
- \r
- // Cut\r
- if(imass < fMaxInvmass) {\r
- if((fCharge1*fCharge2)<0.0) oppositetaggedphotonic=kTRUE;\r
- if((fCharge1*fCharge2)>0.0) sametaggedphotonic=kTRUE;\r
- }\r
- }\r
- }\r
- \r
- if(oppositetaggedphotonic && sametaggedphotonic){\r
- taggedphotonic = 6;\r
- }\r
-\r
- if(!oppositetaggedphotonic && sametaggedphotonic){\r
- taggedphotonic = 4;\r
- }\r
-\r
- if(oppositetaggedphotonic && !sametaggedphotonic){\r
- taggedphotonic = 2;\r
- }\r
-\r
- \r
- return taggedphotonic;\r
-}\r
-//_________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::FindMother(Int_t tr, AliMCEvent *mcEvent, Int_t &indexmother){\r
- //\r
- // Find the mother if MC\r
- //\r
-\r
- if(!mcEvent) return 0;\r
-\r
- Int_t pdg = CheckPdg(tr,mcEvent);\r
- if(TMath::Abs(pdg)!= 11) {\r
- indexmother = -1;\r
- return kNoElectron;\r
- }\r
- \r
- indexmother = IsMotherGamma(tr,mcEvent);\r
- if(indexmother > 0) return kElectronfromconversion;\r
- indexmother = IsMotherPi0(tr,mcEvent);\r
- if(indexmother > 0) return kElectronfrompi0;\r
- indexmother = IsMotherC(tr,mcEvent);\r
- if(indexmother > 0) return kElectronfromC;\r
- indexmother = IsMotherB(tr,mcEvent);\r
- if(indexmother > 0) return kElectronfromB;\r
- indexmother = IsMotherEta(tr,mcEvent);\r
- if(indexmother > 0) return kElectronfrometa;\r
- \r
- return kElectronfromother;\r
-\r
-\r
-}\r
-//____________________________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::CheckPdg(Int_t tr, AliMCEvent* mcEvent) {\r
-\r
- //\r
- // Return the pdg of the particle\r
- //\r
-\r
-\r
- Int_t pdgcode = -1;\r
- if(tr < 0) return pdgcode;\r
-\r
- if(!mcEvent) return pdgcode;\r
-\r
- AliVParticle *mctrack = mcEvent->GetTrack(tr);\r
- \r
- \r
- if(mctrack->IsA() == AliMCParticle::Class()) {\r
- AliMCParticle *mctrackesd = NULL;\r
- if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return pdgcode;\r
- pdgcode = mctrackesd->PdgCode();\r
- }\r
-\r
- if(mctrack->IsA() == AliAODMCParticle::Class()) {\r
- AliAODMCParticle *mctrackaod = NULL;\r
- if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return pdgcode;\r
- pdgcode = mctrackaod->GetPdgCode();\r
- }\r
- \r
- return pdgcode;\r
-\r
- \r
-}\r
-//____________________________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherGamma(Int_t tr, AliMCEvent* mcEvent) {\r
-\r
- //\r
- // Return the lab of gamma mother or -1 if not gamma\r
- //\r
-\r
- if(tr < 0) return -1;\r
- AliVParticle *mctrack = mcEvent->GetTrack(tr);\r
- \r
- if(mctrack->IsA() == AliMCParticle::Class()) {\r
- AliMCParticle *mctrackesd = NULL;\r
- if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- TParticle *particle = 0x0;\r
- particle = mctrackesd->Particle();\r
- // Take mother\r
- if(!particle) return -1;\r
- Int_t imother = particle->GetFirstMother(); \r
- if(imother < 0) return -1; \r
- AliMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- TParticle * mother = mothertrack->Particle();\r
- if(!mother) return -1;\r
- // Check gamma \r
- Int_t pdg = mother->GetPdgCode();\r
- if(TMath::Abs(pdg) == 22) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherGamma(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- if(mctrack->IsA() == AliAODMCParticle::Class()) {\r
- AliAODMCParticle *mctrackaod = NULL;\r
- if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- // Take mother\r
- Int_t imother = mctrackaod->GetMother();\r
- if(imother < 0) return -1; \r
- AliAODMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- // Check gamma \r
- Int_t pdg = mothertrack->GetPdgCode();\r
- if(TMath::Abs(pdg) == 22) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherGamma(imother,mcEvent);\r
- }\r
- return -1;\r
-\r
- }\r
- \r
- return -1;\r
-\r
- \r
-}\r
-//\r
-//____________________________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherPi0(Int_t tr, AliMCEvent* mcEvent) {\r
-\r
- //\r
- // Return the lab of pi0 mother or -1 if not pi0\r
- //\r
-\r
- if(tr < 0) return -1;\r
- AliVParticle *mctrack = mcEvent->GetTrack(tr);\r
- \r
- if(mctrack->IsA() == AliMCParticle::Class()) {\r
- AliMCParticle *mctrackesd = NULL;\r
- if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- TParticle *particle = 0x0;\r
- particle = mctrackesd->Particle();\r
- // Take mother\r
- if(!particle) return -1;\r
- Int_t imother = particle->GetFirstMother(); \r
- if(imother < 0) return -1; \r
- AliMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- TParticle * mother = mothertrack->Particle();\r
- if(!mother) return -1;\r
- // Check gamma \r
- Int_t pdg = mother->GetPdgCode();\r
- if(TMath::Abs(pdg) == 111) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherPi0(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- if(mctrack->IsA() == AliAODMCParticle::Class()) {\r
- AliAODMCParticle *mctrackaod = NULL;\r
- if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- // Take mother\r
- Int_t imother = mctrackaod->GetMother();\r
- if(imother < 0) return -1; \r
- AliAODMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- // Check gamma \r
- Int_t pdg = mothertrack->GetPdgCode();\r
- if(TMath::Abs(pdg) == 111) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherPi0(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- return -1;\r
- \r
-}\r
-//____________________________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherC(Int_t tr, AliMCEvent* mcEvent) {\r
-\r
- //\r
- // Return the lab of signal mother or -1 if not signal\r
- //\r
-\r
- if(tr < 0) return -1;\r
- AliVParticle *mctrack = mcEvent->GetTrack(tr);\r
- \r
- if(mctrack->IsA() == AliMCParticle::Class()) {\r
- AliMCParticle *mctrackesd = NULL;\r
- if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- TParticle *particle = 0x0;\r
- particle = mctrackesd->Particle();\r
- // Take mother\r
- if(!particle) return -1;\r
- Int_t imother = particle->GetFirstMother(); \r
- if(imother < 0) return -1; \r
- AliMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- TParticle * mother = mothertrack->Particle();\r
- if(!mother) return -1;\r
- // Check gamma \r
- Int_t pdg = mother->GetPdgCode();\r
- if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherC(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- if(mctrack->IsA() == AliAODMCParticle::Class()) {\r
- AliAODMCParticle *mctrackaod = NULL;\r
- if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- // Take mother\r
- Int_t imother = mctrackaod->GetMother();\r
- if(imother < 0) return -1; \r
- AliAODMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- // Check gamma \r
- Int_t pdg = mothertrack->GetPdgCode();\r
- if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherC(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- return -1;\r
-\r
-}\r
-//____________________________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherB(Int_t tr, AliMCEvent* mcEvent) {\r
-\r
- //\r
- // Return the lab of signal mother or -1 if not signal\r
- //\r
-\r
- if(tr < 0) return -1;\r
- AliVParticle *mctrack = mcEvent->GetTrack(tr);\r
- \r
- if(mctrack->IsA() == AliMCParticle::Class()) {\r
- AliMCParticle *mctrackesd = NULL;\r
- if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- TParticle *particle = 0x0;\r
- particle = mctrackesd->Particle();\r
- // Take mother\r
- if(!particle) return -1;\r
- Int_t imother = particle->GetFirstMother(); \r
- if(imother < 0) return -1; \r
- AliMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- TParticle * mother = mothertrack->Particle();\r
- if(!mother) return -1;\r
- // Check gamma \r
- Int_t pdg = mother->GetPdgCode();\r
- if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother; \r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherB(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- if(mctrack->IsA() == AliAODMCParticle::Class()) {\r
- AliAODMCParticle *mctrackaod = NULL;\r
- if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- // Take mother\r
- Int_t imother = mctrackaod->GetMother();\r
- if(imother < 0) return -1; \r
- AliAODMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- // Check gamma \r
- Int_t pdg = mothertrack->GetPdgCode();\r
- if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherB(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- return -1;\r
-\r
-}\r
-//____________________________________________________________________________________________________________\r
-Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherEta(Int_t tr, AliMCEvent* mcEvent) {\r
-\r
- //\r
- // Return the lab of pi0 mother or -1 if not pi0\r
- //\r
-\r
- if(tr < 0) return -1;\r
- AliVParticle *mctrack = mcEvent->GetTrack(tr);\r
- \r
- if(mctrack->IsA() == AliMCParticle::Class()) {\r
- AliMCParticle *mctrackesd = NULL;\r
- if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- TParticle *particle = 0x0;\r
- particle = mctrackesd->Particle();\r
- // Take mother\r
- if(!particle) return -1;\r
- Int_t imother = particle->GetFirstMother(); \r
- if(imother < 0) return -1; \r
- AliMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- TParticle * mother = mothertrack->Particle();\r
- if(!mother) return -1;\r
- // Check gamma \r
- Int_t pdg = mother->GetPdgCode();\r
- if(TMath::Abs(pdg) == 221) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherEta(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- if(mctrack->IsA() == AliAODMCParticle::Class()) {\r
- AliAODMCParticle *mctrackaod = NULL;\r
- if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;\r
- // Take mother\r
- Int_t imother = mctrackaod->GetMother();\r
- if(imother < 0) return -1; \r
- AliAODMCParticle *mothertrack = NULL;\r
- if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;\r
- // Check gamma \r
- Int_t pdg = mothertrack->GetPdgCode();\r
- if(TMath::Abs(pdg) == 221) return imother;\r
- if(TMath::Abs(pdg) == 11) {\r
- return IsMotherEta(imother,mcEvent);\r
- }\r
- return -1;\r
- }\r
-\r
- return -1;\r
- \r
-}\r
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+//
+// Flow task
+//
+// Authors:
+// Raphaelle Bailhache <R.Bailhache@gsi.de>
+// Theodor Rascanu <trascanu@stud.uni-frankfurt.de>
+//
+#include "TROOT.h"
+#include "TH1D.h"
+#include "TH2D.h"
+#include "TChain.h"
+#include "TVector2.h"
+#include "THnSparse.h"
+#include "TMath.h"
+#include "TRandom3.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+#include "TLorentzVector.h"
+#include "TParticle.h"
+#include "TF1.h"
+
+#include <TDirectory.h>
+#include <TTreeStream.h>
+
+#include "AliVEventHandler.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisManager.h"
+
+#include "AliVEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliMCEvent.h"
+#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliESDVZERO.h"
+#include "AliESDUtils.h"
+#include "AliMCParticle.h"
+#include "AliAODMCParticle.h"
+#include "AliAODEvent.h"
+#include "AliAODVertex.h"
+#include "AliAODTrack.h"
+#include "AliVTrack.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliAODTrack.h"
+#include "AliStack.h"
+#include "AliMCEvent.h"
+
+#include "AliFlowCandidateTrack.h"
+#include "AliFlowEvent.h"
+#include "AliFlowTrackCuts.h"
+#include "AliFlowVector.h"
+#include "AliFlowCommonConstants.h"
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+
+#include "AliHFEcuts.h"
+#include "AliHFEpid.h"
+#include "AliHFEpidQAmanager.h"
+#include "AliHFEtools.h"
+#include "AliHFEVZEROEventPlane.h"
+
+#include "AliCentrality.h"
+#include "AliEventplane.h"
+#include "AliAnalysisTaskFlowTPCTOFEPSP.h"
+#include "AliAODMCHeader.h"
+#include "TClonesArray.h"
+#include "AliHFENonPhotonicElectron.h"
+
+ClassImp(AliAnalysisTaskFlowTPCTOFEPSP)
+
+//____________________________________________________________________
+AliAnalysisTaskFlowTPCTOFEPSP::AliAnalysisTaskFlowTPCTOFEPSP() :
+ AliAnalysisTaskSE(),
+ fListHist(0x0),
+ fAODAnalysis(kFALSE),
+ fFilter(1<<4),
+ fAODMCHeader(NULL),
+ fAODArrayMCInfo(NULL),
+ fBackgroundSubtraction(NULL),
+ fVZEROEventPlane(kFALSE),
+ fVZEROEventPlaneA(kFALSE),
+ fVZEROEventPlaneC(kFALSE),
+ fSubEtaGapTPC(kFALSE),
+ fEtaGap(0.0),
+ fNbBinsCentralityQCumulant(4),
+ fNbBinsPtQCumulant(12),
+ fMinPtQCumulant(0.2),
+ fMaxPtQCumulant(6.0),
+ fAfterBurnerOn(kFALSE),
+ fNonFlowNumberOfTrackClones(0),
+ fV1(0.),
+ fV2(0.),
+ fV3(0.),
+ fV4(0.),
+ fV5(0.),
+ fMaxNumberOfIterations(100),
+ fPrecisionPhi(0.001),
+ fUseMCReactionPlane(kFALSE),
+ fSP(kFALSE),
+ fMCPID(kFALSE),
+ fNoPID(kFALSE),
+ fChi2OverNDFCut(3.0),
+ fMaxdca(3.0),
+ fMaxopeningtheta(0.02),
+ fMaxopeningphi(0.1),
+ fMaxopening3D(0.1),
+ fMaxInvmass(0.1),
+ fSetMassConstraint(kFALSE),
+ fMonitorEventPlane(kFALSE),
+ fMonitorContamination(kFALSE),
+ fMonitorPhotonic(kFALSE),
+ fMonitorWithoutPID(kFALSE),
+ fMonitorTrackCuts(kFALSE),
+ fMonitorQCumulant(kFALSE),
+ fcutsRP(0),
+ fcutsPOI(0),
+ fHFECuts(0),
+ fPID(0),
+ fPIDTOFOnly(0),
+ fPIDqa(0),
+ fflowEvent(NULL),
+ fHFEBackgroundCuts(0),
+ fPIDBackground(0),
+ fPIDBackgroundqa(0),
+ fAlgorithmMA(kTRUE),
+ fArraytrack(NULL),
+ fCounterPoolBackground(0),
+ fHFEVZEROEventPlane(0x0),
+ fHistEV(0),
+ fHistPileUp(0),
+ fPileUpCut(kFALSE),
+ fEventPlane(0x0),
+ fEventPlaneaftersubtraction(0x0),
+ fFractionContamination(0x0),
+ fContaminationv2(0x0),
+ fCosSin2phiep(0x0),
+ fCos2phie(0x0),
+ fSin2phie(0x0),
+ fCos2phiep(0x0),
+ fSin2phiep(0x0),
+ fSin2phiephiep(0x0),
+ fCosResabc(0x0),
+ fSinResabc(0x0),
+ fProfileCosResab(0x0),
+ fProfileCosResac(0x0),
+ fProfileCosResbc(0x0),
+ fCosRes(0x0),
+ fSinRes(0x0),
+ fProfileCosRes(0x0),
+ fTrackingCuts(0x0),
+ fDeltaPhiMapsBeforePID(0x0),
+ fCosPhiMapsBeforePID(0x0),
+ fDeltaPhiMaps(0x0),
+ fDeltaPhiMapsContamination(0x0),
+ fCosPhiMaps(0x0),
+ fProfileCosPhiMaps(0x0),
+ fDeltaPhiMapsTaggedPhotonic(0x0),
+ //fCosPhiMapsTaggedPhotonic(0x0),
+ fDeltaPhiMapsTaggedNonPhotonic(0x0),
+ //fCosPhiMapsTaggedNonPhotonic(0x0),
+ fDeltaPhiMapsTaggedPhotonicLS(0x0),
+ //fCosPhiMapsTaggedPhotonicLS(0x0),
+ fMCSourceDeltaPhiMaps(0x0),
+ fOppSignDeltaPhiMaps(0x0),
+ fSameSignDeltaPhiMaps(0x0),
+ fOppSignAngle(0x0),
+ fSameSignAngle(0x0),
+ fDebugStreamer(0)
+{
+ // Constructor
+
+ for(Int_t k = 0; k < 10; k++) {
+ fBinCentralityLess[k] = 0.0;
+ }
+ for(Int_t k = 0; k < 11; k++) {
+ fContamination[k] = NULL;
+ fv2contamination[k] = NULL;
+ }
+
+}
+//______________________________________________________________________________
+AliAnalysisTaskFlowTPCTOFEPSP:: AliAnalysisTaskFlowTPCTOFEPSP(const char *name) :
+ AliAnalysisTaskSE(name),
+ fListHist(0x0),
+ fAODAnalysis(kFALSE),
+ fFilter(1<<4),
+ fAODMCHeader(NULL),
+ fAODArrayMCInfo(NULL),
+ fBackgroundSubtraction(NULL),
+ fVZEROEventPlane(kFALSE),
+ fVZEROEventPlaneA(kFALSE),
+ fVZEROEventPlaneC(kFALSE),
+ fSubEtaGapTPC(kFALSE),
+ fEtaGap(0.0),
+ fNbBinsCentralityQCumulant(4),
+ fNbBinsPtQCumulant(15),
+ fMinPtQCumulant(0.0),
+ fMaxPtQCumulant(6.0),
+ fAfterBurnerOn(kFALSE),
+ fNonFlowNumberOfTrackClones(0),
+ fV1(0.),
+ fV2(0.),
+ fV3(0.),
+ fV4(0.),
+ fV5(0.),
+ fMaxNumberOfIterations(100),
+ fPrecisionPhi(0.001),
+ fUseMCReactionPlane(kFALSE),
+ fSP(kFALSE),
+ fMCPID(kFALSE),
+ fNoPID(kFALSE),
+ fChi2OverNDFCut(3.0),
+ fMaxdca(3.0),
+ fMaxopeningtheta(0.02),
+ fMaxopeningphi(0.1),
+ fMaxopening3D(0.1),
+ fMaxInvmass(0.1),
+ fSetMassConstraint(kFALSE),
+ fMonitorEventPlane(kFALSE),
+ fMonitorContamination(kFALSE),
+ fMonitorPhotonic(kFALSE),
+ fMonitorWithoutPID(kFALSE),
+ fMonitorTrackCuts(kFALSE),
+ fMonitorQCumulant(kFALSE),
+ fcutsRP(0),
+ fcutsPOI(0),
+ fHFECuts(0),
+ fPID(0),
+ fPIDTOFOnly(0),
+ fPIDqa(0),
+ fflowEvent(NULL),
+ fHFEBackgroundCuts(0),
+ fPIDBackground(0),
+ fPIDBackgroundqa(0),
+ fAlgorithmMA(kTRUE),
+ fArraytrack(NULL),
+ fCounterPoolBackground(0),
+ fHFEVZEROEventPlane(0x0),
+ fHistEV(0),
+ fHistPileUp(0),
+ fPileUpCut(kFALSE),
+ fEventPlane(0x0),
+ fEventPlaneaftersubtraction(0x0),
+ fFractionContamination(0x0),
+ fContaminationv2(0x0),
+ fCosSin2phiep(0x0),
+ fCos2phie(0x0),
+ fSin2phie(0x0),
+ fCos2phiep(0x0),
+ fSin2phiep(0x0),
+ fSin2phiephiep(0x0),
+ fCosResabc(0x0),
+ fSinResabc(0x0),
+ fProfileCosResab(0x0),
+ fProfileCosResac(0x0),
+ fProfileCosResbc(0x0),
+ fCosRes(0x0),
+ fSinRes(0x0),
+ fProfileCosRes(0x0),
+ fTrackingCuts(0x0),
+ fDeltaPhiMapsBeforePID(0x0),
+ fCosPhiMapsBeforePID(0x0),
+ fDeltaPhiMaps(0x0),
+ fDeltaPhiMapsContamination(0x0),
+ fCosPhiMaps(0x0),
+ fProfileCosPhiMaps(0x0),
+ fDeltaPhiMapsTaggedPhotonic(0x0),
+ //fCosPhiMapsTaggedPhotonic(0x0),
+ fDeltaPhiMapsTaggedNonPhotonic(0x0),
+ //fCosPhiMapsTaggedNonPhotonic(0x0),
+ fDeltaPhiMapsTaggedPhotonicLS(0x0),
+ //fCosPhiMapsTaggedPhotonicLS(0x0),
+ fMCSourceDeltaPhiMaps(0x0),
+ fOppSignDeltaPhiMaps(0x0),
+ fSameSignDeltaPhiMaps(0x0),
+ fOppSignAngle(0x0),
+ fSameSignAngle(0x0),
+ fDebugStreamer(0)
+{
+ //
+ // named ctor
+ //
+
+ for(Int_t k = 0; k < 10; k++) {
+ fBinCentralityLess[k] = 0.0;
+ }
+ fBinCentralityLess[0] = 0.0;
+ fBinCentralityLess[1] = 20.0;
+ fBinCentralityLess[2] = 40.0;
+ fBinCentralityLess[3] = 60.0;
+ fBinCentralityLess[4] = 80.0;
+
+ for(Int_t k = 0; k < 11; k++) {
+ fContamination[k] = NULL;
+ fv2contamination[k] = NULL;
+ }
+
+ fPID = new AliHFEpid("hfePid");
+ fPIDqa = new AliHFEpidQAmanager;
+
+ fPIDBackground = new AliHFEpid("hfePidBackground");
+ fPIDBackgroundqa = new AliHFEpidQAmanager;
+
+ fPIDTOFOnly = new AliHFEpid("hfePidTOFOnly");
+
+ DefineInput(0,TChain::Class());
+ DefineOutput(1, TList::Class());
+ //for(Int_t bincless = 0; bincless < fNbBinsCentralityQCumulant; bincless++) {
+ // DefineOutput(bincless+2,AliFlowEventSimple::Class());
+ //}
+
+}
+//____________________________________________________________
+AliAnalysisTaskFlowTPCTOFEPSP::AliAnalysisTaskFlowTPCTOFEPSP(const AliAnalysisTaskFlowTPCTOFEPSP &ref):
+ AliAnalysisTaskSE(ref),
+ fListHist(NULL),
+ fAODAnalysis(ref.fAODAnalysis),
+ fFilter(ref.fFilter),
+ fAODMCHeader(ref.fAODMCHeader),
+ fAODArrayMCInfo(ref.fAODArrayMCInfo),
+ fBackgroundSubtraction(ref.fBackgroundSubtraction),
+ fVZEROEventPlane(ref.fVZEROEventPlane),
+ fVZEROEventPlaneA(ref.fVZEROEventPlaneA),
+ fVZEROEventPlaneC(ref.fVZEROEventPlaneC),
+ fSubEtaGapTPC(ref.fSubEtaGapTPC),
+ fEtaGap(ref.fEtaGap),
+ fNbBinsCentralityQCumulant(ref.fNbBinsCentralityQCumulant),
+ fNbBinsPtQCumulant(ref.fNbBinsPtQCumulant),
+ fMinPtQCumulant(ref.fMinPtQCumulant),
+ fMaxPtQCumulant(ref.fMaxPtQCumulant),
+ fAfterBurnerOn(ref.fAfterBurnerOn),
+ fNonFlowNumberOfTrackClones(ref.fNonFlowNumberOfTrackClones),
+ fV1(ref.fV1),
+ fV2(ref.fV2),
+ fV3(ref.fV3),
+ fV4(ref.fV4),
+ fV5(ref.fV5),
+ fMaxNumberOfIterations(ref.fMaxNumberOfIterations),
+ fPrecisionPhi(ref.fPrecisionPhi),
+ fUseMCReactionPlane(ref.fUseMCReactionPlane),
+ fSP(ref.fSP),
+ fMCPID(ref.fMCPID),
+ fNoPID(ref.fNoPID),
+ fChi2OverNDFCut(ref.fChi2OverNDFCut),
+ fMaxdca(ref.fMaxdca),
+ fMaxopeningtheta(ref.fMaxopeningtheta),
+ fMaxopeningphi(ref.fMaxopeningphi),
+ fMaxopening3D(ref.fMaxopening3D),
+ fMaxInvmass(ref.fMaxInvmass),
+ fSetMassConstraint(ref.fSetMassConstraint),
+ fMonitorEventPlane(ref.fMonitorEventPlane),
+ fMonitorContamination(ref.fMonitorContamination),
+ fMonitorPhotonic(ref.fMonitorPhotonic),
+ fMonitorWithoutPID(ref.fMonitorWithoutPID),
+ fMonitorTrackCuts(ref.fMonitorTrackCuts),
+ fMonitorQCumulant(ref.fMonitorQCumulant),
+ fcutsRP(NULL),
+ fcutsPOI(NULL),
+ fHFECuts(NULL),
+ fPID(NULL),
+ fPIDTOFOnly(NULL),
+ fPIDqa(NULL),
+ fflowEvent(NULL),
+ fHFEBackgroundCuts(NULL),
+ fPIDBackground(NULL),
+ fPIDBackgroundqa(NULL),
+ fAlgorithmMA(ref.fAlgorithmMA),
+ fArraytrack(NULL),
+ fCounterPoolBackground(ref.fCounterPoolBackground),
+ fHFEVZEROEventPlane(NULL),
+ fHistEV(NULL),
+ fHistPileUp(NULL),
+ fPileUpCut(kFALSE),
+ fEventPlane(NULL),
+ fEventPlaneaftersubtraction(NULL),
+ fFractionContamination(NULL),
+ fContaminationv2(NULL),
+ fCosSin2phiep(NULL),
+ fCos2phie(NULL),
+ fSin2phie(NULL),
+ fCos2phiep(NULL),
+ fSin2phiep(NULL),
+ fSin2phiephiep(NULL),
+ fCosResabc(NULL),
+ fSinResabc(NULL),
+ fProfileCosResab(NULL),
+ fProfileCosResac(NULL),
+ fProfileCosResbc(NULL),
+ fCosRes(NULL),
+ fSinRes(NULL),
+ fProfileCosRes(NULL),
+ fTrackingCuts(NULL),
+ fDeltaPhiMapsBeforePID(NULL),
+ fCosPhiMapsBeforePID(NULL),
+ fDeltaPhiMaps(NULL),
+ fDeltaPhiMapsContamination(NULL),
+ fCosPhiMaps(NULL),
+ fProfileCosPhiMaps(NULL),
+ fDeltaPhiMapsTaggedPhotonic(NULL),
+ //fCosPhiMapsTaggedPhotonic(NULL),
+ fDeltaPhiMapsTaggedNonPhotonic(NULL),
+ //fCosPhiMapsTaggedNonPhotonic(NULL),
+ fDeltaPhiMapsTaggedPhotonicLS(NULL),
+ //fCosPhiMapsTaggedPhotonicLS(NULL),
+ fMCSourceDeltaPhiMaps(NULL),
+ fOppSignDeltaPhiMaps(NULL),
+ fSameSignDeltaPhiMaps(NULL),
+ fOppSignAngle(NULL),
+ fSameSignAngle(NULL),
+ fDebugStreamer(0)
+{
+ //
+ // Copy Constructor
+ //
+
+ for(Int_t k = 0; k < 10; k++) {
+ fBinCentralityLess[k] = 0.0;
+ }
+ for(Int_t k = 0; k < 11; k++) {
+ fContamination[k] = NULL;
+ fv2contamination[k] = NULL;
+ }
+
+
+ ref.Copy(*this);
+}
+
+//____________________________________________________________
+AliAnalysisTaskFlowTPCTOFEPSP &AliAnalysisTaskFlowTPCTOFEPSP::operator=(const AliAnalysisTaskFlowTPCTOFEPSP &ref){
+ //
+ // Assignment operator
+ //
+ if(this == &ref)
+ ref.Copy(*this);
+ return *this;
+}
+
+//____________________________________________________________
+void AliAnalysisTaskFlowTPCTOFEPSP::Copy(TObject &o) const {
+ //
+ // Copy into object o
+ //
+ AliAnalysisTaskFlowTPCTOFEPSP &target = dynamic_cast<AliAnalysisTaskFlowTPCTOFEPSP &>(o);
+ target.fListHist = fListHist;
+ target.fAODAnalysis = fAODAnalysis;
+ target.fFilter = fFilter;
+ target.fAODMCHeader = fAODMCHeader;
+ target.fAODArrayMCInfo = fAODArrayMCInfo;
+ target.fBackgroundSubtraction = fBackgroundSubtraction;
+ target.fVZEROEventPlane = fVZEROEventPlane;
+ target.fVZEROEventPlaneA = fVZEROEventPlaneA;
+ target.fVZEROEventPlaneC = fVZEROEventPlaneC;
+ target.fSubEtaGapTPC = fSubEtaGapTPC;
+ target.fEtaGap = fEtaGap;
+ target.fNbBinsCentralityQCumulant = fNbBinsCentralityQCumulant;
+ target.fNbBinsPtQCumulant = fNbBinsPtQCumulant;
+ target.fMinPtQCumulant = fMinPtQCumulant;
+ target.fMaxPtQCumulant = fMaxPtQCumulant;
+ target.fAfterBurnerOn = fAfterBurnerOn;
+ target.fNonFlowNumberOfTrackClones = fNonFlowNumberOfTrackClones;
+ target.fV1 = fV1;
+ target.fV2 = fV2;
+ target.fV3 = fV3;
+ target.fV4 = fV4;
+ target.fV5 = fV5;
+ target.fMaxNumberOfIterations = fMaxNumberOfIterations;
+ target.fPrecisionPhi = fPrecisionPhi;
+ target.fUseMCReactionPlane = fUseMCReactionPlane;
+ target.fSP = fSP;
+ target.fMCPID = fMCPID;
+ target.fNoPID = fNoPID;
+ target.fChi2OverNDFCut = fChi2OverNDFCut;
+ target.fMaxdca = fMaxdca;
+ target.fMaxopeningtheta = fMaxopeningtheta;
+ target.fMaxopeningphi = fMaxopeningphi;
+ target.fMaxopening3D = fMaxopening3D;
+ target.fMaxInvmass = fMaxInvmass;
+ target.fSetMassConstraint = fSetMassConstraint;
+ target.fMonitorEventPlane = fMonitorEventPlane;
+ target.fMonitorContamination = fMonitorContamination;
+ target.fMonitorPhotonic = fMonitorPhotonic;
+ target.fMonitorWithoutPID = fMonitorWithoutPID;
+ target.fMonitorTrackCuts = fMonitorTrackCuts;
+ target.fMonitorQCumulant = fMonitorQCumulant;
+ target.fcutsRP = fcutsRP;
+ target.fcutsPOI = fcutsPOI;
+ target.fHFECuts = fHFECuts;
+ target.fPID = fPID;
+ target.fPIDTOFOnly = fPIDTOFOnly;
+ target.fPIDqa = fPIDqa;
+ target.fflowEvent = fflowEvent;
+ target.fHFEBackgroundCuts = fHFEBackgroundCuts;
+ target.fPIDBackground = fPIDBackground;
+ target.fPIDBackgroundqa = fPIDBackgroundqa;
+ target.fAlgorithmMA = fAlgorithmMA;
+ target.fArraytrack = fArraytrack;
+ target.fCounterPoolBackground = fCounterPoolBackground;
+ target.fHFEVZEROEventPlane = fHFEVZEROEventPlane;
+ target.fHistEV=fHistEV;
+ target.fHistPileUp=fHistPileUp;
+ target.fPileUpCut=fPileUpCut;
+ target.fEventPlane=fEventPlane;
+ target.fEventPlaneaftersubtraction=fEventPlaneaftersubtraction;
+ target.fFractionContamination=fFractionContamination;
+ target.fContaminationv2=fContaminationv2;
+ target.fCosSin2phiep=fCosSin2phiep;
+ target.fCos2phie=fCos2phie;
+ target.fSin2phie=fSin2phie;
+ target.fCos2phiep=fCos2phiep;
+ target.fSin2phiep=fSin2phiep;
+ target.fSin2phiephiep=fSin2phiephiep;
+ target.fCosResabc=fCosResabc;
+ target.fSinResabc=fSinResabc;
+ target.fProfileCosResab=fProfileCosResab;
+ target.fProfileCosResac=fProfileCosResac;
+ target.fProfileCosResbc=fProfileCosResbc;
+ target.fCosRes=fCosRes;
+ target.fSinRes=fSinRes;
+ target.fProfileCosRes=fProfileCosRes;
+ target.fTrackingCuts=fTrackingCuts;
+ target.fDeltaPhiMapsBeforePID=fDeltaPhiMapsBeforePID;
+ target.fCosPhiMapsBeforePID=fCosPhiMapsBeforePID;
+ target.fDeltaPhiMaps=fDeltaPhiMaps;
+ target.fDeltaPhiMapsContamination=fDeltaPhiMapsContamination;
+ target.fCosPhiMaps=fCosPhiMaps;
+ target.fProfileCosPhiMaps=fProfileCosPhiMaps;
+ target.fDeltaPhiMapsTaggedPhotonic=fDeltaPhiMapsTaggedPhotonic;
+ target.fDeltaPhiMapsTaggedNonPhotonic=fDeltaPhiMapsTaggedNonPhotonic;
+ target.fDeltaPhiMapsTaggedPhotonicLS=fDeltaPhiMapsTaggedPhotonicLS;
+ target.fMCSourceDeltaPhiMaps=fMCSourceDeltaPhiMaps;
+ target.fOppSignDeltaPhiMaps=fOppSignDeltaPhiMaps;
+ target.fSameSignDeltaPhiMaps=fSameSignDeltaPhiMaps;
+ target.fOppSignAngle=fOppSignAngle;
+ target.fSameSignAngle=fSameSignAngle;
+
+
+ for(Int_t k = 0; k < 10; k++) {
+ target.fBinCentralityLess[k] = fBinCentralityLess[k];
+ }
+ for(Int_t k = 0; k < 11; k++) {
+ target.fContamination[k] = fContamination[k];
+ target.fv2contamination[k] = fv2contamination[k];
+ }
+ target.fDebugStreamer=fDebugStreamer;
+}
+//____________________________________________________________
+AliAnalysisTaskFlowTPCTOFEPSP::~AliAnalysisTaskFlowTPCTOFEPSP(){
+ //
+ // Destructor
+ //
+
+
+ if(fArraytrack) delete fArraytrack;
+ if(fListHist) delete fListHist;
+ if(fcutsRP) delete fcutsRP;
+ if(fcutsPOI) delete fcutsPOI;
+ if(fHFECuts) delete fHFECuts;
+ if(fPID) delete fPID;
+ if(fPIDTOFOnly) delete fPIDTOFOnly;
+ //if(fPIDqa) delete fPIDqa;
+ if(fflowEvent) delete fflowEvent;
+ if(fHFEBackgroundCuts) delete fHFEBackgroundCuts;
+ if(fPIDBackground) delete fPIDBackground;
+ //if(fBackgroundSubtraction) delete fBackgroundSubtraction;
+ //if(fPIDBackgroundqa) delete fPIDBackgroundqa;
+ //if(fHFEVZEROEventPlane) delete fHFEVZEROEventPlane;
+ if ( fDebugStreamer ) delete fDebugStreamer;
+
+
+}
+//________________________________________________________________________
+void AliAnalysisTaskFlowTPCTOFEPSP::UserCreateOutputObjects()
+{
+
+ //********************
+ // Create histograms
+ //********************
+
+ //**************
+ // Cuts
+ //**************
+
+ //---------Data selection----------
+ //kMC, kGlobal, kTPCstandalone, kSPDtracklet, kPMD
+ //AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
+ //AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kGlobal;
+
+ //---------Parameter mixing--------
+ //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt
+ //AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;
+ //AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: User create output objects");
+
+
+ // AOD or ESD
+ AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+ if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
+ SetAODAnalysis(kTRUE);
+ AliDebug(2,"Put AOD analysis on");
+ } else {
+ SetAODAnalysis(kFALSE);
+ }
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: AOD ESD");
+
+ // RP TRACK CUTS:
+ fcutsRP = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010();
+ fcutsRP->SetName("StandartTPC");
+ fcutsRP->SetEtaRange(-0.9,0.9);
+ fcutsRP->SetQA(kTRUE);
+ //TList *qaCutsRP = fcutsRP->GetQA();
+ //qaCutsRP->SetName("QA_StandartTPC_RP");
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cutsRP");
+
+ //POI TRACK CUTS:
+ fcutsPOI = new AliFlowTrackCuts("dummy");
+ fcutsPOI->SetParamType(AliFlowTrackCuts::kGlobal);
+ fcutsPOI->SetPtRange(+1,-1); // select nothing QUICK
+ fcutsPOI->SetEtaRange(+1,-1); // select nothing VZERO
+
+ if( fflowEvent ){
+ fflowEvent->~AliFlowEvent();
+ new(fflowEvent) AliFlowEvent(fcutsRP,fcutsPOI);
+ }
+ else fflowEvent = new AliFlowEvent(fcutsRP,fcutsPOI);
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cutsPOI");
+
+ // Flow
+ AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
+ cc->SetNbinsMult(10000);
+ cc->SetMultMin(0);
+ cc->SetMultMax(10000.);
+ cc->SetNbinsPt(fNbBinsPtQCumulant);
+ cc->SetPtMin(fMinPtQCumulant);
+ cc->SetPtMax(fMaxPtQCumulant);
+ cc->SetNbinsPhi(180);
+ cc->SetPhiMin(0.0);
+ cc->SetPhiMax(TMath::TwoPi());
+ cc->SetNbinsEta(200);
+ cc->SetEtaMin(-0.9);
+ cc->SetEtaMax(+0.9);
+ cc->SetNbinsQ(500);
+ cc->SetQMin(0.0);
+ cc->SetQMax(3.0);
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: common constants");
+
+ // HFE cuts
+
+ if(!fHFECuts){
+ fHFECuts = new AliHFEcuts;
+ fHFECuts->CreateStandardCuts();
+ }
+ fHFECuts->Initialize();
+ if(fAODAnalysis) fHFECuts->SetAOD();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: HFE cuts");
+
+
+ // PID HFE
+ //fPID->SetHasMCData(HasMCData());
+ if(!fPID) {
+ fPID =new AliHFEpid("hfePid");
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid init 0");
+ }
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid init 1");
+ if(!fPID->GetNumberOfPIDdetectors()) fPID->AddDetector("TPC", 0);
+ AliDebug(2,Form("AliAnalysisTaskFlowTPCTOFEPSP: GetNumber of PID detectors %d",fPID->GetNumberOfPIDdetectors()));
+ fPID->InitializePID();
+ fPIDqa->Initialize(fPID);
+ fPID->SortDetectors();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid and pidqa");
+
+ if(!fPIDTOFOnly->GetNumberOfPIDdetectors()) {
+ fPIDTOFOnly->AddDetector("TOF", 0);
+ fPIDTOFOnly->ConfigureTOF(3.);
+ }
+ fPIDTOFOnly->InitializePID();
+ fPIDTOFOnly->SortDetectors();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pidtof");
+
+ // HFE Background cuts
+
+ if(!fHFEBackgroundCuts){
+ fHFEBackgroundCuts = new AliESDtrackCuts();
+ fHFEBackgroundCuts->SetName("nackgroundcuts");
+ //Configure Default Track Cuts
+ fHFEBackgroundCuts->SetAcceptKinkDaughters(kFALSE);
+ fHFEBackgroundCuts->SetRequireTPCRefit(kTRUE);
+ fHFEBackgroundCuts->SetEtaRange(-0.9,0.9);
+ fHFEBackgroundCuts->SetRequireSigmaToVertex(kTRUE);
+ fHFEBackgroundCuts->SetMaxChi2PerClusterTPC(4.0);
+ fHFEBackgroundCuts->SetMinNClustersTPC(50);
+ fHFEBackgroundCuts->SetPtRange(0.3,1e10);
+ }
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: hfe background");
+
+ // PID background HFE
+ if(!fPIDBackground->GetNumberOfPIDdetectors()) fPIDBackground->AddDetector("TPC", 0);
+ fPIDBackground->InitializePID();
+ fPIDBackgroundqa->Initialize(fPIDBackground);
+ fPIDBackground->SortDetectors();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: pid background");
+
+ if (fMonitorPhotonic) {
+ if(!fBackgroundSubtraction) fBackgroundSubtraction = new AliHFENonPhotonicElectron();
+ if(fAODAnalysis) fBackgroundSubtraction->SetAOD(kTRUE);
+ fBackgroundSubtraction->Init();
+ }
+
+
+
+ //**************************
+ // Bins for the THnSparse
+ //**************************
+
+ /*
+ Int_t nBinsPt = 44;
+ Double_t minPt = 0.1;
+ Double_t maxPt = 20.0;
+ Double_t binLimLogPt[nBinsPt+1];
+ Double_t binLimPt[nBinsPt+1];
+ for(Int_t i=0; i<=nBinsPt; i++) binLimLogPt[i]=(Double_t)TMath::Log10(minPt) + (TMath::Log10(maxPt)-TMath::Log10(minPt))/nBinsPt*(Double_t)i ;
+ for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);
+ */
+
+ Int_t nBinsPt = 20;
+ Double_t binLimPt[21] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2,
+ 1.3, 1.4, 1.5, 2., 2.5, 3., 4., 6.};
+
+ Int_t nBinsPtPlus = fNbBinsPtQCumulant;
+ Double_t minPtPlus = fMinPtQCumulant;
+ Double_t maxPtPlus = fMaxPtQCumulant;
+ Double_t binLimPtPlus[nBinsPtPlus+1];
+ for(Int_t i=0; i<=nBinsPtPlus; i++) binLimPtPlus[i]=(Double_t)minPtPlus + (maxPtPlus-minPtPlus)/nBinsPtPlus*(Double_t)i ;
+
+ Int_t nBinsEta = 8;
+ Double_t minEta = -0.8;
+ Double_t maxEta = 0.8;
+ Double_t binLimEta[nBinsEta+1];
+ for(Int_t i=0; i<=nBinsEta; i++) binLimEta[i]=(Double_t)minEta + (maxEta-minEta)/nBinsEta*(Double_t)i ;
+
+ Int_t nBinsStep = 6;
+ Double_t minStep = 0.;
+ Double_t maxStep = 6.;
+ Double_t binLimStep[nBinsStep+1];
+ for(Int_t i=0; i<=nBinsStep; i++) binLimStep[i]=(Double_t)minStep + (maxStep-minStep)/nBinsStep*(Double_t)i ;
+
+ Int_t nBinsEtaLess = 2;
+ Double_t binLimEtaLess[nBinsEtaLess+1];
+ for(Int_t i=0; i<=nBinsEtaLess; i++) binLimEtaLess[i]=(Double_t)minEta + (maxEta-minEta)/nBinsEtaLess*(Double_t)i ;
+
+ Int_t nBinsCos = 50;
+ Double_t minCos = -1.0;
+ Double_t maxCos = 1.0;
+ Double_t binLimCos[nBinsCos+1];
+ for(Int_t i=0; i<=nBinsCos; i++) binLimCos[i]=(Double_t)minCos + (maxCos-minCos)/nBinsCos*(Double_t)i ;
+
+ // Int_t nBinsCosSP = 50;
+ // Double_t minCosSP = -100.0;
+ // Double_t maxCosSP = 100.0;
+ // Double_t binLimCosSP[nBinsCosSP+1];
+ // for(Int_t i=0; i<=nBinsCosSP; i++) binLimCosSP[i]=(Double_t)minCosSP + (maxCosSP-minCosSP)/nBinsCosSP*(Double_t)i ;
+
+ Int_t nBinsC = 11;
+ Double_t minC = 0.0;
+ Double_t maxC = 11.0;
+ Double_t binLimC[nBinsC+1];
+ for(Int_t i=0; i<=nBinsC; i++) binLimC[i]=(Double_t)minC + (maxC-minC)/nBinsC*(Double_t)i ;
+
+ Int_t nBinsCMore = 20;
+ Double_t minCMore = 0.0;
+ Double_t maxCMore = 20.0;
+ Double_t binLimCMore[nBinsCMore+1];
+ for(Int_t i=0; i<=nBinsCMore; i++) binLimCMore[i]=(Double_t)minCMore + (maxCMore-minCMore)/nBinsCMore*(Double_t)i ;
+
+ Int_t nBinsCEvenMore = 100;
+ Double_t minCEvenMore = 0.0;
+ Double_t maxCEvenMore = 100.0;
+ Double_t binLimCEvenMore[nBinsCEvenMore+1];
+ for(Int_t i=0; i<=nBinsCEvenMore; i++) binLimCEvenMore[i]=(Double_t)minCEvenMore + (maxCEvenMore-minCEvenMore)/nBinsCEvenMore*(Double_t)i ;
+
+ Int_t nBinsPhi = 8;
+ Double_t minPhi = 0.0;
+ Double_t maxPhi = TMath::Pi();
+ Double_t binLimPhi[nBinsPhi+1];
+ for(Int_t i=0; i<=nBinsPhi; i++) {
+ binLimPhi[i]=(Double_t)minPhi + (maxPhi-minPhi)/nBinsPhi*(Double_t)i ;
+ AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));
+ }
+
+ Int_t nBinsPhiLess = 2.0;
+ Double_t minPhiLess = 0.0;
+ Double_t maxPhiLess = 2.0;
+ Double_t binLimPhiLess[nBinsPhiLess+1];
+ for(Int_t i=0; i<=nBinsPhiLess; i++) {
+ binLimPhiLess[i]=(Double_t)minPhiLess + (maxPhiLess-minPhiLess)/nBinsPhiLess*(Double_t)i ;
+ }
+
+ Int_t nBinsTPCdEdx = 140;
+ Double_t minTPCdEdx = -12.0;
+ Double_t maxTPCdEdx = 12.0;
+ Double_t binLimTPCdEdx[nBinsTPCdEdx+1];
+ for(Int_t i=0; i<=nBinsTPCdEdx; i++) {
+ binLimTPCdEdx[i]=(Double_t)minTPCdEdx + (maxTPCdEdx-minTPCdEdx)/nBinsTPCdEdx*(Double_t)i ;
+ }
+
+ Int_t nBinsAngle = 40;
+ Double_t minAngle = 0.0;
+ Double_t maxAngle = 1.0;
+ Double_t binLimAngle[nBinsAngle+1];
+ for(Int_t i=0; i<=nBinsAngle; i++) {
+ binLimAngle[i]=(Double_t)minAngle + (maxAngle-minAngle)/nBinsAngle*(Double_t)i ;
+ AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));
+ }
+
+ Int_t nBinsCharge = 2;
+ Double_t minCharge = -1.0;
+ Double_t maxCharge = 1.0;
+ Double_t binLimCharge[nBinsCharge+1];
+ for(Int_t i=0; i<=nBinsCharge; i++) binLimCharge[i]=(Double_t)minCharge + (maxCharge-minCharge)/nBinsCharge*(Double_t)i ;
+
+ Int_t nBinsSource = 10;
+ Double_t minSource = 0.;
+ Double_t maxSource = 10.;
+ Double_t binLimSource[nBinsSource+1];
+ for(Int_t i=0; i<=nBinsSource; i++) binLimSource[i]=(Double_t)minSource + (maxSource-minSource)/nBinsSource*(Double_t)i ;
+
+ Int_t nBinsInvMass = 50;
+ Double_t minInvMass = 0.;
+ Double_t maxInvMass = 0.3;
+ Double_t binLimInvMass[nBinsInvMass+1];
+ for(Int_t i=0; i<=nBinsInvMass; i++) binLimInvMass[i]=(Double_t)minInvMass + (maxInvMass-minInvMass)/nBinsInvMass*(Double_t)i ;
+
+ Int_t nBinsMult = 100;
+ Double_t minMult = 0.;
+ Double_t maxMult = 3000;
+ Double_t binLimMult[nBinsMult+1];
+ //for(Int_t i=0; i<=nBinsMult; i++) binLimMult[i]=TMath::Power((Double_t)minMult + (TMath::Sqrt(maxMult)-TMath::Sqrt(minMult))/nBinsMult*(Double_t)i,2);
+ for(Int_t i=0; i<=nBinsMult; i++) binLimMult[i]=(Double_t)minMult + (maxMult-minMult)/nBinsMult*(Double_t)i;
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: variables");
+
+ //******************
+ // Histograms
+ //******************
+
+ fListHist = new TList();
+ fListHist->SetOwner();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: list");
+
+ // Minimum histos
+
+ // Histos
+ fHistEV = new TH2D("fHistEV", "events", 3, 0, 3, 3, 0,3);
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: histev");
+
+ // V0 multiplicity vs # of tracks vs centraliy
+ const Int_t nDimPU=4;
+ Int_t nBinPU[nDimPU] = {nBinsCEvenMore,nBinsCEvenMore,nBinsMult,nBinsMult};
+ fHistPileUp = new THnSparseF("PileUp","PileUp",nDimPU,nBinPU);
+ fHistPileUp->SetBinEdges(0,binLimCEvenMore);
+ fHistPileUp->SetBinEdges(1,binLimCEvenMore);
+ fHistPileUp->SetBinEdges(2,binLimMult);
+ fHistPileUp->SetBinEdges(3,binLimMult);
+ fHistPileUp->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: eventplane");
+
+ // Event plane as function of phiep, centrality
+ const Int_t nDima=4;
+ Int_t nBina[nDima] = {nBinsPhi,nBinsPhi,nBinsPhi,nBinsC};
+ fEventPlane = new THnSparseF("EventPlane","EventPlane",nDima,nBina);
+ fEventPlane->SetBinEdges(0,binLimPhi);
+ fEventPlane->SetBinEdges(1,binLimPhi);
+ fEventPlane->SetBinEdges(2,binLimPhi);
+ fEventPlane->SetBinEdges(3,binLimC);
+ fEventPlane->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: eventplane");
+
+ // Fraction of contamination, centrality
+ const Int_t nDimcont=2;
+ Int_t nBincont[nDimcont] = {nBinsPt,nBinsC};
+ fFractionContamination = new THnSparseF("Contamination","Contamination",nDimcont,nBincont);
+ fFractionContamination->SetBinEdges(0,binLimPt);
+ fFractionContamination->SetBinEdges(1,binLimC);
+ fFractionContamination->Sumw2();
+ //
+ fContaminationv2 = new TProfile2D("Contaminationv2","",nBinsC,binLimC,nBinsPt,binLimPt);
+ fContaminationv2->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: fraction of contamination");
+
+ // Resolution cosres_abc centrality
+ const Int_t nDimfbis=4;
+ Int_t nBinfbis[nDimfbis] = {nBinsCos,nBinsCos,nBinsCos,nBinsCMore};
+ fCosResabc = new THnSparseF("CosRes_abc","CosRes_abc",nDimfbis,nBinfbis);
+ fCosResabc->SetBinEdges(0,binLimCos);
+ fCosResabc->SetBinEdges(1,binLimCos);
+ fCosResabc->SetBinEdges(2,binLimCos);
+ fCosResabc->SetBinEdges(3,binLimCMore);
+ fCosResabc->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosresabc");
+
+ // Resolution cosres centrality
+ const Int_t nDimf=2;
+ Int_t nBinf[nDimf] = {nBinsCos, nBinsCMore};
+ fCosRes = new THnSparseF("CosRes","CosRes",nDimf,nBinf);
+ fCosRes->SetBinEdges(0,binLimCos);
+ fCosRes->SetBinEdges(1,binLimCMore);
+ fCosRes->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosres");
+
+ // Maps delta phi
+ const Int_t nDimg=5;
+ Int_t nBing[nDimg] = {nBinsPhi,nBinsC,nBinsPt, nBinsCharge,nBinsEtaLess};
+ fDeltaPhiMaps = new THnSparseF("DeltaPhiMaps","DeltaPhiMaps",nDimg,nBing);
+ fDeltaPhiMaps->SetBinEdges(0,binLimPhi);
+ fDeltaPhiMaps->SetBinEdges(1,binLimC);
+ fDeltaPhiMaps->SetBinEdges(2,binLimPt);
+ fDeltaPhiMaps->SetBinEdges(3,binLimCharge);
+ fDeltaPhiMaps->SetBinEdges(4,binLimEtaLess);
+ fDeltaPhiMaps->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimaps");
+
+ // Maps cos phi
+ const Int_t nDimh=5;
+ Int_t nBinh[nDimh] = {nBinsCos,nBinsC,nBinsPt,nBinsCharge,nBinsEtaLess};
+ fCosPhiMaps = new THnSparseF("CosPhiMaps","CosPhiMaps",nDimh,nBinh);
+ fCosPhiMaps->SetBinEdges(0,binLimCos);
+ fCosPhiMaps->SetBinEdges(1,binLimC);
+ fCosPhiMaps->SetBinEdges(2,binLimPt);
+ fCosPhiMaps->SetBinEdges(3,binLimCharge);
+ fCosPhiMaps->SetBinEdges(4,binLimEtaLess);
+ fCosPhiMaps->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosphimaps");
+
+ //
+ // fMonitorEventPlane
+ //
+ //
+
+ if(fMonitorEventPlane) {
+ // Event Plane after subtraction as function of phiep, centrality, pt, eta
+ const Int_t nDimb=2;
+ Int_t nBinb[nDimb] = {nBinsPhi, nBinsC};
+ fEventPlaneaftersubtraction = new THnSparseF("EventPlane_aftersubtraction","EventPlane_aftersubtraction",nDimb,nBinb);
+ fEventPlaneaftersubtraction->SetBinEdges(0,binLimPhi);
+ fEventPlaneaftersubtraction->SetBinEdges(1,binLimC);
+ fEventPlaneaftersubtraction->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: eventplane after sub");
+
+ // Monitoring of the event Plane cos(2phi) sin(2phi) centrality
+ const Int_t nDimi=3;
+ Int_t nBini[nDimi] = {nBinsCos, nBinsCos, nBinsCMore};
+ fCosSin2phiep = new THnSparseF("CosSin2phiep","CosSin2phiep",nDimi,nBini);
+ fCosSin2phiep->SetBinEdges(0,binLimCos);
+ fCosSin2phiep->SetBinEdges(1,binLimCos);
+ fCosSin2phiep->SetBinEdges(2,binLimCMore);
+ fCosSin2phiep->Sumw2();
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cossin2phiep");
+
+ // Monitoring Event plane after subtraction of the track
+ const Int_t nDime=4;
+ Int_t nBine[nDime] = {nBinsCos, nBinsC, nBinsPt, nBinsEta};
+ fCos2phie = new THnSparseF("cos2phie","cos2phie",nDime,nBine);
+ fCos2phie->SetBinEdges(2,binLimPt);
+ fCos2phie->SetBinEdges(3,binLimEta);
+ fCos2phie->SetBinEdges(0,binLimCos);
+ fCos2phie->SetBinEdges(1,binLimC);
+ fCos2phie->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cos2phie");
+ fSin2phie = new THnSparseF("sin2phie","sin2phie",nDime,nBine);
+ fSin2phie->SetBinEdges(2,binLimPt);
+ fSin2phie->SetBinEdges(3,binLimEta);
+ fSin2phie->SetBinEdges(0,binLimCos);
+ fSin2phie->SetBinEdges(1,binLimC);
+ fSin2phie->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sin2phie");
+ fCos2phiep = new THnSparseF("cos2phiep","cos2phiep",nDime,nBine);
+ fCos2phiep->SetBinEdges(2,binLimPt);
+ fCos2phiep->SetBinEdges(3,binLimEta);
+ fCos2phiep->SetBinEdges(0,binLimCos);
+ fCos2phiep->SetBinEdges(1,binLimC);
+ fCos2phiep->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cos2phiep");
+ fSin2phiep = new THnSparseF("sin2phiep","sin2phiep",nDime,nBine);
+ fSin2phiep->SetBinEdges(2,binLimPt);
+ fSin2phiep->SetBinEdges(3,binLimEta);
+ fSin2phiep->SetBinEdges(0,binLimCos);
+ fSin2phiep->SetBinEdges(1,binLimC);
+ fSin2phiep->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sin2phiep");
+ fSin2phiephiep = new THnSparseF("sin2phie_phiep","sin2phie_phiep",nDime,nBine);
+ fSin2phiephiep->SetBinEdges(2,binLimPt);
+ fSin2phiephiep->SetBinEdges(3,binLimEta);
+ fSin2phiephiep->SetBinEdges(0,binLimCos);
+ fSin2phiephiep->SetBinEdges(1,binLimC);
+ fSin2phiephiep->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sin2phiephiep");
+
+ const Int_t nDimfbiss=4;
+ Int_t nBinfbiss[nDimfbiss] = {nBinsCos,nBinsCos,nBinsCos,nBinsC};
+ fSinResabc = new THnSparseF("SinRes_abc","SinRes_abc",nDimfbiss,nBinfbiss);
+ fSinResabc->SetBinEdges(0,binLimCos);
+ fSinResabc->SetBinEdges(1,binLimCos);
+ fSinResabc->SetBinEdges(2,binLimCos);
+ fSinResabc->SetBinEdges(3,binLimC);
+ fSinResabc->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sinresabc");
+
+ // Profile cosres centrality with 3 subevents
+ fProfileCosResab = new TProfile("ProfileCosRes_a_b","ProfileCosRes_a_b",nBinsCMore,binLimCMore);
+ fProfileCosResab->Sumw2();
+ fProfileCosResac = new TProfile("ProfileCosRes_a_c","ProfileCosRes_a_c",nBinsCMore,binLimCMore);
+ fProfileCosResac->Sumw2();
+ fProfileCosResbc = new TProfile("ProfileCosRes_b_c","ProfileCosRes_b_c",nBinsCMore,binLimCMore);
+ fProfileCosResbc->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: profilecosresbc");
+
+ //
+ const Int_t nDimff=2;
+ Int_t nBinff[nDimff] = {nBinsCos, nBinsC};
+ fSinRes = new THnSparseF("SinRes","SinRes",nDimff,nBinff);
+ fSinRes->SetBinEdges(0,binLimCos);
+ fSinRes->SetBinEdges(1,binLimC);
+ fSinRes->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: sinres");
+
+ // Profile cosres centrality
+ fProfileCosRes = new TProfile("ProfileCosRes","ProfileCosRes",nBinsCMore,binLimCMore);
+ fProfileCosRes->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: profilecosres");
+
+ // Profile Maps cos phi
+ fProfileCosPhiMaps = new TProfile2D("ProfileCosPhiMaps","ProfileCosPhiMaps",nBinsC,binLimC,nBinsPt,binLimPt);
+ fProfileCosPhiMaps->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: profilecosphimaps");
+
+ }
+ //
+ // fMonitorTrackCuts
+ //
+
+ if(fMonitorTrackCuts) {
+ // Debugging tracking steps
+ const Int_t nDimTrStep=2;
+ Int_t nBinTrStep[nDimTrStep] = {nBinsPt,nBinsStep};
+ fTrackingCuts = new THnSparseF("TrackingCuts","TrackingCuts",nDimTrStep,nBinTrStep);
+ fTrackingCuts->SetBinEdges(0,binLimPt);
+ fTrackingCuts->SetBinEdges(1,binLimStep);
+ fTrackingCuts->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: trackingcuts");
+ }
+
+ //
+ // fMonitorContamination
+ //
+
+ if(fMonitorContamination) {
+ // Maps delta phi contamination
+ const Int_t nDimgcont=4;
+ Int_t nBingcont[nDimgcont] = {nBinsPhiLess,nBinsC,nBinsPt, nBinsTPCdEdx};
+ fDeltaPhiMapsContamination = new THnSparseF("DeltaPhiMapsContamination","DeltaPhiMapsContamination",nDimgcont,nBingcont);
+ fDeltaPhiMapsContamination->SetBinEdges(0,binLimPhiLess);
+ fDeltaPhiMapsContamination->SetBinEdges(1,binLimC);
+ fDeltaPhiMapsContamination->SetBinEdges(2,binLimPt);
+ fDeltaPhiMapsContamination->SetBinEdges(3,binLimTPCdEdx);
+ fDeltaPhiMapsContamination->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapscontamination");
+
+ }
+ //
+ // fMonitorWithoutPID
+ //
+
+ if(fMonitorWithoutPID) {
+ //
+ const Int_t nDimgb=3;
+ Int_t nBingb[nDimgb] = {nBinsPhi,nBinsC,nBinsPt};
+
+ fDeltaPhiMapsBeforePID = new THnSparseF("DeltaPhiMapsBeforePID","DeltaPhiMapsBeforePID",nDimgb,nBingb);
+ fDeltaPhiMapsBeforePID->SetBinEdges(0,binLimPhi);
+ fDeltaPhiMapsBeforePID->SetBinEdges(1,binLimC);
+ fDeltaPhiMapsBeforePID->SetBinEdges(2,binLimPt);
+ fDeltaPhiMapsBeforePID->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapsbeforepid");
+
+ const Int_t nDimhb=3;
+ Int_t nBinhb[nDimhb] = {nBinsCos,nBinsC,nBinsPt};
+
+ fCosPhiMapsBeforePID = new THnSparseF("CosPhiMapsBeforePID","CosPhiMapsBeforePID",nDimhb,nBinhb);
+ fCosPhiMapsBeforePID->SetBinEdges(0,binLimCos);
+ fCosPhiMapsBeforePID->SetBinEdges(1,binLimC);
+ fCosPhiMapsBeforePID->SetBinEdges(2,binLimPt);
+ fCosPhiMapsBeforePID->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: cosphimapsbeforepid");
+ }
+ //
+ // fMonitorPhotonic
+ //
+
+ if(fMonitorPhotonic) {
+
+ const Int_t nDimgbp=3;
+ Int_t nBingbp[nDimgbp] = {nBinsPhi,nBinsC,nBinsPt};
+
+ fDeltaPhiMapsTaggedPhotonic = new THnSparseF("DeltaPhiMapsTaggedPhotonic","DeltaPhiMapsTaggedPhotonic",nDimgbp,nBingbp);
+ fDeltaPhiMapsTaggedPhotonic->SetBinEdges(0,binLimPhi);
+ fDeltaPhiMapsTaggedPhotonic->SetBinEdges(1,binLimC);
+ fDeltaPhiMapsTaggedPhotonic->SetBinEdges(2,binLimPt);
+ fDeltaPhiMapsTaggedPhotonic->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapstaggedphotonic");
+
+ fDeltaPhiMapsTaggedNonPhotonic = new THnSparseF("DeltaPhiMapsTaggedNonPhotonic","DeltaPhiMapsTaggedNonPhotonic",nDimgbp,nBingbp);
+ fDeltaPhiMapsTaggedNonPhotonic->SetBinEdges(0,binLimPhi);
+ fDeltaPhiMapsTaggedNonPhotonic->SetBinEdges(1,binLimC);
+ fDeltaPhiMapsTaggedNonPhotonic->SetBinEdges(2,binLimPt);
+ fDeltaPhiMapsTaggedNonPhotonic->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapstaggednonphotonic");
+
+ fDeltaPhiMapsTaggedPhotonicLS = new THnSparseF("DeltaPhiMapsTaggedPhotonicLS","DeltaPhiMapsTaggedPhotonicLS",nDimgbp,nBingbp);
+ fDeltaPhiMapsTaggedPhotonicLS->SetBinEdges(0,binLimPhi);
+ fDeltaPhiMapsTaggedPhotonicLS->SetBinEdges(1,binLimC);
+ fDeltaPhiMapsTaggedPhotonicLS->SetBinEdges(2,binLimPt);
+ fDeltaPhiMapsTaggedPhotonicLS->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: deltaphimapstaggedphotonicls");
+
+ const Int_t nDimMCSource=3;
+ Int_t nBinMCSource[nDimMCSource] = {nBinsC,nBinsPt,nBinsSource};
+ fMCSourceDeltaPhiMaps = new THnSparseF("MCSourceDeltaPhiMaps","MCSourceDeltaPhiMaps",nDimMCSource,nBinMCSource);
+ fMCSourceDeltaPhiMaps->SetBinEdges(0,binLimC);
+ fMCSourceDeltaPhiMaps->SetBinEdges(1,binLimPt);
+ fMCSourceDeltaPhiMaps->SetBinEdges(2,binLimSource);
+ fMCSourceDeltaPhiMaps->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: mcsourcedeltaphimaps");
+
+ // Maps invmass opposite
+ const Int_t nDimOppSign=5;
+ Int_t nBinOppSign[nDimOppSign] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource};
+ fOppSignDeltaPhiMaps = new THnSparseF("OppSignDeltaPhiMaps","OppSignDeltaPhiMaps",nDimOppSign,nBinOppSign);
+ fOppSignDeltaPhiMaps->SetBinEdges(0,binLimPhi);
+ fOppSignDeltaPhiMaps->SetBinEdges(1,binLimC);
+ fOppSignDeltaPhiMaps->SetBinEdges(2,binLimPt);
+ fOppSignDeltaPhiMaps->SetBinEdges(3,binLimInvMass);
+ fOppSignDeltaPhiMaps->SetBinEdges(4,binLimSource);
+ fOppSignDeltaPhiMaps->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: oppsigndeltaphimaps");
+
+ // Maps invmass same sign
+ const Int_t nDimSameSign=5;
+ Int_t nBinSameSign[nDimSameSign] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource};
+ fSameSignDeltaPhiMaps = new THnSparseF("SameSignDeltaPhiMaps","SameSignDeltaPhiMaps",nDimSameSign,nBinSameSign);
+ fSameSignDeltaPhiMaps->SetBinEdges(0,binLimPhi);
+ fSameSignDeltaPhiMaps->SetBinEdges(1,binLimC);
+ fSameSignDeltaPhiMaps->SetBinEdges(2,binLimPt);
+ fSameSignDeltaPhiMaps->SetBinEdges(3,binLimInvMass);
+ fSameSignDeltaPhiMaps->SetBinEdges(4,binLimSource);
+ fSameSignDeltaPhiMaps->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: samesigndeltaphimaps");
+
+ // Maps angle same sign
+ const Int_t nDimAngleSameSign=3;
+ Int_t nBinAngleSameSign[nDimAngleSameSign] = {nBinsAngle,nBinsC,nBinsSource};
+ fSameSignAngle = new THnSparseF("SameSignAngleMaps","SameSignAngleMaps",nDimAngleSameSign,nBinAngleSameSign);
+ fSameSignAngle->SetBinEdges(0,binLimAngle);
+ fSameSignAngle->SetBinEdges(1,binLimC);
+ fSameSignAngle->SetBinEdges(2,binLimSource);
+ fSameSignAngle->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: samesignangle");
+
+ // Maps angle opp sign
+ const Int_t nDimAngleOppSign=3;
+ Int_t nBinAngleOppSign[nDimAngleOppSign] = {nBinsAngle,nBinsC,nBinsSource};
+ fOppSignAngle = new THnSparseF("OppSignAngleMaps","OppSignAngleMaps",nDimAngleOppSign,nBinAngleOppSign);
+ fOppSignAngle->SetBinEdges(0,binLimAngle);
+ fOppSignAngle->SetBinEdges(1,binLimC);
+ fOppSignAngle->SetBinEdges(2,binLimSource);
+ fOppSignAngle->Sumw2();
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: oppsignangle");
+
+ }
+
+ //**************************
+ // Add to the list
+ //******************************
+
+ fListHist->Add(fHistEV);
+ fListHist->Add(fHistPileUp);
+ fListHist->Add(fEventPlane);
+ fListHist->Add(fFractionContamination);
+ fListHist->Add(fCosRes);
+ fListHist->Add(fCosResabc);
+ fListHist->Add(fCosPhiMaps);
+ fListHist->Add(fDeltaPhiMaps);
+ fListHist->Add(fPIDqa->MakeList("HFEpidQA"));
+ fListHist->Add(fContaminationv2);
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add default");
+
+ if(fMonitorEventPlane) {
+ fListHist->Add(fProfileCosRes);
+ fListHist->Add(fProfileCosResab);
+ fListHist->Add(fProfileCosResac);
+ fListHist->Add(fProfileCosResbc);
+ fListHist->Add(fCosSin2phiep);
+ fListHist->Add(fCos2phie);
+ fListHist->Add(fSin2phie);
+ fListHist->Add(fCos2phiep);
+ fListHist->Add(fSin2phiep);
+ fListHist->Add(fSin2phiephiep);
+ fListHist->Add(fSinRes);
+ fListHist->Add(fSinResabc);
+ fListHist->Add(fProfileCosPhiMaps);
+ }
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add monitor");
+
+ if(fMonitorTrackCuts) fListHist->Add(fTrackingCuts);
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add monitortrackcuts");
+
+ if(fMonitorContamination) {
+ fListHist->Add(fDeltaPhiMapsContamination);
+ }
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add deltaphimapscontamination");
+
+ if(fMonitorWithoutPID) {
+ fListHist->Add(fDeltaPhiMapsBeforePID);
+ fListHist->Add(fCosPhiMapsBeforePID);
+ }
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add without pid");
+
+ if(fMonitorPhotonic) {
+ fListHist->Add(fPIDBackgroundqa->MakeList("HFEpidBackgroundQA"));
+ fListHist->Add(fDeltaPhiMapsTaggedPhotonic);
+ fListHist->Add(fDeltaPhiMapsTaggedNonPhotonic);
+ fListHist->Add(fDeltaPhiMapsTaggedPhotonicLS);
+ fListHist->Add(fMCSourceDeltaPhiMaps);
+ fListHist->Add(fOppSignDeltaPhiMaps);
+ fListHist->Add(fSameSignDeltaPhiMaps);
+ fListHist->Add(fSameSignAngle);
+ fListHist->Add(fOppSignAngle);
+ fListHist->Add(fBackgroundSubtraction->GetListOutput());
+ }
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add photonic");
+
+ if(fHFEVZEROEventPlane && fMonitorEventPlane) fListHist->Add(fHFEVZEROEventPlane->GetOutputList());
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: add event plane");
+
+ fListHist->Print();
+
+ PostData(1, fListHist);
+ //for(Int_t bincless = 0; bincless < fNbBinsCentralityQCumulant; bincless++) {
+ // PostData(bincless+2,fflowEvent);
+ //}
+
+ AliDebug(2,"AliAnalysisTaskFlowTPCTOFEPSP: post");
+
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskFlowTPCTOFEPSP::UserExec(Option_t */*option*/)
+{
+ //
+ // Loop over event
+ //
+
+
+ Double_t massElectron = 0.000511;
+ Double_t mcReactionPlane = 0.0;
+
+ Float_t cntr = 0.0;
+ Double_t binct = 11.5;
+ Double_t binctMore = 20.5;
+ Double_t binctLess = -0.5;
+ Float_t binctt = -1.0;
+
+ Double_t valuecossinephiep[3];
+ Double_t valuensparsea[4];
+ Double_t valuensparseabis[5];
+ Double_t valuensparsee[4];
+ Double_t valuensparsef[2];
+ Double_t valuensparsefsin[2];
+ Double_t valuensparsefbis[4];
+ Double_t valuensparsefbissin[4];
+ Double_t valuensparseg[5];
+ Double_t valuensparseh[5];
+ Double_t valuensparsehprofile[3];
+ Double_t valuensparseMCSourceDeltaPhiMaps[3];
+ Double_t valuetrackingcuts[2];
+ Double_t valuedeltaphicontamination[4];
+ Double_t valuefractioncont[2];
+
+ AliMCEvent *mcEvent = MCEvent();
+ AliMCParticle *mctrack = NULL;
+
+ // MC info
+ Bool_t mcthere = kTRUE;
+ if(fAODAnalysis) {
+ AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent);
+ if(!aodE){
+ // printf("testd\n");
+ AliError("No AOD Event");
+ return;
+ }
+ fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName()));
+ if(!fAODMCHeader){
+ mcthere = kFALSE;
+ }
+ fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+ if(!fAODArrayMCInfo){
+ mcthere = kFALSE;
+ }
+ else {
+ fHFECuts->SetMCEvent(aodE);
+ if(fMonitorPhotonic) fBackgroundSubtraction->SetAODArrayMCInfo(fAODArrayMCInfo);
+ }
+ }
+ else {
+ AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+ if(!mcH) mcthere = kFALSE;
+ else {
+ if(fMonitorPhotonic) fBackgroundSubtraction->SetMCEvent(fMCEvent);
+ }
+ }
+
+
+ /////////////////
+ // centrality
+ /////////////////
+
+ //AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
+ //if(!esd) return;
+ AliCentrality *centrality = fInputEvent->GetCentrality();
+ //AliDebug(2,"Got the centrality");
+ if(!centrality) return;
+ cntr = centrality->GetCentralityPercentile("V0M");
+ if((0.0< cntr) && (cntr<5.0)) binct = 0.5;
+ if((5.0< cntr) && (cntr<10.0)) binct = 1.5;
+ if((10.0< cntr) && (cntr<20.0)) binct = 2.5;
+ if((20.0< cntr) && (cntr<30.0)) binct = 3.5;
+ if((30.0< cntr) && (cntr<40.0)) binct = 4.5;
+ if((40.0< cntr) && (cntr<50.0)) binct = 5.5;
+ if((50.0< cntr) && (cntr<60.0)) binct = 6.5;
+ if((60.0< cntr) && (cntr<70.0)) binct = 7.5;
+ if((70.0< cntr) && (cntr<80.0)) binct = 8.5;
+ if((80.0< cntr) && (cntr<90.0)) binct = 9.5;
+ if((90.0< cntr) && (cntr<100.0)) binct = 10.5;
+
+ if((0.< cntr) && (cntr < 20.)) binctt = 0.5;
+ if((20.< cntr) && (cntr < 40.)) binctt = 1.5;
+ if((40.< cntr) && (cntr < 80.)) binctt = 2.5;
+
+ if((0.0< cntr) && (cntr<5.0)) binctMore = 0.5;
+ if((5.0< cntr) && (cntr<10.0)) binctMore = 1.5;
+ if((10.0< cntr) && (cntr<15.0)) binctMore = 2.5;
+ if((15.0< cntr) && (cntr<20.0)) binctMore = 3.5;
+ if((20.0< cntr) && (cntr<25.0)) binctMore = 4.5;
+ if((25.0< cntr) && (cntr<30.0)) binctMore = 5.5;
+ if((30.0< cntr) && (cntr<35.0)) binctMore = 6.5;
+ if((35.0< cntr) && (cntr<40.0)) binctMore = 7.5;
+ if((40.0< cntr) && (cntr<45.0)) binctMore = 8.5;
+ if((45.0< cntr) && (cntr<50.0)) binctMore = 9.5;
+ if((50.0< cntr) && (cntr<55.0)) binctMore = 10.5;
+ if((55.0< cntr) && (cntr<60.0)) binctMore = 11.5;
+ if((60.0< cntr) && (cntr<65.0)) binctMore = 12.5;
+ if((65.0< cntr) && (cntr<70.0)) binctMore = 13.5;
+ if((70.0< cntr) && (cntr<75.0)) binctMore = 14.5;
+ if((75.0< cntr) && (cntr<80.0)) binctMore = 15.5;
+ if((80.0< cntr) && (cntr<85.0)) binctMore = 16.5;
+ if((85.0< cntr) && (cntr<90.0)) binctMore = 17.5;
+ if((90.0< cntr) && (cntr<95.0)) binctMore = 18.5;
+ if((95.0< cntr) && (cntr<100.0)) binctMore = 19.5;
+
+ binctLess = cntr;
+
+
+ if(binct > 11.0) return;
+
+ // centrality
+ valuensparsea[3] = binct;
+ valuensparseabis[1] = binct;
+ valuensparsee[1] = binct;
+ valuensparsef[1] = binctMore;
+ valuensparsefsin[1] = binct;
+ valuensparsefbis[3] = binctMore;
+ valuensparsefbissin[3] = binct;
+ valuensparseg[1] = binct;
+ valuensparseh[1] = binct;
+ valuefractioncont[1] = binct;
+ valuensparsehprofile[1] = binct;
+ valuecossinephiep[2] = binctMore;
+ valuensparseMCSourceDeltaPhiMaps[0] = binct;
+ valuedeltaphicontamination[1] = binct;
+
+ //////////////////////
+ // run number
+ //////////////////////
+
+ Int_t runnumber = fInputEvent->GetRunNumber();
+ AliDebug(2,Form("Run number %d",runnumber));
+
+ if(!fPID->IsInitialized()){
+ // Initialize PID with the given run number
+ fPID->InitializePID(runnumber);
+ }
+ if(!fPIDTOFOnly->IsInitialized()){
+ // Initialize PID with the given run number
+ fPIDTOFOnly->InitializePID(runnumber);
+ }
+
+ //
+ if(!fPIDBackground->IsInitialized()){
+ // Initialize PID with the given run number
+ fPIDBackground->InitializePID(runnumber);
+ }
+
+ fHFECuts->SetRecEvent(fInputEvent);
+ if(mcEvent) fHFECuts->SetMCEvent(mcEvent);
+
+
+ //////////
+ // PID
+ //////////
+
+ AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
+ if(!pidResponse){
+ AliDebug(2,"No PID response set");
+ return;
+ }
+ fPID->SetPIDResponse(pidResponse);
+ fPIDTOFOnly->SetPIDResponse(pidResponse);
+ fPIDBackground->SetPIDResponse(pidResponse);
+ if(fMonitorPhotonic) fBackgroundSubtraction->InitRun(fInputEvent,pidResponse);
+
+ fHistEV->Fill(binctt,0.0);
+
+ //////////////////
+ // Event cut
+ //////////////////
+ if(!fHFECuts->CheckEventCuts("fEvRecCuts", fInputEvent)) {
+ AliDebug(2,"Does not pass the event cut");
+ PostData(1, fListHist);
+ return;
+ }
+
+ fHistEV->Fill(binctt,1.0);
+
+
+ ///////////////////////////////////////////////////////////
+ // PileUpCut
+ ///////////////////////////////////////////////////////////
+
+ Float_t multTPC(0.); // tpc mult estimate
+ Float_t multGlob(0.); // global multiplicity
+ const Int_t nGoodTracks = fInputEvent->GetNumberOfTracks();
+ for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult
+ AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(fInputEvent->GetTrack(iTracks));
+ if (!trackAOD) continue;
+ if (!(trackAOD->TestFilterBit(1))) continue;
+ if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.2)) continue;
+ multTPC++;
+ }
+ for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult
+ AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(fInputEvent->GetTrack(iTracks));
+ if (!trackAOD) continue;
+ if (!(trackAOD->TestFilterBit(16))) continue;
+ if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.1)) continue;
+ Double_t b[2] = {-99., -99.};
+ Double_t bCov[3] = {-99., -99., -99.};
+ if (!(trackAOD->PropagateToDCA(fInputEvent->GetPrimaryVertex(), fInputEvent->GetMagneticField(), 100., b, bCov))) continue;
+ if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;
+ multGlob++;
+ } //track loop
+
+ Double_t pileup[4];
+ pileup[0]=fInputEvent->GetCentrality()->GetCentralityPercentile("V0M");
+ pileup[1]=fInputEvent->GetCentrality()->GetCentralityPercentile("TRK");
+ pileup[2]=multTPC;
+ pileup[3]=multGlob;
+ fHistPileUp->Fill(pileup);
+
+ if(fPileUpCut){
+ if (TMath::Abs(pileup[0]-pileup[1]) > 5) {
+ AliDebug(2,"Does not pass the centrality correlation cut");
+ return;
+ }
+ if(multTPC < (-36.81+1.48*multGlob) && multTPC > (63.03+1.78*multGlob)){
+ AliDebug(2,"Does not pass the multiplicity correlation cut");
+ return;
+ }
+ }
+
+ // AliVVZERO* vzeroData=fInputEvent->GetVZEROData();
+ // Double_t mult[3],multV0A(0),multV0C(0);
+ // for(Int_t i=0; i<32; ++i) {
+ // multV0A += vzeroData->GetMultiplicityV0A(i);
+ // multV0C += vzeroData->GetMultiplicityV0C(i);
+ // }
+
+ // int ntrk=0;
+ // for(Int_t k = 0; k < fInputEvent->GetNumberOfTracks(); k++){
+ // AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);
+ // if(!track) continue;
+ // if(!(track->GetStatus()&AliVTrack::kITSrefit)) continue;
+ // if(!(track->GetStatus()&AliVTrack::kTPCrefit)) continue;
+ // ntrk++;
+ // }
+
+ // mult[0]=fInputEvent->GetNumberOfTracks();
+ // mult[1]=multV0A+multV0C;
+ // mult[2]=binctMore;
+ // fHistPileUp->Fill(mult);
+
+ // if(fUpperPileUpCut&&fLowerPileUpCut){
+ // if((mult[0]<fLowerPileUpCut->Eval(mult[1])) ||
+ // (mult[0]>fUpperPileUpCut->Eval(mult[1]))){
+ // AliDebug(2,"Does not pass the pileup cut");
+ // PostData(1, fListHist);
+ // return;
+ // }
+ // }
+
+ ////////////////////////////////////
+ // First method event plane
+ ////////////////////////////////////
+
+ AliEventplane* vEPa = fInputEvent->GetEventplane();
+ Float_t eventPlanea = 0.0;
+ Float_t eventPlaneTPC = 0.0;
+ Float_t eventPlaneV0A = 0.0;
+ Float_t eventPlaneV0C = 0.0;
+ Float_t eventPlaneV0 = 0.0;
+ TVector2 *qTPC = 0x0;
+ TVector2 *qsub1a = 0x0;
+ TVector2 *qsub2a = 0x0;
+ TVector2 qV0A,qV0C,qV0,*qAna;
+
+ // V0
+
+ if(fHFEVZEROEventPlane && (!fAODAnalysis)){
+
+ //AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
+ //if(!esd) return;
+
+ fHFEVZEROEventPlane->ProcessEvent(fInputEvent);
+
+ if(TMath::Abs(fHFEVZEROEventPlane->GetEventPlaneV0A()+100) < 0.0000001) eventPlaneV0A = -100.0;
+ else {
+ eventPlaneV0A = TVector2::Phi_0_2pi(fHFEVZEROEventPlane->GetEventPlaneV0A());
+ if(eventPlaneV0A > TMath::Pi()) eventPlaneV0A = eventPlaneV0A - TMath::Pi();
+ }
+
+ if(TMath::Abs(fHFEVZEROEventPlane->GetEventPlaneV0C()+100) < 0.0000001) eventPlaneV0C = -100.0;
+ else {
+ eventPlaneV0C = TVector2::Phi_0_2pi(fHFEVZEROEventPlane->GetEventPlaneV0C());
+ if(eventPlaneV0C > TMath::Pi()) eventPlaneV0C = eventPlaneV0C - TMath::Pi();
+ }
+
+ if(TMath::Abs(fHFEVZEROEventPlane->GetEventPlaneV0()+100) < 0.0000001) eventPlaneV0 = -100.0;
+ else {
+ eventPlaneV0 = TVector2::Phi_0_2pi(fHFEVZEROEventPlane->GetEventPlaneV0());
+ if(eventPlaneV0 > TMath::Pi()) eventPlaneV0 = eventPlaneV0 - TMath::Pi();
+ }
+
+ }
+ else {
+
+ Double_t qVx, qVy; //TR: info
+ eventPlaneV0 = TVector2::Phi_0_2pi(vEPa->CalculateVZEROEventPlane(fInputEvent,10,2,qVx,qVy));
+ if(eventPlaneV0 > TMath::Pi()) eventPlaneV0 = eventPlaneV0 - TMath::Pi();
+ qV0.Set(qVx,qVy);
+ eventPlaneV0A = TVector2::Phi_0_2pi(vEPa->CalculateVZEROEventPlane(fInputEvent,8,2,qVx,qVy));
+ if(eventPlaneV0A > TMath::Pi()) eventPlaneV0A = eventPlaneV0A - TMath::Pi();
+ qV0A.Set(qVx,qVy);
+ eventPlaneV0C = TVector2::Phi_0_2pi(vEPa->CalculateVZEROEventPlane(fInputEvent,9,2,qVx,qVy));
+ if(eventPlaneV0C > TMath::Pi()) eventPlaneV0C = eventPlaneV0C - TMath::Pi();
+ qV0C.Set(qVx,qVy);
+
+ if(eventPlaneV0<-900) return;
+ if(eventPlaneV0A<-900) return;
+ if(eventPlaneV0C<-900) return;
+
+
+ eventPlaneV0=TVector2::Phi_0_2pi(eventPlaneV0);
+ eventPlaneV0A=TVector2::Phi_0_2pi(eventPlaneV0A);
+ eventPlaneV0C=TVector2::Phi_0_2pi(eventPlaneV0C);
+ }
+
+
+ // TPC
+
+ qTPC = vEPa->GetQVector();
+ Double_t qx = -1.0;
+ Double_t qy = -1.0;
+ if(qTPC) {
+ qx = qTPC->X();
+ qy = qTPC->Y();
+ }
+ TVector2 qVectorfortrack;
+ qVectorfortrack.Set(qx,qy);
+ eventPlaneTPC = TVector2::Phi_0_2pi(qVectorfortrack.Phi())/2.;
+
+ // Choose the one used for v2
+
+ if(fVZEROEventPlane){ //TR: info
+ eventPlanea = eventPlaneV0;
+ qAna = &qV0;
+ }
+ if(fVZEROEventPlaneA){
+ eventPlanea = eventPlaneV0A;
+ qAna = &qV0A;
+ }
+ if(fVZEROEventPlaneC){
+ eventPlanea = eventPlaneV0C;
+ qAna = &qV0C;
+ }
+ if(!fVZEROEventPlane){
+ eventPlanea = eventPlaneTPC;
+ qAna = &qV0C;
+ }
+
+ valuecossinephiep[0] = TMath::Cos(2*eventPlanea);
+ valuecossinephiep[1] = TMath::Sin(2*eventPlanea);
+
+ Float_t eventPlanesub1a = -100.0;
+ Float_t eventPlanesub2a = -100.0;
+ Double_t diffsub1sub2a = -100.0;
+ Double_t diffsub1sub2asin = -100.0;
+ Double_t diffsubasubb = -100.0;
+ Double_t diffsubasubc = -100.0;
+ Double_t diffsubbsubc = -100.0;
+ Double_t diffsubasubbsin = -100.0;
+ Double_t diffsubasubcsin = -100.0;
+ Double_t diffsubbsubcsin = -100.0;
+
+ // two sub event TPC
+ qsub1a = vEPa->GetQsub1();
+ qsub2a = vEPa->GetQsub2();
+
+ /////////////////////////////////////////////////////////
+ // Cut for event with event plane reconstructed by all
+ ////////////////////////////////////////////////////////
+
+ if((!qTPC) || (!qsub1a) || (!qsub2a)) {
+ AliDebug(2,"No event plane");
+ return;
+ }
+
+ eventPlanesub1a = TVector2::Phi_0_2pi(qsub1a->Phi())/2.;
+ eventPlanesub2a = TVector2::Phi_0_2pi(qsub2a->Phi())/2.;
+ diffsub1sub2a = TMath::Cos(2.*TVector2::Phi_0_2pi(qsub1a->Phi()/2.- qsub2a->Phi()/2.));
+ diffsub1sub2asin = TMath::Sin(2.*TVector2::Phi_0_2pi(qsub1a->Phi()/2.- qsub2a->Phi()/2.));
+
+
+ // if ( !fDebugStreamer ) {
+ // //debug stream
+ // TDirectory *backup = gDirectory;
+ // fDebugStreamer = new TTreeSRedirector("TaskFlowTPCTOFEPSPdebug.root");
+ // if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
+ // }
+
+ // {
+
+ // double v0nrom = TMath::Sqrt(qV0.X()*qV0.X()+qV0.Y()*qV0.Y());
+ // double v0Anrom = TMath::Sqrt(qV0A.X()*qV0A.X()+qV0A.Y()*qV0A.Y());
+ // double v0Cnrom = TMath::Sqrt(qV0C.X()*qV0C.X()+qV0C.Y()*qV0C.Y());
+ // double sub1nrom = TMath::Sqrt(qsub1a->X()*qsub1a->X()+qsub1a->Y()*qsub1a->Y());
+ // double sub2nrom = TMath::Sqrt(qsub2a->X()*qsub2a->X()+qsub2a->Y()*qsub2a->Y());
+
+ // (* fDebugStreamer) << "UserExec" <<
+ // "binct="<<binct<<
+ // "qV0="<<v0nrom<<
+ // "qV0A="<<v0Anrom<<
+ // "qV0C="<<v0Cnrom<<
+ // "qsub1a="<<sub1nrom<<
+ // "qsub2a="<<sub2nrom<<
+ // "\n";
+ // }
+
+ // three sub events in case of VZEROA and VZEROC
+ if(!fSP){
+ diffsubasubb = TMath::Cos(2.*(eventPlaneV0A - eventPlaneV0C)); //TR:
+ diffsubasubc = TMath::Cos(2.*(eventPlaneV0A - eventPlaneTPC)); //TR:
+ diffsubbsubc = TMath::Cos(2.*(eventPlaneV0C - eventPlaneTPC)); //TR:
+ }
+ else{
+ if(fVZEROEventPlaneA){
+ diffsubasubb = qV0A.X()*qV0C.X()+qV0A.Y()*qV0C.Y();
+ diffsubasubc = qV0A.X()*qTPC->X()+qV0A.Y()*qTPC->Y();
+ diffsubbsubc = qV0C.X()*qTPC->X()+qV0C.Y()*qTPC->Y();
+ }
+ else if(fVZEROEventPlaneC){
+ diffsubasubb = qV0C.X()*qV0A.X()+qV0C.Y()*qV0A.Y();
+ diffsubasubc = qV0C.X()*qTPC->X()+qV0C.Y()*qTPC->Y();
+ diffsubbsubc = qV0A.X()*qTPC->X()+qV0A.Y()*qTPC->Y();
+ }
+ }
+
+ diffsubasubbsin = TMath::Sin(2.*(eventPlaneV0A - eventPlaneV0C));
+ diffsubasubcsin = TMath::Sin(2.*(eventPlaneV0A - eventPlaneTPC));
+ diffsubbsubcsin = TMath::Sin(2.*(eventPlaneV0C - eventPlaneTPC));
+ // three sub events in case of VZERO all
+ if(fVZEROEventPlane && (!fVZEROEventPlaneA) && (!fVZEROEventPlaneC)) {
+ if(!fSP){
+ diffsubasubb = TMath::Cos(2.*(eventPlaneV0 - eventPlanesub1a)); //TR:
+ diffsubasubc = TMath::Cos(2.*(eventPlaneV0 - eventPlanesub2a)); //TR:
+ diffsubbsubc = TMath::Cos(2.*(eventPlanesub1a - eventPlanesub2a)); //TR:
+ }
+ else{
+ diffsubasubb = qV0.X()*qsub1a->X()+qV0.Y()*qsub1a->Y();
+ diffsubasubc = qV0.X()*qsub2a->X()+qV0.Y()*qsub2a->Y();
+ diffsubbsubc = qsub1a->X()*qsub2a->X()+qsub1a->Y()*qsub2a->Y();
+ }
+
+ diffsubasubbsin = TMath::Sin(2.*(eventPlaneV0 - eventPlanesub1a));
+ diffsubasubcsin = TMath::Sin(2.*(eventPlaneV0 - eventPlanesub2a));
+ diffsubbsubcsin = TMath::Sin(2.*(eventPlanesub1a - eventPlanesub2a));
+ }
+
+ //////////////////////////////////////
+ // AliFlowEvent and MC event plane
+ /////////////////////////////////////
+
+ Int_t nbtracks = fInputEvent->GetNumberOfTracks();
+ AliDebug(2,Form("Number of tracks %d",nbtracks));
+
+ if(fMonitorQCumulant) {
+
+ fcutsRP->SetEvent( InputEvent(), MCEvent());
+ fcutsPOI->SetEvent( InputEvent(), MCEvent());
+ if( fflowEvent ){
+ fflowEvent->~AliFlowEvent();
+ new(fflowEvent) AliFlowEvent(fcutsRP,fcutsPOI);
+ }else fflowEvent = new AliFlowEvent(fcutsRP,fcutsPOI);
+ if(mcEvent && mcEvent->GenEventHeader()) {
+ fflowEvent->SetMCReactionPlaneAngle(mcEvent);
+ //if reaction plane not set from elsewhere randomize it before adding flow
+ //if (!fflowEvent->IsSetMCReactionPlaneAngle()) fflowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
+ mcReactionPlane = TVector2::Phi_0_2pi(fflowEvent->GetMCReactionPlaneAngle());
+ if(mcReactionPlane > TMath::Pi()) mcReactionPlane = mcReactionPlane - TMath::Pi();
+ AliDebug(2,Form("MC reaction plane %f",mcReactionPlane));
+ }
+ fflowEvent->SetReferenceMultiplicity( nbtracks );
+ fflowEvent->DefineDeadZone(0,0,0,0);
+ //fflowEvent.TagSubeventsInEta(-0.8,-0.1,0.1,0.8);
+
+ ////////////////
+ // MC
+ ///////////////
+ if(fUseMCReactionPlane) {
+ eventPlanea = mcReactionPlane;
+ diffsub1sub2a = 0.0;
+ }
+ }
+
+
+ //////////////////////
+ // Fill Histos
+ //////////////////////
+
+ fHistEV->Fill(binctt,2.0);
+
+ // Fill
+ valuensparsea[0] = eventPlaneV0A;
+ valuensparsea[1] = eventPlaneV0C;
+ valuensparsea[2] = eventPlaneTPC;
+ if(fVZEROEventPlane && (!fVZEROEventPlaneA) && (!fVZEROEventPlaneC)) {
+ // case VZERO all
+ valuensparsea[0] = eventPlaneV0;
+ valuensparsea[1] = eventPlanesub1a;
+ valuensparsea[2] = eventPlanesub2a;
+ }
+ fEventPlane->Fill(&valuensparsea[0]);
+
+ // Fill
+ if(fMonitorEventPlane) fCosSin2phiep->Fill(&valuecossinephiep[0]);
+
+ if(!fVZEROEventPlane) {
+ valuensparsef[0] = diffsub1sub2a;
+ fCosRes->Fill(&valuensparsef[0]);
+ valuensparsefsin[0] = diffsub1sub2asin;
+ if(fMonitorEventPlane) fSinRes->Fill(&valuensparsefsin[0]);
+ if(fMonitorEventPlane) {
+ fProfileCosRes->Fill(valuensparsef[1],valuensparsef[0]);
+ }
+ }
+ else {
+ valuensparsefbis[0] = diffsubasubb;
+ valuensparsefbis[1] = diffsubasubc;
+ valuensparsefbis[2] = diffsubbsubc;
+ fCosResabc->Fill(&valuensparsefbis[0]); //TR: info
+ valuensparsefbissin[0] = diffsubasubbsin;
+ valuensparsefbissin[1] = diffsubbsubcsin;
+ valuensparsefbissin[2] = diffsubasubcsin;
+ if(fMonitorEventPlane) fSinResabc->Fill(&valuensparsefbissin[0]);
+ if(fMonitorEventPlane) {
+ fProfileCosResab->Fill(valuensparsefbis[3],valuensparsefbis[0]);
+ fProfileCosResac->Fill(valuensparsefbis[3],valuensparsefbis[1]);
+ fProfileCosResbc->Fill(valuensparsefbis[3],valuensparsefbis[2]);
+ }
+ }
+
+ ////////////////////////////////////////
+ // Loop to determine pool background
+ /////////////////////////////////////////
+ if(fMonitorPhotonic) {
+
+ fBackgroundSubtraction->FillPoolAssociatedTracks(fInputEvent,binct);
+
+ if( fArraytrack ){
+ fArraytrack->~TArrayI();
+ new(fArraytrack) TArrayI(nbtracks);
+ }
+ else {
+ fArraytrack = new TArrayI(nbtracks);
+ }
+ fCounterPoolBackground = 0;
+
+ for(Int_t k = 0; k < nbtracks; k++){
+
+ AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);
+ if(!track) continue;
+
+ // Track cuts
+ Bool_t survivedbackground = kTRUE;
+ if(fAODAnalysis) {
+ AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);
+ if(aodtrack) {
+ AliESDtrack esdTrack(aodtrack);
+ // set the TPC cluster info
+ esdTrack.SetTPCClusterMap(aodtrack->GetTPCClusterMap());
+ esdTrack.SetTPCSharedMap(aodtrack->GetTPCSharedMap());
+ esdTrack.SetTPCPointsF(aodtrack->GetTPCNclsF());
+ // needed to calculate the impact parameters
+ AliAODEvent *aodeventu = dynamic_cast<AliAODEvent *>(fInputEvent);
+ if(aodeventu) {
+ AliAODVertex *vAOD = aodeventu->GetPrimaryVertex();
+ Double_t bfield = aodeventu->GetMagneticField();
+ Double_t pos[3],cov[6];
+ vAOD->GetXYZ(pos);
+ vAOD->GetCovarianceMatrix(cov);
+ const AliESDVertex vESD(pos,cov,100.,100);
+ esdTrack.RelateToVertex(&vESD,bfield,3.);
+ }
+ if(!fHFEBackgroundCuts->IsSelected(&esdTrack)) {
+ survivedbackground = kFALSE;
+ }
+ }
+ }
+ else {
+ AliESDtrack *esdtrack = dynamic_cast<AliESDtrack *>(track);
+ if(esdtrack) {
+ if(!fHFEBackgroundCuts->IsSelected(esdtrack)) survivedbackground = kFALSE;
+ }
+ }
+ // PID
+ if(survivedbackground) {
+ // PID track cuts
+ AliHFEpidObject hfetrack2;
+ if(!fAODAnalysis) hfetrack2.SetAnalysisType(AliHFEpidObject::kESDanalysis);
+ else hfetrack2.SetAnalysisType(AliHFEpidObject::kAODanalysis);
+ hfetrack2.SetRecTrack(track);
+ hfetrack2.SetCentrality((Int_t)binct);
+ AliDebug(2,Form("centrality %f and %d",binct,hfetrack2.GetCentrality()));
+ hfetrack2.SetPbPb();
+ if(fPIDBackground->IsSelected(&hfetrack2,0x0,"recTrackCont",fPIDBackgroundqa)) {
+ fArraytrack->AddAt(k,fCounterPoolBackground);
+ fCounterPoolBackground++;
+ AliDebug(2,Form("fCounterPoolBackground %d, track %d",fCounterPoolBackground,k));
+ }
+ }
+ }
+ }
+
+
+ //////////////////////////
+ // Loop over track
+ //////////////////////////
+ for(Int_t k = 0; k < nbtracks; k++){
+
+ AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);
+ if(!track) continue;
+
+ if(fAODAnalysis) {
+ AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);
+ if(!aodtrack){
+ AliError("AOD track is not there");
+ continue;
+ }
+ AliDebug(2,"Find AOD track on");
+ if(!(aodtrack->TestFilterBit(fFilter))) continue; // Only process AOD tracks where the HFE is set
+ }
+
+
+ valuetrackingcuts[0] = track->Pt();
+ valuetrackingcuts[1] = 0;
+
+ // RecKine: ITSTPC cuts
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);
+
+ // RecPrim
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ valuetrackingcuts[1] = 1;
+ if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);
+
+ // HFEcuts: ITS layers cuts
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ valuetrackingcuts[1] = 2;
+ if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);
+
+ // HFE cuts: TOF and mismatch flag
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ valuetrackingcuts[1] = 3;
+ if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);
+
+ // HFE cuts: TPC PID cleanup
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ valuetrackingcuts[1] = 4;
+ if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);
+
+ // HFEcuts: Nb of tracklets TRD0
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ valuetrackingcuts[1] = 5;
+ if(fMonitorTrackCuts) fTrackingCuts->Fill(&valuetrackingcuts[0]);
+
+ AliDebug(2,"Survived");
+
+ /////////////////////////////////////////////////////////
+ // Subtract candidate from TPC event plane
+ ////////////////////////////////////////////////////////
+ Float_t eventplanesubtracted = 0.0;
+
+ if(!fVZEROEventPlane) {
+ // Subtract the tracks from the event plane
+ Double_t qX = qTPC->X() - vEPa->GetQContributionX(track); //Modify the components: subtract the track you want to look at with your analysis
+ Double_t qY = qTPC->Y() - vEPa->GetQContributionY(track); //Modify the components: subtract the track you want to look at with your analysis
+ TVector2 newQVectorfortrack;
+ newQVectorfortrack.Set(qX,qY);
+ eventplanesubtracted = TVector2::Phi_0_2pi(newQVectorfortrack.Phi())/2;
+ }
+ else eventplanesubtracted = eventPlanea;
+
+ ///////////////////////////////////////////
+ // Event plane
+ //////////////////////////////////////////
+ Bool_t fillEventPlane = kTRUE;
+ if(!fVZEROEventPlane){
+ if((!qsub1a) || (!qsub2a)) fillEventPlane = kFALSE;
+ if(fSubEtaGapTPC) {
+ if(track->Eta() < (- fEtaGap/2.)) eventplanesubtracted = eventPlanesub1a;
+ else if(track->Eta() > (fEtaGap/2.)) eventplanesubtracted = eventPlanesub2a;
+ else fillEventPlane = kFALSE;
+ }
+ }
+
+ ///////////////
+ // MC
+ //////////////
+ if(fUseMCReactionPlane) {
+ eventplanesubtracted = mcReactionPlane;
+ fillEventPlane = kTRUE;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////AFTERBURNER
+ Double_t phitrack = track->Phi();
+ if (fAfterBurnerOn)
+ {
+ phitrack = GetPhiAfterAddV2(track->Phi(),mcReactionPlane);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+
+
+ ///////////////////////
+ // Calculate deltaphi
+ ///////////////////////
+
+ // Suppose phi track is between 0.0 and phi
+ Double_t deltaphi = TVector2::Phi_0_2pi(phitrack - eventplanesubtracted);
+ if(deltaphi > TMath::Pi()) deltaphi = deltaphi - TMath::Pi();
+
+ ////////////////////////////////
+ // Determine the deltaphi bin
+ ///////////////////////////////
+
+ // in-plane
+ if(((deltaphi<(TMath::Pi()/4.)) && (deltaphi>0.0)) || ((deltaphi>(3*TMath::Pi()/4.)) && (deltaphi<TMath::Pi()))) valuedeltaphicontamination[0] = 0.5;
+ // out-of-plane
+ if((deltaphi>(TMath::Pi()/4.)) && (deltaphi<(3*TMath::Pi()/4.))) valuedeltaphicontamination[0] = 1.5;
+
+ ////////////////////////////////////////
+ // Define variables
+ ///////////////////////////////////////
+
+
+ valuedeltaphicontamination[2] = track->Pt();
+ valuensparsee[2] = track->Pt();
+ valuensparsee[3] = track->Eta();
+ valuensparseg[2] = track->Pt();
+ valuensparseh[2] = track->Pt();
+ valuefractioncont[0] = track->Pt();
+ valuensparsehprofile[2] = track->Pt();
+ valuensparseMCSourceDeltaPhiMaps[1] = track->Pt();
+ if(track->Charge() > 0.0) {
+ valuensparseg[3] = 0.2;
+ valuensparseh[3] = 0.2;
+ }
+ else {
+ valuensparseg[3] = -0.2;
+ valuensparseh[3] = -0.2;
+ }
+ valuensparseh[4] = track->Eta();
+ valuensparseg[4] = track->Eta();
+
+ AliDebug(2,Form("charge %d",(Int_t)track->Charge()));
+
+ ////////////////////////
+ // Fill before PID
+ ///////////////////////
+
+ if(fMonitorWithoutPID) {
+
+ valuensparseg[0] = deltaphi;
+ if(fillEventPlane) fDeltaPhiMapsBeforePID->Fill(&valuensparseg[0]);
+
+ //
+ valuensparseh[0] = TMath::Cos(2*TVector2::Phi_mpi_pi(phitrack-eventplanesubtracted));
+ if(fillEventPlane) {
+ fCosPhiMapsBeforePID->Fill(&valuensparseh[0]);
+ }
+ }
+
+ ////////////////////////
+ // Apply PID
+ ////////////////////////
+ if(!fNoPID) {
+ // Apply PID for Data
+ if(!fMCPID) {
+ // pid object
+ AliHFEpidObject hfetrack;
+ if(!fAODAnalysis) hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
+ else hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);
+ hfetrack.SetRecTrack(track);
+ hfetrack.SetCentrality((Int_t)binct);
+ AliDebug(2,Form("centrality %f and %d",binct,hfetrack.GetCentrality()));
+ hfetrack.SetPbPb();
+
+ // Only TOF PID
+ if(fMonitorContamination) {
+ if(fPIDTOFOnly->IsSelected(&hfetrack,0x0,"recTrackCont",0x0)) {
+ Float_t nsigma = pidResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
+ valuedeltaphicontamination[3] = nsigma;
+ fDeltaPhiMapsContamination->Fill(&valuedeltaphicontamination[0]);
+ }
+ }
+
+ // Complete PID TOF+TPC
+ if(!fPID->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqa)) {
+ continue;
+ }
+ }
+ else {
+ if(!mcEvent) continue;
+ if(!(mctrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(track->GetLabel()))))) continue;
+ AliDebug(2,Form("PdgCode %d",TMath::Abs(mctrack->Particle()->GetPdgCode())));
+ if(TMath::Abs(mctrack->Particle()->GetPdgCode())!=11) continue;
+ }
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Add candidate to AliFlowEvent for POI and subtract from RP if needed
+ ////////////////////////////////////////////////////////////////////////////
+ if(fMonitorQCumulant) {
+ Int_t idtrack = static_cast<AliVTrack*>(track)->GetID();
+ Bool_t found = kFALSE;
+ Int_t numberoffound = 0;
+ AliDebug(2,Form("A: Number of tracks %d",fflowEvent->NumberOfTracks()));
+ for(Int_t iRPs=0; iRPs< fflowEvent->NumberOfTracks(); iRPs++) {
+ AliFlowTrack *iRP = (AliFlowTrack*) (fflowEvent->GetTrack(iRPs));
+ if(!iRP) continue;
+ //if(!iRP->InRPSelection()) continue;
+ if( TMath::Abs(idtrack) == TMath::Abs(iRP->GetID()) ) {
+ iRP->SetForPOISelection(kTRUE);
+ found = kTRUE;
+ numberoffound ++;
+ }
+ }
+ AliDebug(2,Form("Found %d mal",numberoffound));
+ if(!found) {
+ AliFlowCandidateTrack *sTrack = (AliFlowCandidateTrack*) MakeTrack(massElectron,track->Pt(),track->Phi(), track->Eta());
+ sTrack->SetID(idtrack);
+ fflowEvent->AddTrack(sTrack);
+ AliDebug(2,"Add the track");
+ }
+ AliDebug(2,Form("B: Number of tracks %d",fflowEvent->NumberOfTracks()));
+ }
+
+
+ /////////////////////
+ // Fill THnSparseF
+ /////////////////////
+
+ //
+ valuensparseabis[0] = eventplanesubtracted;
+ if((fillEventPlane) && (fMonitorEventPlane)) fEventPlaneaftersubtraction->Fill(&valuensparseabis[0]);
+
+
+ if(fMonitorEventPlane)
+ {
+ //
+ valuensparsee[0] = TMath::Cos(2*phitrack);
+ fCos2phie->Fill(&valuensparsee[0]);
+ valuensparsee[0] = TMath::Sin(2*phitrack);
+ fSin2phie->Fill(&valuensparsee[0]);
+ //
+ valuensparsee[0] = TMath::Cos(2*eventplanesubtracted);
+ if(fillEventPlane) fCos2phiep->Fill(&valuensparsee[0]);
+ valuensparsee[0] = TMath::Sin(2*eventplanesubtracted);
+ if(fillEventPlane) fSin2phiep->Fill(&valuensparsee[0]);
+ valuensparsee[0] = TMath::Sin(2*TVector2::Phi_mpi_pi(phitrack-eventplanesubtracted));
+ if(fillEventPlane) fSin2phiephiep->Fill(&valuensparsee[0]);
+ //
+ }
+
+ //
+ valuensparseg[0] = deltaphi;
+ if(fillEventPlane) fDeltaPhiMaps->Fill(&valuensparseg[0]);
+
+ //
+ valuensparseh[0] = TMath::Cos(2*TVector2::Phi_mpi_pi(phitrack-eventplanesubtracted));
+ if(fillEventPlane) {
+ fCosPhiMaps->Fill(&valuensparseh[0]); //TR: fCosPhiQSum+=valuensparseh[0]*TMath:Sqrt(qAna->X()*qAna->X()+qAna->Y()*qAna->Y()); fCosPhiQN++;
+ if((valuefractioncont[1] >=0) && (valuefractioncont[1] < 11)){
+ if(fContamination[((Int_t)valuefractioncont[1])]){
+ Double_t weight = fContamination[((Int_t)valuefractioncont[1])]->Eval(track->P());
+ if(weight<0.0) weight=0.0;
+ if(weight>1.0) weight=1.0;
+ fFractionContamination->Fill(&valuefractioncont[0],weight);
+ if(fv2contamination[((Int_t)valuefractioncont[1])]){
+ Double_t v2 = fv2contamination[((Int_t)valuefractioncont[1])]->Eval(track->Pt());
+ AliDebug(2,Form("value v2 %f, contamination %f and pt %f centrality %d\n",v2,weight,track->Pt(),(Int_t)valuefractioncont[1]));
+ AliDebug(2,Form("Check for centrality 3: value v2 %f, contamination %f\n",fv2contamination[3]->Eval(track->Pt()),fContamination[3]->Eval(track->P())));
+ AliDebug(2,Form("Check for centrality 4: value v2 %f, contamination %f\n",fv2contamination[4]->Eval(track->Pt()),fContamination[4]->Eval(track->P())));
+ AliDebug(2,Form("Check for centrality 5: value v2 %f, contamination %f\n",fv2contamination[5]->Eval(track->Pt()),fContamination[5]->Eval(track->P())));
+ fContaminationv2->Fill(valuefractioncont[1],valuefractioncont[0],v2,weight);
+ }
+ }
+ }
+ if(fMonitorEventPlane) {
+ if(fSP)
+ valuensparseh[0] *= TMath::Sqrt(qAna->X()*qAna->X()+qAna->Y()*qAna->Y());
+ fProfileCosPhiMaps->Fill(valuensparsehprofile[1],valuensparsehprofile[2],valuensparseh[0]); //TR: info
+ }
+ }
+
+ if(fMonitorPhotonic) {
+ Int_t indexmother = -1;
+ Int_t source = 1;
+ if(mcthere) source = fBackgroundSubtraction->FindMother(mctrack->GetLabel(),indexmother);
+ fBackgroundSubtraction->LookAtNonHFE(k, track, fInputEvent, 1, binct, deltaphi, source, indexmother);
+
+ if((!fAODAnalysis && mcthere) || !mcthere) {
+ // background
+ source = 0;
+ indexmother = -1;
+ source = FindMother(TMath::Abs(track->GetLabel()),mcEvent, indexmother);
+ valuensparseMCSourceDeltaPhiMaps[2] = source;
+ if(mcEvent) fMCSourceDeltaPhiMaps->Fill(&valuensparseMCSourceDeltaPhiMaps[0]);
+ //LookAtNonHFE(k,track,fInputEvent,mcEvent,binct,deltaphi,source,indexmother);
+ Int_t taggedvalue = LookAtNonHFE(k,track,fInputEvent,mcEvent,binct,deltaphi,source,indexmother);
+ if(fMonitorPhotonic) {
+ // No opposite charge partner found in the invariant mass choosen
+ if((taggedvalue!=2) && (taggedvalue!=6)) {
+ //fDeltaPhiMapsTaggedNonPhotonic->Fill(&valuensparseg[0]);
+ //fCosPhiMapsTaggedNonPhotonic->Fill(&valuensparseh[0]);
+ }
+ // One opposite charge partner found in the invariant mass choosen
+ if((taggedvalue==2) || (taggedvalue==6)) {
+ fDeltaPhiMapsTaggedPhotonic->Fill(&valuensparseg[0]);
+ //fCosPhiMapsTaggedPhotonic->Fill(&valuensparseh[0]);
+ }
+ // One same charge partner found in the invariant mass choosen
+ if((taggedvalue==4) || (taggedvalue==6)) {
+ fDeltaPhiMapsTaggedPhotonicLS->Fill(&valuensparseg[0]);
+ //fCosPhiMapsTaggedPhotonicLS->Fill(&valuensparseh[0]);
+ }
+ }
+ }
+ }
+
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////AFTERBURNER
+ if (fAfterBurnerOn & fMonitorQCumulant)
+ {
+ fflowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow
+ fflowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
+ }
+ //////////////////////////////////////////////////////////////////////////////
+
+
+
+ //for(Int_t bincless = 0; bincless < fNbBinsCentralityQCumulant; bincless++) {
+ // if((fBinCentralityLess[bincless]< cntr) && (cntr < fBinCentralityLess[bincless+1])) PostData(bincless+2,fflowEvent);
+ //}
+
+ if(fMonitorPhotonic) {
+ if(fArraytrack) {
+ delete fArraytrack;
+ fArraytrack = NULL;
+ }
+ }
+
+ if(fMonitorPhotonic) fBackgroundSubtraction->CountPoolAssociated(fInputEvent,binct);
+
+ PostData(1, fListHist);
+
+
+
+}
+//______________________________________________________________________________
+AliFlowCandidateTrack *AliAnalysisTaskFlowTPCTOFEPSP::MakeTrack( Double_t mass,
+ Double_t pt, Double_t phi, Double_t eta) {
+ //
+ // Make Track (Not needed actually)
+ //
+
+ AliFlowCandidateTrack *sTrack = new AliFlowCandidateTrack();
+ sTrack->SetMass(mass);
+ sTrack->SetPt(pt);
+ sTrack->SetPhi(phi);
+ sTrack->SetEta(eta);
+ sTrack->SetForPOISelection(kTRUE);
+ sTrack->SetForRPSelection(kFALSE);
+ return sTrack;
+}
+//_________________________________________________________________________________
+Double_t AliAnalysisTaskFlowTPCTOFEPSP::GetPhiAfterAddV2(Double_t phi,Double_t reactionPlaneAngle) const
+{
+ //
+ // Adds v2, uses Newton-Raphson iteration
+ //
+ Double_t phiend=phi;
+ Double_t phi0=phi;
+ Double_t f=0.;
+ Double_t fp=0.;
+ Double_t phiprev=0.;
+
+ for (Int_t i=0; i<fMaxNumberOfIterations; i++)
+ {
+ phiprev=phiend; //store last value for comparison
+ f = phiend-phi0+fV2*TMath::Sin(2.*(phiend-reactionPlaneAngle));
+ fp = 1.0+2.0*fV2*TMath::Cos(2.*(phiend-reactionPlaneAngle)); //first derivative
+ phiend -= f/fp;
+ if (TMath::AreEqualAbs(phiprev,phiend,fPrecisionPhi)) break;
+ }
+ return phiend;
+}
+//_____________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, AliMCEvent *mcEvent,Int_t binct,Double_t deltaphi,Int_t source,Int_t indexmother)
+{
+ //
+ // Look At Non HFE
+ //
+
+ // return -1 if nothing
+ // return 2 if opposite charge within the mass range found
+ // return 4 if like charge within the mass range found
+ // return 6 if opposite charge and like charge within the mass range found
+ //
+
+ Int_t taggedphotonic = -1;
+
+ Bool_t oppositetaggedphotonic = kFALSE;
+ Bool_t sametaggedphotonic = kFALSE;
+
+ AliDebug(2,Form("fCounterPoolBackground %d in LookAtNonHFE!!!",fCounterPoolBackground));
+ if(!fArraytrack) return taggedphotonic;
+ AliDebug(2,Form("process track %d",iTrack1));
+
+ TVector3 v3D1;
+ TVector3 v3D2;
+
+ Double_t valuensparseDeltaPhiMaps[5];
+ Double_t valueangle[3];
+
+ valuensparseDeltaPhiMaps[1] = binct;
+ valuensparseDeltaPhiMaps[2] = track1->Pt();
+ valuensparseDeltaPhiMaps[0] = deltaphi;
+ valuensparseDeltaPhiMaps[4] = source;
+
+ valueangle[2] = source;
+ valueangle[1] = binct;
+
+ // Pdg code
+ Int_t pdg1 = CheckPdg(TMath::Abs(track1->GetLabel()),mcEvent);
+ Int_t numberfound = 0;
+
+ //Magnetic Field
+ Double_t bfield = vEvent->GetMagneticField();
+
+ // Get Primary vertex
+ const AliVVertex *pVtx = vEvent->GetPrimaryVertex();
+
+ for(Int_t idex = 0; idex < fCounterPoolBackground; idex++)
+ {
+
+ Int_t iTrack2 = fArraytrack->At(idex);
+ AliDebug(2,Form("track %d",iTrack2));
+ AliVTrack* track2 = (AliVTrack *) vEvent->GetTrack(iTrack2);
+ if (!track2)
+ {
+ printf("ERROR: Could not receive track %d", iTrack2);
+ continue;
+ }
+ if(iTrack2==iTrack1) continue;
+ AliDebug(2,"Different");
+
+ // Reset the MC info
+ valueangle[2] = source;
+ valuensparseDeltaPhiMaps[4] = source;
+
+ // track cuts and PID already done
+
+ // if MC look
+ Int_t pdg2 = -100;
+ if(mcEvent) {
+ Int_t source2 = 0;
+ Int_t indexmother2 = -1;
+ source2 = FindMother(TMath::Abs(track2->GetLabel()),mcEvent, indexmother2);
+ pdg2 = CheckPdg(TMath::Abs(track2->GetLabel()),mcEvent);
+ if(source2 >=0 ) {
+ if((indexmother2 == indexmother) && (source == source2) && ((pdg1*pdg2)<0.0)) {
+ if(source == kElectronfromconversion) {
+ valueangle[2] = kElectronfromconversionboth;
+ valuensparseDeltaPhiMaps[4] = kElectronfromconversionboth;
+ numberfound++;
+ }
+ if(source == kElectronfrompi0) {
+ valueangle[2] = kElectronfrompi0both;
+ valuensparseDeltaPhiMaps[4] = kElectronfrompi0both;
+ }
+ if(source == kElectronfrometa) {
+ valueangle[2] = kElectronfrometaboth;
+ valuensparseDeltaPhiMaps[4] = kElectronfrometaboth;
+ }
+ }
+ }
+ }
+
+ if(fAlgorithmMA && (!fAODAnalysis))
+ {
+ // tracks
+ AliESDtrack *esdtrack2 = dynamic_cast<AliESDtrack *>(track2);
+ AliESDtrack *esdtrack1 = dynamic_cast<AliESDtrack *>(track1);
+ if((!esdtrack2) || (!esdtrack1)) continue;
+
+ //Variables
+ Double_t p1[3];
+ Double_t p2[3];
+ Double_t xt1; //radial position track 1 at the DCA point
+ Double_t xt2; //radial position track 2 at the DCA point
+ //DCA track1-track2
+ Double_t dca12 = esdtrack2->GetDCA(esdtrack1,bfield,xt2,xt1);
+
+ // Cut dca
+ if(dca12 > fMaxdca) continue;
+
+ //Momento of the track extrapolated to DCA track-track
+ //Track1
+ Bool_t hasdcaT1 = esdtrack1->GetPxPyPzAt(xt1,bfield,p1);
+ //Track2
+ Bool_t hasdcaT2 = esdtrack2->GetPxPyPzAt(xt2,bfield,p2);
+
+ if(!hasdcaT1 || !hasdcaT2) AliWarning("It could be a problem in the extrapolation");
+
+ //track1-track2 Invariant Mass
+ Double_t eMass = 0.000510998910; //Electron mass in GeV
+ Double_t pP1 = sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]); //Track 1 momentum
+ Double_t pP2 = sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]); //Track 2 momentum
+ Double_t eE1 = TMath::Sqrt(pP1*pP1+eMass*eMass);
+ Double_t eE2 = TMath::Sqrt(pP2*pP2+eMass*eMass);
+
+ //TLorentzVector v1(p1[0],p1[1],p1[2],sqrt(eMass*eMass+pP1*pP1));
+ //TLorentzVector v2(p2[0],p2[1],p2[2],sqrt(eMass*eMass+pP2*pP2));
+ //Double_t imass = (v1+v2).M(); //Invariant Mass
+ //Double_t angle3D = v1.Angle(v2.Vect()); //Opening Angle (Total Angle)
+
+ // daughter
+ v3D1.SetXYZ(p1[0],p1[1],p1[2]);
+ v3D2.SetXYZ(p2[0],p2[1],p2[2]);
+ Double_t openingangle = TVector2::Phi_0_2pi(v3D2.Angle(v3D1));
+
+ // mother
+ TVector3 motherrec = v3D1 + v3D2;
+ Double_t invmass = TMath::Sqrt((eE1+eE2)*(eE1+eE2)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
+
+ // xy
+ //TVector3 vectordiff = v3D1 - v3D2;
+ //Double_t diffphi = TVector2::Phi_0_2pi(vectordiff.Phi());
+ //Double_t massxy = TMath::Sqrt((eE1+eE2)*(eE1+eE2)-(pP1*pP1+pP2*pP2+2*pP1*pP2*TMath::Cos(diffphi)));
+
+ // rz
+ //Double_t difftheta = TVector2::Phi_0_2pi(vectordiff.Eta());
+ //Double_t massrz = TMath::Sqrt((eE1+eE2)*(eE1+eE2)-(pP1*pP1+pP2*pP2+2*pP1*pP2*TMath::Cos(difftheta)));
+
+
+ Float_t fCharge1 = track1->Charge();
+ Float_t fCharge2 = track2->Charge();
+
+ // Fill Histo
+ //valueangle[0] = diffphi;
+ //valueangle[1] = difftheta;
+ valueangle[0] = openingangle;
+ if((fCharge1*fCharge2)>0.0) fSameSignAngle->Fill(&valueangle[0]);
+ else fOppSignAngle->Fill(&valueangle[0]);
+
+ // Cut
+ if(openingangle > fMaxopening3D) continue;
+ //if(difftheta > fMaxopeningtheta) continue;
+ //if(diffphi > fMaxopeningphi) continue;
+
+ // Invmass
+ valuensparseDeltaPhiMaps[3] = invmass;
+ if((fCharge1*fCharge2)>0.0) fSameSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);
+ else fOppSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);
+
+ // Cut
+ if(invmass < fMaxInvmass) {
+ if((fCharge1*fCharge2)<0.0) oppositetaggedphotonic=kTRUE;
+ if((fCharge1*fCharge2)>0.0) sametaggedphotonic=kTRUE;
+ }
+
+
+ }
+ else
+ {
+ Int_t fPDGtrack1 = 11;
+ Int_t fPDGtrack2 = 11;
+
+ Float_t fCharge1 = track1->Charge();
+ Float_t fCharge2 = track2->Charge();
+
+ if(fCharge1>0) fPDGtrack1 = -11;
+ if(fCharge2>0) fPDGtrack2 = -11;
+
+ AliKFParticle ktrack1(*track1, fPDGtrack1);
+ AliKFParticle ktrack2(*track2, fPDGtrack2);
+ AliKFParticle recoGamma(ktrack1, ktrack2);
+
+ //Reconstruction Cuts
+ if(recoGamma.GetNDF()<1) continue;
+ Double_t chi2OverNDF = recoGamma.GetChi2()/recoGamma.GetNDF();
+ if(TMath::Sqrt(TMath::Abs(chi2OverNDF))>fChi2OverNDFCut) continue;
+
+ // DCA
+ //Double_t dca12 = ktrack1.GetDistanceFromParticle(ktrack2);
+ //if(dca12 > fMaxdca) continue;
+
+ // if set mass constraint
+ if(fSetMassConstraint && pVtx) {
+ AliKFVertex primV(*pVtx);
+ primV += recoGamma;
+ primV -= ktrack1;
+ primV -= ktrack2;
+ recoGamma.SetProductionVertex(primV);
+ recoGamma.SetMassConstraint(0,0.0001);
+ }
+
+ //Invariant Mass
+ Double_t imass;
+ Double_t width;
+ recoGamma.GetMass(imass,width);
+
+ //Opening Angle (Total Angle)
+ Double_t angle = ktrack1.GetAngle(ktrack2);
+ valueangle[0] = angle;
+ if((fCharge1*fCharge2)>0.0) fSameSignAngle->Fill(&valueangle[0]);
+ else fOppSignAngle->Fill(&valueangle[0]);
+
+ // Cut
+ if(angle > fMaxopening3D) continue;
+
+ // Invmass
+ valuensparseDeltaPhiMaps[3] = imass;
+ if((fCharge1*fCharge2)>0.0) fSameSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);
+ else {
+ fOppSignDeltaPhiMaps->Fill(&valuensparseDeltaPhiMaps[0]);
+ /*
+ if(valueangle[2] == kElectronfromconversionboth) {
+ printf("Reconstructed charge1 %f, charge 2 %f and invmass %f",fCharge1,fCharge2,imass);
+ printf("MC charge1 %d, charge 2 %d",pdg1,pdg2);
+ printf("DCA %f",dca12);
+ printf("Number of found %d",numberfound);
+ }
+ */
+ }
+
+ // Cut
+ if(imass < fMaxInvmass) {
+ if((fCharge1*fCharge2)<0.0) oppositetaggedphotonic=kTRUE;
+ if((fCharge1*fCharge2)>0.0) sametaggedphotonic=kTRUE;
+ }
+ }
+ }
+
+ if(oppositetaggedphotonic && sametaggedphotonic){
+ taggedphotonic = 6;
+ }
+
+ if(!oppositetaggedphotonic && sametaggedphotonic){
+ taggedphotonic = 4;
+ }
+
+ if(oppositetaggedphotonic && !sametaggedphotonic){
+ taggedphotonic = 2;
+ }
+
+
+ return taggedphotonic;
+}
+//_________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::FindMother(Int_t tr, AliMCEvent *mcEvent, Int_t &indexmother){
+ //
+ // Find the mother if MC
+ //
+
+ if(!mcEvent) return 0;
+
+ Int_t pdg = CheckPdg(tr,mcEvent);
+ if(TMath::Abs(pdg)!= 11) {
+ indexmother = -1;
+ return kNoElectron;
+ }
+
+ indexmother = IsMotherGamma(tr,mcEvent);
+ if(indexmother > 0) return kElectronfromconversion;
+ indexmother = IsMotherPi0(tr,mcEvent);
+ if(indexmother > 0) return kElectronfrompi0;
+ indexmother = IsMotherC(tr,mcEvent);
+ if(indexmother > 0) return kElectronfromC;
+ indexmother = IsMotherB(tr,mcEvent);
+ if(indexmother > 0) return kElectronfromB;
+ indexmother = IsMotherEta(tr,mcEvent);
+ if(indexmother > 0) return kElectronfrometa;
+
+ return kElectronfromother;
+
+
+}
+//____________________________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::CheckPdg(Int_t tr, AliMCEvent* mcEvent) {
+
+ //
+ // Return the pdg of the particle
+ //
+
+
+ Int_t pdgcode = -1;
+ if(tr < 0) return pdgcode;
+
+ if(!mcEvent) return pdgcode;
+
+ AliVParticle *mctrack = mcEvent->GetTrack(tr);
+
+
+ if(mctrack->IsA() == AliMCParticle::Class()) {
+ AliMCParticle *mctrackesd = NULL;
+ if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return pdgcode;
+ pdgcode = mctrackesd->PdgCode();
+ }
+
+ if(mctrack->IsA() == AliAODMCParticle::Class()) {
+ AliAODMCParticle *mctrackaod = NULL;
+ if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return pdgcode;
+ pdgcode = mctrackaod->GetPdgCode();
+ }
+
+ return pdgcode;
+
+
+}
+//____________________________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherGamma(Int_t tr, AliMCEvent* mcEvent) {
+
+ //
+ // Return the lab of gamma mother or -1 if not gamma
+ //
+
+ if(tr < 0) return -1;
+ AliVParticle *mctrack = mcEvent->GetTrack(tr);
+
+ if(mctrack->IsA() == AliMCParticle::Class()) {
+ AliMCParticle *mctrackesd = NULL;
+ if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ TParticle *particle = 0x0;
+ particle = mctrackesd->Particle();
+ // Take mother
+ if(!particle) return -1;
+ Int_t imother = particle->GetFirstMother();
+ if(imother < 0) return -1;
+ AliMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ TParticle * mother = mothertrack->Particle();
+ if(!mother) return -1;
+ // Check gamma
+ Int_t pdg = mother->GetPdgCode();
+ if(TMath::Abs(pdg) == 22) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherGamma(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ if(mctrack->IsA() == AliAODMCParticle::Class()) {
+ AliAODMCParticle *mctrackaod = NULL;
+ if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ // Take mother
+ Int_t imother = mctrackaod->GetMother();
+ if(imother < 0) return -1;
+ AliAODMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ // Check gamma
+ Int_t pdg = mothertrack->GetPdgCode();
+ if(TMath::Abs(pdg) == 22) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherGamma(imother,mcEvent);
+ }
+ return -1;
+
+ }
+
+ return -1;
+
+
+}
+//
+//____________________________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherPi0(Int_t tr, AliMCEvent* mcEvent) {
+
+ //
+ // Return the lab of pi0 mother or -1 if not pi0
+ //
+
+ if(tr < 0) return -1;
+ AliVParticle *mctrack = mcEvent->GetTrack(tr);
+
+ if(mctrack->IsA() == AliMCParticle::Class()) {
+ AliMCParticle *mctrackesd = NULL;
+ if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ TParticle *particle = 0x0;
+ particle = mctrackesd->Particle();
+ // Take mother
+ if(!particle) return -1;
+ Int_t imother = particle->GetFirstMother();
+ if(imother < 0) return -1;
+ AliMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ TParticle * mother = mothertrack->Particle();
+ if(!mother) return -1;
+ // Check gamma
+ Int_t pdg = mother->GetPdgCode();
+ if(TMath::Abs(pdg) == 111) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherPi0(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ if(mctrack->IsA() == AliAODMCParticle::Class()) {
+ AliAODMCParticle *mctrackaod = NULL;
+ if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ // Take mother
+ Int_t imother = mctrackaod->GetMother();
+ if(imother < 0) return -1;
+ AliAODMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ // Check gamma
+ Int_t pdg = mothertrack->GetPdgCode();
+ if(TMath::Abs(pdg) == 111) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherPi0(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ return -1;
+
+}
+//____________________________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherC(Int_t tr, AliMCEvent* mcEvent) {
+
+ //
+ // Return the lab of signal mother or -1 if not signal
+ //
+
+ if(tr < 0) return -1;
+ AliVParticle *mctrack = mcEvent->GetTrack(tr);
+
+ if(mctrack->IsA() == AliMCParticle::Class()) {
+ AliMCParticle *mctrackesd = NULL;
+ if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ TParticle *particle = 0x0;
+ particle = mctrackesd->Particle();
+ // Take mother
+ if(!particle) return -1;
+ Int_t imother = particle->GetFirstMother();
+ if(imother < 0) return -1;
+ AliMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ TParticle * mother = mothertrack->Particle();
+ if(!mother) return -1;
+ // Check gamma
+ Int_t pdg = mother->GetPdgCode();
+ if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherC(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ if(mctrack->IsA() == AliAODMCParticle::Class()) {
+ AliAODMCParticle *mctrackaod = NULL;
+ if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ // Take mother
+ Int_t imother = mctrackaod->GetMother();
+ if(imother < 0) return -1;
+ AliAODMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ // Check gamma
+ Int_t pdg = mothertrack->GetPdgCode();
+ if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherC(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ return -1;
+
+}
+//____________________________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherB(Int_t tr, AliMCEvent* mcEvent) {
+
+ //
+ // Return the lab of signal mother or -1 if not signal
+ //
+
+ if(tr < 0) return -1;
+ AliVParticle *mctrack = mcEvent->GetTrack(tr);
+
+ if(mctrack->IsA() == AliMCParticle::Class()) {
+ AliMCParticle *mctrackesd = NULL;
+ if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ TParticle *particle = 0x0;
+ particle = mctrackesd->Particle();
+ // Take mother
+ if(!particle) return -1;
+ Int_t imother = particle->GetFirstMother();
+ if(imother < 0) return -1;
+ AliMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ TParticle * mother = mothertrack->Particle();
+ if(!mother) return -1;
+ // Check gamma
+ Int_t pdg = mother->GetPdgCode();
+ if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherB(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ if(mctrack->IsA() == AliAODMCParticle::Class()) {
+ AliAODMCParticle *mctrackaod = NULL;
+ if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ // Take mother
+ Int_t imother = mctrackaod->GetMother();
+ if(imother < 0) return -1;
+ AliAODMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ // Check gamma
+ Int_t pdg = mothertrack->GetPdgCode();
+ if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherB(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ return -1;
+
+}
+//____________________________________________________________________________________________________________
+Int_t AliAnalysisTaskFlowTPCTOFEPSP::IsMotherEta(Int_t tr, AliMCEvent* mcEvent) {
+
+ //
+ // Return the lab of pi0 mother or -1 if not pi0
+ //
+
+ if(tr < 0) return -1;
+ AliVParticle *mctrack = mcEvent->GetTrack(tr);
+
+ if(mctrack->IsA() == AliMCParticle::Class()) {
+ AliMCParticle *mctrackesd = NULL;
+ if(!(mctrackesd = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ TParticle *particle = 0x0;
+ particle = mctrackesd->Particle();
+ // Take mother
+ if(!particle) return -1;
+ Int_t imother = particle->GetFirstMother();
+ if(imother < 0) return -1;
+ AliMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ TParticle * mother = mothertrack->Particle();
+ if(!mother) return -1;
+ // Check gamma
+ Int_t pdg = mother->GetPdgCode();
+ if(TMath::Abs(pdg) == 221) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherEta(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ if(mctrack->IsA() == AliAODMCParticle::Class()) {
+ AliAODMCParticle *mctrackaod = NULL;
+ if(!(mctrackaod = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(tr))))) return -1;
+ // Take mother
+ Int_t imother = mctrackaod->GetMother();
+ if(imother < 0) return -1;
+ AliAODMCParticle *mothertrack = NULL;
+ if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(mcEvent->GetTrack(TMath::Abs(imother))))) return -1;
+ // Check gamma
+ Int_t pdg = mothertrack->GetPdgCode();
+ if(TMath::Abs(pdg) == 221) return imother;
+ if(TMath::Abs(pdg) == 11) {
+ return IsMotherEta(imother,mcEvent);
+ }
+ return -1;
+ }
+
+ return -1;
+
+}
-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-//\r
-// Flow task class for the ALICE HFE group\r
-//\r
-//\r
-#ifndef ALIANALYSISTASKFLOWTPCTOFEPSP_H\r
-#define ALIANALYSISTASKFLOWTPCTOFEPSP_H\r
-\r
-\r
-\r
-\r
-#include <AliAnalysisTaskSE.h>\r
-\r
-class TList;\r
-class AliVTrack;\r
-class AliVEvent;\r
-class AliESDtrack;\r
-class AliESDEvent;\r
-class AliMCEvent;\r
-class AliFlowTrackCuts;\r
-class AliFlowCandidateTrack;\r
-class AliHFEcuts;\r
-class AliHFEpid;\r
-class TH1D;\r
-class TH2D;\r
-class TF1;\r
-class TProfile;\r
-class TProfile2D;\r
-class THnSparse;\r
-class AliHFEpidQAmanager;\r
-class AliFlowEvent;\r
-class AliESDtrackCuts;\r
-class AliHFEVZEROEventPlane;\r
-class TArrayI;\r
-class AliAODMCHeader;\r
-class TClonesArray;\r
-class AliHFENonPhotonicElectron;\r
-class TTreeSRedirector;\r
-\r
-class AliAnalysisTaskFlowTPCTOFEPSP: public AliAnalysisTaskSE {\r
-public:\r
-\r
- typedef enum{\r
- kElectronfromconversion = 0,\r
- kElectronfromconversionboth = 1,\r
- kElectronfrompi0 = 2,\r
- kElectronfrompi0both = 3,\r
- kElectronfrometa = 4,\r
- kElectronfrometaboth = 5,\r
- kElectronfromC = 6,\r
- kElectronfromB = 7,\r
- kElectronfromother = 8,\r
- kNoElectron = 9\r
- } FlowSource_t;\r
- \r
- typedef enum{\r
- kS = 0,\r
- kOp = 1\r
- } FlowSign_t;\r
-\r
-\r
-\r
-\r
- AliAnalysisTaskFlowTPCTOFEPSP();\r
- AliAnalysisTaskFlowTPCTOFEPSP(const char *name);\r
- AliAnalysisTaskFlowTPCTOFEPSP(const AliAnalysisTaskFlowTPCTOFEPSP &ref);\r
- AliAnalysisTaskFlowTPCTOFEPSP& operator=(const AliAnalysisTaskFlowTPCTOFEPSP &ref);\r
- virtual void Copy(TObject &o) const;\r
- virtual ~AliAnalysisTaskFlowTPCTOFEPSP();\r
- \r
- virtual void UserExec(Option_t */*option*/);\r
- virtual void UserCreateOutputObjects();\r
-\r
- void SetAODAnalysis(Bool_t aodAnalysis) { fAODAnalysis = aodAnalysis; };\r
- void SetFilter(ULong_t filter) { fFilter = filter; }\r
- \r
- AliHFEpid *GetPID() const { return fPID; }\r
- AliHFEpid *GetPIDTOFOnly() const { return fPIDTOFOnly; }\r
- AliHFEpidQAmanager *GetPIDQAManager() const { return fPIDqa; }\r
- AliHFEpid *GetPIDBackground() const { return fPIDBackground; }\r
- AliHFEpidQAmanager *GetPIDBackgroundQAManager() const { return fPIDBackgroundqa; }\r
- AliHFENonPhotonicElectron *GetHFEBackgroundSubtraction() const { return fBackgroundSubtraction; }\r
-\r
-\r
- void SetContamination(TF1 * const function,Int_t k) { fContamination[k] = function; };\r
- void SetV2Contamination(TF1 * const function,Int_t k) { fv2contamination[k] = function; };\r
- void SetHFECuts(AliHFEcuts * const cuts) { fHFECuts = cuts; };\r
- void SetHFEBackgroundSubtraction(AliHFENonPhotonicElectron * const backgroundSubtraction) { fBackgroundSubtraction = backgroundSubtraction; };\r
- void SetHFEBackgroundCuts(AliESDtrackCuts * const cuts) { fHFEBackgroundCuts = cuts; };\r
- void SetSubEtaGapTPC(Bool_t subEtaGapTPC) { fSubEtaGapTPC = subEtaGapTPC; };\r
- void SetEtaGap(Double_t etaGap) { fEtaGap = etaGap; };\r
- void SetVZEROEventPlane(Bool_t vzeroEventPlane) { fVZEROEventPlane = vzeroEventPlane; };\r
- void SetVZEROEventPlaneA(Bool_t vzeroEventPlaneA) { fVZEROEventPlaneA = vzeroEventPlaneA; };\r
- void SetVZEROEventPlaneC(Bool_t vzeroEventPlaneC) { fVZEROEventPlaneC = vzeroEventPlaneC; };\r
- void SetHFEVZEROEventPlane(AliHFEVZEROEventPlane *hfeVZEROEventPlane) { fHFEVZEROEventPlane = hfeVZEROEventPlane; };\r
-\r
- void SetNbBinsCentralityQCumulant(Int_t nbBinsCentralityQCumulant) { fNbBinsCentralityQCumulant = nbBinsCentralityQCumulant; };\r
- void SetBinCentralityLess(Int_t k, Float_t value) { fBinCentralityLess[k] = value; };\r
- void SetNbBinsPtQCumulant(Int_t nbBinsPtQCumulant) { fNbBinsPtQCumulant = nbBinsPtQCumulant; };\r
- void SetMinPtQCumulant(Double_t minPtQCumulant) { fMinPtQCumulant = minPtQCumulant; };\r
- void SetMaxPtQCumulant(Double_t maxPtQCumulant) { fMaxPtQCumulant = maxPtQCumulant; };\r
-\r
- void SetAfterBurnerOn(Bool_t afterBurnerOn) { fAfterBurnerOn = afterBurnerOn; };\r
- void SetNonFlowNumberOfTrackClones(Int_t nonFlowNumberOfTrackClones) { fNonFlowNumberOfTrackClones = nonFlowNumberOfTrackClones; };\r
- void SetV1V2V3V4V5(Double_t v1,Double_t v2,Double_t v3,Double_t v4,Double_t v5) {fV1 = v1; fV2 = v2; fV3 = v3; fV4 = v4; fV5 = v5; };\r
- void SetMaxNumberOfIterations(Int_t maxNumberOfIterations) { fMaxNumberOfIterations = maxNumberOfIterations; };\r
- void SetPrecisionPhi(Double_t precisionPhi) { fPrecisionPhi = precisionPhi;};\r
- void SetUseMCReactionPlane(Bool_t useMCReactionPlane) { fUseMCReactionPlane = useMCReactionPlane;};\r
- void SetUseSP(Bool_t useSP) { fSP = useSP;}\r
- void SetMCPID(Bool_t mcPID) { fMCPID = mcPID;};\r
- void SetNoPID(Bool_t noPID) { fNoPID = noPID;};\r
-\r
- void SetMonitorEventPlane(Bool_t monitorEventPlane) { fMonitorEventPlane = monitorEventPlane;};\r
- void SetMonitorContamination(Bool_t monitorContamination) { fMonitorContamination = monitorContamination;};\r
- void SetMonitorPhotonic(Bool_t monitorPhotonic) { fMonitorPhotonic = monitorPhotonic;};\r
- void SetMonitorWithoutPID(Bool_t monitorWithoutPID) { fMonitorWithoutPID = monitorWithoutPID;};\r
- void SetMonitorTrackCuts(Bool_t monitorTrackCuts) { fMonitorTrackCuts = monitorTrackCuts;};\r
- void SetMonitorQCumulant(Bool_t monitorQCumulant) { fMonitorQCumulant = monitorQCumulant;};\r
-\r
- Int_t GetNbBinsCentralityQCumulant() const { return fNbBinsCentralityQCumulant; };\r
- Double_t GetBinCentralityLess(Int_t k) const { return fBinCentralityLess[k]; };\r
- \r
- AliFlowCandidateTrack *MakeTrack( Double_t mass, Double_t pt, Double_t phi, Double_t eta) ;\r
- Double_t GetPhiAfterAddV2(Double_t phi,Double_t reactionPlaneAngle) const;\r
-\r
- void SetMaxInvmass(Double_t maxInvmass) { fMaxInvmass = maxInvmass; };\r
- void SetMaxopening3D(Double_t maxOpening3D) { fMaxopening3D = maxOpening3D; };\r
- void SetMaxopeningtheta(Double_t maxOpeningtheta) { fMaxopeningtheta = maxOpeningtheta; };\r
- void SetMaxopeningphi(Double_t maxOpeningphi) { fMaxopeningphi = maxOpeningphi; };\r
- void SetAlgorithmMA(Bool_t algorithmMA) { fAlgorithmMA = algorithmMA; };\r
- void SetMassConstraint(Bool_t massConstraint) { fSetMassConstraint = massConstraint; };\r
- void SetPileUpCut(Bool_t cut=kTRUE) { fPileUpCut=cut; }\r
-\r
- Int_t LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *fESD, AliMCEvent *mcEvent,Int_t binct,Double_t deltaphi,Int_t source,Int_t indexmother);\r
- \r
-private:\r
- TList *fListHist; //! TH list\r
- Bool_t fAODAnalysis; // AOD analysis\r
- ULong_t fFilter; // reconstruction AOD status flags \r
- AliAODMCHeader *fAODMCHeader; // ! MC info AOD\r
- TClonesArray *fAODArrayMCInfo; // ! MC info particle AOD\r
- AliHFENonPhotonicElectron *fBackgroundSubtraction; // Background subtraction\r
- \r
- Bool_t fVZEROEventPlane; // Use Event Planes from VZERO\r
- Bool_t fVZEROEventPlaneA; // Use Event Planes from VZERO A\r
- Bool_t fVZEROEventPlaneC; // Use Event Planes from VZERO C\r
-\r
- Bool_t fSubEtaGapTPC; // bool to fill with eta gap\r
- Double_t fEtaGap; // Value of the eta gap\r
-\r
- Int_t fNbBinsCentralityQCumulant; // Number of Bins Q Cumulant\r
- Double_t fBinCentralityLess[10]; // Centrality Bin lower value\r
- Int_t fNbBinsPtQCumulant; // Nbbinspt QCumulant method\r
- Double_t fMinPtQCumulant; // Min pt QCumulant method\r
- Double_t fMaxPtQCumulant; // Max pt QCumulant method\r
- Bool_t fAfterBurnerOn; // Add flow to all tracks\r
- Int_t fNonFlowNumberOfTrackClones; // number of times to clone the particles (nonflow) \r
- Double_t fV1; // Add Flow. Must be in range [0,0.5].\r
- Double_t fV2; // Add Flow. Must be in range [0,0.5].\r
- Double_t fV3; // Add Flow. Must be in range [0,0.5].\r
- Double_t fV4; // Add Flow. Must be in range [0,0.5].\r
- Double_t fV5; // Add Flow. Must be in range [0,0.5].\r
- Int_t fMaxNumberOfIterations; // Max number of iteration for adding v2\r
- Double_t fPrecisionPhi; // precision phi for adding v2\r
- Bool_t fUseMCReactionPlane; // use MC reaction plane\r
- Bool_t fSP; // calculate using scalar product method (instead of event plane method)\r
-\r
- Bool_t fMCPID; // MC PID for electrons\r
- Bool_t fNoPID; // No PID for checks\r
-\r
- Double_t fChi2OverNDFCut; // Limit chi2\r
- Double_t fMaxdca; // Limit dca\r
- Double_t fMaxopeningtheta; // Limit opening angle in theta\r
- Double_t fMaxopeningphi; // Limit opening angle in phi\r
- Double_t fMaxopening3D; // Limit opening 3D\r
- Double_t fMaxInvmass; // Limit invariant mass\r
- Bool_t fSetMassConstraint; // Set mass constraint\r
- \r
-\r
- Bool_t fMonitorEventPlane; // Monitor event plane\r
- Bool_t fMonitorContamination; // Monitor contamination\r
- Bool_t fMonitorPhotonic;// Monitor photonic\r
- Bool_t fMonitorWithoutPID;// Monitor without PID\r
- Bool_t fMonitorTrackCuts;// Monitor track cuts\r
- Bool_t fMonitorQCumulant;// Monitor Q cumulant\r
- \r
- // Cuts for FLOW PWG2\r
- AliFlowTrackCuts* fcutsRP; //! Reference particle cut\r
- AliFlowTrackCuts* fcutsPOI; //! Particle Of Interest cut\r
- \r
- // Cuts for HFE\r
- AliHFEcuts *fHFECuts; // HFE cuts\r
- AliHFEpid *fPID; // PID cuts \r
- AliHFEpid *fPIDTOFOnly; // PID cuts TOF only\r
- AliHFEpidQAmanager *fPIDqa; // QA Manager\r
- AliFlowEvent *fflowEvent; //! Flow event \r
-\r
- // Hadron Contamination\r
- TF1 *fContamination[11]; // Parametrization of the contamination (0-5,5-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80,80-90,90-100)\r
- TF1 *fv2contamination[11]; // Parametrization of the v2 of charged pions (0-5,5-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80,80-90,90-100)\r
-\r
- // Cuts for background study\r
- AliESDtrackCuts *fHFEBackgroundCuts; // HFE background cuts\r
- AliHFEpid *fPIDBackground; // PID background cuts \r
- AliHFEpidQAmanager *fPIDBackgroundqa; // QA Manager Background \r
- Bool_t fAlgorithmMA; // algorithm MA\r
-\r
- // List of tracks\r
- TArrayI *fArraytrack; //! list of tracks\r
- Int_t fCounterPoolBackground; // number of tracks\r
-\r
- // VZERO Event plane after calibration 2010\r
- AliHFEVZEROEventPlane *fHFEVZEROEventPlane; // VZERO event plane calibrated\r
- \r
- // Histos\r
- TH2D *fHistEV; //! Number of events\r
- THnSparseF *fHistPileUp; //! Pile up histogram\r
- Bool_t fPileUpCut;\r
-\r
- // A Event plane as function of phiepa, phiepb, phiepc, phiepd centrality \r
- // a V0A, b V0C, c TPC,\r
- THnSparseF *fEventPlane; //! Event plane\r
- \r
- // B Event Plane after subtraction as function of phiep, centrality \r
- THnSparseF *fEventPlaneaftersubtraction; //! Event plane\r
-\r
- // Contamination\r
- THnSparseF *fFractionContamination; //! Fraction of contamination as function of pt\r
- TProfile2D *fContaminationv2; //! v2 of contamination\r
-\r
- // Monitoring Event plane: cos2phi, sin2phi, centrality\r
- THnSparseF *fCosSin2phiep; //! Cos(2phi), Sin(2phi)\r
- \r
- // E Monitoring Event plane after subtraction of the track: cos, centrality, pt, eta\r
- THnSparseF *fCos2phie; //! Monitoring\r
- THnSparseF *fSin2phie; //! Monitoring\r
- THnSparseF *fCos2phiep; //! Monitoring\r
- THnSparseF *fSin2phiep; //! Monitoring\r
- THnSparseF *fSin2phiephiep; //! Monitoring\r
-\r
- // Fbis Resolution as function of cosres, cosres, cosres, centrality for three subevents (V0)\r
- // a V0A, b V0C, c TPC\r
- THnSparseF *fCosResabc; //! Res\r
- THnSparseF *fSinResabc; //! Res\r
- TProfile *fProfileCosResab; //! Profile Res_a_b\r
- TProfile *fProfileCosResac; //! Profile Res_a_c\r
- TProfile *fProfileCosResbc; //! Profile Res_b_c\r
- \r
- // F Resolution as function of cosres, centrality for two subevents (TPC)\r
- THnSparseF *fCosRes; //! Res\r
- THnSparseF *fSinRes; //! Res\r
- TProfile *fProfileCosRes; //! Profile Res\r
- \r
- // Debuging Cuts step by step all centrality together: pt, step (6)\r
- THnSparseF *fTrackingCuts; //! Tracking Cuts\r
-\r
- // Before PID cut\r
- // G Maps delta phi as function of deltaphi, centrality, pt\r
- THnSparseF *fDeltaPhiMapsBeforePID; //! Delta phi\r
- // H Maps cos phi : cos, centrality, pt\r
- THnSparseF *fCosPhiMapsBeforePID; //! Cos\r
-\r
- // G Maps delta phi as function of deltaphi, centrality, pt\r
- THnSparseF *fDeltaPhiMaps; //! Delta phi\r
- THnSparseF *fDeltaPhiMapsContamination; //! Delta phi for contamination substraction\r
- // H Maps cos phi : cos, centrality, pt\r
- THnSparseF *fCosPhiMaps; //! Cos\r
- TProfile2D *fProfileCosPhiMaps; //! Profile Cos\r
-\r
- // Background study: not statistic but tagged \r
- THnSparseF *fDeltaPhiMapsTaggedPhotonic; //! Delta phi\r
- //THnSparseF *fCosPhiMapsTaggedPhotonic; //! Cos\r
- THnSparseF *fDeltaPhiMapsTaggedNonPhotonic; //! Delta phi\r
- //THnSparseF *fCosPhiMapsTaggedNonPhotonic; //! Cos\r
- THnSparseF *fDeltaPhiMapsTaggedPhotonicLS; //! Delta phi\r
- //THnSparseF *fCosPhiMapsTaggedPhotonicLS; //! Cos\r
-\r
- // Background study: centrality, pt, source\r
- THnSparseF *fMCSourceDeltaPhiMaps; //! Source MC\r
- // Background study: deltaphi, centrality, pt, minv, source\r
- THnSparseF *fOppSignDeltaPhiMaps; //! Delta phi\r
- THnSparseF *fSameSignDeltaPhiMaps; //! Delta phi\r
- // Background study: angle, centrality, source\r
- THnSparseF *fOppSignAngle; // ! Opening Angles\r
- THnSparseF *fSameSignAngle; // ! Opening Angles\r
-\r
- TTreeSRedirector *fDebugStreamer; //!Debug streamer\r
-\r
- Int_t FindMother(Int_t tr, AliMCEvent *mcEvent, Int_t &indexmother);\r
- Int_t CheckPdg(Int_t tr, AliMCEvent* mcEvent);\r
- Int_t IsMotherGamma(Int_t tr, AliMCEvent* mcEvent);\r
- Int_t IsMotherPi0(Int_t tr, AliMCEvent* mcEvent);\r
- Int_t IsMotherC(Int_t tr, AliMCEvent* mcEvent);\r
- Int_t IsMotherB(Int_t tr, AliMCEvent* mcEvent);\r
- Int_t IsMotherEta(Int_t tr, AliMCEvent* mcEvent);\r
- \r
- \r
- ClassDef(AliAnalysisTaskFlowTPCTOFEPSP, 1); // analysisclass\r
-};\r
-\r
-#endif\r
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+//
+// Flow task class for the ALICE HFE group
+//
+//
+#ifndef ALIANALYSISTASKFLOWTPCTOFEPSP_H
+#define ALIANALYSISTASKFLOWTPCTOFEPSP_H
+
+
+
+
+#include <AliAnalysisTaskSE.h>
+
+class TList;
+class AliVTrack;
+class AliVEvent;
+class AliESDtrack;
+class AliESDEvent;
+class AliMCEvent;
+class AliFlowTrackCuts;
+class AliFlowCandidateTrack;
+class AliHFEcuts;
+class AliHFEpid;
+class TH1D;
+class TH2D;
+class TF1;
+class TProfile;
+class TProfile2D;
+class THnSparse;
+class AliHFEpidQAmanager;
+class AliFlowEvent;
+class AliESDtrackCuts;
+class AliHFEVZEROEventPlane;
+class TArrayI;
+class AliAODMCHeader;
+class TClonesArray;
+class AliHFENonPhotonicElectron;
+class TTreeSRedirector;
+
+class AliAnalysisTaskFlowTPCTOFEPSP: public AliAnalysisTaskSE {
+public:
+
+ typedef enum{
+ kElectronfromconversion = 0,
+ kElectronfromconversionboth = 1,
+ kElectronfrompi0 = 2,
+ kElectronfrompi0both = 3,
+ kElectronfrometa = 4,
+ kElectronfrometaboth = 5,
+ kElectronfromC = 6,
+ kElectronfromB = 7,
+ kElectronfromother = 8,
+ kNoElectron = 9
+ } FlowSource_t;
+
+ typedef enum{
+ kS = 0,
+ kOp = 1
+ } FlowSign_t;
+
+
+
+
+ AliAnalysisTaskFlowTPCTOFEPSP();
+ AliAnalysisTaskFlowTPCTOFEPSP(const char *name);
+ AliAnalysisTaskFlowTPCTOFEPSP(const AliAnalysisTaskFlowTPCTOFEPSP &ref);
+ AliAnalysisTaskFlowTPCTOFEPSP& operator=(const AliAnalysisTaskFlowTPCTOFEPSP &ref);
+ virtual void Copy(TObject &o) const;
+ virtual ~AliAnalysisTaskFlowTPCTOFEPSP();
+
+ virtual void UserExec(Option_t */*option*/);
+ virtual void UserCreateOutputObjects();
+
+ void SetAODAnalysis(Bool_t aodAnalysis) { fAODAnalysis = aodAnalysis; };
+ void SetFilter(ULong_t filter) { fFilter = filter; }
+
+ AliHFEpid *GetPID() const { return fPID; }
+ AliHFEpid *GetPIDTOFOnly() const { return fPIDTOFOnly; }
+ AliHFEpidQAmanager *GetPIDQAManager() const { return fPIDqa; }
+ AliHFEpid *GetPIDBackground() const { return fPIDBackground; }
+ AliHFEpidQAmanager *GetPIDBackgroundQAManager() const { return fPIDBackgroundqa; }
+ AliHFENonPhotonicElectron *GetHFEBackgroundSubtraction() const { return fBackgroundSubtraction; }
+
+
+ void SetContamination(TF1 * const function,Int_t k) { fContamination[k] = function; };
+ void SetV2Contamination(TF1 * const function,Int_t k) { fv2contamination[k] = function; };
+ void SetHFECuts(AliHFEcuts * const cuts) { fHFECuts = cuts; };
+ void SetHFEBackgroundSubtraction(AliHFENonPhotonicElectron * const backgroundSubtraction) { fBackgroundSubtraction = backgroundSubtraction; };
+ void SetHFEBackgroundCuts(AliESDtrackCuts * const cuts) { fHFEBackgroundCuts = cuts; };
+ void SetSubEtaGapTPC(Bool_t subEtaGapTPC) { fSubEtaGapTPC = subEtaGapTPC; };
+ void SetEtaGap(Double_t etaGap) { fEtaGap = etaGap; };
+ void SetVZEROEventPlane(Bool_t vzeroEventPlane) { fVZEROEventPlane = vzeroEventPlane; };
+ void SetVZEROEventPlaneA(Bool_t vzeroEventPlaneA) { fVZEROEventPlaneA = vzeroEventPlaneA; };
+ void SetVZEROEventPlaneC(Bool_t vzeroEventPlaneC) { fVZEROEventPlaneC = vzeroEventPlaneC; };
+ void SetHFEVZEROEventPlane(AliHFEVZEROEventPlane *hfeVZEROEventPlane) { fHFEVZEROEventPlane = hfeVZEROEventPlane; };
+
+ void SetNbBinsCentralityQCumulant(Int_t nbBinsCentralityQCumulant) { fNbBinsCentralityQCumulant = nbBinsCentralityQCumulant; };
+ void SetBinCentralityLess(Int_t k, Float_t value) { fBinCentralityLess[k] = value; };
+ void SetNbBinsPtQCumulant(Int_t nbBinsPtQCumulant) { fNbBinsPtQCumulant = nbBinsPtQCumulant; };
+ void SetMinPtQCumulant(Double_t minPtQCumulant) { fMinPtQCumulant = minPtQCumulant; };
+ void SetMaxPtQCumulant(Double_t maxPtQCumulant) { fMaxPtQCumulant = maxPtQCumulant; };
+
+ void SetAfterBurnerOn(Bool_t afterBurnerOn) { fAfterBurnerOn = afterBurnerOn; };
+ void SetNonFlowNumberOfTrackClones(Int_t nonFlowNumberOfTrackClones) { fNonFlowNumberOfTrackClones = nonFlowNumberOfTrackClones; };
+ void SetV1V2V3V4V5(Double_t v1,Double_t v2,Double_t v3,Double_t v4,Double_t v5) {fV1 = v1; fV2 = v2; fV3 = v3; fV4 = v4; fV5 = v5; };
+ void SetMaxNumberOfIterations(Int_t maxNumberOfIterations) { fMaxNumberOfIterations = maxNumberOfIterations; };
+ void SetPrecisionPhi(Double_t precisionPhi) { fPrecisionPhi = precisionPhi;};
+ void SetUseMCReactionPlane(Bool_t useMCReactionPlane) { fUseMCReactionPlane = useMCReactionPlane;};
+ void SetUseSP(Bool_t useSP) { fSP = useSP;}
+ void SetMCPID(Bool_t mcPID) { fMCPID = mcPID;};
+ void SetNoPID(Bool_t noPID) { fNoPID = noPID;};
+
+ void SetMonitorEventPlane(Bool_t monitorEventPlane) { fMonitorEventPlane = monitorEventPlane;};
+ void SetMonitorContamination(Bool_t monitorContamination) { fMonitorContamination = monitorContamination;};
+ void SetMonitorPhotonic(Bool_t monitorPhotonic) { fMonitorPhotonic = monitorPhotonic;};
+ void SetMonitorWithoutPID(Bool_t monitorWithoutPID) { fMonitorWithoutPID = monitorWithoutPID;};
+ void SetMonitorTrackCuts(Bool_t monitorTrackCuts) { fMonitorTrackCuts = monitorTrackCuts;};
+ void SetMonitorQCumulant(Bool_t monitorQCumulant) { fMonitorQCumulant = monitorQCumulant;};
+
+ Int_t GetNbBinsCentralityQCumulant() const { return fNbBinsCentralityQCumulant; };
+ Double_t GetBinCentralityLess(Int_t k) const { return fBinCentralityLess[k]; };
+
+ AliFlowCandidateTrack *MakeTrack( Double_t mass, Double_t pt, Double_t phi, Double_t eta) ;
+ Double_t GetPhiAfterAddV2(Double_t phi,Double_t reactionPlaneAngle) const;
+
+ void SetMaxInvmass(Double_t maxInvmass) { fMaxInvmass = maxInvmass; };
+ void SetMaxopening3D(Double_t maxOpening3D) { fMaxopening3D = maxOpening3D; };
+ void SetMaxopeningtheta(Double_t maxOpeningtheta) { fMaxopeningtheta = maxOpeningtheta; };
+ void SetMaxopeningphi(Double_t maxOpeningphi) { fMaxopeningphi = maxOpeningphi; };
+ void SetAlgorithmMA(Bool_t algorithmMA) { fAlgorithmMA = algorithmMA; };
+ void SetMassConstraint(Bool_t massConstraint) { fSetMassConstraint = massConstraint; };
+ void SetPileUpCut(Bool_t cut=kTRUE) { fPileUpCut=cut; }
+
+ Int_t LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *fESD, AliMCEvent *mcEvent,Int_t binct,Double_t deltaphi,Int_t source,Int_t indexmother);
+
+private:
+ TList *fListHist; //! TH list
+ Bool_t fAODAnalysis; // AOD analysis
+ ULong_t fFilter; // reconstruction AOD status flags
+ AliAODMCHeader *fAODMCHeader; // ! MC info AOD
+ TClonesArray *fAODArrayMCInfo; // ! MC info particle AOD
+ AliHFENonPhotonicElectron *fBackgroundSubtraction; // Background subtraction
+
+ Bool_t fVZEROEventPlane; // Use Event Planes from VZERO
+ Bool_t fVZEROEventPlaneA; // Use Event Planes from VZERO A
+ Bool_t fVZEROEventPlaneC; // Use Event Planes from VZERO C
+
+ Bool_t fSubEtaGapTPC; // bool to fill with eta gap
+ Double_t fEtaGap; // Value of the eta gap
+
+ Int_t fNbBinsCentralityQCumulant; // Number of Bins Q Cumulant
+ Double_t fBinCentralityLess[10]; // Centrality Bin lower value
+ Int_t fNbBinsPtQCumulant; // Nbbinspt QCumulant method
+ Double_t fMinPtQCumulant; // Min pt QCumulant method
+ Double_t fMaxPtQCumulant; // Max pt QCumulant method
+ Bool_t fAfterBurnerOn; // Add flow to all tracks
+ Int_t fNonFlowNumberOfTrackClones; // number of times to clone the particles (nonflow)
+ Double_t fV1; // Add Flow. Must be in range [0,0.5].
+ Double_t fV2; // Add Flow. Must be in range [0,0.5].
+ Double_t fV3; // Add Flow. Must be in range [0,0.5].
+ Double_t fV4; // Add Flow. Must be in range [0,0.5].
+ Double_t fV5; // Add Flow. Must be in range [0,0.5].
+ Int_t fMaxNumberOfIterations; // Max number of iteration for adding v2
+ Double_t fPrecisionPhi; // precision phi for adding v2
+ Bool_t fUseMCReactionPlane; // use MC reaction plane
+ Bool_t fSP; // calculate using scalar product method (instead of event plane method)
+
+ Bool_t fMCPID; // MC PID for electrons
+ Bool_t fNoPID; // No PID for checks
+
+ Double_t fChi2OverNDFCut; // Limit chi2
+ Double_t fMaxdca; // Limit dca
+ Double_t fMaxopeningtheta; // Limit opening angle in theta
+ Double_t fMaxopeningphi; // Limit opening angle in phi
+ Double_t fMaxopening3D; // Limit opening 3D
+ Double_t fMaxInvmass; // Limit invariant mass
+ Bool_t fSetMassConstraint; // Set mass constraint
+
+
+ Bool_t fMonitorEventPlane; // Monitor event plane
+ Bool_t fMonitorContamination; // Monitor contamination
+ Bool_t fMonitorPhotonic;// Monitor photonic
+ Bool_t fMonitorWithoutPID;// Monitor without PID
+ Bool_t fMonitorTrackCuts;// Monitor track cuts
+ Bool_t fMonitorQCumulant;// Monitor Q cumulant
+
+ // Cuts for FLOW PWG2
+ AliFlowTrackCuts* fcutsRP; //! Reference particle cut
+ AliFlowTrackCuts* fcutsPOI; //! Particle Of Interest cut
+
+ // Cuts for HFE
+ AliHFEcuts *fHFECuts; // HFE cuts
+ AliHFEpid *fPID; // PID cuts
+ AliHFEpid *fPIDTOFOnly; // PID cuts TOF only
+ AliHFEpidQAmanager *fPIDqa; // QA Manager
+ AliFlowEvent *fflowEvent; //! Flow event
+
+ // Hadron Contamination
+ TF1 *fContamination[11]; // Parametrization of the contamination (0-5,5-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80,80-90,90-100)
+ TF1 *fv2contamination[11]; // Parametrization of the v2 of charged pions (0-5,5-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80,80-90,90-100)
+
+ // Cuts for background study
+ AliESDtrackCuts *fHFEBackgroundCuts; // HFE background cuts
+ AliHFEpid *fPIDBackground; // PID background cuts
+ AliHFEpidQAmanager *fPIDBackgroundqa; // QA Manager Background
+ Bool_t fAlgorithmMA; // algorithm MA
+
+ // List of tracks
+ TArrayI *fArraytrack; //! list of tracks
+ Int_t fCounterPoolBackground; // number of tracks
+
+ // VZERO Event plane after calibration 2010
+ AliHFEVZEROEventPlane *fHFEVZEROEventPlane; // VZERO event plane calibrated
+
+ // Histos
+ TH2D *fHistEV; //! Number of events
+ THnSparseF *fHistPileUp; //! Pile up histogram
+ Bool_t fPileUpCut;
+
+ // A Event plane as function of phiepa, phiepb, phiepc, phiepd centrality
+ // a V0A, b V0C, c TPC,
+ THnSparseF *fEventPlane; //! Event plane
+
+ // B Event Plane after subtraction as function of phiep, centrality
+ THnSparseF *fEventPlaneaftersubtraction; //! Event plane
+
+ // Contamination
+ THnSparseF *fFractionContamination; //! Fraction of contamination as function of pt
+ TProfile2D *fContaminationv2; //! v2 of contamination
+
+ // Monitoring Event plane: cos2phi, sin2phi, centrality
+ THnSparseF *fCosSin2phiep; //! Cos(2phi), Sin(2phi)
+
+ // E Monitoring Event plane after subtraction of the track: cos, centrality, pt, eta
+ THnSparseF *fCos2phie; //! Monitoring
+ THnSparseF *fSin2phie; //! Monitoring
+ THnSparseF *fCos2phiep; //! Monitoring
+ THnSparseF *fSin2phiep; //! Monitoring
+ THnSparseF *fSin2phiephiep; //! Monitoring
+
+ // Fbis Resolution as function of cosres, cosres, cosres, centrality for three subevents (V0)
+ // a V0A, b V0C, c TPC
+ THnSparseF *fCosResabc; //! Res
+ THnSparseF *fSinResabc; //! Res
+ TProfile *fProfileCosResab; //! Profile Res_a_b
+ TProfile *fProfileCosResac; //! Profile Res_a_c
+ TProfile *fProfileCosResbc; //! Profile Res_b_c
+
+ // F Resolution as function of cosres, centrality for two subevents (TPC)
+ THnSparseF *fCosRes; //! Res
+ THnSparseF *fSinRes; //! Res
+ TProfile *fProfileCosRes; //! Profile Res
+
+ // Debuging Cuts step by step all centrality together: pt, step (6)
+ THnSparseF *fTrackingCuts; //! Tracking Cuts
+
+ // Before PID cut
+ // G Maps delta phi as function of deltaphi, centrality, pt
+ THnSparseF *fDeltaPhiMapsBeforePID; //! Delta phi
+ // H Maps cos phi : cos, centrality, pt
+ THnSparseF *fCosPhiMapsBeforePID; //! Cos
+
+ // G Maps delta phi as function of deltaphi, centrality, pt
+ THnSparseF *fDeltaPhiMaps; //! Delta phi
+ THnSparseF *fDeltaPhiMapsContamination; //! Delta phi for contamination substraction
+ // H Maps cos phi : cos, centrality, pt
+ THnSparseF *fCosPhiMaps; //! Cos
+ TProfile2D *fProfileCosPhiMaps; //! Profile Cos
+
+ // Background study: not statistic but tagged
+ THnSparseF *fDeltaPhiMapsTaggedPhotonic; //! Delta phi
+ //THnSparseF *fCosPhiMapsTaggedPhotonic; //! Cos
+ THnSparseF *fDeltaPhiMapsTaggedNonPhotonic; //! Delta phi
+ //THnSparseF *fCosPhiMapsTaggedNonPhotonic; //! Cos
+ THnSparseF *fDeltaPhiMapsTaggedPhotonicLS; //! Delta phi
+ //THnSparseF *fCosPhiMapsTaggedPhotonicLS; //! Cos
+
+ // Background study: centrality, pt, source
+ THnSparseF *fMCSourceDeltaPhiMaps; //! Source MC
+ // Background study: deltaphi, centrality, pt, minv, source
+ THnSparseF *fOppSignDeltaPhiMaps; //! Delta phi
+ THnSparseF *fSameSignDeltaPhiMaps; //! Delta phi
+ // Background study: angle, centrality, source
+ THnSparseF *fOppSignAngle; // ! Opening Angles
+ THnSparseF *fSameSignAngle; // ! Opening Angles
+
+ TTreeSRedirector *fDebugStreamer; //!Debug streamer
+
+ Int_t FindMother(Int_t tr, AliMCEvent *mcEvent, Int_t &indexmother);
+ Int_t CheckPdg(Int_t tr, AliMCEvent* mcEvent);
+ Int_t IsMotherGamma(Int_t tr, AliMCEvent* mcEvent);
+ Int_t IsMotherPi0(Int_t tr, AliMCEvent* mcEvent);
+ Int_t IsMotherC(Int_t tr, AliMCEvent* mcEvent);
+ Int_t IsMotherB(Int_t tr, AliMCEvent* mcEvent);
+ Int_t IsMotherEta(Int_t tr, AliMCEvent* mcEvent);
+
+
+ ClassDef(AliAnalysisTaskFlowTPCTOFEPSP, 1); // analysisclass
+};
+
+#endif
-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-//\r
-// QA task\r
-// \r
-// Authors:\r
-// Raphaelle Bailhache <R.Bailhache@gsi.de>\r
-//\r
-#include "TROOT.h"\r
-#include "TChain.h"\r
-#include "TMath.h"\r
-#include <TString.h>\r
-#include <TBits.h>\r
-#include <TH1F.h>\r
-\r
-#include <TDirectory.h>\r
-#include <TTreeStream.h>\r
-\r
-#include "AliVEventHandler.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliAnalysisManager.h"\r
-\r
-#include "AliVEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliMCEvent.h"\r
-#include "AliESD.h"\r
-#include "AliESDEvent.h"\r
-#include "AliPID.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliESDUtils.h"\r
-#include "AliMCParticle.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODVertex.h"\r
-#include "AliAODTrack.h"\r
-#include "AliVTrack.h"\r
-#include "AliESDtrack.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliAODTrack.h"\r
-#include "AliStack.h"\r
-#include "AliMCEvent.h"\r
-\r
-#include "AliHFEcuts.h"\r
-#include "AliHFEpid.h"\r
-#include "AliHFEpidQAmanager.h"\r
-#include "AliHFEtools.h"\r
-\r
-#include "AliCentrality.h"\r
-#include "AliEventplane.h"\r
-#include "AliAnalysisTaskHFEQA.h"\r
-#include "AliAODMCHeader.h"\r
-\r
-\r
-ClassImp(AliAnalysisTaskHFEQA)\r
-\r
-//____________________________________________________________________\r
-AliAnalysisTaskHFEQA::AliAnalysisTaskHFEQA() :\r
- AliAnalysisTaskSE(),\r
- fListHist(0x0), \r
- fAODAnalysis(kFALSE),\r
- fAODMCHeader(NULL),\r
- fAODArrayMCInfo(NULL),\r
- fHFECuts(0),\r
- fPIDTPConly(0),\r
- fPIDTRDonly(0),\r
- fPIDTOFTPC(0),\r
- fPIDTPCTRD(0),\r
- fPIDTPCEMCal(0),\r
- fPIDqaTRDonly(0),\r
- fPIDqaTOFTPC(0),\r
- fPIDqaTPCTRD(0),\r
- fPIDqaTPCEMCal(0),\r
- fCentralityEstimator("V0M"),\r
- fCollisionSystem(3),\r
- fNbEvent(0),\r
- fTPConly(0),\r
- fTOFTPC(0),\r
- fTPCTRD(0),\r
- fTPCEMCal(0),\r
- fTPConlydo(kFALSE),\r
- fTRDonlydo(kFALSE),\r
- fTOFTPCdo(kFALSE),\r
- fTPCTRDdo(kFALSE),\r
- fTPCEMCaldo(kFALSE)\r
-{\r
- // Constructor\r
- \r
-}\r
-//______________________________________________________________________________\r
-AliAnalysisTaskHFEQA:: AliAnalysisTaskHFEQA(const char *name) :\r
- AliAnalysisTaskSE(name),\r
- fListHist(0x0),\r
- fAODAnalysis(kFALSE),\r
- fAODMCHeader(NULL),\r
- fAODArrayMCInfo(NULL),\r
- fHFECuts(0),\r
- fPIDTPConly(0),\r
- fPIDTRDonly(0),\r
- fPIDTOFTPC(0),\r
- fPIDTPCTRD(0),\r
- fPIDTPCEMCal(0),\r
- fPIDqaTRDonly(0),\r
- fPIDqaTOFTPC(0),\r
- fPIDqaTPCTRD(0),\r
- fPIDqaTPCEMCal(0),\r
- fCentralityEstimator("V0M"),\r
- fCollisionSystem(3),\r
- fNbEvent(0),\r
- fTPConly(0),\r
- fTOFTPC(0),\r
- fTPCTRD(0),\r
- fTPCEMCal(0),\r
- fTPConlydo(kFALSE),\r
- fTRDonlydo(kFALSE),\r
- fTOFTPCdo(kFALSE),\r
- fTPCTRDdo(kFALSE),\r
- fTPCEMCaldo(kFALSE)\r
-{\r
- //\r
- // named ctor\r
- //\r
- \r
- fPIDTPConly = new AliHFEpid("hfePidTPConly");\r
- fPIDTRDonly = new AliHFEpid("hfePidTRDonly");\r
- fPIDTOFTPC = new AliHFEpid("hfePidTOFTPC");\r
- fPIDTPCTRD = new AliHFEpid("hfePidTPCTRD");\r
- fPIDTPCEMCal = new AliHFEpid("hfePidTPCEMCal");\r
-\r
- fPIDqaTRDonly = new AliHFEpidQAmanager;\r
- fPIDqaTOFTPC = new AliHFEpidQAmanager;\r
- fPIDqaTPCTRD = new AliHFEpidQAmanager;\r
- fPIDqaTPCEMCal = new AliHFEpidQAmanager;\r
-\r
- SetPbPbAnalysis();\r
-\r
- DefineInput(0,TChain::Class());\r
- DefineOutput(1, TList::Class());\r
- \r
-}\r
-//____________________________________________________________\r
-AliAnalysisTaskHFEQA::AliAnalysisTaskHFEQA(const AliAnalysisTaskHFEQA &ref):\r
- AliAnalysisTaskSE(ref),\r
- fListHist(NULL),\r
- fAODAnalysis(ref.fAODAnalysis), \r
- fAODMCHeader(ref.fAODMCHeader),\r
- fAODArrayMCInfo(ref.fAODArrayMCInfo),\r
- fHFECuts(NULL),\r
- fPIDTPConly(0),\r
- fPIDTRDonly(0),\r
- fPIDTOFTPC(0),\r
- fPIDTPCTRD(0),\r
- fPIDTPCEMCal(0),\r
- fPIDqaTRDonly(0),\r
- fPIDqaTOFTPC(0),\r
- fPIDqaTPCTRD(0),\r
- fPIDqaTPCEMCal(0),\r
- fCentralityEstimator(ref.fCentralityEstimator),\r
- fCollisionSystem(ref.fCollisionSystem),\r
- fNbEvent(ref.fNbEvent),\r
- fTPConly(ref.fTPConly),\r
- fTOFTPC(ref.fTOFTPC),\r
- fTPCTRD(ref.fTPCTRD),\r
- fTPCEMCal(ref.fTPCEMCal),\r
- fTPConlydo(ref.fTPConlydo),\r
- fTRDonlydo(ref.fTRDonlydo),\r
- fTOFTPCdo(ref.fTOFTPCdo),\r
- fTPCTRDdo(ref.fTPCTRDdo),\r
- fTPCEMCaldo(ref.fTPCEMCaldo)\r
-{\r
- //\r
- // Copy Constructor\r
- //\r
-\r
- ref.Copy(*this);\r
-}\r
-\r
-//____________________________________________________________\r
-AliAnalysisTaskHFEQA &AliAnalysisTaskHFEQA::operator=(const AliAnalysisTaskHFEQA &ref){\r
- //\r
- // Assignment operator\r
- //\r
- if(this == &ref) \r
- ref.Copy(*this);\r
- return *this;\r
-}\r
-\r
-//____________________________________________________________\r
-void AliAnalysisTaskHFEQA::Copy(TObject &o) const {\r
- // \r
- // Copy into object o\r
- //\r
- AliAnalysisTaskHFEQA &target = dynamic_cast<AliAnalysisTaskHFEQA &>(o);\r
- target.fListHist = fListHist;\r
- target.fAODAnalysis = fAODAnalysis;\r
- target.fAODMCHeader = fAODMCHeader;\r
- target.fAODArrayMCInfo = fAODArrayMCInfo;\r
- target.fHFECuts = fHFECuts;\r
- target.fPIDTPConly = fPIDTPConly;\r
- target.fPIDTRDonly = fPIDTRDonly;\r
- target.fPIDTOFTPC = fPIDTOFTPC;\r
- target.fPIDTPCTRD = fPIDTPCTRD;\r
- target.fPIDTPCEMCal = fPIDTPCEMCal;\r
- target.fPIDqaTRDonly = fPIDqaTRDonly;\r
- target.fPIDqaTOFTPC = fPIDqaTOFTPC;\r
- target.fPIDqaTPCTRD = fPIDqaTPCTRD;\r
- target.fPIDqaTPCEMCal = fPIDqaTPCEMCal;\r
- target.fCentralityEstimator = fCentralityEstimator;\r
- target.fCollisionSystem = fCollisionSystem;\r
- target.fNbEvent = fNbEvent;\r
- target.fTPConly = fTPConly;\r
- target.fTOFTPC = fTOFTPC;\r
- target.fTPCTRD = fTPCTRD;\r
- target.fTPCEMCal = fTPCEMCal;\r
- target.fTPConlydo = fTPConlydo;\r
- target.fTRDonlydo = fTRDonlydo; \r
- target.fTOFTPCdo = fTOFTPCdo;\r
- target.fTPCTRDdo = fTPCTRDdo;\r
- target.fTPCEMCaldo = fTPCEMCaldo;\r
- \r
-\r
-}\r
-//____________________________________________________________\r
-AliAnalysisTaskHFEQA::~AliAnalysisTaskHFEQA(){\r
- //\r
- // Destructor\r
- //\r
- \r
-\r
- if(fListHist) delete fListHist;\r
- if(fHFECuts) delete fHFECuts;\r
- if(fPIDTPConly) delete fPIDTPConly;\r
- if(fPIDTRDonly) delete fPIDTRDonly;\r
- if(fPIDTOFTPC) delete fPIDTOFTPC;\r
- if(fPIDTPCTRD) delete fPIDTPCTRD;\r
- if(fPIDTPCEMCal) delete fPIDTPCEMCal;\r
-\r
- \r
-}\r
-//________________________________________________________________________\r
-void AliAnalysisTaskHFEQA::UserCreateOutputObjects()\r
-{\r
-\r
- //********************\r
- // Create histograms\r
- //********************\r
- AliDebug(2,"AliAnalysisTaskHFEQA: User create output objects");\r
-\r
-\r
- // AOD or ESD\r
- AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());\r
- if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){\r
- SetAODAnalysis(kTRUE);\r
- AliDebug(2,"Put AOD analysis on");\r
- } else {\r
- SetAODAnalysis(kFALSE);\r
- }\r
-\r
- AliDebug(2,"AliAnalysisTaskHFEQA: AOD ESD");\r
-\r
- // HFE cuts\r
-\r
- if(!fHFECuts){\r
- fHFECuts = new AliHFEcuts;\r
- fHFECuts->CreateStandardCuts();\r
- }\r
- fHFECuts->Initialize();\r
- if(fAODAnalysis) {\r
- fHFECuts->SetAOD();\r
- } \r
-\r
- AliDebug(2,"AliAnalysisTaskHFEQA: HFE cuts");\r
-\r
-\r
- // PIDTPConly HFE\r
- if(!fPIDTPConly) {\r
- fPIDTPConly =new AliHFEpid("hfePidTPConly");\r
- }\r
- if(!fPIDTPConly->GetNumberOfPIDdetectors()) fPIDTPConly->AddDetector("TPC", 0);\r
- fPIDTPConly->InitializePID();\r
- fPIDTPConly->SortDetectors();\r
-\r
- // PIDTRDonly HFE\r
- if(!fPIDTRDonly) {\r
- fPIDTRDonly =new AliHFEpid("hfePidTRDonly");\r
- }\r
- if(!fPIDTRDonly->GetNumberOfPIDdetectors()) fPIDTRDonly->AddDetector("TRD", 0);\r
- fPIDTRDonly->InitializePID();\r
- fPIDqaTRDonly->Initialize(fPIDTRDonly);\r
- fPIDTRDonly->SortDetectors();\r
-\r
- // PIDTOFTPC HFE\r
- if(!fPIDTOFTPC) {\r
- fPIDTOFTPC =new AliHFEpid("hfePidTOFTPC");\r
- }\r
- if(!fPIDTOFTPC->GetNumberOfPIDdetectors()) {\r
- fPIDTOFTPC->AddDetector("TOF", 0);\r
- fPIDTOFTPC->AddDetector("TPC", 1);\r
- }\r
- fPIDTOFTPC->InitializePID();\r
- fPIDqaTOFTPC->Initialize(fPIDTOFTPC);\r
- fPIDTOFTPC->SortDetectors();\r
-\r
-\r
- // PIDTPCTRD HFE\r
- if(!fPIDTPCTRD) {\r
- fPIDTPCTRD =new AliHFEpid("hfePidTPCTRD");\r
- }\r
- if(!fPIDTPCTRD->GetNumberOfPIDdetectors()) {\r
- fPIDTPCTRD->AddDetector("TPC", 0);\r
- fPIDTPCTRD->AddDetector("TRD", 1);\r
- }\r
- fPIDTPCTRD->InitializePID();\r
- fPIDqaTPCTRD->Initialize(fPIDTPCTRD);\r
- fPIDTPCTRD->SortDetectors();\r
-\r
- // PIDTPCEMCal HFE\r
- if(!fPIDTPCEMCal) {\r
- fPIDTPCEMCal =new AliHFEpid("hfePidTPCEMCal");\r
- }\r
- if(!fPIDTPCEMCal->GetNumberOfPIDdetectors()) {\r
- fPIDTPCEMCal->AddDetector("TPC", 0);\r
- fPIDTPCEMCal->AddDetector("EMCal", 1);\r
- }\r
- fPIDTPCEMCal->InitializePID();\r
- fPIDqaTPCEMCal->Initialize(fPIDTPCEMCal);\r
- fPIDTPCEMCal->SortDetectors();\r
- \r
- // Histograms\r
- fNbEvent = new TH1F("NbEvent", "",11,0,11);\r
- fNbEvent->Sumw2();\r
- Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};\r
- fTPConly = new TH1F("TPCOnly", "",35,&ptbinning[0]);\r
- fTPConly->Sumw2();\r
- fTOFTPC = new TH1F("TOFTPC", "",35,&ptbinning[0]);\r
- fTOFTPC->Sumw2();\r
- fTPCTRD = new TH1F("TPCTRD", "",35,&ptbinning[0]);\r
- fTPCTRD->Sumw2();\r
- fTPCEMCal = new TH1F("TPCEMCal", "",35,&ptbinning[0]);\r
- fTPCEMCal->Sumw2();\r
-\r
-\r
- // List\r
- \r
- fListHist = new TList();\r
- fListHist->SetOwner();\r
-\r
- fListHist->Add(fPIDqaTRDonly->MakeList("HFEpidQATRDonly"));\r
- fListHist->Add(fPIDqaTOFTPC->MakeList("HFEpidQATOFTPC"));\r
- fListHist->Add(fPIDqaTPCTRD->MakeList("HFEpidQATPCTRD"));\r
- fListHist->Add(fPIDqaTPCEMCal->MakeList("HFEpidQATPCEMCal"));\r
-\r
- fListHist->Add(fNbEvent);\r
- fListHist->Add(fTPConly);\r
- fListHist->Add(fTOFTPC);\r
- fListHist->Add(fTPCTRD);\r
- fListHist->Add(fTPCEMCal);\r
-\r
- AliDebug(2,"AliAnalysisTaskHFEQA: list");\r
-\r
-\r
- fListHist->Print();\r
-\r
- PostData(1, fListHist);\r
-\r
- AliDebug(2,"AliAnalysisTaskHFEQA: post");\r
-\r
-\r
-}\r
- \r
-//________________________________________________________________________\r
-void AliAnalysisTaskHFEQA::UserExec(Option_t */*option*/)\r
-{\r
- //\r
- // Loop over event\r
- //\r
- \r
- Double_t binct = 11.5;\r
-\r
- AliMCEvent *mcEvent = MCEvent();\r
- \r
-\r
- AliDebug(2,"MC info");\r
- // MC info\r
- Bool_t mcthere = kTRUE;\r
- if(fAODAnalysis) {\r
- AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent);\r
- if(!aodE){\r
- AliError("No AOD Event");\r
- return;\r
- }\r
- fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName()));\r
- if(!fAODMCHeader){ \r
- mcthere = kFALSE;\r
- }\r
- fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));\r
- if(!fAODArrayMCInfo){ \r
- mcthere = kFALSE;\r
- }\r
- else {\r
- fHFECuts->SetMCEvent(aodE);\r
- }\r
- }\r
- else {\r
- AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());\r
- if(!mcH){\r
- mcthere=kFALSE;\r
- }\r
- if(mcEvent) fHFECuts->SetMCEvent(mcEvent);\r
- }\r
-\r
-\r
- ////////////////////////////////////\r
- // Number of contributors\r
- ///////////////////////////////////\r
- AliDebug(2,"Number of contributors");\r
- Int_t ncontribVtx = 0;\r
- if(fAODAnalysis) {\r
- AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent);\r
- if(!fAOD){\r
- AliError("AOD Event required for AOD Analysis");\r
- return;\r
- } \r
- AliAODVertex *priVtx = fAOD->GetPrimaryVertex();\r
- if(priVtx){\r
- ncontribVtx = priVtx->GetNContributors();\r
- }\r
- }\r
- else {\r
- AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);\r
- if(!fESD){\r
- AliError("ESD Event required for ESD Analysis");\r
- return;\r
- }\r
- const AliESDVertex *priVtx = fESD->GetPrimaryVertexTracks();\r
- if(priVtx){\r
- ncontribVtx = priVtx->GetNContributors();\r
- }\r
- }\r
- AliDebug(2,Form("Number of contributors %d",ncontribVtx));\r
-\r
-\r
- /////////////////////////////////\r
- // centrality\r
- ////////////////////////////////\r
-\r
- //printf("Centrality \n");\r
- AliCentrality *centrality = fInputEvent->GetCentrality();\r
- AliDebug(2,"Got the centrality");\r
- Float_t cntr = 0.;\r
- if(centrality && (! Ispp())) { \r
- cntr = centrality->GetCentralityPercentile(fCentralityEstimator.Data());\r
- if((0.0< cntr) && (cntr<5.0)) binct = 0.5;\r
- if((5.0< cntr) && (cntr<10.0)) binct = 1.5;\r
- if((10.0< cntr) && (cntr<20.0)) binct = 2.5;\r
- if((20.0< cntr) && (cntr<30.0)) binct = 3.5;\r
- if((30.0< cntr) && (cntr<40.0)) binct = 4.5;\r
- if((40.0< cntr) && (cntr<50.0)) binct = 5.5;\r
- if((50.0< cntr) && (cntr<60.0)) binct = 6.5;\r
- if((60.0< cntr) && (cntr<70.0)) binct = 7.5;\r
- if((70.0< cntr) && (cntr<80.0)) binct = 8.5;\r
- if((80.0< cntr) && (cntr<90.0)) binct = 9.5;\r
- if((90.0< cntr) && (cntr<100.0)) binct = 10.5;\r
- if(binct > 11.0) return;\r
- }\r
- else binct = 0.5;\r
- AliDebug(2,Form("Centrality %f with %s",binct,fCentralityEstimator.Data()));\r
- \r
- //////////////////////\r
- // run number\r
- //////////////////////\r
-\r
- Int_t runnumber = fInputEvent->GetRunNumber();\r
- AliDebug(2,Form("Run number %d",runnumber));\r
- \r
- if(!fPIDTPConly->IsInitialized()){\r
- fPIDTPConly->InitializePID(runnumber);\r
- }\r
- if(!fPIDTRDonly->IsInitialized()){\r
- fPIDTRDonly->InitializePID(runnumber);\r
- }\r
- if(!fPIDTOFTPC->IsInitialized()){\r
- fPIDTOFTPC->InitializePID(runnumber);\r
- }\r
- if(!fPIDTPCTRD->IsInitialized()){\r
- fPIDTPCTRD->InitializePID(runnumber);\r
- }\r
- if(!fPIDTPCEMCal->IsInitialized()){\r
- fPIDTPCEMCal->InitializePID(runnumber);\r
- }\r
-\r
- //\r
- fHFECuts->SetRecEvent(fInputEvent);\r
- \r
-\r
-\r
- //////////\r
- // PID\r
- //////////\r
- AliDebug(2,"PID response");\r
- AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();\r
- if(!pidResponse){\r
- AliDebug(2,"No PID response set");\r
- return;\r
- }\r
- fPIDTPConly->SetPIDResponse(pidResponse);\r
- fPIDTRDonly->SetPIDResponse(pidResponse);\r
- fPIDTOFTPC->SetPIDResponse(pidResponse);\r
- fPIDTPCTRD->SetPIDResponse(pidResponse);\r
- fPIDTPCEMCal->SetPIDResponse(pidResponse);\r
- \r
- //////////////////\r
- // Event cut\r
- //////////////////\r
- AliDebug(2,"Event cut");\r
- if(!fHFECuts->CheckEventCuts("fEvRecCuts", fInputEvent)) {\r
- AliDebug(2,"Does not pass the event cut");\r
- PostData(1, fListHist);\r
- return;\r
- }\r
- fNbEvent->Fill(binct);\r
- \r
- //////////////////////////\r
- // Loop over track\r
- //////////////////////////\r
- Int_t nbtracks = fInputEvent->GetNumberOfTracks();\r
- AliDebug(2,Form("Number of tracks %d",nbtracks));\r
- for(Int_t k = 0; k < nbtracks; k++){\r
- \r
- AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);\r
- if(!track) continue;\r
- Double_t pt = track->Pt(); \r
-\r
- AliDebug(2,"test 0\n");\r
- \r
- // RecKine: ITSTPC cuts \r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- AliDebug(2,"test 1\n");\r
-\r
- // RecPrim\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- AliDebug(2,"test 2\n");\r
-\r
- // HFEcuts: ITS layers cuts\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- AliDebug(2,"test 3\n");\r
-\r
- // HFE cuts: TOF and mismatch flag\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- AliDebug(2,"test 4\n");\r
-\r
- // HFE cuts: TPC PID cleanup\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- AliDebug(2,"test 5\n");\r
-\r
- // HFEcuts: Nb of tracklets TRD0\r
- if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;\r
- \r
- AliDebug(2,"Survived");\r
- \r
-\r
- ////////////////////////\r
- // Apply PID\r
- ////////////////////////\r
- AliHFEpidObject hfetrack;\r
- if(!fAODAnalysis) hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);\r
- else hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);\r
- hfetrack.SetRecTrack(track);\r
- hfetrack.SetCentrality((Int_t)binct);\r
- hfetrack.SetMulitplicity(ncontribVtx); // for correction\r
- if(IsPbPb()) hfetrack.SetPbPb();\r
- else{\r
- if(IspPb()) hfetrack.SetpPb();\r
- else {\r
- hfetrack.SetPP();\r
- //printf("pp\n");\r
- }\r
- }\r
- AliDebug(2,Form("centrality %f and %d",binct,hfetrack.GetCentrality()));\r
- \r
- //printf("test 7\n");\r
-\r
- // Complete PID TPC alone\r
- if(fTPConlydo) {\r
- if(fPIDTPConly->IsSelected(&hfetrack,0x0,"recTrackCont",0x0)) {\r
- fTPConly->Fill(pt);\r
- }\r
- }\r
- AliDebug(2,"TPC only PID\n");\r
- \r
- // Complete PID TRD alone\r
- if(fTRDonlydo) {\r
- if(fPIDTRDonly->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTRDonly)) {\r
- AliDebug(2,"Passed TRD only PID\n");\r
- }\r
- }\r
- AliDebug(2,"TRD only PID\n");\r
- \r
- \r
- // Complete PID TPC TOF \r
- if(fTOFTPCdo) {\r
- if(fPIDTOFTPC->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTOFTPC)) {\r
- fTOFTPC->Fill(pt);\r
- }\r
- }\r
- AliDebug(2,"TOF TPC PID\n");\r
- \r
- // Complete PID TPC TRD \r
- if(fTPCTRDdo) {\r
- if(fPIDTPCTRD->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTPCTRD)) {\r
- fTPCTRD->Fill(pt);\r
- }\r
- }\r
- AliDebug(2,"TPC TRD PID\n");\r
-\r
-\r
- if(fTPCEMCaldo) {\r
- if(!fAODAnalysis) {\r
- // Complete PID TPC TRD \r
- if(fPIDTPCEMCal->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTPCEMCal)) {\r
- fTPCEMCal->Fill(pt);\r
- }\r
- }\r
- }\r
- AliDebug(2,"TPC EMCal PID\n");\r
- \r
- \r
- }\r
- \r
- PostData(1, fListHist);\r
- \r
-}\r
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+//
+// QA task
+//
+// Authors:
+// Raphaelle Bailhache <R.Bailhache@gsi.de>
+//
+#include "TROOT.h"
+#include "TChain.h"
+#include "TMath.h"
+#include <TString.h>
+#include <TBits.h>
+#include <TH1F.h>
+
+#include <TDirectory.h>
+#include <TTreeStream.h>
+
+#include "AliVEventHandler.h"
+#include "AliMCEventHandler.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisManager.h"
+
+#include "AliVEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliMCEvent.h"
+#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliESDUtils.h"
+#include "AliMCParticle.h"
+#include "AliAODMCParticle.h"
+#include "AliAODEvent.h"
+#include "AliAODVertex.h"
+#include "AliAODTrack.h"
+#include "AliVTrack.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliAODTrack.h"
+#include "AliStack.h"
+#include "AliMCEvent.h"
+
+#include "AliHFEcuts.h"
+#include "AliHFEpid.h"
+#include "AliHFEpidQAmanager.h"
+#include "AliHFEtools.h"
+
+#include "AliCentrality.h"
+#include "AliEventplane.h"
+#include "AliAnalysisTaskHFEQA.h"
+#include "AliAODMCHeader.h"
+
+
+ClassImp(AliAnalysisTaskHFEQA)
+
+//____________________________________________________________________
+AliAnalysisTaskHFEQA::AliAnalysisTaskHFEQA() :
+ AliAnalysisTaskSE(),
+ fListHist(0x0),
+ fAODAnalysis(kFALSE),
+ fAODMCHeader(NULL),
+ fAODArrayMCInfo(NULL),
+ fHFECuts(0),
+ fPIDTPConly(0),
+ fPIDTRDonly(0),
+ fPIDTOFTPC(0),
+ fPIDTPCTRD(0),
+ fPIDTPCEMCal(0),
+ fPIDqaTRDonly(0),
+ fPIDqaTOFTPC(0),
+ fPIDqaTPCTRD(0),
+ fPIDqaTPCEMCal(0),
+ fCentralityEstimator("V0M"),
+ fCollisionSystem(3),
+ fNbEvent(0),
+ fTPConly(0),
+ fTOFTPC(0),
+ fTPCTRD(0),
+ fTPCEMCal(0),
+ fTPConlydo(kFALSE),
+ fTRDonlydo(kFALSE),
+ fTOFTPCdo(kFALSE),
+ fTPCTRDdo(kFALSE),
+ fTPCEMCaldo(kFALSE)
+{
+ // Constructor
+
+}
+//______________________________________________________________________________
+AliAnalysisTaskHFEQA:: AliAnalysisTaskHFEQA(const char *name) :
+ AliAnalysisTaskSE(name),
+ fListHist(0x0),
+ fAODAnalysis(kFALSE),
+ fAODMCHeader(NULL),
+ fAODArrayMCInfo(NULL),
+ fHFECuts(0),
+ fPIDTPConly(0),
+ fPIDTRDonly(0),
+ fPIDTOFTPC(0),
+ fPIDTPCTRD(0),
+ fPIDTPCEMCal(0),
+ fPIDqaTRDonly(0),
+ fPIDqaTOFTPC(0),
+ fPIDqaTPCTRD(0),
+ fPIDqaTPCEMCal(0),
+ fCentralityEstimator("V0M"),
+ fCollisionSystem(3),
+ fNbEvent(0),
+ fTPConly(0),
+ fTOFTPC(0),
+ fTPCTRD(0),
+ fTPCEMCal(0),
+ fTPConlydo(kFALSE),
+ fTRDonlydo(kFALSE),
+ fTOFTPCdo(kFALSE),
+ fTPCTRDdo(kFALSE),
+ fTPCEMCaldo(kFALSE)
+{
+ //
+ // named ctor
+ //
+
+ fPIDTPConly = new AliHFEpid("hfePidTPConly");
+ fPIDTRDonly = new AliHFEpid("hfePidTRDonly");
+ fPIDTOFTPC = new AliHFEpid("hfePidTOFTPC");
+ fPIDTPCTRD = new AliHFEpid("hfePidTPCTRD");
+ fPIDTPCEMCal = new AliHFEpid("hfePidTPCEMCal");
+
+ fPIDqaTRDonly = new AliHFEpidQAmanager;
+ fPIDqaTOFTPC = new AliHFEpidQAmanager;
+ fPIDqaTPCTRD = new AliHFEpidQAmanager;
+ fPIDqaTPCEMCal = new AliHFEpidQAmanager;
+
+ SetPbPbAnalysis();
+
+ DefineInput(0,TChain::Class());
+ DefineOutput(1, TList::Class());
+
+}
+//____________________________________________________________
+AliAnalysisTaskHFEQA::AliAnalysisTaskHFEQA(const AliAnalysisTaskHFEQA &ref):
+ AliAnalysisTaskSE(ref),
+ fListHist(NULL),
+ fAODAnalysis(ref.fAODAnalysis),
+ fAODMCHeader(ref.fAODMCHeader),
+ fAODArrayMCInfo(ref.fAODArrayMCInfo),
+ fHFECuts(NULL),
+ fPIDTPConly(0),
+ fPIDTRDonly(0),
+ fPIDTOFTPC(0),
+ fPIDTPCTRD(0),
+ fPIDTPCEMCal(0),
+ fPIDqaTRDonly(0),
+ fPIDqaTOFTPC(0),
+ fPIDqaTPCTRD(0),
+ fPIDqaTPCEMCal(0),
+ fCentralityEstimator(ref.fCentralityEstimator),
+ fCollisionSystem(ref.fCollisionSystem),
+ fNbEvent(ref.fNbEvent),
+ fTPConly(ref.fTPConly),
+ fTOFTPC(ref.fTOFTPC),
+ fTPCTRD(ref.fTPCTRD),
+ fTPCEMCal(ref.fTPCEMCal),
+ fTPConlydo(ref.fTPConlydo),
+ fTRDonlydo(ref.fTRDonlydo),
+ fTOFTPCdo(ref.fTOFTPCdo),
+ fTPCTRDdo(ref.fTPCTRDdo),
+ fTPCEMCaldo(ref.fTPCEMCaldo)
+{
+ //
+ // Copy Constructor
+ //
+
+ ref.Copy(*this);
+}
+
+//____________________________________________________________
+AliAnalysisTaskHFEQA &AliAnalysisTaskHFEQA::operator=(const AliAnalysisTaskHFEQA &ref){
+ //
+ // Assignment operator
+ //
+ if(this == &ref)
+ ref.Copy(*this);
+ return *this;
+}
+
+//____________________________________________________________
+void AliAnalysisTaskHFEQA::Copy(TObject &o) const {
+ //
+ // Copy into object o
+ //
+ AliAnalysisTaskHFEQA &target = dynamic_cast<AliAnalysisTaskHFEQA &>(o);
+ target.fListHist = fListHist;
+ target.fAODAnalysis = fAODAnalysis;
+ target.fAODMCHeader = fAODMCHeader;
+ target.fAODArrayMCInfo = fAODArrayMCInfo;
+ target.fHFECuts = fHFECuts;
+ target.fPIDTPConly = fPIDTPConly;
+ target.fPIDTRDonly = fPIDTRDonly;
+ target.fPIDTOFTPC = fPIDTOFTPC;
+ target.fPIDTPCTRD = fPIDTPCTRD;
+ target.fPIDTPCEMCal = fPIDTPCEMCal;
+ target.fPIDqaTRDonly = fPIDqaTRDonly;
+ target.fPIDqaTOFTPC = fPIDqaTOFTPC;
+ target.fPIDqaTPCTRD = fPIDqaTPCTRD;
+ target.fPIDqaTPCEMCal = fPIDqaTPCEMCal;
+ target.fCentralityEstimator = fCentralityEstimator;
+ target.fCollisionSystem = fCollisionSystem;
+ target.fNbEvent = fNbEvent;
+ target.fTPConly = fTPConly;
+ target.fTOFTPC = fTOFTPC;
+ target.fTPCTRD = fTPCTRD;
+ target.fTPCEMCal = fTPCEMCal;
+ target.fTPConlydo = fTPConlydo;
+ target.fTRDonlydo = fTRDonlydo;
+ target.fTOFTPCdo = fTOFTPCdo;
+ target.fTPCTRDdo = fTPCTRDdo;
+ target.fTPCEMCaldo = fTPCEMCaldo;
+
+
+}
+//____________________________________________________________
+AliAnalysisTaskHFEQA::~AliAnalysisTaskHFEQA(){
+ //
+ // Destructor
+ //
+
+
+ if(fListHist) delete fListHist;
+ if(fHFECuts) delete fHFECuts;
+ if(fPIDTPConly) delete fPIDTPConly;
+ if(fPIDTRDonly) delete fPIDTRDonly;
+ if(fPIDTOFTPC) delete fPIDTOFTPC;
+ if(fPIDTPCTRD) delete fPIDTPCTRD;
+ if(fPIDTPCEMCal) delete fPIDTPCEMCal;
+
+
+}
+//________________________________________________________________________
+void AliAnalysisTaskHFEQA::UserCreateOutputObjects()
+{
+
+ //********************
+ // Create histograms
+ //********************
+ AliDebug(2,"AliAnalysisTaskHFEQA: User create output objects");
+
+
+ // AOD or ESD
+ AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+ if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
+ SetAODAnalysis(kTRUE);
+ AliDebug(2,"Put AOD analysis on");
+ } else {
+ SetAODAnalysis(kFALSE);
+ }
+
+ AliDebug(2,"AliAnalysisTaskHFEQA: AOD ESD");
+
+ // HFE cuts
+
+ if(!fHFECuts){
+ fHFECuts = new AliHFEcuts;
+ fHFECuts->CreateStandardCuts();
+ }
+ fHFECuts->Initialize();
+ if(fAODAnalysis) {
+ fHFECuts->SetAOD();
+ }
+
+ AliDebug(2,"AliAnalysisTaskHFEQA: HFE cuts");
+
+
+ // PIDTPConly HFE
+ if(!fPIDTPConly) {
+ fPIDTPConly =new AliHFEpid("hfePidTPConly");
+ }
+ if(!fPIDTPConly->GetNumberOfPIDdetectors()) fPIDTPConly->AddDetector("TPC", 0);
+ fPIDTPConly->InitializePID();
+ fPIDTPConly->SortDetectors();
+
+ // PIDTRDonly HFE
+ if(!fPIDTRDonly) {
+ fPIDTRDonly =new AliHFEpid("hfePidTRDonly");
+ }
+ if(!fPIDTRDonly->GetNumberOfPIDdetectors()) fPIDTRDonly->AddDetector("TRD", 0);
+ fPIDTRDonly->InitializePID();
+ fPIDqaTRDonly->Initialize(fPIDTRDonly);
+ fPIDTRDonly->SortDetectors();
+
+ // PIDTOFTPC HFE
+ if(!fPIDTOFTPC) {
+ fPIDTOFTPC =new AliHFEpid("hfePidTOFTPC");
+ }
+ if(!fPIDTOFTPC->GetNumberOfPIDdetectors()) {
+ fPIDTOFTPC->AddDetector("TOF", 0);
+ fPIDTOFTPC->AddDetector("TPC", 1);
+ }
+ fPIDTOFTPC->InitializePID();
+ fPIDqaTOFTPC->Initialize(fPIDTOFTPC);
+ fPIDTOFTPC->SortDetectors();
+
+
+ // PIDTPCTRD HFE
+ if(!fPIDTPCTRD) {
+ fPIDTPCTRD =new AliHFEpid("hfePidTPCTRD");
+ }
+ if(!fPIDTPCTRD->GetNumberOfPIDdetectors()) {
+ fPIDTPCTRD->AddDetector("TPC", 0);
+ fPIDTPCTRD->AddDetector("TRD", 1);
+ }
+ fPIDTPCTRD->InitializePID();
+ fPIDqaTPCTRD->Initialize(fPIDTPCTRD);
+ fPIDTPCTRD->SortDetectors();
+
+ // PIDTPCEMCal HFE
+ if(!fPIDTPCEMCal) {
+ fPIDTPCEMCal =new AliHFEpid("hfePidTPCEMCal");
+ }
+ if(!fPIDTPCEMCal->GetNumberOfPIDdetectors()) {
+ fPIDTPCEMCal->AddDetector("TPC", 0);
+ fPIDTPCEMCal->AddDetector("EMCal", 1);
+ }
+ fPIDTPCEMCal->InitializePID();
+ fPIDqaTPCEMCal->Initialize(fPIDTPCEMCal);
+ fPIDTPCEMCal->SortDetectors();
+
+ // Histograms
+ fNbEvent = new TH1F("NbEvent", "",11,0,11);
+ fNbEvent->Sumw2();
+ Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
+ fTPConly = new TH1F("TPCOnly", "",35,&ptbinning[0]);
+ fTPConly->Sumw2();
+ fTOFTPC = new TH1F("TOFTPC", "",35,&ptbinning[0]);
+ fTOFTPC->Sumw2();
+ fTPCTRD = new TH1F("TPCTRD", "",35,&ptbinning[0]);
+ fTPCTRD->Sumw2();
+ fTPCEMCal = new TH1F("TPCEMCal", "",35,&ptbinning[0]);
+ fTPCEMCal->Sumw2();
+
+
+ // List
+
+ fListHist = new TList();
+ fListHist->SetOwner();
+
+ fListHist->Add(fPIDqaTRDonly->MakeList("HFEpidQATRDonly"));
+ fListHist->Add(fPIDqaTOFTPC->MakeList("HFEpidQATOFTPC"));
+ fListHist->Add(fPIDqaTPCTRD->MakeList("HFEpidQATPCTRD"));
+ fListHist->Add(fPIDqaTPCEMCal->MakeList("HFEpidQATPCEMCal"));
+
+ fListHist->Add(fNbEvent);
+ fListHist->Add(fTPConly);
+ fListHist->Add(fTOFTPC);
+ fListHist->Add(fTPCTRD);
+ fListHist->Add(fTPCEMCal);
+
+ AliDebug(2,"AliAnalysisTaskHFEQA: list");
+
+
+ fListHist->Print();
+
+ PostData(1, fListHist);
+
+ AliDebug(2,"AliAnalysisTaskHFEQA: post");
+
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHFEQA::UserExec(Option_t */*option*/)
+{
+ //
+ // Loop over event
+ //
+
+ Double_t binct = 11.5;
+
+ AliMCEvent *mcEvent = MCEvent();
+
+
+ AliDebug(2,"MC info");
+ // MC info
+ Bool_t mcthere = kTRUE;
+ if(fAODAnalysis) {
+ AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent);
+ if(!aodE){
+ AliError("No AOD Event");
+ return;
+ }
+ fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName()));
+ if(!fAODMCHeader){
+ mcthere = kFALSE;
+ }
+ fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+ if(!fAODArrayMCInfo){
+ mcthere = kFALSE;
+ }
+ else {
+ fHFECuts->SetMCEvent(aodE);
+ }
+ }
+ else {
+ AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+ if(!mcH){
+ mcthere=kFALSE;
+ }
+ if(mcEvent) fHFECuts->SetMCEvent(mcEvent);
+ }
+
+
+ ////////////////////////////////////
+ // Number of contributors
+ ///////////////////////////////////
+ AliDebug(2,"Number of contributors");
+ Int_t ncontribVtx = 0;
+ if(fAODAnalysis) {
+ AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent);
+ if(!fAOD){
+ AliError("AOD Event required for AOD Analysis");
+ return;
+ }
+ AliAODVertex *priVtx = fAOD->GetPrimaryVertex();
+ if(priVtx){
+ ncontribVtx = priVtx->GetNContributors();
+ }
+ }
+ else {
+ AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
+ if(!fESD){
+ AliError("ESD Event required for ESD Analysis");
+ return;
+ }
+ const AliESDVertex *priVtx = fESD->GetPrimaryVertexTracks();
+ if(priVtx){
+ ncontribVtx = priVtx->GetNContributors();
+ }
+ }
+ AliDebug(2,Form("Number of contributors %d",ncontribVtx));
+
+
+ /////////////////////////////////
+ // centrality
+ ////////////////////////////////
+
+ //printf("Centrality \n");
+ AliCentrality *centrality = fInputEvent->GetCentrality();
+ AliDebug(2,"Got the centrality");
+ Float_t cntr = 0.;
+ if(centrality && (! Ispp())) {
+ cntr = centrality->GetCentralityPercentile(fCentralityEstimator.Data());
+ if((0.0< cntr) && (cntr<5.0)) binct = 0.5;
+ if((5.0< cntr) && (cntr<10.0)) binct = 1.5;
+ if((10.0< cntr) && (cntr<20.0)) binct = 2.5;
+ if((20.0< cntr) && (cntr<30.0)) binct = 3.5;
+ if((30.0< cntr) && (cntr<40.0)) binct = 4.5;
+ if((40.0< cntr) && (cntr<50.0)) binct = 5.5;
+ if((50.0< cntr) && (cntr<60.0)) binct = 6.5;
+ if((60.0< cntr) && (cntr<70.0)) binct = 7.5;
+ if((70.0< cntr) && (cntr<80.0)) binct = 8.5;
+ if((80.0< cntr) && (cntr<90.0)) binct = 9.5;
+ if((90.0< cntr) && (cntr<100.0)) binct = 10.5;
+ if(binct > 11.0) return;
+ }
+ else binct = 0.5;
+ AliDebug(2,Form("Centrality %f with %s",binct,fCentralityEstimator.Data()));
+
+ //////////////////////
+ // run number
+ //////////////////////
+
+ Int_t runnumber = fInputEvent->GetRunNumber();
+ AliDebug(2,Form("Run number %d",runnumber));
+
+ if(!fPIDTPConly->IsInitialized()){
+ fPIDTPConly->InitializePID(runnumber);
+ }
+ if(!fPIDTRDonly->IsInitialized()){
+ fPIDTRDonly->InitializePID(runnumber);
+ }
+ if(!fPIDTOFTPC->IsInitialized()){
+ fPIDTOFTPC->InitializePID(runnumber);
+ }
+ if(!fPIDTPCTRD->IsInitialized()){
+ fPIDTPCTRD->InitializePID(runnumber);
+ }
+ if(!fPIDTPCEMCal->IsInitialized()){
+ fPIDTPCEMCal->InitializePID(runnumber);
+ }
+
+ //
+ fHFECuts->SetRecEvent(fInputEvent);
+
+
+
+ //////////
+ // PID
+ //////////
+ AliDebug(2,"PID response");
+ AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
+ if(!pidResponse){
+ AliDebug(2,"No PID response set");
+ return;
+ }
+ fPIDTPConly->SetPIDResponse(pidResponse);
+ fPIDTRDonly->SetPIDResponse(pidResponse);
+ fPIDTOFTPC->SetPIDResponse(pidResponse);
+ fPIDTPCTRD->SetPIDResponse(pidResponse);
+ fPIDTPCEMCal->SetPIDResponse(pidResponse);
+
+ //////////////////
+ // Event cut
+ //////////////////
+ AliDebug(2,"Event cut");
+ if(!fHFECuts->CheckEventCuts("fEvRecCuts", fInputEvent)) {
+ AliDebug(2,"Does not pass the event cut");
+ PostData(1, fListHist);
+ return;
+ }
+ fNbEvent->Fill(binct);
+
+ //////////////////////////
+ // Loop over track
+ //////////////////////////
+ Int_t nbtracks = fInputEvent->GetNumberOfTracks();
+ AliDebug(2,Form("Number of tracks %d",nbtracks));
+ for(Int_t k = 0; k < nbtracks; k++){
+
+ AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);
+ if(!track) continue;
+ Double_t pt = track->Pt();
+
+ AliDebug(2,"test 0\n");
+
+ // RecKine: ITSTPC cuts
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ AliDebug(2,"test 1\n");
+
+ // RecPrim
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ AliDebug(2,"test 2\n");
+
+ // HFEcuts: ITS layers cuts
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ AliDebug(2,"test 3\n");
+
+ // HFE cuts: TOF and mismatch flag
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ AliDebug(2,"test 4\n");
+
+ // HFE cuts: TPC PID cleanup
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+ AliDebug(2,"test 5\n");
+
+ // HFEcuts: Nb of tracklets TRD0
+ if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue;
+
+ AliDebug(2,"Survived");
+
+
+ ////////////////////////
+ // Apply PID
+ ////////////////////////
+ AliHFEpidObject hfetrack;
+ if(!fAODAnalysis) hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
+ else hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);
+ hfetrack.SetRecTrack(track);
+ hfetrack.SetCentrality((Int_t)binct);
+ hfetrack.SetMulitplicity(ncontribVtx); // for correction
+ if(IsPbPb()) hfetrack.SetPbPb();
+ else{
+ if(IspPb()) hfetrack.SetpPb();
+ else {
+ hfetrack.SetPP();
+ //printf("pp\n");
+ }
+ }
+ AliDebug(2,Form("centrality %f and %d",binct,hfetrack.GetCentrality()));
+
+ //printf("test 7\n");
+
+ // Complete PID TPC alone
+ if(fTPConlydo) {
+ if(fPIDTPConly->IsSelected(&hfetrack,0x0,"recTrackCont",0x0)) {
+ fTPConly->Fill(pt);
+ }
+ }
+ AliDebug(2,"TPC only PID\n");
+
+ // Complete PID TRD alone
+ if(fTRDonlydo) {
+ if(fPIDTRDonly->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTRDonly)) {
+ AliDebug(2,"Passed TRD only PID\n");
+ }
+ }
+ AliDebug(2,"TRD only PID\n");
+
+
+ // Complete PID TPC TOF
+ if(fTOFTPCdo) {
+ if(fPIDTOFTPC->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTOFTPC)) {
+ fTOFTPC->Fill(pt);
+ }
+ }
+ AliDebug(2,"TOF TPC PID\n");
+
+ // Complete PID TPC TRD
+ if(fTPCTRDdo) {
+ if(fPIDTPCTRD->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTPCTRD)) {
+ fTPCTRD->Fill(pt);
+ }
+ }
+ AliDebug(2,"TPC TRD PID\n");
+
+
+ if(fTPCEMCaldo) {
+ if(!fAODAnalysis) {
+ // Complete PID TPC TRD
+ if(fPIDTPCEMCal->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTPCEMCal)) {
+ fTPCEMCal->Fill(pt);
+ }
+ }
+ }
+ AliDebug(2,"TPC EMCal PID\n");
+
+
+ }
+
+ PostData(1, fListHist);
+
+}
-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-//\r
-// Flow task class for the ALICE HFE group\r
-//\r
-//\r
-#ifndef ALIANALYSISTASKHFEQA_H\r
-#define ALIANALYSISTASKHFEQA_H\r
-\r
-\r
-#ifndef ALIANALYSISTASKSE_H\r
-#include "AliAnalysisTaskSE.h"\r
-#endif\r
-\r
-#ifndef ROOT_TString\r
-#include <TString.h>\r
-#endif\r
-\r
-#ifndef ROOT_TBits\r
-#include <TBits.h>\r
-#endif\r
-\r
-\r
-class TList;\r
-class AliHFEcuts;\r
-class AliHFEpid;\r
-class AliHFEpidQAmanager;\r
-class AliAODMCHeader;\r
-class TClonesArray;\r
-class TH1F;\r
-\r
-\r
-class AliAnalysisTaskHFEQA: public AliAnalysisTaskSE {\r
-public:\r
-\r
- typedef enum{\r
- kpp = 0,\r
- kpPb = 1,\r
- kPbPb = 2\r
- } ESystem_t;\r
- \r
-\r
- AliAnalysisTaskHFEQA();\r
- AliAnalysisTaskHFEQA(const char *name);\r
- AliAnalysisTaskHFEQA(const AliAnalysisTaskHFEQA &ref);\r
- AliAnalysisTaskHFEQA& operator=(const AliAnalysisTaskHFEQA &ref);\r
- virtual void Copy(TObject &o) const;\r
- virtual ~AliAnalysisTaskHFEQA();\r
- \r
- virtual void UserExec(Option_t */*option*/);\r
- virtual void UserCreateOutputObjects();\r
-\r
- void SetDoTPConly(Bool_t tpconlydo) { fTPConlydo = tpconlydo; };\r
- void SetDoTRDonly(Bool_t trdonlydo) { fTRDonlydo = trdonlydo; };\r
- void SetDoTOFTPC(Bool_t toftpcdo) { fTOFTPCdo = toftpcdo; };\r
- void SetDoTPCTRD(Bool_t tpctrddo) { fTPCTRDdo = tpctrddo; };\r
- void SetDoTPCEMCal(Bool_t tpcemcaldo) { fTPCEMCaldo = tpcemcaldo; };\r
- void SetAODAnalysis(Bool_t aodAnalysis) { fAODAnalysis = aodAnalysis; };\r
- void SetCentralityEstimator(const char *estimator) { fCentralityEstimator = estimator; }\r
- void SetppAnalysis(){\r
- fCollisionSystem.SetBitNumber(kpPb, kFALSE); \r
- fCollisionSystem.SetBitNumber(kPbPb, kFALSE); \r
- fCollisionSystem.SetBitNumber(kpp, kTRUE); \r
- }\r
- void SetpPbAnalysis() {\r
- fCollisionSystem.SetBitNumber(kpp, kFALSE); \r
- fCollisionSystem.SetBitNumber(kPbPb, kFALSE); \r
- fCollisionSystem.SetBitNumber(kpPb, kTRUE); \r
- }\r
- void SetPbPbAnalysis() { \r
- fCollisionSystem.SetBitNumber(kpp, kFALSE); \r
- fCollisionSystem.SetBitNumber(kpPb, kFALSE); \r
- fCollisionSystem.SetBitNumber(kPbPb, kTRUE); \r
- };\r
- Bool_t Ispp() const { return fCollisionSystem.TestBitNumber(kpp); }\r
- Bool_t IsPbPb() const { return fCollisionSystem.TestBitNumber(kPbPb); }\r
- Bool_t IspPb() const { return fCollisionSystem.TestBitNumber(kpPb); }\r
- \r
- AliHFEpid *GetPIDTPConly() const { return fPIDTPConly; }\r
- AliHFEpid *GetPIDTRDonly() const { return fPIDTRDonly; }\r
- AliHFEpid *GetPIDTOFTPC() const { return fPIDTOFTPC; }\r
- AliHFEpid *GetPIDTPCTRD() const { return fPIDTPCTRD; }\r
- AliHFEpid *GetPIDTPCEMCal() const { return fPIDTPCEMCal; }\r
- AliHFEpidQAmanager *GetPIDQAManagerTRDonly() const { return fPIDqaTRDonly; }\r
- AliHFEpidQAmanager *GetPIDQAManagerTOFTPC() const { return fPIDqaTOFTPC; }\r
- AliHFEpidQAmanager *GetPIDQAManagerTPCTRD() const { return fPIDqaTPCTRD; }\r
- AliHFEpidQAmanager *GetPIDQAManagerTPCEMCal() const { return fPIDqaTPCEMCal; }\r
- \r
-\r
- void SetHFECuts(AliHFEcuts * const cuts) { fHFECuts = cuts; };\r
- \r
- private:\r
- TList *fListHist; //! TH list\r
- Bool_t fAODAnalysis; // AOD analysis\r
- AliAODMCHeader *fAODMCHeader; // ! MC info AOD\r
- TClonesArray *fAODArrayMCInfo; // ! MC info particle AOD\r
- \r
- // Cuts for HFE\r
- AliHFEcuts *fHFECuts; // HFE cuts\r
- AliHFEpid *fPIDTPConly; // PID cuts \r
- AliHFEpid *fPIDTRDonly; // PID cuts \r
- AliHFEpid *fPIDTOFTPC; // PID cuts TOF-TPC only\r
- AliHFEpid *fPIDTPCTRD; // PID cuts TPC-TRD \r
- AliHFEpid *fPIDTPCEMCal; // PID cuts TPC-EMCal \r
- AliHFEpidQAmanager *fPIDqaTRDonly; // QA Manager TOF TPC\r
- AliHFEpidQAmanager *fPIDqaTOFTPC; // QA Manager TOF TPC\r
- AliHFEpidQAmanager *fPIDqaTPCTRD; // QA Manager TPC TRD\r
- AliHFEpidQAmanager *fPIDqaTPCEMCal; // QA Manager TPC EMCal\r
- TString fCentralityEstimator; // Centrality Estimator\r
- TBits fCollisionSystem; // Collision System;\r
-\r
- // Histo yields\r
- TH1F *fNbEvent; // Number of events\r
- TH1F *fTPConly; // TPC only electron yield\r
- TH1F *fTOFTPC; // TOF TPC electron yield\r
- TH1F *fTPCTRD; // TPC TRD electron yield\r
- TH1F *fTPCEMCal; // TPC EMCal electron yield\r
-\r
- // Do PID or not\r
- Bool_t fTPConlydo; // Do TPC only PID\r
- Bool_t fTRDonlydo; // Do TRD only PID\r
- Bool_t fTOFTPCdo; // Do TOF TPC \r
- Bool_t fTPCTRDdo; // Do TPC TRD \r
- Bool_t fTPCEMCaldo; // Do TPC EMCal \r
-\r
- \r
- // Debuging Cuts step by step all centrality together: pt, step (6)\r
- //THnSparseF *fTrackingCuts; //! Tracking Cuts\r
-\r
- \r
- \r
- ClassDef(AliAnalysisTaskHFEQA, 3); // analysisclass\r
-};\r
-\r
-#endif\r
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+//
+// Flow task class for the ALICE HFE group
+//
+//
+#ifndef ALIANALYSISTASKHFEQA_H
+#define ALIANALYSISTASKHFEQA_H
+
+
+#ifndef ALIANALYSISTASKSE_H
+#include "AliAnalysisTaskSE.h"
+#endif
+
+#ifndef ROOT_TString
+#include <TString.h>
+#endif
+
+#ifndef ROOT_TBits
+#include <TBits.h>
+#endif
+
+
+class TList;
+class AliHFEcuts;
+class AliHFEpid;
+class AliHFEpidQAmanager;
+class AliAODMCHeader;
+class TClonesArray;
+class TH1F;
+
+
+class AliAnalysisTaskHFEQA: public AliAnalysisTaskSE {
+public:
+
+ typedef enum{
+ kpp = 0,
+ kpPb = 1,
+ kPbPb = 2
+ } ESystem_t;
+
+
+ AliAnalysisTaskHFEQA();
+ AliAnalysisTaskHFEQA(const char *name);
+ AliAnalysisTaskHFEQA(const AliAnalysisTaskHFEQA &ref);
+ AliAnalysisTaskHFEQA& operator=(const AliAnalysisTaskHFEQA &ref);
+ virtual void Copy(TObject &o) const;
+ virtual ~AliAnalysisTaskHFEQA();
+
+ virtual void UserExec(Option_t */*option*/);
+ virtual void UserCreateOutputObjects();
+
+ void SetDoTPConly(Bool_t tpconlydo) { fTPConlydo = tpconlydo; };
+ void SetDoTRDonly(Bool_t trdonlydo) { fTRDonlydo = trdonlydo; };
+ void SetDoTOFTPC(Bool_t toftpcdo) { fTOFTPCdo = toftpcdo; };
+ void SetDoTPCTRD(Bool_t tpctrddo) { fTPCTRDdo = tpctrddo; };
+ void SetDoTPCEMCal(Bool_t tpcemcaldo) { fTPCEMCaldo = tpcemcaldo; };
+ void SetAODAnalysis(Bool_t aodAnalysis) { fAODAnalysis = aodAnalysis; };
+ void SetCentralityEstimator(const char *estimator) { fCentralityEstimator = estimator; }
+ void SetppAnalysis(){
+ fCollisionSystem.SetBitNumber(kpPb, kFALSE);
+ fCollisionSystem.SetBitNumber(kPbPb, kFALSE);
+ fCollisionSystem.SetBitNumber(kpp, kTRUE);
+ }
+ void SetpPbAnalysis() {
+ fCollisionSystem.SetBitNumber(kpp, kFALSE);
+ fCollisionSystem.SetBitNumber(kPbPb, kFALSE);
+ fCollisionSystem.SetBitNumber(kpPb, kTRUE);
+ }
+ void SetPbPbAnalysis() {
+ fCollisionSystem.SetBitNumber(kpp, kFALSE);
+ fCollisionSystem.SetBitNumber(kpPb, kFALSE);
+ fCollisionSystem.SetBitNumber(kPbPb, kTRUE);
+ };
+ Bool_t Ispp() const { return fCollisionSystem.TestBitNumber(kpp); }
+ Bool_t IsPbPb() const { return fCollisionSystem.TestBitNumber(kPbPb); }
+ Bool_t IspPb() const { return fCollisionSystem.TestBitNumber(kpPb); }
+
+ AliHFEpid *GetPIDTPConly() const { return fPIDTPConly; }
+ AliHFEpid *GetPIDTRDonly() const { return fPIDTRDonly; }
+ AliHFEpid *GetPIDTOFTPC() const { return fPIDTOFTPC; }
+ AliHFEpid *GetPIDTPCTRD() const { return fPIDTPCTRD; }
+ AliHFEpid *GetPIDTPCEMCal() const { return fPIDTPCEMCal; }
+ AliHFEpidQAmanager *GetPIDQAManagerTRDonly() const { return fPIDqaTRDonly; }
+ AliHFEpidQAmanager *GetPIDQAManagerTOFTPC() const { return fPIDqaTOFTPC; }
+ AliHFEpidQAmanager *GetPIDQAManagerTPCTRD() const { return fPIDqaTPCTRD; }
+ AliHFEpidQAmanager *GetPIDQAManagerTPCEMCal() const { return fPIDqaTPCEMCal; }
+
+
+ void SetHFECuts(AliHFEcuts * const cuts) { fHFECuts = cuts; };
+
+ private:
+ TList *fListHist; //! TH list
+ Bool_t fAODAnalysis; // AOD analysis
+ AliAODMCHeader *fAODMCHeader; // ! MC info AOD
+ TClonesArray *fAODArrayMCInfo; // ! MC info particle AOD
+
+ // Cuts for HFE
+ AliHFEcuts *fHFECuts; // HFE cuts
+ AliHFEpid *fPIDTPConly; // PID cuts
+ AliHFEpid *fPIDTRDonly; // PID cuts
+ AliHFEpid *fPIDTOFTPC; // PID cuts TOF-TPC only
+ AliHFEpid *fPIDTPCTRD; // PID cuts TPC-TRD
+ AliHFEpid *fPIDTPCEMCal; // PID cuts TPC-EMCal
+ AliHFEpidQAmanager *fPIDqaTRDonly; // QA Manager TOF TPC
+ AliHFEpidQAmanager *fPIDqaTOFTPC; // QA Manager TOF TPC
+ AliHFEpidQAmanager *fPIDqaTPCTRD; // QA Manager TPC TRD
+ AliHFEpidQAmanager *fPIDqaTPCEMCal; // QA Manager TPC EMCal
+ TString fCentralityEstimator; // Centrality Estimator
+ TBits fCollisionSystem; // Collision System;
+
+ // Histo yields
+ TH1F *fNbEvent; // Number of events
+ TH1F *fTPConly; // TPC only electron yield
+ TH1F *fTOFTPC; // TOF TPC electron yield
+ TH1F *fTPCTRD; // TPC TRD electron yield
+ TH1F *fTPCEMCal; // TPC EMCal electron yield
+
+ // Do PID or not
+ Bool_t fTPConlydo; // Do TPC only PID
+ Bool_t fTRDonlydo; // Do TRD only PID
+ Bool_t fTOFTPCdo; // Do TOF TPC
+ Bool_t fTPCTRDdo; // Do TPC TRD
+ Bool_t fTPCEMCaldo; // Do TPC EMCal
+
+
+ // Debuging Cuts step by step all centrality together: pt, step (6)
+ //THnSparseF *fTrackingCuts; //! Tracking Cuts
+
+
+
+ ClassDef(AliAnalysisTaskHFEQA, 3); // analysisclass
+};
+
+#endif
-///////////////////////////////////////////////////////////////////\r
-// //\r
-// AddTaskFlowITSTPCTOFQCSP macro //\r
-// Author: Andrea Dubla, Utrecht University, 2012 //\r
-// //\r
-///////////////////////////////////////////////////////////////////\r
-class AliAnalysisDataContainer;\r
-class AliFlowTrackCuts;\r
-class AliFlowTrackSimpleCuts;\r
-class AliFlowEventCuts;\r
-class AliFlowEventSimpleCuts;\r
-class AliAnalysisDataContainer;\r
-class AliHFEextraCuts;\r
-\r
-AliAnalysisTaskFlowITSTPCTOFQCSP* AddTaskFlowITSTPCTOFQCSP(\r
- TString uniqueID = "",\r
- Float_t centrMin ,\r
- Float_t centrMax ,\r
- Double_t InvmassCut,\r
- Int_t Trigger,\r
- Bool_t multCorrcut,\r
- Double_t pTCutmin,\r
- Double_t pTCutmax,\r
- Double_t minTOFnSigma,\r
- Double_t maxTOFnSigma,\r
- Double_t minITSnsigmaLowpT,\r
- Double_t maxITSnsigmaLowpT,\r
- Double_t minITSnsigmaHighpT,\r
- Double_t maxITSnsigmaHighpT,\r
- Double_t minTPCnsigmaLowpT,\r
- Double_t maxTPCnsigmaLowpT,\r
- Double_t minTPCnsigmaHighpT,\r
- Double_t maxTPCnsigmaHighpT,\r
- Int_t minTPCCluster,\r
- Int_t TPCS,\r
- AliHFEextraCuts::ITSPixel_t pixel,\r
- Bool_t PhotonicElectronDCA = kFALSE,\r
- // Bool_t QaPidSparse = kFALSE,\r
- const char *Cent = "V0M",\r
- Bool_t QC = kTRUE, // use qc2 and qc4\r
- Bool_t SP_TPC = kTRUE, //use tpc sp method\r
- Bool_t VZERO_SP = kFALSE, // use vzero sp method\r
- Int_t harmonic = 2,\r
- Bool_t shrinkSP = kTRUE,\r
- Bool_t debug = kFALSE,\r
- Int_t RPFilterBit = 1,\r
- Bool_t op_ang = kFALSE,\r
- Int_t Vz = 10,\r
- Double_t op_angle_cut = 3.,\r
- TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root"\r
- )\r
-\r
-{\r
- \r
- \r
- \r
- if(debug) cout << " === Adding Task ElectFlow === " << endl;\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- fileName += ":ElectroID_";\r
- fileName += uniqueID;\r
- if(debug) cout << " --> Reconstruction data container: " << fileName << endl;\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- if(debug) cout << " Fatal error: no analysis manager found! " << endl;\r
- return 0x0;\r
- }\r
- if (!mgr->GetInputEventHandler()) {\r
- if(debug) cout << " Fatal error: no imput event handler found!" << endl;\r
- return 0x0;\r
- }\r
- \r
- //create a task\r
- AliAnalysisTaskFlowITSTPCTOFQCSP *taskHFE = ConfigHFEStandardCuts(kFALSE, minTPCCluster, pixel); //kTRUE if MC\r
- \r
- if(debug) cout << " === AliAnalysisTaskFlowITSTPCTOFQCSP === " << taskHFE << endl;\r
- if(!taskHFE) {\r
- if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;\r
- return 0x0;\r
- }\r
- taskHFE->SetTrigger(Trigger);\r
- \r
- if(Trigger==0 || Trigger==4){\r
- TFile *fFlat=TFile::Open(histoflatname.Data());\r
- TCanvas *c=fFlat->Get("cintegral");\r
- TH1F *hfl=(TH1F*)c->FindObject("hint");\r
- taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0);\r
- }\r
- // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC\r
- taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);\r
- taskHFE->SetInvariantMassCut(InvmassCut);\r
- taskHFE->SetpTCuttrack(pTCutmin, pTCutmax);\r
- taskHFE->SetTPCS(TPCS);\r
- taskHFE->SetVz(Vz);\r
- taskHFE->SetIDCuts(minTOFnSigma, maxTOFnSigma, minITSnsigmaLowpT, maxITSnsigmaLowpT, minITSnsigmaHighpT, maxITSnsigmaHighpT, minTPCnsigmaLowpT, maxTPCnsigmaLowpT, minTPCnsigmaHighpT, maxTPCnsigmaHighpT);\r
- // taskHFE->SetQAPIDSparse(QaPidSparse);\r
- taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);\r
- taskHFE->SetOpeningAngleflag(op_ang);\r
- taskHFE->SetOpeningAngleCut(op_angle_cut);\r
- taskHFE->SetMultCorrelationCut(multCorrcut);\r
-\r
- \r
- //set RP cuts for flow package analysis\r
- cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));\r
- if(!cutsRP) {\r
- if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;\r
- return 0x0;\r
- }\r
- \r
- if(!VZERO_SP) {\r
- AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;\r
- cutsRP->SetParamType(rptype);\r
- cutsRP->SetAODfilterBit(RPFilterBit);\r
- cutsRP->SetPtRange(0.2, 5.0);\r
- cutsRP->SetEtaRange(-0.8, 0.8);\r
- cutsRP->SetMinNClustersTPC(70);\r
- cutsRP->SetMinChi2PerClusterTPC(0.1);\r
- cutsRP->SetMaxChi2PerClusterTPC(4.0);\r
- cutsRP->SetRequireTPCRefit(kTRUE);\r
- cutsRP->SetMaxDCAToVertexXY(0.3);\r
- cutsRP->SetMaxDCAToVertexZ(0.3);\r
- cutsRP->SetAcceptKinkDaughters(kFALSE);\r
- cutsRP->SetMinimalTPCdedx(10.);\r
- if(debug) cout << " --> kGlobal RP's " << cutsRP << endl;\r
- }\r
- if(VZERO_SP) { // use vzero sub analysis\r
- cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks\r
- SP_TPC = kFALSE; // disable other methods\r
- QC = kFALSE;\r
- if(debug) cout << " --> VZERO RP's " << cutsRP << endl;\r
- }\r
- \r
- AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts();\r
- AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts();\r
- if(SP_TPC){\r
- POIfilterLeft->SetEtaMin(-0.8);\r
- POIfilterLeft->SetEtaMax(0.0);\r
- POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733);\r
- \r
- POIfilterRight->SetEtaMin(0.0);\r
- POIfilterRight->SetEtaMax(0.8);\r
- POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733);\r
- }\r
- \r
- \r
- AliFlowTrackSimpleCuts *POIfilterVZERO = new AliFlowTrackSimpleCuts();\r
- if(VZERO_SP || QC){\r
- POIfilterVZERO->SetEtaMin(-0.8);\r
- POIfilterVZERO->SetEtaMax(0.8);\r
- POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733);\r
- \r
- }\r
- \r
- \r
- AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts();\r
- AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts();\r
- if(SP_TPC){\r
- POIfilterLeftH->SetEtaMin(-0.8);\r
- POIfilterLeftH->SetEtaMax(0.0);\r
- POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638);\r
- \r
- POIfilterRightH->SetEtaMin(0.0);\r
- POIfilterRightH->SetEtaMax(0.8);\r
- POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638);\r
- }\r
- \r
- \r
- AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts();\r
- if(QC){\r
- POIfilterQCH->SetEtaMin(-0.8);\r
- POIfilterQCH->SetEtaMax(0.8);\r
- POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638);\r
- \r
- }\r
- \r
- \r
- \r
- taskHFE->SetRPCuts(cutsRP);\r
- \r
- \r
- AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);\r
- \r
- mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(taskHFE,1,coutput3);\r
- \r
- \r
- if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;\r
- AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);\r
- mgr->ConnectOutput(taskHFE, 2, flowEvent);\r
- if(debug) cout << " --> Created IO containers " << flowEvent << endl;\r
- \r
- \r
- mgr->AddTask(taskHFE);\r
- \r
- if (QC) { // add qc tasks\r
- TPCTOFnew::AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent, debug ,uniqueID, -0.8, -0.0, 0.0, 0.8,false,POIfilterVZERO);\r
- if(debug) cout << " --> Hanging QC task ...succes! "<< endl;\r
- }\r
- if (SP_TPC) { // add sp subevent tasks\r
- TPCTOFnew::AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight);\r
- if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;\r
- TPCTOFnew::AddSPmethod(Form("SPTPCQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterLeft);\r
- if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;\r
- }\r
- if (VZERO_SP) { // add sp subevent tasks\r
- TPCTOFnew::AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);\r
- if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;\r
- TPCTOFnew::AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);\r
- if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;\r
- }\r
- \r
- \r
- return taskHFE;\r
- \r
-}\r
-\r
-//_____________________________________________________________________________\r
-//_____________________________________________________________________________\r
-\r
-AliAnalysisTaskFlowITSTPCTOFQCSP* ConfigHFEStandardCuts(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){\r
- //\r
- // HFE standard task configuration\r
- //\r
- \r
- Bool_t kAnalyseTaggedTracks = kTRUE;\r
- \r
- AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts"); //TODO....change the cuts values to PbPb\r
- // hfecuts->CreateStandardCuts();\r
- hfecuts->SetMinNClustersTPC(minTPCCulster);\r
- hfecuts->SetMinNClustersITS(5);//5 for ITS pid.....usually i used 3.\r
- hfecuts->SetMinNTrackletsTRD(0);\r
- hfecuts->SetMinRatioTPCclusters(0.6);\r
- \r
- // hfecuts->SetEtaRange(-0.9,0.9);\r
- // hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);\r
- hfecuts->SetRequireITSPixel();\r
- hfecuts->SetCutITSpixel(pixel);//kAny\r
- hfecuts->SetMaxChi2perClusterITS(36); //new from ALberto\r
- hfecuts->SetMaxChi2perClusterTPC(3.5);\r
- hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back\r
- // hfecuts->UnsetVertexRequirement();\r
- hfecuts->SetVertexRange(10.);\r
- hfecuts->SetRequireSigmaToVertex();\r
- //hfecuts->SetSigmaToVertex(10);\r
- hfecuts->SetTOFPIDStep(kFALSE);\r
- // hfecuts->SetQAOn();\r
- hfecuts->SetPtRange(0, 5.);\r
- \r
- AliAnalysisTaskFlowITSTPCTOFQCSP *task = new AliAnalysisTaskFlowITSTPCTOFQCSP("HFE_Flow_TPCTOF");\r
- printf("*************************************************************");\r
- printf("task -------------------------------------------- %p\n ", task);\r
- printf("*************************************************************\n");\r
- \r
- \r
- task->SetHFECuts(hfecuts);\r
- \r
- // task->SetInvariantMassCut(0.05);\r
- // task->SetRejectKinkMother(kTRUE);\r
- // task->SetRemovePileUp(kTRUE);\r
- \r
- // Define PID\r
- AliHFEpid *pid = task->GetPID();\r
- if(useMC) pid->SetHasMCData(kTRUE);\r
- pid->AddDetector("ITS", 0);\r
- pid->AddDetector("TOF", 1);\r
- pid->AddDetector("TPC", 2);\r
-\r
- printf("*************************************\n");\r
- printf("Configuring standard Task:\n");\r
- // task->PrintStatus();\r
- pid->PrintStatus();\r
- printf("*************************************\n");\r
- return task;\r
- \r
- \r
-}\r
-\r
-//_____________________________________________________________________________\r
-\r
-namespace TPCTOFnew{\r
- //_____________________________________________________________________________\r
- void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, bool bEP, bool shrink = false, bool debug, TString uniqueID,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter)\r
- {\r
- // add sp task and invm filter tasks\r
- if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- (bEP) ? fileName+=":EP_tpctof" : fileName+=":SP_tpctof";\r
- // if(etagap) {\r
- // fileName+="_SUBEVENTS";\r
- // if(debug) cout << " --> Setting up subevent analysis <-- " << endl;\r
- // }\r
- if(debug) cout << " --> fileName " << fileName << endl;\r
- TString myFolder = fileName;\r
- if(debug) cout << " --> myFolder " << myFolder << endl;\r
- TString myNameSP;\r
- (bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);\r
- if(debug) cout << " myNameSP " << myNameSP << endl;\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);\r
- AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);\r
- tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);\r
- if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);\r
- mgr->AddTask(tskFilter);\r
- mgr->ConnectInput(tskFilter, 0, flowEvent);\r
- mgr->ConnectOutput(tskFilter, 1, flowEventOut);\r
- AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);\r
- AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);\r
- tskSP->SetApplyCorrectionForNUA(kTRUE);\r
- tskSP->SetHarmonic(harmonic);\r
- tskSP->SetTotalQvector(Qvector);\r
- if (bEP) tskSP->SetBehaveAsEP();\r
- if (shrink) tskSP->SetBookOnlyBasicCCH(kTRUE);\r
- mgr->AddTask(tskSP);\r
- mgr->ConnectInput(tskSP, 0, flowEventOut);\r
- mgr->ConnectOutput(tskSP, 1, outSP);\r
- }\r
- //_____________________________________________________________________________\r
- void AddQCmethod(char *name, int harmonic, AliAnalysisDataContainer *flowEvent, Bool_t debug, TString uniqueID,double minEtaA, double maxEtaA, double minEtaB, double maxEtaB,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter)\r
- {\r
- // add qc task and invm filter tasks\r
- if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", IO ****** " << flowEvent << endl;\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- fileName+=":QC_tpctof";\r
- if(debug) cout << " --> Common filename: " << fileName << endl;\r
- TString myFolder = Form("v%d", harmonic);\r
- if(debug) cout << " --> myFolder: " << myFolder << endl;\r
- TString myName = Form("%s", name);\r
- if(debug) cout << " --> myName: " << myName << endl;\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);\r
- AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), NULL, POIfilter);\r
- tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);\r
- // if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);\r
- mgr->AddTask(tskFilter);\r
- mgr->ConnectInput(tskFilter, 0, flowEvent);\r
- mgr->ConnectOutput(tskFilter, 1, flowEventOut);\r
- \r
- AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);\r
- AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE);\r
- tskQC->SetApplyCorrectionForNUA(kTRUE);\r
- tskQC->SetHarmonic(harmonic);\r
- tskQC->SetBookOnlyBasicCCH(kTRUE);\r
- mgr->AddTask(tskQC);\r
- mgr->ConnectInput(tskQC, 0, flowEventOut);\r
- mgr->ConnectOutput(tskQC, 1, outQC);\r
- }\r
- //_____________________________________________________________________________\r
-}\r
-\r
+///////////////////////////////////////////////////////////////////
+// //
+// AddTaskFlowITSTPCTOFQCSP macro //
+// Author: Andrea Dubla, Utrecht University, 2012 //
+// //
+///////////////////////////////////////////////////////////////////
+class AliAnalysisDataContainer;
+class AliFlowTrackCuts;
+class AliFlowTrackSimpleCuts;
+class AliFlowEventCuts;
+class AliFlowEventSimpleCuts;
+class AliAnalysisDataContainer;
+class AliHFEextraCuts;
+
+AliAnalysisTaskFlowITSTPCTOFQCSP* AddTaskFlowITSTPCTOFQCSP(
+ TString uniqueID = "",
+ Float_t centrMin ,
+ Float_t centrMax ,
+ Double_t InvmassCut,
+ Int_t Trigger,
+ Bool_t multCorrcut,
+ Double_t pTCutmin,
+ Double_t pTCutmax,
+ Double_t minTOFnSigma,
+ Double_t maxTOFnSigma,
+ Double_t minITSnsigmaLowpT,
+ Double_t maxITSnsigmaLowpT,
+ Double_t minITSnsigmaHighpT,
+ Double_t maxITSnsigmaHighpT,
+ Double_t minTPCnsigmaLowpT,
+ Double_t maxTPCnsigmaLowpT,
+ Double_t minTPCnsigmaHighpT,
+ Double_t maxTPCnsigmaHighpT,
+ Int_t minTPCCluster,
+ Int_t TPCS,
+ AliHFEextraCuts::ITSPixel_t pixel,
+ Bool_t PhotonicElectronDCA = kFALSE,
+ // Bool_t QaPidSparse = kFALSE,
+ const char *Cent = "V0M",
+ Bool_t QC = kTRUE, // use qc2 and qc4
+ Bool_t SP_TPC = kTRUE, //use tpc sp method
+ Bool_t VZERO_SP = kFALSE, // use vzero sp method
+ Int_t harmonic = 2,
+ Bool_t shrinkSP = kTRUE,
+ Bool_t debug = kFALSE,
+ Int_t RPFilterBit = 1,
+ Bool_t op_ang = kFALSE,
+ Int_t Vz = 10,
+ Double_t op_angle_cut = 3.,
+ TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root"
+ )
+
+{
+
+
+
+ if(debug) cout << " === Adding Task ElectFlow === " << endl;
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ fileName += ":ElectroID_";
+ fileName += uniqueID;
+ if(debug) cout << " --> Reconstruction data container: " << fileName << endl;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ if(debug) cout << " Fatal error: no analysis manager found! " << endl;
+ return 0x0;
+ }
+ if (!mgr->GetInputEventHandler()) {
+ if(debug) cout << " Fatal error: no imput event handler found!" << endl;
+ return 0x0;
+ }
+
+ //create a task
+ AliAnalysisTaskFlowITSTPCTOFQCSP *taskHFE = ConfigHFEStandardCuts(kFALSE, minTPCCluster, pixel); //kTRUE if MC
+
+ if(debug) cout << " === AliAnalysisTaskFlowITSTPCTOFQCSP === " << taskHFE << endl;
+ if(!taskHFE) {
+ if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;
+ return 0x0;
+ }
+ taskHFE->SetTrigger(Trigger);
+
+ if(Trigger==0 || Trigger==4){
+ TFile *fFlat=TFile::Open(histoflatname.Data());
+ TCanvas *c=fFlat->Get("cintegral");
+ TH1F *hfl=(TH1F*)c->FindObject("hint");
+ taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0);
+ }
+ // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC
+ taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);
+ taskHFE->SetInvariantMassCut(InvmassCut);
+ taskHFE->SetpTCuttrack(pTCutmin, pTCutmax);
+ taskHFE->SetTPCS(TPCS);
+ taskHFE->SetVz(Vz);
+ taskHFE->SetIDCuts(minTOFnSigma, maxTOFnSigma, minITSnsigmaLowpT, maxITSnsigmaLowpT, minITSnsigmaHighpT, maxITSnsigmaHighpT, minTPCnsigmaLowpT, maxTPCnsigmaLowpT, minTPCnsigmaHighpT, maxTPCnsigmaHighpT);
+ // taskHFE->SetQAPIDSparse(QaPidSparse);
+ taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);
+ taskHFE->SetOpeningAngleflag(op_ang);
+ taskHFE->SetOpeningAngleCut(op_angle_cut);
+ taskHFE->SetMultCorrelationCut(multCorrcut);
+
+
+ //set RP cuts for flow package analysis
+ cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));
+ if(!cutsRP) {
+ if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;
+ return 0x0;
+ }
+
+ if(!VZERO_SP) {
+ AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
+ cutsRP->SetParamType(rptype);
+ cutsRP->SetAODfilterBit(RPFilterBit);
+ cutsRP->SetPtRange(0.2, 5.0);
+ cutsRP->SetEtaRange(-0.8, 0.8);
+ cutsRP->SetMinNClustersTPC(70);
+ cutsRP->SetMinChi2PerClusterTPC(0.1);
+ cutsRP->SetMaxChi2PerClusterTPC(4.0);
+ cutsRP->SetRequireTPCRefit(kTRUE);
+ cutsRP->SetMaxDCAToVertexXY(0.3);
+ cutsRP->SetMaxDCAToVertexZ(0.3);
+ cutsRP->SetAcceptKinkDaughters(kFALSE);
+ cutsRP->SetMinimalTPCdedx(10.);
+ if(debug) cout << " --> kGlobal RP's " << cutsRP << endl;
+ }
+ if(VZERO_SP) { // use vzero sub analysis
+ cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks
+ SP_TPC = kFALSE; // disable other methods
+ QC = kFALSE;
+ if(debug) cout << " --> VZERO RP's " << cutsRP << endl;
+ }
+
+ AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts();
+ AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts();
+ if(SP_TPC){
+ POIfilterLeft->SetEtaMin(-0.8);
+ POIfilterLeft->SetEtaMax(0.0);
+ POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733);
+
+ POIfilterRight->SetEtaMin(0.0);
+ POIfilterRight->SetEtaMax(0.8);
+ POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733);
+ }
+
+
+ AliFlowTrackSimpleCuts *POIfilterVZERO = new AliFlowTrackSimpleCuts();
+ if(VZERO_SP || QC){
+ POIfilterVZERO->SetEtaMin(-0.8);
+ POIfilterVZERO->SetEtaMax(0.8);
+ POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733);
+
+ }
+
+
+ AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts();
+ AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts();
+ if(SP_TPC){
+ POIfilterLeftH->SetEtaMin(-0.8);
+ POIfilterLeftH->SetEtaMax(0.0);
+ POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638);
+
+ POIfilterRightH->SetEtaMin(0.0);
+ POIfilterRightH->SetEtaMax(0.8);
+ POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638);
+ }
+
+
+ AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts();
+ if(QC){
+ POIfilterQCH->SetEtaMin(-0.8);
+ POIfilterQCH->SetEtaMax(0.8);
+ POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638);
+
+ }
+
+
+
+ taskHFE->SetRPCuts(cutsRP);
+
+
+ AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);
+
+ mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(taskHFE,1,coutput3);
+
+
+ if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
+ AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
+ mgr->ConnectOutput(taskHFE, 2, flowEvent);
+ if(debug) cout << " --> Created IO containers " << flowEvent << endl;
+
+
+ mgr->AddTask(taskHFE);
+
+ if (QC) { // add qc tasks
+ TPCTOFnew::AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent, debug ,uniqueID, -0.8, -0.0, 0.0, 0.8,false,POIfilterVZERO);
+ if(debug) cout << " --> Hanging QC task ...succes! "<< endl;
+ }
+ if (SP_TPC) { // add sp subevent tasks
+ TPCTOFnew::AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight);
+ if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;
+ TPCTOFnew::AddSPmethod(Form("SPTPCQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterLeft);
+ if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;
+ }
+ if (VZERO_SP) { // add sp subevent tasks
+ TPCTOFnew::AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);
+ if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;
+ TPCTOFnew::AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);
+ if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;
+ }
+
+
+ return taskHFE;
+
+}
+
+//_____________________________________________________________________________
+//_____________________________________________________________________________
+
+AliAnalysisTaskFlowITSTPCTOFQCSP* ConfigHFEStandardCuts(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){
+ //
+ // HFE standard task configuration
+ //
+
+ Bool_t kAnalyseTaggedTracks = kTRUE;
+
+ AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts"); //TODO....change the cuts values to PbPb
+ // hfecuts->CreateStandardCuts();
+ hfecuts->SetMinNClustersTPC(minTPCCulster);
+ hfecuts->SetMinNClustersITS(5);//5 for ITS pid.....usually i used 3.
+ hfecuts->SetMinNTrackletsTRD(0);
+ hfecuts->SetMinRatioTPCclusters(0.6);
+
+ // hfecuts->SetEtaRange(-0.9,0.9);
+ // hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+ hfecuts->SetRequireITSPixel();
+ hfecuts->SetCutITSpixel(pixel);//kAny
+ hfecuts->SetMaxChi2perClusterITS(36); //new from ALberto
+ hfecuts->SetMaxChi2perClusterTPC(3.5);
+ hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back
+ // hfecuts->UnsetVertexRequirement();
+ hfecuts->SetVertexRange(10.);
+ hfecuts->SetRequireSigmaToVertex();
+ //hfecuts->SetSigmaToVertex(10);
+ hfecuts->SetTOFPIDStep(kFALSE);
+ // hfecuts->SetQAOn();
+ hfecuts->SetPtRange(0, 5.);
+
+ AliAnalysisTaskFlowITSTPCTOFQCSP *task = new AliAnalysisTaskFlowITSTPCTOFQCSP("HFE_Flow_TPCTOF");
+ printf("*************************************************************");
+ printf("task -------------------------------------------- %p\n ", task);
+ printf("*************************************************************\n");
+
+
+ task->SetHFECuts(hfecuts);
+
+ // task->SetInvariantMassCut(0.05);
+ // task->SetRejectKinkMother(kTRUE);
+ // task->SetRemovePileUp(kTRUE);
+
+ // Define PID
+ AliHFEpid *pid = task->GetPID();
+ if(useMC) pid->SetHasMCData(kTRUE);
+ pid->AddDetector("ITS", 0);
+ pid->AddDetector("TOF", 1);
+ pid->AddDetector("TPC", 2);
+
+ printf("*************************************\n");
+ printf("Configuring standard Task:\n");
+ // task->PrintStatus();
+ pid->PrintStatus();
+ printf("*************************************\n");
+ return task;
+
+
+}
+
+//_____________________________________________________________________________
+
+namespace TPCTOFnew{
+ //_____________________________________________________________________________
+ void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, bool bEP, bool shrink = false, bool debug, TString uniqueID,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter)
+ {
+ // add sp task and invm filter tasks
+ if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ (bEP) ? fileName+=":EP_tpctof" : fileName+=":SP_tpctof";
+ // if(etagap) {
+ // fileName+="_SUBEVENTS";
+ // if(debug) cout << " --> Setting up subevent analysis <-- " << endl;
+ // }
+ if(debug) cout << " --> fileName " << fileName << endl;
+ TString myFolder = fileName;
+ if(debug) cout << " --> myFolder " << myFolder << endl;
+ TString myNameSP;
+ (bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
+ if(debug) cout << " myNameSP " << myNameSP << endl;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+ AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);
+ tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
+ if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
+ mgr->AddTask(tskFilter);
+ mgr->ConnectInput(tskFilter, 0, flowEvent);
+ mgr->ConnectOutput(tskFilter, 1, flowEventOut);
+ AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
+ AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);
+ tskSP->SetApplyCorrectionForNUA(kTRUE);
+ tskSP->SetHarmonic(harmonic);
+ tskSP->SetTotalQvector(Qvector);
+ if (bEP) tskSP->SetBehaveAsEP();
+ if (shrink) tskSP->SetBookOnlyBasicCCH(kTRUE);
+ mgr->AddTask(tskSP);
+ mgr->ConnectInput(tskSP, 0, flowEventOut);
+ mgr->ConnectOutput(tskSP, 1, outSP);
+ }
+ //_____________________________________________________________________________
+ void AddQCmethod(char *name, int harmonic, AliAnalysisDataContainer *flowEvent, Bool_t debug, TString uniqueID,double minEtaA, double maxEtaA, double minEtaB, double maxEtaB,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter)
+ {
+ // add qc task and invm filter tasks
+ if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", IO ****** " << flowEvent << endl;
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ fileName+=":QC_tpctof";
+ if(debug) cout << " --> Common filename: " << fileName << endl;
+ TString myFolder = Form("v%d", harmonic);
+ if(debug) cout << " --> myFolder: " << myFolder << endl;
+ TString myName = Form("%s", name);
+ if(debug) cout << " --> myName: " << myName << endl;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+ AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), NULL, POIfilter);
+ tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
+ // if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
+ mgr->AddTask(tskFilter);
+ mgr->ConnectInput(tskFilter, 0, flowEvent);
+ mgr->ConnectOutput(tskFilter, 1, flowEventOut);
+
+ AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
+ AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE);
+ tskQC->SetApplyCorrectionForNUA(kTRUE);
+ tskQC->SetHarmonic(harmonic);
+ tskQC->SetBookOnlyBasicCCH(kTRUE);
+ mgr->AddTask(tskQC);
+ mgr->ConnectInput(tskQC, 0, flowEventOut);
+ mgr->ConnectOutput(tskQC, 1, outQC);
+ }
+ //_____________________________________________________________________________
+}
+
-///////////////////////////////////////////////////////////////////\r
-// //\r
-// AddTaskFlowTPCEMCalQCSP macro //\r
-// Author: Andrea Dubla, Utrecht University, 2012 //\r
-// //\r
-///////////////////////////////////////////////////////////////////\r
-class AliAnalysisDataContainer;\r
-class AliFlowTrackCuts;\r
-class AliFlowTrackSimpleCuts;\r
-class AliFlowEventCuts;\r
-class AliFlowEventSimpleCuts;\r
-class AliAnalysisDataContainer;\r
-class AliHFEextraCuts;\r
-\r
-AliAnalysisTaskFlowTPCEMCalQCSP* AddTaskFlowTPCEMCalQCSP(\r
- TString uniqueID = "",\r
- Float_t centrMin ,\r
- Float_t centrMax ,\r
- Double_t InvmassCut,\r
- Double_t pTCut,\r
- Int_t Trigger,\r
- Bool_t multCorrcut,\r
- Double_t minTPC,\r
- Double_t maxTPC,\r
- Double_t minEovP,\r
- Double_t maxEovP,\r
- Double_t minM20,\r
- Double_t maxM20,\r
- Double_t minM02,\r
- Double_t maxM02,\r
- Double_t Dispersion,\r
- Int_t minTPCCluster,\r
- AliHFEextraCuts::ITSPixel_t pixel,\r
- Bool_t NUA = kTRUE,\r
- Bool_t PhotonicElectronDCA = kFALSE,\r
- Int_t TPCClusterforAsso = 80,\r
- Bool_t AssoITSref = kTRUE,\r
- Bool_t purity = kTRUE,\r
- Bool_t SideBandsFlow = kFALSE,\r
- Bool_t Phi_minus_psi = kFALSE,\r
- const char *Cent = "V0M",\r
- Bool_t QC = kTRUE, // use qc2 and qc4\r
- Bool_t SP_TPC = kTRUE, //use tpc sp method\r
- Bool_t VZERO_SP = kFALSE, // use vzero sp method\r
- Bool_t BaseH = kFALSE, // base histo\r
- Int_t harmonic = 2,\r
- Bool_t shrinkSP = kTRUE,\r
- Bool_t debug = kFALSE,\r
- Int_t RPFilterBit = 1,\r
- Bool_t op_ang = kFALSE,\r
- Double_t op_angle_cut=3.,\r
- TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root"\r
- )\r
-\r
-{\r
- \r
- \r
- \r
- if(debug) cout << " === Adding Task ElectFlow === " << endl;\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- fileName += ":ElectroID_";\r
- fileName += uniqueID;\r
- if(debug) cout << " --> Reconstruction data container: " << fileName << endl;\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- if(debug) cout << " Fatal error: no analysis manager found! " << endl;\r
- return 0x0;\r
- }\r
- if (!mgr->GetInputEventHandler()) {\r
- if(debug) cout << " Fatal error: no imput event handler found!" << endl;\r
- return 0x0;\r
- }\r
- \r
- //create a task\r
- AliAnalysisTaskFlowTPCEMCalQCSP *taskHFE = ConfigHFEemcalMod(kFALSE, minTPCCluster, pixel); //kTRUE if MC\r
- \r
- if(debug) cout << " === AliAnalysisElectronFlow === " << taskHFE << endl;\r
- if(!taskHFE) {\r
- if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;\r
- return 0x0;\r
- }\r
- taskHFE->SetTrigger(Trigger);\r
- \r
- if(Trigger==0 || Trigger==4){\r
- TFile *fFlat=TFile::Open(histoflatname.Data());\r
- TCanvas *c=fFlat->Get("cintegral");\r
- TH1F *hfl=(TH1F*)c->FindObject("hint");\r
- taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0);\r
- }\r
- \r
- // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC\r
- taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);\r
- taskHFE->SetInvariantMassCut(InvmassCut);\r
- taskHFE->SetIDCuts(minTPC, maxTPC, minEovP, maxEovP, minM20, maxM20, minM02, maxM02, Dispersion);\r
- taskHFE->SetFlowSideBands(SideBandsFlow);\r
- taskHFE->Setphiminuspsi(Phi_minus_psi);\r
- taskHFE->SetPurity(purity);\r
- taskHFE->SetpTCuttrack(pTCut);\r
- taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);\r
- taskHFE->SetOpeningAngleflag(op_ang);\r
- taskHFE->SetOpeningAngleCut(op_angle_cut);\r
- taskHFE->SetAssoTPCCluster(TPCClusterforAsso);\r
- taskHFE->SetAssoITSRefit(AssoITSref);\r
- taskHFE->SetMultCorrelationCut(multCorrcut);\r
- //set RP cuts for flow package analysis\r
- cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));\r
- if(!cutsRP) {\r
- if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;\r
- return 0x0;\r
- }\r
- \r
- if(!VZERO_SP) {\r
- AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;\r
- cutsRP->SetParamType(rptype);\r
- cutsRP->SetAODfilterBit(RPFilterBit);\r
- cutsRP->SetPtRange(0.2, 5.0);\r
- cutsRP->SetEtaRange(-0.7, 0.7);\r
- cutsRP->SetMinNClustersTPC(70);\r
- cutsRP->SetMinChi2PerClusterTPC(0.1);\r
- cutsRP->SetMaxChi2PerClusterTPC(4.0);\r
- cutsRP->SetRequireTPCRefit(kTRUE);\r
- cutsRP->SetMaxDCAToVertexXY(0.3);\r
- cutsRP->SetMaxDCAToVertexZ(0.3);\r
- cutsRP->SetAcceptKinkDaughters(kFALSE);\r
- cutsRP->SetMinimalTPCdedx(10.);\r
- if(debug) cout << " --> kGlobal RP's " << cutsRP << endl;\r
- }\r
- if(VZERO_SP) { // use vzero sub analysis\r
- cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks\r
- SP_TPC = kFALSE; // disable other methods\r
- QC = kFALSE;\r
- if(debug) cout << " --> VZERO RP's " << cutsRP << endl;\r
- }\r
- \r
- AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts();\r
- AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts();\r
- if(VZERO_SP || SP_TPC){\r
- POIfilterLeft->SetEtaMin(-0.7);\r
- POIfilterLeft->SetEtaMax(0.0);\r
- POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733);\r
- \r
- POIfilterRight->SetEtaMin(0.0);\r
- POIfilterRight->SetEtaMax(0.7);\r
- POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733);\r
- }\r
- \r
- \r
- AliFlowTrackSimpleCuts *POIfilterQC = new AliFlowTrackSimpleCuts();\r
- if(QC){\r
- POIfilterQC->SetEtaMin(-0.7);\r
- POIfilterQC->SetEtaMax(0.7);\r
- POIfilterQC->SetMassMin(263731); POIfilterQC->SetMassMax(263733);\r
- \r
- }\r
- \r
- if(SideBandsFlow){\r
- \r
- AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts();\r
- AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts();\r
- if(SP_TPC){\r
- POIfilterLeftH->SetEtaMin(-0.7);\r
- POIfilterLeftH->SetEtaMax(0.0);\r
- POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638);\r
- \r
- POIfilterRightH->SetEtaMin(0.0);\r
- POIfilterRightH->SetEtaMax(0.7);\r
- POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638);\r
- }\r
- \r
- \r
- AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts();\r
- if(QC){\r
- POIfilterQCH->SetEtaMin(-0.7);\r
- POIfilterQCH->SetEtaMax(0.7);\r
- POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638);\r
- \r
- }\r
- \r
- }\r
- \r
- taskHFE->SetRPCuts(cutsRP);\r
- \r
- \r
- AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);\r
- \r
- mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(taskHFE,1,coutput3);\r
- \r
- \r
- if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;\r
- AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);\r
- mgr->ConnectOutput(taskHFE, 2, flowEvent);\r
- if(debug) cout << " --> Created IO containers " << flowEvent << endl;\r
- \r
- if(SideBandsFlow){\r
- if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;\r
- AliAnalysisDataContainer *flowEventCont = mgr->CreateContainer(Form("FlowContainer_Cont_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);\r
- mgr->ConnectOutput(taskHFE, 3, flowEventCont);\r
- if(debug) cout << " --> Created IO containers " << flowEventCont << endl;\r
- }\r
- \r
- \r
- mgr->AddTask(taskHFE);\r
- \r
- if (QC) { // add qc tasks\r
- AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent, debug ,uniqueID, -0.7, -0.0, 0.0, 0.7,false,POIfilterQC, NUA, shrinkSP, BaseH);\r
- if(debug) cout << " --> Hanging QC task ...succes! "<< endl;\r
- }\r
- if (SP_TPC) { // add sp subevent tasks\r
- AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight, NUA,BaseH);\r
- if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;\r
- AddSPmethod(Form("SPTPCQb_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterLeft, NUA,BaseH);\r
- if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;\r
- }\r
- if (VZERO_SP) { // add sp subevent tasks\r
- AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterRight, NUA,BaseH);\r
- if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;\r
- AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterLeft, NUA,BaseH);\r
- if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;\r
- }\r
- \r
- //=========================================Flow event for elctronContamination==============================================================================================\r
- if(SideBandsFlow){\r
- if (QC) { // add qc tasks\r
- AddQCmethod(Form("QCTPCCont_%s",uniqueID.Data()), harmonic, flowEventCont, debug ,uniqueID, -0.7, -0.0, 0.0, 0.7,false,POIfilterQCH, NUA, shrinkSP,BaseH);\r
- if(debug) cout << " --> Hanging QC task ...succes! "<< endl;\r
- }\r
- if (SP_TPC) { // add sp subevent tasks\r
- AddSPmethod(Form("SPTPCQa_Cont_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qa", harmonic, flowEventCont, false, shrinkSP, debug,uniqueID, false, POIfilterRightH, NUA,BaseH);\r
- if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;\r
- AddSPmethod(Form("SPTPCQb_Cont_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qb", harmonic, flowEventCont, false, shrinkSP, debug,uniqueID, false, POIfilterLeftH, NUA,BaseH);\r
- if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;\r
- }\r
- }\r
- //==========================================================================================================================================================================\r
- \r
- \r
- return taskHFE;\r
- \r
-}\r
-\r
-//_____________________________________________________________________________\r
-\r
-\r
-//_____________________________________________________________________________\r
-void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, bool bEP, bool shrink = false, bool debug, TString uniqueID, Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter, Bool_t kNUA, Bool_t kBaseH)\r
-{\r
- // add sp task and invm filter tasks\r
- if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- (bEP) ? fileName+=":EP" : fileName+=":SP";\r
- // if(etagap) {\r
- // fileName+="_SUBEVENTS";\r
- // if(debug) cout << " --> Setting up subevent analysis <-- " << endl;\r
- // }\r
- if(debug) cout << " --> fileName " << fileName << endl;\r
- TString myFolder = fileName;\r
- if(debug) cout << " --> myFolder " << myFolder << endl;\r
- TString myNameSP;\r
- (bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);\r
- if(debug) cout << " myNameSP " << myNameSP << endl;\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);\r
- AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);\r
- tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);\r
- if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);\r
- mgr->AddTask(tskFilter);\r
- mgr->ConnectInput(tskFilter, 0, flowEvent);\r
- mgr->ConnectOutput(tskFilter, 1, flowEventOut);\r
- AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);\r
- AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);\r
- tskSP->SetApplyCorrectionForNUA(kNUA);\r
- tskSP->SetHarmonic(harmonic);\r
- tskSP->SetTotalQvector(Qvector);\r
- if (bEP) tskSP->SetBehaveAsEP();\r
- if (shrink)tskSP->SetBookOnlyBasicCCH(kBaseH);\r
- mgr->AddTask(tskSP);\r
- mgr->ConnectInput(tskSP, 0, flowEventOut);\r
- mgr->ConnectOutput(tskSP, 1, outSP);\r
-}\r
-//_____________________________________________________________________________\r
-void AddQCmethod(char *name, int harmonic, AliAnalysisDataContainer *flowEvent, Bool_t debug, TString uniqueID,double minEtaA, double maxEtaA, double minEtaB, double maxEtaB,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter, Bool_t kNUA, bool shrink = false, Bool_t kBaseH)\r
-{\r
- // add qc task and invm filter tasks\r
- if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", IO ****** " << flowEvent << endl;\r
- TString fileName = AliAnalysisManager::GetCommonFileName();\r
- fileName+=":QC";\r
- if(debug) cout << " --> Common filename: " << fileName << endl;\r
- TString myFolder = Form("v%d", harmonic);\r
- if(debug) cout << " --> myFolder: " << myFolder << endl;\r
- TString myName = Form("%s", name);\r
- if(debug) cout << " --> myName: " << myName << endl;\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);\r
- AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), NULL, POIfilter);\r
- tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);\r
- // if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);\r
- mgr->AddTask(tskFilter);\r
- mgr->ConnectInput(tskFilter, 0, flowEvent);\r
- mgr->ConnectOutput(tskFilter, 1, flowEventOut);\r
- \r
- AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);\r
- AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE);\r
- tskQC->SetApplyCorrectionForNUA(kNUA);\r
- tskQC->SetHarmonic(harmonic);\r
- if (shrink)tskQC->SetBookOnlyBasicCCH(kBaseH);\r
- mgr->AddTask(tskQC);\r
- mgr->ConnectInput(tskQC, 0, flowEventOut);\r
- mgr->ConnectOutput(tskQC, 1, outQC);\r
-}\r
-//_____________________________________________________________________________\r
-\r
-\r
-//_____________________________________________________________________________\r
-\r
-AliAnalysisTaskFlowTPCEMCalQCSP* ConfigHFEemcalMod(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){\r
- //\r
- // HFE standard task configuration\r
- //\r
- \r
- Bool_t kAnalyseTaggedTracks = kTRUE;\r
- \r
- AliHFEcuts *hfecuts = new AliHFEcuts("hfeCutsEMCAL","HFE Standard Cuts"); //TODO....change the cuts values to PbPb\r
- // hfecuts->CreateStandardCuts();\r
- hfecuts->SetMinNClustersTPC(minTPCCulster);\r
- hfecuts->SetMinNClustersITS(3);\r
- hfecuts->SetMinNTrackletsTRD(0);\r
- hfecuts->SetMinRatioTPCclusters(0.6);\r
- \r
- // hfecuts->SetEtaRange(-0.9,0.9);\r
- // hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);\r
- hfecuts->SetRequireITSPixel();\r
- hfecuts->SetCutITSpixel(pixel);//kAny\r
- hfecuts->SetMaxChi2perClusterITS(-1);\r
- hfecuts->SetMaxChi2perClusterTPC(3.5);\r
- hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back\r
- // hfecuts->UnsetVertexRequirement();\r
- hfecuts->SetVertexRange(10.);\r
- hfecuts->SetRequireSigmaToVertex();\r
- //hfecuts->SetSigmaToVertex(10);\r
- hfecuts->SetTOFPIDStep(kFALSE);\r
- // hfecuts->SetQAOn();\r
- hfecuts->SetPtRange(0, 30);\r
- \r
- AliAnalysisTaskFlowTPCEMCalQCSP *task = new AliAnalysisTaskFlowTPCEMCalQCSP("HFE_Flow_TPCEMCal");\r
- printf("task ------------------------ %p\n ", task);\r
- \r
- \r
- task->SetHFECuts(hfecuts);\r
- \r
- // task->SetInvariantMassCut(0.05);\r
- // task->SetRejectKinkMother(kTRUE);\r
- // task->SetRemovePileUp(kTRUE);\r
- \r
- // Define PID\r
- AliHFEpid *pid = task->GetPID();\r
- if(useMC) pid->SetHasMCData(kTRUE);\r
- pid->AddDetector("TPC", 0);\r
- pid->AddDetector("EMCAL", 1);\r
- \r
- printf("*************************************\n");\r
- printf("Configuring standard Task:\n");\r
- // task->PrintStatus();\r
- pid->PrintStatus();\r
- printf("*************************************\n");\r
- return task;\r
- \r
- \r
-}\r
-\r
+///////////////////////////////////////////////////////////////////
+// //
+// AddTaskFlowTPCEMCalQCSP macro //
+// Author: Andrea Dubla, Utrecht University, 2012 //
+// //
+///////////////////////////////////////////////////////////////////
+class AliAnalysisDataContainer;
+class AliFlowTrackCuts;
+class AliFlowTrackSimpleCuts;
+class AliFlowEventCuts;
+class AliFlowEventSimpleCuts;
+class AliAnalysisDataContainer;
+class AliHFEextraCuts;
+
+AliAnalysisTaskFlowTPCEMCalQCSP* AddTaskFlowTPCEMCalQCSP(
+ TString uniqueID = "",
+ Float_t centrMin ,
+ Float_t centrMax ,
+ Double_t InvmassCut,
+ Double_t pTCut,
+ Int_t Trigger,
+ Bool_t multCorrcut,
+ Double_t minTPC,
+ Double_t maxTPC,
+ Double_t minEovP,
+ Double_t maxEovP,
+ Double_t minM20,
+ Double_t maxM20,
+ Double_t minM02,
+ Double_t maxM02,
+ Double_t Dispersion,
+ Int_t minTPCCluster,
+ AliHFEextraCuts::ITSPixel_t pixel,
+ Bool_t NUA = kTRUE,
+ Bool_t PhotonicElectronDCA = kFALSE,
+ Int_t TPCClusterforAsso = 80,
+ Bool_t AssoITSref = kTRUE,
+ Bool_t purity = kTRUE,
+ Bool_t SideBandsFlow = kFALSE,
+ Bool_t Phi_minus_psi = kFALSE,
+ const char *Cent = "V0M",
+ Bool_t QC = kTRUE, // use qc2 and qc4
+ Bool_t SP_TPC = kTRUE, //use tpc sp method
+ Bool_t VZERO_SP = kFALSE, // use vzero sp method
+ Bool_t BaseH = kFALSE, // base histo
+ Int_t harmonic = 2,
+ Bool_t shrinkSP = kTRUE,
+ Bool_t debug = kFALSE,
+ Int_t RPFilterBit = 1,
+ Bool_t op_ang = kFALSE,
+ Double_t op_angle_cut=3.,
+ TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root"
+ )
+
+{
+
+
+
+ if(debug) cout << " === Adding Task ElectFlow === " << endl;
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ fileName += ":ElectroID_";
+ fileName += uniqueID;
+ if(debug) cout << " --> Reconstruction data container: " << fileName << endl;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ if(debug) cout << " Fatal error: no analysis manager found! " << endl;
+ return 0x0;
+ }
+ if (!mgr->GetInputEventHandler()) {
+ if(debug) cout << " Fatal error: no imput event handler found!" << endl;
+ return 0x0;
+ }
+
+ //create a task
+ AliAnalysisTaskFlowTPCEMCalQCSP *taskHFE = ConfigHFEemcalMod(kFALSE, minTPCCluster, pixel); //kTRUE if MC
+
+ if(debug) cout << " === AliAnalysisElectronFlow === " << taskHFE << endl;
+ if(!taskHFE) {
+ if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;
+ return 0x0;
+ }
+ taskHFE->SetTrigger(Trigger);
+
+ if(Trigger==0 || Trigger==4){
+ TFile *fFlat=TFile::Open(histoflatname.Data());
+ TCanvas *c=fFlat->Get("cintegral");
+ TH1F *hfl=(TH1F*)c->FindObject("hint");
+ taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0);
+ }
+
+ // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC
+ taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);
+ taskHFE->SetInvariantMassCut(InvmassCut);
+ taskHFE->SetIDCuts(minTPC, maxTPC, minEovP, maxEovP, minM20, maxM20, minM02, maxM02, Dispersion);
+ taskHFE->SetFlowSideBands(SideBandsFlow);
+ taskHFE->Setphiminuspsi(Phi_minus_psi);
+ taskHFE->SetPurity(purity);
+ taskHFE->SetpTCuttrack(pTCut);
+ taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);
+ taskHFE->SetOpeningAngleflag(op_ang);
+ taskHFE->SetOpeningAngleCut(op_angle_cut);
+ taskHFE->SetAssoTPCCluster(TPCClusterforAsso);
+ taskHFE->SetAssoITSRefit(AssoITSref);
+ taskHFE->SetMultCorrelationCut(multCorrcut);
+ //set RP cuts for flow package analysis
+ cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));
+ if(!cutsRP) {
+ if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;
+ return 0x0;
+ }
+
+ if(!VZERO_SP) {
+ AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
+ cutsRP->SetParamType(rptype);
+ cutsRP->SetAODfilterBit(RPFilterBit);
+ cutsRP->SetPtRange(0.2, 5.0);
+ cutsRP->SetEtaRange(-0.7, 0.7);
+ cutsRP->SetMinNClustersTPC(70);
+ cutsRP->SetMinChi2PerClusterTPC(0.1);
+ cutsRP->SetMaxChi2PerClusterTPC(4.0);
+ cutsRP->SetRequireTPCRefit(kTRUE);
+ cutsRP->SetMaxDCAToVertexXY(0.3);
+ cutsRP->SetMaxDCAToVertexZ(0.3);
+ cutsRP->SetAcceptKinkDaughters(kFALSE);
+ cutsRP->SetMinimalTPCdedx(10.);
+ if(debug) cout << " --> kGlobal RP's " << cutsRP << endl;
+ }
+ if(VZERO_SP) { // use vzero sub analysis
+ cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks
+ SP_TPC = kFALSE; // disable other methods
+ QC = kFALSE;
+ if(debug) cout << " --> VZERO RP's " << cutsRP << endl;
+ }
+
+ AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts();
+ AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts();
+ if(VZERO_SP || SP_TPC){
+ POIfilterLeft->SetEtaMin(-0.7);
+ POIfilterLeft->SetEtaMax(0.0);
+ POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733);
+
+ POIfilterRight->SetEtaMin(0.0);
+ POIfilterRight->SetEtaMax(0.7);
+ POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733);
+ }
+
+
+ AliFlowTrackSimpleCuts *POIfilterQC = new AliFlowTrackSimpleCuts();
+ if(QC){
+ POIfilterQC->SetEtaMin(-0.7);
+ POIfilterQC->SetEtaMax(0.7);
+ POIfilterQC->SetMassMin(263731); POIfilterQC->SetMassMax(263733);
+
+ }
+
+ if(SideBandsFlow){
+
+ AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts();
+ AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts();
+ if(SP_TPC){
+ POIfilterLeftH->SetEtaMin(-0.7);
+ POIfilterLeftH->SetEtaMax(0.0);
+ POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638);
+
+ POIfilterRightH->SetEtaMin(0.0);
+ POIfilterRightH->SetEtaMax(0.7);
+ POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638);
+ }
+
+
+ AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts();
+ if(QC){
+ POIfilterQCH->SetEtaMin(-0.7);
+ POIfilterQCH->SetEtaMax(0.7);
+ POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638);
+
+ }
+
+ }
+
+ taskHFE->SetRPCuts(cutsRP);
+
+
+ AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);
+
+ mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(taskHFE,1,coutput3);
+
+
+ if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
+ AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
+ mgr->ConnectOutput(taskHFE, 2, flowEvent);
+ if(debug) cout << " --> Created IO containers " << flowEvent << endl;
+
+ if(SideBandsFlow){
+ if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
+ AliAnalysisDataContainer *flowEventCont = mgr->CreateContainer(Form("FlowContainer_Cont_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
+ mgr->ConnectOutput(taskHFE, 3, flowEventCont);
+ if(debug) cout << " --> Created IO containers " << flowEventCont << endl;
+ }
+
+
+ mgr->AddTask(taskHFE);
+
+ if (QC) { // add qc tasks
+ AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent, debug ,uniqueID, -0.7, -0.0, 0.0, 0.7,false,POIfilterQC, NUA, shrinkSP, BaseH);
+ if(debug) cout << " --> Hanging QC task ...succes! "<< endl;
+ }
+ if (SP_TPC) { // add sp subevent tasks
+ AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight, NUA,BaseH);
+ if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;
+ AddSPmethod(Form("SPTPCQb_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterLeft, NUA,BaseH);
+ if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;
+ }
+ if (VZERO_SP) { // add sp subevent tasks
+ AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterRight, NUA,BaseH);
+ if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;
+ AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterLeft, NUA,BaseH);
+ if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;
+ }
+
+ //=========================================Flow event for elctronContamination==============================================================================================
+ if(SideBandsFlow){
+ if (QC) { // add qc tasks
+ AddQCmethod(Form("QCTPCCont_%s",uniqueID.Data()), harmonic, flowEventCont, debug ,uniqueID, -0.7, -0.0, 0.0, 0.7,false,POIfilterQCH, NUA, shrinkSP,BaseH);
+ if(debug) cout << " --> Hanging QC task ...succes! "<< endl;
+ }
+ if (SP_TPC) { // add sp subevent tasks
+ AddSPmethod(Form("SPTPCQa_Cont_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qa", harmonic, flowEventCont, false, shrinkSP, debug,uniqueID, false, POIfilterRightH, NUA,BaseH);
+ if(debug) cout << " --> Hanging SP Qa task ... succes!" << endl;
+ AddSPmethod(Form("SPTPCQb_Cont_%s", uniqueID.Data()), -0.7, -.0, .0, +0.7, "Qb", harmonic, flowEventCont, false, shrinkSP, debug,uniqueID, false, POIfilterLeftH, NUA,BaseH);
+ if(debug) cout << " --> Hanging SP Qb task ... succes!"<< endl;
+ }
+ }
+ //==========================================================================================================================================================================
+
+
+ return taskHFE;
+
+}
+
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, bool bEP, bool shrink = false, bool debug, TString uniqueID, Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter, Bool_t kNUA, Bool_t kBaseH)
+{
+ // add sp task and invm filter tasks
+ if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ (bEP) ? fileName+=":EP" : fileName+=":SP";
+ // if(etagap) {
+ // fileName+="_SUBEVENTS";
+ // if(debug) cout << " --> Setting up subevent analysis <-- " << endl;
+ // }
+ if(debug) cout << " --> fileName " << fileName << endl;
+ TString myFolder = fileName;
+ if(debug) cout << " --> myFolder " << myFolder << endl;
+ TString myNameSP;
+ (bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
+ if(debug) cout << " myNameSP " << myNameSP << endl;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+ AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);
+ tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
+ if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
+ mgr->AddTask(tskFilter);
+ mgr->ConnectInput(tskFilter, 0, flowEvent);
+ mgr->ConnectOutput(tskFilter, 1, flowEventOut);
+ AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
+ AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);
+ tskSP->SetApplyCorrectionForNUA(kNUA);
+ tskSP->SetHarmonic(harmonic);
+ tskSP->SetTotalQvector(Qvector);
+ if (bEP) tskSP->SetBehaveAsEP();
+ if (shrink)tskSP->SetBookOnlyBasicCCH(kBaseH);
+ mgr->AddTask(tskSP);
+ mgr->ConnectInput(tskSP, 0, flowEventOut);
+ mgr->ConnectOutput(tskSP, 1, outSP);
+}
+//_____________________________________________________________________________
+void AddQCmethod(char *name, int harmonic, AliAnalysisDataContainer *flowEvent, Bool_t debug, TString uniqueID,double minEtaA, double maxEtaA, double minEtaB, double maxEtaB,Bool_t VZERO_SP = kFALSE, AliFlowTrackSimpleCuts* POIfilter, Bool_t kNUA, bool shrink = false, Bool_t kBaseH)
+{
+ // add qc task and invm filter tasks
+ if(debug) cout << " ****** Received request for QC v" << harmonic << " task " << name << ", IO ****** " << flowEvent << endl;
+ TString fileName = AliAnalysisManager::GetCommonFileName();
+ fileName+=":QC";
+ if(debug) cout << " --> Common filename: " << fileName << endl;
+ TString myFolder = Form("v%d", harmonic);
+ if(debug) cout << " --> myFolder: " << myFolder << endl;
+ TString myName = Form("%s", name);
+ if(debug) cout << " --> myName: " << myName << endl;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s", myName.Data()), AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+ AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myName.Data()), NULL, POIfilter);
+ tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
+ // if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
+ mgr->AddTask(tskFilter);
+ mgr->ConnectInput(tskFilter, 0, flowEvent);
+ mgr->ConnectOutput(tskFilter, 1, flowEventOut);
+
+ AliAnalysisDataContainer *outQC = mgr->CreateContainer(myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
+ AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_%s", myName.Data()), kFALSE);
+ tskQC->SetApplyCorrectionForNUA(kNUA);
+ tskQC->SetHarmonic(harmonic);
+ if (shrink)tskQC->SetBookOnlyBasicCCH(kBaseH);
+ mgr->AddTask(tskQC);
+ mgr->ConnectInput(tskQC, 0, flowEventOut);
+ mgr->ConnectOutput(tskQC, 1, outQC);
+}
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+
+AliAnalysisTaskFlowTPCEMCalQCSP* ConfigHFEemcalMod(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){
+ //
+ // HFE standard task configuration
+ //
+
+ Bool_t kAnalyseTaggedTracks = kTRUE;
+
+ AliHFEcuts *hfecuts = new AliHFEcuts("hfeCutsEMCAL","HFE Standard Cuts"); //TODO....change the cuts values to PbPb
+ // hfecuts->CreateStandardCuts();
+ hfecuts->SetMinNClustersTPC(minTPCCulster);
+ hfecuts->SetMinNClustersITS(3);
+ hfecuts->SetMinNTrackletsTRD(0);
+ hfecuts->SetMinRatioTPCclusters(0.6);
+
+ // hfecuts->SetEtaRange(-0.9,0.9);
+ // hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+ hfecuts->SetRequireITSPixel();
+ hfecuts->SetCutITSpixel(pixel);//kAny
+ hfecuts->SetMaxChi2perClusterITS(-1);
+ hfecuts->SetMaxChi2perClusterTPC(3.5);
+ hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back
+ // hfecuts->UnsetVertexRequirement();
+ hfecuts->SetVertexRange(10.);
+ hfecuts->SetRequireSigmaToVertex();
+ //hfecuts->SetSigmaToVertex(10);
+ hfecuts->SetTOFPIDStep(kFALSE);
+ // hfecuts->SetQAOn();
+ hfecuts->SetPtRange(0, 30);
+
+ AliAnalysisTaskFlowTPCEMCalQCSP *task = new AliAnalysisTaskFlowTPCEMCalQCSP("HFE_Flow_TPCEMCal");
+ printf("task ------------------------ %p\n ", task);
+
+
+ task->SetHFECuts(hfecuts);
+
+ // task->SetInvariantMassCut(0.05);
+ // task->SetRejectKinkMother(kTRUE);
+ // task->SetRemovePileUp(kTRUE);
+
+ // Define PID
+ AliHFEpid *pid = task->GetPID();
+ if(useMC) pid->SetHasMCData(kTRUE);
+ pid->AddDetector("TPC", 0);
+ pid->AddDetector("EMCAL", 1);
+
+ printf("*************************************\n");
+ printf("Configuring standard Task:\n");
+ // task->PrintStatus();
+ pid->PrintStatus();
+ printf("*************************************\n");
+ return task;
+
+
+}
+
//_____________________________________________________________________________
\ No newline at end of file
-AliAnalysisTask *AddTaskHFEnpePbPb(Bool_t MCthere, \r
- Bool_t isAOD,\r
- Bool_t kNPERef = kTRUE,\r
- Bool_t kNPEkAny = kFALSE,\r
- Bool_t kNPERefMCf = kTRUE,\r
- Bool_t kNPERefTPConly = kTRUE)\r
-{\r
- // Default settings (TOF-TPC PbPb)\r
- const int kDefTPCcl = 130;\r
- const int kDefTPCclPID = 80;\r
- const int kDefTPCclshared = 1.1;\r
- const int kDefITScl = 4;\r
- const int kDefITSchi2percluster = -1; // cleanup removes badly matching tracks - effects high pt (cut value = 36)\r
- const double kDefDCAr = 1.;\r
- const double kDefDCAz = 2.;\r
- const double kDefTOFs = 3.;\r
- const double kDefEtaIncMin = -0.8;\r
- const double kDefEtaIncMax = 0.8;\r
- const Bool_t etacorrection = kFALSE;\r
- const Bool_t multicorrection = kTRUE;\r
-\r
- Double_t dEdxhm[12] = {3.11,3.11,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0}; \r
- Double_t tpcl1[12] = {-0.14,-0.14,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3}; \r
-\r
- // Default setting for the associated electron for the NonPhotonic Analysis\r
- const double kassETAm = -0.8;\r
- const double kassETAp = 0.8;\r
- const int kassITS = 2;\r
- const int kassTPCcl = 60;\r
- const int kassTPCPIDcl = 60;\r
- const double kassDCAr = 1.0;\r
- const double kassDCAz = 2.0;\r
- const double kassTPCSminus = -3.0;\r
- const double kassTPCSplus = 3.0;\r
-\r
- //get the current analysis manager\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTask_hfe_HFE", "No analysis manager found.");\r
- return 0;\r
- }\r
-\r
- //mgr->AddClassDebug("AliAnalysisTaskHFE",12);\r
- \r
-\r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();\r
-\r
- //@@ 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
-\r
- Double_t dEdxaclm[12], dEdxachm[12];\r
- for(int icent = 0; icent < 12; icent++){\r
- dEdxaclm[icent] = kassTPCSminus;\r
- dEdxachm[icent] = kassTPCSplus;\r
- }\r
-\r
- if(kNPERef){\r
- // **************************************************************\r
- // \r
- // Reference task\r
- //\r
- // **************************************************************\r
- RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,\r
- kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE,kFALSE);\r
- }\r
-\r
- if(kNPEkAny){\r
- // **************************************************************\r
- // \r
- // task for kAny instead of kBoth\r
- //\r
- // **************************************************************\r
- RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kAny, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,\r
- kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE,kFALSE);\r
- }\r
- if(kNPERefMCf){\r
- // **************************************************************\r
- // \r
- // Reference task + MC fake rejected\r
- //\r
- // **************************************************************\r
- RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,\r
- kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE, kTRUE);\r
- }\r
-\r
- if(kNPERefTPConly){\r
- // **************************************************************\r
- // \r
- // Reference task\r
- //\r
- // **************************************************************\r
- RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, 0., AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,\r
- kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE, kFALSE);\r
- }\r
-\r
- return NULL;\r
-}\r
-\r
-//===============================================================================\r
-AliAnalysisTask *RegisterTaskNPEPbPb(Bool_t useMC, Bool_t isAOD, \r
- Int_t tpcCls=120, Int_t tpcClsPID=80, \r
- Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0, \r
- Double_t *tpcdEdxcutlow=NULL, Double_t *tpcdEdxcuthigh=NULL, \r
- Double_t tofs=3., Int_t itshitpixel =AliHFEextraCuts::kBoth,\r
- Double_t itschi2percluster = -1, Double_t tpcsharedcluster = 1.1,\r
- Bool_t etacorr=kFALSE, Bool_t multicorr = kFALSE,\r
- Double_t etaIncMin = -0.8, Double_t etaIncMax = 0.8,\r
- Double_t assETAm=-0.8, Double_t assETAp=0.8, Int_t assITS=2, Int_t assTPCcl=100,\r
- Int_t assTPCPIDcl=80, Double_t assDCAr=1.0, Double_t assDCAz=2.0,\r
- Double_t *assTPCSminus = NULL, Double_t *assTPCSplus=NULL,\r
- Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE, Bool_t rejectMCFake = kFALSE)\r
-{\r
-\r
- //\r
- // Cuts on the inclusive leg\r
- //\r
- Int_t idcaxy = (Int_t)(dcaxy*10.);\r
- Int_t idcaz = (Int_t)(dcaz*10.);\r
- Int_t tpclow = 0;\r
- if(tpcdEdxcutlow) tpclow = (Int_t) (tpcdEdxcutlow[0]*1000.);\r
- Int_t itofs = (Int_t)(tofs*10.);\r
- Int_t ipixelany = itshitpixel;\r
- Int_t imult = multicorr ? 1 : 0;\r
-\r
- //\r
- // Cuts on the associated leg\r
- //\r
- Int_t iassDCAr = (Int_t)(assDCAr*10);\r
- Int_t iassDCAz = (Int_t)(assDCAz*10);\r
- Int_t iassTPCSplus = assTPCSplus ? (Int_t)(assTPCSplus[0]*1000) : 0;\r
- Int_t icat1 = useCat1Tracks ? 1 : 0;\r
- Int_t icat2 = useCat2Tracks ? 1 : 0;\r
- Int_t irejectMCFake = rejectMCFake ? 1 : 0;\r
-\r
- TString appendix(TString::Format("SPD%d_incTPCc%dTPCp%dITS%dDCAr%dz%dTPCs%dTOFs%dm%d_photTPCc%dTPCp%dITS%dDCAr%dDCAz%dTPCs%dMCf%d",ipixelany,tpcCls,tpcClsPID,itsCls,idcaxy,idcaz,tpclow,itofs,imult,assTPCcl,assTPCPIDcl,assITS,iassDCAr,iassDCAz,iassTPCSplus,irejectMCFake));\r
-\r
- printf("Add macro appendix %s\n", appendix.Data());\r
-\r
- if(!gROOT->GetListOfGlobalFunctions()->FindObject("ConfigHFEnpePbPb"))gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/ConfigHFEnpePbPb.C");\r
-\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();\r
- AliAnalysisTaskHFE *task = ConfigHFEnpePbPb(useMC, isAOD, appendix, tpcCls, tpcClsPID, itsCls, dcaxy, dcaz, tpcdEdxcutlow, tpcdEdxcuthigh, tofs, 0, itshitpixel, itschi2percluster, tpcsharedcluster, etacorr, multicorr, etaIncMin, etaIncMax,\r
- assETAm, assETAp, assITS, assTPCcl, assTPCPIDcl, assDCAr, assDCAz, assTPCSminus, assTPCSplus, useCat1Tracks, useCat2Tracks,rejectMCFake);\r
- if(isAOD)\r
- task->SetAODAnalysis();\r
- else\r
- task->SetESDAnalysis();\r
-\r
- if (useMC) task->SetHasMCData(kTRUE);\r
- else task->SetHasMCData(kFALSE);\r
-\r
- task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);\r
-\r
- TString containerName = mgr->GetCommonFileName();\r
- containerName += ":HFE";\r
- containerName += appendix.Data();\r
- printf("container name: %s\n", containerName.Data());\r
-\r
- //create data containers\r
- task->ConnectOutput(1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));\r
- task->ConnectOutput(2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));\r
- mgr->ConnectInput(task, 0, cinput );\r
-\r
- mgr->AddTask(task);\r
-\r
- return NULL;\r
-}\r
+AliAnalysisTask *AddTaskHFEnpePbPb(Bool_t MCthere,
+ Bool_t isAOD,
+ Bool_t kNPERef = kTRUE,
+ Bool_t kNPEkAny = kFALSE,
+ Bool_t kNPERefMCf = kTRUE,
+ Bool_t kNPERefTPConly = kTRUE)
+{
+ // Default settings (TOF-TPC PbPb)
+ const int kDefTPCcl = 130;
+ const int kDefTPCclPID = 80;
+ const int kDefTPCclshared = 1.1;
+ const int kDefITScl = 4;
+ const int kDefITSchi2percluster = -1; // cleanup removes badly matching tracks - effects high pt (cut value = 36)
+ const double kDefDCAr = 1.;
+ const double kDefDCAz = 2.;
+ const double kDefTOFs = 3.;
+ const double kDefEtaIncMin = -0.8;
+ const double kDefEtaIncMax = 0.8;
+ const Bool_t etacorrection = kFALSE;
+ const Bool_t multicorrection = kTRUE;
+
+ Double_t dEdxhm[12] = {3.11,3.11,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
+ Double_t tpcl1[12] = {-0.14,-0.14,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3};
+
+ // Default setting for the associated electron for the NonPhotonic Analysis
+ const double kassETAm = -0.8;
+ const double kassETAp = 0.8;
+ const int kassITS = 2;
+ const int kassTPCcl = 60;
+ const int kassTPCPIDcl = 60;
+ const double kassDCAr = 1.0;
+ const double kassDCAz = 2.0;
+ const double kassTPCSminus = -3.0;
+ const double kassTPCSplus = 3.0;
+
+ //get the current analysis manager
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTask_hfe_HFE", "No analysis manager found.");
+ return 0;
+ }
+
+ //mgr->AddClassDebug("AliAnalysisTaskHFE",12);
+
+
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+
+ //@@ 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+ Double_t dEdxaclm[12], dEdxachm[12];
+ for(int icent = 0; icent < 12; icent++){
+ dEdxaclm[icent] = kassTPCSminus;
+ dEdxachm[icent] = kassTPCSplus;
+ }
+
+ if(kNPERef){
+ // **************************************************************
+ //
+ // Reference task
+ //
+ // **************************************************************
+ RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
+ kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE,kFALSE);
+ }
+
+ if(kNPEkAny){
+ // **************************************************************
+ //
+ // task for kAny instead of kBoth
+ //
+ // **************************************************************
+ RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kAny, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
+ kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE,kFALSE);
+ }
+ if(kNPERefMCf){
+ // **************************************************************
+ //
+ // Reference task + MC fake rejected
+ //
+ // **************************************************************
+ RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
+ kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE, kTRUE);
+ }
+
+ if(kNPERefTPConly){
+ // **************************************************************
+ //
+ // Reference task
+ //
+ // **************************************************************
+ RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, 0., AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
+ kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE, kFALSE);
+ }
+
+ return NULL;
+}
+
+//===============================================================================
+AliAnalysisTask *RegisterTaskNPEPbPb(Bool_t useMC, Bool_t isAOD,
+ Int_t tpcCls=120, Int_t tpcClsPID=80,
+ Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0,
+ Double_t *tpcdEdxcutlow=NULL, Double_t *tpcdEdxcuthigh=NULL,
+ Double_t tofs=3., Int_t itshitpixel =AliHFEextraCuts::kBoth,
+ Double_t itschi2percluster = -1, Double_t tpcsharedcluster = 1.1,
+ Bool_t etacorr=kFALSE, Bool_t multicorr = kFALSE,
+ Double_t etaIncMin = -0.8, Double_t etaIncMax = 0.8,
+ Double_t assETAm=-0.8, Double_t assETAp=0.8, Int_t assITS=2, Int_t assTPCcl=100,
+ Int_t assTPCPIDcl=80, Double_t assDCAr=1.0, Double_t assDCAz=2.0,
+ Double_t *assTPCSminus = NULL, Double_t *assTPCSplus=NULL,
+ Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE, Bool_t rejectMCFake = kFALSE)
+{
+
+ //
+ // Cuts on the inclusive leg
+ //
+ Int_t idcaxy = (Int_t)(dcaxy*10.);
+ Int_t idcaz = (Int_t)(dcaz*10.);
+ Int_t tpclow = 0;
+ if(tpcdEdxcutlow) tpclow = (Int_t) (tpcdEdxcutlow[0]*1000.);
+ Int_t itofs = (Int_t)(tofs*10.);
+ Int_t ipixelany = itshitpixel;
+ Int_t imult = multicorr ? 1 : 0;
+
+ //
+ // Cuts on the associated leg
+ //
+ Int_t iassDCAr = (Int_t)(assDCAr*10);
+ Int_t iassDCAz = (Int_t)(assDCAz*10);
+ Int_t iassTPCSplus = assTPCSplus ? (Int_t)(assTPCSplus[0]*1000) : 0;
+ Int_t icat1 = useCat1Tracks ? 1 : 0;
+ Int_t icat2 = useCat2Tracks ? 1 : 0;
+ Int_t irejectMCFake = rejectMCFake ? 1 : 0;
+
+ TString appendix(TString::Format("SPD%d_incTPCc%dTPCp%dITS%dDCAr%dz%dTPCs%dTOFs%dm%d_photTPCc%dTPCp%dITS%dDCAr%dDCAz%dTPCs%dMCf%d",ipixelany,tpcCls,tpcClsPID,itsCls,idcaxy,idcaz,tpclow,itofs,imult,assTPCcl,assTPCPIDcl,assITS,iassDCAr,iassDCAz,iassTPCSplus,irejectMCFake));
+
+ printf("Add macro appendix %s\n", appendix.Data());
+
+ if(!gROOT->GetListOfGlobalFunctions()->FindObject("ConfigHFEnpePbPb"))gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/ConfigHFEnpePbPb.C");
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+ AliAnalysisTaskHFE *task = ConfigHFEnpePbPb(useMC, isAOD, appendix, tpcCls, tpcClsPID, itsCls, dcaxy, dcaz, tpcdEdxcutlow, tpcdEdxcuthigh, tofs, 0, itshitpixel, itschi2percluster, tpcsharedcluster, etacorr, multicorr, etaIncMin, etaIncMax,
+ assETAm, assETAp, assITS, assTPCcl, assTPCPIDcl, assDCAr, assDCAz, assTPCSminus, assTPCSplus, useCat1Tracks, useCat2Tracks,rejectMCFake);
+ if(isAOD)
+ task->SetAODAnalysis();
+ else
+ task->SetESDAnalysis();
+
+ if (useMC) task->SetHasMCData(kTRUE);
+ else task->SetHasMCData(kFALSE);
+
+ task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
+
+ TString containerName = mgr->GetCommonFileName();
+ containerName += ":HFE";
+ containerName += appendix.Data();
+ printf("container name: %s\n", containerName.Data());
+
+ //create data containers
+ task->ConnectOutput(1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));
+ task->ConnectOutput(2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));
+ mgr->ConnectInput(task, 0, cinput );
+
+ mgr->AddTask(task);
+
+ return NULL;
+}
-AliAnalysisTaskHFECal* ConfigHFECal(Bool_t useMC,Bool_t MassConst,Bool_t MassWidthCut,Bool_t MassCal,Bool_t MassNonlinear,Double_t asspTCut,Double_t angleCut,Double_t MassCut, Double_t NsigCut, Int_t fqa){\r
- //\r
- // HFE standard task configuration\r
- //\r
-\r
- printf("Setting in this analysis\n");\r
- printf("MassConst = %d/n",MassConst); \r
- printf("MassCal = %d/n", MassCal); \r
- printf("MassWidth = %d/n",MassWidthCut); \r
- printf("asspTCut = %d/n",asspTCut); \r
- printf("angleCut = %d/n",angleCut); \r
- printf("MassCut = %d/n",MassCut); \r
- printf("NsigCut = %d/n", NsigCut); \r
- printf("qa = %d/n", fqa); \r
-\r
- Bool_t kAnalyseTaggedTracks = kTRUE;\r
- \r
- AliHFEcuts *hfecuts = new AliHFEcuts("hfeCutsEMCAL","HFE Standard Cuts");\r
- hfecuts->CreateStandardCuts();\r
- hfecuts->SetMinNClustersTPC(100);\r
- hfecuts->SetMinRatioTPCclusters(0.6);\r
- hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);\r
- hfecuts->SetMinNClustersITS(3);\r
- hfecuts->SetCutITSpixel(AliHFEextraCuts::kAny);\r
- hfecuts->SetCheckITSLayerStatus(kFALSE);\r
- hfecuts->SetVertexRange(10.);\r
- hfecuts->SetTOFPIDStep(kFALSE);\r
- hfecuts->SetPtRange(2, 50);\r
- hfecuts->SetMaxImpactParam(3.,3.);\r
- \r
- AliAnalysisTaskHFECal *task = new AliAnalysisTaskHFECal("HFEanalysisEMCal");\r
- printf("task ------------------------ %p\n ", task);\r
- task->SetHFECuts(hfecuts);\r
- task->SetMassConstraint(MassConst);\r
- task->SetMassWidthCut(MassWidthCut);\r
- task->SetMassNonlinear(MassNonlinear);\r
- //Double_t masscut = 0.05;\r
- //if(!MassConst)masscut = 0.1;\r
- Double_t masscut = MassCut;\r
- task->SetInvariantMassCut(masscut);\r
- task->SetOpeningAngleCut(angleCut);\r
- task->SetMimpTassCut(asspTCut);\r
- task->SetMimNsigassCut(NsigCut); \r
- task->SetMassCalMethod(MassCal);\r
- task->SetQAHist(fqa);\r
-\r
- // Define PID\r
- AliHFEpid *pid = task->GetPID();\r
- if(useMC) pid->SetHasMCData(kTRUE);\r
- pid->AddDetector("TPC", 0);\r
- //pid->AddDetector("EMCAL", 1);\r
-\r
- Double_t params[4];\r
- char *cutmodel;\r
- if(useMC){\r
- // Monte-Carlo needs modelling of the falling mean with momentum at low momentum\r
- // for high momentum it is consistent with a flat -0.94\r
- //cutmodel = "[0]*TMath::Exp([1]*x) + [2] + [3]*x";\r
- //Double_t paramsMC[4] = {0.7174, -1.588, -0.9395, 0.0246};\r
- //for(int ipar = 0; ipar < 4; ipar++) params[ipar] = paramsMC[ipar];\r
- cutmodel = "pol0";\r
- params[0] = -1.0; //sigma min\r
- } else {\r
- // Data is consistent with a flat 0.12\r
- cutmodel = "pol0";\r
- //params[0] = -0.0015;\r
- //params[0] = -3.0;\r
- //params[0] = -0.05; //sigma min\r
- params[0] = -1.0; //sigma min\r
- }\r
- //pid->ConfigureTPCdefaultCut(cutmodel, params,3.0); \r
- for(Int_t a=0;a<11;a++)pid->ConfigureTPCcentralityCut(a,cutmodel,params,3.0);\r
- \r
-\r
- // change E/p cuts\r
- AliHFEpidEMCAL *emcpid = pid->AliHFEpid::GetDetPID(AliHFEpid::kEMCALpid);\r
- emcpid->SetEoPMax(1.3);\r
- emcpid->SetEoPMim(0.9);\r
-\r
- printf("*************************************\n");\r
- printf("Configuring standard Task:\n");\r
-// task->PrintStatus();\r
- pid->PrintStatus();\r
- printf("*************************************\n"); \r
- return task;\r
-}\r
+AliAnalysisTaskHFECal* ConfigHFECal(Bool_t useMC,Bool_t MassConst,Bool_t MassWidthCut,Bool_t MassCal,Bool_t MassNonlinear,Double_t asspTCut,Double_t angleCut,Double_t MassCut, Double_t NsigCut, Int_t fqa){
+ //
+ // HFE standard task configuration
+ //
+
+ printf("Setting in this analysis\n");
+ printf("MassConst = %d/n",MassConst);
+ printf("MassCal = %d/n", MassCal);
+ printf("MassWidth = %d/n",MassWidthCut);
+ printf("asspTCut = %d/n",asspTCut);
+ printf("angleCut = %d/n",angleCut);
+ printf("MassCut = %d/n",MassCut);
+ printf("NsigCut = %d/n", NsigCut);
+ printf("qa = %d/n", fqa);
+
+ Bool_t kAnalyseTaggedTracks = kTRUE;
+
+ AliHFEcuts *hfecuts = new AliHFEcuts("hfeCutsEMCAL","HFE Standard Cuts");
+ hfecuts->CreateStandardCuts();
+ hfecuts->SetMinNClustersTPC(100);
+ hfecuts->SetMinRatioTPCclusters(0.6);
+ hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+ hfecuts->SetMinNClustersITS(3);
+ hfecuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+ hfecuts->SetCheckITSLayerStatus(kFALSE);
+ hfecuts->SetVertexRange(10.);
+ hfecuts->SetTOFPIDStep(kFALSE);
+ hfecuts->SetPtRange(2, 50);
+ hfecuts->SetMaxImpactParam(3.,3.);
+
+ AliAnalysisTaskHFECal *task = new AliAnalysisTaskHFECal("HFEanalysisEMCal");
+ printf("task ------------------------ %p\n ", task);
+ task->SetHFECuts(hfecuts);
+ task->SetMassConstraint(MassConst);
+ task->SetMassWidthCut(MassWidthCut);
+ task->SetMassNonlinear(MassNonlinear);
+ //Double_t masscut = 0.05;
+ //if(!MassConst)masscut = 0.1;
+ Double_t masscut = MassCut;
+ task->SetInvariantMassCut(masscut);
+ task->SetOpeningAngleCut(angleCut);
+ task->SetMimpTassCut(asspTCut);
+ task->SetMimNsigassCut(NsigCut);
+ task->SetMassCalMethod(MassCal);
+ task->SetQAHist(fqa);
+
+ // Define PID
+ AliHFEpid *pid = task->GetPID();
+ if(useMC) pid->SetHasMCData(kTRUE);
+ pid->AddDetector("TPC", 0);
+ //pid->AddDetector("EMCAL", 1);
+
+ Double_t params[4];
+ char *cutmodel;
+ if(useMC){
+ // Monte-Carlo needs modelling of the falling mean with momentum at low momentum
+ // for high momentum it is consistent with a flat -0.94
+ //cutmodel = "[0]*TMath::Exp([1]*x) + [2] + [3]*x";
+ //Double_t paramsMC[4] = {0.7174, -1.588, -0.9395, 0.0246};
+ //for(int ipar = 0; ipar < 4; ipar++) params[ipar] = paramsMC[ipar];
+ cutmodel = "pol0";
+ params[0] = -1.0; //sigma min
+ } else {
+ // Data is consistent with a flat 0.12
+ cutmodel = "pol0";
+ //params[0] = -0.0015;
+ //params[0] = -3.0;
+ //params[0] = -0.05; //sigma min
+ params[0] = -1.0; //sigma min
+ }
+ //pid->ConfigureTPCdefaultCut(cutmodel, params,3.0);
+ for(Int_t a=0;a<11;a++)pid->ConfigureTPCcentralityCut(a,cutmodel,params,3.0);
+
+
+ // change E/p cuts
+ AliHFEpidEMCAL *emcpid = pid->AliHFEpid::GetDetPID(AliHFEpid::kEMCALpid);
+ emcpid->SetEoPMax(1.3);
+ emcpid->SetEoPMim(0.9);
+
+ printf("*************************************\n");
+ printf("Configuring standard Task:\n");
+// task->PrintStatus();
+ pid->PrintStatus();
+ printf("*************************************\n");
+ return task;
+}
-#ifndef ALIANALYSISTASKSECHARMFRACTION_H\r
-#define ALIANALYSISTASKSECHARMFRACTION_H\r
-\r
-/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-//*************************************************************************\r
-// Class AliAnalysisTaskSECharmFraction\r
-// AliAnalysisTask for the extraction of the fraction of prompt charm\r
-// using the charm hadron impact parameter to the primary vertex\r
-//\r
-//\r
-// Author: Andrea Rossi andrea.rossi@pd.infn.it\r
-//*************************************************************************\r
-\r
-class TH1F;\r
-class TH2F;\r
-class AliAODDEvent;\r
-class AliAODMCHeader;\r
-class AliAODRecoDecayHF2Prong;\r
-class AliAODRecoDecayHF;\r
-class AliAODMCParticle;\r
-class AliAnalysisVertexingHF;\r
-class AliRDHFCutsD0toKpi;\r
-class AliNormalizationCounter;\r
-class AliVertexingHFUtils;\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-\r
-class AliAnalysisTaskSECharmFraction : public AliAnalysisTaskSE {\r
- public:\r
- AliAnalysisTaskSECharmFraction();\r
- AliAnalysisTaskSECharmFraction(const char *name);\r
- AliAnalysisTaskSECharmFraction(const char *name,AliRDHFCutsD0toKpi *cutsA,AliRDHFCutsD0toKpi *cutsB);\r
-\r
- virtual ~AliAnalysisTaskSECharmFraction(); \r
-\r
- // Implementation of interface methods\r
- virtual void UserCreateOutputObjects();\r
- virtual void Init();\r
- virtual void LocalInit() {Init();}\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *option); \r
- void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}\r
- void SetSplitMassD0D0bar(Bool_t splitD0D0bar=kTRUE){fsplitMassD0D0bar=splitD0D0bar;}\r
- Bool_t GetIsSplitMassD0D0bar(){return fsplitMassD0D0bar;}\r
- void SetUsePID(Bool_t pid){fusePID=pid;}\r
- void SetAnalyzeLikeSign(Bool_t likesign=kFALSE){fLikeSign=likesign;}\r
- void SetNMaxTrForVtx(const Int_t ntrMaxforVtx){fNtrMaxforVtx=ntrMaxforVtx;}\r
- Int_t GetNMaxTrForVtx(){return fNtrMaxforVtx;}\r
- void SetPtBins(Int_t nbins,const Float_t *ptbins);\r
- void SetSignalInvMassCut(const Double_t signalInvMassCut=0.027){fsignalInvMassCut=signalInvMassCut;}\r
- void SetLargeInvMassCut(const Double_t largeInvMassCut=2.){flargeInvMassCut=largeInvMassCut;}\r
- void SetSideBandInvMassCut(const Double_t sidebandInvMassCut=0.054){// default value ~ 2x3 times inv mass resol.: a factor 2 is applied w.r.t. 3sigma, should be safe enough to exclude most of the reflections \r
- fsidebandInvMassCut=sidebandInvMassCut; \r
- }\r
- void SetSideBandInvMassWindow(const Double_t sidebandInvMassWindow=0.108){//~ 6 times inv. mass resol.\r
- fsidebandInvMassWindow=sidebandInvMassWindow;\r
- } \r
- void SetAcceptanceCut(const Double_t eta=0.8,const Double_t nITSpoints=5.,const Double_t nSPDpoints=2.){fAcceptanceCuts[0]=eta;fAcceptanceCuts[1]=nITSpoints;fAcceptanceCuts[2]=nSPDpoints;}\r
- void SetStandardMassSelection();\r
- Int_t SetStandardCuts(Double_t pt,Double_t invMassCut);\r
- Int_t SetStandardCuts(Float_t *&ptbinlimits);\r
- void CheckInvMassD0(AliAODRecoDecayHF2Prong *d,Double_t &invMassD0,Double_t &invMassD0bar,Bool_t &isPeakD0,Bool_t &isPeakD0bar,Bool_t &isSideBandD0,Bool_t &isSideBandD0bar);\r
- void SetAnalysisLevel(Int_t level){fFastAnalysis=level;}\r
- void SetCheckBitD0flag(Bool_t checkfl){fcheckD0Bit=checkfl;}\r
- Bool_t GetCheckBitD0flag(){return fcheckD0Bit;}\r
- Int_t GetAnalysisLevel(){return fFastAnalysis;}\r
- Int_t CheckOrigin(const TClonesArray* arrayMC, const AliAODMCParticle *mcPartCandidate)const;\r
- AliAODRecoDecayHF *GetD0toKPiSignalType(const AliAODRecoDecayHF2Prong *d,TClonesArray *arrayMC,Int_t &signaltype,Double_t &massMumTrue,Double_t *primaryVtx);\r
- AliAODRecoDecayHF *GetD0toKPiSignalTypeObsolete(const AliAODRecoDecayHF2Prong *d,TClonesArray *arrayMC,Int_t &signaltype,Double_t &massMumTrue,Double_t *primaryVtx);\r
- AliAODRecoDecayHF* ConstructFakeTrueSecVtx(const AliAODMCParticle *b1,const AliAODMCParticle *b2,const AliAODMCParticle *mum,Double_t *primaryVtxTrue);\r
- void SetUseMC(Bool_t useMC){fUseMC=useMC;}\r
- Bool_t SpecialSelD0(AliAODRecoDecayHF2Prong *d,Int_t &nusedforVtx);\r
- Bool_t FillAziList(AliAODEvent *aod,Double_t azilist[30000],Int_t trkIDlist[30000],Int_t &nprim)const;\r
- void FillAziHistos(AliAODRecoDecayHF2Prong *d,TList *&list,Int_t ptbin,Double_t azilist[30000],Int_t trkIDlist[30000],Int_t nprim,Int_t okD0,Int_t okD0bar,Bool_t isPeakD0,Bool_t isPeakD0bar,Bool_t isSideBandD0,Bool_t isSideBandD0bar)const;\r
-\r
- AliAODVertex* GetPrimaryVtxSkipped(AliAODEvent *aodev,AliAODRecoDecayHF2Prong *d);\r
- void SetRejecCandidateMCUpgrade(Bool_t selection){fselectForUpgrade=selection;}\r
- void SetSkipEventSelection(Bool_t skip){fskipEventSelection=skip;}\r
- void SetMaxZvtxForSkipEventSelection(Double_t zmax){fZvtxUpgr=zmax;}\r
- /* ######### THE FOLLOWING IS FOR FURTHER IMPLEMENATION ############\r
- Int_t GetPtBin(Double_t pt)const;\r
- void SetD0Cuts(Int_t ptbin,Double_t &*d0cutsLoose,Double_t &*d0cutsTight);\r
- \r
- // void InvMassSelection();\r
- \r
- void SetCheckMC(Bool_t checkMC){fcheckMC=checkMC;}\r
- void SetCheckMC_D0(Bool_t check_D0){fcheckMCD0=check_D0;}\r
- void SetCheckMC_2prongs(Bool_t check2prongs){fcheckMC2prongs=check2prongs;}\r
- void SetCheckMC_prompt(Bool_t checkprompt){fcheckMCprompt=checkprompt;}\r
- void SetCheckMC_fromB(Bool_t checkfromB){fcheckMCfromB=checkfromB;}\r
- void SetCheckMC_fromDstar(Bool_t skipD0star){fSkipD0star=skipD0star;}\r
- void SetUseCuts(Bool_t usecuts){fD0usecuts=usecuts;}\r
- void SetSideBands(Double_t sideband){fSideBands=sideband;}\r
- void SetStudyPureBackground(Bool_t back){fStudyPureBackground=back;}\r
- */\r
- AliRDHFCutsD0toKpi* GetLooseCut(){\r
- return fCutsLoose;\r
- }\r
- AliRDHFCutsD0toKpi* GetTightCut(){\r
- return fCutsTight;\r
- }\r
- /* void SetCutFunction(Int_t (*setcuts)(AliAnalysisTaskSECharmFraction*,Double_t,Double_t)){\r
- fSetCuts=setcuts;\r
- fStandCuts=kFALSE;\r
- }\r
- */\r
- // Int_t SetCuts(AliAnalysisTaskSECharmFraction *alchfr,Double_t pt,Double_t invMassCut);\r
- \r
- private:\r
- Bool_t FillHistos(AliAODRecoDecayHF2Prong *d,TList *&list,Int_t ptbin,Int_t okD0,Int_t okD0bar,Double_t invMassD0,Double_t invMassD0bar,Bool_t isPeakD0,Bool_t isPeakD0bar,Bool_t isSideBandD0,Bool_t isSideBandD0bar,Double_t massmumtrue,AliAODRecoDecayHF *aodDMC,Double_t *vtxTrue);\r
- void FillHistoMCproperties(TClonesArray *arrayMC);\r
-\r
- AliRDHFCutsD0toKpi *fCutsLoose; // Loose cuts object\r
- AliRDHFCutsD0toKpi *fCutsTight; // Vertexer heavy flavour\r
- Int_t fFastAnalysis; // Level of analysis speed: default is 1, switch it to 2 to fill the THnSparse\r
- Bool_t fReadMC; // Flag To switch on/off access to MC \r
- Bool_t fcheckD0Bit; // Flag to check the D0 bit flag\r
- Bool_t fsplitMassD0D0bar; // Flag to use two shistos for D0 and D0bar invariant masses\r
- Bool_t fLikeSign; // Flag to analyse Like Sign array\r
- Bool_t fusePID; // Flag to use PID\r
- Double_t fmD0PDG; // MC D0 mass\r
- Int_t fnbins; // Number of pt bins\r
- Float_t *fptbins; //[fnbins] ptbins \r
- Int_t fNtrMaxforVtx; // N Max acceptable tracks used for vertex (0,1,2)\r
- Double_t fptAll; //!Sum of pt of the reco tracks\r
- Double_t fptAllSq; //!Sum of the square of the pt of the reco tracks\r
- Double_t fptMax[3]; //!Three largest track pt in the event\r
- Double_t fAcceptanceCuts[3]; // array with acceptance cuts\r
- Double_t fsignalInvMassCut; // invariant mass cut to define signal region\r
- Double_t flargeInvMassCut; // invariant mass cut to accept all inv mass window\r
- Double_t fsidebandInvMassCut; // invariant mass cut to define side band region lower limit\r
- Double_t fsidebandInvMassWindow; // invariant mass cut to define side band region width\r
- Bool_t fUseMC; // flag to use or not MC info\r
- Bool_t fCleanCandOwnVtx; // flag to switch on/off cleaning of the candidate own vtx\r
- TH1F *fNentries; //!histo for #AOD analysed, container 1\r
- TH1F *fSignalType; //!histo for the type of MC signal , container 2\r
- TH1F *fSignalTypeLsCuts; //!histo for the type of MC signal with loose cuts , container 3\r
- TH1F *fSignalTypeTghCuts; //!histo for the type of MC signal with tight cuts, container 4\r
- AliNormalizationCounter *fCounter; //!counter for the normalization \r
- TList *flistMCproperties; //!TLists for MC properties of D0 w.r.t. B mesons and c quarks cntainer 5\r
- TList *flistNoCutsSignal; //!TList for signal (D prompt) with nocuts, container 6\r
- TList *flistNoCutsBack; //!TList for background with nocuts, container 7\r
- TList *flistNoCutsFromB; //!TList for D from B or D from Dstar from Bwith nocuts, container 8\r
- TList *flistNoCutsFromDstar; //!TList for D from Dstar with nocuts, container 9\r
- TList *flistNoCutsOther; //!TList for others with nocuts, container 10\r
- TList *flistLsCutsSignal; //!TList for signal (D prompt) with loose cuts, container 11\r
- TList *flistLsCutsBack; //!TList for background with loose cuts, container 12\r
- TList *flistLsCutsFromB; //!TList for D from B or D from Dstar from B with loose cuts, container 13\r
- TList *flistLsCutsFromDstar; //!TList for D from Dstar with loose cuts, container 14\r
- TList *flistLsCutsOther; //!TList for others with loose cuts, container 15\r
- TList *flistTghCutsSignal; //!TList for signal (D prompt) with tight cuts, container 16\r
- TList *flistTghCutsBack; //!TList for backgrnd with tight cuts, container 17\r
- TList *flistTghCutsFromB; //!TList for D from B or D from Dstar from Bwith tight cuts, container 18\r
- TList *flistTghCutsFromDstar; //!TList for D from Dstar Dstar with tight cuts, container 19\r
- TList *flistTghCutsOther; //!TList for others with tight cuts, container 20\r
- AliVertexingHFUtils *fVertUtil; // vertexing HF Util\r
- Bool_t fselectForUpgrade; // switch to reject candidates from HIJING and not Pythia for upgrade studies\r
- Bool_t fskipEventSelection; // switch to skip event selection (for upgrade studies)\r
- Double_t fZvtxUpgr; // cut value on max zvtx used ONLY if fskipEventSelection is kTRUE\r
- /* Bool_t fD0usecuts; // Switch on the use of the cuts TO BE IMPLEMENTED \r
- Bool_t fcheckMC; // Switch on MC check: minimum check is same mother TO BE IMPLEMENTED\r
- Bool_t fcheckMCD0; // check the mother is a D0 TO BE IMPLEMENTED\r
- Bool_t fcheckMC2prongs; // check the decay is in two prongs TO BE IMPLEMENTED \r
- Bool_t fcheckMCprompt; // check the D0 comes from a c quark TO BE IMPLEMENTED\r
- Bool_t fcheckMCfromB; // check the D0 comes from a b quark TO BE IMPLEMENTED\r
- Bool_t fSkipD0star; // skip if D0 comes from a D* TO BE IMPLEMENTED\r
- Bool_t fStudyd0fromBTrue; // Flag for analyze true impact par of D0 from B TO BE IMPLEMENTED \r
- Bool_t fStudyPureBackground; // Flag to study the background (reverse the selection on the signal) TO BE IMPLEMENTED \r
- Double_t fSideBands; //Side bands selection (see cxx) TO BE IMPLEMENTED\r
- */\r
- AliAnalysisTaskSECharmFraction(const AliAnalysisTaskSECharmFraction&); // not implemented\r
- AliAnalysisTaskSECharmFraction& operator=(const AliAnalysisTaskSECharmFraction&); // not implemented\r
- \r
- ClassDef(AliAnalysisTaskSECharmFraction,5); // analysis task for prompt charm fraction\r
-};\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKSECHARMFRACTION_H
+#define ALIANALYSISTASKSECHARMFRACTION_H
+
+/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//*************************************************************************
+// Class AliAnalysisTaskSECharmFraction
+// AliAnalysisTask for the extraction of the fraction of prompt charm
+// using the charm hadron impact parameter to the primary vertex
+//
+//
+// Author: Andrea Rossi andrea.rossi@pd.infn.it
+//*************************************************************************
+
+class TH1F;
+class TH2F;
+class AliAODDEvent;
+class AliAODMCHeader;
+class AliAODRecoDecayHF2Prong;
+class AliAODRecoDecayHF;
+class AliAODMCParticle;
+class AliAnalysisVertexingHF;
+class AliRDHFCutsD0toKpi;
+class AliNormalizationCounter;
+class AliVertexingHFUtils;
+
+#include "AliAnalysisTaskSE.h"
+
+class AliAnalysisTaskSECharmFraction : public AliAnalysisTaskSE {
+ public:
+ AliAnalysisTaskSECharmFraction();
+ AliAnalysisTaskSECharmFraction(const char *name);
+ AliAnalysisTaskSECharmFraction(const char *name,AliRDHFCutsD0toKpi *cutsA,AliRDHFCutsD0toKpi *cutsB);
+
+ virtual ~AliAnalysisTaskSECharmFraction();
+
+ // Implementation of interface methods
+ virtual void UserCreateOutputObjects();
+ virtual void Init();
+ virtual void LocalInit() {Init();}
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *option);
+ void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}
+ void SetSplitMassD0D0bar(Bool_t splitD0D0bar=kTRUE){fsplitMassD0D0bar=splitD0D0bar;}
+ Bool_t GetIsSplitMassD0D0bar(){return fsplitMassD0D0bar;}
+ void SetUsePID(Bool_t pid){fusePID=pid;}
+ void SetAnalyzeLikeSign(Bool_t likesign=kFALSE){fLikeSign=likesign;}
+ void SetNMaxTrForVtx(const Int_t ntrMaxforVtx){fNtrMaxforVtx=ntrMaxforVtx;}
+ Int_t GetNMaxTrForVtx(){return fNtrMaxforVtx;}
+ void SetPtBins(Int_t nbins,const Float_t *ptbins);
+ void SetSignalInvMassCut(const Double_t signalInvMassCut=0.027){fsignalInvMassCut=signalInvMassCut;}
+ void SetLargeInvMassCut(const Double_t largeInvMassCut=2.){flargeInvMassCut=largeInvMassCut;}
+ void SetSideBandInvMassCut(const Double_t sidebandInvMassCut=0.054){// default value ~ 2x3 times inv mass resol.: a factor 2 is applied w.r.t. 3sigma, should be safe enough to exclude most of the reflections
+ fsidebandInvMassCut=sidebandInvMassCut;
+ }
+ void SetSideBandInvMassWindow(const Double_t sidebandInvMassWindow=0.108){//~ 6 times inv. mass resol.
+ fsidebandInvMassWindow=sidebandInvMassWindow;
+ }
+ void SetAcceptanceCut(const Double_t eta=0.8,const Double_t nITSpoints=5.,const Double_t nSPDpoints=2.){fAcceptanceCuts[0]=eta;fAcceptanceCuts[1]=nITSpoints;fAcceptanceCuts[2]=nSPDpoints;}
+ void SetStandardMassSelection();
+ Int_t SetStandardCuts(Double_t pt,Double_t invMassCut);
+ Int_t SetStandardCuts(Float_t *&ptbinlimits);
+ void CheckInvMassD0(AliAODRecoDecayHF2Prong *d,Double_t &invMassD0,Double_t &invMassD0bar,Bool_t &isPeakD0,Bool_t &isPeakD0bar,Bool_t &isSideBandD0,Bool_t &isSideBandD0bar);
+ void SetAnalysisLevel(Int_t level){fFastAnalysis=level;}
+ void SetCheckBitD0flag(Bool_t checkfl){fcheckD0Bit=checkfl;}
+ Bool_t GetCheckBitD0flag(){return fcheckD0Bit;}
+ Int_t GetAnalysisLevel(){return fFastAnalysis;}
+ Int_t CheckOrigin(const TClonesArray* arrayMC, const AliAODMCParticle *mcPartCandidate)const;
+ AliAODRecoDecayHF *GetD0toKPiSignalType(const AliAODRecoDecayHF2Prong *d,TClonesArray *arrayMC,Int_t &signaltype,Double_t &massMumTrue,Double_t *primaryVtx);
+ AliAODRecoDecayHF *GetD0toKPiSignalTypeObsolete(const AliAODRecoDecayHF2Prong *d,TClonesArray *arrayMC,Int_t &signaltype,Double_t &massMumTrue,Double_t *primaryVtx);
+ AliAODRecoDecayHF* ConstructFakeTrueSecVtx(const AliAODMCParticle *b1,const AliAODMCParticle *b2,const AliAODMCParticle *mum,Double_t *primaryVtxTrue);
+ void SetUseMC(Bool_t useMC){fUseMC=useMC;}
+ Bool_t SpecialSelD0(AliAODRecoDecayHF2Prong *d,Int_t &nusedforVtx);
+ Bool_t FillAziList(AliAODEvent *aod,Double_t azilist[30000],Int_t trkIDlist[30000],Int_t &nprim)const;
+ void FillAziHistos(AliAODRecoDecayHF2Prong *d,TList *&list,Int_t ptbin,Double_t azilist[30000],Int_t trkIDlist[30000],Int_t nprim,Int_t okD0,Int_t okD0bar,Bool_t isPeakD0,Bool_t isPeakD0bar,Bool_t isSideBandD0,Bool_t isSideBandD0bar)const;
+
+ AliAODVertex* GetPrimaryVtxSkipped(AliAODEvent *aodev,AliAODRecoDecayHF2Prong *d);
+ void SetRejecCandidateMCUpgrade(Bool_t selection){fselectForUpgrade=selection;}
+ void SetSkipEventSelection(Bool_t skip){fskipEventSelection=skip;}
+ void SetMaxZvtxForSkipEventSelection(Double_t zmax){fZvtxUpgr=zmax;}
+ /* ######### THE FOLLOWING IS FOR FURTHER IMPLEMENATION ############
+ Int_t GetPtBin(Double_t pt)const;
+ void SetD0Cuts(Int_t ptbin,Double_t &*d0cutsLoose,Double_t &*d0cutsTight);
+
+ // void InvMassSelection();
+
+ void SetCheckMC(Bool_t checkMC){fcheckMC=checkMC;}
+ void SetCheckMC_D0(Bool_t check_D0){fcheckMCD0=check_D0;}
+ void SetCheckMC_2prongs(Bool_t check2prongs){fcheckMC2prongs=check2prongs;}
+ void SetCheckMC_prompt(Bool_t checkprompt){fcheckMCprompt=checkprompt;}
+ void SetCheckMC_fromB(Bool_t checkfromB){fcheckMCfromB=checkfromB;}
+ void SetCheckMC_fromDstar(Bool_t skipD0star){fSkipD0star=skipD0star;}
+ void SetUseCuts(Bool_t usecuts){fD0usecuts=usecuts;}
+ void SetSideBands(Double_t sideband){fSideBands=sideband;}
+ void SetStudyPureBackground(Bool_t back){fStudyPureBackground=back;}
+ */
+ AliRDHFCutsD0toKpi* GetLooseCut(){
+ return fCutsLoose;
+ }
+ AliRDHFCutsD0toKpi* GetTightCut(){
+ return fCutsTight;
+ }
+ /* void SetCutFunction(Int_t (*setcuts)(AliAnalysisTaskSECharmFraction*,Double_t,Double_t)){
+ fSetCuts=setcuts;
+ fStandCuts=kFALSE;
+ }
+ */
+ // Int_t SetCuts(AliAnalysisTaskSECharmFraction *alchfr,Double_t pt,Double_t invMassCut);
+
+ private:
+ Bool_t FillHistos(AliAODRecoDecayHF2Prong *d,TList *&list,Int_t ptbin,Int_t okD0,Int_t okD0bar,Double_t invMassD0,Double_t invMassD0bar,Bool_t isPeakD0,Bool_t isPeakD0bar,Bool_t isSideBandD0,Bool_t isSideBandD0bar,Double_t massmumtrue,AliAODRecoDecayHF *aodDMC,Double_t *vtxTrue);
+ void FillHistoMCproperties(TClonesArray *arrayMC);
+
+ AliRDHFCutsD0toKpi *fCutsLoose; // Loose cuts object
+ AliRDHFCutsD0toKpi *fCutsTight; // Vertexer heavy flavour
+ Int_t fFastAnalysis; // Level of analysis speed: default is 1, switch it to 2 to fill the THnSparse
+ Bool_t fReadMC; // Flag To switch on/off access to MC
+ Bool_t fcheckD0Bit; // Flag to check the D0 bit flag
+ Bool_t fsplitMassD0D0bar; // Flag to use two shistos for D0 and D0bar invariant masses
+ Bool_t fLikeSign; // Flag to analyse Like Sign array
+ Bool_t fusePID; // Flag to use PID
+ Double_t fmD0PDG; // MC D0 mass
+ Int_t fnbins; // Number of pt bins
+ Float_t *fptbins; //[fnbins] ptbins
+ Int_t fNtrMaxforVtx; // N Max acceptable tracks used for vertex (0,1,2)
+ Double_t fptAll; //!Sum of pt of the reco tracks
+ Double_t fptAllSq; //!Sum of the square of the pt of the reco tracks
+ Double_t fptMax[3]; //!Three largest track pt in the event
+ Double_t fAcceptanceCuts[3]; // array with acceptance cuts
+ Double_t fsignalInvMassCut; // invariant mass cut to define signal region
+ Double_t flargeInvMassCut; // invariant mass cut to accept all inv mass window
+ Double_t fsidebandInvMassCut; // invariant mass cut to define side band region lower limit
+ Double_t fsidebandInvMassWindow; // invariant mass cut to define side band region width
+ Bool_t fUseMC; // flag to use or not MC info
+ Bool_t fCleanCandOwnVtx; // flag to switch on/off cleaning of the candidate own vtx
+ TH1F *fNentries; //!histo for #AOD analysed, container 1
+ TH1F *fSignalType; //!histo for the type of MC signal , container 2
+ TH1F *fSignalTypeLsCuts; //!histo for the type of MC signal with loose cuts , container 3
+ TH1F *fSignalTypeTghCuts; //!histo for the type of MC signal with tight cuts, container 4
+ AliNormalizationCounter *fCounter; //!counter for the normalization
+ TList *flistMCproperties; //!TLists for MC properties of D0 w.r.t. B mesons and c quarks cntainer 5
+ TList *flistNoCutsSignal; //!TList for signal (D prompt) with nocuts, container 6
+ TList *flistNoCutsBack; //!TList for background with nocuts, container 7
+ TList *flistNoCutsFromB; //!TList for D from B or D from Dstar from Bwith nocuts, container 8
+ TList *flistNoCutsFromDstar; //!TList for D from Dstar with nocuts, container 9
+ TList *flistNoCutsOther; //!TList for others with nocuts, container 10
+ TList *flistLsCutsSignal; //!TList for signal (D prompt) with loose cuts, container 11
+ TList *flistLsCutsBack; //!TList for background with loose cuts, container 12
+ TList *flistLsCutsFromB; //!TList for D from B or D from Dstar from B with loose cuts, container 13
+ TList *flistLsCutsFromDstar; //!TList for D from Dstar with loose cuts, container 14
+ TList *flistLsCutsOther; //!TList for others with loose cuts, container 15
+ TList *flistTghCutsSignal; //!TList for signal (D prompt) with tight cuts, container 16
+ TList *flistTghCutsBack; //!TList for backgrnd with tight cuts, container 17
+ TList *flistTghCutsFromB; //!TList for D from B or D from Dstar from Bwith tight cuts, container 18
+ TList *flistTghCutsFromDstar; //!TList for D from Dstar Dstar with tight cuts, container 19
+ TList *flistTghCutsOther; //!TList for others with tight cuts, container 20
+ AliVertexingHFUtils *fVertUtil; // vertexing HF Util
+ Bool_t fselectForUpgrade; // switch to reject candidates from HIJING and not Pythia for upgrade studies
+ Bool_t fskipEventSelection; // switch to skip event selection (for upgrade studies)
+ Double_t fZvtxUpgr; // cut value on max zvtx used ONLY if fskipEventSelection is kTRUE
+ /* Bool_t fD0usecuts; // Switch on the use of the cuts TO BE IMPLEMENTED
+ Bool_t fcheckMC; // Switch on MC check: minimum check is same mother TO BE IMPLEMENTED
+ Bool_t fcheckMCD0; // check the mother is a D0 TO BE IMPLEMENTED
+ Bool_t fcheckMC2prongs; // check the decay is in two prongs TO BE IMPLEMENTED
+ Bool_t fcheckMCprompt; // check the D0 comes from a c quark TO BE IMPLEMENTED
+ Bool_t fcheckMCfromB; // check the D0 comes from a b quark TO BE IMPLEMENTED
+ Bool_t fSkipD0star; // skip if D0 comes from a D* TO BE IMPLEMENTED
+ Bool_t fStudyd0fromBTrue; // Flag for analyze true impact par of D0 from B TO BE IMPLEMENTED
+ Bool_t fStudyPureBackground; // Flag to study the background (reverse the selection on the signal) TO BE IMPLEMENTED
+ Double_t fSideBands; //Side bands selection (see cxx) TO BE IMPLEMENTED
+ */
+ AliAnalysisTaskSECharmFraction(const AliAnalysisTaskSECharmFraction&); // not implemented
+ AliAnalysisTaskSECharmFraction& operator=(const AliAnalysisTaskSECharmFraction&); // not implemented
+
+ ClassDef(AliAnalysisTaskSECharmFraction,5); // analysis task for prompt charm fraction
+};
+
+#endif
-#ifndef ALIANALYSISTASKFLAVOURJETCORRELATIONS_H\r
-#define ALIANALYSISTASKFLAVOURJETCORRELATIONS_H\r
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------------\r
-// Author : A. Grelli, Utrecht University\r
-// C. Bianchin, Utrecht University\r
-// X. Zhang, LBNL\r
-//-----------------------------------------------------------------------\r
-\r
-\r
-#include <TH2F.h>\r
-#include "AliAODEvent.h"\r
-#include "AliPicoTrack.h"\r
-#include "AliAnalysisTaskEmcalJet.h"\r
-\r
-class TH3F;\r
-class TParticle ;\r
-class TClonesArray ;\r
-class AliMCParticle;\r
-class AliAODMCParticle;\r
-class AliRDHFCuts;\r
-class AliEmcalJet;\r
-class AliAODRecoDecayHF;\r
-class AliAODRecoCascadeHF;\r
-class AliAODEvent;\r
-\r
-class AliAnalysisTaskFlavourJetCorrelations : public AliAnalysisTaskEmcalJet \r
-{\r
-\r
- public:\r
-\r
- enum ECandidateType{ kD0toKpi, kDstartoKpipi };\r
-\r
- AliAnalysisTaskFlavourJetCorrelations();\r
- AliAnalysisTaskFlavourJetCorrelations(const Char_t* name,AliRDHFCuts* cuts, ECandidateType candtype);\r
- virtual ~AliAnalysisTaskFlavourJetCorrelations();\r
-\r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- virtual void Init();\r
- virtual void LocalInit() {Init();}\r
-\r
- // inizializations\r
- Bool_t DefineHistoForAnalysis(); \r
-\r
- // set MC usage\r
- void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}\r
- Bool_t GetMC() const {return fUseMCInfo;}\r
- // set usage of reconstructed tracks\r
- void SetUseReco(Bool_t reco) {fUseReco=reco;}\r
- Bool_t GetUseReco() {return fUseReco;}\r
- \r
- \r
- void SetMassLimits(Double_t range, Int_t pdg);\r
- void SetMassLimits(Double_t lowlimit, Double_t uplimit);\r
-\r
- //jet reconstruction algorithm\r
- void SetJetArrayName(TString jetArrName) {fJetArrName=jetArrName;};\r
- TString GetJetArrayName() const {return fJetArrName;};\r
-\r
- // trigger on jet events\r
- void SetTriggerOnLeadingJet(Bool_t triggerOnLeadingJet) {fLeadingJetOnly=triggerOnLeadingJet;};\r
- Bool_t GetTriggerOnLeadingJet() const {return fLeadingJetOnly;}\r
-\r
-\r
- // Array of D0 width for the Dstar\r
- Bool_t SetD0WidthForDStar(Int_t nptbins,Float_t* width);\r
-\r
- //Bool_t FillMCDJetInfo(AliPicoTrack *jetTrk,AliEmcalJet* jet, TClonesArray *mcArray,Double_t ptjet);\r
- void FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet);\r
- void FillHistogramsD0JetCorr(AliAODRecoDecayHF* candidate, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj, Double_t deltaR, AliAODEvent* aodEvent);\r
-\r
- void FillHistogramsDstarJetCorr(AliAODRecoCascadeHF* dstar, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj,Double_t deltaR);\r
- void FillHistogramsMCGenDJetCorr(Double_t dPhi, Double_t z,Double_t ptD,Double_t ptjet,Double_t deltaR);\r
- void SideBandBackground(AliAODRecoCascadeHF *candDstar, AliEmcalJet *jet);\r
- void MCBackground(AliAODRecoDecayHF *candbg, AliEmcalJet *jet);\r
- void FillMassHistograms(Double_t mass,Double_t ptD, Double_t deltaR);\r
- void FlagFlavour(AliVParticle* charm, AliEmcalJet* jet);\r
+#ifndef ALIANALYSISTASKFLAVOURJETCORRELATIONS_H
+#define ALIANALYSISTASKFLAVOURJETCORRELATIONS_H
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Author : A. Grelli, Utrecht University
+// C. Bianchin, Utrecht University
+// X. Zhang, LBNL
+//-----------------------------------------------------------------------
+
+
+#include <TH2F.h>
+#include "AliAODEvent.h"
+#include "AliPicoTrack.h"
+#include "AliAnalysisTaskEmcalJet.h"
+
+class TH3F;
+class TParticle ;
+class TClonesArray ;
+class AliMCParticle;
+class AliAODMCParticle;
+class AliRDHFCuts;
+class AliEmcalJet;
+class AliAODRecoDecayHF;
+class AliAODRecoCascadeHF;
+class AliAODEvent;
+
+class AliAnalysisTaskFlavourJetCorrelations : public AliAnalysisTaskEmcalJet
+{
+
+ public:
+
+ enum ECandidateType{ kD0toKpi, kDstartoKpipi };
+
+ AliAnalysisTaskFlavourJetCorrelations();
+ AliAnalysisTaskFlavourJetCorrelations(const Char_t* name,AliRDHFCuts* cuts, ECandidateType candtype);
+ virtual ~AliAnalysisTaskFlavourJetCorrelations();
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ virtual void Init();
+ virtual void LocalInit() {Init();}
+
+ // inizializations
+ Bool_t DefineHistoForAnalysis();
+
+ // set MC usage
+ void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
+ Bool_t GetMC() const {return fUseMCInfo;}
+ // set usage of reconstructed tracks
+ void SetUseReco(Bool_t reco) {fUseReco=reco;}
+ Bool_t GetUseReco() {return fUseReco;}
+
+
+ void SetMassLimits(Double_t range, Int_t pdg);
+ void SetMassLimits(Double_t lowlimit, Double_t uplimit);
+
+ //jet reconstruction algorithm
+ void SetJetArrayName(TString jetArrName) {fJetArrName=jetArrName;};
+ TString GetJetArrayName() const {return fJetArrName;};
+
+ // trigger on jet events
+ void SetTriggerOnLeadingJet(Bool_t triggerOnLeadingJet) {fLeadingJetOnly=triggerOnLeadingJet;};
+ Bool_t GetTriggerOnLeadingJet() const {return fLeadingJetOnly;}
+
+
+ // Array of D0 width for the Dstar
+ Bool_t SetD0WidthForDStar(Int_t nptbins,Float_t* width);
+
+ //Bool_t FillMCDJetInfo(AliPicoTrack *jetTrk,AliEmcalJet* jet, TClonesArray *mcArray,Double_t ptjet);
+ void FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet);
+ void FillHistogramsD0JetCorr(AliAODRecoDecayHF* candidate, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj, Double_t deltaR, AliAODEvent* aodEvent);
+
+ void FillHistogramsDstarJetCorr(AliAODRecoCascadeHF* dstar, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj,Double_t deltaR);
+ void FillHistogramsMCGenDJetCorr(Double_t dPhi, Double_t z,Double_t ptD,Double_t ptjet,Double_t deltaR);
+ void SideBandBackground(AliAODRecoCascadeHF *candDstar, AliEmcalJet *jet);
+ void MCBackground(AliAODRecoDecayHF *candbg, AliEmcalJet *jet);
+ void FillMassHistograms(Double_t mass,Double_t ptD, Double_t deltaR);
+ void FlagFlavour(AliVParticle* charm, AliEmcalJet* jet);
Int_t IsDzeroSideBand(AliAODRecoCascadeHF *candDstar);
-\r
- private:\r
- \r
- AliAnalysisTaskFlavourJetCorrelations(const AliAnalysisTaskFlavourJetCorrelations &source);\r
- AliAnalysisTaskFlavourJetCorrelations& operator=(const AliAnalysisTaskFlavourJetCorrelations& source); \r
-\r
- Double_t Z(AliVParticle* part,AliEmcalJet* jet) const;\r
- Float_t DeltaR(AliVParticle *p1, AliVParticle *p2) const;\r
-\r
-\r
- Bool_t fUseMCInfo; // Use MC info\r
- Bool_t fUseReco; // use reconstructed tracks when running on MC\r
- Int_t fCandidateType; // Dstar or D0\r
- Int_t fPDGmother; // PDG code of D meson\r
- Int_t fNProngs; // number of prong of the decay channel \r
- Int_t fPDGdaughters[4]; // PDG codes of daughters\r
- Float_t fSigmaD0[30]; //\r
- TString fBranchName; // AOD branch name\r
- TList *fmyOutput; //! user output\r
- AliRDHFCuts *fCuts; // Cuts \r
-\r
- Double_t fMinMass; // mass lower limit histogram\r
- Double_t fMaxMass; // mass upper limit histogram\r
-\r
- TString fJetArrName; // name of the jet array, taken from the task running the jet finder\r
- TString fCandArrName; // string which correspond to the candidate type\r
- Bool_t fLeadingJetOnly; // use only the leading jet in the event to make the correlations\r
- Double_t fJetRadius; // jet radius (filled from the JetContainer)\r
-\r
- ClassDef(AliAnalysisTaskFlavourJetCorrelations,2); // class for charm-jet correlations\r
-};\r
-\r
-#endif\r
+
+ private:
+
+ AliAnalysisTaskFlavourJetCorrelations(const AliAnalysisTaskFlavourJetCorrelations &source);
+ AliAnalysisTaskFlavourJetCorrelations& operator=(const AliAnalysisTaskFlavourJetCorrelations& source);
+
+ Double_t Z(AliVParticle* part,AliEmcalJet* jet) const;
+ Float_t DeltaR(AliVParticle *p1, AliVParticle *p2) const;
+
+
+ Bool_t fUseMCInfo; // Use MC info
+ Bool_t fUseReco; // use reconstructed tracks when running on MC
+ Int_t fCandidateType; // Dstar or D0
+ Int_t fPDGmother; // PDG code of D meson
+ Int_t fNProngs; // number of prong of the decay channel
+ Int_t fPDGdaughters[4]; // PDG codes of daughters
+ Float_t fSigmaD0[30]; //
+ TString fBranchName; // AOD branch name
+ TList *fmyOutput; //! user output
+ AliRDHFCuts *fCuts; // Cuts
+
+ Double_t fMinMass; // mass lower limit histogram
+ Double_t fMaxMass; // mass upper limit histogram
+
+ TString fJetArrName; // name of the jet array, taken from the task running the jet finder
+ TString fCandArrName; // string which correspond to the candidate type
+ Bool_t fLeadingJetOnly; // use only the leading jet in the event to make the correlations
+ Double_t fJetRadius; // jet radius (filled from the JetContainer)
+
+ ClassDef(AliAnalysisTaskFlavourJetCorrelations,2); // class for charm-jet correlations
+};
+
+#endif
-/**************************************************************************\r
-* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-//\r
-//\r
-// Task for selecting D mesons to be used as an input for D-Jet correlations\r
-//\r
-//-----------------------------------------------------------------------\r
-// Authors:\r
-// C. Bianchin (Utrecht University) chiara.bianchin@cern.ch\r
-// A.Grelli (Utrecht University) a.grelli@uu.nl\r
-// Xiaoming Zhang (LBNL) XMZhang@lbl.gov\r
-//-----------------------------------------------------------------------\r
-\r
-#include <TDatabasePDG.h>\r
-#include <TParticle.h>\r
-#include <TVector3.h>\r
-#include "TROOT.h"\r
-#include <TH3F.h>\r
-\r
-#include "AliRDHFCutsDStartoKpipi.h"\r
-#include "AliRDHFCutsD0toKpi.h"\r
-#include "AliAODMCHeader.h"\r
-#include "AliAODHandler.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliLog.h"\r
-#include "AliAODVertex.h"\r
-#include "AliAODRecoDecay.h"\r
-#include "AliAODRecoCascadeHF.h"\r
-#include "AliAODRecoDecayHF2Prong.h"\r
-#include "AliESDtrack.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliAnalysisTaskSEDmesonsFilterCJ.h"\r
-\r
-ClassImp(AliAnalysisTaskSEDmesonsFilterCJ)\r
-\r
-//_______________________________________________________________________________\r
-\r
-AliAnalysisTaskSEDmesonsFilterCJ::AliAnalysisTaskSEDmesonsFilterCJ() :\r
-AliAnalysisTaskSE(),\r
-fUseMCInfo(kFALSE),\r
-fUseReco(kTRUE),\r
-fCandidateType(0),\r
-fCandidateName(""),\r
-fPDGmother(0),\r
-fNProngs(0),\r
-fBranchName(""),\r
-fOutput(0),\r
-fCuts(0),\r
-fMinMass(0.),\r
-fMaxMass(0.),\r
-fCandidateArray(0)\r
-\r
-{\r
- //\r
- // Default constructor\r
- //\r
- \r
- for (Int_t i=4; i--;) fPDGdaughters[i] = 0;\r
- for (Int_t i=30; i--;) fSigmaD0[i] = 0.;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-AliAnalysisTaskSEDmesonsFilterCJ::AliAnalysisTaskSEDmesonsFilterCJ(const char *name, AliRDHFCuts *cuts, ECandidateType candtype) :\r
-AliAnalysisTaskSE(name),\r
-fUseMCInfo(kFALSE),\r
-fUseReco(kTRUE),\r
-fCandidateType(candtype),\r
-fCandidateName(""),\r
-fPDGmother(0),\r
-fNProngs(0),\r
-fBranchName(""),\r
-fOutput(0),\r
-fCuts(cuts),\r
-fMinMass(0.),\r
-fMaxMass(0.),\r
-fCandidateArray(0)\r
-{\r
- //\r
- // Constructor. Initialization of Inputs and Outputs\r
- //\r
- \r
- Info("AliAnalysisTaskSEDmesonsFilterCJ","Calling Constructor");\r
- \r
- for (Int_t i=4; i--;) fPDGdaughters[i] = 0;\r
- for (Int_t i=30; i--;) fSigmaD0[i] = 0.;\r
- \r
- const Int_t nptbins = fCuts->GetNPtBins();\r
- Float_t defaultSigmaD013[13] = { 0.012, 0.012, 0.012, 0.015, 0.015, 0.018, 0.018, 0.020, 0.020, 0.030, 0.030, 0.037, 0.040 };\r
- \r
- switch (fCandidateType) {\r
- case 0 :\r
- fCandidateName = "D0";\r
- fPDGmother = 421;\r
- fNProngs = 2;\r
- fPDGdaughters[0] = 211; // pi \r
- fPDGdaughters[1] = 321; // K\r
- fPDGdaughters[2] = 0; // empty\r
- fPDGdaughters[3] = 0; // empty\r
- fBranchName = "D0toKpi";\r
- break;\r
- case 1 :\r
- fCandidateName = "Dstar";\r
- fPDGmother = 413;\r
- fNProngs = 3;\r
- fPDGdaughters[1] = 211; // pi soft\r
- fPDGdaughters[0] = 421; // D0\r
- fPDGdaughters[2] = 211; // pi fromD0\r
- fPDGdaughters[3] = 321; // K from D0\r
- fBranchName = "Dstar";\r
- \r
- if (nptbins<=13) {\r
- for (Int_t ipt=0; ipt<nptbins;ipt++) fSigmaD0[ipt] = defaultSigmaD013[ipt];\r
- } else {\r
- AliFatal(Form("Default sigma D0 not enough for %d pt bins, use SetSigmaD0ForDStar to set them",nptbins));\r
- }\r
- break;\r
- default :\r
- printf("%d not accepted!!\n",fCandidateType);\r
- break;\r
- }\r
- \r
- if (fCandidateType==kD0toKpi) SetMassLimits(0.15, fPDGmother);\r
- if (fCandidateType==kDstartoKpipi) SetMassLimits(0.015, fPDGmother);\r
- \r
- DefineOutput(1, TList::Class()); // histos\r
- DefineOutput(2, AliRDHFCuts::Class()); // my cuts\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-AliAnalysisTaskSEDmesonsFilterCJ::~AliAnalysisTaskSEDmesonsFilterCJ()\r
-{\r
- //\r
- // destructor\r
- //\r
- \r
- Info("~AliAnalysisTaskSEDmesonsFilterCJ","Calling Destructor"); \r
- \r
- if (fOutput) { delete fOutput; fOutput = 0; }\r
- if (fCuts) { delete fCuts; fCuts = 0; }\r
- if (fCandidateArray) { delete fCandidateArray; fCandidateArray = 0; }\r
- \r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-void AliAnalysisTaskSEDmesonsFilterCJ::Init()\r
-{\r
- //\r
- // Initialization\r
- //\r
- \r
- if(fDebug>1) printf("AnalysisTaskSEDmesonsForJetCorrelations::Init() \n");\r
- \r
- switch (fCandidateType) {\r
- case 0: {\r
- AliRDHFCutsD0toKpi* copyfCutsDzero = new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));\r
- copyfCutsDzero->SetName("AnalysisCutsDzero");\r
- PostData(2, copyfCutsDzero); // Post the data\r
- } break;\r
-case 1: {\r
- AliRDHFCutsDStartoKpipi* copyfCutsDstar = new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));\r
- copyfCutsDstar->SetName("AnalysisCutsDStar");\r
- PostData(2, copyfCutsDstar); // Post the cuts\r
-} break;\r
-default: return;\r
- }\r
- \r
- return;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-void AliAnalysisTaskSEDmesonsFilterCJ::UserCreateOutputObjects()\r
-{ \r
- //\r
- // output \r
- //\r
- \r
- Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());\r
- \r
- fOutput = new TList(); fOutput->SetOwner();\r
- DefineHistoForAnalysis(); // define histograms\r
- \r
- fCandidateArray = new TClonesArray("AliAODRecoDecayHF",0);\r
- fCandidateArray->SetName(Form("fCandidateArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen"));\r
- \r
- if (fCandidateType==kDstartoKpipi){\r
- fSideBandArray = new TClonesArray("AliAODRecoCascadeHF",0); //this is for the DStar only!\r
- fSideBandArray->SetName(Form("fSideBandArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen"));\r
- }\r
- \r
- PostData(1, fOutput);\r
- return;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *){\r
- //\r
- // user exec\r
- //\r
- \r
- // add cadidate branch\r
- fCandidateArray->Delete();\r
- if (!(InputEvent()->FindListObject(Form("fCandidateArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen")))) InputEvent()->AddObject(fCandidateArray);\r
- if (fCandidateType==kDstartoKpipi){\r
- fSideBandArray->Delete();\r
- if (!(InputEvent()->FindListObject(Form("fSideBandArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen")))) InputEvent()->AddObject(fSideBandArray);\r
- }\r
- //Printf("Arr names %s, %s",fCandidateArray->GetName(),fSideBandArray->GetName());\r
- // Load the event\r
- AliAODEvent *aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);\r
- \r
- TClonesArray *arrayDStartoD0pi = 0;\r
- if (!aodEvent && AODEvent() && IsStandardAOD()) {\r
- \r
- // In case there is an AOD handler writing a standard AOD, use the AOD \r
- // event in memory rather than the input (ESD) event. \r
- aodEvent = dynamic_cast<AliAODEvent*>(AODEvent());\r
- \r
- // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)\r
- // have to taken from the AOD event hold by the AliAODExtension\r
- AliAODHandler *aodHandler = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());\r
- if(aodHandler->GetExtensions()) {\r
- AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");\r
- AliAODEvent *aodFromExt = ext->GetAOD();\r
- arrayDStartoD0pi = (TClonesArray*)aodFromExt->GetList()->FindObject(fBranchName.Data());\r
- }\r
- } else {\r
- arrayDStartoD0pi = (TClonesArray*)aodEvent->GetList()->FindObject(fBranchName.Data());\r
- }\r
- \r
- if (!arrayDStartoD0pi) {\r
- AliInfo(Form("Could not find array %s, skipping the event",fBranchName.Data()));\r
- return;\r
- } else {\r
- AliDebug(2, Form("Found %d vertices",arrayDStartoD0pi->GetEntriesFast())); \r
- }\r
- \r
- TClonesArray* mcArray = 0x0;\r
- if (fUseMCInfo) {\r
- mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));\r
- if (!mcArray) {\r
- printf("AliAnalysisTaskSEDStarSpectra::UserExec: MC particles not found!\n");\r
- return;\r
- }\r
- }\r
- \r
- //Histograms\r
- TH1I* hstat = (TH1I*)fOutput->FindObject("hstat");\r
- TH1F* hnSBCandEv=(TH1F*)fOutput->FindObject("hnSBCandEv");\r
- TH1F* hnCandEv=(TH1F*)fOutput->FindObject("hnCandEv");\r
- TH2F* hInvMassptD = (TH2F*)fOutput->FindObject("hInvMassptD");\r
- \r
- TH1F* hPtPion=0x0;\r
- if (fCandidateType==kDstartoKpipi) hPtPion = (TH1F*)fOutput->FindObject("hPtPion");\r
- hstat->Fill(0);\r
- \r
- // fix for temporary bug in ESDfilter \r
- // the AODs with null vertex pointer didn't pass the PhysSel\r
- if(!aodEvent->GetPrimaryVertex() || TMath::Abs(aodEvent->GetMagneticField())<0.001) return;\r
- \r
- //Event selection\r
- Bool_t iseventselected=fCuts->IsEventSelected(aodEvent);\r
- //TString firedTriggerClasses=((AliAODEvent*)aodEvent)->GetFiredTriggerClasses();\r
- if (!iseventselected) return;\r
- hstat->Fill(1);\r
- \r
- const Int_t nD = arrayDStartoD0pi->GetEntriesFast();\r
- if(fUseReco) hstat->Fill(2, nD);\r
- \r
- //D* and D0 prongs needed to MatchToMC method\r
- Int_t pdgDgDStartoD0pi[2] = { 421, 211 }; // D0,pi\r
- Int_t pdgDgD0toKpi[2] = { 321, 211 }; // K, pi\r
- \r
- //D0 from D0 bar\r
- Int_t pdgdaughtersD0[2] = { 211, 321 }; // pi,K \r
- Int_t pdgdaughtersD0bar[2] = { 321, 211 }; // K,pi \r
- \r
- Int_t iCand =0;\r
- Int_t iSBCand=0;\r
- Int_t isSelected = 0;\r
- AliAODRecoDecayHF *charmCand = 0;\r
- AliAODMCParticle *charmPart = 0;\r
- Bool_t isMCBkg=kFALSE;\r
- \r
- Double_t mPDGD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();\r
- \r
- Int_t mcLabel = -9999;\r
- Int_t pdgMeson = 413;\r
- if (fCandidateType==kD0toKpi) pdgMeson = 421;\r
- \r
- for (Int_t icharm=0; icharm<nD; icharm++) { //loop over D candidates\r
- charmCand = (AliAODRecoDecayHF*)arrayDStartoD0pi->At(icharm); // D candidates\r
- if (!charmCand) continue;\r
- \r
- \r
- if (fUseMCInfo) { // Look in MC, try to simulate the z\r
- if (fCandidateType==kDstartoKpipi) {\r
- AliAODRecoCascadeHF *temp = (AliAODRecoCascadeHF*)charmCand;\r
- mcLabel = temp->MatchToMC(413,421,pdgDgDStartoD0pi,pdgDgD0toKpi,mcArray);\r
- }\r
- \r
- if (fCandidateType==kD0toKpi) \r
- mcLabel = charmCand->MatchToMC(421,mcArray,fNProngs,fPDGdaughters);\r
- \r
- if (mcLabel<=0) isMCBkg=kTRUE;\r
- else hstat->Fill(2);\r
- if (!isMCBkg) charmPart=(AliAODMCParticle*)mcArray->At(mcLabel);\r
- }\r
- \r
- Double_t ptD = charmCand->Pt();\r
- \r
- // region of interest + cuts\r
- if (!fCuts->IsInFiducialAcceptance(ptD,charmCand->Y(pdgMeson))) continue; \r
- \r
- if(!fUseMCInfo && fCandidateType==kDstartoKpipi){\r
- //select by track cuts the side band candidates (don't want mass cut)\r
- isSelected = fCuts->IsSelected(charmCand,AliRDHFCuts::kTracks,aodEvent); \r
- if (!isSelected) continue;\r
- //add a reasonable cut on the invariant mass (e.g. (+-2\sigma, +-10 \sigma), with \sigma = fSigmaD0[bin])\r
- Int_t bin = fCuts->PtBin(ptD);\r
- if(bin<0 || bin>=fCuts->GetNPtBins()) {\r
- AliError(Form("Pt %.3f out of bounds",ptD));\r
- continue;\r
- }\r
- AliAODRecoCascadeHF *temp = (AliAODRecoCascadeHF*)charmCand;\r
- //if data and Dstar from D0 side band\r
- if (((temp->InvMassD0()<=(mPDGD0-3.*fSigmaD0[bin])) && (temp->InvMassD0()>(mPDGD0-10.*fSigmaD0[bin]))) /*left side band*/|| ((temp->InvMassD0()>=(mPDGD0+3.*fSigmaD0[bin])) && (temp->InvMassD0()<(mPDGD0+10.*fSigmaD0[bin])))/*right side band*/){ \r
- \r
- new ((*fSideBandArray)[iSBCand]) AliAODRecoCascadeHF(*temp);\r
- iSBCand++;\r
- }\r
- }\r
- //candidate selected by cuts and PID\r
- isSelected = fCuts->IsSelected(charmCand,AliRDHFCuts::kAll,aodEvent); //selected\r
- if (!isSelected) continue;\r
- \r
- //for data and MC signal fill fCandidateArray\r
- if(!fUseMCInfo || (fUseMCInfo && !isMCBkg)){\r
- // for data or MC with the requirement fUseReco fill with candidates\r
- if(fUseReco) {\r
- new ((*fCandidateArray)[iCand]) AliAODRecoDecayHF(*charmCand);\r
- //Printf("Filling reco");\r
- hstat->Fill(3);\r
- }\r
- // for MC with requirement particle level fill with AliAODMCParticle\r
- else if (fUseMCInfo) {\r
- new ((*fCandidateArray)[iCand]) AliAODMCParticle(*charmPart);\r
- //Printf("Filling gen");\r
- hstat->Fill(3);\r
- }\r
- \r
- iCand++; \r
- }\r
- //for MC background fill fSideBandArray (which is instead filled above for DStar in case of data for the side bands candidates)\r
- else if(fUseReco){\r
- new ((*fSideBandArray)[iSBCand]) AliAODRecoDecayHF(*charmCand);\r
- iSBCand++;\r
- }\r
- \r
- \r
- Double_t masses[2];\r
- if (fCandidateType==kDstartoKpipi) { //D*->D0pi->Kpipi\r
- \r
- //softpion from D* decay\r
- AliAODRecoCascadeHF *temp = (AliAODRecoCascadeHF*)charmCand;\r
- AliAODTrack *track2 = (AliAODTrack*)temp->GetBachelor(); \r
- \r
- // select D* in the D0 window.\r
- // In the cut object window is loose to allow for side bands\r
- \r
- \r
- // retrieve the corresponding pt bin for the candidate\r
- // and set the expected D0 width (x3)\r
- // static const Int_t n = fCuts->GetNPtBins();\r
- Int_t bin = fCuts->PtBin(ptD);\r
- if(bin<0 || bin>=fCuts->GetNPtBins()) {\r
- AliError(Form("Pt %.3f out of bounds",ptD));\r
- continue;\r
- }\r
- \r
- AliInfo(Form("Pt bin %d and sigma D0 %.4f",bin,fSigmaD0[bin]));\r
- //consider the Dstar candidates only if the mass of the D0 is in 3 sigma wrt the PDG value\r
- if ((temp->InvMassD0()>=(mPDGD0-3.*fSigmaD0[bin])) && (temp->InvMassD0()<=(mPDGD0+3.*fSigmaD0[bin]))) { \r
- masses[0] = temp->DeltaInvMass(); //D*\r
- masses[1] = 0.; //dummy for D*\r
- \r
- //D* delta mass\r
- hInvMassptD->Fill(masses[0], ptD); // 2 D slice for pt bins\r
- \r
- // D* pt and soft pion pt for good candidates \r
- Double_t mPDGDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();\r
- Double_t invmassDelta = temp->DeltaInvMass();\r
- if (TMath::Abs(invmassDelta-(mPDGDstar-mPDGD0))<0.0021) hPtPion->Fill(track2->Pt());\r
- }\r
- } //Dstar specific\r
- \r
- if (fCandidateType==kD0toKpi) { //D0->Kpi\r
- \r
- //needed quantities\r
- masses[0] = charmCand->InvMass(fNProngs, (UInt_t*)pdgdaughtersD0); //D0\r
- masses[1] = charmCand->InvMass(fNProngs, (UInt_t*)pdgdaughtersD0bar); //D0bar\r
- hstat->Fill(3);\r
- \r
- // mass vs pt\r
- if (isSelected==1 || isSelected==3) hInvMassptD->Fill(masses[0],ptD);\r
- if (isSelected>=2) hInvMassptD->Fill(masses[1],ptD);\r
- } //D0 specific\r
- \r
- charmCand = 0;\r
- isMCBkg=kFALSE;\r
- } // end of D cand loop\r
- \r
- hnCandEv->Fill(fCandidateArray->GetEntriesFast());\r
- if (fCandidateType==kDstartoKpipi || fUseMCInfo) {\r
- Int_t nsbcand=fSideBandArray->GetEntriesFast();\r
- hstat->Fill(4,nsbcand);\r
- hnSBCandEv->Fill(nsbcand);\r
- }\r
- \r
- return;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-void AliAnalysisTaskSEDmesonsFilterCJ::Terminate(Option_t*)\r
-{\r
- // The Terminate() function is the last function to be called during\r
- // a query. It always runs on the client, it can be used to present\r
- // the results graphically or save the results to file.\r
- \r
- Info("Terminate"," terminate");\r
- AliAnalysisTaskSE::Terminate();\r
- \r
- fOutput = dynamic_cast<TList*>(GetOutputData(1));\r
- if (!fOutput) {\r
- printf("ERROR: fOutput not available\n");\r
- return;\r
- }\r
- \r
- return;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-void AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits(Double_t range, Int_t pdg)\r
-{\r
- //\r
- // AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits\r
- //\r
- \r
- Float_t mass = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg))->Mass();\r
- \r
- // compute the Delta mass for the D*\r
- if (fCandidateType==kDstartoKpipi) mass -= TDatabasePDG::Instance()->GetParticle(421)->Mass();\r
- \r
- \r
- fMinMass = mass - range;\r
- fMaxMass = mass + range;\r
- \r
- AliInfo(Form("Setting mass limits to %f, %f",fMinMass,fMaxMass));\r
- if ((fMinMass<0.) || (fMaxMass<=0.) || (fMaxMass<fMinMass)) AliFatal("Wrong mass limits!\n");\r
- \r
- return;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-void AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits(Double_t lowlimit, Double_t uplimit)\r
-{\r
- //\r
- // AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits\r
- //\r
- \r
- if (uplimit>lowlimit) {\r
- fMinMass = lowlimit;\r
- fMaxMass = uplimit;\r
- } else {\r
- printf("Error! Lower limit larger than upper limit!\n");\r
- fMinMass = uplimit - uplimit*0.2;\r
- fMaxMass = uplimit;\r
- }\r
- \r
- return;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-Bool_t AliAnalysisTaskSEDmesonsFilterCJ::SetD0WidthForDStar(Int_t nptbins, Float_t *width)\r
-{\r
- //\r
- // AliAnalysisTaskSEDmesonsFilterCJ::SetD0WidthForDStar\r
- //\r
- \r
- if (nptbins>30) {\r
- AliInfo("Maximum number of bins allowed is 30!");\r
- return kFALSE;\r
- }\r
- \r
- if (!width) return kFALSE;\r
- for (Int_t ipt=0; ipt<nptbins; ipt++) fSigmaD0[ipt]=width[ipt];\r
- \r
- return kTRUE;\r
-}\r
-\r
-//_______________________________________________________________________________\r
-\r
-Bool_t AliAnalysisTaskSEDmesonsFilterCJ::DefineHistoForAnalysis()\r
-{\r
- //\r
- // AliAnalysisTaskSEDmesonsFilterCJ::DefineHistoForAnalysis\r
- //\r
- \r
- // Statistics \r
- TH1I* hstat = new TH1I("hstat","Statistics",5,-0.5,4.5);\r
- hstat->GetXaxis()->SetBinLabel(1, "N ev anal");\r
- hstat->GetXaxis()->SetBinLabel(2, "N ev sel");\r
- if(fUseReco) hstat->GetXaxis()->SetBinLabel(3, "N cand");\r
- else hstat->GetXaxis()->SetBinLabel(3, "N Gen D");\r
- hstat->GetXaxis()->SetBinLabel(4, "N cand sel cuts");\r
- if (fCandidateType==kDstartoKpipi) hstat->GetXaxis()->SetBinLabel(5, "N side band cand"); \r
- hstat->SetNdivisions(1);\r
- fOutput->Add(hstat);\r
- \r
- TH1F* hnCandEv=new TH1F("hnCandEv", "Number of candidates per event (after cuts);# cand/ev", 100, 0.,100.);\r
- fOutput->Add(hnCandEv);\r
- \r
- // Invariant mass related histograms\r
- const Int_t nbinsmass = 200;\r
- TH2F *hInvMass = new TH2F("hInvMassptD", "D invariant mass distribution", nbinsmass, fMinMass, fMaxMass, 100, 0., 50.);\r
- hInvMass->SetStats(kTRUE);\r
- hInvMass->GetXaxis()->SetTitle("mass (GeV/c)");\r
- hInvMass->GetYaxis()->SetTitle("p_{T} (GeV/c)");\r
- fOutput->Add(hInvMass);\r
- \r
- if (fCandidateType==kDstartoKpipi) {\r
- TH1F* hnSBCandEv=new TH1F("hnSBCandEv", "Number of side bands candidates per event (after cuts);# cand/ev", 100, 0.,100.);\r
- fOutput->Add(hnSBCandEv);\r
- \r
- TH1F* hPtPion = new TH1F("hPtPion", "Primary pions candidates pt", 500, 0., 10.);\r
- hPtPion->SetStats(kTRUE);\r
- hPtPion->GetXaxis()->SetTitle("p_{T} (GeV/c)");\r
- hPtPion->GetYaxis()->SetTitle("entries");\r
- fOutput->Add(hPtPion);\r
- }\r
- \r
- return kTRUE; \r
-}\r
+/**************************************************************************
+* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+//
+//
+// Task for selecting D mesons to be used as an input for D-Jet correlations
+//
+//-----------------------------------------------------------------------
+// Authors:
+// C. Bianchin (Utrecht University) chiara.bianchin@cern.ch
+// A.Grelli (Utrecht University) a.grelli@uu.nl
+// Xiaoming Zhang (LBNL) XMZhang@lbl.gov
+//-----------------------------------------------------------------------
+
+#include <TDatabasePDG.h>
+#include <TParticle.h>
+#include <TVector3.h>
+#include "TROOT.h"
+#include <TH3F.h>
+
+#include "AliRDHFCutsDStartoKpipi.h"
+#include "AliRDHFCutsD0toKpi.h"
+#include "AliAODMCHeader.h"
+#include "AliAODHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliLog.h"
+#include "AliAODVertex.h"
+#include "AliAODRecoDecay.h"
+#include "AliAODRecoCascadeHF.h"
+#include "AliAODRecoDecayHF2Prong.h"
+#include "AliESDtrack.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisTaskSEDmesonsFilterCJ.h"
+
+ClassImp(AliAnalysisTaskSEDmesonsFilterCJ)
+
+//_______________________________________________________________________________
+
+AliAnalysisTaskSEDmesonsFilterCJ::AliAnalysisTaskSEDmesonsFilterCJ() :
+AliAnalysisTaskSE(),
+fUseMCInfo(kFALSE),
+fUseReco(kTRUE),
+fCandidateType(0),
+fCandidateName(""),
+fPDGmother(0),
+fNProngs(0),
+fBranchName(""),
+fOutput(0),
+fCuts(0),
+fMinMass(0.),
+fMaxMass(0.),
+fCandidateArray(0)
+
+{
+ //
+ // Default constructor
+ //
+
+ for (Int_t i=4; i--;) fPDGdaughters[i] = 0;
+ for (Int_t i=30; i--;) fSigmaD0[i] = 0.;
+}
+
+//_______________________________________________________________________________
+
+AliAnalysisTaskSEDmesonsFilterCJ::AliAnalysisTaskSEDmesonsFilterCJ(const char *name, AliRDHFCuts *cuts, ECandidateType candtype) :
+AliAnalysisTaskSE(name),
+fUseMCInfo(kFALSE),
+fUseReco(kTRUE),
+fCandidateType(candtype),
+fCandidateName(""),
+fPDGmother(0),
+fNProngs(0),
+fBranchName(""),
+fOutput(0),
+fCuts(cuts),
+fMinMass(0.),
+fMaxMass(0.),
+fCandidateArray(0)
+{
+ //
+ // Constructor. Initialization of Inputs and Outputs
+ //
+
+ Info("AliAnalysisTaskSEDmesonsFilterCJ","Calling Constructor");
+
+ for (Int_t i=4; i--;) fPDGdaughters[i] = 0;
+ for (Int_t i=30; i--;) fSigmaD0[i] = 0.;
+
+ const Int_t nptbins = fCuts->GetNPtBins();
+ Float_t defaultSigmaD013[13] = { 0.012, 0.012, 0.012, 0.015, 0.015, 0.018, 0.018, 0.020, 0.020, 0.030, 0.030, 0.037, 0.040 };
+
+ switch (fCandidateType) {
+ case 0 :
+ fCandidateName = "D0";
+ fPDGmother = 421;
+ fNProngs = 2;
+ fPDGdaughters[0] = 211; // pi
+ fPDGdaughters[1] = 321; // K
+ fPDGdaughters[2] = 0; // empty
+ fPDGdaughters[3] = 0; // empty
+ fBranchName = "D0toKpi";
+ break;
+ case 1 :
+ fCandidateName = "Dstar";
+ fPDGmother = 413;
+ fNProngs = 3;
+ fPDGdaughters[1] = 211; // pi soft
+ fPDGdaughters[0] = 421; // D0
+ fPDGdaughters[2] = 211; // pi fromD0
+ fPDGdaughters[3] = 321; // K from D0
+ fBranchName = "Dstar";
+
+ if (nptbins<=13) {
+ for (Int_t ipt=0; ipt<nptbins;ipt++) fSigmaD0[ipt] = defaultSigmaD013[ipt];
+ } else {
+ AliFatal(Form("Default sigma D0 not enough for %d pt bins, use SetSigmaD0ForDStar to set them",nptbins));
+ }
+ break;
+ default :
+ printf("%d not accepted!!\n",fCandidateType);
+ break;
+ }
+
+ if (fCandidateType==kD0toKpi) SetMassLimits(0.15, fPDGmother);
+ if (fCandidateType==kDstartoKpipi) SetMassLimits(0.015, fPDGmother);
+
+ DefineOutput(1, TList::Class()); // histos
+ DefineOutput(2, AliRDHFCuts::Class()); // my cuts
+}
+
+//_______________________________________________________________________________
+
+AliAnalysisTaskSEDmesonsFilterCJ::~AliAnalysisTaskSEDmesonsFilterCJ()
+{
+ //
+ // destructor
+ //
+
+ Info("~AliAnalysisTaskSEDmesonsFilterCJ","Calling Destructor");
+
+ if (fOutput) { delete fOutput; fOutput = 0; }
+ if (fCuts) { delete fCuts; fCuts = 0; }
+ if (fCandidateArray) { delete fCandidateArray; fCandidateArray = 0; }
+
+}
+
+//_______________________________________________________________________________
+
+void AliAnalysisTaskSEDmesonsFilterCJ::Init()
+{
+ //
+ // Initialization
+ //
+
+ if(fDebug>1) printf("AnalysisTaskSEDmesonsForJetCorrelations::Init() \n");
+
+ switch (fCandidateType) {
+ case 0: {
+ AliRDHFCutsD0toKpi* copyfCutsDzero = new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
+ copyfCutsDzero->SetName("AnalysisCutsDzero");
+ PostData(2, copyfCutsDzero); // Post the data
+ } break;
+case 1: {
+ AliRDHFCutsDStartoKpipi* copyfCutsDstar = new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
+ copyfCutsDstar->SetName("AnalysisCutsDStar");
+ PostData(2, copyfCutsDstar); // Post the cuts
+} break;
+default: return;
+ }
+
+ return;
+}
+
+//_______________________________________________________________________________
+
+void AliAnalysisTaskSEDmesonsFilterCJ::UserCreateOutputObjects()
+{
+ //
+ // output
+ //
+
+ Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
+
+ fOutput = new TList(); fOutput->SetOwner();
+ DefineHistoForAnalysis(); // define histograms
+
+ fCandidateArray = new TClonesArray("AliAODRecoDecayHF",0);
+ fCandidateArray->SetName(Form("fCandidateArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen"));
+
+ if (fCandidateType==kDstartoKpipi){
+ fSideBandArray = new TClonesArray("AliAODRecoCascadeHF",0); //this is for the DStar only!
+ fSideBandArray->SetName(Form("fSideBandArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen"));
+ }
+
+ PostData(1, fOutput);
+ return;
+}
+
+//_______________________________________________________________________________
+
+void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *){
+ //
+ // user exec
+ //
+
+ // add cadidate branch
+ fCandidateArray->Delete();
+ if (!(InputEvent()->FindListObject(Form("fCandidateArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen")))) InputEvent()->AddObject(fCandidateArray);
+ if (fCandidateType==kDstartoKpipi){
+ fSideBandArray->Delete();
+ if (!(InputEvent()->FindListObject(Form("fSideBandArray%s%s",fCandidateName.Data(),fUseReco ? "rec" : "gen")))) InputEvent()->AddObject(fSideBandArray);
+ }
+ //Printf("Arr names %s, %s",fCandidateArray->GetName(),fSideBandArray->GetName());
+ // Load the event
+ AliAODEvent *aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
+
+ TClonesArray *arrayDStartoD0pi = 0;
+ if (!aodEvent && AODEvent() && IsStandardAOD()) {
+
+ // In case there is an AOD handler writing a standard AOD, use the AOD
+ // event in memory rather than the input (ESD) event.
+ aodEvent = dynamic_cast<AliAODEvent*>(AODEvent());
+
+ // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
+ // have to taken from the AOD event hold by the AliAODExtension
+ AliAODHandler *aodHandler = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
+ if(aodHandler->GetExtensions()) {
+ AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
+ AliAODEvent *aodFromExt = ext->GetAOD();
+ arrayDStartoD0pi = (TClonesArray*)aodFromExt->GetList()->FindObject(fBranchName.Data());
+ }
+ } else {
+ arrayDStartoD0pi = (TClonesArray*)aodEvent->GetList()->FindObject(fBranchName.Data());
+ }
+
+ if (!arrayDStartoD0pi) {
+ AliInfo(Form("Could not find array %s, skipping the event",fBranchName.Data()));
+ return;
+ } else {
+ AliDebug(2, Form("Found %d vertices",arrayDStartoD0pi->GetEntriesFast()));
+ }
+
+ TClonesArray* mcArray = 0x0;
+ if (fUseMCInfo) {
+ mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+ if (!mcArray) {
+ printf("AliAnalysisTaskSEDStarSpectra::UserExec: MC particles not found!\n");
+ return;
+ }
+ }
+
+ //Histograms
+ TH1I* hstat = (TH1I*)fOutput->FindObject("hstat");
+ TH1F* hnSBCandEv=(TH1F*)fOutput->FindObject("hnSBCandEv");
+ TH1F* hnCandEv=(TH1F*)fOutput->FindObject("hnCandEv");
+ TH2F* hInvMassptD = (TH2F*)fOutput->FindObject("hInvMassptD");
+
+ TH1F* hPtPion=0x0;
+ if (fCandidateType==kDstartoKpipi) hPtPion = (TH1F*)fOutput->FindObject("hPtPion");
+ hstat->Fill(0);
+
+ // fix for temporary bug in ESDfilter
+ // the AODs with null vertex pointer didn't pass the PhysSel
+ if(!aodEvent->GetPrimaryVertex() || TMath::Abs(aodEvent->GetMagneticField())<0.001) return;
+
+ //Event selection
+ Bool_t iseventselected=fCuts->IsEventSelected(aodEvent);
+ //TString firedTriggerClasses=((AliAODEvent*)aodEvent)->GetFiredTriggerClasses();
+ if (!iseventselected) return;
+ hstat->Fill(1);
+
+ const Int_t nD = arrayDStartoD0pi->GetEntriesFast();
+ if(fUseReco) hstat->Fill(2, nD);
+
+ //D* and D0 prongs needed to MatchToMC method
+ Int_t pdgDgDStartoD0pi[2] = { 421, 211 }; // D0,pi
+ Int_t pdgDgD0toKpi[2] = { 321, 211 }; // K, pi
+
+ //D0 from D0 bar
+ Int_t pdgdaughtersD0[2] = { 211, 321 }; // pi,K
+ Int_t pdgdaughtersD0bar[2] = { 321, 211 }; // K,pi
+
+ Int_t iCand =0;
+ Int_t iSBCand=0;
+ Int_t isSelected = 0;
+ AliAODRecoDecayHF *charmCand = 0;
+ AliAODMCParticle *charmPart = 0;
+ Bool_t isMCBkg=kFALSE;
+
+ Double_t mPDGD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();
+
+ Int_t mcLabel = -9999;
+ Int_t pdgMeson = 413;
+ if (fCandidateType==kD0toKpi) pdgMeson = 421;
+
+ for (Int_t icharm=0; icharm<nD; icharm++) { //loop over D candidates
+ charmCand = (AliAODRecoDecayHF*)arrayDStartoD0pi->At(icharm); // D candidates
+ if (!charmCand) continue;
+
+
+ if (fUseMCInfo) { // Look in MC, try to simulate the z
+ if (fCandidateType==kDstartoKpipi) {
+ AliAODRecoCascadeHF *temp = (AliAODRecoCascadeHF*)charmCand;
+ mcLabel = temp->MatchToMC(413,421,pdgDgDStartoD0pi,pdgDgD0toKpi,mcArray);
+ }
+
+ if (fCandidateType==kD0toKpi)
+ mcLabel = charmCand->MatchToMC(421,mcArray,fNProngs,fPDGdaughters);
+
+ if (mcLabel<=0) isMCBkg=kTRUE;
+ else hstat->Fill(2);
+ if (!isMCBkg) charmPart=(AliAODMCParticle*)mcArray->At(mcLabel);
+ }
+
+ Double_t ptD = charmCand->Pt();
+
+ // region of interest + cuts
+ if (!fCuts->IsInFiducialAcceptance(ptD,charmCand->Y(pdgMeson))) continue;
+
+ if(!fUseMCInfo && fCandidateType==kDstartoKpipi){
+ //select by track cuts the side band candidates (don't want mass cut)
+ isSelected = fCuts->IsSelected(charmCand,AliRDHFCuts::kTracks,aodEvent);
+ if (!isSelected) continue;
+ //add a reasonable cut on the invariant mass (e.g. (+-2\sigma, +-10 \sigma), with \sigma = fSigmaD0[bin])
+ Int_t bin = fCuts->PtBin(ptD);
+ if(bin<0 || bin>=fCuts->GetNPtBins()) {
+ AliError(Form("Pt %.3f out of bounds",ptD));
+ continue;
+ }
+ AliAODRecoCascadeHF *temp = (AliAODRecoCascadeHF*)charmCand;
+ //if data and Dstar from D0 side band
+ if (((temp->InvMassD0()<=(mPDGD0-3.*fSigmaD0[bin])) && (temp->InvMassD0()>(mPDGD0-10.*fSigmaD0[bin]))) /*left side band*/|| ((temp->InvMassD0()>=(mPDGD0+3.*fSigmaD0[bin])) && (temp->InvMassD0()<(mPDGD0+10.*fSigmaD0[bin])))/*right side band*/){
+
+ new ((*fSideBandArray)[iSBCand]) AliAODRecoCascadeHF(*temp);
+ iSBCand++;
+ }
+ }
+ //candidate selected by cuts and PID
+ isSelected = fCuts->IsSelected(charmCand,AliRDHFCuts::kAll,aodEvent); //selected
+ if (!isSelected) continue;
+
+ //for data and MC signal fill fCandidateArray
+ if(!fUseMCInfo || (fUseMCInfo && !isMCBkg)){
+ // for data or MC with the requirement fUseReco fill with candidates
+ if(fUseReco) {
+ new ((*fCandidateArray)[iCand]) AliAODRecoDecayHF(*charmCand);
+ //Printf("Filling reco");
+ hstat->Fill(3);
+ }
+ // for MC with requirement particle level fill with AliAODMCParticle
+ else if (fUseMCInfo) {
+ new ((*fCandidateArray)[iCand]) AliAODMCParticle(*charmPart);
+ //Printf("Filling gen");
+ hstat->Fill(3);
+ }
+
+ iCand++;
+ }
+ //for MC background fill fSideBandArray (which is instead filled above for DStar in case of data for the side bands candidates)
+ else if(fUseReco){
+ new ((*fSideBandArray)[iSBCand]) AliAODRecoDecayHF(*charmCand);
+ iSBCand++;
+ }
+
+
+ Double_t masses[2];
+ if (fCandidateType==kDstartoKpipi) { //D*->D0pi->Kpipi
+
+ //softpion from D* decay
+ AliAODRecoCascadeHF *temp = (AliAODRecoCascadeHF*)charmCand;
+ AliAODTrack *track2 = (AliAODTrack*)temp->GetBachelor();
+
+ // select D* in the D0 window.
+ // In the cut object window is loose to allow for side bands
+
+
+ // retrieve the corresponding pt bin for the candidate
+ // and set the expected D0 width (x3)
+ // static const Int_t n = fCuts->GetNPtBins();
+ Int_t bin = fCuts->PtBin(ptD);
+ if(bin<0 || bin>=fCuts->GetNPtBins()) {
+ AliError(Form("Pt %.3f out of bounds",ptD));
+ continue;
+ }
+
+ AliInfo(Form("Pt bin %d and sigma D0 %.4f",bin,fSigmaD0[bin]));
+ //consider the Dstar candidates only if the mass of the D0 is in 3 sigma wrt the PDG value
+ if ((temp->InvMassD0()>=(mPDGD0-3.*fSigmaD0[bin])) && (temp->InvMassD0()<=(mPDGD0+3.*fSigmaD0[bin]))) {
+ masses[0] = temp->DeltaInvMass(); //D*
+ masses[1] = 0.; //dummy for D*
+
+ //D* delta mass
+ hInvMassptD->Fill(masses[0], ptD); // 2 D slice for pt bins
+
+ // D* pt and soft pion pt for good candidates
+ Double_t mPDGDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
+ Double_t invmassDelta = temp->DeltaInvMass();
+ if (TMath::Abs(invmassDelta-(mPDGDstar-mPDGD0))<0.0021) hPtPion->Fill(track2->Pt());
+ }
+ } //Dstar specific
+
+ if (fCandidateType==kD0toKpi) { //D0->Kpi
+
+ //needed quantities
+ masses[0] = charmCand->InvMass(fNProngs, (UInt_t*)pdgdaughtersD0); //D0
+ masses[1] = charmCand->InvMass(fNProngs, (UInt_t*)pdgdaughtersD0bar); //D0bar
+ hstat->Fill(3);
+
+ // mass vs pt
+ if (isSelected==1 || isSelected==3) hInvMassptD->Fill(masses[0],ptD);
+ if (isSelected>=2) hInvMassptD->Fill(masses[1],ptD);
+ } //D0 specific
+
+ charmCand = 0;
+ isMCBkg=kFALSE;
+ } // end of D cand loop
+
+ hnCandEv->Fill(fCandidateArray->GetEntriesFast());
+ if (fCandidateType==kDstartoKpipi || fUseMCInfo) {
+ Int_t nsbcand=fSideBandArray->GetEntriesFast();
+ hstat->Fill(4,nsbcand);
+ hnSBCandEv->Fill(nsbcand);
+ }
+
+ return;
+}
+
+//_______________________________________________________________________________
+
+void AliAnalysisTaskSEDmesonsFilterCJ::Terminate(Option_t*)
+{
+ // The Terminate() function is the last function to be called during
+ // a query. It always runs on the client, it can be used to present
+ // the results graphically or save the results to file.
+
+ Info("Terminate"," terminate");
+ AliAnalysisTaskSE::Terminate();
+
+ fOutput = dynamic_cast<TList*>(GetOutputData(1));
+ if (!fOutput) {
+ printf("ERROR: fOutput not available\n");
+ return;
+ }
+
+ return;
+}
+
+//_______________________________________________________________________________
+
+void AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits(Double_t range, Int_t pdg)
+{
+ //
+ // AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits
+ //
+
+ Float_t mass = TDatabasePDG::Instance()->GetParticle(TMath::Abs(pdg))->Mass();
+
+ // compute the Delta mass for the D*
+ if (fCandidateType==kDstartoKpipi) mass -= TDatabasePDG::Instance()->GetParticle(421)->Mass();
+
+
+ fMinMass = mass - range;
+ fMaxMass = mass + range;
+
+ AliInfo(Form("Setting mass limits to %f, %f",fMinMass,fMaxMass));
+ if ((fMinMass<0.) || (fMaxMass<=0.) || (fMaxMass<fMinMass)) AliFatal("Wrong mass limits!\n");
+
+ return;
+}
+
+//_______________________________________________________________________________
+
+void AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits(Double_t lowlimit, Double_t uplimit)
+{
+ //
+ // AliAnalysisTaskSEDmesonsFilterCJ::SetMassLimits
+ //
+
+ if (uplimit>lowlimit) {
+ fMinMass = lowlimit;
+ fMaxMass = uplimit;
+ } else {
+ printf("Error! Lower limit larger than upper limit!\n");
+ fMinMass = uplimit - uplimit*0.2;
+ fMaxMass = uplimit;
+ }
+
+ return;
+}
+
+//_______________________________________________________________________________
+
+Bool_t AliAnalysisTaskSEDmesonsFilterCJ::SetD0WidthForDStar(Int_t nptbins, Float_t *width)
+{
+ //
+ // AliAnalysisTaskSEDmesonsFilterCJ::SetD0WidthForDStar
+ //
+
+ if (nptbins>30) {
+ AliInfo("Maximum number of bins allowed is 30!");
+ return kFALSE;
+ }
+
+ if (!width) return kFALSE;
+ for (Int_t ipt=0; ipt<nptbins; ipt++) fSigmaD0[ipt]=width[ipt];
+
+ return kTRUE;
+}
+
+//_______________________________________________________________________________
+
+Bool_t AliAnalysisTaskSEDmesonsFilterCJ::DefineHistoForAnalysis()
+{
+ //
+ // AliAnalysisTaskSEDmesonsFilterCJ::DefineHistoForAnalysis
+ //
+
+ // Statistics
+ TH1I* hstat = new TH1I("hstat","Statistics",5,-0.5,4.5);
+ hstat->GetXaxis()->SetBinLabel(1, "N ev anal");
+ hstat->GetXaxis()->SetBinLabel(2, "N ev sel");
+ if(fUseReco) hstat->GetXaxis()->SetBinLabel(3, "N cand");
+ else hstat->GetXaxis()->SetBinLabel(3, "N Gen D");
+ hstat->GetXaxis()->SetBinLabel(4, "N cand sel cuts");
+ if (fCandidateType==kDstartoKpipi) hstat->GetXaxis()->SetBinLabel(5, "N side band cand");
+ hstat->SetNdivisions(1);
+ fOutput->Add(hstat);
+
+ TH1F* hnCandEv=new TH1F("hnCandEv", "Number of candidates per event (after cuts);# cand/ev", 100, 0.,100.);
+ fOutput->Add(hnCandEv);
+
+ // Invariant mass related histograms
+ const Int_t nbinsmass = 200;
+ TH2F *hInvMass = new TH2F("hInvMassptD", "D invariant mass distribution", nbinsmass, fMinMass, fMaxMass, 100, 0., 50.);
+ hInvMass->SetStats(kTRUE);
+ hInvMass->GetXaxis()->SetTitle("mass (GeV/c)");
+ hInvMass->GetYaxis()->SetTitle("p_{T} (GeV/c)");
+ fOutput->Add(hInvMass);
+
+ if (fCandidateType==kDstartoKpipi) {
+ TH1F* hnSBCandEv=new TH1F("hnSBCandEv", "Number of side bands candidates per event (after cuts);# cand/ev", 100, 0.,100.);
+ fOutput->Add(hnSBCandEv);
+
+ TH1F* hPtPion = new TH1F("hPtPion", "Primary pions candidates pt", 500, 0., 10.);
+ hPtPion->SetStats(kTRUE);
+ hPtPion->GetXaxis()->SetTitle("p_{T} (GeV/c)");
+ hPtPion->GetYaxis()->SetTitle("entries");
+ fOutput->Add(hPtPion);
+ }
+
+ return kTRUE;
+}
-#ifndef ALIANALYSISTASKSEDMESONSFILTERCJ_H\r
-#define ALIANALYSISTASKSEDMESONSFILTERCJ_H\r
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------------\r
-// Author : A. Grelli, Utrecht University\r
-// C. Bianchin, Utrecht University\r
-// X. Zhang, LBNL\r
-//-----------------------------------------------------------------------\r
-\r
-\r
-#include <TH2F.h>\r
-#include "AliAODEvent.h"\r
-#include "AliPicoTrack.h"\r
-#include "AliAnalysisTaskSE.h"\r
-\r
-class TH3F;\r
-class TString;\r
-class TParticle ;\r
-class TClonesArray ;\r
-class AliMCParticle;\r
-class AliAODMCParticle;\r
-class AliRDHFCuts;\r
-class AliAODRecoCascadeHF;\r
-\r
-class AliAnalysisTaskSEDmesonsFilterCJ : public AliAnalysisTaskSE \r
-{\r
-\r
- public :\r
-\r
- enum ECandidateType{ kD0toKpi, kDstartoKpipi };\r
- \r
- AliAnalysisTaskSEDmesonsFilterCJ();\r
- AliAnalysisTaskSEDmesonsFilterCJ(const Char_t* name,AliRDHFCuts* cuts,ECandidateType candtype);\r
- virtual ~AliAnalysisTaskSEDmesonsFilterCJ();\r
-\r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- virtual void Init();\r
- virtual void LocalInit() { Init(); }\r
-\r
- // inizializations\r
- Bool_t DefineHistoForAnalysis();\r
-\r
- // set MC usage\r
- void SetMC(Bool_t theMCon) { fUseMCInfo = theMCon; }\r
- Bool_t GetMC() const { return fUseMCInfo; }\r
- \r
- // set usage of generated or reconstucted quantities (relevant for MC)\r
- void SetUseReco(Bool_t useReco=kTRUE) { fUseReco= useReco;}\r
- Bool_t GetUseReco() const {return fUseReco;}\r
- \r
- void SetMassLimits(Double_t range, Int_t pdg);\r
- void SetMassLimits(Double_t lowlimit, Double_t uplimit);\r
-\r
- // Array of D0 width for the Dstar\r
- Bool_t SetD0WidthForDStar(Int_t nptbins, Float_t *width);\r
-\r
- private :\r
- \r
- AliAnalysisTaskSEDmesonsFilterCJ(const AliAnalysisTaskSEDmesonsFilterCJ &source);\r
- AliAnalysisTaskSEDmesonsFilterCJ& operator=(const AliAnalysisTaskSEDmesonsFilterCJ& source); \r
-\r
- Bool_t fUseMCInfo; // Use MC info\r
- Bool_t fUseReco; // use reconstructed tracks when running on MC\r
-\r
- UInt_t fCandidateType; // Dstar or D0\r
- TString fCandidateName; // Dstar or D0\r
-\r
- Int_t fPDGmother; // PDG code of D meson\r
- Int_t fNProngs; // number of prong of the decay channel \r
- Int_t fPDGdaughters[4]; // PDG codes of daughters\r
- Float_t fSigmaD0[30]; // D0 sigma for Dstar\r
-\r
- TString fBranchName; // AOD branch name\r
- TList *fOutput; //! user output\r
-\r
- AliRDHFCuts *fCuts; // Cuts \r
- Double_t fMinMass; // mass lower limit histogram\r
- Double_t fMaxMass; // mass upper limit histogram\r
-\r
- TClonesArray *fCandidateArray; //! contains candidates selected by AliRDHFCuts\r
- TClonesArray *fSideBandArray; //! contains candidates selected by AliRDHFCuts::IsSelected(kTracks), to be used for side bands (DStar case only!!)\r
-\r
- ClassDef(AliAnalysisTaskSEDmesonsFilterCJ,2); // class for charm-jet correlations\r
-};\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKSEDMESONSFILTERCJ_H
+#define ALIANALYSISTASKSEDMESONSFILTERCJ_H
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Author : A. Grelli, Utrecht University
+// C. Bianchin, Utrecht University
+// X. Zhang, LBNL
+//-----------------------------------------------------------------------
+
+
+#include <TH2F.h>
+#include "AliAODEvent.h"
+#include "AliPicoTrack.h"
+#include "AliAnalysisTaskSE.h"
+
+class TH3F;
+class TString;
+class TParticle ;
+class TClonesArray ;
+class AliMCParticle;
+class AliAODMCParticle;
+class AliRDHFCuts;
+class AliAODRecoCascadeHF;
+
+class AliAnalysisTaskSEDmesonsFilterCJ : public AliAnalysisTaskSE
+{
+
+ public :
+
+ enum ECandidateType{ kD0toKpi, kDstartoKpipi };
+
+ AliAnalysisTaskSEDmesonsFilterCJ();
+ AliAnalysisTaskSEDmesonsFilterCJ(const Char_t* name,AliRDHFCuts* cuts,ECandidateType candtype);
+ virtual ~AliAnalysisTaskSEDmesonsFilterCJ();
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ virtual void Init();
+ virtual void LocalInit() { Init(); }
+
+ // inizializations
+ Bool_t DefineHistoForAnalysis();
+
+ // set MC usage
+ void SetMC(Bool_t theMCon) { fUseMCInfo = theMCon; }
+ Bool_t GetMC() const { return fUseMCInfo; }
+
+ // set usage of generated or reconstucted quantities (relevant for MC)
+ void SetUseReco(Bool_t useReco=kTRUE) { fUseReco= useReco;}
+ Bool_t GetUseReco() const {return fUseReco;}
+
+ void SetMassLimits(Double_t range, Int_t pdg);
+ void SetMassLimits(Double_t lowlimit, Double_t uplimit);
+
+ // Array of D0 width for the Dstar
+ Bool_t SetD0WidthForDStar(Int_t nptbins, Float_t *width);
+
+ private :
+
+ AliAnalysisTaskSEDmesonsFilterCJ(const AliAnalysisTaskSEDmesonsFilterCJ &source);
+ AliAnalysisTaskSEDmesonsFilterCJ& operator=(const AliAnalysisTaskSEDmesonsFilterCJ& source);
+
+ Bool_t fUseMCInfo; // Use MC info
+ Bool_t fUseReco; // use reconstructed tracks when running on MC
+
+ UInt_t fCandidateType; // Dstar or D0
+ TString fCandidateName; // Dstar or D0
+
+ Int_t fPDGmother; // PDG code of D meson
+ Int_t fNProngs; // number of prong of the decay channel
+ Int_t fPDGdaughters[4]; // PDG codes of daughters
+ Float_t fSigmaD0[30]; // D0 sigma for Dstar
+
+ TString fBranchName; // AOD branch name
+ TList *fOutput; //! user output
+
+ AliRDHFCuts *fCuts; // Cuts
+ Double_t fMinMass; // mass lower limit histogram
+ Double_t fMaxMass; // mass upper limit histogram
+
+ TClonesArray *fCandidateArray; //! contains candidates selected by AliRDHFCuts
+ TClonesArray *fSideBandArray; //! contains candidates selected by AliRDHFCuts::IsSelected(kTracks), to be used for side bands (DStar case only!!)
+
+ ClassDef(AliAnalysisTaskSEDmesonsFilterCJ,2); // class for charm-jet correlations
+};
+
+#endif
-AliAnalysisTaskFlavourJetCorrelations *AddTaskFlavourJetCorrelations(\r
- AliAnalysisTaskFlavourJetCorrelations::ECandidateType cand = AliAnalysisTaskFlavourJetCorrelations::kDstartoKpipi,\r
- TString filename = "DStartoKpipiCuts.root",\r
- Bool_t theMCon = kFALSE,\r
- Bool_t reco = kTRUE /*must be true if theMCon is false*/,\r
- TString jetArrname = "",\r
- TString suffix = "",\r
- Bool_t triggerOnLeadingJet = kFALSE,\r
- Int_t leadingHadType = 0 /*0 = charged, 1 = neutral, 2 = both*/,\r
- Float_t R = 0.4,\r
- Float_t jptcut = 10.,\r
- const char *cutType = "TPC",\r
- Double_t percjetareacut = 1.)\r
-{\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- ::Error("AddTaskFlavourJetCorrelations::AddTaskFlavourJetCorrelations", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
-\r
- Bool_t useStdC = kFALSE;\r
- TFile* filecuts=TFile::Open(filename);\r
- if (!filecuts || (filecuts && !filecuts->IsOpen())) {\r
- cout<<"Input file not found: use std cuts"<<endl;\r
- useStdC = kTRUE;\r
- }\r
-\r
- AliRDHFCuts *analysiscuts = 0x0;\r
- switch (cand) {\r
- case 0 :\r
- if (useStdC) {\r
- analysiscuts = new AliRDHFCutsD0toKpi();\r
- analysiscuts->SetStandardCutsPP2010();\r
- } else\r
- analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");\r
- break;\r
- case 1 :\r
- if(useStdC) {\r
- analysiscuts = new AliRDHFCutsDStartoKpipi();\r
- analysiscuts->SetStandardCutsPP2010();\r
- } else\r
- analysiscuts = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");\r
- analysiscuts->SetName("DStartoKpipiCuts");\r
- break;\r
- }\r
- \r
- if (!analysiscuts) { // mm let's see if everything is ok\r
- AliFatal("Specific AliRDHFCuts not found");\r
- return;\r
- }\r
-\r
- printf("CREATE TASK\n"); //CREATE THE TASK\r
-\r
- // create the task\r
- AliAnalysisTaskFlavourJetCorrelations *task = new AliAnalysisTaskFlavourJetCorrelations("AnaTaskFlavourJetCorrelations", \r
- analysiscuts, cand);\r
- task->SetJetsName(jetArrname);\r
- task->SetMC(theMCon);\r
- task->SetUseReco(reco);\r
- task->SetTriggerOnLeadingJet(triggerOnLeadingJet);\r
- task->SetJetAcceptanceType(cutType);\r
-\r
- mgr->AddTask(task);\r
-\r
- if(theMCon) {\r
- suffix+="MC";\r
- if(reco) suffix+="rec"; \r
- }\r
-\r
- // Create and connect containers for input/output\r
- TString outputfile = AliAnalysisManager::GetCommonFileName();\r
- outputfile += ":PWG3_D2H_DEmcalJet";\r
- outputfile += suffix;\r
-\r
- TString candname="DStar"; \r
- if(cand==0) candname="D0";\r
-\r
- TString nameContainer1="hCor";\r
- TString nameContainer2="cutsJ";\r
-\r
- nameContainer1 += candname;\r
- nameContainer2 += candname;\r
- \r
- nameContainer1 += suffix;\r
- nameContainer2 += suffix;\r
- // ------ input data ------\r
- AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();\r
-\r
- // ----- output data -----\r
- AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(nameContainer1, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());\r
- AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(nameContainer2, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());\r
-\r
- mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(task,1,coutput1);\r
- mgr->ConnectOutput(task,2,coutput2);\r
-\r
-\r
- Printf("Input and Output connected to the manager");\r
- return task ;\r
-}\r
+AliAnalysisTaskFlavourJetCorrelations *AddTaskFlavourJetCorrelations(
+ AliAnalysisTaskFlavourJetCorrelations::ECandidateType cand = AliAnalysisTaskFlavourJetCorrelations::kDstartoKpipi,
+ TString filename = "DStartoKpipiCuts.root",
+ Bool_t theMCon = kFALSE,
+ Bool_t reco = kTRUE /*must be true if theMCon is false*/,
+ TString jetArrname = "",
+ TString suffix = "",
+ Bool_t triggerOnLeadingJet = kFALSE,
+ Int_t leadingHadType = 0 /*0 = charged, 1 = neutral, 2 = both*/,
+ Float_t R = 0.4,
+ Float_t jptcut = 10.,
+ const char *cutType = "TPC",
+ Double_t percjetareacut = 1.)
+{
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error("AddTaskFlavourJetCorrelations::AddTaskFlavourJetCorrelations", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ Bool_t useStdC = kFALSE;
+ TFile* filecuts=TFile::Open(filename);
+ if (!filecuts || (filecuts && !filecuts->IsOpen())) {
+ cout<<"Input file not found: use std cuts"<<endl;
+ useStdC = kTRUE;
+ }
+
+ AliRDHFCuts *analysiscuts = 0x0;
+ switch (cand) {
+ case 0 :
+ if (useStdC) {
+ analysiscuts = new AliRDHFCutsD0toKpi();
+ analysiscuts->SetStandardCutsPP2010();
+ } else
+ analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");
+ break;
+ case 1 :
+ if(useStdC) {
+ analysiscuts = new AliRDHFCutsDStartoKpipi();
+ analysiscuts->SetStandardCutsPP2010();
+ } else
+ analysiscuts = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");
+ analysiscuts->SetName("DStartoKpipiCuts");
+ break;
+ }
+
+ if (!analysiscuts) { // mm let's see if everything is ok
+ AliFatal("Specific AliRDHFCuts not found");
+ return;
+ }
+
+ printf("CREATE TASK\n"); //CREATE THE TASK
+
+ // create the task
+ AliAnalysisTaskFlavourJetCorrelations *task = new AliAnalysisTaskFlavourJetCorrelations("AnaTaskFlavourJetCorrelations",
+ analysiscuts, cand);
+ task->SetJetsName(jetArrname);
+ task->SetMC(theMCon);
+ task->SetUseReco(reco);
+ task->SetTriggerOnLeadingJet(triggerOnLeadingJet);
+ task->SetJetAcceptanceType(cutType);
+
+ mgr->AddTask(task);
+
+ if(theMCon) {
+ suffix+="MC";
+ if(reco) suffix+="rec";
+ }
+
+ // Create and connect containers for input/output
+ TString outputfile = AliAnalysisManager::GetCommonFileName();
+ outputfile += ":PWG3_D2H_DEmcalJet";
+ outputfile += suffix;
+
+ TString candname="DStar";
+ if(cand==0) candname="D0";
+
+ TString nameContainer1="hCor";
+ TString nameContainer2="cutsJ";
+
+ nameContainer1 += candname;
+ nameContainer2 += candname;
+
+ nameContainer1 += suffix;
+ nameContainer2 += suffix;
+ // ------ input data ------
+ AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
+
+ // ----- output data -----
+ AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(nameContainer1, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
+ AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(nameContainer2, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
+
+ mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(task,1,coutput1);
+ mgr->ConnectOutput(task,2,coutput2);
+
+
+ Printf("Input and Output connected to the manager");
+ return task ;
+}
-AliAnalysisTaskSEDmesonsFilterCJ *AddTaskSEDmesonsFilterCJ(\r
- AliAnalysisTaskSEDmesonsFilterCJ::ECandidateType cand = AliAnalysisTaskSEDmesonsFilterCJ::kDstartoKpipi,\r
- TString filename = "DStartoKpipiCuts.root",\r
- Bool_t theMCon = kFALSE,\r
- Bool_t reco = kTRUE /*must be true if theMCon is false*/,\r
- TString suffix = "")\r
-{\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- ::Error("AddTaskSEDmesonsFilterCJ", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
-\r
- Bool_t useStdC = kFALSE;\r
- TFile* filecuts=TFile::Open(filename);\r
- if(!filecuts || (filecuts && !filecuts->IsOpen())) {\r
- cout<<"Input file not found: use std cuts"<<endl;\r
- useStdC = kTRUE;\r
- }\r
-\r
- AliRDHFCuts *analysiscuts=0x0;\r
- switch (cand) {\r
- case 0 :\r
- if(useStdC) {\r
- analysiscuts = new AliRDHFCutsD0toKpi();\r
- analysiscuts->SetStandardCutsPP2010();\r
- } else\r
- analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");\r
- break;\r
- case 1 :\r
- if(useStdC) {\r
- analysiscuts = new AliRDHFCutsDStartoKpipi();\r
- analysiscuts->SetStandardCutsPP2010();\r
- } else\r
- analysiscuts = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");\r
- analysiscuts->SetName("DStartoKpipiCuts");\r
- break;\r
- }\r
- \r
- if (!analysiscuts) { // mm let's see if everything is ok\r
- AliFatal("Specific AliRDHFCuts not found");\r
- return;\r
- } \r
-\r
- printf("CREATE TASK\n"); //CREATE THE TASK\r
-\r
- // create the task\r
- AliAnalysisTaskSEDmesonsFilterCJ *task = new AliAnalysisTaskSEDmesonsFilterCJ("AnaTaskSEDmesonsFilterCJ",analysiscuts,cand);\r
- if(!theMCon) reco=kTRUE;\r
- task->SetMC(theMCon); //D meson settings\r
- task->SetUseReco(reco);\r
- mgr->AddTask(task);\r
- if(theMCon) {\r
- suffix+="MC";\r
- if(reco) suffix+="rec"; \r
- }\r
- \r
- TString candname="DStar"; \r
- if(cand==0) candname="D0";\r
- \r
- // Create and connect containers for input/output\r
- TString outputfile = AliAnalysisManager::GetCommonFileName();\r
- outputfile += ":PWG3_D2H_DmesonsForJetCorrelations";\r
- outputfile += suffix;\r
-\r
- TString nameContainer0="histograms";\r
- TString nameContainer1="cuts";\r
- //TString nameContainer2="DcandidatesSel";\r
-\r
- nameContainer0 += candname;\r
- nameContainer1 += candname;\r
- \r
- nameContainer0 += suffix;\r
- nameContainer1 += suffix;\r
-//nameContainer2 += suffix;\r
-\r
- // ------ input data ------\r
- AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();\r
- \r
- // ----- output data -----\r
- \r
- AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(nameContainer0, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());\r
- AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(nameContainer1, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());\r
-//AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(nameContainer2, TList::Class(),AliAnalysisManager::kExchangeContainer, outputfile.Data());\r
- \r
- mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(task,1,coutput1);\r
- mgr->ConnectOutput(task,2,coutput2);\r
-//mgr->ConnectOutput(task,3,coutput3);\r
-\r
- Printf("Input and Output connected to the manager");\r
- return task ;\r
-}\r
-\r
+AliAnalysisTaskSEDmesonsFilterCJ *AddTaskSEDmesonsFilterCJ(
+ AliAnalysisTaskSEDmesonsFilterCJ::ECandidateType cand = AliAnalysisTaskSEDmesonsFilterCJ::kDstartoKpipi,
+ TString filename = "DStartoKpipiCuts.root",
+ Bool_t theMCon = kFALSE,
+ Bool_t reco = kTRUE /*must be true if theMCon is false*/,
+ TString suffix = "")
+{
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error("AddTaskSEDmesonsFilterCJ", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ Bool_t useStdC = kFALSE;
+ TFile* filecuts=TFile::Open(filename);
+ if(!filecuts || (filecuts && !filecuts->IsOpen())) {
+ cout<<"Input file not found: use std cuts"<<endl;
+ useStdC = kTRUE;
+ }
+
+ AliRDHFCuts *analysiscuts=0x0;
+ switch (cand) {
+ case 0 :
+ if(useStdC) {
+ analysiscuts = new AliRDHFCutsD0toKpi();
+ analysiscuts->SetStandardCutsPP2010();
+ } else
+ analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");
+ break;
+ case 1 :
+ if(useStdC) {
+ analysiscuts = new AliRDHFCutsDStartoKpipi();
+ analysiscuts->SetStandardCutsPP2010();
+ } else
+ analysiscuts = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");
+ analysiscuts->SetName("DStartoKpipiCuts");
+ break;
+ }
+
+ if (!analysiscuts) { // mm let's see if everything is ok
+ AliFatal("Specific AliRDHFCuts not found");
+ return;
+ }
+
+ printf("CREATE TASK\n"); //CREATE THE TASK
+
+ // create the task
+ AliAnalysisTaskSEDmesonsFilterCJ *task = new AliAnalysisTaskSEDmesonsFilterCJ("AnaTaskSEDmesonsFilterCJ",analysiscuts,cand);
+ if(!theMCon) reco=kTRUE;
+ task->SetMC(theMCon); //D meson settings
+ task->SetUseReco(reco);
+ mgr->AddTask(task);
+ if(theMCon) {
+ suffix+="MC";
+ if(reco) suffix+="rec";
+ }
+
+ TString candname="DStar";
+ if(cand==0) candname="D0";
+
+ // Create and connect containers for input/output
+ TString outputfile = AliAnalysisManager::GetCommonFileName();
+ outputfile += ":PWG3_D2H_DmesonsForJetCorrelations";
+ outputfile += suffix;
+
+ TString nameContainer0="histograms";
+ TString nameContainer1="cuts";
+ //TString nameContainer2="DcandidatesSel";
+
+ nameContainer0 += candname;
+ nameContainer1 += candname;
+
+ nameContainer0 += suffix;
+ nameContainer1 += suffix;
+//nameContainer2 += suffix;
+
+ // ------ input data ------
+ AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
+
+ // ----- output data -----
+
+ AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(nameContainer0, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
+ AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(nameContainer1, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
+//AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(nameContainer2, TList::Class(),AliAnalysisManager::kExchangeContainer, outputfile.Data());
+
+ mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(task,1,coutput1);
+ mgr->ConnectOutput(task,2,coutput2);
+//mgr->ConnectOutput(task,3,coutput3);
+
+ Printf("Input and Output connected to the manager");
+ return task ;
+}
+
-#include "TH1D.h"\r
-#include "TCanvas.h"\r
-#include "TStyle.h"\r
-#include "TString.h"\r
-#include "TLegend.h"\r
-#include "TFile.h"\r
-#include "TGraphErrors.h"\r
-#include "TGraphAsymmErrors.h"\r
-#include "TGraph.h"\r
-#include "TMath.h"\r
-\r
-#include "AliPID.h"\r
-\r
-#include "THnSparseDefinitions.h"\r
-\r
-#include <iostream>\r
-#include <iomanip>\r
-\r
-const Int_t numSpecies = 5;\r
-\r
-//________________________________________________________\r
-TCanvas* DrawFractionHistos(TString canvName, TString canvTitle, Double_t pLow, Double_t pHigh, TGraphAsymmErrors** gr, TH1F** histRef)\r
-{\r
- TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);\r
- canv->SetGridx(1);\r
- canv->SetGridy(1);\r
- canv->SetLogx(1);\r
- \r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- histRef[i]->GetYaxis()->SetRangeUser(0.0, 1.0);\r
- histRef[i]->GetYaxis()->SetTitle(canvTitle.Data());\r
- histRef[i]->GetXaxis()->SetRangeUser(pLow, pHigh);\r
- //histRef[i]->SetFillStyle(3004 + i);\r
- //histRef[i]->SetFillColor(kGray);\r
- histRef[i]->SetFillStyle(0);\r
- histRef[i]->SetFillColor(histRef[i]->GetMarkerColor());\r
- histRef[i]->SetLineColor(histRef[i]->GetMarkerColor());\r
- }\r
- histRef[2]->SetMarkerStyle(20);\r
- histRef[2]->Draw("e p");\r
- histRef[0]->SetMarkerStyle(21);\r
- histRef[0]->Draw("e p same");\r
- histRef[1]->SetMarkerStyle(22);\r
- histRef[1]->Draw("e p same");\r
- histRef[3]->SetMarkerStyle(29);\r
- histRef[3]->Draw("e p same");\r
- histRef[4]->SetMarkerStyle(30);\r
- histRef[4]->Draw("e p same");\r
- \r
- gr[0]->GetHistogram()->GetXaxis()->SetRangeUser(pLow, pHigh);\r
- gr[0]->GetHistogram()->GetYaxis()->SetRangeUser(0., 1.0);\r
- gr[0]->Draw("2 same");\r
- gr[1]->Draw("2 same");\r
- gr[2]->Draw("2 same");\r
- gr[3]->Draw("2 same");\r
- gr[4]->Draw("2 same");\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- legend->AddEntry(histRef[2], "#pi", "flp");\r
- legend->AddEntry(histRef[0], "e", "flp");\r
- legend->AddEntry(histRef[1], "K", "flp");\r
- legend->AddEntry(histRef[3], "p", "flp");\r
- legend->AddEntry(histRef[4], "#mu", "flp");\r
- legend->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(canv);\r
- \r
- return canv;\r
-}\r
-\r
-\r
-//________________________________________________________\r
-TGraphAsymmErrors* loadGraph(const TString graphName, TFile* f)\r
-{\r
- if (!f) {\r
- std::cout << "No file. Cannot load graph \"" << graphName.Data() << "\n!" << std::endl;\r
- return 0x0;\r
- }\r
- \r
- TGraphAsymmErrors* grTemp = dynamic_cast<TGraphAsymmErrors*>(f->Get(graphName.Data()));\r
- if (!grTemp) {\r
- std::cout << "Failed to load histo \"" << graphName.Data() << "\"!" << std::endl;\r
- return 0x0;\r
- } \r
- \r
- return grTemp;\r
-}\r
-\r
-\r
-//________________________________________________________\r
-TH1F* loadHisto(const TString histName, TFile* f)\r
-{\r
- if (!f) {\r
- std::cout << "No file. Cannot load hist \"" << histName.Data() << "\n!" << std::endl;\r
- return 0x0;\r
- }\r
- \r
- TH1F* hTemp = dynamic_cast<TH1F*>(f->Get(histName.Data()));\r
- if (!hTemp) {\r
- std::cout << "Failed to load histo \"" << histName.Data() << "\"!" << std::endl;\r
- return 0x0;\r
- } \r
- \r
- return hTemp;\r
-}\r
-\r
-\r
-//________________________________________________________\r
-Int_t AddUpSystematicErrors(const TString path, const TString outFileTitle, const TString* fileNames, const Int_t numFiles,\r
- const TString fileNameReference) \r
-{ \r
- if (!fileNames || numFiles < 1)\r
- return -1;\r
- \r
- TFile* f[numFiles];\r
- TGraphAsymmErrors** grSysError[numSpecies];\r
- TString grNames[numSpecies] = {"systematicError_electron", "systematicError_kaon", "systematicError_pion", "systematicError_proton",\r
- "systematicError_muon" };\r
- \r
- const TString histNames[numSpecies] = {"hFractionElectrons", "hFractionKaons", "hFractionPions", "hFractionProtons", "hFractionMuons" };\r
- \r
- \r
- TGraphAsymmErrors** grSysErrorYields[numSpecies];\r
- TString grNamesYields[numSpecies] = {"systematicErrorYields_electron", "systematicErrorYields_kaon", "systematicErrorYields_pion",\r
- "systematicErrorYields_proton", "systematicErrorYields_muon" };\r
- \r
- const TString histNamesYields[numSpecies] = {"hYieldElectrons", "hYieldKaons", "hYieldPions", "hYieldProtons", "hYieldMuons" };\r
- \r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- grSysError[i] = new TGraphAsymmErrors*[numFiles];\r
- grSysErrorYields[i] = new TGraphAsymmErrors*[numFiles];\r
- }\r
- \r
- for (Int_t iFile = 0; iFile < numFiles; iFile++) {\r
- f[iFile] = TFile::Open(fileNames[iFile].Data());\r
- if (!f[iFile]) {\r
- std::cout << "Failed to open file \"" << fileNames[iFile].Data() << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- // Extract the data graphs\r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- grSysError[i][iFile] = loadGraph(grNames[i], f[iFile]);\r
- if (!grSysError[i][iFile])\r
- return -1;\r
- \r
- grSysError[i][iFile]->SetName(Form("%s_fileID%d", grSysError[i][iFile]->GetName(), iFile));\r
- \r
- \r
- grSysErrorYields[i][iFile] = loadGraph(grNamesYields[i], f[iFile]);\r
- if (!grSysErrorYields[i][iFile])\r
- return -1;\r
- \r
- grSysErrorYields[i][iFile]->SetName(Form("%s_fileID%d", grSysErrorYields[i][iFile]->GetName(), iFile));\r
- }\r
- }\r
- \r
- // Load data points with statistical errors\r
- TFile* fReferenceData = TFile::Open(fileNameReference.Data());\r
- if (!fReferenceData) {\r
- std::cout << "Failed to open file \"" << fileNameReference.Data() << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- TH1F* hReferenceFractions[numSpecies];\r
- TH1F* hReferenceYields[numSpecies];\r
- \r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- hReferenceFractions[i] = loadHisto(histNames[i], fReferenceData);\r
- if (!hReferenceFractions[i])\r
- return -1;\r
- \r
- hReferenceYields[i] = loadHisto(histNamesYields[i], fReferenceData);\r
- if (!hReferenceYields[i])\r
- return -1;\r
- }\r
- \r
- const Int_t reference = 0;\r
- \r
- // The x,y coordinates should be those of the reference graph. Then, all corresponding sys. errors are added in quadrature.\r
- TGraphAsymmErrors* grTotSysError[numSpecies];\r
- TGraphAsymmErrors* grTotSysErrorYields[numSpecies];\r
- Double_t sysErrorTotalSquared = 0;\r
- Double_t temp = 0;\r
- \r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- grTotSysError[i] = new TGraphAsymmErrors(*grSysError[i][reference]);\r
- grTotSysError[i]->SetName(grNames[i]);\r
- \r
- for (Int_t iPoint = 0; iPoint < grTotSysError[i]->GetN(); iPoint++) {\r
- sysErrorTotalSquared = 0;\r
- for (Int_t iFile = 0; iFile < numFiles; iFile++) {\r
- // Already averages high and low value -> Since they are by now the same, this is ok.\r
- temp = grSysError[i][iFile]->GetErrorY(iPoint); \r
- if (temp > 0) {\r
- sysErrorTotalSquared += temp * temp;\r
- }\r
- }\r
- \r
- grTotSysError[i]->SetPointEYlow(iPoint, TMath::Sqrt(sysErrorTotalSquared));\r
- grTotSysError[i]->SetPointEYhigh(iPoint, TMath::Sqrt(sysErrorTotalSquared));\r
- }\r
- \r
- // Same for the yields\r
- grTotSysErrorYields[i] = new TGraphAsymmErrors(*grSysErrorYields[i][reference]);\r
- grTotSysErrorYields[i]->SetName(grNamesYields[i]);\r
- \r
- for (Int_t iPoint = 0; iPoint < grTotSysErrorYields[i]->GetN(); iPoint++) {\r
- sysErrorTotalSquared = 0;\r
- for (Int_t iFile = 0; iFile < numFiles; iFile++) {\r
- // Already averages high and low value -> Since they are by now the same, this is ok.\r
- temp = grSysErrorYields[i][iFile]->GetErrorY(iPoint); \r
- if (temp > 0) {\r
- sysErrorTotalSquared += temp * temp;\r
- }\r
- }\r
- \r
- grTotSysErrorYields[i]->SetPointEYlow(iPoint, TMath::Sqrt(sysErrorTotalSquared));\r
- grTotSysErrorYields[i]->SetPointEYhigh(iPoint, TMath::Sqrt(sysErrorTotalSquared));\r
- }\r
- }\r
- \r
- const Double_t pLow = 0.15;\r
- const Double_t pHigh = 50.;\r
- TCanvas* cFractionsWithTotalSystematicError = DrawFractionHistos("cFractionsWithTotalSystematicError", "Particle fractions", pLow, pHigh,\r
- grTotSysError, hReferenceFractions);\r
- \r
- \r
- // Output file\r
- TFile* fSave = 0x0;\r
- TDatime daTime;\r
- TString saveFileName;\r
- \r
- saveFileName = Form("outputSystematicsTotal_%s__%04d_%02d_%02d.root", outFileTitle.Data(), daTime.GetYear(),\r
- daTime.GetMonth(), daTime.GetDay());\r
- \r
- fSave = TFile::Open(Form("%s/%s", path.Data(), saveFileName.Data()), "recreate");\r
- if (!fSave) {\r
- std::cout << "Failed to open save file \"" << Form("%s/%s", path.Data(), saveFileName.Data()) << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- // Save final results\r
- fSave->cd();\r
- \r
- if (cFractionsWithTotalSystematicError)\r
- cFractionsWithTotalSystematicError->Write();\r
- \r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- if (grTotSysError[i])\r
- grTotSysError[i]->Write();\r
- if (hReferenceFractions[i])\r
- hReferenceFractions[i]->Write();\r
- \r
- if (grTotSysErrorYields[i])\r
- grTotSysErrorYields[i]->Write();\r
- if (hReferenceYields[i])\r
- hReferenceYields[i]->Write();\r
- }\r
- \r
- // Save list of file names in output file\r
- TString listOfFileNames = "";\r
- for (Int_t i = 0; i < numFiles; i++) {\r
- listOfFileNames.Append(Form("%s%d: %s", i == 0 ? "" : ", ", i, fileNames[i].Data()));\r
- }\r
- \r
- TNamed* settings = new TNamed(Form("Used files for systematics: %s\n", listOfFileNames.Data()),\r
- Form("Used files for systematics: %s\n", listOfFileNames.Data()));\r
- settings->Write();\r
- \r
- delete cFractionsWithTotalSystematicError;\r
- \r
- fSave->Close();\r
- \r
- return 0;\r
-}\r
+#include "TH1D.h"
+#include "TCanvas.h"
+#include "TStyle.h"
+#include "TString.h"
+#include "TLegend.h"
+#include "TFile.h"
+#include "TGraphErrors.h"
+#include "TGraphAsymmErrors.h"
+#include "TGraph.h"
+#include "TMath.h"
+
+#include "AliPID.h"
+
+#include "THnSparseDefinitions.h"
+
+#include <iostream>
+#include <iomanip>
+
+const Int_t numSpecies = 5;
+
+//________________________________________________________
+TCanvas* DrawFractionHistos(TString canvName, TString canvTitle, Double_t pLow, Double_t pHigh, TGraphAsymmErrors** gr, TH1F** histRef)
+{
+ TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);
+ canv->SetGridx(1);
+ canv->SetGridy(1);
+ canv->SetLogx(1);
+
+ for (Int_t i = 0; i < numSpecies; i++) {
+ histRef[i]->GetYaxis()->SetRangeUser(0.0, 1.0);
+ histRef[i]->GetYaxis()->SetTitle(canvTitle.Data());
+ histRef[i]->GetXaxis()->SetRangeUser(pLow, pHigh);
+ //histRef[i]->SetFillStyle(3004 + i);
+ //histRef[i]->SetFillColor(kGray);
+ histRef[i]->SetFillStyle(0);
+ histRef[i]->SetFillColor(histRef[i]->GetMarkerColor());
+ histRef[i]->SetLineColor(histRef[i]->GetMarkerColor());
+ }
+ histRef[2]->SetMarkerStyle(20);
+ histRef[2]->Draw("e p");
+ histRef[0]->SetMarkerStyle(21);
+ histRef[0]->Draw("e p same");
+ histRef[1]->SetMarkerStyle(22);
+ histRef[1]->Draw("e p same");
+ histRef[3]->SetMarkerStyle(29);
+ histRef[3]->Draw("e p same");
+ histRef[4]->SetMarkerStyle(30);
+ histRef[4]->Draw("e p same");
+
+ gr[0]->GetHistogram()->GetXaxis()->SetRangeUser(pLow, pHigh);
+ gr[0]->GetHistogram()->GetYaxis()->SetRangeUser(0., 1.0);
+ gr[0]->Draw("2 same");
+ gr[1]->Draw("2 same");
+ gr[2]->Draw("2 same");
+ gr[3]->Draw("2 same");
+ gr[4]->Draw("2 same");
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+ legend->AddEntry(histRef[2], "#pi", "flp");
+ legend->AddEntry(histRef[0], "e", "flp");
+ legend->AddEntry(histRef[1], "K", "flp");
+ legend->AddEntry(histRef[3], "p", "flp");
+ legend->AddEntry(histRef[4], "#mu", "flp");
+ legend->Draw();
+
+ ClearTitleFromHistoInCanvas(canv);
+
+ return canv;
+}
+
+
+//________________________________________________________
+TGraphAsymmErrors* loadGraph(const TString graphName, TFile* f)
+{
+ if (!f) {
+ std::cout << "No file. Cannot load graph \"" << graphName.Data() << "\n!" << std::endl;
+ return 0x0;
+ }
+
+ TGraphAsymmErrors* grTemp = dynamic_cast<TGraphAsymmErrors*>(f->Get(graphName.Data()));
+ if (!grTemp) {
+ std::cout << "Failed to load histo \"" << graphName.Data() << "\"!" << std::endl;
+ return 0x0;
+ }
+
+ return grTemp;
+}
+
+
+//________________________________________________________
+TH1F* loadHisto(const TString histName, TFile* f)
+{
+ if (!f) {
+ std::cout << "No file. Cannot load hist \"" << histName.Data() << "\n!" << std::endl;
+ return 0x0;
+ }
+
+ TH1F* hTemp = dynamic_cast<TH1F*>(f->Get(histName.Data()));
+ if (!hTemp) {
+ std::cout << "Failed to load histo \"" << histName.Data() << "\"!" << std::endl;
+ return 0x0;
+ }
+
+ return hTemp;
+}
+
+
+//________________________________________________________
+Int_t AddUpSystematicErrors(const TString path, const TString outFileTitle, const TString* fileNames, const Int_t numFiles,
+ const TString fileNameReference)
+{
+ if (!fileNames || numFiles < 1)
+ return -1;
+
+ TFile* f[numFiles];
+ TGraphAsymmErrors** grSysError[numSpecies];
+ TString grNames[numSpecies] = {"systematicError_electron", "systematicError_kaon", "systematicError_pion", "systematicError_proton",
+ "systematicError_muon" };
+
+ const TString histNames[numSpecies] = {"hFractionElectrons", "hFractionKaons", "hFractionPions", "hFractionProtons", "hFractionMuons" };
+
+
+ TGraphAsymmErrors** grSysErrorYields[numSpecies];
+ TString grNamesYields[numSpecies] = {"systematicErrorYields_electron", "systematicErrorYields_kaon", "systematicErrorYields_pion",
+ "systematicErrorYields_proton", "systematicErrorYields_muon" };
+
+ const TString histNamesYields[numSpecies] = {"hYieldElectrons", "hYieldKaons", "hYieldPions", "hYieldProtons", "hYieldMuons" };
+
+ for (Int_t i = 0; i < numSpecies; i++) {
+ grSysError[i] = new TGraphAsymmErrors*[numFiles];
+ grSysErrorYields[i] = new TGraphAsymmErrors*[numFiles];
+ }
+
+ for (Int_t iFile = 0; iFile < numFiles; iFile++) {
+ f[iFile] = TFile::Open(fileNames[iFile].Data());
+ if (!f[iFile]) {
+ std::cout << "Failed to open file \"" << fileNames[iFile].Data() << "\"!" << std::endl;
+ return -1;
+ }
+
+ // Extract the data graphs
+ for (Int_t i = 0; i < numSpecies; i++) {
+ grSysError[i][iFile] = loadGraph(grNames[i], f[iFile]);
+ if (!grSysError[i][iFile])
+ return -1;
+
+ grSysError[i][iFile]->SetName(Form("%s_fileID%d", grSysError[i][iFile]->GetName(), iFile));
+
+
+ grSysErrorYields[i][iFile] = loadGraph(grNamesYields[i], f[iFile]);
+ if (!grSysErrorYields[i][iFile])
+ return -1;
+
+ grSysErrorYields[i][iFile]->SetName(Form("%s_fileID%d", grSysErrorYields[i][iFile]->GetName(), iFile));
+ }
+ }
+
+ // Load data points with statistical errors
+ TFile* fReferenceData = TFile::Open(fileNameReference.Data());
+ if (!fReferenceData) {
+ std::cout << "Failed to open file \"" << fileNameReference.Data() << "\"!" << std::endl;
+ return -1;
+ }
+
+ TH1F* hReferenceFractions[numSpecies];
+ TH1F* hReferenceYields[numSpecies];
+
+ for (Int_t i = 0; i < numSpecies; i++) {
+ hReferenceFractions[i] = loadHisto(histNames[i], fReferenceData);
+ if (!hReferenceFractions[i])
+ return -1;
+
+ hReferenceYields[i] = loadHisto(histNamesYields[i], fReferenceData);
+ if (!hReferenceYields[i])
+ return -1;
+ }
+
+ const Int_t reference = 0;
+
+ // The x,y coordinates should be those of the reference graph. Then, all corresponding sys. errors are added in quadrature.
+ TGraphAsymmErrors* grTotSysError[numSpecies];
+ TGraphAsymmErrors* grTotSysErrorYields[numSpecies];
+ Double_t sysErrorTotalSquared = 0;
+ Double_t temp = 0;
+
+ for (Int_t i = 0; i < numSpecies; i++) {
+ grTotSysError[i] = new TGraphAsymmErrors(*grSysError[i][reference]);
+ grTotSysError[i]->SetName(grNames[i]);
+
+ for (Int_t iPoint = 0; iPoint < grTotSysError[i]->GetN(); iPoint++) {
+ sysErrorTotalSquared = 0;
+ for (Int_t iFile = 0; iFile < numFiles; iFile++) {
+ // Already averages high and low value -> Since they are by now the same, this is ok.
+ temp = grSysError[i][iFile]->GetErrorY(iPoint);
+ if (temp > 0) {
+ sysErrorTotalSquared += temp * temp;
+ }
+ }
+
+ grTotSysError[i]->SetPointEYlow(iPoint, TMath::Sqrt(sysErrorTotalSquared));
+ grTotSysError[i]->SetPointEYhigh(iPoint, TMath::Sqrt(sysErrorTotalSquared));
+ }
+
+ // Same for the yields
+ grTotSysErrorYields[i] = new TGraphAsymmErrors(*grSysErrorYields[i][reference]);
+ grTotSysErrorYields[i]->SetName(grNamesYields[i]);
+
+ for (Int_t iPoint = 0; iPoint < grTotSysErrorYields[i]->GetN(); iPoint++) {
+ sysErrorTotalSquared = 0;
+ for (Int_t iFile = 0; iFile < numFiles; iFile++) {
+ // Already averages high and low value -> Since they are by now the same, this is ok.
+ temp = grSysErrorYields[i][iFile]->GetErrorY(iPoint);
+ if (temp > 0) {
+ sysErrorTotalSquared += temp * temp;
+ }
+ }
+
+ grTotSysErrorYields[i]->SetPointEYlow(iPoint, TMath::Sqrt(sysErrorTotalSquared));
+ grTotSysErrorYields[i]->SetPointEYhigh(iPoint, TMath::Sqrt(sysErrorTotalSquared));
+ }
+ }
+
+ const Double_t pLow = 0.15;
+ const Double_t pHigh = 50.;
+ TCanvas* cFractionsWithTotalSystematicError = DrawFractionHistos("cFractionsWithTotalSystematicError", "Particle fractions", pLow, pHigh,
+ grTotSysError, hReferenceFractions);
+
+
+ // Output file
+ TFile* fSave = 0x0;
+ TDatime daTime;
+ TString saveFileName;
+
+ saveFileName = Form("outputSystematicsTotal_%s__%04d_%02d_%02d.root", outFileTitle.Data(), daTime.GetYear(),
+ daTime.GetMonth(), daTime.GetDay());
+
+ fSave = TFile::Open(Form("%s/%s", path.Data(), saveFileName.Data()), "recreate");
+ if (!fSave) {
+ std::cout << "Failed to open save file \"" << Form("%s/%s", path.Data(), saveFileName.Data()) << "\"!" << std::endl;
+ return -1;
+ }
+
+ // Save final results
+ fSave->cd();
+
+ if (cFractionsWithTotalSystematicError)
+ cFractionsWithTotalSystematicError->Write();
+
+ for (Int_t i = 0; i < numSpecies; i++) {
+ if (grTotSysError[i])
+ grTotSysError[i]->Write();
+ if (hReferenceFractions[i])
+ hReferenceFractions[i]->Write();
+
+ if (grTotSysErrorYields[i])
+ grTotSysErrorYields[i]->Write();
+ if (hReferenceYields[i])
+ hReferenceYields[i]->Write();
+ }
+
+ // Save list of file names in output file
+ TString listOfFileNames = "";
+ for (Int_t i = 0; i < numFiles; i++) {
+ listOfFileNames.Append(Form("%s%d: %s", i == 0 ? "" : ", ", i, fileNames[i].Data()));
+ }
+
+ TNamed* settings = new TNamed(Form("Used files for systematics: %s\n", listOfFileNames.Data()),
+ Form("Used files for systematics: %s\n", listOfFileNames.Data()));
+ settings->Write();
+
+ delete cFractionsWithTotalSystematicError;
+
+ fSave->Close();
+
+ return 0;
+}
-#include "THnSparse.h"\r
-#include "TH2D.h"\r
-#include "TH1D.h"\r
-#include "TProfile.h"\r
-#include "TF1.h"\r
-#include "TFitResultPtr.h"\r
-#include "TFitResult.h"\r
-#include "TCanvas.h"\r
-#include "TStyle.h"\r
-#include "TVirtualFitter.h"\r
-#include "TObjArray.h"\r
-#include "TString.h"\r
-#include "TLegend.h"\r
-#include "TFile.h"\r
-#include "TGraphErrors.h"\r
-#include "TGraph.h"\r
-#include "TMath.h"\r
-#include "TMatrixDSym.h"\r
-#include "TRandom3.h"\r
-#include "TROOT.h"\r
-\r
-#include <iostream>\r
-#include <iomanip>\r
-\r
-#include "AliPID.h"\r
-\r
-#include "THnSparseDefinitions.h"\r
-#include "AliTPCPIDmathFit.h"\r
-\r
-enum processMode { kPMpT = 0, kPMz = 1, kPMxi = 2 };\r
-enum muonTreatment { kNoMuons = 0, kMuonFracEqualElFrac = 1, kMuonFracOverElFracTunedOnMCStandardTrackCuts = 2,\r
- kMuonFracOverElFracTunedOnMCHybridTrackCuts = 3, kMuonFracOverElFracTunedOnMCHybridTrackCutsJets = 4,\r
- kMuonFracOverElFracTunedOnMCStandardTrackCutsPPb = 5,\r
- kNumHandlings = 6 };\r
-\r
-const TString modeShortName[3] = { "Pt", "Z", "Xi" };\r
-const TString modeLatexName[3] = { "P_{T}", "z", "#xi" };\r
-\r
-const TString muonFractionHandlingShortName[kNumHandlings] =\r
- { "noMuons", "muonsEqualElectrons", "muonToElTunedOnMCStandardTrackCuts", "muonToElTunedOnMCHybridTrackCuts",\r
- "muonToElTunedOnMCHybridTrackCutsJets", "muonToElTunedOnMCStandardTrackCutsPPB" };\r
-\r
-const Double_t epsilon = 1e-10;\r
-const TString identifiedLabels[2] = { "Most Probable PID", "MC" };\r
-Int_t isMC = 0;\r
-\r
-TString minimisationStrategy = "MIGRAD"; // "MINIMIZE"\r
-Bool_t takeIntoAccountMuons = kTRUE;\r
-\r
-// 0 = no muons, 1 = muonFrac=elFrac, 2(3) = muonFrac/elFrac tuned on MC for DefaultTrackCuts (hybridTrackCuts),\r
-// 4 = muonFrac/elFrac tuned on MC for hybridTrackCuts for jet particles,\r
-Int_t muonFractionHandling = 3; \r
-\r
-\r
-//TODO getErrorOf.... is COMPLETELY wrong now, since the parameter numbering has changed and the muons had come into play!!!!!!\r
-\r
-// TODO CAREFUL: fitMethod == 1 adds errors of electrons to pions, but not to muons (should be added to electron error instead!)\r
-const Bool_t muonContamination = kFALSE;//TODO CAREFUL: fitMethod == 1 takes into account the muon contamination in the error calculation!!!\r
-\r
-const Bool_t normaliseResults = kTRUE; // Works only for fitMethod == 2\r
-\r
-const Bool_t enableShift = kFALSE;\r
-const Int_t dataAxis = kPidDeltaPrime;//kPidDelta; kPidDeltaPrime\r
-\r
-const Int_t numSimultaneousFits = 4;\r
-\r
-// Upper and lower axis bounds (y-axis) of (data - fit) / data QA histos\r
-const Double_t fitQAaxisLowBound = -0.5;\r
-const Double_t fitQAaxisUpBound = 0.5;\r
-\r
-Bool_t useDeltaPrime = (dataAxis == kPidDeltaPrime);\r
-\r
-// Will be set later\r
-Double_t muonFractionThresholdForFitting = -1.;\r
-Double_t muonFractionThresholdBinForFitting = -1;\r
- \r
-Double_t electronFractionThresholdForFitting = -1.;\r
-Double_t electronFractionThresholdBinForFitting = -1;\r
-\r
-\r
-TF1 fMuonOverElFractionMC("fMuonOverElFractionMC", "[0]+[1]/TMath::Min(x, [4])+[2]*TMath::Min(x, [4])+[3]*TMath::Min(x, [4])*TMath::Min(x, [4])+[5]*TMath::Min(x, [4])*TMath::Min(x, [4])*TMath::Min(x, [4])+[6]*(x>[7])*TMath::Min(x-[7], [8]-[7])",\r
- 0.01, 50.);\r
-\r
-TF1* fElectronFraction = 0x0;\r
-const Double_t lowFittingBoundElectronFraction = 3.0; \r
-\r
-TGraphErrors* gFractionElectronsData = 0x0;\r
-Double_t lastPtForCallOfGetElectronFraction = -1;\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t GetElectronFraction(const Double_t pT, const Double_t *par)\r
-{\r
- // During the fit (both, simultaneous and non-simultaneous), the algorithm will always start off from\r
- // the low pT and go to higher pT. So, it is only necessary to do the fit once the first fixed bin is reached.\r
- // Then the parameters for the electron fraction remain fixed until the next fit iteration.\r
- // Since only for the case of regularisation the electron fractions of all x bins are stored in mathFit,\r
- // the evaluation of this function is done here only in that case (only then the electron fraction will\r
- // be set to "-pT".\r
- \r
- // NOTE 1: Electrons have index 3 per x bin\r
- // NOTE 2: This function is only called for fitting vs. pT. In that case, xValue holds the LOG of pT!\r
- \r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- // lastPtForCallOfGetElectronFraction will be initialised with a value larger than any pT during the fit.\r
- // So, if this function is called and the pT is smaller than lastPtForCallOfGetElectronFraction, the parameters\r
- // must have changed and the electron fit needs to be re-done (also see comment above)\r
- if (pT < lastPtForCallOfGetElectronFraction) {\r
- for (Int_t xBin = 0; xBin < mathFit->GetNumXbinsRegularisation(); xBin++) {\r
- \r
- const Double_t xCoord = TMath::Exp(mathFit->GetXvaluesForRegularisation()[xBin]);\r
- const Int_t parIndexWithFraction = 3 + xBin * mathFit->GetNumParametersPerXbin(); \r
- \r
- if (xCoord >= lowFittingBoundElectronFraction && xCoord <= electronFractionThresholdForFitting\r
- && par[parIndexWithFraction] > epsilon) { // Skip zero values (usually due to failed fits)\r
- gFractionElectronsData->SetPoint(xBin, TMath::Exp(mathFit->GetXvaluesForRegularisation()[xBin]), par[parIndexWithFraction]);\r
- // Since the errors during the fitting are not reliable, use the following approximation on a statistical basis\r
- // (which indeed turns out to be rather good!)\r
- \r
- // Bin effective weight required for weighted data sets. In case of no weighting, the weight error is sqrt(weight),\r
- // i.e. effWeight is 1\r
- const Double_t effWeight = mathFit->GetXstatisticalWeightError()[xBin] * mathFit->GetXstatisticalWeightError()[xBin]\r
- / mathFit->GetXstatisticalWeight()[xBin];\r
- gFractionElectronsData->SetPointError(xBin, 0, effWeight * TMath::Sqrt(par[parIndexWithFraction] \r
- / mathFit->GetXstatisticalWeight()[xBin]));\r
- }\r
- else {\r
- gFractionElectronsData->SetPoint(xBin, -1, 0);\r
- gFractionElectronsData->SetPointError(xBin, 0, 0);\r
- }\r
- }\r
- \r
- gFractionElectronsData->Fit(fElectronFraction, "Ex0NQ", "", lowFittingBoundElectronFraction, electronFractionThresholdForFitting);\r
- }\r
- \r
- lastPtForCallOfGetElectronFraction = pT;\r
- \r
- // Catch cases in which the fit function yields invalid fractions (i.e. < 0 or > 1)\r
- return TMath::Max(0.0, TMath::Min(1.0, fElectronFraction->Eval(pT)));\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t GetElectronFractionError()\r
-{\r
- // This function estimates the error of the electron fraction for the fixed values via using the parameter errors of\r
- // the electron fraction function. Note that the parameters (and errors) must be set before calling this function.\r
- \r
- // Produce several values via setting the parameters to a random value, which is distributed with a gaussian with mean = parValue\r
- // and sigma = parError and then take the 2*RMS as the error\r
- const Int_t nGenValues = 1000;\r
- Double_t genValues[nGenValues];\r
- \r
- const Int_t nPars = fElectronFraction->GetNpar();\r
- Double_t par[nPars];\r
- \r
- TRandom3 rnd(0); // 0 means random seed\r
- \r
- const Double_t x = electronFractionThresholdForFitting + 1.; // Some value above the threshold to obtain a fixed value\r
- for (Int_t i = 0 ; i < nGenValues; i++) {\r
- for (Int_t iPar = 0; iPar < nPars; iPar++)\r
- par[iPar] = rnd.Gaus(fElectronFraction->GetParameter(iPar), fElectronFraction->GetParError(iPar));\r
- \r
- genValues[i] = fElectronFraction->EvalPar(&x, &par[0]);\r
- }\r
- \r
- // NOTE: RMS is not really the root mean square, is it rather the sigma deviation, which is what is wanted here\r
- return 2. * TMath::RMS(nGenValues, &genValues[0]);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t GetMuonFractionFromElectronFractionAndPt(Double_t pT, Double_t elFrac)\r
-{\r
- if (muonFractionHandling == kMuonFracOverElFracTunedOnMCStandardTrackCuts) {\r
-// return elFrac / (1. + 7.06909e+01 * TMath::Exp(-2.95078e+00 * TMath::Power(pT, 5.05016e-01)));\r
- return elFrac / (1. + 2.01840e+10 * TMath::Exp(-2.50480e+01 * TMath::Power(pT, 5.89044e-02)));\r
- }\r
- else if (muonFractionHandling == kMuonFracOverElFracTunedOnMCHybridTrackCuts) {\r
- fMuonOverElFractionMC.SetParameters(-6.87241e-01, 4.19528e-02, 4.52095e+00, -6.20026e+00, 5.16629e-01, 2.88604e+00, 3.68058e-02,\r
- 2.21086e+00, 5.75003e+00);\r
- return elFrac * fMuonOverElFractionMC.Eval(pT);\r
- }\r
- else if (muonFractionHandling == kMuonFracOverElFracTunedOnMCHybridTrackCutsJets) {\r
- fMuonOverElFractionMC.SetParameters(-7.64548e-01, 2.47929e-02, 4.49057e+00, -2.06320e-01, 4.23339e-02, 1.19697e+02, 1.28832e-01,\r
- -1.71895e-01, 6.00000e+00);\r
- return elFrac * fMuonOverElFractionMC.Eval(pT);\r
- }\r
- else if (muonFractionHandling == kMuonFracOverElFracTunedOnMCStandardTrackCutsPPb) {\r
- // WITH PID cluster cut!\r
- fMuonOverElFractionMC.SetParameters(-6.62149e-01, 4.89591e-02, 4.58356e+00, -6.04319e+00, 6.25368e-01, 3.27191e+00, 1.69933e-01,\r
- 1.00004e+00, 2.61438e+00);\r
- return elFrac * fMuonOverElFractionMC.Eval(pT);\r
- }\r
- else if (muonFractionHandling == kMuonFracEqualElFrac) {\r
- return elFrac;\r
- }\r
- \r
- return 0.;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t GetCorrelatedError(const Double_t x, const Double_t y, const Double_t cov00, const Double_t cov11, const Double_t cov01) \r
-{\r
- // Calculate the correlated error df of f:\r
- // (cov00 cov01) (x)\r
- //df^2 = (x, y) * (cov01 cov11) (y) = x^2 * cov00 + y^2 * cov11 + 2 * x * y * cov01\r
- //\r
- // with f = f(p1, p2) = p1 / p2\r
- // and (x, y) = (\partial f / \partial p1, \partial f / \partial p2)\r
- // = (f / p1, -f / p2)\r
-\r
- const Double_t df2 = x * x * cov00 + y * y * cov11 + 2. * x * y * cov01;\r
- \r
- if (df2 < epsilon)\r
- return 0.;\r
- \r
- return TMath::Sqrt(df2);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-void GetRatioWithCorrelatedError(const Double_t fractionA, const Double_t fractionB,\r
- const Double_t fractionErrorA, const Double_t fractionErrorB,\r
- const Double_t covMatrixElementAB, Double_t& ratio, Double_t& ratioError)\r
-{\r
- // Given fractions A and B with corresponding errors and the off-diagonal covariance matrix element of\r
- // these fractions, calculate the ratio A/B and the error taking into account the correlation.\r
- // The results are stored in ratio and ratioError.\r
- \r
- if (fractionB < epsilon) {\r
- ratio = -999.;\r
- ratioError = 999.;\r
- \r
- return;\r
- }\r
- \r
- if (fractionA < epsilon) {\r
- ratio = 0.;\r
- ratioError = 999.;\r
- \r
- return;\r
- }\r
- \r
- ratio = fractionA / fractionB;\r
- \r
- const Double_t x = ratio / fractionA;\r
- const Double_t y = -ratio / fractionB;\r
- \r
- // covMatrixElement(i, i) = error(i)^2\r
- ratioError = GetCorrelatedError(x, y, fractionErrorA * fractionErrorA, fractionErrorB * fractionErrorB, covMatrixElementAB); \r
- \r
- //printf("frationA %e\nfractionB %e\nfractionErrorA %e\nfractionErrorB %e\ncovMatrixElementAB %e\nratio %e\nx %e\ny %e\nratioError %e\n\n",\r
- // fractionA, fractionB, fractionErrorA, fractionErrorB, covMatrixElementAB, ratio, x, y, ratioError);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-void SetReasonableAxisRange(TAxis* axis, Int_t mode, Double_t pLow = -1, Double_t pHigh = -1)\r
-{\r
- if (mode == kPMpT)\r
- axis->SetRangeUser(TMath::Max(0.15, pLow - 0.1), TMath::Min(50., pHigh + 0.1));\r
- else if (mode == kPMz)\r
- axis->SetRange(0, -1);\r
- else if (mode == kPMxi)\r
- axis->SetRange(0, -1);\r
-}\r
-\r
-//____________________________________________________________________________________________________________________\r
-void SetReasonableXaxisRange(TH1* h, Int_t& binLow, Int_t& binHigh)\r
-{\r
- binLow = TMath::Max(1, h->FindFirstBinAbove(0));\r
- binHigh = TMath::Min(h->GetNbinsX(), h->FindLastBinAbove(0));\r
- \r
- h->GetXaxis()->SetRange(binLow, binHigh);\r
- h->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- h->GetXaxis()->SetNoExponent(kTRUE);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Int_t FindMomentumBin(const Double_t* pTbins, const Double_t value, const Int_t numPtBins = nPtBins)\r
-{\r
- for (Int_t bin = 0; bin < numPtBins; bin++) {\r
- if (value >= pTbins[bin] && value < pTbins[bin + 1])\r
- return bin;\r
- }\r
- \r
- return -1;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t normaliseHist(TH1* h, Double_t scaleFactor = -1)\r
-{\r
- // Scales the histogram with the scale factor. If the scale factor is < 0,\r
- // the histogram is normalised to it's integral.\r
- // In both cases, the normalisation factor is returned.\r
- \r
- Double_t normFactor = 1.;\r
- \r
- if (scaleFactor < 0) {\r
- Double_t integralTemp = h->Integral();\r
- if (integralTemp > 0) {\r
- normFactor = 1.0 / integralTemp;\r
- h->Scale(normFactor);\r
- }\r
- }\r
- else {\r
- normFactor = scaleFactor;\r
- h->Scale(normFactor);\r
- }\r
- \r
- h->GetXaxis()->SetTitleOffset(1.0);\r
- \r
- return normFactor;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-void normaliseYieldHist(TH1* h, Double_t numEvents, Double_t deta)\r
-{\r
- // Yield histos are already normalised to dpT. Now normalise to 1/NeV 1/(2pi pT) 1/deta in addition\r
- \r
- if (numEvents <= 0) // Do not normalise\r
- numEvents = 1; \r
- \r
- for (Int_t bin = 1; bin <= h->GetNbinsX(); bin++) {\r
- Double_t normFactor = 1. / (numEvents * 2 * TMath::Pi() * h->GetXaxis()->GetBinCenter(bin) * deta);\r
- h->SetBinContent(bin, h->GetBinContent(bin) * normFactor);\r
- h->SetBinError(bin, h->GetBinError(bin) * normFactor);\r
- }\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-void normaliseGenYieldMCtruthHist(TH1* h, Double_t numEvents, Double_t deta)\r
-{\r
- // Yield histos are NOT normalised to dpT. Now normalise to 1/NeV 1/(2pi pT) 1/deta 1/dpT!\r
- \r
- if (numEvents <= 0) // Do not normalise\r
- numEvents = 1; \r
- \r
- for (Int_t bin = 1; bin <= h->GetNbinsX(); bin++) {\r
- Double_t normFactor = 1. / (numEvents * 2 * TMath::Pi() * h->GetXaxis()->GetBinCenter(bin) * h->GetXaxis()->GetBinWidth(bin) * deta);\r
- h->SetBinContent(bin, h->GetBinContent(bin) * normFactor);\r
- h->SetBinError(bin, h->GetBinError(bin) * normFactor);\r
- }\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-void setUpFitFunction(TF1* fitFunc, Int_t nBins, Bool_t noShift = kFALSE)\r
-{\r
- fitFunc->SetLineColor(kGray + 1);\r
- fitFunc->SetLineWidth(2);\r
- fitFunc->SetLineStyle(1);\r
- fitFunc->SetNpx(nBins * 100);\r
- fitFunc->SetParName(0, "Pion fraction");\r
- fitFunc->SetParName(1, "Kaon fraction");\r
- fitFunc->SetParName(2, "Proton fraction");\r
- fitFunc->SetParName(3, "Electron fraction");\r
- fitFunc->SetParName(4, "Muon fraction");\r
- fitFunc->SetParName(5, "Total yield");\r
- if (noShift == kFALSE) {\r
- fitFunc->SetParName(6, "Shift of pion peak");\r
- fitFunc->SetParName(7, "Shift of kaon peak");\r
- fitFunc->SetParName(8, "Shift of proton peak");\r
- fitFunc->SetParName(9, "Shift of electron peak");\r
- fitFunc->SetParName(10, "Shift of muon peak");\r
- }\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Int_t findBinWithinRange(const TAxis* axis, Double_t value)\r
-{\r
- Int_t bin = axis->FindFixBin(value);\r
- if (bin <= 0)\r
- bin = 1;\r
- if (bin > axis->GetNbins())\r
- bin = axis->GetNbins();\r
- \r
- return bin;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t linearInterpolation(const TH1* h, Double_t x, Double_t scaleFactor, Double_t shift, Double_t* error)\r
-{ \r
- // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters.\r
- // The shift also introduces some uncertainty, which is rather hard to estimate. Therefore, just take the maximum error of the involved bins.\r
- const Double_t xShifted = x - shift;\r
-\r
- // Just take value of bin, if beyond center of first/last bin\r
- if (xShifted <= h->GetBinCenter(1)) {\r
- if (error)\r
- *error = h->GetBinError(1) * scaleFactor;\r
- return h->GetBinContent(1) * scaleFactor;\r
- }\r
- else if(xShifted >= h->GetBinCenter(h->GetNbinsX())) {\r
- if (error)\r
- *error = h->GetBinError(h->GetNbinsX()) * scaleFactor;\r
- return h->GetBinContent(h->GetNbinsX()) * scaleFactor;\r
- }\r
- else {\r
- const Int_t xbin = h->FindFixBin(xShifted);\r
- Double_t x0, x1, y0, y1;\r
- \r
- if(xShifted <= h->GetBinCenter(xbin)) {\r
- y0 = h->GetBinContent(xbin - 1);\r
- x0 = h->GetBinCenter(xbin - 1);\r
- y1 = h->GetBinContent(xbin);\r
- x1 = h->GetBinCenter(xbin);\r
- \r
- if (error)\r
- *error = TMath::Max(h->GetBinError(xbin - 1), h->GetBinError(xbin)) * scaleFactor;\r
- } \r
- else {\r
- y0 = h->GetBinContent(xbin);\r
- x0 = h->GetBinCenter(xbin);\r
- y1 = h->GetBinContent(xbin + 1);\r
- x1 = h->GetBinCenter(xbin + 1);\r
- \r
- if (error)\r
- *error = TMath::Max(h->GetBinError(xbin), h->GetBinError(xbin + 1)) * scaleFactor;\r
- }\r
- \r
- return scaleFactor * (y0 + (xShifted - x0) * ((y1 - y0) / (x1 - x0)));\r
- }\r
- \r
- return 0;\r
- \r
- /*Old version available for code bevor 03.05.2013*/\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-void shiftHist(TH1D* h, Double_t shift, Bool_t useRegularisation = kFALSE)\r
-{\r
- // Shift not available for regularisation. Just for convenience (can use the same code and only set one flag)\r
- // call this functions and then do nothing.\r
- // Actually, the shift is not availabe for simultaneous fitting also, but the parameter is just set to 0 there\r
- if (!h || useRegularisation)\r
- return;\r
- \r
- TString name = h->GetName();\r
- TH1D* hTemp = (TH1D*)h->Clone(Form("%s_clone", name.Data()));\r
- h->Reset();\r
- \r
- Double_t error = 0;\r
- for (Int_t i = 1; i <= h->GetNbinsX(); i++) {\r
- // linearInterpolation with scaleFactor = 1.0, since histo is assumed to be properly scaled\r
- h->SetBinContent(i, linearInterpolation(hTemp, h->GetXaxis()->GetBinCenter(i), 1.0, shift, &error));\r
- h->SetBinError(i, error);\r
- }\r
- \r
- delete hTemp;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t multiGaussFitForSimultaneousFitting(const Double_t *xx, const Double_t *par, const Int_t offset)\r
-{\r
- // Offset for reference histos for delta_Species\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- // parXbinIndex (fixed) will be used my mathfit to hold the pT bin index (needed for regularisation)\r
- const Int_t xBinIndex = mathFit->GetXbinIndex();\r
- const Int_t numParsPerXbin = mathFit->GetNumParametersPerXbin();\r
- \r
- const Int_t numRefHistosPerFit = numSimultaneousFits + (takeIntoAccountMuons ? 1 : 0);\r
- const Int_t numRefHistosPerXbin = numRefHistosPerFit * numSimultaneousFits;\r
- \r
- const Int_t refHistOffset = offset * numRefHistosPerFit + xBinIndex * numRefHistosPerXbin;\r
- \r
- const TH1* hRefPi = mathFit->GetRefHisto(0 + refHistOffset);\r
- const TH1* hRefKa = mathFit->GetRefHisto(1 + refHistOffset);\r
- const TH1* hRefPr = mathFit->GetRefHisto(2 + refHistOffset);\r
- const TH1* hRefEl = mathFit->GetRefHisto(3 + refHistOffset);\r
- const TH1* hRefMu = takeIntoAccountMuons ? mathFit->GetRefHisto(4 + refHistOffset) : 0x0;\r
- \r
- if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)\r
- return 0;\r
- \r
- if (takeIntoAccountMuons && !hRefMu)\r
- return 0;\r
- \r
- const Int_t parOffset = xBinIndex * numParsPerXbin;\r
- const Int_t parPi = 0 + parOffset;\r
- const Int_t parKa = 1 + parOffset;\r
- const Int_t parPr = 2 + parOffset;\r
- const Int_t parEl = 3 + parOffset;\r
- const Int_t parMu = 4 + parOffset;\r
- const Int_t parAll = 5 + parOffset;\r
- \r
- const Double_t scaleFactorPi = par[parAll] * (par[parPi] + (muonContamination ? par[parEl] : 0));\r
- const Double_t scaleFactorKa = par[parAll] * par[parKa];\r
- const Double_t scaleFactorPr = par[parAll] * par[parPr];\r
- const Double_t parElFraction = (par[parEl] < 0) ? GetElectronFraction(-par[parEl], par) : par[parEl];\r
- const Double_t scaleFactorEl = par[parAll] * parElFraction;\r
- // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0\r
- const Double_t scaleFactorMu = (par[parMu] < 0)\r
- ? (par[parAll] * GetMuonFractionFromElectronFractionAndPt(-par[parMu], parElFraction)) \r
- : (par[parAll] * par[parMu]);\r
- \r
- // Since one is looking at the same deltaSpecies for all considered species, the reference histograms have the same axes\r
- // => Only need to search for the bin once\r
- const Int_t binWithinRange = findBinWithinRange(hRefPi->GetXaxis(), xx[0]);\r
- const Double_t countPi = scaleFactorPi * hRefPi->GetBinContent(binWithinRange);\r
- const Double_t countKa = scaleFactorKa * hRefKa->GetBinContent(binWithinRange);\r
- const Double_t countPr = scaleFactorPr * hRefPr->GetBinContent(binWithinRange);\r
- const Double_t countEl = scaleFactorEl * hRefEl->GetBinContent(binWithinRange);\r
- const Double_t countMu = takeIntoAccountMuons ? scaleFactorMu * hRefMu->GetBinContent(binWithinRange) : 0;\r
- \r
- const Double_t res = countPi + countKa + countPr + countEl + countMu;\r
- \r
- \r
- return res;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t multiGaussFitDeltaPi(const Double_t *xx, const Double_t *par)\r
-{\r
- return multiGaussFitForSimultaneousFitting(xx, par, 0);\r
-}\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t multiGaussFitDeltaKa(const Double_t *xx, const Double_t *par)\r
-{\r
- return multiGaussFitForSimultaneousFitting(xx, par, 1);\r
-}\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t multiGaussFitDeltaPr(const Double_t *xx, const Double_t *par)\r
-{\r
- return multiGaussFitForSimultaneousFitting(xx, par, 2);\r
-}\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t multiGaussFitDeltaEl(const Double_t *xx, const Double_t *par)\r
-{\r
- return multiGaussFitForSimultaneousFitting(xx, par, 3);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t multiGaussFit(const Double_t *xx, const Double_t *par)\r
-{\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- const TH1* hRefPi = mathFit->GetRefHisto(0);\r
- const TH1* hRefKa = mathFit->GetRefHisto(1);\r
- const TH1* hRefPr = mathFit->GetRefHisto(2);\r
- const TH1* hRefEl = mathFit->GetRefHisto(3);\r
- const TH1* hRefMu = takeIntoAccountMuons ? mathFit->GetRefHisto(4) : 0x0;\r
- \r
- if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)\r
- return 0;\r
- \r
- if (takeIntoAccountMuons && !hRefMu)\r
- return 0; \r
- \r
- // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters\r
- const Double_t scaleFactorPi = par[5] * (par[0] + (muonContamination ? par[3] : 0));\r
- const Double_t scaleFactorKa = par[5] * par[1];\r
- const Double_t scaleFactorPr = par[5] * par[2];\r
- const Double_t parElFraction = (par[3] < 0) ? GetElectronFraction(-par[3], par) : par[3];\r
- const Double_t scaleFactorEl = par[5] * parElFraction;\r
- // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0\r
- const Double_t scaleFactorMu = (par[4] < 0)\r
- ? (par[5] * GetMuonFractionFromElectronFractionAndPt(-par[4], parElFraction)) \r
- : (par[5] * par[4]);\r
-\r
- const Double_t countPi = linearInterpolation(hRefPi, xx[0], scaleFactorPi, par[6], 0x0);\r
- const Double_t countKa = linearInterpolation(hRefKa, xx[0], scaleFactorKa, par[7], 0x0);\r
- const Double_t countPr = linearInterpolation(hRefPr, xx[0], scaleFactorPr, par[8], 0x0);\r
- const Double_t countEl = linearInterpolation(hRefEl, xx[0], scaleFactorEl, par[9], 0x0);\r
- const Double_t countMu = takeIntoAccountMuons ? linearInterpolation(hRefMu, xx[0], scaleFactorMu, par[10], 0x0) : 0;\r
- \r
- const Double_t res = countPi + countKa + countPr + countEl + countMu;\r
- \r
- /*\r
- const Double_t countPi = linearInterpolation(hRefPi, xx[0], par[6], 0x0);\r
- const Double_t countKa = linearInterpolation(hRefKa, xx[0], par[7], 0x0);\r
- const Double_t countPr = linearInterpolation(hRefPr, xx[0], par[8], 0x0);\r
- const Double_t countEl = linearInterpolation(hRefEl, xx[0], par[9], 0x0);\r
- const Double_t countMu = takeIntoAccountMuons ? linearInterpolation(hRefMu, xx[0], par[10], 0x0) : 0; \r
- \r
- const Double_t res = par[5] * ((par[0] + (muonContamination ? par[3] : 0)) * countPi + par[1] * countKa \r
- + par[2] * countPr + par[3] * countEl + par[4] * countMu);\r
-\r
- */\r
- \r
- return res;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t errorOfFitHistosForSimultaneousFitting(const Double_t *xx, const Double_t *par, const Int_t offset)\r
-{\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- Double_t summedError = 0;\r
- \r
- // parXbinIndex (fixed) will be used my mathfit to hold the pT bin index (needed for regularisation)\r
- const Int_t xBinIndex = mathFit->GetXbinIndex();\r
- const Int_t numParsPerXbin = mathFit->GetNumParametersPerXbin();\r
- \r
- const Int_t numRefHistosPerFit = numSimultaneousFits + (takeIntoAccountMuons ? 1 : 0);\r
- const Int_t numRefHistosPerXbin = numRefHistosPerFit * numSimultaneousFits;\r
- \r
- const Int_t refHistOffset = offset * numRefHistosPerFit + xBinIndex * numRefHistosPerXbin;\r
- \r
- const TH1* hRefPi = mathFit->GetRefHisto(0 + refHistOffset);\r
- const TH1* hRefKa = mathFit->GetRefHisto(1 + refHistOffset);\r
- const TH1* hRefPr = mathFit->GetRefHisto(2 + refHistOffset);\r
- const TH1* hRefEl = mathFit->GetRefHisto(3 + refHistOffset);\r
- const TH1* hRefMu = takeIntoAccountMuons ? \r
- mathFit->GetRefHisto(4 + refHistOffset) \r
- : 0x0;\r
- \r
- if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)\r
- return 0;\r
- \r
- if (takeIntoAccountMuons && !hRefMu)\r
- return 0;\r
- \r
- const Int_t parOffset = xBinIndex * numParsPerXbin;\r
- const Int_t parPi = 0 + parOffset;\r
- const Int_t parKa = 1 + parOffset;\r
- const Int_t parPr = 2 + parOffset;\r
- const Int_t parEl = 3 + parOffset;\r
- const Int_t parMu = 4 + parOffset;\r
- const Int_t parAll = 5 + parOffset;\r
- \r
- const Double_t scaleFactorPi = par[parAll] * (par[parPi] + (muonContamination ? par[parEl] : 0));\r
- const Double_t scaleFactorKa = par[parAll] * par[parKa];\r
- const Double_t scaleFactorPr = par[parAll] * par[parPr];\r
- const Double_t scaleFactorEl = par[parAll] * ((par[parEl] < 0) ? GetElectronFraction(-par[parEl], par) : par[parEl]);\r
- // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0\r
- const Double_t scaleFactorMu = (par[parMu] < 0) ? \r
- (scaleFactorEl * GetMuonFractionFromElectronFractionAndPt(-par[parMu], par[parEl]) / par[parEl]) \r
- : (par[parAll] * par[parMu]);\r
- \r
- Double_t errorPi = 0, errorKa = 0, errorPr = 0, errorEl = 0, errorMu = 0;\r
-\r
- // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters\r
- // Shift not implemented for simultaneous fit -> Just set all corresponding parameters to zero\r
- linearInterpolation(hRefPi, xx[0], scaleFactorPi, 0, &errorPi);\r
- linearInterpolation(hRefKa, xx[0], scaleFactorKa, 0, &errorKa);\r
- linearInterpolation(hRefPr, xx[0], scaleFactorPr, 0, &errorPr);\r
- linearInterpolation(hRefEl, xx[0], scaleFactorEl, 0, &errorEl);\r
- if (takeIntoAccountMuons)\r
- linearInterpolation(hRefMu, xx[0], scaleFactorMu, 0, &errorMu);\r
- \r
- summedError += TMath::Power(errorPi, 2);\r
- summedError += TMath::Power(errorKa, 2);\r
- summedError += TMath::Power(errorPr, 2);\r
- summedError += TMath::Power(errorEl, 2);\r
- if (takeIntoAccountMuons)\r
- summedError += TMath::Power(errorMu, 2);\r
- \r
- return summedError;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t errorOfFitHistosDeltaPi(const Double_t *xx, const Double_t *par)\r
-{\r
- return errorOfFitHistosForSimultaneousFitting(xx, par, 0);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t errorOfFitHistosDeltaKa(const Double_t *xx, const Double_t *par)\r
-{\r
- return errorOfFitHistosForSimultaneousFitting(xx, par, 1);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t errorOfFitHistosDeltaPr(const Double_t *xx, const Double_t *par)\r
-{\r
- return errorOfFitHistosForSimultaneousFitting(xx, par, 2);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t errorOfFitHistosDeltaEl(const Double_t *xx, const Double_t *par)\r
-{\r
- return errorOfFitHistosForSimultaneousFitting(xx, par, 3);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t errorOfFitHistos(const Double_t *xx, const Double_t *par)\r
-{\r
- //TODO Error of shift is still not taken into account\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- Double_t summedError = 0;\r
- \r
- const TH1* hRefPi = mathFit->GetRefHisto(0);\r
- const TH1* hRefKa = mathFit->GetRefHisto(1);\r
- const TH1* hRefPr = mathFit->GetRefHisto(2);\r
- const TH1* hRefEl = mathFit->GetRefHisto(3);\r
- const TH1* hRefMu = takeIntoAccountMuons ? mathFit->GetRefHisto(4) : 0x0;\r
-\r
- if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)\r
- return 0;\r
-\r
- if (takeIntoAccountMuons && !hRefMu)\r
- return 0;\r
- \r
- // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters\r
- const Double_t scaleFactorPi = par[5] * (par[0] + (muonContamination ? par[3] : 0));\r
- const Double_t scaleFactorKa = par[5] * par[1];\r
- const Double_t scaleFactorPr = par[5] * par[2];\r
- const Double_t scaleFactorEl = par[5] * ((par[3] < 0) ? GetElectronFraction(-par[3], par) : par[3]);\r
- // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0\r
- const Double_t scaleFactorMu = (par[4] < 0) ? (scaleFactorEl * GetMuonFractionFromElectronFractionAndPt(-par[4], par[3]) / par[3]) \r
- : (par[5] * par[4]);\r
- \r
- Double_t errorPi = 0, errorKa = 0, errorPr = 0, errorEl = 0, errorMu = 0;\r
-\r
- linearInterpolation(hRefPi, xx[0], scaleFactorPi, par[6], &errorPi);\r
- linearInterpolation(hRefKa, xx[0], scaleFactorKa, par[7], &errorKa);\r
- linearInterpolation(hRefPr, xx[0], scaleFactorPr, par[8], &errorPr);\r
- linearInterpolation(hRefEl, xx[0], scaleFactorEl, par[9], &errorEl);\r
- if (takeIntoAccountMuons)\r
- linearInterpolation(hRefMu, xx[0], scaleFactorMu, par[10], &errorMu); // Assume same fraction as electron, i.e. same scale factor\r
- \r
- summedError += TMath::Power(errorPi, 2);\r
- summedError += TMath::Power(errorKa, 2);\r
- summedError += TMath::Power(errorPr, 2);\r
- summedError += TMath::Power(errorEl, 2);\r
- if (takeIntoAccountMuons)\r
- summedError += TMath::Power(errorMu, 2);\r
-\r
- \r
- /*\r
- for (Int_t index = 0; index < mathFit->GetNrefHistos(); index++) {\r
- TH1* HREF = mathFit->GetRefHisto(index);\r
- Int_t bin = findBinWithinRange(HREF->GetXaxis(), xx[0]);\r
- summedError += TMath::Power(HREF->GetBinError(bin) * par[index] * par[mathFit->GetNrefHistos()], 2);\r
- }\r
- */\r
- return summedError;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-inline Double_t saveDivide(Double_t numerator, Double_t denominator) \r
-{\r
- return ((denominator != 0) ? numerator/denominator : 0 );\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getErrorOfPionIntegral(TMatrixDSym covMat)\r
-{\r
- return TMath::Sqrt(covMat(0, 0) + covMat(12, 12) + 2 * covMat(0, 12));\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getErrorOfElectronFraction(Double_t* par, TMatrixDSym covMat) \r
-{\r
- Double_t g = saveDivide(par[3], (par[0] + par[1] + par[2] + 2 * par[3]));\r
- Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));\r
- Double_t s2 = TMath::Power(g, 2) * covMat(3, 3);\r
- Double_t s3 = (4 * TMath::Power(g, 4) - 2 * TMath::Power(g, 3)) * (covMat(3, 2) + covMat(3, 1) + covMat(3, 0));\r
- Double_t s4 = TMath::Power(g, 4) * 2 * (covMat(2, 1) + covMat(2, 0) +covMat(1, 0));\r
- \r
- return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4), par[3]);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getErrorOfKaonFraction(Double_t* par, TMatrixDSym covMat) \r
-{\r
- Double_t g = saveDivide(par[1], (par[0] + par[1] + par[2] + 2 * par[3]));\r
- Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));\r
- Double_t s2 = TMath::Power(g, 2) * covMat(1, 1);\r
- Double_t s3 = TMath::Power(g, 4) * (4 * covMat(3, 0) + 4 * covMat(3, 2) + 4 * covMat(3, 1) +\r
- 2 * covMat(2, 1) + 2 * covMat(2, 0) + 2 * covMat(1, 0));\r
- Double_t s4 = TMath::Power(g, 3) * ((-4) * covMat(3, 1) - 2 * covMat(2, 1) - 2 * covMat(1, 0));\r
- \r
- return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4), par[1]);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getErrorOfPionFraction(Double_t* par, TMatrixDSym covMat) \r
-{\r
- Double_t g = saveDivide(par[0] + par[3], (par[0] + par[1] + par[2] + 2 * par[3]));\r
- Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));\r
- Double_t s2 = TMath::Power(g, 2) * (covMat(0, 0) + covMat(3, 3));\r
- Double_t s3 = TMath::Power(g, 4) * 2 * covMat(2, 1);\r
- Double_t s4 = (4 * TMath::Power(g, 4) - 2 * TMath::Power(g, 3)) * (covMat(3, 2) + covMat(3, 1));\r
- Double_t s5 = 2 * covMat(3, 0) * (2 * TMath::Power(g, 4) - 3 * TMath::Power(g, 3) + TMath::Power(g, 2));\r
- Double_t s6 = 2 * (covMat(2, 0) + covMat(1, 0)) * (TMath::Power(g, 4) - TMath::Power(g, 3));\r
- \r
- return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4 + s5 + s6), par[0] + par[3]);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getErrorOfProtonFraction(Double_t* par, TMatrixDSym covMat) \r
-{\r
- Double_t g = saveDivide(par[2], (par[0] + par[2] + par[1] + 2 * par[3]));\r
- Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));\r
- Double_t s2 = TMath::Power(g, 2) * covMat(2, 2);\r
- Double_t s3 = TMath::Power(g, 4) * (4 * covMat(3, 0) + 4 * covMat(3, 2) + 4 * covMat(3, 1) +\r
- 2 * covMat(2, 1) + 2 * covMat(2, 0) + 2 * covMat(1, 0));\r
- Double_t s4 = TMath::Power(g, 3) * ((-4) * covMat(3, 2) - 2 * covMat(2, 1) - 2 * covMat(2, 0));\r
- \r
- return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4), par[2]);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getErrorOfTotalIntegral(TMatrixDSym covMat) \r
-{\r
- Double_t s1 = covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3);\r
- Double_t s2 = 4 * (covMat(3, 0) + covMat(3, 1) + covMat(3, 2));\r
- Double_t s3 = 2 * (covMat(2, 1) + covMat(2, 0) + covMat(1, 0));\r
-\r
- return TMath::Sqrt(s1 + s2 + s3);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t getMedianOfNonZeros(Double_t input[4])\r
-{\r
- Double_t values[4] = {0,0,0,0};\r
- Int_t numNonZero = 0;\r
- if (input[0] > 0) {\r
- values[numNonZero] = input[0];\r
- numNonZero++;\r
- }\r
- if (input[1] > 0) {\r
- values[numNonZero] = input[1];\r
- numNonZero++;\r
- }\r
- if (input[2] > 0) {\r
- values[numNonZero] = input[2];\r
- numNonZero++;\r
- }\r
- if (input[3] > 0) {\r
- values[numNonZero] = input[3];\r
- numNonZero++;\r
- }\r
- \r
- return ((numNonZero > 0) ? TMath::Median(numNonZero, values) : 0);\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-TCanvas* drawFractionHistos(TString canvName, TString canvTitle, Int_t mode, Double_t pLow, Double_t pHigh, \r
- TH1* histDeltaPion, TH1* histDeltaElectron, TH1* histDeltaKaon, TH1* histDeltaProton, TH1* histMC,\r
- Bool_t plotIdentifiedSpectra)\r
-{\r
- TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);\r
- canv->SetGridx(1);\r
- canv->SetGridy(1);\r
- canv->SetLogx(mode == kPMpT);\r
- histDeltaPion->GetYaxis()->SetRangeUser(0.0, 1.0);\r
- histDeltaPion->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaPion->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaPion->SetMarkerStyle(20);\r
- histDeltaPion->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- histDeltaPion->GetXaxis()->SetNoExponent(kTRUE);\r
- histDeltaPion->Draw("e p");\r
- histDeltaElectron->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaElectron->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaElectron->SetMarkerStyle(21);\r
- histDeltaElectron->Draw("e p same");\r
- histDeltaKaon->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaKaon->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaKaon->SetMarkerStyle(22);\r
- histDeltaKaon->Draw("e p same");\r
- histDeltaProton->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaProton->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaProton->SetMarkerStyle(29);\r
- histDeltaProton->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- histMC->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histMC->GetXaxis(), mode, pLow, pHigh);\r
- histMC->SetMarkerStyle(24);\r
- histMC->Draw("e p same");\r
- }\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- legend->AddEntry(histDeltaPion, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{#pi}}" : "_{#pi}"), "p");\r
- legend->AddEntry(histDeltaElectron, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{e}}" : "_{e}"), "p");\r
- legend->AddEntry(histDeltaKaon, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{K}}" : "_{K}"), "p");\r
- legend->AddEntry(histDeltaProton, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{p}}" : "_{p}"), "p");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(histMC, identifiedLabels[isMC].Data(), "p");\r
- legend->SetEntrySeparation(0.2);\r
- legend->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(canv);\r
- \r
- return canv;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-TCanvas* drawYieldHistos(TString canvName, TString canvTitle, Int_t mode, Double_t pLow, Double_t pHigh, \r
- TH1* histDeltaPion, TH1* histDeltaElectron, TH1* histDeltaKaon, TH1* histDeltaProton, TH1* histMC,\r
- Bool_t plotIdentifiedSpectra)\r
-{\r
- TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);\r
- canv->SetGridx(1);\r
- canv->SetGridy(1);\r
- canv->SetLogx(mode == kPMpT);\r
- canv->SetLogy(1);\r
- histDeltaPion->GetYaxis()->SetRangeUser(histDeltaPion->GetBinContent(histDeltaPion->FindLastBinAbove(0.)) / 10.,\r
- histDeltaPion->GetBinContent(histDeltaPion->GetMaximumBin()) * 10.);\r
- histDeltaPion->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaPion->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaPion->SetMarkerStyle(20);\r
- histDeltaPion->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- histDeltaPion->GetXaxis()->SetNoExponent(kTRUE);\r
- histDeltaPion->Draw("e p");\r
- histDeltaElectron->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaElectron->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaElectron->SetMarkerStyle(21);\r
- histDeltaElectron->Draw("e p same");\r
- histDeltaKaon->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaKaon->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaKaon->SetMarkerStyle(22);\r
- histDeltaKaon->Draw("e p same");\r
- histDeltaProton->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histDeltaProton->GetXaxis(), mode, pLow, pHigh);\r
- histDeltaProton->SetMarkerStyle(29);\r
- histDeltaProton->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- histMC->GetYaxis()->SetTitle(canvTitle.Data());\r
- SetReasonableAxisRange(histMC->GetXaxis(), mode, pLow, pHigh);\r
- histMC->SetMarkerStyle(24);\r
- histMC->Draw("e p same");\r
- }\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- \r
- legend->AddEntry(histDeltaPion, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{#pi}}" : "_{#pi}"), "p");\r
- legend->AddEntry(histDeltaElectron, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{e}}" : "_{e}"), "p");\r
- legend->AddEntry(histDeltaKaon, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{K}}" : "_{K}"), "p");\r
- legend->AddEntry(histDeltaProton, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{p}}" : "_{p}"), "p");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(histMC, identifiedLabels[isMC].Data(), "p");\r
- legend->SetEntrySeparation(0.2);\r
- legend->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(canv);\r
- \r
- return canv;\r
-}\r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Int_t doSimultaneousFitRegularised(Int_t nPar, Double_t* gausParams, Double_t* parameterErrorsOut, Double_t* covMatrix,\r
- Double_t* stepSize, Double_t* lowParLimits, Double_t* upParLimits, Double_t& reducedChiSquare)\r
-{\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- Double_t chiSquare = -999;\r
- Int_t ndf = -1;\r
- \r
- AliTPCPIDmathFit::FitFunc_t* multiGaussFitArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];\r
- multiGaussFitArray[0] = multiGaussFitDeltaPi; \r
- multiGaussFitArray[1] = multiGaussFitDeltaKa; \r
- multiGaussFitArray[2] = multiGaussFitDeltaPr; \r
- multiGaussFitArray[3] = multiGaussFitDeltaEl; \r
- \r
- AliTPCPIDmathFit::FitFunc_t* errorOfFitHistosArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];\r
- errorOfFitHistosArray[0] = errorOfFitHistosDeltaPi; \r
- errorOfFitHistosArray[1] = errorOfFitHistosDeltaKa; \r
- errorOfFitHistosArray[2] = errorOfFitHistosDeltaPr; \r
- errorOfFitHistosArray[3] = errorOfFitHistosDeltaEl; \r
- \r
- //TODO errorFunction for bin errors of fit histos? \r
- Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, 0x0, nPar, gausParams, parameterErrorsOut, covMatrix, \r
- chiSquare, ndf, stepSize, lowParLimits, upParLimits);\r
- //Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, errorOfFitHistosArray, nPar, gausParams, parameterErrorsOut, covMatrix, \r
- // chiSquare, ndf, stepSize, lowParLimits, upParLimits);\r
- \r
- std::cout << std::endl;\r
- \r
- for (Int_t xBin = 0; xBin < mathFit->GetNumXbinsRegularisation(); xBin++) {\r
- std::cout << "x bin " << xBin << ":" << std::endl;\r
- \r
- Double_t sumFractions = 0;\r
- \r
- for (Int_t parIndex = xBin * mathFit->GetNumParametersPerXbin(); parIndex < (xBin + 1) * mathFit->GetNumParametersPerXbin();\r
- parIndex++) {\r
- Int_t parIndexModulo = parIndex % mathFit->GetNumParametersPerXbin();\r
- \r
- // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so\r
- // the error from the matrix would be zero.\r
- // parIndexModulo = 4 means muons, parIndexModulo = 3 means electrons, i.e. if parIndexModulo corresponds to muons,\r
- // then parIndexModulo - 1 corresponds to electrons.\r
- \r
- // Set electron fraction to value evaluated from a function above some threshold.\r
- // Fixed electron fraction < 0 does this job within the fitting functions\r
- if (parIndexModulo == 3 && gausParams[parIndex] < 0) {\r
- gausParams[parIndex] = GetElectronFraction(-gausParams[parIndex], &gausParams[0]);\r
- parameterErrorsOut[parIndex] = GetElectronFractionError();\r
- }\r
- // Set muon fraction equal to electron fraction (or some modified electron fraction) above some threshold,\r
- // which should be a reasonable approximation:\r
- // Fixed muon fraction < 0 does this job within the fitting functions\r
- else if (parIndexModulo == 4 && gausParams[parIndex] < 0) {\r
- gausParams[parIndex] = GetMuonFractionFromElectronFractionAndPt(-gausParams[parIndex], gausParams[parIndex - 1]);\r
- parameterErrorsOut[parIndex] = parameterErrorsOut[parIndex - 1];\r
- } \r
- \r
- \r
- std::cout << "par[" << parIndex << "]: " << gausParams[parIndex] << " +- " << parameterErrorsOut[parIndex] << std::endl;\r
- \r
- if (parIndexModulo <= 3 || ((muonContamination || takeIntoAccountMuons) && parIndexModulo == 4))\r
- sumFractions += gausParams[parIndex];\r
- }\r
- \r
- std::cout << "Sum of fractions" << (muonContamination || takeIntoAccountMuons ? "(including muon contamination)" : "") << ": "\r
- << sumFractions; std::cout << std::endl;\r
- std::cout << std::endl << std::endl;\r
- }\r
- \r
- if (errFlag == 0) \r
- std::cout << std::endl << "***Fit operation completed successfully***" << std::endl << std::endl;\r
- else\r
- std::cout << std::endl << "***Fit operation completed, but with errors***" << std::endl << std::endl;\r
- \r
- reducedChiSquare = (ndf > 0) ? chiSquare / ndf : -1;\r
- \r
- return errFlag;\r
-} \r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Int_t doSimultaneousFit(TH1D** hDelta, Double_t xLow, Double_t xUp, Int_t nPar, Double_t* gausParams, Double_t* parameterErrorsOut, \r
- Double_t* covMatrix, Double_t* stepSize, Double_t* lowParLimits, Double_t* upParLimits, Double_t& \r
- reducedChiSquare)\r
-{\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- Double_t chiSquare = -999;\r
- Int_t ndf = -1;\r
- \r
- //TODO:\r
- // Using no error on x (next TODO line) and no errorFunction (next after next TODO line) sometimes gives good results.\r
- // However, it can completely fail for low statistics for the fit histos.\r
- // Using either an error on x or the errorFunction both gives reasonable results, but might be slightly worse results in some cases\r
- // (shifted/distorted data). Maybe: Choose one method - the rest is for systematic errors of this fitting\r
- \r
- //TODO The next TODO marks are only relevant for chiSquare, but not for loglikelihood\r
- //TODO Use error in x also -> If reference histos have low statistics, this will be very important\r
- \r
- for (Int_t i = 0; i < numSimultaneousFits; i++) {\r
- mathFit->InputData(hDelta[i], 0, i, xLow, xUp, -1., kFALSE); \r
- //mathFit->InputData(hDelta[i], 0, i, xLow, xUp, -1., kTRUE); \r
- }\r
- \r
- AliTPCPIDmathFit::FitFunc_t* multiGaussFitArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];\r
- multiGaussFitArray[0] = multiGaussFitDeltaPi; \r
- multiGaussFitArray[1] = multiGaussFitDeltaKa; \r
- multiGaussFitArray[2] = multiGaussFitDeltaPr; \r
- multiGaussFitArray[3] = multiGaussFitDeltaEl; \r
- \r
- AliTPCPIDmathFit::FitFunc_t* errorOfFitHistosArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];\r
- errorOfFitHistosArray[0] = errorOfFitHistosDeltaPi; \r
- errorOfFitHistosArray[1] = errorOfFitHistosDeltaKa; \r
- errorOfFitHistosArray[2] = errorOfFitHistosDeltaPr; \r
- errorOfFitHistosArray[3] = errorOfFitHistosDeltaEl; \r
- \r
- //TODO errorFunction for bin errors of fit histos? \r
- Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, 0x0, nPar, gausParams, parameterErrorsOut, covMatrix, \r
- chiSquare, ndf, stepSize, lowParLimits, upParLimits);\r
- //Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, errorOfFitHistosArray, nPar, gausParams, parameterErrorsOut, covMatrix, \r
- // chiSquare, ndf, stepSize, lowParLimits, upParLimits);\r
- \r
- std::cout << std::endl;\r
- \r
- // If the electron fraction is fixed, evaluate the error of the extrapolation of the fixed value\r
- if (TMath::Abs(lowParLimits[3] - upParLimits[3]) < epsilon) {\r
- // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so\r
- // the error from the matrix would be zero\r
- parameterErrorsOut[3] = GetElectronFractionError();\r
- }\r
- \r
- // Set muon fraction equal to electron fraction (or some modified electron fraction) above some threshold,\r
- // which should be a reasonable approximation:\r
- // Fixed muon fraction < 0 does this job within the fitting functions\r
- if (gausParams[4] < 0 ) {\r
- // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so\r
- // the error from the matrix would be zero\r
- gausParams[4] = GetMuonFractionFromElectronFractionAndPt(-gausParams[4], gausParams[3]);\r
- parameterErrorsOut[4] = parameterErrorsOut[3];\r
- }\r
- \r
- Double_t sumFractions = 0;\r
- for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {\r
- std::cout << "par[" << parIndex << "]: " << gausParams[parIndex] << " +- " << parameterErrorsOut[parIndex] << std::endl;\r
- }\r
- sumFractions = gausParams[0] + gausParams[1] + gausParams[2] + gausParams[3];\r
- // In case of muon contamination add muon fraction also\r
- if (muonContamination || takeIntoAccountMuons) {\r
- sumFractions += gausParams[4];\r
- }\r
- \r
- std::cout << "Sum of fractions" << (muonContamination || takeIntoAccountMuons ? "(including muon contamination)" : "") << ": " << sumFractions; std::cout << std::endl;\r
- \r
- if (errFlag == 0) \r
- std::cout << std::endl << "***Fit operation completed successfully***" << std::endl << std::endl;\r
- else\r
- std::cout << std::endl << "***Fit operation completed, but with errors***" << std::endl << std::endl;\r
- \r
- reducedChiSquare = (ndf > 0) ? chiSquare / ndf : -1;\r
- \r
- return errFlag;\r
-} \r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Int_t doFit(TH1D* hDelta, Double_t xLow, Double_t xUp, Int_t nPar, Double_t* gausParams, Double_t* parameterErrorsOut, Double_t* covMatrix,\r
- Double_t* stepSize, Double_t* lowParLimits, Double_t* upParLimits, TF1* totalDeltaSpecies, Double_t& reducedChiSquare)\r
-{\r
- AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();\r
- \r
- Double_t chiSquare = -999;\r
- Int_t ndf = -1;\r
- \r
- //TODO:\r
- // Using no error on x (next TODO line) and no errorFunction (next after next TODO line) sometimes gives good results.\r
- // However, it can completely fail for low statistics for the fit histos.\r
- // Using either an error on x or the errorFunction both gives reasonable results, but might be slightly worse results in some cases\r
- // (shifted/distorted data). Maybe: Choose one method - the rest is for systematic errors of this fitting\r
- \r
- //TODO The next TODO marks are only relevant for chiSquare, but not for loglikelihood\r
- //TODO Use error in x also -> If reference histos have low statistics, this will be very important\r
- mathFit->InputData(hDelta, 0, 0, xLow, xUp, -1., kFALSE); \r
- //mathFit->InputData(hDelta, 0, 0, xLow, xUp, -1., kTRUE); \r
- \r
- AliTPCPIDmathFit::FitFunc_t* multiGaussFitArray = new AliTPCPIDmathFit::FitFunc_t[1];\r
- multiGaussFitArray[0] = multiGaussFit; \r
- \r
- AliTPCPIDmathFit::FitFunc_t* errorOfFitHistosArray = new AliTPCPIDmathFit::FitFunc_t[1];\r
- errorOfFitHistosArray[0] = errorOfFitHistos;\r
- \r
- //TODO errorFunction for bin errors of fit histos?\r
- Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, 0x0, nPar, gausParams, parameterErrorsOut, covMatrix, \r
- chiSquare, ndf, stepSize, lowParLimits, upParLimits);\r
- //Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, errorOfFitHistosArray, nPar, gausParams, parameterErrorsOut, covMatrix, \r
- // chiSquare, ndf, stepSize, lowParLimits, upParLimits);\r
- \r
- // If the electron fraction is fixed, evaluate the error of the extrapolation of the fixed value\r
- if (TMath::Abs(lowParLimits[3] - upParLimits[3]) < epsilon) {\r
- // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so\r
- // the error from the matrix would be zero\r
- parameterErrorsOut[3] = GetElectronFractionError();\r
- }\r
- \r
- // Set muon fraction equal to electron fraction (or some modified electron fraction) above some threshold, which should be a reasonable approximation:\r
- // Fixed muon fraction < 0 does this job within the fitting functions\r
- if (gausParams[4] < 0 ) {\r
- // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so\r
- // the error from the matrix would be zero\r
- gausParams[4] = GetMuonFractionFromElectronFractionAndPt(-gausParams[4], gausParams[3]);\r
- parameterErrorsOut[4] = parameterErrorsOut[3];\r
- }\r
- \r
- Double_t sumFractions = 0;\r
- for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {\r
- std::cout << totalDeltaSpecies->GetParName(parIndex) << ": " << gausParams[parIndex] << " +- " << parameterErrorsOut[parIndex] << std::endl;\r
- }\r
- sumFractions = gausParams[0] + gausParams[1] + gausParams[2] + gausParams[3];\r
- // In case of muon contamination add muon fraction also\r
- if (muonContamination || takeIntoAccountMuons) {\r
- sumFractions += gausParams[4];\r
- }\r
- \r
- std::cout << "Sum of fractions" << (muonContamination || takeIntoAccountMuons ? "(including muon contamination)" : "") << ": " << sumFractions;\r
- std::cout << std::endl;\r
- \r
- if (errFlag == 0) \r
- std::cout << std::endl << "***Fit operation completed successfully***" << std::endl << std::endl;\r
- else\r
- std::cout << std::endl << "***Fit operation completed, but with errors***" << std::endl << std::endl;\r
- \r
- for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {\r
- totalDeltaSpecies->SetParameter(parIndex, gausParams[parIndex]);\r
- totalDeltaSpecies->SetParError(parIndex, parameterErrorsOut[parIndex]);\r
- }\r
- \r
- reducedChiSquare = (ndf > 0) ? chiSquare / ndf : -1;\r
- \r
- return errFlag;\r
-} \r
-\r
-\r
-//____________________________________________________________________________________________________________________\r
-Double_t setFractionsAndYields(Int_t slice, Double_t inverseBinWidth, Double_t binWidthFitHisto, Int_t species, Double_t* parametersOut, \r
- Double_t* parameterErrorsOut, TH1* hFractionSpecies, TH1* hFractionPionsDeltaSpecies, \r
- TH1* hFractionElectronsDeltaSpecies, TH1* hFractionKaonsDeltaSpecies, TH1* hFractionProtonsDeltaSpecies,\r
- TH1* hFractionMuonsDeltaSpecies, TH1* hYieldSpecies, TH1* hYieldPionsDeltaSpecies,\r
- TH1* hYieldElectronsDeltaSpecies, TH1* hYieldKaonsDeltaSpecies, TH1* hYieldProtonsDeltaSpecies,\r
- TH1* hYieldMuonsDeltaSpecies, \r
- Bool_t normaliseFractions = kFALSE)\r
-{\r
- // Set fraction and yields in corresponding histograms. If normaliseFractions is kTRUE, the fractions will be normalised to unity\r
- // and the normalisation factor will be returned (i.e. 1./sumFraction)\r
- \r
- Double_t normalisationFactor = 1.0;\r
- \r
- // Since a log likelihood fit is anyway used, the normalisation should give a factor close to unity\r
- if (normaliseFractions) {\r
- Double_t sumFractions = parametersOut[0] + (muonContamination ? parametersOut[3] : 0) + parametersOut[1] + parametersOut[2] +\r
- parametersOut[3] + (takeIntoAccountMuons ? parametersOut[4] : 0.);\r
- if (sumFractions > 0) {\r
- normalisationFactor = 1./sumFractions;\r
- for (Int_t i = 0; i < 5; i++) {\r
- parametersOut[i] *= normalisationFactor;\r
- \r
- // Do not introduce an error for the normalisation, i.e. just scale parameters and fractions with the same factor which is \r
- // assumed to be exact.\r
- // Note that correlations should already be included in the parameterError \r
- parameterErrorsOut[i] *= normalisationFactor;\r
- }\r
- }\r
- }\r
- \r
- Double_t sumOfParticles = inverseBinWidth * parametersOut[5] / binWidthFitHisto; // Divide by binWidthFitHisto since parametersOut includes this width\r
- \r
- if (species == kPi) {\r
- hFractionSpecies->SetBinContent(slice + 1, (parametersOut[0]+(muonContamination ? parametersOut[3] : 0)));\r
- hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[0]);\r
- }\r
- else if (species == kEl) {\r
- hFractionSpecies->SetBinContent(slice + 1, parametersOut[3]);\r
- hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[3]);\r
- }\r
- else if (species == kKa) { \r
- hFractionSpecies->SetBinContent(slice + 1, parametersOut[1]);\r
- hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[1]);\r
- }\r
- else if (species == kPr) { \r
- hFractionSpecies->SetBinContent(slice + 1, parametersOut[2]);\r
- hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[2]);\r
- }\r
- else if (species == kMu) {\r
- if (takeIntoAccountMuons) { \r
- hFractionSpecies->SetBinContent(slice + 1, parametersOut[4]);\r
- hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[4]);\r
- \r
- hYieldSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionSpecies->GetBinContent(slice + 1));\r
- hYieldSpecies->SetBinError(slice + 1, sumOfParticles * hFractionSpecies->GetBinError(slice + 1));\r
- }\r
- \r
- // Only set these histos for muons. The DeltaSpecies histos for muons will be set together with all other species\r
- return normalisationFactor;\r
- }\r
- \r
- hFractionPionsDeltaSpecies->SetBinContent(slice + 1, (parametersOut[0]+(muonContamination ? parametersOut[3] : 0)));\r
- hFractionPionsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[0]);//TODO What about error of parOut[3]?\r
- hFractionElectronsDeltaSpecies->SetBinContent(slice + 1, parametersOut[3]);\r
- hFractionElectronsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[3]);\r
- hFractionKaonsDeltaSpecies->SetBinContent(slice + 1, parametersOut[1]);\r
- hFractionKaonsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[1]);\r
- hFractionProtonsDeltaSpecies->SetBinContent(slice + 1, parametersOut[2]);\r
- hFractionProtonsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[2]);\r
- if (takeIntoAccountMuons) {\r
- hFractionMuonsDeltaSpecies->SetBinContent(slice + 1, parametersOut[4]);\r
- hFractionMuonsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[4]);\r
- }\r
- \r
- hYieldSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionSpecies->GetBinContent(slice + 1));\r
- hYieldSpecies->SetBinError(slice + 1, sumOfParticles * hFractionSpecies->GetBinError(slice + 1));\r
- \r
- hYieldPionsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaSpecies->GetBinContent(slice + 1));\r
- hYieldPionsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaSpecies->GetBinError(slice + 1));\r
- hYieldElectronsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaSpecies->GetBinContent(slice + 1));\r
- hYieldElectronsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaSpecies->GetBinError(slice + 1));\r
- hYieldKaonsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaSpecies->GetBinContent(slice + 1));\r
- hYieldKaonsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaSpecies->GetBinError(slice + 1));\r
- hYieldProtonsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaSpecies->GetBinContent(slice + 1));\r
- hYieldProtonsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaSpecies->GetBinError(slice + 1));\r
- if (takeIntoAccountMuons) {\r
- hYieldMuonsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaSpecies->GetBinContent(slice + 1));\r
- hYieldMuonsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaSpecies->GetBinError(slice + 1));\r
- }\r
- \r
- return normalisationFactor;\r
-}\r
-\r
-//____________________________________________________________________________________________________________________\r
-Int_t PID(TString fileName, Double_t deta, Double_t pLow, Double_t pHigh, Bool_t isMCdataSet, Int_t fitMethod, \r
- Int_t muonFractionHandlingParameter, //0 = no muons, 1 = muonFrac=elFrac,\r
- //2(3) = muonFrac/elFrac tuned on MC for StandardTrackCuts(HybridTrackCuts)\r
- Bool_t useIdentifiedGeneratedSpectra, Bool_t plotIdentifiedSpectra, Int_t mode/*0=pT,1=z,2=xi*/,\r
- Int_t chargeMode /*kNegCharge = -1, kAllCharged = 0, kPosCharge = 1*/,\r
- Double_t lowerCentrality /*= -2*/, Double_t upperCentrality /*= -2*/,\r
- Double_t lowerJetPt /*= -1*/ , Double_t upperJetPt/* = -1*/,\r
- Int_t rebin/* = 1 -> DON'T USE FOR PT (will not work since binsPt will and should be used!)*/,\r
- Int_t rebinDeltaPrime/* = 1*/,\r
- TString listName /* = "bhess_PID"*/,\r
- Bool_t useLogLikelihood /*= kTRUE*/, Bool_t useWeightsForLogLikelihood /*= kFALSE*/,\r
- Int_t regularisation /*= 0*/,\r
- Double_t regularisationFactor /*= 1*/,\r
- TString filePathNameFileWithInititalFractions /*= ""*/,\r
- TString* filePathNameResults /*= 0x0*/) \r
-{\r
- // Do all the fitting\r
- \r
- isMC = isMCdataSet;\r
- \r
- muonFractionHandling = muonFractionHandlingParameter;\r
- \r
- Int_t genAxis = useDeltaPrime ? kPidGenDeltaPrime : 1000/*kPidGenDelta*/;\r
- if (!useDeltaPrime) {\r
- std::cout << "ERROR: delta plots no longer available!" << std::endl;\r
- return -1;\r
- }\r
- \r
- if (listName == "") {\r
- listName = fileName;\r
- listName.Replace(0, listName.Last('/') + 1, "");\r
- listName.ReplaceAll(".root", "");\r
- }\r
- \r
- \r
- if (rebin > 1 && mode == kPMpT) {\r
- std::cout << "ERROR: Requested re-binning of pT-axis! Since binsPt will be used, re-binning the data histo will lead to "\r
- << "unforeseen consequences!" << std::endl;\r
- return -1;\r
- }\r
- \r
- Int_t pSliceLow = -1;\r
- Int_t pSliceHigh = -1;\r
- \r
- Int_t axisForMode = kPidPt;\r
- Int_t axisGenForMode = kPidGenPt;\r
- \r
- std::cout << "Fitting \"" << fileName.Data() << "\" with settings:" << std::endl;\r
- \r
- std::cout << "Minimisation strategy: " << minimisationStrategy.Data() << std::endl;\r
- if (useLogLikelihood) \r
- std::cout << "Binned loglikelihood fit" << (useWeightsForLogLikelihood ? " (weighted)" : "") << std::endl;\r
- else\r
- std::cout << "ChiSquare fit" << std::endl;\r
- std::cout << "Processing mode: ";\r
- if (mode == kPMpT)\r
- std::cout << "pT" << std::endl;\r
- else if (mode == kPMz) {\r
- std::cout << "z" << std::endl;\r
- axisForMode = kPidZ;\r
- axisGenForMode = kPidGenZ;\r
- }\r
- else if (mode == kPMxi) {\r
- std::cout << "xi" << std::endl;\r
- axisForMode = kPidXi;\r
- axisGenForMode = kPidGenXi;\r
- }\r
- else {\r
- std::cout << "Unknown -> ERROR" << std::endl;\r
- return -1;\r
- }\r
- \r
- std::cout << "Charge selection: ";\r
- if (chargeMode == kAllCharged)\r
- std::cout << "All charged particles" << std::endl;\r
- else if (chargeMode == kNegCharge)\r
- std::cout << "Negative particles only" << std::endl;\r
- else if (chargeMode == kPosCharge)\r
- std::cout << "Positive particles only" << std::endl;\r
- else {\r
- std::cout << "Unknown -> ERROR" << std::endl;\r
- return -1;\r
- }\r
- \r
- const Bool_t restrictCharge = (chargeMode != kAllCharged);\r
- \r
- if (regularisation > 0)\r
- std::cout << "Regularisation with +-" << regularisation << " bins and factor " << regularisationFactor << " for penalty term."\r
- << std::endl;\r
- else\r
- std::cout << "No regularisation" << std::endl;\r
- \r
- std::cout << "Assumption on muon fraction: ";\r
- if (muonFractionHandlingParameter >= 0 && muonFractionHandlingParameter < kNumHandlings)\r
- std::cout << muonFractionHandlingShortName[muonFractionHandlingParameter].Data() << std::endl;\r
- /*if (muonFractionHandlingParameter == kNoMuons)\r
- std::cout << "Identical zero" << std::endl;\r
- else if (muonFractionHandlingParameter == kMuonFracEqualElFrac)\r
- std::cout << "Equal electron fraction" << std::endl;\r
- else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCStandardTrackCuts)\r
- std::cout << "Ratio to electron fraction tuned on MC for standard track cuts" << std::endl;\r
- else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCHybridTrackCuts)\r
- std::cout << "Ratio to electron fraction tuned on MC for hybrid track cuts" << std::endl;\r
- else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCHybridTrackCutsJets)\r
- std::cout << "Ratio to electron fraction tuned on MC for hybrid track cuts for jet particles" << std::endl;\r
- else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCHybridTrackCutsJets)\r
- std::cout << "Ratio to electron fraction tuned on MC for hybrid track cuts for jet particles" << std::endl;*/\r
- else {\r
- std::cout << "Unknown -> ERROR" << std::endl;\r
- return -1;\r
- }\r
- \r
- if (mode == kPMpT) {\r
- Int_t index = 0;\r
- while (pLow >= binsPt[index] && index < nPtBins)\r
- index++;\r
- pSliceLow = index - 1;\r
- \r
- index = 0;\r
- while (pHigh > binsPt[index] && index < nPtBins)\r
- index++;\r
- pSliceHigh = index - 1;\r
- \r
- Int_t numMomIntervals = pSliceHigh - pSliceLow + 1;\r
- \r
- if (numMomIntervals <= 0 || pSliceLow < 0 || pSliceHigh > nPtBins) {\r
- std::cout << "Wrong choice of limits pLow/pHigh!" << std::endl;\r
- return -1;\r
- }\r
- \r
- pLow = binsPt[pSliceLow];\r
- pHigh = binsPt[pSliceHigh + 1]; // need upper edge, but binsPt holds lower edge\r
- std::cout << "pLow/pHigh: ";\r
- std::cout << pLow << " / " << pHigh << std::endl;\r
- }\r
- \r
- Bool_t initialiseWithFractionsFromFile = kFALSE;\r
- TFile* fInitialFractions = 0x0;\r
- TH1 *hInitFracEl = 0x0, *hInitFracKa = 0x0, *hInitFracPi = 0x0, *hInitFracMu = 0x0, *hInitFracPr = 0x0;\r
- \r
- if (filePathNameFileWithInititalFractions != "") {\r
- initialiseWithFractionsFromFile = kTRUE;\r
- \r
- std::cout << "Initialising fractions from file: " << filePathNameFileWithInititalFractions.Data() << std::endl;\r
- }\r
- else\r
- std::cout << "Not initialising fractions from file" << std::endl;\r
-\r
- if (initialiseWithFractionsFromFile) {\r
- fInitialFractions = TFile::Open(filePathNameFileWithInititalFractions.Data());\r
- if (!fInitialFractions) {\r
- std::cout << std::endl;\r
- std::cout << "Failed to open file with initial fractions \"" << filePathNameFileWithInititalFractions.Data() << "\"!"\r
- << std::endl;\r
- return -1;\r
- }\r
- \r
- hInitFracEl = (TH1*)fInitialFractions->Get("hFractionElectrons");\r
- hInitFracKa = (TH1*)fInitialFractions->Get("hFractionKaons");\r
- hInitFracPi = (TH1*)fInitialFractions->Get("hFractionPions");\r
- hInitFracMu = (TH1*)fInitialFractions->Get("hFractionMuons");\r
- hInitFracPr = (TH1*)fInitialFractions->Get("hFractionProtons");\r
- \r
- if (!hInitFracEl || ! hInitFracKa || ! hInitFracPi || ! hInitFracMu || ! hInitFracPr) {\r
- std::cout << std::endl;\r
- std::cout << "Failed to load initial fractions from file \"" << filePathNameFileWithInititalFractions.Data() << "\"!"\r
- << std::endl;\r
- \r
- fInitialFractions->Close();\r
- return -1;\r
- }\r
- }\r
- \r
- \r
- \r
- TObjArray* histList = 0x0;\r
- \r
- TFile* f = TFile::Open(fileName.Data());\r
- if (!f) {\r
- std::cout << std::endl;\r
- std::cout << "Failed to open file \"" << fileName.Data() << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- //TString listName = fileName;\r
- //listName = listName.ReplaceAll(".root", "");\r
- //listName = listName.Remove(1, listName.Last('/') + 1);\r
- histList = (TObjArray*)(f->Get(listName.Data()));\r
- if (!histList) {\r
- std::cout << std::endl;\r
- std::cout << "Failed to load list \"" << listName.Data() << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- // Extract the data histogram\r
- THnSparse* hPIDdata = dynamic_cast<THnSparse*>(histList->FindObject("hPIDdataAll"));\r
- if (!hPIDdata) {\r
- std::cout << std::endl;\r
- std::cout << "Failed to load data histo!" << std::endl;\r
- return -1;\r
- }\r
- \r
- // If desired, rebin considered axis\r
- if (rebin > 1 || rebinDeltaPrime > 1) {\r
- const Int_t nDimensions = hPIDdata->GetNdimensions();\r
- Int_t rebinFactor[nDimensions];\r
- \r
- for (Int_t dim = 0; dim < nDimensions; dim++) {\r
- if (dim == axisForMode && rebin > 1)\r
- rebinFactor[dim] = rebin;\r
- else if (dim == kPidDeltaPrime && rebinDeltaPrime > 1)\r
- rebinFactor[dim] = rebinDeltaPrime;\r
- else\r
- rebinFactor[dim] = 1;\r
- }\r
- \r
- THnSparse* temp = hPIDdata->Rebin(&rebinFactor[0]);\r
- hPIDdata->Reset();\r
- hPIDdata = temp;\r
- }\r
- \r
- // Set proper errors, if not yet calculated\r
- if (!hPIDdata->GetCalculateErrors()) {\r
- std::cout << "Re-calculating errors of " << hPIDdata->GetName() << "..." << std::endl;\r
- hPIDdata->Sumw2();\r
- Long64_t nBinsTHnSparse = hPIDdata->GetNbins();\r
- Double_t binContent = 0;\r
- \r
- for (Long64_t bin = 0; bin < nBinsTHnSparse; bin++) {\r
- binContent = hPIDdata->GetBinContent(bin);\r
- hPIDdata->SetBinError(bin, TMath::Sqrt(binContent));\r
- }\r
- }\r
- \r
- \r
- // If desired, restrict centrality axis\r
- Int_t lowerCentralityBinLimit = -1;\r
- Int_t upperCentralityBinLimit = -1;\r
- Bool_t restrictCentralityAxis = kFALSE;\r
- Double_t actualLowerCentrality = -1.;\r
- Double_t actualUpperCentrality = -1.;\r
- \r
- if (lowerCentrality >= -1 && upperCentrality >= -1) {\r
- // Add subtract a very small number to avoid problems with values right on the border between to bins\r
- lowerCentralityBinLimit = hPIDdata->GetAxis(kPidCentrality)->FindBin(lowerCentrality + 0.001);\r
- upperCentralityBinLimit = hPIDdata->GetAxis(kPidCentrality)->FindBin(upperCentrality - 0.001);\r
- \r
- // Check if the values look reasonable\r
- if (lowerCentralityBinLimit <= upperCentralityBinLimit && lowerCentralityBinLimit >= 1\r
- && upperCentralityBinLimit <= hPIDdata->GetAxis(kPidCentrality)->GetNbins()) {\r
- actualLowerCentrality = hPIDdata->GetAxis(kPidCentrality)->GetBinLowEdge(lowerCentralityBinLimit);\r
- actualUpperCentrality = hPIDdata->GetAxis(kPidCentrality)->GetBinUpEdge(upperCentralityBinLimit);\r
-\r
- restrictCentralityAxis = kTRUE;\r
- }\r
- else {\r
- std::cout << std::endl;\r
- std::cout << "Requested centrality range out of limits or upper and lower limit are switched!" << std::endl;\r
- return -1;\r
- }\r
- }\r
- \r
- std::cout << "centrality: ";\r
- if (restrictCentralityAxis) {\r
- std::cout << actualLowerCentrality << " - " << actualUpperCentrality << std::endl;\r
- }\r
- else {\r
- std::cout << "All" << std::endl;\r
- }\r
- \r
- if (restrictCentralityAxis) {\r
- hPIDdata->GetAxis(kPidCentrality)->SetRange(lowerCentralityBinLimit, upperCentralityBinLimit);\r
- }\r
- \r
- \r
- \r
- // If desired, restrict jetPt axis\r
- Int_t lowerJetPtBinLimit = -1;\r
- Int_t upperJetPtBinLimit = -1;\r
- Bool_t restrictJetPtAxis = kFALSE;\r
- Double_t actualLowerJetPt = -1.;\r
- Double_t actualUpperJetPt = -1.;\r
- \r
- if (lowerJetPt >= 0 && upperJetPt >= 0) {\r
- // Add subtract a very small number to avoid problems with values right on the border between to bins\r
- lowerJetPtBinLimit = hPIDdata->GetAxis(kPidJetPt)->FindBin(lowerJetPt + 0.001);\r
- upperJetPtBinLimit = hPIDdata->GetAxis(kPidJetPt)->FindBin(upperJetPt - 0.001);\r
- \r
- // Check if the values look reasonable\r
- if (lowerJetPtBinLimit <= upperJetPtBinLimit && lowerJetPtBinLimit >= 1 && upperJetPtBinLimit <= hPIDdata->GetAxis(kPidJetPt)->GetNbins()) {\r
- actualLowerJetPt = hPIDdata->GetAxis(kPidJetPt)->GetBinLowEdge(lowerJetPtBinLimit);\r
- actualUpperJetPt = hPIDdata->GetAxis(kPidJetPt)->GetBinUpEdge(upperJetPtBinLimit);\r
-\r
- restrictJetPtAxis = kTRUE;\r
- }\r
- else {\r
- std::cout << std::endl;\r
- std::cout << "Requested jet pT range out of limits or upper and lower limit are switched!" << std::endl;\r
- return -1;\r
- }\r
- }\r
- \r
- std::cout << "jet pT: ";\r
- if (restrictJetPtAxis) {\r
- std::cout << actualLowerJetPt << " - " << actualUpperJetPt << std::endl;\r
- }\r
- else {\r
- std::cout << "All" << std::endl;\r
- }\r
- \r
- if (restrictJetPtAxis) {\r
- hPIDdata->GetAxis(kPidJetPt)->SetRange(lowerJetPtBinLimit, upperJetPtBinLimit);\r
- }\r
- \r
- \r
- // If desired, restrict charge axis\r
- const Int_t indexChargeAxisData = GetAxisByTitle(hPIDdata, "Charge (e_{0})");\r
- if (indexChargeAxisData < 0 && restrictCharge) {\r
- std::cout << "Error: Charge axis not found for data histogram!" << std::endl;\r
- return -1;\r
- }\r
- Int_t lowerChargeBinLimitData = -1;\r
- Int_t upperChargeBinLimitData = -2;\r
- Double_t actualLowerChargeData = -999;\r
- Double_t actualUpperChargeData = -999;\r
- \r
- if (restrictCharge) {\r
- // Add subtract a very small number to avoid problems with values right on the border between to bins\r
- if (chargeMode == kNegCharge) {\r
- lowerChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(-1. + 0.001);\r
- upperChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(0. - 0.001);\r
- }\r
- else if (chargeMode == kPosCharge) {\r
- lowerChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(0. + 0.001);\r
- upperChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(1. - 0.001);\r
- }\r
- \r
- // Check if the values look reasonable\r
- if (lowerChargeBinLimitData <= upperChargeBinLimitData && lowerChargeBinLimitData >= 1\r
- && upperChargeBinLimitData <= hPIDdata->GetAxis(indexChargeAxisData)->GetNbins()) {\r
- actualLowerChargeData = hPIDdata->GetAxis(indexChargeAxisData)->GetBinLowEdge(lowerChargeBinLimitData);\r
- actualUpperChargeData = hPIDdata->GetAxis(indexChargeAxisData)->GetBinUpEdge(upperChargeBinLimitData);\r
- \r
- std::cout << "Charge range data: " << actualLowerChargeData << " - " << actualUpperChargeData << std::endl;\r
- }\r
- else {\r
- std::cout << std::endl;\r
- std::cout << "Requested charge range out of limits or upper and lower limit are switched!" << std::endl;\r
- return -1;\r
- }\r
- \r
- hPIDdata->GetAxis(indexChargeAxisData)->SetRange(lowerChargeBinLimitData, upperChargeBinLimitData);\r
- }\r
- \r
- std::cout << std::endl;\r
- \r
- \r
- \r
- // Open file in which all the projections (= intermediate results) will be saved\r
- TString saveInterFName = fileName;\r
- TString chargeString = "";\r
- if (chargeMode == kPosCharge)\r
- chargeString = "_posCharge";\r
- else if (chargeMode == kNegCharge)\r
- chargeString = "_negCharge";\r
- \r
- saveInterFName = Form("%s_Projections_%s_%d_%s%s%s%s%s.root", saveInterFName.ReplaceAll(".root", "").Data(), \r
- modeShortName[mode].Data(),\r
- fitMethod, muonFractionHandlingShortName[muonFractionHandlingParameter].Data(),\r
- useIdentifiedGeneratedSpectra ? "_idSpectra" : "",\r
- restrictCentralityAxis ? Form("_centrality%.0f_%.0f", actualLowerCentrality, actualUpperCentrality) : "",\r
- restrictJetPtAxis ? Form("_jetPt%.1f_%.1f", actualLowerJetPt, actualUpperJetPt) : "",\r
- chargeString.Data());\r
- TFile *saveInterF = TFile::Open(saveInterFName.Data(), "RECREATE");\r
- saveInterF->cd();\r
-\r
- // TH1 hist with number of processed events\r
- Double_t numEvents = -1;\r
- TH1* hNumEvents = dynamic_cast<TH1*>(histList->FindObject("fhEventsProcessed"));\r
- if (!hNumEvents) {\r
- std::cout << std::endl;\r
- std::cout << "Histo with number of processed events not found! Yields will NOT be normalised to this number!" << std::endl \r
- << std::endl;\r
- }\r
- else {\r
- numEvents = restrictCentralityAxis ? hNumEvents->Integral(lowerCentralityBinLimit, upperCentralityBinLimit) : \r
- hNumEvents->Integral();\r
- \r
- if (numEvents <= 0) {\r
- numEvents = -1;\r
- std::cout << std::endl;\r
- std::cout << "Number of processed events < 1 in selected range! Yields will NOT be normalised to this number!"\r
- << std::endl << std::endl;\r
- }\r
- }\r
- \r
- \r
- // TH1D hist with total yield per pT bin (-> project to arbitrary selectSpecies to avoid multiple counting)\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(1, 1);\r
- TH1D* hYieldPt = hPIDdata->Projection(axisForMode, "e");\r
- hYieldPt->SetName(Form("hYield%s", modeShortName[mode].Data()));\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1);\r
- \r
- \r
- // Fill \Delta\species histograms for each momentum slice\r
- Int_t nBins = hPIDdata->GetAxis(dataAxis)->GetNbins();\r
- Double_t xLow = hPIDdata->GetAxis(dataAxis)->GetXmin();\r
- Double_t xUp = hPIDdata->GetAxis(dataAxis)->GetXmax();\r
- \r
- const Int_t numSlices = (mode == kPMpT) ? nPtBins : hPIDdata->GetAxis(axisForMode)->GetNbins();\r
- \r
- TH1D* hDeltaPi[numSlices];\r
- TH1D* hDeltaEl[numSlices];\r
- TH1D* hDeltaKa[numSlices];\r
- TH1D* hDeltaPr[numSlices]; \r
- \r
- TH1D* hDeltaPiFitQA[numSlices];\r
- TH1D* hDeltaElFitQA[numSlices];\r
- TH1D* hDeltaKaFitQA[numSlices];\r
- TH1D* hDeltaPrFitQA[numSlices];\r
- \r
- const Int_t nMCbins = 5;\r
- TH1D* hDeltaPiMC[numSlices][nMCbins];\r
- TH1D* hDeltaElMC[numSlices][nMCbins];\r
- TH1D* hDeltaKaMC[numSlices][nMCbins];\r
- TH1D* hDeltaPrMC[numSlices][nMCbins]; \r
- \r
- \r
- TH2D* h2Delta[4];\r
- TH2D* h2DeltaMC[4][nMCbins];\r
- \r
- for (Int_t i = 0; i < 4; i++) {\r
- TString speciesLabel = hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(i + 1);\r
- \r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(i + 1, i + 1);\r
- h2Delta[i] = hPIDdata->Projection(dataAxis, axisForMode, "e");\r
- h2Delta[i]->SetName(Form("h2Delta_%s", speciesLabel.Data()));\r
- h2Delta[i]->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());\r
- h2Delta[i]->GetYaxis()->SetTitle(Form("#Delta%s_{%s} = dE/dx %s <dE/dx>_{%s} (arb. units)", useDeltaPrime ? "'" : "", speciesLabel.Data(),\r
- useDeltaPrime ? "/" : "-", speciesLabel.Data()));\r
- \r
- for (Int_t species = 0; species < nMCbins; species++) {\r
- hPIDdata->GetAxis(kPidMCpid)->SetRange(species + 1, species + 1); // Select MC species\r
- h2DeltaMC[i][species] = hPIDdata->Projection(dataAxis, axisGenForMode, "e");\r
- h2DeltaMC[i][species]->SetName(Form("h2Delta_MC_%s", speciesLabel.Data()));\r
- h2DeltaMC[i][species]->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisGenForMode)->GetTitle());\r
- h2DeltaMC[i][species]->GetYaxis()->SetTitle(h2Delta[i]->GetYaxis()->GetTitle());\r
- }\r
- hPIDdata->GetAxis(kPidMCpid)->SetRange(0, -1);\r
- }\r
- \r
- Int_t firstValidSlice = -1;\r
- for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hPIDdata->GetAxis(axisForMode)->GetNbins(); slice++) { \r
- if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))\r
- continue; \r
- \r
- if (firstValidSlice < 0)\r
- firstValidSlice = slice;\r
- \r
- // Add/subtract some very small offset to be sure not to sit on the bin boundary, when looking for the integration/projection limits.\r
- // For modes different from pT, just take 1 bin\r
- const Int_t pBinLowProjLimit = (mode == kPMpT) ? h2Delta[0]->GetXaxis()->FindBin(binsPt[slice] + 1e-5) : slice + 1;\r
- const Int_t pBinUpProjLimit = (mode == kPMpT) ? h2Delta[0]->GetXaxis()->FindBin(binsPt[slice + 1]- 1e-5) : slice + 1;\r
- \r
- const TString binInfo = (mode == kPMpT) ? Form("%.2f_Pt_%.2f", binsPt[slice], binsPt[slice + 1])\r
- : Form("%.2f_%s_%.2f", hPIDdata->GetAxis(axisForMode)->GetBinLowEdge(pBinLowProjLimit), \r
- modeShortName[mode].Data(),\r
- hPIDdata->GetAxis(axisForMode)->GetBinUpEdge(pBinUpProjLimit));\r
- \r
- hDeltaEl[slice] = h2Delta[0]->ProjectionY(Form("hDeltaEl_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaEl[slice]->GetXaxis()->SetTitle(h2Delta[0]->GetYaxis()->GetTitle());\r
- hDeltaEl[slice]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaEl[slice]->SetStats(kFALSE);\r
- \r
- hDeltaKa[slice] = h2Delta[1]->ProjectionY(Form("hDeltaKa_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaKa[slice]->SetName(Form("hDeltaKa_%s", binInfo.Data()));\r
- hDeltaKa[slice]->GetXaxis()->SetTitle(h2Delta[1]->GetYaxis()->GetTitle());\r
- hDeltaKa[slice]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaKa[slice]->SetStats(kFALSE);\r
- \r
- hDeltaPi[slice] = h2Delta[2]->ProjectionY(Form("hDeltaPi_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaPi[slice]->SetName(Form("hDeltaPi_%s", binInfo.Data()));\r
- hDeltaPi[slice]->GetXaxis()->SetTitle(h2Delta[2]->GetYaxis()->GetTitle());\r
- hDeltaPi[slice]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaPi[slice]->SetStats(kFALSE);\r
- \r
- hDeltaPr[slice] = h2Delta[3]->ProjectionY(Form("hDeltaPr_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaPr[slice]->SetName(Form("hDeltaPr_%s", binInfo.Data()));\r
- hDeltaPr[slice]->GetXaxis()->SetTitle(h2Delta[3]->GetYaxis()->GetTitle());\r
- hDeltaPr[slice]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaPr[slice]->SetStats(kFALSE);\r
- \r
- if (plotIdentifiedSpectra) {\r
- // If identified spectra are available (mainly useful in the MC case) and shall be used,\r
- // create histos with signals from identified particles\r
- \r
- // DeltaEl\r
- for (Int_t species = 0; species < nMCbins; species++) {\r
- hDeltaElMC[slice][species] = h2DeltaMC[0][species]->ProjectionY(Form("hDeltaElMC_%s_species_%d", binInfo.Data(), species),\r
- pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaElMC[slice][species]->SetLineColor(getLineColor(species + 1));\r
- hDeltaElMC[slice][species]->SetMarkerColor(getLineColor(species + 1));\r
- hDeltaElMC[slice][species]->SetMarkerStyle(24);\r
- hDeltaElMC[slice][species]->SetLineStyle(1);\r
- hDeltaElMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[0][species]->GetYaxis()->GetTitle());\r
- hDeltaElMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaElMC[slice][species]->SetStats(kFALSE);\r
- }\r
- \r
- // DeltaKa\r
- for (Int_t species = 0; species < nMCbins; species++) {\r
- hDeltaKaMC[slice][species] = h2DeltaMC[1][species]->ProjectionY(Form("hDeltaKaMC_%s_species_%d", binInfo.Data(), species),\r
- pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaKaMC[slice][species]->SetLineColor(getLineColor(species + 1));\r
- hDeltaKaMC[slice][species]->SetMarkerColor(getLineColor(species + 1));\r
- hDeltaKaMC[slice][species]->SetMarkerStyle(24);\r
- hDeltaKaMC[slice][species]->SetLineStyle(1);\r
- hDeltaKaMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[1][species]->GetYaxis()->GetTitle());\r
- hDeltaKaMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaKaMC[slice][species]->SetStats(kFALSE);\r
- }\r
- \r
- // DeltaPi\r
- for (Int_t species = 0; species < nMCbins; species++) {\r
- hDeltaPiMC[slice][species] = h2DeltaMC[2][species]->ProjectionY(Form("hDeltaPiMC_%s_species_%d", binInfo.Data(), species),\r
- pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaPiMC[slice][species]->SetLineColor(getLineColor(species + 1));\r
- hDeltaPiMC[slice][species]->SetMarkerColor(getLineColor(species + 1));\r
- hDeltaPiMC[slice][species]->SetMarkerStyle(24);\r
- hDeltaPiMC[slice][species]->SetLineStyle(1);\r
- hDeltaPiMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[2][species]->GetYaxis()->GetTitle());\r
- hDeltaPiMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaPiMC[slice][species]->SetStats(kFALSE);\r
- }\r
- \r
- // DeltaPr\r
- for (Int_t species = 0; species < nMCbins; species++) {\r
- hDeltaPrMC[slice][species] = h2DeltaMC[3][species]->ProjectionY(Form("hDeltaPrMC_%s_species_%d", binInfo.Data(), species),\r
- pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hDeltaPrMC[slice][species]->SetLineColor(getLineColor(species + 1));\r
- hDeltaPrMC[slice][species]->SetMarkerColor(getLineColor(species + 1));\r
- hDeltaPrMC[slice][species]->SetMarkerStyle(24);\r
- hDeltaPrMC[slice][species]->SetLineStyle(1);\r
- hDeltaPrMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[3][species]->GetYaxis()->GetTitle());\r
- hDeltaPrMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);\r
- hDeltaPrMC[slice][species]->SetStats(kFALSE);\r
- }\r
- }\r
- }\r
- hPIDdata->GetAxis(kPidMCpid)->SetRange(0, -1);\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1);\r
- \r
- hPIDdata->GetAxis(axisForMode)->SetRange(0, -1);\r
-\r
- /*\r
- // TOF TODO\r
- TCanvas* cTOF = new TCanvas("cTOF", "TOF PID",100,10,1200,800);\r
- cTOF->Divide(4,1);\r
- cTOF->cd(1);\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(1, 1);\r
- TH2D* h2TOFel = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);\r
- h2TOFel->SetName("h2TOFel");\r
- h2TOFel->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(1)));\r
- h2TOFel->Draw("colz");\r
- \r
- cTOF->cd(2);\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(2, 2);\r
- TH2D* h2TOFka = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);\r
- h2TOFka->SetName("h2TOFka");\r
- h2TOFka->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(2)));\r
- h2TOFka->Draw("colz");\r
- \r
- cTOF->cd(3);\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(3, 3);\r
- TH2D* h2TOFpi = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);\r
- h2TOFpi->SetName("h2TOFpi");\r
- h2TOFpi->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(3)));\r
- h2TOFpi->Draw("colz");\r
- \r
- cTOF->cd(4);\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(4, 4);\r
- TH2D* h2TOFpr = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);\r
- h2TOFpr->SetName("h2TOFpr");\r
- h2TOFpr->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(4)));\r
- h2TOFpr->Draw("colz");\r
- \r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1);\r
- */\r
- \r
- // Start fitting of slices\r
- TCanvas* cSingleFit[numSlices][4];\r
- \r
- TF1* fitFuncTotalDeltaPion[numSlices];\r
- TF1* fitFuncTotalDeltaElectron[numSlices];\r
- TF1* fitFuncTotalDeltaKaon[numSlices];\r
- TF1* fitFuncTotalDeltaProton[numSlices];\r
- \r
- // Histos for particle fractions\r
- TH1F* hFractionElectrons = 0x0;\r
- if (mode == kPMpT)\r
- hFractionElectrons = new TH1F("hFractionElectrons", "e", nPtBins, binsPt);\r
- else {\r
- const TArrayD* histBins = hPIDdata->GetAxis(axisForMode)->GetXbins();\r
- if (histBins->fN == 0)\r
- hFractionElectrons = new TH1F("hFractionElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), hPIDdata->GetAxis(axisForMode)->GetXmin(),\r
- hPIDdata->GetAxis(axisForMode)->GetXmax());\r
- else\r
- hFractionElectrons = new TH1F("hFractionElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), histBins->fArray);\r
- }\r
- \r
- hFractionElectrons->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());\r
- hFractionElectrons->GetYaxis()->SetTitle("Fraction");\r
- hFractionElectrons->SetLineColor(getLineColor(kEl));\r
- hFractionElectrons->SetMarkerColor(getLineColor(kEl));\r
- hFractionElectrons->SetMarkerStyle(20);\r
- hFractionElectrons->Sumw2();\r
- hFractionElectrons->SetStats(kFALSE);\r
- \r
- TH1F* hFractionElectronsDeltaPion = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaPion");\r
- TH1F* hFractionElectronsDeltaElectron = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaElectron");\r
- TH1F* hFractionElectronsDeltaKaon = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaKaon");\r
- TH1F* hFractionElectronsDeltaProton = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaProton");\r
- \r
- TH1F* hFractionKaons = (TH1F*)hFractionElectrons->Clone("hFractionKaons");\r
- hFractionKaons->SetTitle("K");\r
- hFractionKaons->SetLineColor(getLineColor(kKa));\r
- hFractionKaons->SetMarkerColor(getLineColor(kKa));\r
- \r
- TH1F* hFractionKaonsDeltaPion = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaPion");\r
- TH1F* hFractionKaonsDeltaElectron = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaElectron");\r
- TH1F* hFractionKaonsDeltaKaon = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaKaon");\r
- TH1F* hFractionKaonsDeltaProton = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaProton");\r
- \r
- TH1F* hFractionPions = (TH1F*)hFractionElectrons->Clone("hFractionPions");\r
- hFractionPions->SetTitle("#pi");\r
- hFractionPions->SetLineColor(getLineColor(kPi));\r
- hFractionPions->SetMarkerColor(getLineColor(kPi));\r
- \r
- TH1F* hFractionPionsDeltaPion = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaPion");\r
- TH1F* hFractionPionsDeltaElectron = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaElectron");\r
- TH1F* hFractionPionsDeltaKaon = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaKaon");\r
- TH1F* hFractionPionsDeltaProton = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaProton");\r
- \r
- TH1F* hFractionProtons = (TH1F*)hFractionElectrons->Clone("hFractionProtons");\r
- hFractionProtons->SetTitle("p");\r
- hFractionProtons->SetLineColor(getLineColor(kPr));\r
- hFractionProtons->SetMarkerColor(getLineColor(kPr));\r
- \r
- TH1F* hFractionProtonsDeltaPion = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaPion");\r
- TH1F* hFractionProtonsDeltaElectron = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaElectron");\r
- TH1F* hFractionProtonsDeltaKaon = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaKaon");\r
- TH1F* hFractionProtonsDeltaProton = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaProton");\r
- \r
- TH1F* hFractionMuons = (TH1F*)hFractionElectrons->Clone("hFractionMuons");\r
- hFractionMuons->SetTitle("#mu");\r
- hFractionMuons->SetLineColor(getLineColor(kMu));\r
- hFractionMuons->SetMarkerColor(getLineColor(kMu));\r
- \r
- TH1F* hFractionMuonsDeltaPion = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaPion");\r
- TH1F* hFractionMuonsDeltaElectron = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaElectron");\r
- TH1F* hFractionMuonsDeltaKaon = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaKaon");\r
- TH1F* hFractionMuonsDeltaProton = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaProton");\r
-\r
- TH1F* hFractionSummed = (TH1F*)hFractionProtons->Clone("hFractionSummed");\r
- hFractionSummed->SetTitle("Sum");\r
- hFractionSummed->SetLineColor(kBlack);\r
- hFractionSummed->SetMarkerColor(kBlack);\r
- \r
- \r
- // MC fractions\r
- TH1F* hFractionElectronsMC = (TH1F*)hFractionElectrons->Clone("hFractionElectronsMC");\r
- hFractionElectronsMC->SetMarkerStyle(24);\r
- TH1F* hFractionKaonsMC = (TH1F*)hFractionKaons->Clone("hFractionKaonsMC");\r
- hFractionKaonsMC->SetMarkerStyle(24);\r
- TH1F* hFractionPionsMC = (TH1F*)hFractionPions->Clone("hFractionPionsMC");\r
- hFractionPionsMC->SetMarkerStyle(24);\r
- TH1F* hFractionMuonsMC = (TH1F*)hFractionMuons->Clone("hFractionMuonsMC");\r
- hFractionMuonsMC->SetMarkerStyle(24);\r
- TH1F* hFractionProtonsMC = (TH1F*)hFractionProtons->Clone("hFractionProtonsMC");\r
- hFractionProtonsMC->SetMarkerStyle(24);\r
- \r
- \r
- // Comparison fit result<->MC\r
- TString fractionComparisonTitle = Form("Fraction fit / fraction %s", identifiedLabels[isMC].Data()); \r
- TH1F* hFractionComparisonElectrons = (TH1F*)hFractionElectrons->Clone("hFractionComparisonElectrons");\r
- hFractionComparisonElectrons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());\r
- TH1F* hFractionComparisonMuons = (TH1F*)hFractionMuons->Clone("hFractionComparisonMuons");\r
- hFractionComparisonMuons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());\r
- TH1F* hFractionComparisonKaons = (TH1F*)hFractionKaons->Clone("hFractionComparisonKaons");\r
- hFractionComparisonKaons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());\r
- TH1F* hFractionComparisonPions = (TH1F*)hFractionPions->Clone("hFractionComparisonPions");\r
- hFractionComparisonPions->GetYaxis()->SetTitle(fractionComparisonTitle.Data());\r
- TH1F* hFractionComparisonProtons = (TH1F*)hFractionProtons->Clone("hFractionComparisonProtons");\r
- hFractionComparisonProtons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());\r
- TH1F* hFractionComparisonTotal = (TH1F*)hFractionSummed->Clone("hFractionComparisonTotal");\r
- hFractionComparisonTotal->GetYaxis()->SetTitle(fractionComparisonTitle.Data());\r
- \r
- \r
- \r
- // Histos for particle yields\r
- TH1F* hYieldElectrons = 0x0;\r
- if (mode == kPMpT)\r
- hYieldElectrons = new TH1F("hYieldElectrons", "e", nPtBins, binsPt);\r
- else {\r
- const TArrayD* histBins = hPIDdata->GetAxis(axisForMode)->GetXbins();\r
- if (histBins->fN == 0)\r
- hYieldElectrons = new TH1F("hYieldElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), hPIDdata->GetAxis(axisForMode)->GetXmin(),\r
- hPIDdata->GetAxis(axisForMode)->GetXmax());\r
- else\r
- hYieldElectrons = new TH1F("hYieldElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), histBins->fArray);\r
- }\r
- \r
- hYieldElectrons->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());\r
- hYieldElectrons->GetYaxis()->SetTitle(Form("%s1/(2#pi%s) d^{2}N/d#etad%s%s", numEvents > 0 ? "1/N_{ev} " : "",\r
- modeLatexName[mode].Data(), modeLatexName[mode].Data(),\r
- mode == kPMpT ? " (GeV/c)^{-2}" : 0));\r
- hYieldElectrons->SetLineColor(getLineColor(kEl));\r
- hYieldElectrons->SetMarkerColor(getLineColor(kEl));\r
- hYieldElectrons->SetMarkerStyle(20);\r
- hYieldElectrons->Sumw2();\r
- hYieldElectrons->SetStats(kFALSE);\r
- \r
- TH1F* hYieldElectronsDeltaPion = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaPion");\r
- TH1F* hYieldElectronsDeltaElectron = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaElectron");\r
- TH1F* hYieldElectronsDeltaKaon = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaKaon");\r
- TH1F* hYieldElectronsDeltaProton = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaProton");\r
- \r
- TH1F* hYieldKaons = (TH1F*)hYieldElectrons->Clone("hYieldKaons");\r
- hYieldKaons->SetTitle("K");\r
- hYieldKaons->SetLineColor(getLineColor(kKa));\r
- hYieldKaons->SetMarkerColor(getLineColor(kKa));\r
- \r
- TH1F* hYieldKaonsDeltaPion = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaPion");\r
- TH1F* hYieldKaonsDeltaElectron = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaElectron");\r
- TH1F* hYieldKaonsDeltaKaon = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaKaon");\r
- TH1F* hYieldKaonsDeltaProton = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaProton");\r
- \r
- TH1F* hYieldPions = (TH1F*)hYieldElectrons->Clone("hYieldPions");\r
- hYieldPions->SetTitle("#pi");\r
- hYieldPions->SetLineColor(getLineColor(kPi));\r
- hYieldPions->SetMarkerColor(getLineColor(kPi));\r
- \r
- TH1F* hYieldPionsDeltaPion = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaPion");\r
- TH1F* hYieldPionsDeltaElectron = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaElectron");\r
- TH1F* hYieldPionsDeltaKaon = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaKaon");\r
- TH1F* hYieldPionsDeltaProton = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaProton");\r
- \r
- TH1F* hYieldProtons = (TH1F*)hYieldElectrons->Clone("hYieldProtons");\r
- hYieldProtons->SetTitle("p");\r
- hYieldProtons->SetLineColor(getLineColor(kPr));\r
- hYieldProtons->SetMarkerColor(getLineColor(kPr));\r
- \r
- TH1F* hYieldProtonsDeltaPion = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaPion");\r
- TH1F* hYieldProtonsDeltaElectron = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaElectron");\r
- TH1F* hYieldProtonsDeltaKaon = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaKaon");\r
- TH1F* hYieldProtonsDeltaProton = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaProton");\r
- \r
- TH1F* hYieldMuons = (TH1F*)hYieldElectrons->Clone("hYieldMuons");\r
- hYieldMuons->SetTitle("#mu");\r
- hYieldMuons->SetLineColor(getLineColor(kMu));\r
- hYieldMuons->SetMarkerColor(getLineColor(kMu));\r
- \r
- TH1F* hYieldMuonsDeltaPion = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaPion");\r
- TH1F* hYieldMuonsDeltaElectron = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaElectron");\r
- TH1F* hYieldMuonsDeltaKaon = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaKaon");\r
- TH1F* hYieldMuonsDeltaProton = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaProton");\r
- \r
- // MC yields\r
- TH1F* hYieldElectronsMC = (TH1F*)hYieldElectrons->Clone("hYieldElectronsMC");\r
- hYieldElectronsMC->SetMarkerStyle(24);\r
- TH1F* hYieldMuonsMC = (TH1F*)hYieldElectrons->Clone("hYieldMuonsMC");\r
- hYieldMuonsMC->SetMarkerStyle(24);\r
- hYieldMuonsMC->SetLineColor(getLineColor(kMu));\r
- hYieldMuonsMC->SetMarkerColor(getLineColor(kMu));\r
- TH1F* hYieldKaonsMC = (TH1F*)hYieldKaons->Clone("hYieldKaonsMC");\r
- hYieldKaonsMC->SetMarkerStyle(24);\r
- TH1F* hYieldPionsMC = (TH1F*)hYieldPions->Clone("hYieldPionsMC");\r
- hYieldPionsMC->SetMarkerStyle(24);\r
- TH1F* hYieldProtonsMC = (TH1F*)hYieldProtons->Clone("hYieldProtonsMC");\r
- hYieldProtonsMC->SetMarkerStyle(24);\r
- TH1F* hYieldSummedMC = (TH1F*)hYieldProtonsMC->Clone("hYieldSummedMC");\r
- hYieldSummedMC->SetTitle("Sum");\r
- hYieldSummedMC->SetLineColor(kBlack);\r
- hYieldSummedMC->SetMarkerColor(kBlack);\r
- \r
- // Comparison fit result<->MC (yields)\r
- TString yieldComparisonTitle = Form("Yield fit / yield %s", identifiedLabels[isMC].Data()); \r
- TH1F* hYieldComparisonElectrons = (TH1F*)hYieldElectrons->Clone("hYieldComparisonElectrons");\r
- hYieldComparisonElectrons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());\r
- TH1F* hYieldComparisonMuons = (TH1F*)hYieldMuons->Clone("hYieldComparisonMuons");\r
- hYieldComparisonMuons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());\r
- TH1F* hYieldComparisonKaons = (TH1F*)hYieldKaons->Clone("hYieldComparisonKaons");\r
- hYieldComparisonKaons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());\r
- TH1F* hYieldComparisonPions = (TH1F*)hYieldPions->Clone("hYieldComparisonPions");\r
- hYieldComparisonPions->GetYaxis()->SetTitle(yieldComparisonTitle.Data());\r
- TH1F* hYieldComparisonProtons = (TH1F*)hYieldProtons->Clone("hYieldComparisonProtons");\r
- hYieldComparisonProtons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());\r
- \r
- \r
- // To-pi ratios\r
- TString electronString[3] = { "e^{-}", "e^{+}+e^{-}", "e^{+}" };\r
- TString muonString[3] = { "#mu^{-}", "#mu^{+}+#mu^{-}", "#mu^{+}" };\r
- TString kaonString[3] = { "K^{-}", "K^{+}+K^{-}", "K^{+}" };\r
- TString pionString[3] = { "#pi^{-}", "#pi^{+}+#pi^{-}", "#pi^{+}" };\r
- TString protonString[3] = { "#bar{p}", "p+#bar{p}", "p" };\r
- \r
- TH1F* hRatioToPiElectrons = (TH1F*)hYieldElectrons->Clone("hRatioToPiElectrons");\r
- hRatioToPiElectrons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",\r
- electronString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data(),\r
- pionString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data()));\r
- hRatioToPiElectrons->SetTitle(Form("%s", chargeMode == 0\r
- ? Form("(%s)/(%s)", electronString[chargeMode+1].Data(), pionString[chargeMode+1].Data())\r
- : Form("%s/%s", electronString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));\r
- \r
- \r
- TH1F* hRatioToPiMuons = (TH1F*)hYieldMuons->Clone("hRatioToPiMuons");\r
- hRatioToPiMuons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",\r
- muonString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data(),\r
- pionString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data()));\r
- hRatioToPiMuons->SetTitle(Form("%s", chargeMode == 0\r
- ? Form("(%s)/(%s)", muonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())\r
- : Form("%s/%s", muonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));\r
- \r
- TH1F* hRatioToPiKaons = (TH1F*)hYieldKaons->Clone("hRatioToPiKaons");\r
- hRatioToPiKaons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",\r
- kaonString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data(),\r
- pionString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data()));\r
- hRatioToPiKaons->SetTitle(Form("%s", chargeMode == 0\r
- ? Form("(%s)/(%s)", kaonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())\r
- : Form("%s/%s", kaonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));\r
- \r
- TH1F* hRatioToPiProtons = (TH1F*)hYieldProtons->Clone("hRatioToPiProtons");\r
- hRatioToPiProtons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",\r
- protonString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data(),\r
- pionString[chargeMode+1].Data(),\r
- modeLatexName[mode].Data()));\r
- hRatioToPiProtons->SetTitle(Form("%s", chargeMode == 0\r
- ? Form("(%s)/(%s)", protonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())\r
- : Form("%s/%s", protonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));\r
- \r
- // MC to-pi ratios\r
- TH1F* hRatioToPiElectronsMC = (TH1F*)hRatioToPiElectrons->Clone("hRatioToPiElectronsMC");\r
- hRatioToPiElectronsMC->SetMarkerStyle(24);\r
- TH1F* hRatioToPiMuonsMC = (TH1F*)hRatioToPiMuons->Clone("hRatioToPiMuonsMC");\r
- hRatioToPiMuonsMC->SetMarkerStyle(24);\r
- hRatioToPiMuonsMC->SetLineColor(getLineColor(kMu));\r
- hRatioToPiMuonsMC->SetMarkerColor(getLineColor(kMu));\r
- TH1F* hRatioToPiKaonsMC = (TH1F*)hRatioToPiKaons->Clone("hRatioToPiKaonsMC");\r
- hRatioToPiKaonsMC->SetMarkerStyle(24);\r
- TH1F* hRatioToPiProtonsMC = (TH1F*)hRatioToPiProtons->Clone("hRatioToPiProtonsMC");\r
- hRatioToPiProtonsMC->SetMarkerStyle(24);\r
- \r
- // Reduced Chi^2 of fits vs. pT for all Delta_Species\r
- TH2F* hReducedChiSquarePt = 0x0;\r
- if (mode == kPMpT)\r
- hReducedChiSquarePt = new TH2F("hReducedChiSquarePt", "e", nPtBins, binsPt, 4, 0, 4);\r
- else {\r
- const TArrayD* histBins = hPIDdata->GetAxis(axisForMode)->GetXbins();\r
- if (histBins->fN == 0)\r
- hReducedChiSquarePt = new TH2F(Form("hReducedChiSquare%s", modeShortName[mode].Data()), "e",\r
- hPIDdata->GetAxis(axisForMode)->GetNbins(), hPIDdata->GetAxis(axisForMode)->GetXmin(),\r
- hPIDdata->GetAxis(axisForMode)->GetXmax(), 4, 0, 4);\r
- else\r
- hReducedChiSquarePt = new TH2F(Form("hReducedChiSquare%s", modeShortName[mode].Data()), "e",\r
- hPIDdata->GetAxis(axisForMode)->GetNbins(), histBins->fArray, 4, 0, 4);\r
- }\r
- \r
- hReducedChiSquarePt->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());\r
- hReducedChiSquarePt->GetYaxis()->SetTitle("Delta_{Species}");\r
- hReducedChiSquarePt->GetYaxis()->SetBinLabel(1, "e");\r
- hReducedChiSquarePt->GetYaxis()->SetBinLabel(2, "K");\r
- hReducedChiSquarePt->GetYaxis()->SetBinLabel(3, "#pi");\r
- hReducedChiSquarePt->GetYaxis()->SetBinLabel(4, "p");\r
- hReducedChiSquarePt->SetMarkerColor(kRed);\r
- hReducedChiSquarePt->SetMarkerStyle(20);\r
- hReducedChiSquarePt->SetStats(kFALSE);\r
- \r
- // Obtain MC information about particle yields\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(1, 1); // Do not count each particle more than once\r
- TH2D* hMCdata = (TH2D*)hPIDdata->Projection(kPidMCpid, axisForMode, "e");\r
- hMCdata->SetName("hMCdata");\r
- hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1); // Reset range\r
-\r
- \r
- \r
- // Extract the MC truth generated primary yields\r
- THnSparse* hMCgeneratedYieldsPrimaries = isMCdataSet ? dynamic_cast<THnSparse*>(histList->FindObject("fhMCgeneratedYieldsPrimaries"))\r
- : 0x0;\r
- \r
- TH1D* hMCgenYieldsPrimSpecies[AliPID::kSPECIES];\r
- for (Int_t i = 0; i < AliPID::kSPECIES; i++)\r
- hMCgenYieldsPrimSpecies[i] = 0x0;\r
- \r
- if (hMCgeneratedYieldsPrimaries) {\r
- // Set proper errors, if not yet calculated\r
- if (!hMCgeneratedYieldsPrimaries->GetCalculateErrors()) {\r
- std::cout << "Re-calculating errors of " << hMCgeneratedYieldsPrimaries->GetName() << "..." << std::endl;\r
- \r
- hMCgeneratedYieldsPrimaries->Sumw2();\r
- \r
- Long64_t nBinsTHnSparseGenYield = hMCgeneratedYieldsPrimaries->GetNbins();\r
- Double_t binContentGenYield = 0;\r
- for (Long64_t bin = 0; bin < nBinsTHnSparseGenYield; bin++) {\r
- binContentGenYield = hMCgeneratedYieldsPrimaries->GetBinContent(bin);\r
- hMCgeneratedYieldsPrimaries->SetBinError(bin, TMath::Sqrt(binContentGenYield));\r
- }\r
- }\r
- \r
- if (restrictJetPtAxis) \r
- hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldJetPt)->SetRange(lowerJetPtBinLimit, upperJetPtBinLimit);\r
- \r
- if (restrictCentralityAxis)\r
- hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldCentrality)->SetRange(lowerCentralityBinLimit, upperCentralityBinLimit);\r
- \r
- \r
- if (restrictCharge) {\r
- const Int_t indexChargeAxisGenYield = GetAxisByTitle(hMCgeneratedYieldsPrimaries, "Charge (e_{0})");\r
- if (indexChargeAxisGenYield < 0) {\r
- std::cout << "Error: Charge axis not found for gen yield histogram!" << std::endl;\r
- return -1;\r
- }\r
- \r
- Int_t lowerChargeBinLimitGenYield = -1;\r
- Int_t upperChargeBinLimitGenYield = -2;\r
- Double_t actualLowerChargeGenYield = -999;\r
- Double_t actualUpperChargeGenYield = -999;\r
- \r
- // Add subtract a very small number to avoid problems with values right on the border between to bins\r
- if (chargeMode == kNegCharge) {\r
- lowerChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(-1. + 0.001);\r
- upperChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(0. - 0.001);\r
- }\r
- else if (chargeMode == kPosCharge) {\r
- lowerChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(0. + 0.001);\r
- upperChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(1. - 0.001);\r
- }\r
- \r
- // Check if the values look reasonable\r
- if (lowerChargeBinLimitGenYield <= upperChargeBinLimitGenYield && lowerChargeBinLimitGenYield >= 1\r
- && upperChargeBinLimitGenYield <= hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->GetNbins()) {\r
- actualLowerChargeGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->GetBinLowEdge(lowerChargeBinLimitGenYield);\r
- actualUpperChargeGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->GetBinUpEdge(upperChargeBinLimitGenYield);\r
- \r
- if (TMath::Abs(actualLowerChargeGenYield - actualLowerChargeData) > 1e-4 ||\r
- TMath::Abs(actualUpperChargeGenYield - actualUpperChargeData) > 1e-4) {\r
- std::cout << std::endl;\r
- std::cout << "Error: Charge range gen yield: " << actualLowerChargeGenYield << " - " << actualUpperChargeGenYield\r
- << std::endl << "differs from that of data: " << actualLowerChargeData << " - " << actualUpperChargeData\r
- << std::endl;\r
- return -1;\r
- }\r
- }\r
- else {\r
- std::cout << std::endl;\r
- std::cout << "Requested charge range (gen yield) out of limits or upper and lower limit are switched!" << std::endl;\r
- return -1;\r
- }\r
- \r
- hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->SetRange(lowerChargeBinLimitGenYield, upperChargeBinLimitGenYield);\r
- }\r
- \r
- for (Int_t MCid = 0; MCid < AliPID::kSPECIES; MCid++) {\r
- hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldMCpid)->SetRange(MCid + 1, MCid + 1);\r
- \r
- hMCgenYieldsPrimSpecies[MCid] = hMCgeneratedYieldsPrimaries->Projection(kPidGenYieldPt, "e");\r
- hMCgenYieldsPrimSpecies[MCid]->SetName(Form("hMCgenYieldsPrimSpecies_%s", AliPID::ParticleShortName(MCid)));\r
- hMCgenYieldsPrimSpecies[MCid]->SetTitle(Form("MC truth generated primary yield, %s", AliPID::ParticleName(MCid)));\r
- \r
- // Choose the same binning as for the fitted yields, i.e. rebin the histogram (Rebin will create a clone!)\r
- TH1D* temp = (TH1D*)hMCgenYieldsPrimSpecies[MCid]->Rebin(nPtBins, hMCgenYieldsPrimSpecies[MCid]->GetName(), binsPt);\r
- // Delete the old binned histo and take the new binned one\r
- delete hMCgenYieldsPrimSpecies[MCid];\r
- hMCgenYieldsPrimSpecies[MCid] = temp;\r
- \r
- hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldMCpid)->SetRange(0, -1);\r
- }\r
- }\r
- \r
- \r
- // Get expected shapes for pT bins\r
- TString Ytitle = "";\r
- \r
- // Array index 0 as unused dummy\r
- TH2D* hGenDelta[6][6]; // DeltaSpecies (first index) for species (second index)\r
- TH2D* hGenDeltaMCid[6][6]; // DeltaSpecies (first index) for species (second index)\r
- \r
- for (Int_t i = 0; i < 6; i++) {\r
- for (Int_t j = 0; j < 6; j++) {\r
- hGenDelta[i][j] = 0x0;\r
- hGenDeltaMCid[i][j] = 0x0;\r
- }\r
- }\r
- \r
- THnSparse* current = 0x0;\r
- \r
- THnSparse* hGenEl = dynamic_cast<THnSparse*>(histList->FindObject("hGenEl"));\r
- if (!hGenEl) {\r
- std::cout << "Failed to load expected dEdx signal shape for: Electrons!" << std::endl;\r
- return -1;\r
- }\r
- \r
- THnSparse* hGenKa = dynamic_cast<THnSparse*>(histList->FindObject("hGenKa"));\r
- if (!hGenKa) {\r
- std::cout << "Failed to load expected dEdx signal shape for: Kaons!" << std::endl;\r
- return -1;\r
- }\r
- \r
- THnSparse* hGenPi = dynamic_cast<THnSparse*>(histList->FindObject("hGenPi"));\r
- if (!hGenPi) {\r
- std::cout << "Failed to load expected dEdx signal shape for: Pions!" << std::endl;\r
- return -1;\r
- }\r
- \r
- THnSparse* hGenMu = dynamic_cast<THnSparse*>(histList->FindObject("hGenMu"));\r
- if (!hGenMu) {\r
- std::cout << "Failed to load expected dEdx signal shape for: Muons! Treated muons as pions in the following." << std::endl;\r
- takeIntoAccountMuons = kFALSE; \r
- }\r
- \r
- THnSparse* hGenPr = dynamic_cast<THnSparse*>(histList->FindObject("hGenPr"));\r
- if (!hGenPr) {\r
- std::cout << "Failed to load expected dEdx signal shape for: Protons!" << std::endl;\r
- return -1;\r
- }\r
-\r
- for (Int_t MCid = kEl; MCid <= kPr; MCid++) {\r
- if (MCid == kEl)\r
- current = hGenEl;\r
- else if (MCid == kKa)\r
- current = hGenKa;\r
- else if (MCid == kMu) {\r
- if (takeIntoAccountMuons)\r
- current = hGenMu;\r
- else\r
- continue; // No histo for muons in this case\r
- }\r
- else if (MCid == kPi)\r
- current = hGenPi;\r
- else if (MCid == kPr)\r
- current = hGenPr;\r
- else\r
- break;\r
- \r
- // If desired, rebin considered axis\r
- if (rebin > 1 || rebinDeltaPrime > 1) {\r
- const Int_t nDimensions = current->GetNdimensions();\r
- Int_t rebinFactor[nDimensions];\r
- \r
- for (Int_t dim = 0; dim < nDimensions; dim++) {\r
- if (dim == axisGenForMode)\r
- rebinFactor[dim] = rebin;\r
- else if (dim == kPidGenDeltaPrime && rebinDeltaPrime > 1)\r
- rebinFactor[dim] = rebinDeltaPrime;\r
- else\r
- rebinFactor[dim] = 1;\r
- }\r
- \r
- THnSparse* temp = current->Rebin(&rebinFactor[0]);\r
- current->Reset();\r
- current = temp;\r
- }\r
- \r
- // Set proper errors, if not yet calculated\r
- if (!current->GetCalculateErrors()) {\r
- std::cout << "Re-calculating errors of " << current->GetName() << "..." << std::endl;\r
- \r
- current->Sumw2();\r
- \r
- Long64_t nBinsTHnSparseGen = current->GetNbins();\r
- Double_t binContentGen = 0;\r
- for (Long64_t bin = 0; bin < nBinsTHnSparseGen; bin++) {\r
- binContentGen = current->GetBinContent(bin);\r
- current->SetBinError(bin, TMath::Sqrt(binContentGen));\r
- }\r
- }\r
- \r
- // If desired, restrict centrality range\r
- if (restrictCentralityAxis) {\r
- current->GetAxis(kPidGenCentrality)->SetRange(lowerCentralityBinLimit, upperCentralityBinLimit);\r
- }\r
- \r
- // If desired, restrict jet pT range\r
- if (restrictJetPtAxis) {\r
- current->GetAxis(kPidGenJetPt)->SetRange(lowerJetPtBinLimit, upperJetPtBinLimit);\r
- }\r
- \r
- // If desired, restrict charge range\r
- if (restrictCharge) {\r
- const Int_t indexChargeAxisGen = GetAxisByTitle(current, "Charge (e_{0})");\r
- if (indexChargeAxisGen < 0) {\r
- std::cout << "Error: Charge axis not found for gen histogram!" << std::endl;\r
- return -1;\r
- }\r
- \r
- Int_t lowerChargeBinLimitGen = -1;\r
- Int_t upperChargeBinLimitGen = -2;\r
- Double_t actualLowerChargeGen = -999;\r
- Double_t actualUpperChargeGen = -999;\r
- \r
- // Add subtract a very small number to avoid problems with values right on the border between to bins\r
- if (chargeMode == kNegCharge) {\r
- lowerChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(-1. + 0.001);\r
- upperChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(0. - 0.001);\r
- }\r
- else if (chargeMode == kPosCharge) {\r
- lowerChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(0. + 0.001);\r
- upperChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(1. - 0.001);\r
- }\r
- \r
- // Check if the values look reasonable\r
- if (lowerChargeBinLimitGen <= upperChargeBinLimitGen && lowerChargeBinLimitGen >= 1\r
- && upperChargeBinLimitGen <= current->GetAxis(indexChargeAxisGen)->GetNbins()) {\r
- actualLowerChargeGen = current->GetAxis(indexChargeAxisGen)->GetBinLowEdge(lowerChargeBinLimitGen);\r
- actualUpperChargeGen = current->GetAxis(indexChargeAxisGen)->GetBinUpEdge(upperChargeBinLimitGen);\r
- \r
- if (TMath::Abs(actualLowerChargeGen - actualLowerChargeData) > 1e-4 ||\r
- TMath::Abs(actualUpperChargeGen - actualUpperChargeData) > 1e-4) {\r
- std::cout << std::endl;\r
- std::cout << "Error: Charge range gen: " << actualLowerChargeGen << " - " << actualUpperChargeGen\r
- << std::endl << "differs from that of data: " << actualLowerChargeData << " - " << actualUpperChargeData\r
- << std::endl;\r
- return -1;\r
- }\r
- }\r
- else {\r
- std::cout << std::endl;\r
- std::cout << "Requested charge range (gen) out of limits or upper and lower limit are switched!" << std::endl;\r
- return -1;\r
- }\r
- \r
- current->GetAxis(indexChargeAxisGen)->SetRange(lowerChargeBinLimitGen, upperChargeBinLimitGen);\r
- }\r
- \r
- \r
- \r
- for (Int_t selectBin = 1; selectBin <= 4; selectBin++) {\r
- Int_t selectMCid = (selectBin >= 3) ? (selectBin+1) : selectBin;\r
-\r
- current->GetAxis(kPidGenSelectSpecies)->SetRange(selectBin, selectBin);\r
- \r
- Ytitle = Form("#Delta%s_{%s} = dE/dx %s <dE/dx>_{%s} (arb. units)", useDeltaPrime ? "'" : "",\r
- partShortName[selectMCid - 1].Data(), useDeltaPrime ? "/" : "-",\r
- partShortName[selectMCid - 1].Data());\r
- \r
- TH2* hGenCurrent = 0x0;\r
- if (!useIdentifiedGeneratedSpectra) {\r
- hGenDelta[selectMCid][MCid] = current->Projection(genAxis, axisGenForMode, "e");\r
- hGenDelta[selectMCid][MCid]->SetName(Form("hGenDelta%sFor%s", partShortName[selectMCid - 1].Data(),\r
- partShortName[MCid - 1].Data()));\r
- hGenCurrent = hGenDelta[selectMCid][MCid];\r
- }\r
- else {\r
- current->GetAxis(kPidGenMCpid)->SetRange(MCid, MCid);\r
- hGenDeltaMCid[selectMCid][MCid] = current->Projection(genAxis, axisGenForMode, "e");\r
- hGenDeltaMCid[selectMCid][MCid]->SetName(Form("hGenDelta%sForMCid%s", partShortName[selectMCid - 1].Data(), \r
- partShortName[MCid - 1].Data()));\r
- \r
- hGenCurrent = hGenDeltaMCid[selectMCid][MCid];\r
- current->GetAxis(kPidGenMCpid)->SetRange(0, -1);\r
- }\r
- \r
- hGenCurrent->GetYaxis()->SetTitle(Ytitle.Data());\r
- hGenCurrent->SetLineColor(getLineColor(MCid));\r
- hGenCurrent->SetMarkerColor(getLineColor(MCid));\r
- hGenCurrent->SetLineWidth(2);\r
- hGenCurrent->SetLineStyle(2);\r
- hGenCurrent->SetMarkerStyle(20);\r
- hGenCurrent->GetXaxis()->SetTitleOffset(1.0);\r
- }\r
- \r
- current->GetAxis(kPidGenSelectSpecies)->SetRange(0, -1);\r
- } \r
- \r
- // Free a lot of memory for the following procedure. Histogram is not needed anymore (only its projections)\r
- delete f;\r
- \r
- // Save intermediate results\r
- //TODO save intermediate TOF results\r
- saveInterF->cd();\r
- \r
- if (hMCdata)\r
- hMCdata->Write();\r
- \r
- for (Int_t i = 0; i < 6; i++) {\r
- for (Int_t j = 0; j < 6; j++) {\r
- if (hGenDelta[i][j])\r
- hGenDelta[i][j]->Write();\r
- \r
- if (hGenDeltaMCid[i][j])\r
- hGenDeltaMCid[i][j]->Write();\r
- }\r
- }\r
- \r
- for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hFractionPions->GetXaxis()->GetNbins(); slice++) { \r
- if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))\r
- continue; \r
- \r
- if(hDeltaPi[slice]) \r
- hDeltaPi[slice]->Write();\r
- if(hDeltaEl[slice])\r
- hDeltaEl[slice]->Write();\r
- if(hDeltaKa[slice])\r
- hDeltaKa[slice]->Write();\r
- if(hDeltaPr[slice])\r
- hDeltaPr[slice]->Write();\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) {\r
- hDeltaElMC[slice][species]->Write();\r
- hDeltaKaMC[slice][species]->Write();\r
- hDeltaPiMC[slice][species]->Write();\r
- hDeltaPrMC[slice][species]->Write(); \r
- }\r
- } \r
- }\r
- \r
- // File may not be closed because the projections are needed in the following!\r
- //saveInterF->Close();\r
- \r
- // Save some first results for the final output\r
- TString saveFName = fileName;\r
- saveFName = Form("%s_results_%s__%s_%d_reg%d_regFac%.2f_%s%s%s%s%s.root", saveFName.ReplaceAll(".root", "").Data(), \r
- useLogLikelihood ? (useWeightsForLogLikelihood ? "weightedLLFit" : "LLFit") : "ChiSquareFit",\r
- modeShortName[mode].Data(), fitMethod, regularisation, regularisationFactor,\r
- muonFractionHandlingShortName[muonFractionHandlingParameter].Data(),\r
- useIdentifiedGeneratedSpectra ? "_idSpectra" : "",\r
- restrictCentralityAxis ? Form("_centrality%.0f_%.0f", actualLowerCentrality, actualUpperCentrality) : "",\r
- restrictJetPtAxis ? Form("_jetPt%.1f_%.1f", actualLowerJetPt, actualUpperJetPt) : "",\r
- chargeString.Data());\r
- TFile *saveF = TFile::Open(saveFName.Data(), "RECREATE");\r
- saveF->cd();\r
- \r
- if (hFractionElectrons)\r
- hFractionElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaons)\r
- hFractionKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPions)\r
- hFractionPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtons)\r
- hFractionProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuons)\r
- hFractionMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionSummed)\r
- hFractionSummed->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionElectronsMC)\r
- hFractionElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsMC)\r
- hFractionKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsMC)\r
- hFractionPionsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsMC)\r
- hFractionMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsMC)\r
- hFractionProtonsMC->Write(0, TObject::kWriteDelete);\r
-\r
- \r
- if (hYieldElectrons)\r
- hYieldElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaons)\r
- hYieldKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPions)\r
- hYieldPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtons)\r
- hYieldProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuons)\r
- hYieldMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldElectronsMC)\r
- hYieldElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsMC)\r
- hYieldMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsMC)\r
- hYieldKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsMC)\r
- hYieldPionsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsMC)\r
- hYieldProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldSummedMC)\r
- hYieldSummedMC->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hRatioToPiElectrons)\r
- hRatioToPiElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiMuons)\r
- hRatioToPiMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiKaons)\r
- hRatioToPiKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiProtons)\r
- hRatioToPiProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiElectronsMC)\r
- hRatioToPiElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiMuonsMC)\r
- hRatioToPiMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiKaonsMC)\r
- hRatioToPiKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiProtonsMC)\r
- hRatioToPiProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- // Dummy histo to create generic legend entries from\r
- TH1D* hMCmuonsAndPionsDummy = 0x0;\r
- if (plotIdentifiedSpectra && firstValidSlice >= 0) {\r
- hMCmuonsAndPionsDummy = new TH1D(*hDeltaPiMC[firstValidSlice][kPi]);\r
- hMCmuonsAndPionsDummy->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPionsDummy->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPionsDummy->SetName("hMCmuonsAndPionsDummy");\r
- }\r
- \r
- \r
- muonFractionThresholdForFitting = 0.;//OLD 0.295;\r
- muonFractionThresholdBinForFitting = (mode == kPMpT) ? FindMomentumBin(binsPt, muonFractionThresholdForFitting) : -1;\r
- \r
- electronFractionThresholdForFitting = 9.;\r
- electronFractionThresholdBinForFitting = (mode == kPMpT) ? FindMomentumBin(binsPt, electronFractionThresholdForFitting) : -1;\r
- \r
- lastPtForCallOfGetElectronFraction = pHigh + 10.; // Make sure that this value is higher than in any call during the fit\r
- \r
- fElectronFraction = new TF1("fElectronFraction", Form("[0]+(x<%f)*[1]*(x-%f)", electronFractionThresholdForFitting, \r
- electronFractionThresholdForFitting), \r
- pLow, pHigh);\r
- fElectronFraction->SetParameters(0.01, 0.0);\r
- \r
- \r
- \r
- TString speciesLabel[4] = {"El", "Ka", "Pi", "Pr" };\r
- \r
- const Double_t binWidthFitHisto = 1.0; // Not used any longer\r
- \r
- // In case of regularisation, the actual number of x bins and the (for pT: logs of their) bin centres are required\r
- Int_t numXBins = 0;\r
- Double_t* xBinCentres = 0x0;\r
- Double_t* xBinStatisticalWeight = 0x0;\r
- Double_t* xBinStatisticalWeightError = 0x0;\r
- \r
- // Set the number of parameters per x bin:\r
- // Regularisation only implemented for simultaneous fit.\r
- const Int_t numParamsPerXbin = AliPID::kSPECIES + 1; // Fractions of each species + total yield in x bin\r
- \r
- // Construct the array of all the parameters that are to be regularised, i.e. only the FREE fractions\r
- // and NOT the total yields or the x bin\r
- Int_t nParToRegulariseSimultaneousFit = 0;\r
- Int_t* indexParametersToRegularise = 0x0;\r
- Int_t* lastNotFixedIndexOfParameters = 0x0;\r
- \r
- if (regularisation > 0) {\r
- Int_t xBinIndexTemp = 0;\r
- Int_t internalParIndexTemp = 0;\r
- \r
- // Loop twice over data: Determine the number of bins in the first iteration, allocate the memory and fill in the 2. iteration\r
- for (Int_t i = 0; i < 2; i++) {\r
- if (i == 1) {\r
- if (numXBins == 0) {\r
- printf("No bins for fitting! Exiting...\n");\r
- \r
- return -1;\r
- }\r
- if (nParToRegulariseSimultaneousFit == 0) {\r
- printf("No parameters to regularise! Exiting...\n");\r
- \r
- return -1;\r
- }\r
- \r
- xBinCentres = new Double_t[numXBins];\r
- xBinStatisticalWeight = new Double_t[numXBins];\r
- xBinStatisticalWeightError = new Double_t[numXBins];\r
- \r
- indexParametersToRegularise = new Int_t[nParToRegulariseSimultaneousFit];\r
- \r
- lastNotFixedIndexOfParameters = new Int_t[numParamsPerXbin];\r
- \r
- // Set last not fixed index of parameter to numXBins, i.e. a index larger than any existing index.\r
- // This will not restrict the parameter regularisation range. In the following, the range for electrons\r
- // and muons will be restricted\r
- for (Int_t iPar = 0; iPar < numParamsPerXbin; iPar++) \r
- lastNotFixedIndexOfParameters[iPar] = numXBins;\r
- }\r
- \r
- \r
- for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hFractionPions->GetXaxis()->GetNbins(); slice++) { \r
- if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))\r
- continue; \r
- \r
- // There won't (actually: shouldn't) be tracks with a pT larger than the jet pT\r
- if (mode == kPMpT && restrictJetPtAxis && binsPt[slice] >= actualUpperJetPt)\r
- continue;\r
- \r
- const Int_t pBinLowProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice] + 1e-5) : slice + 1;\r
- const Int_t pBinUpProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice + 1]- 1e-5) : slice + 1;\r
- \r
- // NOTE: In case of regularisation, only the simultaneous fit values will be used, i.e. totalYield and not allDeltaSpecies!\r
- \r
- // Also take into account bin width in delta(Prime) plots -> Multiply by binWidthFitHisto\r
- Double_t totalYieldError = 0;\r
- const Double_t totalYield = binWidthFitHisto * hYieldPt->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, totalYieldError);\r
- totalYieldError *= binWidthFitHisto;\r
- \r
- if (totalYield <= 0) \r
- continue;\r
- \r
- if (i == 1) {\r
- if (mode == kPMpT)\r
- // Take the logarithm in case of pT\r
- xBinCentres[xBinIndexTemp] = TMath::Log((binsPt[slice + 1] + binsPt[slice]) / 2.);\r
- else\r
- xBinCentres[xBinIndexTemp] = hFractionPions->GetXaxis()->GetBinCenter(slice + 1);\r
- \r
- xBinStatisticalWeight[xBinIndexTemp] = totalYield;\r
- \r
- // NOTE: The total yield is a fact - a number w/o error. However, one assigns this error here to use it\r
- // to calculate the effective weighting for the weighted likelihood fit (and the error is only used for this).\r
- // So, it is more like a weighting than an error...\r
- xBinStatisticalWeightError[xBinIndexTemp] = totalYieldError;\r
- \r
- \r
- // Mark the fractions for all species except for electrons and muons in this bin for regularisation\r
- for (Int_t speciesIndex = 0; speciesIndex < AliPID::kSPECIES - 2; speciesIndex++)\r
- indexParametersToRegularise[internalParIndexTemp++] = numParamsPerXbin * xBinIndexTemp + speciesIndex;\r
- \r
- // Also mark electrons for regularisation in this bin, if not fixed\r
- if( !(mode == kPMpT && slice >= electronFractionThresholdBinForFitting) ) {\r
- indexParametersToRegularise[internalParIndexTemp++] = numParamsPerXbin * xBinIndexTemp + 3; \r
- }\r
- else {\r
- // Set the index of the last x bin in which the parameter is not fixed.\r
- // If the parameter is fixed in all x bins, this index will be -1.\r
- if (xBinIndexTemp - 1 < lastNotFixedIndexOfParameters[3])\r
- lastNotFixedIndexOfParameters[3] = xBinIndexTemp - 1;\r
- }\r
- \r
- // Also mark muons for regularisation in this bin, if not fixed\r
- if( !(mode != kPMpT || slice >= muonFractionThresholdBinForFitting) ) {\r
- indexParametersToRegularise[internalParIndexTemp++] = numParamsPerXbin * xBinIndexTemp + 4; \r
- }\r
- else {\r
- // Set the index of the last x bin in which the parameter is not fixed.\r
- // If the parameter is fixed in all x bins, this index will be -1.\r
- if (xBinIndexTemp - 1 < lastNotFixedIndexOfParameters[4])\r
- lastNotFixedIndexOfParameters[4] = xBinIndexTemp - 1;\r
- }\r
- \r
- xBinIndexTemp++;\r
- }\r
- \r
- if (i == 0) {\r
- nParToRegulariseSimultaneousFit += AliPID::kSPECIES - 2; // Fracs for all species in this bin except for electrons and muons\r
-\r
- if( !(mode == kPMpT && slice >= electronFractionThresholdBinForFitting) )\r
- nParToRegulariseSimultaneousFit++; // Also regularise electrons in this bin (not fixed)\r
- \r
- if( !(mode != kPMpT || slice >= muonFractionThresholdBinForFitting) )\r
- nParToRegulariseSimultaneousFit++; // Also regularise muons in this bin (not fixed)\r
-\r
- numXBins++;\r
- }\r
- }\r
- }\r
- }\r
- AliTPCPIDmathFit* mathFit = 0x0;\r
- \r
- if (regularisation > 0) {\r
- mathFit = (fitMethod == 2) ? AliTPCPIDmathFit::Instance(numXBins, 4, 1810)\r
- : AliTPCPIDmathFit::Instance(numXBins, 1, 1810);\r
- }\r
- else {\r
- mathFit = (fitMethod == 2) ? AliTPCPIDmathFit::Instance(1, 4, 1810)\r
- : AliTPCPIDmathFit::Instance(1, 1, 1810);\r
- }\r
- \r
- mathFit->SetDebugLevel(0); \r
- mathFit->SetEpsilon(5e-05);\r
- mathFit->SetMaxCalls(1e8);\r
- \r
- mathFit->SetMinimisationStrategy(minimisationStrategy);\r
- \r
- mathFit->SetUseLogLikelihood(useLogLikelihood);\r
- mathFit->SetUseWeightsForLogLikelihood(useWeightsForLogLikelihood);\r
- \r
- if (fitMethod == 2) {\r
- // If the deltaPrime range is large enough, we artificially get a factor 4 in statistics by looking at the four\r
- // different deltaPrimeSpecies, which have (except for binning effects) the same information. \r
- // Therefore, to get the "real" statistical error, we need to multiply the obtained error by sqrt(4) = 2\r
- mathFit->SetScaleFactorError(2.);\r
- }\r
- \r
- mathFit->SetRegularisation(regularisation, regularisationFactor);\r
- \r
- // Number of parameters for fitting\r
- const Int_t nPar = 11;\r
- \r
- // Fracs of each species + total yield in x bin\r
- const Int_t nParSimultaneousFit = AliPID::kSPECIES + 1; \r
- \r
- // Fracs of each species in x bin + tot yield in x bin\r
- const Int_t nParSimultaneousFitRegularised = numXBins * (AliPID::kSPECIES + 1); \r
- \r
- if (regularisation > 0) {\r
- if (!mathFit->SetParametersToRegularise(nParToRegulariseSimultaneousFit, numParamsPerXbin, indexParametersToRegularise,\r
- lastNotFixedIndexOfParameters, xBinCentres, xBinStatisticalWeight, \r
- xBinStatisticalWeightError))\r
- return -1;\r
- }\r
- \r
- delete xBinCentres;\r
- xBinCentres = 0x0;\r
- \r
- delete xBinStatisticalWeight;\r
- xBinStatisticalWeight = 0x0;\r
- \r
- delete xBinStatisticalWeightError;\r
- xBinStatisticalWeight = 0x0;\r
- \r
- delete indexParametersToRegularise;\r
- indexParametersToRegularise = 0x0;\r
- \r
- delete lastNotFixedIndexOfParameters;\r
- lastNotFixedIndexOfParameters = 0x0;\r
- \r
- \r
- \r
- gFractionElectronsData = new TGraphErrors(numXBins);\r
- \r
- // Fit each slice with sum of 4/5 shapes with means and sigmas fixed from last fitting step\r
- // For electrons: Fit up to certain pT bin and use constant value for higher momenta\r
- \r
- // Two iterations required for regularisation\r
- Bool_t regularisedFitDone = kFALSE;\r
- Double_t reducedChiSquareRegularisation = -1;\r
- \r
- Double_t gausParamsSimultaneousFitRegularised[nParSimultaneousFitRegularised];\r
- Double_t parameterErrorsOutRegularised[nParSimultaneousFitRegularised];\r
- Double_t lowParLimitsSimultaneousFitRegularised[nParSimultaneousFitRegularised];\r
- Double_t upParLimitsSimultaneousFitRegularised[nParSimultaneousFitRegularised];\r
- Double_t stepSizeSimultaneousFitRegularised[nParSimultaneousFitRegularised];\r
- \r
- for (Int_t i = 0; i < nParSimultaneousFitRegularised; i++) {\r
- gausParamsSimultaneousFitRegularised[i] = 0;\r
- parameterErrorsOutRegularised[i] = 0;\r
- lowParLimitsSimultaneousFitRegularised[i] = 0;\r
- upParLimitsSimultaneousFitRegularised[i] = 0;\r
- stepSizeSimultaneousFitRegularised[i] = 0;\r
- }\r
- \r
- mathFit->ClearRefHistos();\r
- \r
- \r
- const Int_t nParUsed = (fitMethod == 2) ? ((regularisation <= 0) ? nParSimultaneousFit: nParSimultaneousFitRegularised) : nPar;\r
- Double_t parameterErrorsOut[nParUsed];\r
- Double_t covMatrix[nParUsed][nParUsed];\r
- \r
- for (Int_t iter = 0; iter < 2; iter++) {\r
- if (regularisation <= 0 && iter == 0)\r
- continue; // Only one iteration w/o regularisation\r
- \r
- Int_t currXbin = 0;\r
- \r
- for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hFractionPions->GetXaxis()->GetNbins(); slice++) { \r
- if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))\r
- continue; \r
- \r
- // There won't (actually: shouldn't) be tracks with a pT larger than the jet pT\r
- if (mode == kPMpT && restrictJetPtAxis && binsPt[slice] >= actualUpperJetPt)\r
- continue;\r
- \r
- if (regularisation <= 0) {\r
- if (mode == kPMpT)\r
- std::cout << "Fitting range " << binsPt[slice] << " GeV/c < Pt < " << binsPt[slice + 1] << " GeV/c..." << std::endl;\r
- else {\r
- std::cout << "Fitting range " << hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1) << " < " << modeShortName[mode].Data() << " < ";\r
- std::cout << hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1) << "..." << std::endl;\r
- }\r
- }\r
- \r
- // Add/subtract some very small offset to be sure not to sit on the bin boundary, when looking for the integration/projection limits.\r
- const Int_t pBinLowProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice] + 1e-5) : slice + 1;\r
- const Int_t pBinUpProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice + 1]- 1e-5) : slice + 1;\r
- \r
- // Also take into account bin width in delta(Prime) plots -> Multiply by binWidthFitHisto\r
- const Double_t totalYield = binWidthFitHisto * hYieldPt->Integral(pBinLowProjLimit, pBinUpProjLimit);\r
- \r
- if (totalYield <= 0) {\r
- std::cout << "Skipped bin (yield is zero)!" << std::endl;\r
- continue;\r
- }\r
- \r
- const Double_t allDeltaPion = hDeltaPi[slice]->Integral();\r
- const Double_t allDeltaElectron = hDeltaEl[slice]->Integral();\r
- const Double_t allDeltaKaon = hDeltaKa[slice]->Integral();\r
- const Double_t allDeltaProton = hDeltaPr[slice]->Integral();\r
- \r
- // inverseBinWidth = 1.0, if the raw yield for each bin is requested.\r
- // If divided by the bin size, the histograms give "yield per unit pT in the corresponding bin" or dN/dpT\r
- Double_t inverseBinWidth = (mode == kPMpT) ? 1.0 / (binsPt[slice + 1] - binsPt[slice])\r
- : 1.0 / hYieldPt->GetBinWidth(slice + 1); \r
- \r
- TH1D *hGenDeltaElForElProj = 0x0, *hGenDeltaKaForElProj = 0x0, *hGenDeltaPiForElProj = 0x0, *hGenDeltaPrForElProj = 0x0;\r
- TH1D *hGenDeltaElForKaProj = 0x0, *hGenDeltaKaForKaProj = 0x0, *hGenDeltaPiForKaProj = 0x0, *hGenDeltaPrForKaProj = 0x0;\r
- TH1D *hGenDeltaElForPiProj = 0x0, *hGenDeltaKaForPiProj = 0x0, *hGenDeltaPiForPiProj = 0x0, *hGenDeltaPrForPiProj = 0x0;\r
- TH1D *hGenDeltaElForMuProj = 0x0, *hGenDeltaKaForMuProj = 0x0, *hGenDeltaPiForMuProj = 0x0, *hGenDeltaPrForMuProj = 0x0;\r
- TH1D *hGenDeltaElForPrProj = 0x0, *hGenDeltaKaForPrProj = 0x0, *hGenDeltaPiForPrProj = 0x0, *hGenDeltaPrForPrProj = 0x0;\r
- \r
- TH2D* hGenDeltaUsed[6][6];\r
- if (useIdentifiedGeneratedSpectra) { \r
- for (Int_t i = 0; i < 6; i++) {\r
- for (Int_t j = 0; j < 6; j++) {\r
- hGenDeltaUsed[i][j] = hGenDeltaMCid[i][j];\r
- }\r
- }\r
- }\r
- else {\r
- for (Int_t i = 0; i < 6; i++) {\r
- for (Int_t j = 0; j < 6; j++) {\r
- hGenDeltaUsed[i][j] = hGenDelta[i][j];\r
- }\r
- }\r
- }\r
- \r
- hGenDeltaElForElProj =(TH1D*)hGenDeltaUsed[kEl][kEl]->ProjectionY(Form("hGenDeltaElForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaKaForElProj =(TH1D*)hGenDeltaUsed[kKa][kEl]->ProjectionY(Form("hGenDeltaKaForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPiForElProj =(TH1D*)hGenDeltaUsed[kPi][kEl]->ProjectionY(Form("hGenDeltaPiForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPrForElProj =(TH1D*)hGenDeltaUsed[kPr][kEl]->ProjectionY(Form("hGenDeltaPrForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- \r
- hGenDeltaElForKaProj =(TH1D*)hGenDeltaUsed[kEl][kKa]->ProjectionY(Form("hGenDeltaElForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaKaForKaProj =(TH1D*)hGenDeltaUsed[kKa][kKa]->ProjectionY(Form("hGenDeltaKaForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPiForKaProj =(TH1D*)hGenDeltaUsed[kPi][kKa]->ProjectionY(Form("hGenDeltaPiForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPrForKaProj =(TH1D*)hGenDeltaUsed[kPr][kKa]->ProjectionY(Form("hGenDeltaPrForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- \r
- hGenDeltaElForPiProj =(TH1D*)hGenDeltaUsed[kEl][kPi]->ProjectionY(Form("hGenDeltaElForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaKaForPiProj =(TH1D*)hGenDeltaUsed[kKa][kPi]->ProjectionY(Form("hGenDeltaKaForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPiForPiProj =(TH1D*)hGenDeltaUsed[kPi][kPi]->ProjectionY(Form("hGenDeltaPiForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPrForPiProj =(TH1D*)hGenDeltaUsed[kPr][kPi]->ProjectionY(Form("hGenDeltaPrForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaElForMuProj =(TH1D*)hGenDeltaUsed[kEl][kMu]->ProjectionY(Form("hGenDeltaElForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaKaForMuProj =(TH1D*)hGenDeltaUsed[kKa][kMu]->ProjectionY(Form("hGenDeltaKaForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPiForMuProj =(TH1D*)hGenDeltaUsed[kPi][kMu]->ProjectionY(Form("hGenDeltaPiForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPrForMuProj =(TH1D*)hGenDeltaUsed[kPr][kMu]->ProjectionY(Form("hGenDeltaPrForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- }\r
- \r
- hGenDeltaElForPrProj =(TH1D*)hGenDeltaUsed[kEl][kPr]->ProjectionY(Form("hGenDeltaElForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaKaForPrProj =(TH1D*)hGenDeltaUsed[kKa][kPr]->ProjectionY(Form("hGenDeltaKaForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPiForPrProj =(TH1D*)hGenDeltaUsed[kPi][kPr]->ProjectionY(Form("hGenDeltaPiForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- hGenDeltaPrForPrProj =(TH1D*)hGenDeltaUsed[kPr][kPr]->ProjectionY(Form("hGenDeltaPrForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");\r
- \r
- \r
- \r
- if (fitMethod == 2) {\r
- // Normalise generated histos to TOTAL number of GENERATED particles for this species (i.e. including\r
- // entries that lie in the under or overflow bin), so that situations in which the generated spectra lie\r
- // at least partly outside the histo are treated properly. To find the total number of generated particle\r
- // species X, one can just take the integral of the generated histo for DeltaX (which should include all\r
- // generated entries) and apply the same normalisation factor to all other DeltaSpecies.\r
- // Also set some cosmetics\r
- \r
- // Generated electrons\r
- Double_t normEl = normaliseHist(hGenDeltaElForElProj, -1);\r
- normaliseHist(hGenDeltaKaForElProj, normEl);\r
- normaliseHist(hGenDeltaPiForElProj, normEl);\r
- normaliseHist(hGenDeltaPrForElProj, normEl);\r
- \r
- \r
- // Generated kaons\r
- Double_t normKa = normaliseHist(hGenDeltaKaForKaProj, -1);\r
- normaliseHist(hGenDeltaElForKaProj, normKa);\r
- normaliseHist(hGenDeltaPiForKaProj, normKa);\r
- normaliseHist(hGenDeltaPrForKaProj, normKa);\r
- \r
- \r
- // Generated pions\r
- Double_t normPi = normaliseHist(hGenDeltaPiForPiProj, -1);\r
- normaliseHist(hGenDeltaElForPiProj, normPi);\r
- normaliseHist(hGenDeltaKaForPiProj, normPi);\r
- normaliseHist(hGenDeltaPrForPiProj, normPi);\r
- \r
-\r
- Double_t normMu = 1;\r
- if (takeIntoAccountMuons) {\r
- // Generated pions\r
- // Since masses of muons and pions are so similar, the normalisation scheme should still work when looking at deltaPion instead\r
- normMu = normaliseHist(hGenDeltaPiForMuProj, -1);\r
- normaliseHist(hGenDeltaElForMuProj, normMu);\r
- normaliseHist(hGenDeltaKaForMuProj, normMu);\r
- normaliseHist(hGenDeltaPrForMuProj, normMu);\r
- }\r
- \r
- \r
- // Generated protons\r
- Double_t normPr = normaliseHist(hGenDeltaPrForPrProj, -1);\r
- normaliseHist(hGenDeltaElForPrProj, normPr); \r
- normaliseHist(hGenDeltaKaForPrProj, normPr);\r
- normaliseHist(hGenDeltaPiForPrProj, normPr);\r
- }\r
- else {\r
- // Normalise generated histos to total number of particles for this delta\r
- // and also set some cosmetics\r
- \r
- // DeltaEl\r
- normaliseHist(hGenDeltaElForElProj);\r
- normaliseHist(hGenDeltaElForKaProj);\r
- normaliseHist(hGenDeltaElForPiProj);\r
- if (takeIntoAccountMuons)\r
- normaliseHist(hGenDeltaElForMuProj);\r
- normaliseHist(hGenDeltaElForPrProj); \r
- \r
- // DeltaKa\r
- normaliseHist(hGenDeltaKaForElProj);\r
- normaliseHist(hGenDeltaKaForKaProj);\r
- normaliseHist(hGenDeltaKaForPiProj);\r
- if (takeIntoAccountMuons)\r
- normaliseHist(hGenDeltaKaForMuProj);\r
- normaliseHist(hGenDeltaKaForPrProj);\r
- \r
- // DeltaPi\r
- normaliseHist(hGenDeltaPiForElProj);\r
- normaliseHist(hGenDeltaPiForKaProj);\r
- normaliseHist(hGenDeltaPiForPiProj);\r
- if (takeIntoAccountMuons)\r
- normaliseHist(hGenDeltaPiForMuProj);\r
- normaliseHist(hGenDeltaPiForPrProj);\r
- \r
- // DeltaPr\r
- normaliseHist(hGenDeltaPrForElProj);\r
- normaliseHist(hGenDeltaPrForKaProj);\r
- normaliseHist(hGenDeltaPrForPiProj);\r
- if (takeIntoAccountMuons)\r
- normaliseHist(hGenDeltaPrForMuProj);\r
- normaliseHist(hGenDeltaPrForPrProj);\r
- }\r
-\r
- \r
- TF1* totalDeltaPion = 0x0;\r
- TF1* totalDeltaKaon = 0x0;\r
- TF1* totalDeltaProton = 0x0;\r
- TF1* totalDeltaElectron = 0x0;\r
- \r
- TLegend* legend = 0x0;\r
- \r
- if (iter == 1) { // Only needed for second iteration (= the only iteration w/o regularisation)\r
- // The number of parameters and their values will always be adjusted, such that using nPar parameters is fine\r
- totalDeltaPion = new TF1(Form("totalDeltaPion_slice%d", slice), (fitMethod == 2) ? multiGaussFitDeltaPi : multiGaussFit, \r
- xLow, xUp, nPar);\r
- setUpFitFunction(totalDeltaPion, nBins);\r
- \r
- totalDeltaKaon = new TF1(Form("totalDeltaKaon_slice%d", slice), (fitMethod == 2) ? multiGaussFitDeltaKa : multiGaussFit,\r
- xLow, xUp, nPar);\r
- setUpFitFunction(totalDeltaKaon, nBins);\r
- \r
- totalDeltaProton = new TF1(Form("totalDeltaProton_slice%d", slice), (fitMethod == 2) ? multiGaussFitDeltaPr : multiGaussFit, \r
- xLow, xUp, nPar);\r
- setUpFitFunction(totalDeltaProton, nBins);\r
- \r
- totalDeltaElectron = new TF1(Form("totalDeltaElectron_slice%d", slice), \r
- (fitMethod == 2) ? multiGaussFitDeltaEl : multiGaussFit,\r
- xLow, xUp, nPar);\r
- setUpFitFunction(totalDeltaElectron, nBins);\r
- \r
- // Legend is the same for all \Delta "species" plots\r
- legend = new TLegend(0.722126, 0.605932, 0.962069, 0.925932);\r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- if (plotIdentifiedSpectra)\r
- legend->SetNColumns(2);\r
- legend->AddEntry((TObject*)0x0, "Fit", "");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry((TObject*)0x0, identifiedLabels[isMC].Data(), "");\r
- \r
- legend->AddEntry(hDeltaPi[slice], "Data", "Lp");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry((TObject*)0x0, "", "");\r
- \r
- legend->AddEntry(totalDeltaPion, "Multi-template fit", "L");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hMCmuonsAndPionsDummy, "#mu + #pi", "Lp");\r
- \r
- if (takeIntoAccountMuons)\r
- legend->AddEntry(hGenDeltaPiForMuProj, "#mu", "Lp");\r
- else if (plotIdentifiedSpectra)\r
- legend->AddEntry((TObject*)0x0, "", "");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hDeltaPiMC[slice][kMu - 1], "#mu", "Lp");\r
- \r
- legend->AddEntry(hGenDeltaPiForPiProj, takeIntoAccountMuons ? "#pi" : "#pi + #mu", "Lp");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hDeltaPiMC[slice][kPi - 1], "#pi", "Lp");\r
- \r
- legend->AddEntry(hGenDeltaPiForKaProj, "K", "Lp");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hDeltaPiMC[slice][kKa - 1], "K", "Lp");\r
- \r
- legend->AddEntry(hGenDeltaPiForPrProj, "p", "Lp");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hDeltaPiMC[slice][kPr - 1], "p", "Lp");\r
- \r
- legend->AddEntry(hGenDeltaPiForElProj, "e", "Lp");\r
- if (plotIdentifiedSpectra) \r
- legend->AddEntry(hDeltaPiMC[slice][kEl -1], "e", "Lp");\r
- }\r
- \r
- \r
- // Allow tolerance of +-2% (for delta -> assume dEdx = 80 and take +-2%)\r
- //const Double_t peakTolerance = (useDeltaPrime ? 0.8 : 1.0) / hGenDeltaElForElProj->GetXaxis()->GetBinWidth(1);\r
- //const Double_t shiftStepSize = 0.01;\r
- const Double_t peakTolerance = (useDeltaPrime ? 0.02 : 1.6);\r
- const Double_t shiftStepSize = 0.01;\r
- \r
- // Assume fractions vs. pT to be smooth. Allow 1 sigma variations from bin to bin. For small pT, the error will be very small.\r
- // Therefore, allow at least a change of some percent.\r
- const Double_t nSigma = 1.;\r
- const Double_t minChange = 1.0; // This disables the sigma restriction\r
- \r
- Double_t fractionPions = (muonContamination ? 0.87 : 0.88);\r
- \r
- Double_t fractionErrorUpPions = 1.;\r
- Double_t fractionErrorLowPions = 0.;\r
- \r
- Int_t xBinInit = 0;\r
- if (initialiseWithFractionsFromFile) {\r
- Double_t xBinCentre = (mode == kPMpT) ? (binsPt[slice + 1] + binsPt[slice]) / 2.\r
- : hYieldPt->GetXaxis()->GetBinCenter(slice + 1); \r
- xBinInit = hInitFracPi->GetXaxis()->FindBin(xBinCentre);\r
- fractionPions = hInitFracPi->GetBinContent(xBinInit) + (muonContamination ? hInitFracMu->GetBinContent(xBinInit) : 0.);\r
- }\r
- else {\r
- // Set found fraction from last slice, if available. Note: Current bin for slice = slice + 1\r
- // => Bin for last slice = slice\r
- if (hFractionPions->GetBinContent(slice) > 0 && hFractionPions->GetBinError(slice) > 0) {\r
- fractionPions = hFractionPions->GetBinContent(slice);\r
- fractionErrorUpPions = TMath::Min(1.0, fractionPions + TMath::Max(minChange, nSigma * hFractionPions->GetBinError(slice)));\r
- fractionErrorLowPions = TMath::Max(0.0, fractionPions - TMath::Max(minChange, nSigma * hFractionPions->GetBinError(slice)));\r
- }\r
- }\r
- \r
- Double_t fractionKaons = 0.08;\r
- Double_t fractionErrorUpKaons = 1.;\r
- Double_t fractionErrorLowKaons = 0.;\r
- \r
- if (initialiseWithFractionsFromFile) {\r
- fractionKaons = hInitFracKa->GetBinContent(xBinInit);\r
- }\r
- else {\r
- if (hFractionKaons->GetBinContent(slice) > 0 && hFractionKaons->GetBinError(slice) > 0) {\r
- fractionKaons = hFractionKaons->GetBinContent(slice);\r
- fractionErrorUpKaons = TMath::Min(1.0, fractionKaons + TMath::Max(minChange, nSigma * hFractionKaons->GetBinError(slice)));\r
- fractionErrorLowKaons = TMath::Max(0.0, fractionKaons - TMath::Max(minChange, nSigma * hFractionKaons->GetBinError(slice)));\r
- }\r
- }\r
- \r
- Double_t fractionProtons = 0.02;\r
- Double_t fractionErrorUpProtons = 1.;\r
- Double_t fractionErrorLowProtons = 0.;\r
- \r
- if (initialiseWithFractionsFromFile) {\r
- fractionProtons = hInitFracPr->GetBinContent(xBinInit);\r
- }\r
- else {\r
- if (hFractionProtons->GetBinContent(slice) > 0 && hFractionProtons->GetBinError(slice) > 0) {\r
- fractionProtons = hFractionProtons->GetBinContent(slice);\r
- fractionErrorUpProtons = TMath::Min(1.0, fractionProtons +\r
- TMath::Max(minChange, nSigma * hFractionProtons->GetBinError(slice)));\r
- fractionErrorLowProtons = TMath::Max(0.0, fractionProtons -\r
- TMath::Max(minChange, nSigma * hFractionProtons->GetBinError(slice)));\r
- }\r
- }\r
- \r
- Double_t fractionElectrons = (takeIntoAccountMuons ? 0.01 : 0.02);\r
- Double_t fractionErrorUpElectrons = 1.;\r
- Double_t fractionErrorLowElectrons = 0.;\r
- \r
- if (initialiseWithFractionsFromFile) {\r
- fractionElectrons = hInitFracEl->GetBinContent(xBinInit);\r
- }\r
- else {\r
- if (hFractionElectrons->GetBinContent(slice) > 0 && hFractionElectrons->GetBinError(slice) > 0) {\r
- fractionElectrons = hFractionElectrons->GetBinContent(slice);\r
- fractionErrorUpElectrons = TMath::Min(1.0, fractionElectrons + \r
- TMath::Max(minChange, nSigma * hFractionElectrons->GetBinError(slice)));\r
- fractionErrorLowElectrons = TMath::Max(0.0, fractionElectrons -\r
- TMath::Max(minChange, nSigma * hFractionElectrons->GetBinError(slice)));\r
- }\r
- }\r
- \r
- Double_t fractionMuons = (takeIntoAccountMuons ? 0.01 : 0.);\r
- Double_t fractionErrorUpMuons = 1.;\r
- Double_t fractionErrorLowMuons = 0.;\r
- if (!takeIntoAccountMuons) {\r
- fractionErrorUpMuons = 0.;\r
- fractionErrorLowMuons = 0.;\r
- }\r
- else {\r
- if (initialiseWithFractionsFromFile) {\r
- fractionMuons = hInitFracMu->GetBinContent(xBinInit);\r
- }\r
- else {\r
- if (hFractionMuons->GetBinContent(slice) > 0 && hFractionMuons->GetBinError(slice) > 0) {\r
- fractionMuons = hFractionMuons->GetBinContent(slice);\r
- fractionErrorUpMuons = TMath::Min(1.0, fractionMuons + TMath::Max(minChange, nSigma * hFractionMuons->GetBinError(slice)));\r
- fractionErrorLowMuons = TMath::Max(0.0, fractionMuons - TMath::Max(minChange, nSigma * hFractionMuons->GetBinError(slice)));\r
- }\r
- }\r
- }\r
- \r
- Double_t gausParamsPi[nPar] = { \r
- fractionPions,\r
- fractionKaons,\r
- fractionProtons,\r
- fractionElectrons,\r
- fractionMuons,\r
- allDeltaPion,\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
- 0\r
- };\r
- \r
- Double_t gausParamsEl[nPar] = { \r
- fractionPions,\r
- fractionKaons,\r
- fractionProtons,\r
- fractionElectrons,\r
- fractionMuons,\r
- allDeltaElectron,\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
- 0\r
- };\r
- \r
- Double_t gausParamsKa[nPar] = { \r
- fractionPions,\r
- fractionKaons,\r
- fractionProtons,\r
- fractionElectrons,\r
- fractionMuons,\r
- allDeltaKaon,\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
- 0\r
- };\r
- \r
- Double_t gausParamsPr[nPar] = { \r
- fractionPions,\r
- fractionKaons,\r
- fractionProtons,\r
- fractionElectrons,\r
- fractionMuons,\r
- allDeltaProton,\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
- 0\r
- };\r
- \r
- Double_t lowParLimitsPi[nPar] = {\r
- fractionErrorLowPions,\r
- fractionErrorLowKaons,\r
- fractionErrorLowProtons,\r
- fractionErrorLowElectrons,\r
- fractionErrorLowMuons,\r
- allDeltaPion,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance\r
- };\r
- \r
- Double_t lowParLimitsEl[nPar] = {\r
- fractionErrorLowPions,\r
- fractionErrorLowKaons,\r
- fractionErrorLowProtons,\r
- fractionErrorLowElectrons,\r
- fractionErrorLowMuons,\r
- allDeltaElectron,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance\r
- };\r
- \r
- Double_t lowParLimitsKa[nPar] = {\r
- fractionErrorLowPions,\r
- fractionErrorLowKaons,\r
- fractionErrorLowProtons,\r
- fractionErrorLowElectrons,\r
- fractionErrorLowMuons,\r
- allDeltaKaon,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance\r
- };\r
- \r
- Double_t lowParLimitsPr[nPar] = {\r
- fractionErrorLowPions,\r
- fractionErrorLowKaons,\r
- fractionErrorLowProtons,\r
- fractionErrorLowElectrons,\r
- fractionErrorLowMuons,\r
- allDeltaProton,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance,\r
- -peakTolerance\r
- -peakTolerance\r
- };\r
- \r
- \r
- Double_t upParLimitsPi[nPar] = {\r
- fractionErrorUpPions,\r
- fractionErrorUpKaons,\r
- fractionErrorUpProtons,\r
- fractionErrorUpElectrons,\r
- fractionErrorUpMuons,\r
- allDeltaPion,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance\r
- };\r
- \r
- Double_t upParLimitsEl[nPar] = {\r
- fractionErrorUpPions,\r
- fractionErrorUpKaons,\r
- fractionErrorUpProtons,\r
- fractionErrorUpElectrons,\r
- fractionErrorUpMuons,\r
- allDeltaElectron,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance\r
- };\r
- \r
- Double_t upParLimitsKa[nPar] = {\r
- fractionErrorUpPions,\r
- fractionErrorUpKaons,\r
- fractionErrorUpProtons,\r
- fractionErrorUpElectrons,\r
- fractionErrorUpMuons,\r
- allDeltaKaon,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance\r
- };\r
- \r
- Double_t upParLimitsPr[nPar] = {\r
- fractionErrorUpPions,\r
- fractionErrorUpKaons,\r
- fractionErrorUpProtons,\r
- fractionErrorUpElectrons,\r
- fractionErrorUpMuons,\r
- allDeltaProton,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- peakTolerance,\r
- };\r
- \r
- Double_t stepSize[nPar] = {\r
- 0.1,\r
- 0.1,\r
- 0.1,\r
- 0.1,\r
- (takeIntoAccountMuons ? 0.1 : 0.),\r
- \r
- 0.0,\r
- \r
- enableShift ? shiftStepSize : 0.,\r
- enableShift ? shiftStepSize : 0.,\r
- enableShift ? shiftStepSize : 0.,\r
- enableShift ? shiftStepSize : 0.,\r
- (enableShift && takeIntoAccountMuons) ? shiftStepSize : 0.\r
- };\r
- \r
- \r
- Double_t gausParamsSimultaneousFit[nParSimultaneousFit] = { \r
- fractionPions,\r
- fractionKaons,\r
- fractionProtons,\r
- fractionElectrons,\r
- fractionMuons,\r
- totalYield\r
- // No shifts because they do not make too much sense (different eta + possible deviations from Bethe-Bloch in one x-Bin)\r
- };\r
- \r
- Double_t lowParLimitsSimultaneousFit[nParSimultaneousFit] = {\r
- fractionErrorLowPions,\r
- fractionErrorLowKaons,\r
- fractionErrorLowProtons,\r
- fractionErrorLowElectrons,\r
- fractionErrorLowMuons,\r
- totalYield\r
- };\r
- \r
- Double_t upParLimitsSimultaneousFit[nParSimultaneousFit] = {\r
- fractionErrorUpPions,\r
- fractionErrorUpKaons,\r
- fractionErrorUpProtons,\r
- fractionErrorUpElectrons,\r
- fractionErrorUpMuons,\r
- totalYield\r
- };\r
- \r
- Double_t stepSizeSimultaneousFit[nParSimultaneousFit] = {\r
- 0.1,\r
- 0.1,\r
- 0.1,\r
- 0.1,\r
- (takeIntoAccountMuons ? 0.1 : 0.),\r
- \r
- 0.0\r
- };\r
- \r
- if (regularisation <= 0 && iter == 1) {\r
- // In case of no regularisation, do the fit of the electron fraction here (compare comment below)\r
- if (mode == kPMpT && slice == electronFractionThresholdBinForFitting) \r
- hFractionElectrons->Fit(fElectronFraction, "N", "", lowFittingBoundElectronFraction, electronFractionThresholdForFitting);\r
- }\r
- \r
- if ((regularisation > 0 && iter == 0) || (regularisation <= 0 && iter == 1)) {\r
- // Set the electron fraction to the negative pT -> A function will be used\r
- // to evaluate the electron fraction for each bin above the threshold\r
- if(mode == kPMpT && slice >= electronFractionThresholdBinForFitting) {\r
- // In case of no regularisation, mathFit has no information about the fraction of other x bins.\r
- // Thus, the electron fraction is evaluated and set here. For the case w/ regularisation,\r
- // just "-pT" is set and the electron fraction will be evaluated during the fit.\r
- Double_t fixElectronFraction = (regularisation <= 0) ? fElectronFraction->Eval((binsPt[slice + 1] + binsPt[slice]) / 2.)\r
- : -(binsPt[slice + 1] + binsPt[slice]) / 2.;\r
- \r
- if (regularisation <= 0) {\r
- fixElectronFraction = TMath::Min(1.0, fixElectronFraction);\r
- fixElectronFraction = TMath::Max(0.0, fixElectronFraction);\r
- }\r
- \r
- gausParamsPi[3] = fixElectronFraction;\r
- lowParLimitsPi[3] = fixElectronFraction;\r
- upParLimitsPi[3] = fixElectronFraction;\r
- \r
- gausParamsEl[3] = fixElectronFraction;\r
- lowParLimitsEl[3] = fixElectronFraction;\r
- upParLimitsEl[3] = fixElectronFraction;\r
- \r
- gausParamsKa[3] = fixElectronFraction;\r
- lowParLimitsKa[3] = fixElectronFraction;\r
- upParLimitsKa[3] = fixElectronFraction;\r
- \r
- gausParamsPr[3] = fixElectronFraction;\r
- lowParLimitsPr[3] = fixElectronFraction;\r
- upParLimitsPr[3] = fixElectronFraction;\r
- \r
- stepSize[3] = 0.0;\r
- \r
- gausParamsSimultaneousFit[3] = fixElectronFraction;\r
- lowParLimitsSimultaneousFit[3] = fixElectronFraction;\r
- upParLimitsSimultaneousFit[3] = fixElectronFraction;\r
- \r
- stepSizeSimultaneousFit[3] = 0.0;\r
- } \r
- \r
- \r
- // Set muon fraction equal to (some modified) electron fraction above some threshold, which should be a reasonable approximation:\r
- // Fixed muon fraction < 0 does this job within the fitting functions\r
- if(mode != kPMpT || slice >= muonFractionThresholdBinForFitting) {\r
- // "Abuse" the muon fraction to forward the pT, which can then be used to get some modified electron fraction\r
- const Double_t fixedValue = -(binsPt[slice] + binsPt[slice + 1]) / 2.;\r
- gausParamsPi[4] = fixedValue;\r
- lowParLimitsPi[4] = fixedValue;\r
- upParLimitsPi[4] = fixedValue;\r
- \r
- gausParamsEl[4] = fixedValue;\r
- lowParLimitsEl[4] = fixedValue;\r
- upParLimitsEl[4] = fixedValue;\r
- \r
- gausParamsKa[4] = fixedValue;\r
- lowParLimitsKa[4] = fixedValue;\r
- upParLimitsKa[4] = fixedValue;\r
- \r
- gausParamsPr[4] = fixedValue;\r
- lowParLimitsPr[4] = fixedValue;\r
- upParLimitsPr[4] = fixedValue;\r
- \r
- stepSize[4] = 0.;\r
- \r
- gausParamsSimultaneousFit[4] = fixedValue;\r
- lowParLimitsSimultaneousFit[4] = fixedValue;\r
- upParLimitsSimultaneousFit[4] = fixedValue;\r
- \r
- stepSizeSimultaneousFit[4] = 0.0;\r
- }\r
- }\r
- \r
- // iter 0 used for initialisation\r
- if (regularisation > 0 && iter == 0) {\r
- const Int_t offset = currXbin * mathFit->GetNumParametersPerXbin();\r
- for (Int_t i = 0; i < mathFit->GetNumParametersPerXbin(); i++) {\r
- gausParamsSimultaneousFitRegularised[offset + i] = gausParamsSimultaneousFit[i];\r
- lowParLimitsSimultaneousFitRegularised[offset + i] = lowParLimitsSimultaneousFit[i];\r
- upParLimitsSimultaneousFitRegularised[offset + i] = upParLimitsSimultaneousFit[i];\r
- stepSizeSimultaneousFitRegularised[offset + i] = stepSizeSimultaneousFit[i];\r
- }\r
- }\r
- \r
- \r
- if (iter == 1) {\r
- // The parameters are only used for fitMethod < 2. Thus, they can be set for these methods,\r
- // although a different method is used\r
- totalDeltaPion->SetParameters(gausParamsPi);\r
- totalDeltaElectron->SetParameters(gausParamsEl);\r
- totalDeltaKaon->SetParameters(gausParamsKa);\r
- totalDeltaProton->SetParameters(gausParamsPr);\r
- }\r
- \r
- const TString binInfo = (mode == kPMpT) ? Form("%.2f_Pt_%.2f", binsPt[slice], binsPt[slice + 1])\r
- : Form("%.2f_%s_%.2f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1), \r
- modeShortName[mode].Data(), hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));\r
- \r
- const TString binInfoTitle = (mode == kPMpT) ? Form("%.2f < Pt <%.2f", binsPt[slice], binsPt[slice + 1])\r
- : Form("%.2f < %s < %.2f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1), \r
- modeShortName[mode].Data(), \r
- hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));\r
- \r
- const TString fitFuncSuffix = (mode == kPMpT) ? Form("%.3f_Pt_%.3f", binsPt[slice], binsPt[slice + 1])\r
- : Form("%.3f_%s_%.3f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1), \r
- modeShortName[mode].Data(), \r
- hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));\r
- \r
- if (iter == 1) {\r
- for (Int_t species = 0; species < 4; species++) {\r
- cSingleFit[slice][species] = new TCanvas(Form("cSingleFit_%s_%s", binInfo.Data(), speciesLabel[species].Data()), \r
- Form("single fit for %s (%s)", binInfoTitle.Data(), speciesLabel[species].Data()),\r
- 1366, 768);\r
- cSingleFit[slice][species]->Divide(1, 2, 0.01, 0.);\r
- cSingleFit[slice][species]->GetPad(1)->SetRightMargin(0.001);\r
- cSingleFit[slice][species]->GetPad(2)->SetRightMargin(0.001);\r
- cSingleFit[slice][species]->GetPad(1)->SetTopMargin(0.001);\r
- cSingleFit[slice][species]->GetPad(2)->SetTopMargin(0.01);\r
- cSingleFit[slice][species]->GetPad(1)->SetBottomMargin(0.01);\r
- \r
- cSingleFit[slice][species]->GetPad(1)->SetGridx(kTRUE);\r
- cSingleFit[slice][species]->GetPad(2)->SetGridx(kTRUE);\r
- cSingleFit[slice][species]->GetPad(1)->SetGridy(kTRUE);\r
- cSingleFit[slice][species]->GetPad(2)->SetGridy(kTRUE);\r
- \r
- cSingleFit[slice][species]->GetPad(1)->SetLogy(kTRUE);\r
- cSingleFit[slice][species]->GetPad(1)->SetLogx(kTRUE);\r
- cSingleFit[slice][species]->GetPad(2)->SetLogx(kTRUE);\r
- }\r
- }\r
- \r
- // Problem: For p < 0.5 GeV/c, the fractions cannot be simply taken from the parameters because\r
- // not all entries of the histogram are inside the considered range.\r
- // Also: Small deviations of summed fractions from one if taking the fractions from different Delta species histos.\r
- // Therefore: Add up the integrals of the individual fits (\Delta species) and take the fraction of the sum\r
- Double_t integralTotal = 0;\r
- Double_t integralPions = 0, integralKaons = 0, integralProtons = 0, integralElectrons = 0, integralMuons = 0;\r
- \r
- Double_t integralPionsDeltaPion = 0, integralPionsDeltaElectron = 0, integralPionsDeltaKaon = 0, integralPionsDeltaProton = 0;\r
- Double_t integralElectronsDeltaPion = 0, integralElectronsDeltaElectron = 0, integralElectronsDeltaKaon = 0, \r
- integralElectronsDeltaProton = 0;\r
- Double_t integralKaonsDeltaPion = 0, integralKaonsDeltaElectron = 0, integralKaonsDeltaKaon = 0, integralKaonsDeltaProton = 0;\r
- Double_t integralProtonsDeltaPion = 0, integralProtonsDeltaElectron = 0, integralProtonsDeltaKaon = 0, \r
- integralProtonsDeltaProton = 0;\r
- Double_t integralMuonsDeltaPion = 0, integralMuonsDeltaElectron = 0, integralMuonsDeltaKaon = 0, integralMuonsDeltaProton = 0;\r
- \r
- /*\r
- Double_t integralErrorPions = 0, integralErrorKaons = 0, integralErrorProtons = 0, integralErrorElectrons = 0;\r
- \r
- Double_t integralErrorPionsDeltaPion = 0, integralErrorPionsDeltaElectron = 0, integralErrorPionsDeltaKaon = 0, \r
- integralErrorPionsDeltaProton = 0;\r
- Double_t integralErrorElectronsDeltaPion = 0, integralErrorElectronsDeltaElectron = 0, integralErrorElectronsDeltaKaon = 0, \r
- integralErrorElectronsDeltaProton = 0;\r
- Double_t integralErrorKaonsDeltaPion = 0, integralErrorKaonsDeltaElectron = 0, integralErrorKaonsDeltaKaon = 0, \r
- integralErrorKaonsDeltaProton = 0;\r
- Double_t integralErrorProtonsDeltaPion = 0, integralErrorProtonsDeltaElectron = 0, integralErrorProtonsDeltaKaon = 0, \r
- integralErrorProtonsDeltaProton = 0;\r
- \r
- Double_t integralErrorTotalDeltaPion = 0, integralErrorTotalDeltaElectron = 0, integralErrorTotalDeltaKaon = 0; \r
- Double_t integralErrorTotalDeltaProton = 0;\r
- */\r
- \r
- Int_t errFlag = 0;\r
- \r
- // Reset temp arrays for next slice\r
- for (Int_t ind = 0; ind < nParUsed; ind++)\r
- parameterErrorsOut[ind] = 0;\r
- \r
- // Do not reset, if regularisation is on and the fit is done because the covariance matrix\r
- // will not be changed anymore in this case. On the other hand it will only be calculated once,\r
- // so resetting it would mean that is not available anymore.\r
- if (regularisation <= 0 || !regularisedFitDone) {\r
- for (Int_t i = 0; i < nParUsed; i++) {\r
- for (Int_t j = 0; j < nParUsed; j++) {\r
- covMatrix[i][j] = 0;\r
- }\r
- }\r
- }\r
- \r
- Double_t reducedChiSquare = -1;\r
- \r
- if (fitMethod == 2) {\r
- if (regularisation <= 0 && iter == 1)\r
- std::cout << "Fitting data simultaneously...." << std::endl << std::endl;\r
- \r
- // Add ref histos in initialisation step (w/ reg) or in the only loop (w/o reg)\r
- if ((regularisation > 0 && iter == 0) || (regularisation <= 0 && iter == 1)) {\r
- \r
- if (regularisation <= 0)\r
- mathFit->ClearRefHistos();\r
- \r
- mathFit->AddRefHisto(hGenDeltaPiForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaPiForMuProj);\r
- \r
- mathFit->AddRefHisto(hGenDeltaKaForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaKaForMuProj);\r
- \r
- mathFit->AddRefHisto(hGenDeltaPrForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaPrForMuProj);\r
- \r
- mathFit->AddRefHisto(hGenDeltaElForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaElForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaElForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaElForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaElForMuProj);\r
- \r
- // In reg case, fill in the data for this bin and continue with the nex bin\r
- if (regularisation > 0) {\r
- TH1D* hDeltaSpecies[numSimultaneousFits] = { hDeltaPi[slice], hDeltaKa[slice], hDeltaPr[slice], hDeltaEl[slice] };\r
- \r
- for (Int_t i = 0; i < numSimultaneousFits; i++) {\r
- mathFit->InputData(hDeltaSpecies[i], currXbin, i, xLow, xUp, -1., kFALSE); \r
- }\r
- \r
- currXbin++;\r
- continue;\r
- }\r
- }\r
- \r
- if (regularisation > 0 && iter == 1 && !regularisedFitDone) {\r
- std::cout << "Fitting data simultaneously with regularisation...." << std::endl << std::endl;\r
- \r
- // TODO At the moment, the covariance matrix is NOT forwarded from TMinuit (has completely different dimensions)\r
- // -> Since it is not used at the moment, this is not necessary. If it is to be used in future,\r
- // this has to be implemented! But one has to be careful, since parameters from different bins then\r
- // depend on each other! Furthermore, there will be no errors for fixed parameters like muon fraction or electron fraction\r
- // above the corresponding threshold in the covariance matrix, but an estimated error will be set manually.\r
- errFlag = errFlag | doSimultaneousFitRegularised(nParSimultaneousFitRegularised, gausParamsSimultaneousFitRegularised, \r
- parameterErrorsOutRegularised, &covMatrix[0][0],\r
- stepSizeSimultaneousFitRegularised, \r
- lowParLimitsSimultaneousFitRegularised, \r
- upParLimitsSimultaneousFitRegularised, reducedChiSquare);\r
- if (errFlag != 0)\r
- std::cout << "errFlag " << errFlag << std::endl << std::endl;\r
- \r
- reducedChiSquareRegularisation = reducedChiSquare;\r
- \r
- // Since everything is fitted in one go, only do this for the first x bin\r
- // (more convenient to put the fitting in the x bin loop in order to intialise\r
- // the parameters in the same way they are initialised for the fit w/o regularisation.\r
- regularisedFitDone = kTRUE;\r
- }\r
- \r
- if (regularisation > 0 && iter == 1) {\r
- // To allow for an identical processing, just forward the parameter results for the current xBin to the\r
- // array used by the standard simultaneous fit. The rest of the code is then the same for regularisation on and off\r
- \r
- for (Int_t i = 0; i < mathFit->GetNumParametersPerXbin(); i++) {\r
- const Int_t iRegularised = i + currXbin * mathFit->GetNumParametersPerXbin();\r
- \r
- gausParamsSimultaneousFit[i] = gausParamsSimultaneousFitRegularised[iRegularised];\r
- parameterErrorsOut[i] = parameterErrorsOutRegularised[iRegularised];\r
- }\r
- \r
- // Same reducedChiSquare for all bins, since only one fit\r
- reducedChiSquare = reducedChiSquareRegularisation;\r
- \r
- \r
- // Also clear reference histos and load those for the current bin\r
- mathFit->ClearRefHistos();\r
- \r
- mathFit->AddRefHisto(hGenDeltaPiForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaPiForMuProj);\r
- \r
- mathFit->AddRefHisto(hGenDeltaKaForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaKaForMuProj);\r
- \r
- mathFit->AddRefHisto(hGenDeltaPrForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaPrForMuProj);\r
- \r
- mathFit->AddRefHisto(hGenDeltaElForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaElForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaElForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaElForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaElForMuProj);\r
- }\r
- \r
- \r
- if (regularisation <= 0) {\r
- TH1D* hDeltaSpecies[numSimultaneousFits] = { hDeltaPi[slice], hDeltaKa[slice], hDeltaPr[slice], hDeltaEl[slice] };\r
- errFlag = errFlag | \r
- doSimultaneousFit(hDeltaSpecies, xLow, xUp, nParSimultaneousFit, gausParamsSimultaneousFit, parameterErrorsOut, \r
- &covMatrix[0][0], stepSizeSimultaneousFit, lowParLimitsSimultaneousFit,\r
- upParLimitsSimultaneousFit, reducedChiSquare);\r
- }\r
- \r
- // Forward parameters to single fits\r
- for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {\r
- // Fractions\r
- if (parIndex <= 4) {\r
- totalDeltaPion->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);\r
- totalDeltaPion->SetParError(parIndex, parameterErrorsOut[parIndex]);\r
- \r
- totalDeltaKaon->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);\r
- totalDeltaKaon->SetParError(parIndex, parameterErrorsOut[parIndex]);\r
- \r
- totalDeltaProton->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);\r
- totalDeltaProton->SetParError(parIndex, parameterErrorsOut[parIndex]);\r
- \r
- totalDeltaElectron->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);\r
- totalDeltaElectron->SetParError(parIndex, parameterErrorsOut[parIndex]);\r
- }\r
- // Total yield\r
- else if (parIndex == 5) {\r
- totalDeltaPion->SetParameter(parIndex, totalYield);\r
- totalDeltaPion->SetParError(parIndex, 0);\r
- \r
- totalDeltaKaon->SetParameter(parIndex, totalYield);\r
- totalDeltaKaon->SetParError(parIndex, 0);\r
- \r
- totalDeltaProton->SetParameter(parIndex, totalYield);\r
- totalDeltaProton->SetParError(parIndex, 0);\r
- \r
- totalDeltaElectron->SetParameter(parIndex, totalYield);\r
- totalDeltaElectron->SetParError(parIndex, 0);\r
- }\r
- // Hist shifts\r
- else {\r
- totalDeltaPion->SetParameter(parIndex, 0);\r
- totalDeltaPion->SetParError(parIndex, 0);\r
- \r
- totalDeltaKaon->SetParameter(parIndex, 0);\r
- totalDeltaKaon->SetParError(parIndex, 0);\r
- \r
- totalDeltaProton->SetParameter(parIndex, 0);\r
- totalDeltaProton->SetParError(parIndex, 0);\r
- \r
- totalDeltaElectron->SetParameter(parIndex, 0);\r
- totalDeltaElectron->SetParError(parIndex, 0);\r
- }\r
- }\r
- \r
- const Bool_t useRegularisation = regularisation > 0;\r
- \r
- // Plot single fits\r
- \r
- Int_t binLow = -1;\r
- Int_t binHigh = -1;\r
- \r
- // DeltaPions\r
- cSingleFit[slice][2]->cd(1);\r
- \r
- hDeltaPi[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaPi[slice], binLow, binHigh);\r
- hDeltaPi[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaPion[slice] = (TF1*)totalDeltaPion->Clone(Form("Fit_Total_DeltaPion_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaPiFitQA[slice] = (TH1D*)hDeltaPi[slice]->Clone(Form("hDeltaPiFitQA_%d", slice));\r
- hDeltaPiFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaPiFitQA[slice]->Add(fitFuncTotalDeltaPion[slice], -1);\r
- hDeltaPiFitQA[slice]->Divide(hDeltaPi[slice]);\r
- \r
- hDeltaPi[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaPion[slice]);\r
- fitFuncTotalDeltaPion[slice]->Draw("same"); \r
- \r
- Double_t* parametersOut = &totalDeltaPion->GetParameters()[0];\r
- \r
- hGenDeltaPiForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));\r
- shiftHist(hGenDeltaPiForPiProj, parametersOut[6], useRegularisation);\r
- hGenDeltaPiForPiProj->Draw("same");\r
- \r
- hGenDeltaPiForKaProj->Scale(parametersOut[5] * parametersOut[1]);\r
- shiftHist(hGenDeltaPiForKaProj, parametersOut[7], useRegularisation);\r
- hGenDeltaPiForKaProj->Draw("same");\r
- \r
- hGenDeltaPiForPrProj->Scale(parametersOut[5] * parametersOut[2]);\r
- shiftHist(hGenDeltaPiForPrProj, parametersOut[8], useRegularisation);\r
- hGenDeltaPiForPrProj->Draw("same");\r
- \r
- hGenDeltaPiForElProj->Scale(parametersOut[5] * parametersOut[3]);\r
- shiftHist(hGenDeltaPiForElProj, parametersOut[9], useRegularisation);\r
- hGenDeltaPiForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaPiForMuProj->Scale(parametersOut[5] * parametersOut[4]);\r
- shiftHist(hGenDeltaPiForMuProj, parametersOut[10], useRegularisation);\r
- hGenDeltaPiForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaPiMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPiMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaPiMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPiMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaPi[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][2]->cd(2);\r
- hDeltaPiFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaPiFitQA[slice]->Draw("e"); \r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 3, reducedChiSquare);\r
- \r
- // TMatrixDSym covMatrixPi(nParUsed, &covMatrix[0][0]); \r
- \r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPi, parametersOut, parameterErrorsOut, hFractionPions,\r
- hFractionPionsDeltaPion, hFractionElectronsDeltaPion, hFractionKaonsDeltaPion,\r
- hFractionProtonsDeltaPion, hFractionMuonsDeltaPion, hYieldPions, hYieldPionsDeltaPion, hYieldElectronsDeltaPion,\r
- hYieldKaonsDeltaPion, hYieldProtonsDeltaPion, hYieldMuonsDeltaPion, normaliseResults);\r
- \r
- // Also set specific muon fractions and yields -> The deltaSpecies histos are not needed here: They will be set together with\r
- // the fraction and yields for all other species\r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kMu, parametersOut, parameterErrorsOut, hFractionMuons,\r
- 0x0, 0x0, 0x0, 0x0, 0x0, hYieldMuons, 0x0, 0x0, 0x0, 0x0, 0x0, normaliseResults);\r
- \r
- \r
- // DeltaElectrons\r
- cSingleFit[slice][0]->cd(1);\r
- \r
- hDeltaEl[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaEl[slice], binLow, binHigh);\r
- hDeltaEl[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaElectron[slice] = (TF1*)totalDeltaElectron->Clone(Form("Fit_Total_DeltaElectron_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaElFitQA[slice] = (TH1D*)hDeltaEl[slice]->Clone(Form("hDeltaElFitQA_%d", slice));\r
- hDeltaElFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaElFitQA[slice]->Add(fitFuncTotalDeltaElectron[slice], -1);\r
- hDeltaElFitQA[slice]->Divide(hDeltaEl[slice]);\r
- \r
- hDeltaEl[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaElectron[slice]);\r
- fitFuncTotalDeltaElectron[slice]->Draw("same"); \r
- \r
- parametersOut = &totalDeltaElectron->GetParameters()[0];\r
- \r
- hGenDeltaElForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));\r
- shiftHist(hGenDeltaElForPiProj, parametersOut[6], useRegularisation);\r
- hGenDeltaElForPiProj->Draw("same");\r
- \r
- hGenDeltaElForKaProj->Scale(parametersOut[5] * parametersOut[1]);\r
- shiftHist(hGenDeltaElForKaProj, parametersOut[7], useRegularisation);\r
- hGenDeltaElForKaProj->Draw("same");\r
- \r
- hGenDeltaElForPrProj->Scale(parametersOut[5] * parametersOut[2]);\r
- shiftHist(hGenDeltaElForPrProj, parametersOut[8], useRegularisation);\r
- hGenDeltaElForPrProj->Draw("same");\r
- \r
- hGenDeltaElForElProj->Scale(parametersOut[5] * parametersOut[3]);\r
- shiftHist(hGenDeltaElForElProj, parametersOut[9], useRegularisation);\r
- hGenDeltaElForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaElForMuProj->Scale(parametersOut[5] * parametersOut[4]);\r
- shiftHist(hGenDeltaElForMuProj, parametersOut[10], useRegularisation);\r
- hGenDeltaElForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaElMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaElMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaElMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaElMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaEl[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][0]->cd(2);\r
- hDeltaElFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaElFitQA[slice]->Draw("e");\r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 1, reducedChiSquare);\r
- \r
- //TMatrixDSym covMatrixEl(nParUsed, &covMatrix[0][0]);\r
- \r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kEl, parametersOut, parameterErrorsOut, hFractionElectrons,\r
- hFractionPionsDeltaElectron, hFractionElectronsDeltaElectron, hFractionKaonsDeltaElectron,\r
- hFractionProtonsDeltaElectron, hFractionMuonsDeltaElectron, hYieldElectrons, hYieldPionsDeltaElectron, \r
- hYieldElectronsDeltaElectron, hYieldKaonsDeltaElectron, hYieldProtonsDeltaElectron, hYieldMuonsDeltaElectron, \r
- normaliseResults);\r
- \r
- \r
- \r
- // DeltaKaons \r
- cSingleFit[slice][1]->cd(1);\r
- \r
- hDeltaKa[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaKa[slice], binLow, binHigh);\r
- hDeltaKa[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaKaon[slice] = (TF1*)totalDeltaKaon->Clone(Form("Fit_Total_DeltaKaon_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaKaFitQA[slice] = (TH1D*)hDeltaKa[slice]->Clone(Form("hDeltaKaFitQA_%d", slice));\r
- hDeltaKaFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaKaFitQA[slice]->Add(fitFuncTotalDeltaKaon[slice], -1);\r
- hDeltaKaFitQA[slice]->Divide(hDeltaKa[slice]);\r
- \r
- hDeltaKa[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaKaon[slice]);\r
- fitFuncTotalDeltaKaon[slice]->Draw("same"); \r
- \r
- parametersOut = &totalDeltaKaon->GetParameters()[0];\r
- \r
- hGenDeltaKaForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));\r
- shiftHist(hGenDeltaKaForPiProj, parametersOut[6], useRegularisation);\r
- hGenDeltaKaForPiProj->Draw("same");\r
- \r
- hGenDeltaKaForKaProj->Scale(parametersOut[5] * parametersOut[1]);\r
- shiftHist(hGenDeltaKaForKaProj, parametersOut[7], useRegularisation);\r
- hGenDeltaKaForKaProj->Draw("same");\r
- \r
- hGenDeltaKaForPrProj->Scale(parametersOut[5] * parametersOut[2]);\r
- shiftHist(hGenDeltaKaForPrProj, parametersOut[8], useRegularisation);\r
- hGenDeltaKaForPrProj->Draw("same");\r
- \r
- hGenDeltaKaForElProj->Scale(parametersOut[5] * parametersOut[3]);\r
- shiftHist(hGenDeltaKaForElProj, parametersOut[9], useRegularisation);\r
- hGenDeltaKaForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaKaForMuProj->Scale(parametersOut[5] * parametersOut[4]);\r
- shiftHist(hGenDeltaKaForMuProj, parametersOut[10], useRegularisation);\r
- hGenDeltaKaForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaKaMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaKaMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaKaMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaKaMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaKa[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][1]->cd(2);\r
- hDeltaKaFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaKaFitQA[slice]->Draw("e");\r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 2, reducedChiSquare);\r
- \r
- //TMatrixDSym covMatrixKa(nParUsed, &covMatrix[0][0]);\r
- \r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kKa, parametersOut, parameterErrorsOut, hFractionKaons,\r
- hFractionPionsDeltaKaon, hFractionElectronsDeltaKaon, hFractionKaonsDeltaKaon, hFractionProtonsDeltaKaon,\r
- hFractionMuonsDeltaKaon, hYieldKaons, hYieldPionsDeltaKaon, hYieldElectronsDeltaKaon, hYieldKaonsDeltaKaon,\r
- hYieldProtonsDeltaKaon, hYieldMuonsDeltaKaon, normaliseResults);\r
- \r
- \r
- \r
- // DeltaProtons\r
- cSingleFit[slice][3]->cd(1);\r
- \r
- hDeltaPr[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaPr[slice], binLow, binHigh);\r
- hDeltaPr[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaProton[slice] = (TF1*)totalDeltaProton->Clone(Form("Fit_Total_DeltaProton_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaPrFitQA[slice] = (TH1D*)hDeltaPr[slice]->Clone(Form("hDeltaPrFitQA_%d", slice));\r
- hDeltaPrFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaPrFitQA[slice]->Add(fitFuncTotalDeltaProton[slice], -1);\r
- hDeltaPrFitQA[slice]->Divide(hDeltaPr[slice]);\r
- \r
- hDeltaPr[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaProton[slice]);\r
- \r
- fitFuncTotalDeltaProton[slice]->Draw("same"); \r
- \r
- parametersOut = &totalDeltaProton->GetParameters()[0];\r
- \r
- hGenDeltaPrForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));\r
- shiftHist(hGenDeltaPrForPiProj, parametersOut[6], useRegularisation);\r
- hGenDeltaPrForPiProj->Draw("same");\r
- \r
- hGenDeltaPrForKaProj->Scale(parametersOut[5] * parametersOut[1]);\r
- shiftHist(hGenDeltaPrForKaProj, parametersOut[7], useRegularisation);\r
- hGenDeltaPrForKaProj->Draw("same");\r
- \r
- hGenDeltaPrForPrProj->Scale(parametersOut[5] * parametersOut[2]);\r
- shiftHist(hGenDeltaPrForPrProj, parametersOut[8], useRegularisation);\r
- hGenDeltaPrForPrProj->Draw("same");\r
- \r
- hGenDeltaPrForElProj->Scale(parametersOut[5] * parametersOut[3]);\r
- shiftHist(hGenDeltaPrForElProj, parametersOut[9], useRegularisation);\r
- hGenDeltaPrForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaPrForMuProj->Scale(parametersOut[5] * parametersOut[4]);\r
- shiftHist(hGenDeltaPrForMuProj, parametersOut[10], useRegularisation);\r
- hGenDeltaPrForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaPrMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPrMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaPrMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPrMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaPr[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][3]->cd(2);\r
- hDeltaPrFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaPrFitQA[slice]->Draw("e");\r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 4, reducedChiSquare);\r
- \r
- //TMatrixDSym covMatrixPr(nParUsed, &covMatrix[0][0]);\r
- \r
- Double_t normalisationFactor = 1.0;\r
- normalisationFactor = setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPr, parametersOut, parameterErrorsOut, \r
- hFractionProtons, hFractionPionsDeltaProton, hFractionElectronsDeltaProton, \r
- hFractionKaonsDeltaProton, hFractionProtonsDeltaProton, hFractionMuonsDeltaProton, \r
- hYieldProtons, hYieldPionsDeltaProton, hYieldElectronsDeltaProton,\r
- hYieldKaonsDeltaProton, hYieldProtonsDeltaProton, hYieldMuonsDeltaProton, \r
- normaliseResults);\r
- \r
- // Fractions are the same for all plots -> just take deltaPion as default\r
- Double_t sumFractions = hFractionPionsDeltaPion->GetBinContent(slice + 1) + \r
- hFractionElectronsDeltaPion->GetBinContent(slice + 1) + (takeIntoAccountMuons ? hFractionMuonsDeltaPion->GetBinContent(slice + 1) : 0.) +\r
- hFractionKaonsDeltaPion->GetBinContent(slice + 1) + hFractionProtonsDeltaPion->GetBinContent(slice + 1);\r
- \r
- hFractionSummed->SetBinContent(slice + 1, sumFractions);\r
- hFractionSummed->SetBinError(slice + 1, \r
- TMath::Sqrt(TMath::Power(hFractionPionsDeltaPion->GetBinError(slice + 1), 2) + \r
- TMath::Power(hFractionElectronsDeltaPion->GetBinError(slice + 1), 2) +\r
- (takeIntoAccountMuons ? TMath::Power(hFractionMuonsDeltaPion->GetBinError(slice + 1), 2) : 0.) +\r
- TMath::Power(hFractionKaonsDeltaPion->GetBinError(slice + 1), 2) +\r
- TMath::Power(hFractionProtonsDeltaPion->GetBinError(slice + 1), 2)));\r
- \r
- for (Int_t species = 0; species < 4; species++) {\r
- cSingleFit[slice][species]->Modified();\r
- cSingleFit[slice][species]->Update();\r
- }\r
- \r
- \r
- // Compute the to-pi ratios with proper error for the current slice\r
- // NOTE: error and covariance matrix are already scaled for the simultaneous fit\r
- // by mathFit (it was checked that all (i.e. also off-diagonal) matrix elements grow by fScaleError^2\r
- // NOTE 2: take the fractions and error from the histogram (takes correct muon and electrons fractions with errors set manually \r
- // in case of fixed fraction; the parameters are fixed, so the elements of the off-diagonal elements of the covariance matrix \r
- // remain zero!). The fractions are then also scaled to sum up to 1 (but correction factor usually close to unity).\r
- // The covariance matrix is NOT scaled like this. Therefore, scale the matrix elements accordingly.\r
- // If the normalisation is not done for the fractions, then this factor is unity by construction.\r
- \r
- \r
- \r
- Double_t covMatrixElementToPiForEl = 0.;\r
- Double_t covMatrixElementToPiForMu = 0.;\r
- Double_t covMatrixElementToPiForKa = 0.;\r
- Double_t covMatrixElementToPiForPr = 0.;\r
- \r
- // Get the correct covariance matrix elements and apply the normalisation factor\r
- Int_t parOffset = 0;\r
- \r
- // In case of regularisation, there is an offset with respect to the current slice\r
- if (useRegularisation)\r
- parOffset = currXbin * numParamsPerXbin;\r
- \r
- \r
- covMatrixElementToPiForEl = covMatrix[3 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;\r
- covMatrixElementToPiForMu = covMatrix[4 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;\r
- covMatrixElementToPiForKa = covMatrix[1 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;\r
- covMatrixElementToPiForPr = covMatrix[2 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;\r
- \r
- Double_t ratio = -999.;\r
- Double_t ratioError = 999.;\r
- Double_t currFractionSpecies = 0.;\r
- Double_t currFractionPions = 0.;\r
- Double_t currFractionErrorSpecies = 0.;\r
- Double_t currFractionErrorPions = 0.;\r
- Double_t covMatrixElementAB = 0.; // NOTE that there is only one covariance matrix (simultaneous fit!)\r
- \r
- currFractionPions = hFractionPions->GetBinContent(slice + 1);\r
- currFractionErrorPions = hFractionPions->GetBinError(slice + 1);\r
- \r
- // NOTE: Even in case of regularisation, when fractions of different bins become correlated, this does NOT change\r
- // the formula. Only the covariance matrix element for the considered fraction in the SAME slice needs to be taken\r
- // into account. Explanation: f = f(fracA_slice, fracB_slice), this means that \dell f / \dell fracA_slice+-1 = 0 (etc.).\r
- // So, the formula is the same, although the correlation between different slices is contained in the covariance matrix.\r
- \r
- // el-to-pi ratio\r
- currFractionSpecies = hFractionElectrons->GetBinContent(slice + 1);\r
- currFractionErrorSpecies = hFractionElectrons->GetBinError(slice + 1);\r
- covMatrixElementAB = covMatrixElementToPiForEl;\r
- \r
- GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,\r
- covMatrixElementAB, ratio, ratioError);\r
- \r
- hRatioToPiElectrons->SetBinContent(slice + 1, ratio);\r
- hRatioToPiElectrons->SetBinError(slice + 1, ratioError);\r
- \r
- // mu-to-pi ratio\r
- currFractionSpecies = hFractionMuons->GetBinContent(slice + 1);\r
- currFractionErrorSpecies = hFractionMuons->GetBinError(slice + 1);\r
- covMatrixElementAB = covMatrixElementToPiForMu;\r
- \r
- GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,\r
- covMatrixElementAB, ratio, ratioError);\r
- \r
- hRatioToPiMuons->SetBinContent(slice + 1, ratio);\r
- hRatioToPiMuons->SetBinError(slice + 1, ratioError);\r
- \r
- \r
- // K-to-pi ratio\r
- currFractionSpecies = hFractionKaons->GetBinContent(slice + 1);\r
- currFractionErrorSpecies = hFractionKaons->GetBinError(slice + 1);\r
- covMatrixElementAB = covMatrixElementToPiForKa;\r
- \r
- GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,\r
- covMatrixElementAB, ratio, ratioError);\r
- \r
- hRatioToPiKaons->SetBinContent(slice + 1, ratio);\r
- hRatioToPiKaons->SetBinError(slice + 1, ratioError);\r
- \r
- \r
- // p-to-pi ratio\r
- currFractionSpecies = hFractionProtons->GetBinContent(slice + 1);\r
- currFractionErrorSpecies = hFractionProtons->GetBinError(slice + 1);\r
- covMatrixElementAB = covMatrixElementToPiForPr;\r
- \r
- GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,\r
- covMatrixElementAB, ratio, ratioError);\r
- \r
- hRatioToPiProtons->SetBinContent(slice + 1, ratio);\r
- hRatioToPiProtons->SetBinError(slice + 1, ratioError);\r
- \r
- /*\r
- for (Int_t i = 0; i < nParUsed; i++) {\r
- for (Int_t j = 0; j < nParUsed; j++) {\r
- printf("\t%e", covMatrix[i][j]);\r
- }\r
- printf("\n");\r
- }\r
- */\r
- \r
- currXbin++;\r
- }\r
- //_____________________________________________________________________\r
- // Other methods without simultaneous fitting\r
- else {\r
- Int_t binLow = -1;\r
- Int_t binHigh = -1;\r
- \r
- // DeltaPions \r
- \r
- std::cout << "Fitting deltaPion...." << std::endl << std::endl;\r
- \r
- cSingleFit[slice][2]->cd(1);\r
- \r
- mathFit->ClearRefHistos();\r
- mathFit->AddRefHisto(hGenDeltaPiForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaPiForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaPiForMuProj);\r
- \r
- errFlag = errFlag |\r
- doFit(hDeltaPi[slice], xLow, xUp, nPar, gausParamsPi, parameterErrorsOut, &covMatrix[0][0],\r
- stepSize, lowParLimitsPi, upParLimitsPi, totalDeltaPion, reducedChiSquare);\r
- \r
- hDeltaPi[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaPi[slice], binLow, binHigh);\r
- hDeltaPi[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaPion[slice] = (TF1*)totalDeltaPion->Clone(Form("Fit_Total_DeltaPion_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaPiFitQA[slice] = (TH1D*)hDeltaPi[slice]->Clone(Form("hDeltaPiFitQA_%d", slice));\r
- hDeltaPiFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaPiFitQA[slice]->Add(fitFuncTotalDeltaPion[slice], -1);\r
- hDeltaPiFitQA[slice]->Divide(hDeltaPi[slice]);\r
- \r
- hDeltaPi[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaPion[slice]);\r
- fitFuncTotalDeltaPion[slice]->Draw("same"); \r
- \r
- Double_t* parametersOut = &gausParamsPi[0];\r
- \r
- hGenDeltaPiForPiProj->Scale(gausParamsPi[5] * (gausParamsPi[0] + (muonContamination ? gausParamsPi[3] : 0)));\r
- shiftHist(hGenDeltaPiForPiProj, gausParamsPi[6]);\r
- hGenDeltaPiForPiProj->Draw("same");\r
- \r
- hGenDeltaPiForKaProj->Scale(gausParamsPi[5] * gausParamsPi[1]);\r
- shiftHist(hGenDeltaPiForKaProj, gausParamsPi[7]);\r
- hGenDeltaPiForKaProj->Draw("same");\r
- \r
- hGenDeltaPiForPrProj->Scale(gausParamsPi[5] * gausParamsPi[2]);\r
- shiftHist(hGenDeltaPiForPrProj, gausParamsPi[8]);\r
- hGenDeltaPiForPrProj->Draw("same");\r
- \r
- hGenDeltaPiForElProj->Scale(gausParamsPi[5] * gausParamsPi[3]);\r
- shiftHist(hGenDeltaPiForElProj, gausParamsPi[9]);\r
- hGenDeltaPiForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaPiForMuProj->Scale(gausParamsPi[5] * gausParamsPi[4]);\r
- shiftHist(hGenDeltaPiForMuProj, gausParamsPi[10]);\r
- hGenDeltaPiForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaPiMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPiMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaPiMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPiMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaPi[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][2]->cd(2);\r
- hDeltaPiFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaPiFitQA[slice]->Draw("e"); \r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 3, reducedChiSquare);\r
- \r
- TMatrixDSym covMatrixPi(nParUsed, &covMatrix[0][0]); \r
- \r
- if (fitMethod == 1) {\r
- // Histos are normalised => expression equals integral\r
- integralPions = allDeltaPion * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)); \r
- integralTotal += integralPions;\r
- if (takeIntoAccountMuons) {\r
- integralMuons = allDeltaPion * parametersOut[4];\r
- integralTotal += integralMuons;\r
- }\r
- \r
- /*\r
- integralErrorTotalDeltaPion = getErrorOfTotalIntegral(covMatrixPi) * allDeltaPion;\r
- \r
- integralErrorPions = getErrorOfPionIntegral(covMatrixPi) * allDeltaPion;\r
- */\r
- \r
- integralPionsDeltaPion = integralPions;\r
- \r
- // Compare comment above\r
- integralElectronsDeltaPion = allDeltaPion * parametersOut[3];\r
- integralKaonsDeltaPion = allDeltaPion * parametersOut[1];\r
- integralProtonsDeltaPion = allDeltaPion * parametersOut[2];\r
- integralMuonsDeltaPion = allDeltaPion * parametersOut[4];\r
- \r
- /*\r
- integralErrorPionsDeltaPion = integralErrorPions;\r
- \r
- integralErrorElectronsDeltaPion = allDeltaPion * parameterErrorsOut[3];\r
- integralErrorKaonsDeltaPion = allDeltaPion * parameterErrorsOut[1];\r
- integralErrorProtonsDeltaPion = allDeltaPion * parameterErrorsOut[2];\r
- */\r
- }\r
- else {\r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPi, parametersOut, parameterErrorsOut, hFractionPions,\r
- hFractionPionsDeltaPion, hFractionElectronsDeltaPion, hFractionKaonsDeltaPion,\r
- hFractionProtonsDeltaPion, hFractionMuonsDeltaPion, hYieldPions, hYieldPionsDeltaPion, hYieldElectronsDeltaPion,\r
- hYieldKaonsDeltaPion, hYieldProtonsDeltaPion, hYieldMuonsDeltaPion);\r
- \r
- // Also set specific muon fractions and yields -> The deltaSpecies histos are not needed here: They will be set together with\r
- // the fraction and yields for all other species\r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kMu, parametersOut, parameterErrorsOut, hFractionMuons,\r
- 0x0, 0x0, 0x0, 0x0, 0x0, hYieldMuons, 0x0, 0x0, 0x0, 0x0, 0x0);\r
- }\r
- \r
- \r
- std::cout << std::endl << std::endl;\r
- \r
-\r
- // DeltaElectrons\r
- \r
- std::cout << "Fitting deltaElectron...." << std::endl << std::endl;\r
- \r
- cSingleFit[slice][0]->cd(1);\r
- \r
- mathFit->ClearRefHistos();\r
- mathFit->AddRefHisto(hGenDeltaElForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaElForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaElForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaElForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaElForMuProj);\r
- \r
- errFlag = errFlag |\r
- doFit(hDeltaEl[slice], xLow, xUp, nPar, gausParamsEl, parameterErrorsOut, &covMatrix[0][0],\r
- stepSize, lowParLimitsEl, upParLimitsEl, totalDeltaElectron, reducedChiSquare);\r
- \r
- hDeltaEl[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaEl[slice], binLow, binHigh);\r
- hDeltaEl[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaElectron[slice] = (TF1*)totalDeltaElectron->Clone(Form("Fit_Total_DeltaElectron_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaElFitQA[slice] = (TH1D*)hDeltaEl[slice]->Clone(Form("hDeltaElFitQA_%d", slice));\r
- hDeltaElFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaElFitQA[slice]->Add(fitFuncTotalDeltaElectron[slice], -1);\r
- hDeltaElFitQA[slice]->Divide(hDeltaEl[slice]);\r
- \r
- hDeltaEl[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaElectron[slice]);\r
- fitFuncTotalDeltaElectron[slice]->Draw("same"); \r
- \r
- parametersOut = &gausParamsEl[0];\r
- \r
- hGenDeltaElForPiProj->Scale(gausParamsEl[5] * (gausParamsEl[0] + (muonContamination ? gausParamsEl[3] : 0)));\r
- shiftHist(hGenDeltaElForPiProj, gausParamsEl[6]);\r
- hGenDeltaElForPiProj->Draw("same");\r
- \r
- hGenDeltaElForKaProj->Scale(gausParamsEl[5] * gausParamsEl[1]);\r
- shiftHist(hGenDeltaElForKaProj, gausParamsEl[7]);\r
- hGenDeltaElForKaProj->Draw("same");\r
- \r
- hGenDeltaElForPrProj->Scale(gausParamsEl[5] * gausParamsEl[2]);\r
- shiftHist(hGenDeltaElForPrProj, gausParamsEl[8]);\r
- hGenDeltaElForPrProj->Draw("same");\r
- \r
- hGenDeltaElForElProj->Scale(gausParamsEl[5] * gausParamsEl[3]);\r
- shiftHist(hGenDeltaElForElProj, gausParamsEl[9]);\r
- hGenDeltaElForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaElForMuProj->Scale(gausParamsEl[5] * gausParamsEl[4]);\r
- shiftHist(hGenDeltaElForMuProj, gausParamsEl[10]);\r
- hGenDeltaElForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaElMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaElMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaElMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaElMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaEl[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][0]->cd(2);\r
- hDeltaElFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaElFitQA[slice]->Draw("e");\r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 1, reducedChiSquare);\r
- \r
- TMatrixDSym covMatrixEl(nParUsed, &covMatrix[0][0]);\r
- \r
- if (fitMethod == 1) {\r
- integralElectrons = allDeltaElectron * parametersOut[3]; // Histos are normalised => expression equals integral\r
- integralTotal += integralElectrons;\r
- \r
- /* \r
- integralErrorTotalDeltaElectron = getErrorOfTotalIntegral(covMatrixEl) * allDeltaElectron;\r
- \r
- integralErrorElectrons = allDeltaElectron * parameterErrorsOut[3];\r
- */\r
- \r
- // Factor 2 in case of takeIntoAccountMuons will be applied below\r
- integralElectronsDeltaElectron = integralElectrons;\r
-\r
- // Compare comment above\r
- integralPionsDeltaElectron = allDeltaElectron * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));\r
- integralKaonsDeltaElectron = allDeltaElectron * parametersOut[1];\r
- integralProtonsDeltaElectron = allDeltaElectron * parametersOut[2];\r
- integralMuonsDeltaElectron = allDeltaElectron * parametersOut[4];\r
- \r
- \r
- /*\r
- integralErrorElectronsDeltaElectron = integralErrorElectrons;\r
- \r
- integralErrorPionsDeltaElectron = getErrorOfPionIntegral(covMatrixEl) * allDeltaElectron;\r
- integralErrorKaonsDeltaElectron = allDeltaElectron * parameterErrorsOut[1];\r
- integralErrorProtonsDeltaElectron = allDeltaElectron * parameterErrorsOut[2];\r
- */\r
- }\r
- else {\r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kEl, parametersOut, parameterErrorsOut, hFractionElectrons,\r
- hFractionPionsDeltaElectron, hFractionElectronsDeltaElectron, hFractionKaonsDeltaElectron,\r
- hFractionProtonsDeltaElectron, hFractionMuonsDeltaElectron, hYieldElectrons, hYieldPionsDeltaElectron, \r
- hYieldElectronsDeltaElectron, hYieldKaonsDeltaElectron, hYieldProtonsDeltaElectron, hYieldMuonsDeltaElectron);\r
- }\r
- \r
- std::cout << std::endl << std::endl;\r
- \r
- // DeltaKaons \r
- \r
- std::cout << "Fitting deltaKaon...." << std::endl << std::endl;\r
- \r
- cSingleFit[slice][1]->cd(1);\r
- \r
- mathFit->ClearRefHistos();\r
- mathFit->AddRefHisto(hGenDeltaKaForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaKaForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaKaForMuProj);\r
- \r
- errFlag = errFlag |\r
- doFit(hDeltaKa[slice], xLow, xUp, nPar, gausParamsKa, parameterErrorsOut, &covMatrix[0][0],\r
- stepSize, lowParLimitsKa, upParLimitsKa, totalDeltaKaon, reducedChiSquare);\r
- \r
- hDeltaKa[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaKa[slice], binLow, binHigh);\r
- hDeltaKa[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaKaon[slice] = (TF1*)totalDeltaKaon->Clone(Form("Fit_Total_DeltaKaon_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaKaFitQA[slice] = (TH1D*)hDeltaKa[slice]->Clone(Form("hDeltaKaFitQA_%d", slice));\r
- hDeltaKaFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaKaFitQA[slice]->Add(fitFuncTotalDeltaKaon[slice], -1);\r
- hDeltaKaFitQA[slice]->Divide(hDeltaKa[slice]);\r
- \r
- hDeltaKa[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaKaon[slice]);\r
- fitFuncTotalDeltaKaon[slice]->Draw("same"); \r
- \r
- parametersOut = &gausParamsKa[0];\r
- \r
- hGenDeltaKaForPiProj->Scale(gausParamsKa[5] * (gausParamsKa[0] + (muonContamination ? gausParamsKa[3] : 0)));\r
- shiftHist(hGenDeltaKaForPiProj, gausParamsKa[6]);\r
- hGenDeltaKaForPiProj->Draw("same");\r
- \r
- hGenDeltaKaForKaProj->Scale(gausParamsKa[5] * gausParamsKa[1]);\r
- shiftHist(hGenDeltaKaForKaProj, gausParamsKa[7]);\r
- hGenDeltaKaForKaProj->Draw("same");\r
- \r
- hGenDeltaKaForPrProj->Scale(gausParamsKa[5] * gausParamsKa[2]);\r
- shiftHist(hGenDeltaKaForPrProj, gausParamsKa[8]);\r
- hGenDeltaKaForPrProj->Draw("same");\r
- \r
- hGenDeltaKaForElProj->Scale(gausParamsKa[5] * gausParamsKa[3]);\r
- shiftHist(hGenDeltaKaForElProj, gausParamsKa[9]);\r
- hGenDeltaKaForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaKaForMuProj->Scale(gausParamsKa[5] * gausParamsKa[4]);\r
- shiftHist(hGenDeltaKaForMuProj, gausParamsKa[10]);\r
- hGenDeltaKaForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaKaMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaKaMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaKaMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaKaMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaKa[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][1]->cd(2);\r
- hDeltaKaFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaKaFitQA[slice]->Draw("e");\r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 2, reducedChiSquare);\r
- \r
- TMatrixDSym covMatrixKa(nParUsed, &covMatrix[0][0]);\r
- \r
- if (fitMethod == 1) {\r
- integralKaons = allDeltaKaon * parametersOut[1]; // Histos are normalised => expression equals integral\r
- integralTotal += integralKaons;\r
- /*\r
- integralErrorTotalDeltaKaon = getErrorOfTotalIntegral(covMatrixKa) * allDeltaKaon;\r
- \r
- integralErrorKaons = allDeltaKaon * parameterErrorsOut[1];\r
- */\r
- \r
- \r
- integralKaonsDeltaKaon = integralKaons;\r
- \r
- // Compare comment above\r
- integralPionsDeltaKaon = allDeltaKaon * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));\r
- integralElectronsDeltaKaon = allDeltaKaon * parametersOut[3];\r
- integralProtonsDeltaKaon = allDeltaKaon * parametersOut[2];\r
- integralMuonsDeltaKaon = allDeltaKaon * parametersOut[4];\r
- \r
- /*\r
- integralErrorKaonsDeltaKaon = integralErrorKaons; \r
- \r
- integralErrorPionsDeltaKaon = getErrorOfPionIntegral(covMatrixKa) * allDeltaKaon;\r
- integralErrorElectronsDeltaKaon = allDeltaKaon * parameterErrorsOut[3];\r
- integralErrorProtonsDeltaKaon = allDeltaKaon * parameterErrorsOut[2];\r
- */\r
- }\r
- else {\r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kKa, parametersOut, parameterErrorsOut, hFractionKaons,\r
- hFractionPionsDeltaKaon, hFractionElectronsDeltaKaon, hFractionKaonsDeltaKaon, hFractionProtonsDeltaKaon,\r
- hFractionMuonsDeltaKaon, hYieldKaons, hYieldPionsDeltaKaon, hYieldElectronsDeltaKaon, hYieldKaonsDeltaKaon, \r
- hYieldProtonsDeltaKaon, hYieldMuonsDeltaKaon);\r
- }\r
- \r
- std::cout << std::endl << std::endl;\r
- \r
- \r
- // DeltaProtons\r
- \r
- std::cout << "Fitting deltaProton...." << std::endl << std::endl;\r
- \r
- cSingleFit[slice][3]->cd(1);\r
- \r
- mathFit->ClearRefHistos();\r
- mathFit->AddRefHisto(hGenDeltaPrForPiProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForKaProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForPrProj);\r
- mathFit->AddRefHisto(hGenDeltaPrForElProj);\r
- if (takeIntoAccountMuons)\r
- mathFit->AddRefHisto(hGenDeltaPrForMuProj);\r
- \r
- errFlag = errFlag | \r
- doFit(hDeltaPr[slice], xLow, xUp, nPar, gausParamsPr, parameterErrorsOut, &covMatrix[0][0],\r
- stepSize, lowParLimitsPr, upParLimitsPr, totalDeltaProton, reducedChiSquare);\r
- \r
- hDeltaPr[slice]->SetTitle("");\r
- SetReasonableXaxisRange(hDeltaPr[slice], binLow, binHigh);\r
- hDeltaPr[slice]->Draw("e");\r
- \r
- fitFuncTotalDeltaProton[slice] = (TF1*)totalDeltaProton->Clone(Form("Fit_Total_DeltaProton_%s", fitFuncSuffix.Data()));\r
- \r
- hDeltaPrFitQA[slice] = (TH1D*)hDeltaPr[slice]->Clone(Form("hDeltaPrFitQA_%d", slice));\r
- hDeltaPrFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");\r
- hDeltaPrFitQA[slice]->Add(fitFuncTotalDeltaProton[slice], -1);\r
- hDeltaPrFitQA[slice]->Divide(hDeltaPr[slice]);\r
- \r
- hDeltaPr[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaProton[slice]);\r
- \r
- fitFuncTotalDeltaProton[slice]->Draw("same"); \r
- \r
- parametersOut = &gausParamsPr[0];\r
- \r
- hGenDeltaPrForPiProj->Scale(gausParamsPr[5] * (gausParamsPr[0] + (muonContamination ? gausParamsPr[3] : 0)));\r
- shiftHist(hGenDeltaPrForPiProj, gausParamsPr[6]);\r
- hGenDeltaPrForPiProj->Draw("same");\r
- \r
- hGenDeltaPrForKaProj->Scale(gausParamsPr[5] * gausParamsPr[1]);\r
- shiftHist(hGenDeltaPrForKaProj, gausParamsPr[7]);\r
- hGenDeltaPrForKaProj->Draw("same");\r
- \r
- hGenDeltaPrForPrProj->Scale(gausParamsPr[5] * gausParamsPr[2]);\r
- shiftHist(hGenDeltaPrForPrProj, gausParamsPr[8]);\r
- hGenDeltaPrForPrProj->Draw("same");\r
- \r
- hGenDeltaPrForElProj->Scale(gausParamsPr[5] * gausParamsPr[3]);\r
- shiftHist(hGenDeltaPrForElProj, gausParamsPr[9]);\r
- hGenDeltaPrForElProj->Draw("same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hGenDeltaPrForMuProj->Scale(gausParamsPr[5] * gausParamsPr[4]);\r
- shiftHist(hGenDeltaPrForMuProj, gausParamsPr[10]);\r
- hGenDeltaPrForMuProj->Draw("same");\r
- }\r
- \r
- if (plotIdentifiedSpectra) {\r
- for (Int_t species = 0; species < 5; species++) \r
- hDeltaPrMC[slice][species]->Draw("same");\r
- \r
- // Draw histo for sum of MC muons and pions\r
- TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPrMC[slice][kPi - 1]);\r
- hMCmuonsAndPions->Add(hDeltaPrMC[slice][kMu - 1]);\r
- hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));\r
- hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPrMC[slice][kPi - 1]->GetName()));\r
- hMCmuonsAndPions->Draw("same");\r
- }\r
- \r
- hDeltaPr[slice]->Draw("esame");\r
- \r
- legend->Draw();\r
- \r
- cSingleFit[slice][3]->cd(2);\r
- hDeltaPrFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);\r
- hDeltaPrFitQA[slice]->Draw("e");\r
- \r
- hReducedChiSquarePt->SetBinContent(slice + 1, 4, reducedChiSquare);\r
- \r
- TMatrixDSym covMatrixPr(nParUsed, &covMatrix[0][0]);\r
- \r
- if (fitMethod == 1) {\r
- integralProtons = allDeltaProton * parametersOut[2]; // Histos are normalised => expression equals integral\r
- integralTotal += integralProtons;\r
- /*\r
- integralErrorTotalDeltaProton = getErrorOfTotalIntegral(covMatrixPr) * allDeltaProton;\r
- \r
- integralErrorProtons = allDeltaProton * parameterErrorsOut[2];\r
- */ \r
- \r
- integralProtonsDeltaProton = integralProtons;\r
- \r
- // Compare comment above\r
- integralPionsDeltaProton = allDeltaProton * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));\r
- integralElectronsDeltaProton = allDeltaProton * parametersOut[3];\r
- integralKaonsDeltaProton = allDeltaProton * parametersOut[1];\r
- integralMuonsDeltaProton = allDeltaProton * parametersOut[4];\r
- \r
- \r
- /*\r
- integralErrorProtonsDeltaProton = integralErrorProtons; \r
- \r
- integralErrorPionsDeltaProton = getErrorOfPionIntegral(covMatrixPr) * allDeltaProton;\r
- integralErrorElectronsDeltaProton = allDeltaProton * parameterErrorsOut[3];\r
- integralErrorKaonsDeltaProton = allDeltaProton * parameterErrorsOut[1];\r
- */\r
- }\r
- else {\r
- setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPr, parametersOut, parameterErrorsOut, hFractionProtons,\r
- hFractionPionsDeltaProton, hFractionElectronsDeltaProton, hFractionKaonsDeltaProton,\r
- hFractionProtonsDeltaProton, hFractionMuonsDeltaProton, hYieldProtons, hYieldPionsDeltaProton,\r
- hYieldElectronsDeltaProton, hYieldKaonsDeltaProton, hYieldProtonsDeltaProton, hYieldMuonsDeltaProton);\r
- }\r
- \r
- std::cout << std::endl << std::endl;\r
- \r
- \r
- if (fitMethod == 1) { \r
- // Calculate fractions and yields for method 1\r
- if (integralTotal > 0) { \r
- \r
- Double_t sumOfParticles = 0;\r
- \r
- // Check fraction and yield determination for systematics\r
- // DeltaPion\r
- Double_t integralTotalDeltaPion = integralPionsDeltaPion + integralElectronsDeltaPion +\r
- (takeIntoAccountMuons ? integralMuonsDeltaPion : 0.) + \r
- integralKaonsDeltaPion + integralProtonsDeltaPion;\r
- totalDeltaPion->GetParameters(parametersOut);\r
- \r
- Double_t pionFractionDeltaPion = saveDivide(integralPionsDeltaPion, integralTotalDeltaPion);\r
- Double_t pionFractionErrorDeltaPion = getErrorOfPionFraction(parametersOut, covMatrixPi);\r
- hFractionPionsDeltaPion->SetBinContent(slice + 1, pionFractionDeltaPion);\r
- hFractionPionsDeltaPion->SetBinError(slice + 1, pionFractionErrorDeltaPion);\r
- \r
- Double_t electronFractionDeltaPion = saveDivide(integralElectronsDeltaPion, integralTotalDeltaPion);\r
- Double_t electronFractionErrorDeltaPion = getErrorOfElectronFraction(parametersOut, covMatrixPi);\r
- hFractionElectronsDeltaPion->SetBinContent(slice + 1, electronFractionDeltaPion);\r
- hFractionElectronsDeltaPion->SetBinError(slice + 1, electronFractionErrorDeltaPion);\r
- \r
- Double_t kaonFractionDeltaPion = saveDivide(integralKaonsDeltaPion, integralTotalDeltaPion);\r
- Double_t kaonFractionErrorDeltaPion = getErrorOfKaonFraction(parametersOut, covMatrixPi);\r
- hFractionKaonsDeltaPion->SetBinContent(slice + 1, kaonFractionDeltaPion);\r
- hFractionKaonsDeltaPion->SetBinError(slice + 1, kaonFractionErrorDeltaPion);\r
- \r
- Double_t protonFractionDeltaPion = saveDivide(integralProtonsDeltaPion, integralTotalDeltaPion);\r
- Double_t protonFractionErrorDeltaPion = getErrorOfProtonFraction(parametersOut, covMatrixPi);\r
- hFractionProtonsDeltaPion->SetBinContent(slice + 1, protonFractionDeltaPion);\r
- hFractionProtonsDeltaPion->SetBinError(slice + 1, protonFractionErrorDeltaPion);\r
- \r
- Double_t muonFractionDeltaPion = saveDivide(integralMuonsDeltaPion, integralTotalDeltaPion);\r
- // TODO Error is anyway not implemented correctly. Just take electron error as an approximation\r
- Double_t muonFractionErrorDeltaPion = getErrorOfElectronFraction(parametersOut, covMatrixPi);\r
- hFractionMuonsDeltaPion->SetBinContent(slice + 1, muonFractionDeltaPion);\r
- hFractionMuonsDeltaPion->SetBinError(slice + 1, muonFractionErrorDeltaPion);\r
- \r
- sumOfParticles = inverseBinWidth * gausParamsPi[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width\r
- \r
- hYieldPionsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaPion->GetBinContent(slice + 1));\r
- hYieldPionsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaPion->GetBinError(slice + 1));\r
- hYieldElectronsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaPion->GetBinContent(slice + 1));\r
- hYieldElectronsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaPion->GetBinError(slice + 1));\r
- hYieldKaonsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaPion->GetBinContent(slice + 1));\r
- hYieldKaonsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaPion->GetBinError(slice + 1));\r
- hYieldProtonsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaPion->GetBinContent(slice + 1));\r
- hYieldProtonsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaPion->GetBinError(slice + 1));\r
- hYieldMuonsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaPion->GetBinContent(slice + 1));\r
- hYieldMuonsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaPion->GetBinError(slice + 1));\r
- \r
- \r
- // DeltaElectron\r
- Double_t integralTotalDeltaElectron = integralPionsDeltaElectron + integralElectronsDeltaElectron + \r
- (takeIntoAccountMuons ? integralMuonsDeltaElectron : 0.) + \r
- integralKaonsDeltaElectron + integralProtonsDeltaElectron;\r
- totalDeltaElectron->GetParameters(parametersOut);\r
- \r
- Double_t pionFractionDeltaElectron = saveDivide(integralPionsDeltaElectron, integralTotalDeltaElectron);\r
- Double_t pionFractionErrorDeltaElectron = getErrorOfPionFraction(parametersOut, covMatrixEl);\r
- hFractionPionsDeltaElectron->SetBinContent(slice + 1, pionFractionDeltaElectron);\r
- hFractionPionsDeltaElectron->SetBinError(slice + 1, pionFractionErrorDeltaElectron);\r
- \r
- Double_t electronFractionDeltaElectron = saveDivide(integralElectronsDeltaElectron, integralTotalDeltaElectron);\r
- Double_t electronFractionErrorDeltaElectron = getErrorOfElectronFraction(parametersOut, covMatrixEl);\r
- hFractionElectronsDeltaElectron->SetBinContent(slice + 1, electronFractionDeltaElectron);\r
- hFractionElectronsDeltaElectron->SetBinError(slice + 1, electronFractionErrorDeltaElectron);\r
- \r
- Double_t kaonFractionDeltaElectron = saveDivide(integralKaonsDeltaElectron, integralTotalDeltaElectron);\r
- Double_t kaonFractionErrorDeltaElectron = getErrorOfKaonFraction(parametersOut, covMatrixEl);\r
- hFractionKaonsDeltaElectron->SetBinContent(slice + 1, kaonFractionDeltaElectron);\r
- hFractionKaonsDeltaElectron->SetBinError(slice + 1, kaonFractionErrorDeltaElectron);\r
- \r
- Double_t protonFractionDeltaElectron = saveDivide(integralProtonsDeltaElectron, integralTotalDeltaElectron);\r
- Double_t protonFractionErrorDeltaElectron = getErrorOfProtonFraction(parametersOut, covMatrixEl);\r
- hFractionProtonsDeltaElectron->SetBinContent(slice + 1, protonFractionDeltaElectron);\r
- hFractionProtonsDeltaElectron->SetBinError(slice + 1, protonFractionErrorDeltaElectron);\r
- \r
- Double_t muonFractionDeltaElectron = saveDivide(integralMuonsDeltaElectron, integralTotalDeltaElectron);\r
- // TODO Error is anyway not implemented correctly. Just take electron error as an approximation\r
- Double_t muonFractionErrorDeltaElectron = getErrorOfElectronFraction(parametersOut, covMatrixEl);\r
- hFractionMuonsDeltaElectron->SetBinContent(slice + 1, muonFractionDeltaElectron);\r
- hFractionMuonsDeltaElectron->SetBinError(slice + 1, muonFractionErrorDeltaElectron);\r
- \r
- sumOfParticles = inverseBinWidth * gausParamsEl[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width\r
- \r
- hYieldPionsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaElectron->GetBinContent(slice + 1));\r
- hYieldPionsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaElectron->GetBinError(slice + 1));\r
- hYieldElectronsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaElectron->GetBinContent(slice + 1));\r
- hYieldElectronsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaElectron->GetBinError(slice + 1));\r
- hYieldKaonsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaElectron->GetBinContent(slice + 1));\r
- hYieldKaonsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaElectron->GetBinError(slice + 1));\r
- hYieldProtonsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaElectron->GetBinContent(slice + 1));\r
- hYieldProtonsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaElectron->GetBinError(slice + 1));\r
- hYieldMuonsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaElectron->GetBinContent(slice + 1));\r
- hYieldMuonsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaElectron->GetBinError(slice + 1));\r
- \r
- \r
- // DeltaKaon\r
- Double_t integralTotalDeltaKaon = integralPionsDeltaKaon + integralElectronsDeltaKaon +\r
- (takeIntoAccountMuons ? integralMuonsDeltaKaon : 0.) + \r
- integralKaonsDeltaKaon + integralProtonsDeltaKaon;\r
- totalDeltaKaon->GetParameters(parametersOut);\r
- \r
- Double_t pionFractionDeltaKaon = saveDivide(integralPionsDeltaKaon, integralTotalDeltaKaon);\r
- Double_t pionFractionErrorDeltaKaon = getErrorOfPionFraction(parametersOut, covMatrixKa);\r
- hFractionPionsDeltaKaon->SetBinContent(slice + 1, pionFractionDeltaKaon);\r
- hFractionPionsDeltaKaon->SetBinError(slice + 1, pionFractionErrorDeltaKaon);\r
- \r
- Double_t electronFractionDeltaKaon = saveDivide(integralElectronsDeltaKaon, integralTotalDeltaKaon);\r
- Double_t electronFractionErrorDeltaKaon = getErrorOfElectronFraction(parametersOut, covMatrixKa);\r
- hFractionElectronsDeltaKaon->SetBinContent(slice + 1, electronFractionDeltaKaon);\r
- hFractionElectronsDeltaKaon->SetBinError(slice + 1, electronFractionErrorDeltaKaon);\r
- \r
- Double_t kaonFractionDeltaKaon = saveDivide(integralKaonsDeltaKaon, integralTotalDeltaKaon);\r
- Double_t kaonFractionErrorDeltaKaon = getErrorOfKaonFraction(parametersOut, covMatrixKa);\r
- hFractionKaonsDeltaKaon->SetBinContent(slice + 1, kaonFractionDeltaKaon);\r
- hFractionKaonsDeltaKaon->SetBinError(slice + 1, kaonFractionErrorDeltaKaon);\r
- \r
- Double_t protonFractionDeltaKaon = saveDivide(integralProtonsDeltaKaon, integralTotalDeltaKaon);\r
- Double_t protonFractionErrorDeltaKaon = getErrorOfProtonFraction(parametersOut, covMatrixKa);\r
- hFractionProtonsDeltaKaon->SetBinContent(slice + 1, protonFractionDeltaKaon);\r
- hFractionProtonsDeltaKaon->SetBinError(slice + 1, protonFractionErrorDeltaKaon);\r
- \r
- Double_t muonFractionDeltaKaon = saveDivide(integralMuonsDeltaKaon, integralTotalDeltaKaon);\r
- // TODO Error is anyway not implemented correctly. Just take electron error as an approximation\r
- Double_t muonFractionErrorDeltaKaon = getErrorOfElectronFraction(parametersOut, covMatrixKa);\r
- hFractionMuonsDeltaKaon->SetBinContent(slice + 1, muonFractionDeltaKaon);\r
- hFractionMuonsDeltaKaon->SetBinError(slice + 1, muonFractionErrorDeltaKaon);\r
- \r
- sumOfParticles = inverseBinWidth * gausParamsKa[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width\r
- \r
- hYieldPionsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaKaon->GetBinContent(slice + 1));\r
- hYieldPionsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaKaon->GetBinError(slice + 1));\r
- hYieldElectronsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaKaon->GetBinContent(slice + 1));\r
- hYieldElectronsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaKaon->GetBinError(slice + 1));\r
- hYieldKaonsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaKaon->GetBinContent(slice + 1));\r
- hYieldKaonsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaKaon->GetBinError(slice + 1));\r
- hYieldProtonsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaKaon->GetBinContent(slice + 1));\r
- hYieldProtonsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaKaon->GetBinError(slice + 1));\r
- hYieldMuonsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaKaon->GetBinContent(slice + 1));\r
- hYieldMuonsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaKaon->GetBinError(slice + 1));\r
- \r
- \r
- \r
- // DeltaProton\r
- Double_t integralTotalDeltaProton = integralPionsDeltaProton + integralElectronsDeltaProton +\r
- (takeIntoAccountMuons ? integralMuonsDeltaProton : 0.) + \r
- integralKaonsDeltaProton + integralProtonsDeltaProton;\r
- totalDeltaProton->GetParameters(parametersOut);\r
- \r
- Double_t pionFractionDeltaProton = saveDivide(integralPionsDeltaProton, integralTotalDeltaProton);\r
- Double_t pionFractionErrorDeltaProton = getErrorOfPionFraction(parametersOut, covMatrixPr);\r
- hFractionPionsDeltaProton->SetBinContent(slice + 1, pionFractionDeltaProton);\r
- hFractionPionsDeltaProton->SetBinError(slice + 1, pionFractionErrorDeltaProton);\r
- \r
- Double_t electronFractionDeltaProton = saveDivide(integralElectronsDeltaProton, integralTotalDeltaProton);\r
- Double_t electronFractionErrorDeltaProton = getErrorOfElectronFraction(parametersOut, covMatrixPr);\r
- hFractionElectronsDeltaProton->SetBinContent(slice + 1, electronFractionDeltaProton);\r
- hFractionElectronsDeltaProton->SetBinError(slice + 1, electronFractionErrorDeltaProton);\r
- \r
- Double_t kaonFractionDeltaProton = saveDivide(integralKaonsDeltaProton, integralTotalDeltaProton);\r
- Double_t kaonFractionErrorDeltaProton = getErrorOfKaonFraction(parametersOut, covMatrixPr);\r
- hFractionKaonsDeltaProton->SetBinContent(slice + 1, kaonFractionDeltaProton);\r
- hFractionKaonsDeltaProton->SetBinError(slice + 1, kaonFractionErrorDeltaProton);\r
- \r
- Double_t protonFractionDeltaProton = saveDivide(integralProtonsDeltaProton, integralTotalDeltaProton);\r
- Double_t protonFractionErrorDeltaProton = getErrorOfProtonFraction(parametersOut, covMatrixPr);\r
- hFractionProtonsDeltaProton->SetBinContent(slice + 1, protonFractionDeltaProton);\r
- hFractionProtonsDeltaProton->SetBinError(slice + 1, protonFractionErrorDeltaProton);\r
- \r
- Double_t muonFractionDeltaProton = saveDivide(integralMuonsDeltaProton, integralTotalDeltaProton);\r
- // TODO Error is anyway not implemented correctly. Just take electron error as an approximation\r
- Double_t muonFractionErrorDeltaProton = getErrorOfElectronFraction(parametersOut, covMatrixPr);\r
- hFractionMuonsDeltaProton->SetBinContent(slice + 1, muonFractionDeltaProton);\r
- hFractionMuonsDeltaProton->SetBinError(slice + 1, muonFractionErrorDeltaProton);\r
- \r
- sumOfParticles = inverseBinWidth * gausParamsPr[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width\r
- \r
- hYieldPionsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaProton->GetBinContent(slice + 1));\r
- hYieldPionsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaProton->GetBinError(slice + 1));\r
- hYieldElectronsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaProton->GetBinContent(slice + 1));\r
- hYieldElectronsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaProton->GetBinError(slice + 1));\r
- hYieldKaonsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaProton->GetBinContent(slice + 1));\r
- hYieldKaonsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaProton->GetBinError(slice + 1));\r
- hYieldProtonsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaProton->GetBinContent(slice + 1));\r
- hYieldProtonsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaProton->GetBinError(slice + 1));\r
- hYieldMuonsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaProton->GetBinContent(slice + 1));\r
- hYieldMuonsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaProton->GetBinError(slice + 1));\r
- \r
- \r
- \r
- // Take for XXXXfractionError the median of XXXXfractionErrorYYYY and do not take into account errors\r
- // with value zero, since the should correspond to a failed fit (but the other fits can still converge).\r
- // Same for the yields\r
- Double_t pionFraction = saveDivide(integralPions, integralTotal);\r
- Double_t errorsPions[4] = { pionFractionErrorDeltaPion, pionFractionErrorDeltaElectron, \r
- pionFractionErrorDeltaKaon, pionFractionErrorDeltaProton };\r
- Double_t pionFractionError = getMedianOfNonZeros(errorsPions);\r
- \r
- Double_t electronFraction = saveDivide(integralElectrons, integralTotal);\r
- Double_t errorsElectrons[4] = { electronFractionErrorDeltaPion, electronFractionErrorDeltaElectron, \r
- electronFractionErrorDeltaKaon, electronFractionErrorDeltaProton };\r
- Double_t electronFractionError = getMedianOfNonZeros(errorsElectrons);\r
- \r
- Double_t kaonFraction = saveDivide(integralKaons, integralTotal);\r
- Double_t errorsKaons[4] = { kaonFractionErrorDeltaPion, kaonFractionErrorDeltaElectron, \r
- kaonFractionErrorDeltaKaon, kaonFractionErrorDeltaProton };\r
- Double_t kaonFractionError = getMedianOfNonZeros(errorsKaons);\r
- \r
- Double_t protonFraction = saveDivide(integralProtons, integralTotal);\r
- Double_t errorsProtons[4] = { protonFractionErrorDeltaPion, protonFractionErrorDeltaElectron, \r
- protonFractionErrorDeltaKaon, protonFractionErrorDeltaProton };\r
- Double_t protonFractionError = getMedianOfNonZeros(errorsProtons);\r
- \r
- Double_t muonFraction = saveDivide(integralMuons, integralTotal);\r
- Double_t errorsMuons[4] = { muonFractionErrorDeltaPion, muonFractionErrorDeltaElectron, \r
- muonFractionErrorDeltaKaon, muonFractionErrorDeltaProton };\r
- Double_t muonFractionError = getMedianOfNonZeros(errorsMuons);\r
- \r
- hFractionPions->SetBinContent(slice + 1, pionFraction);\r
- hFractionPions->SetBinError(slice + 1, pionFractionError);\r
- hFractionElectrons->SetBinContent(slice + 1, electronFraction);\r
- hFractionElectrons->SetBinError(slice + 1, electronFractionError);\r
- hFractionKaons->SetBinContent(slice + 1, kaonFraction);\r
- hFractionKaons->SetBinError(slice + 1, kaonFractionError);\r
- hFractionProtons->SetBinContent(slice + 1, protonFraction);\r
- hFractionProtons->SetBinError(slice + 1, protonFractionError);\r
- hFractionMuons->SetBinContent(slice + 1, muonFraction);\r
- hFractionMuons->SetBinError(slice + 1, muonFractionError);\r
- \r
- hFractionSummed->SetBinContent(slice + 1, pionFraction + electronFraction + (takeIntoAccountMuons ? muonFraction : 0.) +\r
- kaonFraction + protonFraction);\r
- hFractionSummed->SetBinError(slice + 1, \r
- TMath::Sqrt(TMath::Power(pionFractionError, 2) +\r
- TMath::Power(electronFractionError, 2) +\r
- (takeIntoAccountMuons ? TMath::Power(muonFractionError, 2) : 0.) +\r
- TMath::Power(kaonFractionError, 2) +\r
- TMath::Power(protonFractionError, 2)));\r
- \r
- sumOfParticles = inverseBinWidth * integralTotal / binWidthFitHisto; // Divide by binWidthFitHisto, since integralTotal includes this width\r
- \r
- hYieldPions->SetBinContent(slice + 1, sumOfParticles * hFractionPions->GetBinContent(slice + 1));\r
- hYieldPions->SetBinError(slice + 1, sumOfParticles * hFractionPions->GetBinError(slice + 1));\r
- hYieldElectrons->SetBinContent(slice + 1, sumOfParticles * hFractionElectrons->GetBinContent(slice + 1));\r
- hYieldElectrons->SetBinError(slice + 1, sumOfParticles * hFractionElectrons->GetBinError(slice + 1));\r
- hYieldKaons->SetBinContent(slice + 1, sumOfParticles * hFractionKaons->GetBinContent(slice + 1));\r
- hYieldKaons->SetBinError(slice + 1, sumOfParticles * hFractionKaons->GetBinError(slice + 1));\r
- hYieldProtons->SetBinContent(slice + 1, sumOfParticles * hFractionProtons->GetBinContent(slice + 1));\r
- hYieldProtons->SetBinError(slice + 1, sumOfParticles * hFractionProtons->GetBinError(slice + 1));\r
- hYieldMuons->SetBinContent(slice + 1, sumOfParticles * hFractionMuons->GetBinContent(slice + 1));\r
- hYieldMuons->SetBinError(slice + 1, sumOfParticles * hFractionMuons->GetBinError(slice + 1));\r
- }\r
- }\r
- else { \r
- Double_t SumFractionsDeltaElectron = hFractionPionsDeltaElectron->GetBinContent(slice + 1) + \r
- hFractionElectronsDeltaElectron->GetBinContent(slice + 1) + \r
- (takeIntoAccountMuons ? hFractionMuonsDeltaElectron->GetBinContent(slice + 1) : 0.) +\r
- hFractionKaonsDeltaElectron->GetBinContent(slice + 1) + hFractionProtonsDeltaElectron->GetBinContent(slice + 1);\r
- \r
- Double_t SumFractionsDeltaKaon = hFractionPionsDeltaKaon->GetBinContent(slice + 1) + \r
- hFractionElectronsDeltaKaon->GetBinContent(slice + 1) +\r
- (takeIntoAccountMuons ? hFractionMuonsDeltaKaon->GetBinContent(slice + 1) : 0.) +\r
- hFractionKaonsDeltaKaon->GetBinContent(slice + 1) + hFractionProtonsDeltaKaon->GetBinContent(slice + 1);\r
- \r
- Double_t SumFractionsDeltaPion = hFractionPionsDeltaPion->GetBinContent(slice + 1) + \r
- hFractionElectronsDeltaPion->GetBinContent(slice + 1) +\r
- (takeIntoAccountMuons ? hFractionMuonsDeltaPion->GetBinContent(slice + 1) : 0.) +\r
- hFractionKaonsDeltaPion->GetBinContent(slice + 1) + hFractionProtonsDeltaPion->GetBinContent(slice + 1);\r
- \r
- Double_t SumFractionsDeltaProton = hFractionPionsDeltaProton->GetBinContent(slice + 1) + \r
- hFractionElectronsDeltaProton->GetBinContent(slice + 1) +\r
- (takeIntoAccountMuons ? hFractionMuonsDeltaProton->GetBinContent(slice + 1) : 0.) +\r
- hFractionKaonsDeltaProton->GetBinContent(slice + 1) + hFractionProtonsDeltaProton->GetBinContent(slice + 1);\r
- \r
- Double_t SumFractionsUsed = hFractionPionsDeltaPion->GetBinContent(slice + 1) + \r
- hFractionElectronsDeltaElectron->GetBinContent(slice + 1) +\r
- (takeIntoAccountMuons ? hFractionMuonsDeltaPion->GetBinContent(slice + 1) : 0.) +\r
- hFractionKaonsDeltaKaon->GetBinContent(slice + 1) + hFractionProtonsDeltaProton->GetBinContent(slice + 1);\r
- \r
- hFractionSummed->SetBinContent(slice + 1, SumFractionsUsed);\r
- hFractionSummed->SetBinError(slice + 1, \r
- TMath::Sqrt(TMath::Power(hFractionPionsDeltaPion->GetBinError(slice + 1), 2) + \r
- TMath::Power(hFractionElectronsDeltaElectron->GetBinError(slice + 1), 2) +\r
- (takeIntoAccountMuons ? TMath::Power(hFractionMuonsDeltaPion->GetBinError(slice + 1), \r
- 2) : 0.) +\r
- TMath::Power(hFractionKaonsDeltaKaon->GetBinError(slice + 1), 2) +\r
- TMath::Power(hFractionProtonsDeltaProton->GetBinError(slice + 1), 2)));\r
- \r
- \r
- std::cout << "Sum Fractions DeltaElectron: " << SumFractionsDeltaElectron;\r
- std::cout << (TMath::Abs(SumFractionsDeltaElectron - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;\r
- \r
- std::cout << "Sum Fractions DeltaKaon: " << SumFractionsDeltaKaon;\r
- std::cout << (TMath::Abs(SumFractionsDeltaKaon - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;\r
- \r
- std::cout << "Sum Fractions DeltaPion: " << SumFractionsDeltaPion;\r
- std::cout << (TMath::Abs(SumFractionsDeltaPion - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;\r
- \r
- std::cout << "Sum fractions DeltaProton: " << SumFractionsDeltaProton;\r
- std::cout << (TMath::Abs(SumFractionsDeltaProton - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;\r
- \r
- std::cout << "Sum fractions used: " << SumFractionsUsed;\r
- std::cout << (TMath::Abs(SumFractionsUsed - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;\r
- }\r
- \r
- for (Int_t species = 0; species < 4; species++) {\r
- cSingleFit[slice][species]->Modified();\r
- cSingleFit[slice][species]->Update();\r
- }\r
- \r
- \r
- }\r
- \r
- if (regularisation <= 0)\r
- std::cout << std::endl << std::endl;\r
- \r
- \r
- // MC results\r
- Double_t MCtotal = -1, MCelectrons = -1, MCkaons = -1, MCmuons = -1, MCpions = -1, MCprotons = -1;\r
- Double_t MCelectronsErr = 0, MCkaonsErr = 0, MCmuonsErr = 0, MCpionsErr = 0, MCprotonsErr = 0;\r
- \r
- MCelectrons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 1, 1, MCelectronsErr) * inverseBinWidth;\r
- MCkaons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 2, 2, MCkaonsErr) * inverseBinWidth;\r
- MCmuons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 3, 3, MCmuonsErr) * inverseBinWidth;\r
- MCpions = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 4, 4, MCpionsErr) * inverseBinWidth;\r
- MCprotons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 5, 5, MCprotonsErr) * inverseBinWidth;\r
-\r
- MCelectronsErr *= inverseBinWidth;\r
- MCkaonsErr *= inverseBinWidth;\r
- MCmuonsErr *= inverseBinWidth;\r
- MCpionsErr *= inverseBinWidth;\r
- MCprotonsErr *= inverseBinWidth;\r
- \r
- MCtotal = MCelectrons + MCkaons + MCpions + MCprotons + MCmuons;\r
- \r
- if (MCtotal > 0) {\r
- hYieldElectronsMC->SetBinContent(slice + 1, MCelectrons);\r
- hYieldElectronsMC->SetBinError(slice + 1, MCelectronsErr);\r
- \r
- hYieldMuonsMC->SetBinContent(slice + 1, MCmuons);\r
- hYieldMuonsMC->SetBinError(slice + 1, MCmuonsErr);\r
- \r
- hYieldKaonsMC->SetBinContent(slice + 1, MCkaons);\r
- hYieldKaonsMC->SetBinError(slice + 1, MCkaonsErr);\r
- \r
- hYieldPionsMC->SetBinContent(slice + 1, MCpions);\r
- hYieldPionsMC->SetBinError(slice + 1, MCpionsErr);\r
- \r
- hYieldProtonsMC->SetBinContent(slice + 1, MCprotons);\r
- hYieldProtonsMC->SetBinError(slice + 1, MCprotonsErr);\r
- \r
- hYieldSummedMC->SetBinContent(slice + 1, hYieldElectronsMC->GetBinContent(slice + 1) +\r
- hYieldKaonsMC->GetBinContent(slice + 1) + \r
- hYieldPionsMC->GetBinContent(slice + 1) +\r
- hYieldProtonsMC->GetBinContent(slice + 1) +\r
- hYieldMuonsMC->GetBinContent(slice + 1));\r
- hYieldSummedMC->SetBinError(slice + 1, TMath::Sqrt(TMath::Power(hYieldPionsMC->GetBinError(slice + 1), 2) + \r
- TMath::Power(hYieldElectronsMC->GetBinError(slice + 1), 2) +\r
- TMath::Power(hYieldKaonsMC->GetBinError(slice + 1), 2) +\r
- TMath::Power(hYieldProtonsMC->GetBinError(slice + 1), 2) +\r
- TMath::Power(hYieldMuonsMC->GetBinError(slice + 1), 2)));\r
- \r
- // MCspecies and MCtotal are correlated. This can be taken into account via using the binomial error in the division\r
- hFractionElectronsMC->Divide(hYieldElectronsMC, hYieldSummedMC, 1., 1., "B");\r
- hFractionMuonsMC->Divide(hYieldMuonsMC, hYieldSummedMC, 1., 1., "B");\r
- hFractionKaonsMC->Divide(hYieldKaonsMC, hYieldSummedMC, 1., 1., "B");\r
- hFractionPionsMC->Divide(hYieldPionsMC, hYieldSummedMC, 1., 1., "B");\r
- hFractionProtonsMC->Divide(hYieldProtonsMC, hYieldSummedMC, 1., 1., "B");\r
- }\r
- \r
- // Save further results\r
- if (slice % 18 == 0 || slice == pSliceLow) {\r
- saveF->cd(); \r
-\r
- if (hFractionElectrons)\r
- hFractionElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaons)\r
- hFractionKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPions)\r
- hFractionPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtons)\r
- hFractionProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuons)\r
- hFractionMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionSummed)\r
- hFractionSummed->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaElectron)\r
- hFractionElectronsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaElectron)\r
- hFractionKaonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaElectron)\r
- hFractionPionsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaElectron)\r
- hFractionProtonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaElectron)\r
- hFractionMuonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaPion)\r
- hFractionElectronsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaPion)\r
- hFractionKaonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaPion)\r
- hFractionPionsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaPion)\r
- hFractionProtonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaPion)\r
- hFractionMuonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaKaon)\r
- hFractionElectronsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaKaon)\r
- hFractionKaonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaKaon)\r
- hFractionPionsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaKaon)\r
- hFractionProtonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaKaon)\r
- hFractionMuonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaProton)\r
- hFractionElectronsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaProton)\r
- hFractionKaonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaProton)\r
- hFractionPionsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaProton)\r
- hFractionProtonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaProton)\r
- hFractionMuonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsMC)\r
- hFractionElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsMC)\r
- hFractionKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsMC)\r
- hFractionPionsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsMC)\r
- hFractionMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsMC)\r
- hFractionProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- \r
- \r
- if (hYieldElectrons)\r
- hYieldElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaons)\r
- hYieldKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPions)\r
- hYieldPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtons)\r
- hYieldProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuons)\r
- hYieldMuons->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaElectron)\r
- hYieldElectronsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaElectron)\r
- hYieldKaonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaElectron)\r
- hYieldPionsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaElectron)\r
- hYieldProtonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaElectron)\r
- hYieldMuonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaPion)\r
- hYieldElectronsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaPion)\r
- hYieldKaonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaPion)\r
- hYieldPionsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaPion)\r
- hYieldProtonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaPion)\r
- hYieldMuonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaKaon)\r
- hYieldElectronsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaKaon)\r
- hYieldKaonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaKaon)\r
- hYieldPionsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaKaon)\r
- hYieldProtonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaKaon)\r
- hYieldMuonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaProton)\r
- hYieldElectronsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaProton)\r
- hYieldKaonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaProton)\r
- hYieldPionsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaProton)\r
- hYieldProtonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaProton)\r
- hYieldMuonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsMC)\r
- hYieldElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsMC)\r
- hYieldKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsMC)\r
- hYieldPionsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsMC)\r
- hYieldMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsMC)\r
- hYieldProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldSummedMC)\r
- hYieldSummedMC->Write(0, TObject::kWriteDelete);\r
- }\r
- \r
- TString saveDir = (mode == kPMpT) ? Form("SingleFit_%.2f_Pt_%.2f", binsPt[slice], binsPt[slice + 1])\r
- : Form("SingleFit_%.2f_%s_%.2f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1), \r
- modeShortName[mode].Data(), hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));\r
- saveF->mkdir(saveDir.Data());\r
- saveF->cd(saveDir.Data());\r
- \r
- for (Int_t species = 0; species < 4; species++) {\r
- if (cSingleFit[slice][species]) {\r
- cSingleFit[slice][species]->Write();\r
- delete cSingleFit[slice][species];\r
- }\r
- }\r
- \r
- if (hDeltaPi[slice])\r
- hDeltaPi[slice]->Write();\r
- \r
- if (hDeltaEl[slice])\r
- hDeltaEl[slice]->Write();\r
- \r
- if (hDeltaKa[slice])\r
- hDeltaKa[slice]->Write();\r
- \r
- if (hDeltaPr[slice])\r
- hDeltaPr[slice]->Write();\r
- \r
- \r
- if (hDeltaPiFitQA[slice])\r
- hDeltaPiFitQA[slice]->Write();\r
- delete hDeltaPiFitQA[slice];\r
- \r
- if (hDeltaElFitQA[slice])\r
- hDeltaElFitQA[slice]->Write();\r
- delete hDeltaElFitQA[slice];\r
- \r
- if (hDeltaKaFitQA[slice])\r
- hDeltaKaFitQA[slice]->Write();\r
- delete hDeltaKaFitQA[slice];\r
- \r
- if (hDeltaPrFitQA[slice])\r
- hDeltaPrFitQA[slice]->Write();\r
- delete hDeltaPrFitQA[slice];\r
- \r
- if (hGenDeltaElForElProj) \r
- hGenDeltaElForElProj->Write();\r
- delete hGenDeltaElForElProj;\r
- \r
- if (hGenDeltaElForKaProj) \r
- hGenDeltaElForKaProj->Write();\r
- delete hGenDeltaElForKaProj;\r
- \r
- if (hGenDeltaElForPiProj) \r
- hGenDeltaElForPiProj->Write();\r
- delete hGenDeltaElForPiProj;\r
- \r
- if (hGenDeltaElForPrProj) \r
- hGenDeltaElForPrProj->Write();\r
- delete hGenDeltaElForPrProj;\r
- \r
- if (hGenDeltaElForMuProj) \r
- hGenDeltaElForMuProj->Write();\r
- delete hGenDeltaElForMuProj;\r
- \r
- //if (fitFuncTotalDeltaElectron[slice]) \r
- // fitFuncTotalDeltaElectron[slice]->Write();\r
- delete fitFuncTotalDeltaElectron[slice];\r
- \r
- if (hGenDeltaKaForElProj) \r
- hGenDeltaKaForElProj->Write();\r
- delete hGenDeltaKaForElProj;\r
- \r
- if (hGenDeltaKaForKaProj) \r
- hGenDeltaKaForKaProj->Write();\r
- delete hGenDeltaKaForKaProj;\r
- \r
- if (hGenDeltaKaForPiProj) \r
- hGenDeltaKaForPiProj->Write();\r
- delete hGenDeltaKaForPiProj;\r
- \r
- if (hGenDeltaKaForPrProj) \r
- hGenDeltaKaForPrProj->Write();\r
- delete hGenDeltaKaForPrProj;\r
- \r
- if (hGenDeltaKaForMuProj) \r
- hGenDeltaKaForMuProj->Write();\r
- delete hGenDeltaKaForMuProj;\r
- \r
- //if (fitFuncTotalDeltaKaon[slice]) \r
- // fitFuncTotalDeltaKaon[slice]->Write();\r
- delete fitFuncTotalDeltaKaon[slice];\r
- \r
- \r
- if (hGenDeltaPiForElProj) \r
- hGenDeltaPiForElProj->Write();\r
- delete hGenDeltaPiForElProj;\r
- \r
- if (hGenDeltaPiForKaProj) \r
- hGenDeltaPiForKaProj->Write();\r
- delete hGenDeltaPiForKaProj;\r
- \r
- if (hGenDeltaPiForPiProj) \r
- hGenDeltaPiForPiProj->Write();\r
- delete hGenDeltaPiForPiProj;\r
- \r
- if (hGenDeltaPiForPrProj) \r
- hGenDeltaPiForPrProj->Write();\r
- delete hGenDeltaPiForPrProj;\r
- \r
- if (hGenDeltaPiForMuProj) \r
- hGenDeltaPiForMuProj->Write();\r
- delete hGenDeltaPiForMuProj;\r
- \r
- //if (fitFuncTotalDeltaPion[slice]) \r
- // fitFuncTotalDeltaPion[slice]->Write();\r
- delete fitFuncTotalDeltaPion[slice];\r
- \r
- \r
- if (hGenDeltaPrForElProj) \r
- hGenDeltaPrForElProj->Write();\r
- delete hGenDeltaPrForElProj;\r
- \r
- if (hGenDeltaPrForKaProj) \r
- hGenDeltaPrForKaProj->Write();\r
- delete hGenDeltaPrForKaProj;\r
- \r
- if (hGenDeltaPrForPiProj) \r
- hGenDeltaPrForPiProj->Write();\r
- delete hGenDeltaPrForPiProj;\r
- \r
- if (hGenDeltaPrForPrProj) \r
- hGenDeltaPrForPrProj->Write();\r
- delete hGenDeltaPrForPrProj;\r
- \r
- if (hGenDeltaPrForMuProj) \r
- hGenDeltaPrForMuProj->Write();\r
- delete hGenDeltaPrForMuProj;\r
- \r
- //if (fitFuncTotalDeltaProton[slice]) \r
- // fitFuncTotalDeltaProton[slice]->Write();\r
- delete fitFuncTotalDeltaProton[slice];\r
- \r
- delete totalDeltaElectron;\r
- delete totalDeltaKaon;\r
- delete totalDeltaPion;\r
- delete totalDeltaProton;\r
- \r
- delete legend;\r
- \r
- if (errFlag != 0)\r
- std::cout << "errFlag " << errFlag << std::endl << std::endl;\r
- }\r
- }\r
- \r
- // Calculate MC to-pi ratios -> In MC the yields are uncorrelated, so just divide the histos to get the correct result\r
- hRatioToPiElectronsMC->Divide(hYieldElectronsMC, hYieldPionsMC);\r
- hRatioToPiMuonsMC->Divide(hYieldMuonsMC, hYieldPionsMC);\r
- hRatioToPiKaonsMC->Divide(hYieldKaonsMC, hYieldPionsMC);\r
- hRatioToPiProtonsMC->Divide(hYieldProtonsMC, hYieldPionsMC);\r
- \r
- \r
- TCanvas* cFractions = new TCanvas("cFractions", "Particle fractions",100,10,1200,800);\r
- cFractions->SetGridx(1);\r
- cFractions->SetGridy(1);\r
- cFractions->SetLogx(mode == kPMpT);\r
- hFractionPions->GetYaxis()->SetRangeUser(0.0, 1.0);\r
- SetReasonableAxisRange(hFractionPions->GetXaxis(), mode, pLow, pHigh);\r
- hFractionPions->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- hFractionPions->GetXaxis()->SetNoExponent(kTRUE);\r
- hFractionPions->Draw("e p");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hFractionPionsMC->GetXaxis(), mode, pLow, pHigh);\r
- hFractionPionsMC->Draw("e p same");\r
- }\r
- \r
- SetReasonableAxisRange(hFractionKaons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionKaons->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hFractionKaonsMC->GetXaxis(), mode, pLow, pHigh);\r
- hFractionKaonsMC->Draw("e p same");\r
- }\r
- \r
- SetReasonableAxisRange(hFractionProtons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionProtons->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hFractionProtonsMC->GetXaxis(), mode, pLow, pHigh);\r
- hFractionProtonsMC->Draw("e p same");\r
- }\r
- \r
- SetReasonableAxisRange(hFractionElectrons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionElectrons->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hFractionElectronsMC->GetXaxis(), mode, pLow, pHigh);\r
- hFractionElectronsMC->Draw("e p same");\r
- }\r
- \r
- if (takeIntoAccountMuons) {\r
- SetReasonableAxisRange(hFractionMuons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionMuons->Draw("e p same");\r
- }\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hFractionMuonsMC->GetXaxis(), mode, pLow, pHigh);\r
- hFractionMuonsMC->Draw("e p same");\r
- }\r
- \r
- hFractionSummed->Draw("e p same");\r
- \r
- if (mode == kPMpT) {\r
- fElectronFraction->SetRange(lowFittingBoundElectronFraction, pHigh);\r
- fElectronFraction->Draw("same");\r
- }\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- if (plotIdentifiedSpectra)\r
- legend->SetNColumns(2);\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry((TObject*)0x0, "Fit", "");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry((TObject*)0x0, identifiedLabels[isMC].Data(), "");\r
- legend->AddEntry(hFractionPions, "#pi", "p");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hFractionPionsMC, "#pi", "p");\r
- legend->AddEntry(hFractionKaons, "K", "p");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hFractionKaonsMC, "K", "p");\r
- legend->AddEntry(hFractionProtons, "p", "p");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hFractionProtonsMC, "p", "p");\r
- legend->AddEntry(hFractionElectrons, "e", "p");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hFractionElectronsMC, "e", "p");\r
- if (takeIntoAccountMuons)\r
- legend->AddEntry(hFractionMuons, "#mu", "p");\r
- else\r
- legend->AddEntry((TObject*)0x0, "", "");\r
- if (plotIdentifiedSpectra)\r
- legend->AddEntry(hFractionMuonsMC, "#mu", "p");\r
- legend->AddEntry(hFractionSummed, "Total", "p");\r
- legend->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(cFractions);\r
- \r
-\r
- // Compare data points with MC\r
- for (Int_t i = 1; i <= hFractionComparisonPions->GetNbinsX(); i++) {\r
- hFractionComparisonPions->SetBinContent(i, hFractionPions->GetBinContent(i));\r
- hFractionComparisonPions->SetBinError(i, hFractionPions->GetBinError(i));\r
- \r
- hFractionComparisonElectrons->SetBinContent(i, hFractionElectrons->GetBinContent(i));\r
- hFractionComparisonElectrons->SetBinError(i, hFractionElectrons->GetBinError(i));\r
- \r
- if (takeIntoAccountMuons) {\r
- hFractionComparisonMuons->SetBinContent(i, hFractionMuons->GetBinContent(i));\r
- hFractionComparisonMuons->SetBinError(i, hFractionMuons->GetBinError(i));\r
- }\r
- \r
- hFractionComparisonKaons->SetBinContent(i, hFractionKaons->GetBinContent(i));\r
- hFractionComparisonKaons->SetBinError(i, hFractionKaons->GetBinError(i));\r
- \r
- hFractionComparisonProtons->SetBinContent(i, hFractionProtons->GetBinContent(i));\r
- hFractionComparisonProtons->SetBinError(i, hFractionProtons->GetBinError(i));\r
- \r
- hFractionComparisonTotal->SetBinContent(i, hFractionSummed->GetBinContent(i));\r
- hFractionComparisonTotal->SetBinError(i, hFractionSummed->GetBinError(i));\r
- }\r
- \r
- hFractionComparisonPions->Divide(hFractionPionsMC);\r
- hFractionComparisonElectrons->Divide(hFractionElectronsMC);\r
- if (takeIntoAccountMuons)\r
- hFractionComparisonMuons->Divide(hFractionMuonsMC);\r
- hFractionComparisonKaons->Divide(hFractionKaonsMC);\r
- hFractionComparisonProtons->Divide(hFractionProtonsMC);\r
- \r
- \r
- TCanvas* cFractionComparisons = new TCanvas("cFractionComparisons", "Particle fraction comparisons",100,10,1200,800);\r
- cFractionComparisons->SetGridx(1);\r
- cFractionComparisons->SetGridy(1);\r
- cFractionComparisons->SetLogx(mode == kPMpT);\r
- hFractionComparisonPions->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hFractionComparisonPions->GetXaxis(), mode, pLow, pHigh);\r
- hFractionComparisonPions->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- hFractionComparisonPions->GetXaxis()->SetNoExponent(kTRUE);\r
- hFractionComparisonPions->Draw("e p");\r
- \r
- hFractionComparisonElectrons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hFractionComparisonElectrons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionComparisonElectrons->Draw("e p same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hFractionComparisonMuons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hFractionComparisonMuons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionComparisonMuons->Draw("e p same");\r
- }\r
- \r
- hFractionComparisonKaons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hFractionComparisonKaons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionComparisonKaons->Draw("e p same");\r
- \r
- hFractionComparisonProtons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hFractionComparisonProtons->GetXaxis(), mode, pLow, pHigh);\r
- hFractionComparisonProtons->Draw("e p same");\r
- \r
- hFractionComparisonTotal->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hFractionComparisonTotal->GetXaxis(), mode, pLow, pHigh);\r
- hFractionComparisonTotal->Draw("e p same");\r
- \r
- TLegend* legend2 = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend2->SetBorderSize(0);\r
- legend2->SetFillColor(0);\r
- legend2->SetNColumns(2);\r
- legend2->AddEntry(hFractionComparisonPions, "#pi", "p");\r
- legend2->AddEntry(hFractionComparisonKaons, "K", "p");\r
- legend2->AddEntry(hFractionComparisonProtons, "p", "p");\r
- legend2->AddEntry(hFractionComparisonElectrons, "e", "p");\r
- if (takeIntoAccountMuons)\r
- legend2->AddEntry(hFractionComparisonMuons, "#mu", "p");\r
- legend2->AddEntry(hFractionComparisonTotal, "Total", "p");\r
- legend2->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(cFractionComparisons);\r
- \r
- // Normalise the yields\r
- normaliseYieldHist(hYieldPions, numEvents, deta);\r
- normaliseYieldHist(hYieldPionsMC, numEvents, deta);\r
- normaliseYieldHist(hYieldPionsDeltaElectron, numEvents, deta);\r
- normaliseYieldHist(hYieldPionsDeltaPion, numEvents, deta);\r
- normaliseYieldHist(hYieldPionsDeltaKaon, numEvents, deta);\r
- normaliseYieldHist(hYieldPionsDeltaProton, numEvents, deta);\r
- \r
- normaliseYieldHist(hYieldElectrons, numEvents, deta);\r
- normaliseYieldHist(hYieldElectronsMC, numEvents, deta);\r
- normaliseYieldHist(hYieldElectronsDeltaElectron, numEvents, deta);\r
- normaliseYieldHist(hYieldElectronsDeltaPion, numEvents, deta);\r
- normaliseYieldHist(hYieldElectronsDeltaKaon, numEvents, deta);\r
- normaliseYieldHist(hYieldElectronsDeltaProton, numEvents, deta);\r
- \r
- normaliseYieldHist(hYieldMuons, numEvents, deta);\r
- normaliseYieldHist(hYieldMuonsMC, numEvents, deta);\r
- normaliseYieldHist(hYieldMuonsDeltaElectron, numEvents, deta);\r
- normaliseYieldHist(hYieldMuonsDeltaPion, numEvents, deta);\r
- normaliseYieldHist(hYieldMuonsDeltaKaon, numEvents, deta);\r
- normaliseYieldHist(hYieldMuonsDeltaProton, numEvents, deta);\r
- \r
- normaliseYieldHist(hYieldKaons, numEvents, deta);\r
- normaliseYieldHist(hYieldKaonsMC, numEvents, deta);\r
- normaliseYieldHist(hYieldKaonsDeltaElectron, numEvents, deta);\r
- normaliseYieldHist(hYieldKaonsDeltaPion, numEvents, deta);\r
- normaliseYieldHist(hYieldKaonsDeltaKaon, numEvents, deta);\r
- normaliseYieldHist(hYieldKaonsDeltaProton, numEvents, deta);\r
- \r
- normaliseYieldHist(hYieldProtons, numEvents, deta);\r
- normaliseYieldHist(hYieldProtonsMC, numEvents, deta);\r
- normaliseYieldHist(hYieldProtonsDeltaElectron, numEvents, deta);\r
- normaliseYieldHist(hYieldProtonsDeltaPion, numEvents, deta);\r
- normaliseYieldHist(hYieldProtonsDeltaKaon, numEvents, deta);\r
- normaliseYieldHist(hYieldProtonsDeltaProton, numEvents, deta);\r
- \r
- normaliseYieldHist(hYieldSummedMC, numEvents, deta);\r
- \r
- for (Int_t i = 0; i < AliPID::kSPECIES; i++) {\r
- if (hMCgenYieldsPrimSpecies[i]) {\r
- Int_t color = kBlack;\r
- \r
- switch (i) {\r
- case AliPID::kElectron:\r
- color = getLineColor(kEl);\r
- break;\r
- case AliPID::kKaon:\r
- color = getLineColor(kKa);\r
- break;\r
- case AliPID::kMuon:\r
- color = getLineColor(kMu);\r
- break;\r
- case AliPID::kPion:\r
- color = getLineColor(kPi);\r
- break;\r
- case AliPID::kProton:\r
- color = getLineColor(kPr);\r
- break;\r
- }\r
- \r
- hMCgenYieldsPrimSpecies[i]->SetLineColor(color);\r
- hMCgenYieldsPrimSpecies[i]->SetMarkerColor(color);\r
- hMCgenYieldsPrimSpecies[i]->SetMarkerStyle(28);\r
- hMCgenYieldsPrimSpecies[i]->SetLineStyle(1);\r
- hMCgenYieldsPrimSpecies[i]->GetXaxis()->SetTitleOffset(1.0);\r
- hMCgenYieldsPrimSpecies[i]->SetStats(kFALSE);\r
- \r
- SetReasonableAxisRange(hMCgenYieldsPrimSpecies[i]->GetXaxis(), kPMpT, pLow, pHigh);\r
- normaliseGenYieldMCtruthHist(hMCgenYieldsPrimSpecies[i], numEvents, deta);\r
- }\r
- }\r
- \r
- \r
- // Compare data points with MC (yield)\r
- for (Int_t i = 1; i <= hYieldComparisonPions->GetNbinsX(); i++) {\r
- hYieldComparisonPions->SetBinContent(i, hYieldPions->GetBinContent(i));\r
- hYieldComparisonPions->SetBinError(i, hYieldPions->GetBinError(i));\r
- \r
- hYieldComparisonElectrons->SetBinContent(i, hYieldElectrons->GetBinContent(i));\r
- hYieldComparisonElectrons->SetBinError(i, hYieldElectrons->GetBinError(i));\r
- \r
- if (takeIntoAccountMuons) {\r
- hYieldComparisonMuons->SetBinContent(i, hYieldMuons->GetBinContent(i));\r
- hYieldComparisonMuons->SetBinError(i, hYieldMuons->GetBinError(i));\r
- }\r
- \r
- hYieldComparisonKaons->SetBinContent(i, hYieldKaons->GetBinContent(i));\r
- hYieldComparisonKaons->SetBinError(i, hYieldKaons->GetBinError(i));\r
- \r
- hYieldComparisonProtons->SetBinContent(i, hYieldProtons->GetBinContent(i));\r
- hYieldComparisonProtons->SetBinError(i, hYieldProtons->GetBinError(i));\r
- }\r
- \r
- hYieldComparisonPions->Divide(hYieldPionsMC);\r
- hYieldComparisonElectrons->Divide(hYieldElectronsMC);\r
- if (takeIntoAccountMuons)\r
- hYieldComparisonMuons->Divide(hYieldMuonsMC);\r
- hYieldComparisonKaons->Divide(hYieldKaonsMC);\r
- hYieldComparisonProtons->Divide(hYieldProtonsMC);\r
- \r
- \r
- TCanvas* cYieldComparisons = new TCanvas("cYieldComparisons", "Particle yield comparisons",100,10,1200,800);\r
- cYieldComparisons->SetGridx(1);\r
- cYieldComparisons->SetGridy(1);\r
- cYieldComparisons->SetLogx(mode == kPMpT);\r
- hYieldComparisonPions->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hYieldComparisonPions->GetXaxis(), mode, pLow, pHigh);\r
- hYieldComparisonPions->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- hYieldComparisonPions->GetXaxis()->SetNoExponent(kTRUE);\r
- hYieldComparisonPions->Draw("e p");\r
- \r
- hYieldComparisonElectrons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hYieldComparisonElectrons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldComparisonElectrons->Draw("e p same");\r
- \r
- if (takeIntoAccountMuons) {\r
- hYieldComparisonMuons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hYieldComparisonMuons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldComparisonMuons->Draw("e p same");\r
- }\r
- \r
- hYieldComparisonKaons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hYieldComparisonKaons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldComparisonKaons->Draw("e p same");\r
- \r
- hYieldComparisonProtons->GetYaxis()->SetRangeUser(0.0, 10.0);\r
- SetReasonableAxisRange(hYieldComparisonProtons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldComparisonProtons->Draw("e p same");\r
- \r
- TLegend* legend3 = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend3->SetBorderSize(0);\r
- legend3->SetFillColor(0);\r
- legend3->SetNColumns(2);\r
- legend3->AddEntry(hYieldComparisonPions, "#pi", "p");\r
- legend3->AddEntry(hYieldComparisonKaons, "K", "p");\r
- legend3->AddEntry(hYieldComparisonProtons, "p", "p");\r
- legend3->AddEntry(hYieldComparisonElectrons, "e", "p");\r
- if (takeIntoAccountMuons)\r
- legend3->AddEntry(hYieldComparisonMuons, "#mu", "p");\r
- legend3->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(cYieldComparisons);\r
- \r
- \r
- \r
- \r
- TCanvas* cFractionsPions = drawFractionHistos("cFractionsPions", "Pion fractions", mode, pLow, pHigh, hFractionPionsDeltaPion, \r
- hFractionPionsDeltaElectron, hFractionPionsDeltaKaon, hFractionPionsDeltaProton,\r
- hFractionPionsMC, plotIdentifiedSpectra);\r
- \r
- \r
- TCanvas* cFractionsElectrons = drawFractionHistos("cFractionsElectrons", "Electron fractions", mode, pLow, pHigh, \r
- hFractionElectronsDeltaPion, hFractionElectronsDeltaElectron,\r
- hFractionElectronsDeltaKaon, hFractionElectronsDeltaProton, hFractionElectronsMC, \r
- plotIdentifiedSpectra);\r
- \r
- TCanvas* cFractionsKaons = drawFractionHistos("cFractionsKaons", "Kaon fractions", mode, pLow, pHigh, hFractionKaonsDeltaPion, \r
- hFractionKaonsDeltaElectron, hFractionKaonsDeltaKaon, hFractionKaonsDeltaProton,\r
- hFractionKaonsMC, plotIdentifiedSpectra);\r
- \r
- TCanvas* cFractionsProtons = drawFractionHistos("cFractionsProtons", "Proton fractions", mode, pLow, pHigh, hFractionProtonsDeltaPion, \r
- hFractionProtonsDeltaElectron, hFractionProtonsDeltaKaon, hFractionProtonsDeltaProton,\r
- hFractionProtonsMC, plotIdentifiedSpectra);\r
- \r
- TCanvas* cFractionsMuons = drawFractionHistos("cFractionsMuons", "Muon fractions", mode, pLow, pHigh, hFractionMuonsDeltaPion, \r
- hFractionMuonsDeltaElectron, hFractionMuonsDeltaKaon, hFractionMuonsDeltaProton,\r
- hFractionMuonsMC, plotIdentifiedSpectra);\r
- \r
- \r
- \r
- TCanvas* cYields = new TCanvas("cYields", "Particle yields",100,10,1200,800);\r
- cYields->SetGridx(1);\r
- cYields->SetGridy(1);\r
- cYields->SetLogx(mode == kPMpT);\r
- cYields->SetLogy(1);\r
- hYieldPions->GetYaxis()->SetRangeUser(hYieldElectrons->GetBinContent(hYieldElectrons->FindLastBinAbove(0.)) / 10.,\r
- hYieldPions->GetBinContent(hYieldPions->GetMaximumBin()) * 10.);\r
- SetReasonableAxisRange(hYieldPions->GetXaxis(), mode, pLow, pHigh);\r
- hYieldPions->GetXaxis()->SetMoreLogLabels(kTRUE);\r
- hYieldPions->GetXaxis()->SetNoExponent(kTRUE);\r
- hYieldPions->Draw("e p");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hYieldPionsMC->GetXaxis(), mode, pLow, pHigh);\r
- hYieldPionsMC->Draw("e p same");\r
- }\r
- \r
- SetReasonableAxisRange(hYieldKaons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldKaons->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hYieldKaonsMC->GetXaxis(), mode, pLow, pHigh);\r
- hYieldKaonsMC->Draw("e p same");\r
- }\r
- \r
- SetReasonableAxisRange(hYieldProtons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldProtons->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hYieldProtonsMC->GetXaxis(), mode, pLow, pHigh);\r
- hYieldProtonsMC->Draw("e p same");\r
- }\r
- \r
- if (takeIntoAccountMuons) {\r
- SetReasonableAxisRange(hYieldMuons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldMuons->Draw("e p same");\r
- if (plotIdentifiedSpectra) { \r
- SetReasonableAxisRange(hYieldMuonsMC->GetXaxis(), mode, pLow, pHigh);\r
- hYieldMuonsMC->Draw("e p same");\r
- }\r
- }\r
- \r
- SetReasonableAxisRange(hYieldElectrons->GetXaxis(), mode, pLow, pHigh);\r
- hYieldElectrons->Draw("e p same");\r
- if (plotIdentifiedSpectra) {\r
- SetReasonableAxisRange(hYieldElectronsMC->GetXaxis(), mode, pLow, pHigh);\r
- hYieldElectronsMC->Draw("e p same");\r
- }\r
- \r
- TLegend* legendYields = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legendYields->SetBorderSize(0);\r
- legendYields->SetFillColor(0);\r
- if (plotIdentifiedSpectra)\r
- legendYields->SetNColumns(2);\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry((TObject*)0x0, "Fit", "");\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry((TObject*)0x0, identifiedLabels[isMC].Data(), "");\r
- legendYields->AddEntry(hYieldPions, "#pi", "p");\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry(hYieldPionsMC, "#pi", "p");\r
- legendYields->AddEntry(hYieldKaons, "K", "p");\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry(hYieldKaonsMC, "K", "p");\r
- legendYields->AddEntry(hYieldProtons, "p", "p");\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry(hYieldProtonsMC, "p", "p");\r
- legendYields->AddEntry(hYieldElectrons, "e", "p");\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry(hYieldElectronsMC, "e", "p");\r
- if (takeIntoAccountMuons)\r
- legendYields->AddEntry(hYieldMuons, "#mu", "p");\r
- else\r
- legendYields->AddEntry((TObject*)0x0, "", "");\r
- if (plotIdentifiedSpectra)\r
- legendYields->AddEntry(hYieldMuonsMC, "#mu", "p");\r
- legendYields->Draw();\r
- \r
- ClearTitleFromHistoInCanvas(cYields);\r
- \r
- \r
- TCanvas* cYieldsPions = drawYieldHistos("cYieldsPions", "Pion yields", mode, pLow, pHigh, hYieldPionsDeltaPion, hYieldPionsDeltaElectron,\r
- hYieldPionsDeltaKaon, hYieldPionsDeltaProton, hYieldPionsMC, plotIdentifiedSpectra);\r
- \r
- \r
- TCanvas* cYieldsElectrons = drawYieldHistos("cYieldsElectrons", "Electron yields", mode, pLow, pHigh, hYieldElectronsDeltaPion,\r
- hYieldElectronsDeltaElectron, hYieldElectronsDeltaKaon, hYieldElectronsDeltaProton, hYieldElectronsMC,\r
- plotIdentifiedSpectra);\r
- \r
- TCanvas* cYieldsKaons = drawYieldHistos("cYieldsKaons", "Kaon yields", mode, pLow, pHigh, hYieldKaonsDeltaPion, hYieldKaonsDeltaElectron,\r
- hYieldKaonsDeltaKaon, hYieldKaonsDeltaProton, hYieldKaonsMC, plotIdentifiedSpectra);\r
- \r
- TCanvas* cYieldsProtons = drawYieldHistos("cYieldsProtons", "Proton yields", mode, pLow, pHigh, hYieldProtonsDeltaPion, hYieldProtonsDeltaElectron,\r
- hYieldProtonsDeltaKaon, hYieldProtonsDeltaProton, hYieldProtonsMC, plotIdentifiedSpectra);\r
- \r
- TCanvas* cYieldsMuons = drawYieldHistos("cYieldsMuons", "Muon yields", mode, pLow, pHigh, hYieldMuonsDeltaPion, hYieldMuonsDeltaElectron,\r
- hYieldMuonsDeltaKaon, hYieldMuonsDeltaProton, hYieldMuonsMC, plotIdentifiedSpectra);\r
- \r
- \r
- // Save final results\r
- saveF->cd();\r
- \r
- if (fElectronFraction)\r
- fElectronFraction->Write();\r
- \r
- if (hFractionElectrons)\r
- hFractionElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaons)\r
- hFractionKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPions)\r
- hFractionPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtons)\r
- hFractionProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuons)\r
- hFractionMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionSummed)\r
- hFractionSummed->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaElectron)\r
- hFractionElectronsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaElectron)\r
- hFractionKaonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaElectron)\r
- hFractionPionsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaElectron)\r
- hFractionProtonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaElectron)\r
- hFractionMuonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaPion)\r
- hFractionElectronsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaPion)\r
- hFractionKaonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaPion)\r
- hFractionPionsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaPion)\r
- hFractionProtonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaPion)\r
- hFractionMuonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaKaon)\r
- hFractionElectronsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaKaon)\r
- hFractionKaonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaKaon)\r
- hFractionPionsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaKaon)\r
- hFractionProtonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaKaon)\r
- hFractionMuonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionElectronsDeltaProton)\r
- hFractionElectronsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsDeltaProton)\r
- hFractionKaonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsDeltaProton)\r
- hFractionPionsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsDeltaProton)\r
- hFractionProtonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsDeltaProton)\r
- hFractionMuonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hNumEvents)\r
- hNumEvents->Write();\r
- \r
- if (cFractions)\r
- cFractions->Write();\r
- if (cFractionsPions)\r
- cFractionsPions->Write();\r
- if (cFractionsElectrons)\r
- cFractionsElectrons->Write();\r
- if (cFractionsKaons)\r
- cFractionsKaons->Write();\r
- if (cFractionsProtons)\r
- cFractionsProtons->Write();\r
- if (cFractionsMuons)\r
- cFractionsMuons->Write();\r
- \r
- \r
- if (hFractionElectronsMC)\r
- hFractionElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionKaonsMC)\r
- hFractionKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionPionsMC)\r
- hFractionPionsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionMuonsMC)\r
- hFractionMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionProtonsMC)\r
- hFractionProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hFractionComparisonElectrons)\r
- hFractionComparisonElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionComparisonMuons)\r
- hFractionComparisonMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionComparisonKaons)\r
- hFractionComparisonKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionComparisonPions)\r
- hFractionComparisonPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionComparisonProtons)\r
- hFractionComparisonProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hFractionComparisonTotal)\r
- hFractionComparisonTotal->Write(0, TObject::kWriteDelete);\r
- \r
- if (cFractionComparisons)\r
- cFractionComparisons->Write();\r
- \r
- \r
- if (hYieldComparisonElectrons)\r
- hYieldComparisonElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldComparisonMuons)\r
- hYieldComparisonMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldComparisonKaons)\r
- hYieldComparisonKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldComparisonPions)\r
- hYieldComparisonPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldComparisonProtons)\r
- hYieldComparisonProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (cYieldComparisons)\r
- cYieldComparisons->Write();\r
- \r
- \r
- if (hYieldElectrons)\r
- hYieldElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaons)\r
- hYieldKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPions)\r
- hYieldPions->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtons)\r
- hYieldProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuons)\r
- hYieldMuons->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaElectron)\r
- hYieldElectronsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaElectron)\r
- hYieldKaonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaElectron)\r
- hYieldPionsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaElectron)\r
- hYieldProtonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaElectron)\r
- hYieldMuonsDeltaElectron->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaPion)\r
- hYieldElectronsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaPion)\r
- hYieldKaonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaPion)\r
- hYieldPionsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaPion)\r
- hYieldProtonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaPion)\r
- hYieldMuonsDeltaPion->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaKaon)\r
- hYieldElectronsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaKaon)\r
- hYieldKaonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaKaon)\r
- hYieldPionsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaKaon)\r
- hYieldProtonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaKaon)\r
- hYieldMuonsDeltaKaon->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsDeltaProton)\r
- hYieldElectronsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsDeltaProton)\r
- hYieldKaonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsDeltaProton)\r
- hYieldPionsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsDeltaProton)\r
- hYieldProtonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsDeltaProton)\r
- hYieldMuonsDeltaProton->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hYieldElectronsMC)\r
- hYieldElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldKaonsMC)\r
- hYieldKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldPionsMC)\r
- hYieldPionsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldMuonsMC)\r
- hYieldMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldProtonsMC)\r
- hYieldProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hYieldSummedMC)\r
- hYieldSummedMC->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- if (hRatioToPiElectrons)\r
- hRatioToPiElectrons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiMuons)\r
- hRatioToPiMuons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiKaons)\r
- hRatioToPiKaons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiProtons)\r
- hRatioToPiProtons->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiElectronsMC)\r
- hRatioToPiElectronsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiMuonsMC)\r
- hRatioToPiMuonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiKaonsMC)\r
- hRatioToPiKaonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- if (hRatioToPiProtonsMC)\r
- hRatioToPiProtonsMC->Write(0, TObject::kWriteDelete);\r
- \r
- \r
- \r
- if (hReducedChiSquarePt)\r
- hReducedChiSquarePt->Write(0, TObject::kWriteDelete);\r
- \r
- if (cYields)\r
- cYields->Write();\r
- if (cYieldsPions)\r
- cYieldsPions->Write();\r
- if (cYieldsElectrons)\r
- cYieldsElectrons->Write();\r
- if (cYieldsKaons)\r
- cYieldsKaons->Write();\r
- if (cYieldsProtons)\r
- cYieldsProtons->Write();\r
- if (cYieldsMuons)\r
- cYieldsMuons->Write();\r
- \r
- for (Int_t i = 0; i < AliPID::kSPECIES; i++) {\r
- if (hMCgenYieldsPrimSpecies[i])\r
- hMCgenYieldsPrimSpecies[i]->Write();\r
- }\r
- \r
- if (filePathNameResults)\r
- *filePathNameResults = saveFName;\r
- \r
- if (TMath::Abs(mathFit->GetScaleFactorError() - 1.) > 1e-6) {\r
- // If the deltaPrime range is large enough, we artificially get a factor 4 in statistics by looking at the four\r
- // different deltaPrimeSpecies, which have (except for binning effects) the same information. \r
- // Therefore, to get the "real" statistical error, we need to multiply the obtained error by sqrt(4) = 2\r
- std::cout << "NOTE: Errors multiplied by " << mathFit->GetScaleFactorError() \r
- << " to take into account artificially higher statistics (by factor of 4) due to same information "\r
- << "for all deltaPrimeSpecies (except for binning effects), if deltaPrimeRange sufficiently large!" << std::endl\r
- << std::endl;\r
- }\r
- \r
- if (fitMethod < 2) {\r
- std::cout << "WARNING: Errors might be wrong! Especially, for the to-pi ratios there are no correlations taken into account!"\r
- << std::endl;\r
- }\r
- \r
- delete gFractionElectronsData;\r
- delete fElectronFraction;\r
- \r
- delete mathFit;\r
- \r
- delete cFractions;\r
- delete cFractionComparisons;\r
- delete cYieldComparisons;\r
- delete cFractionsPions;\r
- delete cFractionsElectrons;\r
- delete cFractionsKaons;\r
- delete cFractionsProtons;\r
- delete cFractionsMuons;\r
- delete cYields;\r
- delete cYieldsPions;\r
- delete cYieldsKaons;\r
- delete cYieldsMuons;\r
- delete cYieldsProtons;\r
- delete cYieldsElectrons;\r
- \r
- saveF->Close();\r
-\r
- return 0; \r
-}\r
+#include "THnSparse.h"
+#include "TH2D.h"
+#include "TH1D.h"
+#include "TProfile.h"
+#include "TF1.h"
+#include "TFitResultPtr.h"
+#include "TFitResult.h"
+#include "TCanvas.h"
+#include "TStyle.h"
+#include "TVirtualFitter.h"
+#include "TObjArray.h"
+#include "TString.h"
+#include "TLegend.h"
+#include "TFile.h"
+#include "TGraphErrors.h"
+#include "TGraph.h"
+#include "TMath.h"
+#include "TMatrixDSym.h"
+#include "TRandom3.h"
+#include "TROOT.h"
+
+#include <iostream>
+#include <iomanip>
+
+#include "AliPID.h"
+
+#include "THnSparseDefinitions.h"
+#include "AliTPCPIDmathFit.h"
+
+enum processMode { kPMpT = 0, kPMz = 1, kPMxi = 2 };
+enum muonTreatment { kNoMuons = 0, kMuonFracEqualElFrac = 1, kMuonFracOverElFracTunedOnMCStandardTrackCuts = 2,
+ kMuonFracOverElFracTunedOnMCHybridTrackCuts = 3, kMuonFracOverElFracTunedOnMCHybridTrackCutsJets = 4,
+ kMuonFracOverElFracTunedOnMCStandardTrackCutsPPb = 5,
+ kNumHandlings = 6 };
+
+const TString modeShortName[3] = { "Pt", "Z", "Xi" };
+const TString modeLatexName[3] = { "P_{T}", "z", "#xi" };
+
+const TString muonFractionHandlingShortName[kNumHandlings] =
+ { "noMuons", "muonsEqualElectrons", "muonToElTunedOnMCStandardTrackCuts", "muonToElTunedOnMCHybridTrackCuts",
+ "muonToElTunedOnMCHybridTrackCutsJets", "muonToElTunedOnMCStandardTrackCutsPPB" };
+
+const Double_t epsilon = 1e-10;
+const TString identifiedLabels[2] = { "Most Probable PID", "MC" };
+Int_t isMC = 0;
+
+TString minimisationStrategy = "MIGRAD"; // "MINIMIZE"
+Bool_t takeIntoAccountMuons = kTRUE;
+
+// 0 = no muons, 1 = muonFrac=elFrac, 2(3) = muonFrac/elFrac tuned on MC for DefaultTrackCuts (hybridTrackCuts),
+// 4 = muonFrac/elFrac tuned on MC for hybridTrackCuts for jet particles,
+Int_t muonFractionHandling = 3;
+
+
+//TODO getErrorOf.... is COMPLETELY wrong now, since the parameter numbering has changed and the muons had come into play!!!!!!
+
+// TODO CAREFUL: fitMethod == 1 adds errors of electrons to pions, but not to muons (should be added to electron error instead!)
+const Bool_t muonContamination = kFALSE;//TODO CAREFUL: fitMethod == 1 takes into account the muon contamination in the error calculation!!!
+
+const Bool_t normaliseResults = kTRUE; // Works only for fitMethod == 2
+
+const Bool_t enableShift = kFALSE;
+const Int_t dataAxis = kPidDeltaPrime;//kPidDelta; kPidDeltaPrime
+
+const Int_t numSimultaneousFits = 4;
+
+// Upper and lower axis bounds (y-axis) of (data - fit) / data QA histos
+const Double_t fitQAaxisLowBound = -0.5;
+const Double_t fitQAaxisUpBound = 0.5;
+
+Bool_t useDeltaPrime = (dataAxis == kPidDeltaPrime);
+
+// Will be set later
+Double_t muonFractionThresholdForFitting = -1.;
+Double_t muonFractionThresholdBinForFitting = -1;
+
+Double_t electronFractionThresholdForFitting = -1.;
+Double_t electronFractionThresholdBinForFitting = -1;
+
+
+TF1 fMuonOverElFractionMC("fMuonOverElFractionMC", "[0]+[1]/TMath::Min(x, [4])+[2]*TMath::Min(x, [4])+[3]*TMath::Min(x, [4])*TMath::Min(x, [4])+[5]*TMath::Min(x, [4])*TMath::Min(x, [4])*TMath::Min(x, [4])+[6]*(x>[7])*TMath::Min(x-[7], [8]-[7])",
+ 0.01, 50.);
+
+TF1* fElectronFraction = 0x0;
+const Double_t lowFittingBoundElectronFraction = 3.0;
+
+TGraphErrors* gFractionElectronsData = 0x0;
+Double_t lastPtForCallOfGetElectronFraction = -1;
+
+
+//____________________________________________________________________________________________________________________
+Double_t GetElectronFraction(const Double_t pT, const Double_t *par)
+{
+ // During the fit (both, simultaneous and non-simultaneous), the algorithm will always start off from
+ // the low pT and go to higher pT. So, it is only necessary to do the fit once the first fixed bin is reached.
+ // Then the parameters for the electron fraction remain fixed until the next fit iteration.
+ // Since only for the case of regularisation the electron fractions of all x bins are stored in mathFit,
+ // the evaluation of this function is done here only in that case (only then the electron fraction will
+ // be set to "-pT".
+
+ // NOTE 1: Electrons have index 3 per x bin
+ // NOTE 2: This function is only called for fitting vs. pT. In that case, xValue holds the LOG of pT!
+
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ // lastPtForCallOfGetElectronFraction will be initialised with a value larger than any pT during the fit.
+ // So, if this function is called and the pT is smaller than lastPtForCallOfGetElectronFraction, the parameters
+ // must have changed and the electron fit needs to be re-done (also see comment above)
+ if (pT < lastPtForCallOfGetElectronFraction) {
+ for (Int_t xBin = 0; xBin < mathFit->GetNumXbinsRegularisation(); xBin++) {
+
+ const Double_t xCoord = TMath::Exp(mathFit->GetXvaluesForRegularisation()[xBin]);
+ const Int_t parIndexWithFraction = 3 + xBin * mathFit->GetNumParametersPerXbin();
+
+ if (xCoord >= lowFittingBoundElectronFraction && xCoord <= electronFractionThresholdForFitting
+ && par[parIndexWithFraction] > epsilon) { // Skip zero values (usually due to failed fits)
+ gFractionElectronsData->SetPoint(xBin, TMath::Exp(mathFit->GetXvaluesForRegularisation()[xBin]), par[parIndexWithFraction]);
+ // Since the errors during the fitting are not reliable, use the following approximation on a statistical basis
+ // (which indeed turns out to be rather good!)
+
+ // Bin effective weight required for weighted data sets. In case of no weighting, the weight error is sqrt(weight),
+ // i.e. effWeight is 1
+ const Double_t effWeight = mathFit->GetXstatisticalWeightError()[xBin] * mathFit->GetXstatisticalWeightError()[xBin]
+ / mathFit->GetXstatisticalWeight()[xBin];
+ gFractionElectronsData->SetPointError(xBin, 0, effWeight * TMath::Sqrt(par[parIndexWithFraction]
+ / mathFit->GetXstatisticalWeight()[xBin]));
+ }
+ else {
+ gFractionElectronsData->SetPoint(xBin, -1, 0);
+ gFractionElectronsData->SetPointError(xBin, 0, 0);
+ }
+ }
+
+ gFractionElectronsData->Fit(fElectronFraction, "Ex0NQ", "", lowFittingBoundElectronFraction, electronFractionThresholdForFitting);
+ }
+
+ lastPtForCallOfGetElectronFraction = pT;
+
+ // Catch cases in which the fit function yields invalid fractions (i.e. < 0 or > 1)
+ return TMath::Max(0.0, TMath::Min(1.0, fElectronFraction->Eval(pT)));
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t GetElectronFractionError()
+{
+ // This function estimates the error of the electron fraction for the fixed values via using the parameter errors of
+ // the electron fraction function. Note that the parameters (and errors) must be set before calling this function.
+
+ // Produce several values via setting the parameters to a random value, which is distributed with a gaussian with mean = parValue
+ // and sigma = parError and then take the 2*RMS as the error
+ const Int_t nGenValues = 1000;
+ Double_t genValues[nGenValues];
+
+ const Int_t nPars = fElectronFraction->GetNpar();
+ Double_t par[nPars];
+
+ TRandom3 rnd(0); // 0 means random seed
+
+ const Double_t x = electronFractionThresholdForFitting + 1.; // Some value above the threshold to obtain a fixed value
+ for (Int_t i = 0 ; i < nGenValues; i++) {
+ for (Int_t iPar = 0; iPar < nPars; iPar++)
+ par[iPar] = rnd.Gaus(fElectronFraction->GetParameter(iPar), fElectronFraction->GetParError(iPar));
+
+ genValues[i] = fElectronFraction->EvalPar(&x, &par[0]);
+ }
+
+ // NOTE: RMS is not really the root mean square, is it rather the sigma deviation, which is what is wanted here
+ return 2. * TMath::RMS(nGenValues, &genValues[0]);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t GetMuonFractionFromElectronFractionAndPt(Double_t pT, Double_t elFrac)
+{
+ if (muonFractionHandling == kMuonFracOverElFracTunedOnMCStandardTrackCuts) {
+// return elFrac / (1. + 7.06909e+01 * TMath::Exp(-2.95078e+00 * TMath::Power(pT, 5.05016e-01)));
+ return elFrac / (1. + 2.01840e+10 * TMath::Exp(-2.50480e+01 * TMath::Power(pT, 5.89044e-02)));
+ }
+ else if (muonFractionHandling == kMuonFracOverElFracTunedOnMCHybridTrackCuts) {
+ fMuonOverElFractionMC.SetParameters(-6.87241e-01, 4.19528e-02, 4.52095e+00, -6.20026e+00, 5.16629e-01, 2.88604e+00, 3.68058e-02,
+ 2.21086e+00, 5.75003e+00);
+ return elFrac * fMuonOverElFractionMC.Eval(pT);
+ }
+ else if (muonFractionHandling == kMuonFracOverElFracTunedOnMCHybridTrackCutsJets) {
+ fMuonOverElFractionMC.SetParameters(-7.64548e-01, 2.47929e-02, 4.49057e+00, -2.06320e-01, 4.23339e-02, 1.19697e+02, 1.28832e-01,
+ -1.71895e-01, 6.00000e+00);
+ return elFrac * fMuonOverElFractionMC.Eval(pT);
+ }
+ else if (muonFractionHandling == kMuonFracOverElFracTunedOnMCStandardTrackCutsPPb) {
+ // WITH PID cluster cut!
+ fMuonOverElFractionMC.SetParameters(-6.62149e-01, 4.89591e-02, 4.58356e+00, -6.04319e+00, 6.25368e-01, 3.27191e+00, 1.69933e-01,
+ 1.00004e+00, 2.61438e+00);
+ return elFrac * fMuonOverElFractionMC.Eval(pT);
+ }
+ else if (muonFractionHandling == kMuonFracEqualElFrac) {
+ return elFrac;
+ }
+
+ return 0.;
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t GetCorrelatedError(const Double_t x, const Double_t y, const Double_t cov00, const Double_t cov11, const Double_t cov01)
+{
+ // Calculate the correlated error df of f:
+ // (cov00 cov01) (x)
+ //df^2 = (x, y) * (cov01 cov11) (y) = x^2 * cov00 + y^2 * cov11 + 2 * x * y * cov01
+ //
+ // with f = f(p1, p2) = p1 / p2
+ // and (x, y) = (\partial f / \partial p1, \partial f / \partial p2)
+ // = (f / p1, -f / p2)
+
+ const Double_t df2 = x * x * cov00 + y * y * cov11 + 2. * x * y * cov01;
+
+ if (df2 < epsilon)
+ return 0.;
+
+ return TMath::Sqrt(df2);
+}
+
+
+//____________________________________________________________________________________________________________________
+void GetRatioWithCorrelatedError(const Double_t fractionA, const Double_t fractionB,
+ const Double_t fractionErrorA, const Double_t fractionErrorB,
+ const Double_t covMatrixElementAB, Double_t& ratio, Double_t& ratioError)
+{
+ // Given fractions A and B with corresponding errors and the off-diagonal covariance matrix element of
+ // these fractions, calculate the ratio A/B and the error taking into account the correlation.
+ // The results are stored in ratio and ratioError.
+
+ if (fractionB < epsilon) {
+ ratio = -999.;
+ ratioError = 999.;
+
+ return;
+ }
+
+ if (fractionA < epsilon) {
+ ratio = 0.;
+ ratioError = 999.;
+
+ return;
+ }
+
+ ratio = fractionA / fractionB;
+
+ const Double_t x = ratio / fractionA;
+ const Double_t y = -ratio / fractionB;
+
+ // covMatrixElement(i, i) = error(i)^2
+ ratioError = GetCorrelatedError(x, y, fractionErrorA * fractionErrorA, fractionErrorB * fractionErrorB, covMatrixElementAB);
+
+ //printf("frationA %e\nfractionB %e\nfractionErrorA %e\nfractionErrorB %e\ncovMatrixElementAB %e\nratio %e\nx %e\ny %e\nratioError %e\n\n",
+ // fractionA, fractionB, fractionErrorA, fractionErrorB, covMatrixElementAB, ratio, x, y, ratioError);
+}
+
+
+//____________________________________________________________________________________________________________________
+void SetReasonableAxisRange(TAxis* axis, Int_t mode, Double_t pLow = -1, Double_t pHigh = -1)
+{
+ if (mode == kPMpT)
+ axis->SetRangeUser(TMath::Max(0.15, pLow - 0.1), TMath::Min(50., pHigh + 0.1));
+ else if (mode == kPMz)
+ axis->SetRange(0, -1);
+ else if (mode == kPMxi)
+ axis->SetRange(0, -1);
+}
+
+//____________________________________________________________________________________________________________________
+void SetReasonableXaxisRange(TH1* h, Int_t& binLow, Int_t& binHigh)
+{
+ binLow = TMath::Max(1, h->FindFirstBinAbove(0));
+ binHigh = TMath::Min(h->GetNbinsX(), h->FindLastBinAbove(0));
+
+ h->GetXaxis()->SetRange(binLow, binHigh);
+ h->GetXaxis()->SetMoreLogLabels(kTRUE);
+ h->GetXaxis()->SetNoExponent(kTRUE);
+}
+
+
+//____________________________________________________________________________________________________________________
+Int_t FindMomentumBin(const Double_t* pTbins, const Double_t value, const Int_t numPtBins = nPtBins)
+{
+ for (Int_t bin = 0; bin < numPtBins; bin++) {
+ if (value >= pTbins[bin] && value < pTbins[bin + 1])
+ return bin;
+ }
+
+ return -1;
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t normaliseHist(TH1* h, Double_t scaleFactor = -1)
+{
+ // Scales the histogram with the scale factor. If the scale factor is < 0,
+ // the histogram is normalised to it's integral.
+ // In both cases, the normalisation factor is returned.
+
+ Double_t normFactor = 1.;
+
+ if (scaleFactor < 0) {
+ Double_t integralTemp = h->Integral();
+ if (integralTemp > 0) {
+ normFactor = 1.0 / integralTemp;
+ h->Scale(normFactor);
+ }
+ }
+ else {
+ normFactor = scaleFactor;
+ h->Scale(normFactor);
+ }
+
+ h->GetXaxis()->SetTitleOffset(1.0);
+
+ return normFactor;
+}
+
+
+//____________________________________________________________________________________________________________________
+void normaliseYieldHist(TH1* h, Double_t numEvents, Double_t deta)
+{
+ // Yield histos are already normalised to dpT. Now normalise to 1/NeV 1/(2pi pT) 1/deta in addition
+
+ if (numEvents <= 0) // Do not normalise
+ numEvents = 1;
+
+ for (Int_t bin = 1; bin <= h->GetNbinsX(); bin++) {
+ Double_t normFactor = 1. / (numEvents * 2 * TMath::Pi() * h->GetXaxis()->GetBinCenter(bin) * deta);
+ h->SetBinContent(bin, h->GetBinContent(bin) * normFactor);
+ h->SetBinError(bin, h->GetBinError(bin) * normFactor);
+ }
+}
+
+
+//____________________________________________________________________________________________________________________
+void normaliseGenYieldMCtruthHist(TH1* h, Double_t numEvents, Double_t deta)
+{
+ // Yield histos are NOT normalised to dpT. Now normalise to 1/NeV 1/(2pi pT) 1/deta 1/dpT!
+
+ if (numEvents <= 0) // Do not normalise
+ numEvents = 1;
+
+ for (Int_t bin = 1; bin <= h->GetNbinsX(); bin++) {
+ Double_t normFactor = 1. / (numEvents * 2 * TMath::Pi() * h->GetXaxis()->GetBinCenter(bin) * h->GetXaxis()->GetBinWidth(bin) * deta);
+ h->SetBinContent(bin, h->GetBinContent(bin) * normFactor);
+ h->SetBinError(bin, h->GetBinError(bin) * normFactor);
+ }
+}
+
+
+//____________________________________________________________________________________________________________________
+void setUpFitFunction(TF1* fitFunc, Int_t nBins, Bool_t noShift = kFALSE)
+{
+ fitFunc->SetLineColor(kGray + 1);
+ fitFunc->SetLineWidth(2);
+ fitFunc->SetLineStyle(1);
+ fitFunc->SetNpx(nBins * 100);
+ fitFunc->SetParName(0, "Pion fraction");
+ fitFunc->SetParName(1, "Kaon fraction");
+ fitFunc->SetParName(2, "Proton fraction");
+ fitFunc->SetParName(3, "Electron fraction");
+ fitFunc->SetParName(4, "Muon fraction");
+ fitFunc->SetParName(5, "Total yield");
+ if (noShift == kFALSE) {
+ fitFunc->SetParName(6, "Shift of pion peak");
+ fitFunc->SetParName(7, "Shift of kaon peak");
+ fitFunc->SetParName(8, "Shift of proton peak");
+ fitFunc->SetParName(9, "Shift of electron peak");
+ fitFunc->SetParName(10, "Shift of muon peak");
+ }
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Int_t findBinWithinRange(const TAxis* axis, Double_t value)
+{
+ Int_t bin = axis->FindFixBin(value);
+ if (bin <= 0)
+ bin = 1;
+ if (bin > axis->GetNbins())
+ bin = axis->GetNbins();
+
+ return bin;
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t linearInterpolation(const TH1* h, Double_t x, Double_t scaleFactor, Double_t shift, Double_t* error)
+{
+ // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters.
+ // The shift also introduces some uncertainty, which is rather hard to estimate. Therefore, just take the maximum error of the involved bins.
+ const Double_t xShifted = x - shift;
+
+ // Just take value of bin, if beyond center of first/last bin
+ if (xShifted <= h->GetBinCenter(1)) {
+ if (error)
+ *error = h->GetBinError(1) * scaleFactor;
+ return h->GetBinContent(1) * scaleFactor;
+ }
+ else if(xShifted >= h->GetBinCenter(h->GetNbinsX())) {
+ if (error)
+ *error = h->GetBinError(h->GetNbinsX()) * scaleFactor;
+ return h->GetBinContent(h->GetNbinsX()) * scaleFactor;
+ }
+ else {
+ const Int_t xbin = h->FindFixBin(xShifted);
+ Double_t x0, x1, y0, y1;
+
+ if(xShifted <= h->GetBinCenter(xbin)) {
+ y0 = h->GetBinContent(xbin - 1);
+ x0 = h->GetBinCenter(xbin - 1);
+ y1 = h->GetBinContent(xbin);
+ x1 = h->GetBinCenter(xbin);
+
+ if (error)
+ *error = TMath::Max(h->GetBinError(xbin - 1), h->GetBinError(xbin)) * scaleFactor;
+ }
+ else {
+ y0 = h->GetBinContent(xbin);
+ x0 = h->GetBinCenter(xbin);
+ y1 = h->GetBinContent(xbin + 1);
+ x1 = h->GetBinCenter(xbin + 1);
+
+ if (error)
+ *error = TMath::Max(h->GetBinError(xbin), h->GetBinError(xbin + 1)) * scaleFactor;
+ }
+
+ return scaleFactor * (y0 + (xShifted - x0) * ((y1 - y0) / (x1 - x0)));
+ }
+
+ return 0;
+
+ /*Old version available for code bevor 03.05.2013*/
+}
+
+
+//____________________________________________________________________________________________________________________
+void shiftHist(TH1D* h, Double_t shift, Bool_t useRegularisation = kFALSE)
+{
+ // Shift not available for regularisation. Just for convenience (can use the same code and only set one flag)
+ // call this functions and then do nothing.
+ // Actually, the shift is not availabe for simultaneous fitting also, but the parameter is just set to 0 there
+ if (!h || useRegularisation)
+ return;
+
+ TString name = h->GetName();
+ TH1D* hTemp = (TH1D*)h->Clone(Form("%s_clone", name.Data()));
+ h->Reset();
+
+ Double_t error = 0;
+ for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
+ // linearInterpolation with scaleFactor = 1.0, since histo is assumed to be properly scaled
+ h->SetBinContent(i, linearInterpolation(hTemp, h->GetXaxis()->GetBinCenter(i), 1.0, shift, &error));
+ h->SetBinError(i, error);
+ }
+
+ delete hTemp;
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t multiGaussFitForSimultaneousFitting(const Double_t *xx, const Double_t *par, const Int_t offset)
+{
+ // Offset for reference histos for delta_Species
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ // parXbinIndex (fixed) will be used my mathfit to hold the pT bin index (needed for regularisation)
+ const Int_t xBinIndex = mathFit->GetXbinIndex();
+ const Int_t numParsPerXbin = mathFit->GetNumParametersPerXbin();
+
+ const Int_t numRefHistosPerFit = numSimultaneousFits + (takeIntoAccountMuons ? 1 : 0);
+ const Int_t numRefHistosPerXbin = numRefHistosPerFit * numSimultaneousFits;
+
+ const Int_t refHistOffset = offset * numRefHistosPerFit + xBinIndex * numRefHistosPerXbin;
+
+ const TH1* hRefPi = mathFit->GetRefHisto(0 + refHistOffset);
+ const TH1* hRefKa = mathFit->GetRefHisto(1 + refHistOffset);
+ const TH1* hRefPr = mathFit->GetRefHisto(2 + refHistOffset);
+ const TH1* hRefEl = mathFit->GetRefHisto(3 + refHistOffset);
+ const TH1* hRefMu = takeIntoAccountMuons ? mathFit->GetRefHisto(4 + refHistOffset) : 0x0;
+
+ if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)
+ return 0;
+
+ if (takeIntoAccountMuons && !hRefMu)
+ return 0;
+
+ const Int_t parOffset = xBinIndex * numParsPerXbin;
+ const Int_t parPi = 0 + parOffset;
+ const Int_t parKa = 1 + parOffset;
+ const Int_t parPr = 2 + parOffset;
+ const Int_t parEl = 3 + parOffset;
+ const Int_t parMu = 4 + parOffset;
+ const Int_t parAll = 5 + parOffset;
+
+ const Double_t scaleFactorPi = par[parAll] * (par[parPi] + (muonContamination ? par[parEl] : 0));
+ const Double_t scaleFactorKa = par[parAll] * par[parKa];
+ const Double_t scaleFactorPr = par[parAll] * par[parPr];
+ const Double_t parElFraction = (par[parEl] < 0) ? GetElectronFraction(-par[parEl], par) : par[parEl];
+ const Double_t scaleFactorEl = par[parAll] * parElFraction;
+ // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0
+ const Double_t scaleFactorMu = (par[parMu] < 0)
+ ? (par[parAll] * GetMuonFractionFromElectronFractionAndPt(-par[parMu], parElFraction))
+ : (par[parAll] * par[parMu]);
+
+ // Since one is looking at the same deltaSpecies for all considered species, the reference histograms have the same axes
+ // => Only need to search for the bin once
+ const Int_t binWithinRange = findBinWithinRange(hRefPi->GetXaxis(), xx[0]);
+ const Double_t countPi = scaleFactorPi * hRefPi->GetBinContent(binWithinRange);
+ const Double_t countKa = scaleFactorKa * hRefKa->GetBinContent(binWithinRange);
+ const Double_t countPr = scaleFactorPr * hRefPr->GetBinContent(binWithinRange);
+ const Double_t countEl = scaleFactorEl * hRefEl->GetBinContent(binWithinRange);
+ const Double_t countMu = takeIntoAccountMuons ? scaleFactorMu * hRefMu->GetBinContent(binWithinRange) : 0;
+
+ const Double_t res = countPi + countKa + countPr + countEl + countMu;
+
+
+ return res;
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Double_t multiGaussFitDeltaPi(const Double_t *xx, const Double_t *par)
+{
+ return multiGaussFitForSimultaneousFitting(xx, par, 0);
+}
+
+//____________________________________________________________________________________________________________________
+inline Double_t multiGaussFitDeltaKa(const Double_t *xx, const Double_t *par)
+{
+ return multiGaussFitForSimultaneousFitting(xx, par, 1);
+}
+
+//____________________________________________________________________________________________________________________
+inline Double_t multiGaussFitDeltaPr(const Double_t *xx, const Double_t *par)
+{
+ return multiGaussFitForSimultaneousFitting(xx, par, 2);
+}
+
+//____________________________________________________________________________________________________________________
+inline Double_t multiGaussFitDeltaEl(const Double_t *xx, const Double_t *par)
+{
+ return multiGaussFitForSimultaneousFitting(xx, par, 3);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t multiGaussFit(const Double_t *xx, const Double_t *par)
+{
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+ const TH1* hRefPi = mathFit->GetRefHisto(0);
+ const TH1* hRefKa = mathFit->GetRefHisto(1);
+ const TH1* hRefPr = mathFit->GetRefHisto(2);
+ const TH1* hRefEl = mathFit->GetRefHisto(3);
+ const TH1* hRefMu = takeIntoAccountMuons ? mathFit->GetRefHisto(4) : 0x0;
+
+ if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)
+ return 0;
+
+ if (takeIntoAccountMuons && !hRefMu)
+ return 0;
+
+ // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters
+ const Double_t scaleFactorPi = par[5] * (par[0] + (muonContamination ? par[3] : 0));
+ const Double_t scaleFactorKa = par[5] * par[1];
+ const Double_t scaleFactorPr = par[5] * par[2];
+ const Double_t parElFraction = (par[3] < 0) ? GetElectronFraction(-par[3], par) : par[3];
+ const Double_t scaleFactorEl = par[5] * parElFraction;
+ // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0
+ const Double_t scaleFactorMu = (par[4] < 0)
+ ? (par[5] * GetMuonFractionFromElectronFractionAndPt(-par[4], parElFraction))
+ : (par[5] * par[4]);
+
+ const Double_t countPi = linearInterpolation(hRefPi, xx[0], scaleFactorPi, par[6], 0x0);
+ const Double_t countKa = linearInterpolation(hRefKa, xx[0], scaleFactorKa, par[7], 0x0);
+ const Double_t countPr = linearInterpolation(hRefPr, xx[0], scaleFactorPr, par[8], 0x0);
+ const Double_t countEl = linearInterpolation(hRefEl, xx[0], scaleFactorEl, par[9], 0x0);
+ const Double_t countMu = takeIntoAccountMuons ? linearInterpolation(hRefMu, xx[0], scaleFactorMu, par[10], 0x0) : 0;
+
+ const Double_t res = countPi + countKa + countPr + countEl + countMu;
+
+ /*
+ const Double_t countPi = linearInterpolation(hRefPi, xx[0], par[6], 0x0);
+ const Double_t countKa = linearInterpolation(hRefKa, xx[0], par[7], 0x0);
+ const Double_t countPr = linearInterpolation(hRefPr, xx[0], par[8], 0x0);
+ const Double_t countEl = linearInterpolation(hRefEl, xx[0], par[9], 0x0);
+ const Double_t countMu = takeIntoAccountMuons ? linearInterpolation(hRefMu, xx[0], par[10], 0x0) : 0;
+
+ const Double_t res = par[5] * ((par[0] + (muonContamination ? par[3] : 0)) * countPi + par[1] * countKa
+ + par[2] * countPr + par[3] * countEl + par[4] * countMu);
+
+ */
+
+ return res;
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t errorOfFitHistosForSimultaneousFitting(const Double_t *xx, const Double_t *par, const Int_t offset)
+{
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ Double_t summedError = 0;
+
+ // parXbinIndex (fixed) will be used my mathfit to hold the pT bin index (needed for regularisation)
+ const Int_t xBinIndex = mathFit->GetXbinIndex();
+ const Int_t numParsPerXbin = mathFit->GetNumParametersPerXbin();
+
+ const Int_t numRefHistosPerFit = numSimultaneousFits + (takeIntoAccountMuons ? 1 : 0);
+ const Int_t numRefHistosPerXbin = numRefHistosPerFit * numSimultaneousFits;
+
+ const Int_t refHistOffset = offset * numRefHistosPerFit + xBinIndex * numRefHistosPerXbin;
+
+ const TH1* hRefPi = mathFit->GetRefHisto(0 + refHistOffset);
+ const TH1* hRefKa = mathFit->GetRefHisto(1 + refHistOffset);
+ const TH1* hRefPr = mathFit->GetRefHisto(2 + refHistOffset);
+ const TH1* hRefEl = mathFit->GetRefHisto(3 + refHistOffset);
+ const TH1* hRefMu = takeIntoAccountMuons ?
+ mathFit->GetRefHisto(4 + refHistOffset)
+ : 0x0;
+
+ if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)
+ return 0;
+
+ if (takeIntoAccountMuons && !hRefMu)
+ return 0;
+
+ const Int_t parOffset = xBinIndex * numParsPerXbin;
+ const Int_t parPi = 0 + parOffset;
+ const Int_t parKa = 1 + parOffset;
+ const Int_t parPr = 2 + parOffset;
+ const Int_t parEl = 3 + parOffset;
+ const Int_t parMu = 4 + parOffset;
+ const Int_t parAll = 5 + parOffset;
+
+ const Double_t scaleFactorPi = par[parAll] * (par[parPi] + (muonContamination ? par[parEl] : 0));
+ const Double_t scaleFactorKa = par[parAll] * par[parKa];
+ const Double_t scaleFactorPr = par[parAll] * par[parPr];
+ const Double_t scaleFactorEl = par[parAll] * ((par[parEl] < 0) ? GetElectronFraction(-par[parEl], par) : par[parEl]);
+ // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0
+ const Double_t scaleFactorMu = (par[parMu] < 0) ?
+ (scaleFactorEl * GetMuonFractionFromElectronFractionAndPt(-par[parMu], par[parEl]) / par[parEl])
+ : (par[parAll] * par[parMu]);
+
+ Double_t errorPi = 0, errorKa = 0, errorPr = 0, errorEl = 0, errorMu = 0;
+
+ // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters
+ // Shift not implemented for simultaneous fit -> Just set all corresponding parameters to zero
+ linearInterpolation(hRefPi, xx[0], scaleFactorPi, 0, &errorPi);
+ linearInterpolation(hRefKa, xx[0], scaleFactorKa, 0, &errorKa);
+ linearInterpolation(hRefPr, xx[0], scaleFactorPr, 0, &errorPr);
+ linearInterpolation(hRefEl, xx[0], scaleFactorEl, 0, &errorEl);
+ if (takeIntoAccountMuons)
+ linearInterpolation(hRefMu, xx[0], scaleFactorMu, 0, &errorMu);
+
+ summedError += TMath::Power(errorPi, 2);
+ summedError += TMath::Power(errorKa, 2);
+ summedError += TMath::Power(errorPr, 2);
+ summedError += TMath::Power(errorEl, 2);
+ if (takeIntoAccountMuons)
+ summedError += TMath::Power(errorMu, 2);
+
+ return summedError;
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Double_t errorOfFitHistosDeltaPi(const Double_t *xx, const Double_t *par)
+{
+ return errorOfFitHistosForSimultaneousFitting(xx, par, 0);
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Double_t errorOfFitHistosDeltaKa(const Double_t *xx, const Double_t *par)
+{
+ return errorOfFitHistosForSimultaneousFitting(xx, par, 1);
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Double_t errorOfFitHistosDeltaPr(const Double_t *xx, const Double_t *par)
+{
+ return errorOfFitHistosForSimultaneousFitting(xx, par, 2);
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Double_t errorOfFitHistosDeltaEl(const Double_t *xx, const Double_t *par)
+{
+ return errorOfFitHistosForSimultaneousFitting(xx, par, 3);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t errorOfFitHistos(const Double_t *xx, const Double_t *par)
+{
+ //TODO Error of shift is still not taken into account
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ Double_t summedError = 0;
+
+ const TH1* hRefPi = mathFit->GetRefHisto(0);
+ const TH1* hRefKa = mathFit->GetRefHisto(1);
+ const TH1* hRefPr = mathFit->GetRefHisto(2);
+ const TH1* hRefEl = mathFit->GetRefHisto(3);
+ const TH1* hRefMu = takeIntoAccountMuons ? mathFit->GetRefHisto(4) : 0x0;
+
+ if (!hRefEl || !hRefKa || !hRefPi || !hRefPr)
+ return 0;
+
+ if (takeIntoAccountMuons && !hRefMu)
+ return 0;
+
+ // Do linear interpolation between 2 bins to handle non-integer values of the shift parameters
+ const Double_t scaleFactorPi = par[5] * (par[0] + (muonContamination ? par[3] : 0));
+ const Double_t scaleFactorKa = par[5] * par[1];
+ const Double_t scaleFactorPr = par[5] * par[2];
+ const Double_t scaleFactorEl = par[5] * ((par[3] < 0) ? GetElectronFraction(-par[3], par) : par[3]);
+ // Fix muon fraction to electron fraction (or some modified electron fraction) if desired, i.e. corresponding par < 0
+ const Double_t scaleFactorMu = (par[4] < 0) ? (scaleFactorEl * GetMuonFractionFromElectronFractionAndPt(-par[4], par[3]) / par[3])
+ : (par[5] * par[4]);
+
+ Double_t errorPi = 0, errorKa = 0, errorPr = 0, errorEl = 0, errorMu = 0;
+
+ linearInterpolation(hRefPi, xx[0], scaleFactorPi, par[6], &errorPi);
+ linearInterpolation(hRefKa, xx[0], scaleFactorKa, par[7], &errorKa);
+ linearInterpolation(hRefPr, xx[0], scaleFactorPr, par[8], &errorPr);
+ linearInterpolation(hRefEl, xx[0], scaleFactorEl, par[9], &errorEl);
+ if (takeIntoAccountMuons)
+ linearInterpolation(hRefMu, xx[0], scaleFactorMu, par[10], &errorMu); // Assume same fraction as electron, i.e. same scale factor
+
+ summedError += TMath::Power(errorPi, 2);
+ summedError += TMath::Power(errorKa, 2);
+ summedError += TMath::Power(errorPr, 2);
+ summedError += TMath::Power(errorEl, 2);
+ if (takeIntoAccountMuons)
+ summedError += TMath::Power(errorMu, 2);
+
+
+ /*
+ for (Int_t index = 0; index < mathFit->GetNrefHistos(); index++) {
+ TH1* HREF = mathFit->GetRefHisto(index);
+ Int_t bin = findBinWithinRange(HREF->GetXaxis(), xx[0]);
+ summedError += TMath::Power(HREF->GetBinError(bin) * par[index] * par[mathFit->GetNrefHistos()], 2);
+ }
+ */
+ return summedError;
+}
+
+
+//____________________________________________________________________________________________________________________
+inline Double_t saveDivide(Double_t numerator, Double_t denominator)
+{
+ return ((denominator != 0) ? numerator/denominator : 0 );
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getErrorOfPionIntegral(TMatrixDSym covMat)
+{
+ return TMath::Sqrt(covMat(0, 0) + covMat(12, 12) + 2 * covMat(0, 12));
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getErrorOfElectronFraction(Double_t* par, TMatrixDSym covMat)
+{
+ Double_t g = saveDivide(par[3], (par[0] + par[1] + par[2] + 2 * par[3]));
+ Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));
+ Double_t s2 = TMath::Power(g, 2) * covMat(3, 3);
+ Double_t s3 = (4 * TMath::Power(g, 4) - 2 * TMath::Power(g, 3)) * (covMat(3, 2) + covMat(3, 1) + covMat(3, 0));
+ Double_t s4 = TMath::Power(g, 4) * 2 * (covMat(2, 1) + covMat(2, 0) +covMat(1, 0));
+
+ return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4), par[3]);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getErrorOfKaonFraction(Double_t* par, TMatrixDSym covMat)
+{
+ Double_t g = saveDivide(par[1], (par[0] + par[1] + par[2] + 2 * par[3]));
+ Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));
+ Double_t s2 = TMath::Power(g, 2) * covMat(1, 1);
+ Double_t s3 = TMath::Power(g, 4) * (4 * covMat(3, 0) + 4 * covMat(3, 2) + 4 * covMat(3, 1) +
+ 2 * covMat(2, 1) + 2 * covMat(2, 0) + 2 * covMat(1, 0));
+ Double_t s4 = TMath::Power(g, 3) * ((-4) * covMat(3, 1) - 2 * covMat(2, 1) - 2 * covMat(1, 0));
+
+ return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4), par[1]);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getErrorOfPionFraction(Double_t* par, TMatrixDSym covMat)
+{
+ Double_t g = saveDivide(par[0] + par[3], (par[0] + par[1] + par[2] + 2 * par[3]));
+ Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));
+ Double_t s2 = TMath::Power(g, 2) * (covMat(0, 0) + covMat(3, 3));
+ Double_t s3 = TMath::Power(g, 4) * 2 * covMat(2, 1);
+ Double_t s4 = (4 * TMath::Power(g, 4) - 2 * TMath::Power(g, 3)) * (covMat(3, 2) + covMat(3, 1));
+ Double_t s5 = 2 * covMat(3, 0) * (2 * TMath::Power(g, 4) - 3 * TMath::Power(g, 3) + TMath::Power(g, 2));
+ Double_t s6 = 2 * (covMat(2, 0) + covMat(1, 0)) * (TMath::Power(g, 4) - TMath::Power(g, 3));
+
+ return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4 + s5 + s6), par[0] + par[3]);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getErrorOfProtonFraction(Double_t* par, TMatrixDSym covMat)
+{
+ Double_t g = saveDivide(par[2], (par[0] + par[2] + par[1] + 2 * par[3]));
+ Double_t s1 = TMath::Power(g, 4) * (covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3));
+ Double_t s2 = TMath::Power(g, 2) * covMat(2, 2);
+ Double_t s3 = TMath::Power(g, 4) * (4 * covMat(3, 0) + 4 * covMat(3, 2) + 4 * covMat(3, 1) +
+ 2 * covMat(2, 1) + 2 * covMat(2, 0) + 2 * covMat(1, 0));
+ Double_t s4 = TMath::Power(g, 3) * ((-4) * covMat(3, 2) - 2 * covMat(2, 1) - 2 * covMat(2, 0));
+
+ return saveDivide(TMath::Sqrt(s1 + s2 + s3 + s4), par[2]);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getErrorOfTotalIntegral(TMatrixDSym covMat)
+{
+ Double_t s1 = covMat(0, 0) + covMat(1, 1) + covMat(2, 2) + 4 * covMat(3, 3);
+ Double_t s2 = 4 * (covMat(3, 0) + covMat(3, 1) + covMat(3, 2));
+ Double_t s3 = 2 * (covMat(2, 1) + covMat(2, 0) + covMat(1, 0));
+
+ return TMath::Sqrt(s1 + s2 + s3);
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t getMedianOfNonZeros(Double_t input[4])
+{
+ Double_t values[4] = {0,0,0,0};
+ Int_t numNonZero = 0;
+ if (input[0] > 0) {
+ values[numNonZero] = input[0];
+ numNonZero++;
+ }
+ if (input[1] > 0) {
+ values[numNonZero] = input[1];
+ numNonZero++;
+ }
+ if (input[2] > 0) {
+ values[numNonZero] = input[2];
+ numNonZero++;
+ }
+ if (input[3] > 0) {
+ values[numNonZero] = input[3];
+ numNonZero++;
+ }
+
+ return ((numNonZero > 0) ? TMath::Median(numNonZero, values) : 0);
+}
+
+
+//____________________________________________________________________________________________________________________
+TCanvas* drawFractionHistos(TString canvName, TString canvTitle, Int_t mode, Double_t pLow, Double_t pHigh,
+ TH1* histDeltaPion, TH1* histDeltaElectron, TH1* histDeltaKaon, TH1* histDeltaProton, TH1* histMC,
+ Bool_t plotIdentifiedSpectra)
+{
+ TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);
+ canv->SetGridx(1);
+ canv->SetGridy(1);
+ canv->SetLogx(mode == kPMpT);
+ histDeltaPion->GetYaxis()->SetRangeUser(0.0, 1.0);
+ histDeltaPion->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaPion->GetXaxis(), mode, pLow, pHigh);
+ histDeltaPion->SetMarkerStyle(20);
+ histDeltaPion->GetXaxis()->SetMoreLogLabels(kTRUE);
+ histDeltaPion->GetXaxis()->SetNoExponent(kTRUE);
+ histDeltaPion->Draw("e p");
+ histDeltaElectron->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaElectron->GetXaxis(), mode, pLow, pHigh);
+ histDeltaElectron->SetMarkerStyle(21);
+ histDeltaElectron->Draw("e p same");
+ histDeltaKaon->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaKaon->GetXaxis(), mode, pLow, pHigh);
+ histDeltaKaon->SetMarkerStyle(22);
+ histDeltaKaon->Draw("e p same");
+ histDeltaProton->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaProton->GetXaxis(), mode, pLow, pHigh);
+ histDeltaProton->SetMarkerStyle(29);
+ histDeltaProton->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ histMC->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histMC->GetXaxis(), mode, pLow, pHigh);
+ histMC->SetMarkerStyle(24);
+ histMC->Draw("e p same");
+ }
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+ legend->AddEntry(histDeltaPion, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{#pi}}" : "_{#pi}"), "p");
+ legend->AddEntry(histDeltaElectron, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{e}}" : "_{e}"), "p");
+ legend->AddEntry(histDeltaKaon, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{K}}" : "_{K}"), "p");
+ legend->AddEntry(histDeltaProton, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{p}}" : "_{p}"), "p");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(histMC, identifiedLabels[isMC].Data(), "p");
+ legend->SetEntrySeparation(0.2);
+ legend->Draw();
+
+ ClearTitleFromHistoInCanvas(canv);
+
+ return canv;
+}
+
+
+//____________________________________________________________________________________________________________________
+TCanvas* drawYieldHistos(TString canvName, TString canvTitle, Int_t mode, Double_t pLow, Double_t pHigh,
+ TH1* histDeltaPion, TH1* histDeltaElectron, TH1* histDeltaKaon, TH1* histDeltaProton, TH1* histMC,
+ Bool_t plotIdentifiedSpectra)
+{
+ TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);
+ canv->SetGridx(1);
+ canv->SetGridy(1);
+ canv->SetLogx(mode == kPMpT);
+ canv->SetLogy(1);
+ histDeltaPion->GetYaxis()->SetRangeUser(histDeltaPion->GetBinContent(histDeltaPion->FindLastBinAbove(0.)) / 10.,
+ histDeltaPion->GetBinContent(histDeltaPion->GetMaximumBin()) * 10.);
+ histDeltaPion->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaPion->GetXaxis(), mode, pLow, pHigh);
+ histDeltaPion->SetMarkerStyle(20);
+ histDeltaPion->GetXaxis()->SetMoreLogLabels(kTRUE);
+ histDeltaPion->GetXaxis()->SetNoExponent(kTRUE);
+ histDeltaPion->Draw("e p");
+ histDeltaElectron->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaElectron->GetXaxis(), mode, pLow, pHigh);
+ histDeltaElectron->SetMarkerStyle(21);
+ histDeltaElectron->Draw("e p same");
+ histDeltaKaon->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaKaon->GetXaxis(), mode, pLow, pHigh);
+ histDeltaKaon->SetMarkerStyle(22);
+ histDeltaKaon->Draw("e p same");
+ histDeltaProton->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histDeltaProton->GetXaxis(), mode, pLow, pHigh);
+ histDeltaProton->SetMarkerStyle(29);
+ histDeltaProton->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ histMC->GetYaxis()->SetTitle(canvTitle.Data());
+ SetReasonableAxisRange(histMC->GetXaxis(), mode, pLow, pHigh);
+ histMC->SetMarkerStyle(24);
+ histMC->Draw("e p same");
+ }
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+
+ legend->AddEntry(histDeltaPion, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{#pi}}" : "_{#pi}"), "p");
+ legend->AddEntry(histDeltaElectron, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{e}}" : "_{e}"), "p");
+ legend->AddEntry(histDeltaKaon, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{K}}" : "_{K}"), "p");
+ legend->AddEntry(histDeltaProton, Form("#Delta%s", useDeltaPrime ? "'_{#lower[-0.5]{p}}" : "_{p}"), "p");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(histMC, identifiedLabels[isMC].Data(), "p");
+ legend->SetEntrySeparation(0.2);
+ legend->Draw();
+
+ ClearTitleFromHistoInCanvas(canv);
+
+ return canv;
+}
+
+
+//____________________________________________________________________________________________________________________
+Int_t doSimultaneousFitRegularised(Int_t nPar, Double_t* gausParams, Double_t* parameterErrorsOut, Double_t* covMatrix,
+ Double_t* stepSize, Double_t* lowParLimits, Double_t* upParLimits, Double_t& reducedChiSquare)
+{
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ Double_t chiSquare = -999;
+ Int_t ndf = -1;
+
+ AliTPCPIDmathFit::FitFunc_t* multiGaussFitArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];
+ multiGaussFitArray[0] = multiGaussFitDeltaPi;
+ multiGaussFitArray[1] = multiGaussFitDeltaKa;
+ multiGaussFitArray[2] = multiGaussFitDeltaPr;
+ multiGaussFitArray[3] = multiGaussFitDeltaEl;
+
+ AliTPCPIDmathFit::FitFunc_t* errorOfFitHistosArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];
+ errorOfFitHistosArray[0] = errorOfFitHistosDeltaPi;
+ errorOfFitHistosArray[1] = errorOfFitHistosDeltaKa;
+ errorOfFitHistosArray[2] = errorOfFitHistosDeltaPr;
+ errorOfFitHistosArray[3] = errorOfFitHistosDeltaEl;
+
+ //TODO errorFunction for bin errors of fit histos?
+ Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, 0x0, nPar, gausParams, parameterErrorsOut, covMatrix,
+ chiSquare, ndf, stepSize, lowParLimits, upParLimits);
+ //Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, errorOfFitHistosArray, nPar, gausParams, parameterErrorsOut, covMatrix,
+ // chiSquare, ndf, stepSize, lowParLimits, upParLimits);
+
+ std::cout << std::endl;
+
+ for (Int_t xBin = 0; xBin < mathFit->GetNumXbinsRegularisation(); xBin++) {
+ std::cout << "x bin " << xBin << ":" << std::endl;
+
+ Double_t sumFractions = 0;
+
+ for (Int_t parIndex = xBin * mathFit->GetNumParametersPerXbin(); parIndex < (xBin + 1) * mathFit->GetNumParametersPerXbin();
+ parIndex++) {
+ Int_t parIndexModulo = parIndex % mathFit->GetNumParametersPerXbin();
+
+ // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so
+ // the error from the matrix would be zero.
+ // parIndexModulo = 4 means muons, parIndexModulo = 3 means electrons, i.e. if parIndexModulo corresponds to muons,
+ // then parIndexModulo - 1 corresponds to electrons.
+
+ // Set electron fraction to value evaluated from a function above some threshold.
+ // Fixed electron fraction < 0 does this job within the fitting functions
+ if (parIndexModulo == 3 && gausParams[parIndex] < 0) {
+ gausParams[parIndex] = GetElectronFraction(-gausParams[parIndex], &gausParams[0]);
+ parameterErrorsOut[parIndex] = GetElectronFractionError();
+ }
+ // Set muon fraction equal to electron fraction (or some modified electron fraction) above some threshold,
+ // which should be a reasonable approximation:
+ // Fixed muon fraction < 0 does this job within the fitting functions
+ else if (parIndexModulo == 4 && gausParams[parIndex] < 0) {
+ gausParams[parIndex] = GetMuonFractionFromElectronFractionAndPt(-gausParams[parIndex], gausParams[parIndex - 1]);
+ parameterErrorsOut[parIndex] = parameterErrorsOut[parIndex - 1];
+ }
+
+
+ std::cout << "par[" << parIndex << "]: " << gausParams[parIndex] << " +- " << parameterErrorsOut[parIndex] << std::endl;
+
+ if (parIndexModulo <= 3 || ((muonContamination || takeIntoAccountMuons) && parIndexModulo == 4))
+ sumFractions += gausParams[parIndex];
+ }
+
+ std::cout << "Sum of fractions" << (muonContamination || takeIntoAccountMuons ? "(including muon contamination)" : "") << ": "
+ << sumFractions; std::cout << std::endl;
+ std::cout << std::endl << std::endl;
+ }
+
+ if (errFlag == 0)
+ std::cout << std::endl << "***Fit operation completed successfully***" << std::endl << std::endl;
+ else
+ std::cout << std::endl << "***Fit operation completed, but with errors***" << std::endl << std::endl;
+
+ reducedChiSquare = (ndf > 0) ? chiSquare / ndf : -1;
+
+ return errFlag;
+}
+
+
+//____________________________________________________________________________________________________________________
+Int_t doSimultaneousFit(TH1D** hDelta, Double_t xLow, Double_t xUp, Int_t nPar, Double_t* gausParams, Double_t* parameterErrorsOut,
+ Double_t* covMatrix, Double_t* stepSize, Double_t* lowParLimits, Double_t* upParLimits, Double_t&
+ reducedChiSquare)
+{
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ Double_t chiSquare = -999;
+ Int_t ndf = -1;
+
+ //TODO:
+ // Using no error on x (next TODO line) and no errorFunction (next after next TODO line) sometimes gives good results.
+ // However, it can completely fail for low statistics for the fit histos.
+ // Using either an error on x or the errorFunction both gives reasonable results, but might be slightly worse results in some cases
+ // (shifted/distorted data). Maybe: Choose one method - the rest is for systematic errors of this fitting
+
+ //TODO The next TODO marks are only relevant for chiSquare, but not for loglikelihood
+ //TODO Use error in x also -> If reference histos have low statistics, this will be very important
+
+ for (Int_t i = 0; i < numSimultaneousFits; i++) {
+ mathFit->InputData(hDelta[i], 0, i, xLow, xUp, -1., kFALSE);
+ //mathFit->InputData(hDelta[i], 0, i, xLow, xUp, -1., kTRUE);
+ }
+
+ AliTPCPIDmathFit::FitFunc_t* multiGaussFitArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];
+ multiGaussFitArray[0] = multiGaussFitDeltaPi;
+ multiGaussFitArray[1] = multiGaussFitDeltaKa;
+ multiGaussFitArray[2] = multiGaussFitDeltaPr;
+ multiGaussFitArray[3] = multiGaussFitDeltaEl;
+
+ AliTPCPIDmathFit::FitFunc_t* errorOfFitHistosArray = new AliTPCPIDmathFit::FitFunc_t[numSimultaneousFits];
+ errorOfFitHistosArray[0] = errorOfFitHistosDeltaPi;
+ errorOfFitHistosArray[1] = errorOfFitHistosDeltaKa;
+ errorOfFitHistosArray[2] = errorOfFitHistosDeltaPr;
+ errorOfFitHistosArray[3] = errorOfFitHistosDeltaEl;
+
+ //TODO errorFunction for bin errors of fit histos?
+ Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, 0x0, nPar, gausParams, parameterErrorsOut, covMatrix,
+ chiSquare, ndf, stepSize, lowParLimits, upParLimits);
+ //Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, errorOfFitHistosArray, nPar, gausParams, parameterErrorsOut, covMatrix,
+ // chiSquare, ndf, stepSize, lowParLimits, upParLimits);
+
+ std::cout << std::endl;
+
+ // If the electron fraction is fixed, evaluate the error of the extrapolation of the fixed value
+ if (TMath::Abs(lowParLimits[3] - upParLimits[3]) < epsilon) {
+ // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so
+ // the error from the matrix would be zero
+ parameterErrorsOut[3] = GetElectronFractionError();
+ }
+
+ // Set muon fraction equal to electron fraction (or some modified electron fraction) above some threshold,
+ // which should be a reasonable approximation:
+ // Fixed muon fraction < 0 does this job within the fitting functions
+ if (gausParams[4] < 0 ) {
+ // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so
+ // the error from the matrix would be zero
+ gausParams[4] = GetMuonFractionFromElectronFractionAndPt(-gausParams[4], gausParams[3]);
+ parameterErrorsOut[4] = parameterErrorsOut[3];
+ }
+
+ Double_t sumFractions = 0;
+ for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {
+ std::cout << "par[" << parIndex << "]: " << gausParams[parIndex] << " +- " << parameterErrorsOut[parIndex] << std::endl;
+ }
+ sumFractions = gausParams[0] + gausParams[1] + gausParams[2] + gausParams[3];
+ // In case of muon contamination add muon fraction also
+ if (muonContamination || takeIntoAccountMuons) {
+ sumFractions += gausParams[4];
+ }
+
+ std::cout << "Sum of fractions" << (muonContamination || takeIntoAccountMuons ? "(including muon contamination)" : "") << ": " << sumFractions; std::cout << std::endl;
+
+ if (errFlag == 0)
+ std::cout << std::endl << "***Fit operation completed successfully***" << std::endl << std::endl;
+ else
+ std::cout << std::endl << "***Fit operation completed, but with errors***" << std::endl << std::endl;
+
+ reducedChiSquare = (ndf > 0) ? chiSquare / ndf : -1;
+
+ return errFlag;
+}
+
+
+//____________________________________________________________________________________________________________________
+Int_t doFit(TH1D* hDelta, Double_t xLow, Double_t xUp, Int_t nPar, Double_t* gausParams, Double_t* parameterErrorsOut, Double_t* covMatrix,
+ Double_t* stepSize, Double_t* lowParLimits, Double_t* upParLimits, TF1* totalDeltaSpecies, Double_t& reducedChiSquare)
+{
+ AliTPCPIDmathFit* mathFit = AliTPCPIDmathFit::Instance();
+
+ Double_t chiSquare = -999;
+ Int_t ndf = -1;
+
+ //TODO:
+ // Using no error on x (next TODO line) and no errorFunction (next after next TODO line) sometimes gives good results.
+ // However, it can completely fail for low statistics for the fit histos.
+ // Using either an error on x or the errorFunction both gives reasonable results, but might be slightly worse results in some cases
+ // (shifted/distorted data). Maybe: Choose one method - the rest is for systematic errors of this fitting
+
+ //TODO The next TODO marks are only relevant for chiSquare, but not for loglikelihood
+ //TODO Use error in x also -> If reference histos have low statistics, this will be very important
+ mathFit->InputData(hDelta, 0, 0, xLow, xUp, -1., kFALSE);
+ //mathFit->InputData(hDelta, 0, 0, xLow, xUp, -1., kTRUE);
+
+ AliTPCPIDmathFit::FitFunc_t* multiGaussFitArray = new AliTPCPIDmathFit::FitFunc_t[1];
+ multiGaussFitArray[0] = multiGaussFit;
+
+ AliTPCPIDmathFit::FitFunc_t* errorOfFitHistosArray = new AliTPCPIDmathFit::FitFunc_t[1];
+ errorOfFitHistosArray[0] = errorOfFitHistos;
+
+ //TODO errorFunction for bin errors of fit histos?
+ Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, 0x0, nPar, gausParams, parameterErrorsOut, covMatrix,
+ chiSquare, ndf, stepSize, lowParLimits, upParLimits);
+ //Int_t errFlag = mathFit->MinuitFit(multiGaussFitArray, errorOfFitHistosArray, nPar, gausParams, parameterErrorsOut, covMatrix,
+ // chiSquare, ndf, stepSize, lowParLimits, upParLimits);
+
+ // If the electron fraction is fixed, evaluate the error of the extrapolation of the fixed value
+ if (TMath::Abs(lowParLimits[3] - upParLimits[3]) < epsilon) {
+ // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so
+ // the error from the matrix would be zero
+ parameterErrorsOut[3] = GetElectronFractionError();
+ }
+
+ // Set muon fraction equal to electron fraction (or some modified electron fraction) above some threshold, which should be a reasonable approximation:
+ // Fixed muon fraction < 0 does this job within the fitting functions
+ if (gausParams[4] < 0 ) {
+ // NOTE: Covariance matrix is NOT set. But this doesn't matter since the parameter is fixed anyway, so
+ // the error from the matrix would be zero
+ gausParams[4] = GetMuonFractionFromElectronFractionAndPt(-gausParams[4], gausParams[3]);
+ parameterErrorsOut[4] = parameterErrorsOut[3];
+ }
+
+ Double_t sumFractions = 0;
+ for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {
+ std::cout << totalDeltaSpecies->GetParName(parIndex) << ": " << gausParams[parIndex] << " +- " << parameterErrorsOut[parIndex] << std::endl;
+ }
+ sumFractions = gausParams[0] + gausParams[1] + gausParams[2] + gausParams[3];
+ // In case of muon contamination add muon fraction also
+ if (muonContamination || takeIntoAccountMuons) {
+ sumFractions += gausParams[4];
+ }
+
+ std::cout << "Sum of fractions" << (muonContamination || takeIntoAccountMuons ? "(including muon contamination)" : "") << ": " << sumFractions;
+ std::cout << std::endl;
+
+ if (errFlag == 0)
+ std::cout << std::endl << "***Fit operation completed successfully***" << std::endl << std::endl;
+ else
+ std::cout << std::endl << "***Fit operation completed, but with errors***" << std::endl << std::endl;
+
+ for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {
+ totalDeltaSpecies->SetParameter(parIndex, gausParams[parIndex]);
+ totalDeltaSpecies->SetParError(parIndex, parameterErrorsOut[parIndex]);
+ }
+
+ reducedChiSquare = (ndf > 0) ? chiSquare / ndf : -1;
+
+ return errFlag;
+}
+
+
+//____________________________________________________________________________________________________________________
+Double_t setFractionsAndYields(Int_t slice, Double_t inverseBinWidth, Double_t binWidthFitHisto, Int_t species, Double_t* parametersOut,
+ Double_t* parameterErrorsOut, TH1* hFractionSpecies, TH1* hFractionPionsDeltaSpecies,
+ TH1* hFractionElectronsDeltaSpecies, TH1* hFractionKaonsDeltaSpecies, TH1* hFractionProtonsDeltaSpecies,
+ TH1* hFractionMuonsDeltaSpecies, TH1* hYieldSpecies, TH1* hYieldPionsDeltaSpecies,
+ TH1* hYieldElectronsDeltaSpecies, TH1* hYieldKaonsDeltaSpecies, TH1* hYieldProtonsDeltaSpecies,
+ TH1* hYieldMuonsDeltaSpecies,
+ Bool_t normaliseFractions = kFALSE)
+{
+ // Set fraction and yields in corresponding histograms. If normaliseFractions is kTRUE, the fractions will be normalised to unity
+ // and the normalisation factor will be returned (i.e. 1./sumFraction)
+
+ Double_t normalisationFactor = 1.0;
+
+ // Since a log likelihood fit is anyway used, the normalisation should give a factor close to unity
+ if (normaliseFractions) {
+ Double_t sumFractions = parametersOut[0] + (muonContamination ? parametersOut[3] : 0) + parametersOut[1] + parametersOut[2] +
+ parametersOut[3] + (takeIntoAccountMuons ? parametersOut[4] : 0.);
+ if (sumFractions > 0) {
+ normalisationFactor = 1./sumFractions;
+ for (Int_t i = 0; i < 5; i++) {
+ parametersOut[i] *= normalisationFactor;
+
+ // Do not introduce an error for the normalisation, i.e. just scale parameters and fractions with the same factor which is
+ // assumed to be exact.
+ // Note that correlations should already be included in the parameterError
+ parameterErrorsOut[i] *= normalisationFactor;
+ }
+ }
+ }
+
+ Double_t sumOfParticles = inverseBinWidth * parametersOut[5] / binWidthFitHisto; // Divide by binWidthFitHisto since parametersOut includes this width
+
+ if (species == kPi) {
+ hFractionSpecies->SetBinContent(slice + 1, (parametersOut[0]+(muonContamination ? parametersOut[3] : 0)));
+ hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[0]);
+ }
+ else if (species == kEl) {
+ hFractionSpecies->SetBinContent(slice + 1, parametersOut[3]);
+ hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[3]);
+ }
+ else if (species == kKa) {
+ hFractionSpecies->SetBinContent(slice + 1, parametersOut[1]);
+ hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[1]);
+ }
+ else if (species == kPr) {
+ hFractionSpecies->SetBinContent(slice + 1, parametersOut[2]);
+ hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[2]);
+ }
+ else if (species == kMu) {
+ if (takeIntoAccountMuons) {
+ hFractionSpecies->SetBinContent(slice + 1, parametersOut[4]);
+ hFractionSpecies->SetBinError(slice + 1, parameterErrorsOut[4]);
+
+ hYieldSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionSpecies->GetBinContent(slice + 1));
+ hYieldSpecies->SetBinError(slice + 1, sumOfParticles * hFractionSpecies->GetBinError(slice + 1));
+ }
+
+ // Only set these histos for muons. The DeltaSpecies histos for muons will be set together with all other species
+ return normalisationFactor;
+ }
+
+ hFractionPionsDeltaSpecies->SetBinContent(slice + 1, (parametersOut[0]+(muonContamination ? parametersOut[3] : 0)));
+ hFractionPionsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[0]);//TODO What about error of parOut[3]?
+ hFractionElectronsDeltaSpecies->SetBinContent(slice + 1, parametersOut[3]);
+ hFractionElectronsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[3]);
+ hFractionKaonsDeltaSpecies->SetBinContent(slice + 1, parametersOut[1]);
+ hFractionKaonsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[1]);
+ hFractionProtonsDeltaSpecies->SetBinContent(slice + 1, parametersOut[2]);
+ hFractionProtonsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[2]);
+ if (takeIntoAccountMuons) {
+ hFractionMuonsDeltaSpecies->SetBinContent(slice + 1, parametersOut[4]);
+ hFractionMuonsDeltaSpecies->SetBinError(slice + 1, parameterErrorsOut[4]);
+ }
+
+ hYieldSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionSpecies->GetBinContent(slice + 1));
+ hYieldSpecies->SetBinError(slice + 1, sumOfParticles * hFractionSpecies->GetBinError(slice + 1));
+
+ hYieldPionsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaSpecies->GetBinContent(slice + 1));
+ hYieldPionsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaSpecies->GetBinError(slice + 1));
+ hYieldElectronsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaSpecies->GetBinContent(slice + 1));
+ hYieldElectronsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaSpecies->GetBinError(slice + 1));
+ hYieldKaonsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaSpecies->GetBinContent(slice + 1));
+ hYieldKaonsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaSpecies->GetBinError(slice + 1));
+ hYieldProtonsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaSpecies->GetBinContent(slice + 1));
+ hYieldProtonsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaSpecies->GetBinError(slice + 1));
+ if (takeIntoAccountMuons) {
+ hYieldMuonsDeltaSpecies->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaSpecies->GetBinContent(slice + 1));
+ hYieldMuonsDeltaSpecies->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaSpecies->GetBinError(slice + 1));
+ }
+
+ return normalisationFactor;
+}
+
+//____________________________________________________________________________________________________________________
+Int_t PID(TString fileName, Double_t deta, Double_t pLow, Double_t pHigh, Bool_t isMCdataSet, Int_t fitMethod,
+ Int_t muonFractionHandlingParameter, //0 = no muons, 1 = muonFrac=elFrac,
+ //2(3) = muonFrac/elFrac tuned on MC for StandardTrackCuts(HybridTrackCuts)
+ Bool_t useIdentifiedGeneratedSpectra, Bool_t plotIdentifiedSpectra, Int_t mode/*0=pT,1=z,2=xi*/,
+ Int_t chargeMode /*kNegCharge = -1, kAllCharged = 0, kPosCharge = 1*/,
+ Double_t lowerCentrality /*= -2*/, Double_t upperCentrality /*= -2*/,
+ Double_t lowerJetPt /*= -1*/ , Double_t upperJetPt/* = -1*/,
+ Int_t rebin/* = 1 -> DON'T USE FOR PT (will not work since binsPt will and should be used!)*/,
+ Int_t rebinDeltaPrime/* = 1*/,
+ TString listName /* = "bhess_PID"*/,
+ Bool_t useLogLikelihood /*= kTRUE*/, Bool_t useWeightsForLogLikelihood /*= kFALSE*/,
+ Int_t regularisation /*= 0*/,
+ Double_t regularisationFactor /*= 1*/,
+ TString filePathNameFileWithInititalFractions /*= ""*/,
+ TString* filePathNameResults /*= 0x0*/)
+{
+ // Do all the fitting
+
+ isMC = isMCdataSet;
+
+ muonFractionHandling = muonFractionHandlingParameter;
+
+ Int_t genAxis = useDeltaPrime ? kPidGenDeltaPrime : 1000/*kPidGenDelta*/;
+ if (!useDeltaPrime) {
+ std::cout << "ERROR: delta plots no longer available!" << std::endl;
+ return -1;
+ }
+
+ if (listName == "") {
+ listName = fileName;
+ listName.Replace(0, listName.Last('/') + 1, "");
+ listName.ReplaceAll(".root", "");
+ }
+
+
+ if (rebin > 1 && mode == kPMpT) {
+ std::cout << "ERROR: Requested re-binning of pT-axis! Since binsPt will be used, re-binning the data histo will lead to "
+ << "unforeseen consequences!" << std::endl;
+ return -1;
+ }
+
+ Int_t pSliceLow = -1;
+ Int_t pSliceHigh = -1;
+
+ Int_t axisForMode = kPidPt;
+ Int_t axisGenForMode = kPidGenPt;
+
+ std::cout << "Fitting \"" << fileName.Data() << "\" with settings:" << std::endl;
+
+ std::cout << "Minimisation strategy: " << minimisationStrategy.Data() << std::endl;
+ if (useLogLikelihood)
+ std::cout << "Binned loglikelihood fit" << (useWeightsForLogLikelihood ? " (weighted)" : "") << std::endl;
+ else
+ std::cout << "ChiSquare fit" << std::endl;
+ std::cout << "Processing mode: ";
+ if (mode == kPMpT)
+ std::cout << "pT" << std::endl;
+ else if (mode == kPMz) {
+ std::cout << "z" << std::endl;
+ axisForMode = kPidZ;
+ axisGenForMode = kPidGenZ;
+ }
+ else if (mode == kPMxi) {
+ std::cout << "xi" << std::endl;
+ axisForMode = kPidXi;
+ axisGenForMode = kPidGenXi;
+ }
+ else {
+ std::cout << "Unknown -> ERROR" << std::endl;
+ return -1;
+ }
+
+ std::cout << "Charge selection: ";
+ if (chargeMode == kAllCharged)
+ std::cout << "All charged particles" << std::endl;
+ else if (chargeMode == kNegCharge)
+ std::cout << "Negative particles only" << std::endl;
+ else if (chargeMode == kPosCharge)
+ std::cout << "Positive particles only" << std::endl;
+ else {
+ std::cout << "Unknown -> ERROR" << std::endl;
+ return -1;
+ }
+
+ const Bool_t restrictCharge = (chargeMode != kAllCharged);
+
+ if (regularisation > 0)
+ std::cout << "Regularisation with +-" << regularisation << " bins and factor " << regularisationFactor << " for penalty term."
+ << std::endl;
+ else
+ std::cout << "No regularisation" << std::endl;
+
+ std::cout << "Assumption on muon fraction: ";
+ if (muonFractionHandlingParameter >= 0 && muonFractionHandlingParameter < kNumHandlings)
+ std::cout << muonFractionHandlingShortName[muonFractionHandlingParameter].Data() << std::endl;
+ /*if (muonFractionHandlingParameter == kNoMuons)
+ std::cout << "Identical zero" << std::endl;
+ else if (muonFractionHandlingParameter == kMuonFracEqualElFrac)
+ std::cout << "Equal electron fraction" << std::endl;
+ else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCStandardTrackCuts)
+ std::cout << "Ratio to electron fraction tuned on MC for standard track cuts" << std::endl;
+ else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCHybridTrackCuts)
+ std::cout << "Ratio to electron fraction tuned on MC for hybrid track cuts" << std::endl;
+ else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCHybridTrackCutsJets)
+ std::cout << "Ratio to electron fraction tuned on MC for hybrid track cuts for jet particles" << std::endl;
+ else if (muonFractionHandlingParameter == kMuonFracOverElFracTunedOnMCHybridTrackCutsJets)
+ std::cout << "Ratio to electron fraction tuned on MC for hybrid track cuts for jet particles" << std::endl;*/
+ else {
+ std::cout << "Unknown -> ERROR" << std::endl;
+ return -1;
+ }
+
+ if (mode == kPMpT) {
+ Int_t index = 0;
+ while (pLow >= binsPt[index] && index < nPtBins)
+ index++;
+ pSliceLow = index - 1;
+
+ index = 0;
+ while (pHigh > binsPt[index] && index < nPtBins)
+ index++;
+ pSliceHigh = index - 1;
+
+ Int_t numMomIntervals = pSliceHigh - pSliceLow + 1;
+
+ if (numMomIntervals <= 0 || pSliceLow < 0 || pSliceHigh > nPtBins) {
+ std::cout << "Wrong choice of limits pLow/pHigh!" << std::endl;
+ return -1;
+ }
+
+ pLow = binsPt[pSliceLow];
+ pHigh = binsPt[pSliceHigh + 1]; // need upper edge, but binsPt holds lower edge
+ std::cout << "pLow/pHigh: ";
+ std::cout << pLow << " / " << pHigh << std::endl;
+ }
+
+ Bool_t initialiseWithFractionsFromFile = kFALSE;
+ TFile* fInitialFractions = 0x0;
+ TH1 *hInitFracEl = 0x0, *hInitFracKa = 0x0, *hInitFracPi = 0x0, *hInitFracMu = 0x0, *hInitFracPr = 0x0;
+
+ if (filePathNameFileWithInititalFractions != "") {
+ initialiseWithFractionsFromFile = kTRUE;
+
+ std::cout << "Initialising fractions from file: " << filePathNameFileWithInititalFractions.Data() << std::endl;
+ }
+ else
+ std::cout << "Not initialising fractions from file" << std::endl;
+
+ if (initialiseWithFractionsFromFile) {
+ fInitialFractions = TFile::Open(filePathNameFileWithInititalFractions.Data());
+ if (!fInitialFractions) {
+ std::cout << std::endl;
+ std::cout << "Failed to open file with initial fractions \"" << filePathNameFileWithInititalFractions.Data() << "\"!"
+ << std::endl;
+ return -1;
+ }
+
+ hInitFracEl = (TH1*)fInitialFractions->Get("hFractionElectrons");
+ hInitFracKa = (TH1*)fInitialFractions->Get("hFractionKaons");
+ hInitFracPi = (TH1*)fInitialFractions->Get("hFractionPions");
+ hInitFracMu = (TH1*)fInitialFractions->Get("hFractionMuons");
+ hInitFracPr = (TH1*)fInitialFractions->Get("hFractionProtons");
+
+ if (!hInitFracEl || ! hInitFracKa || ! hInitFracPi || ! hInitFracMu || ! hInitFracPr) {
+ std::cout << std::endl;
+ std::cout << "Failed to load initial fractions from file \"" << filePathNameFileWithInititalFractions.Data() << "\"!"
+ << std::endl;
+
+ fInitialFractions->Close();
+ return -1;
+ }
+ }
+
+
+
+ TObjArray* histList = 0x0;
+
+ TFile* f = TFile::Open(fileName.Data());
+ if (!f) {
+ std::cout << std::endl;
+ std::cout << "Failed to open file \"" << fileName.Data() << "\"!" << std::endl;
+ return -1;
+ }
+
+ //TString listName = fileName;
+ //listName = listName.ReplaceAll(".root", "");
+ //listName = listName.Remove(1, listName.Last('/') + 1);
+ histList = (TObjArray*)(f->Get(listName.Data()));
+ if (!histList) {
+ std::cout << std::endl;
+ std::cout << "Failed to load list \"" << listName.Data() << "\"!" << std::endl;
+ return -1;
+ }
+
+ // Extract the data histogram
+ THnSparse* hPIDdata = dynamic_cast<THnSparse*>(histList->FindObject("hPIDdataAll"));
+ if (!hPIDdata) {
+ std::cout << std::endl;
+ std::cout << "Failed to load data histo!" << std::endl;
+ return -1;
+ }
+
+ // If desired, rebin considered axis
+ if (rebin > 1 || rebinDeltaPrime > 1) {
+ const Int_t nDimensions = hPIDdata->GetNdimensions();
+ Int_t rebinFactor[nDimensions];
+
+ for (Int_t dim = 0; dim < nDimensions; dim++) {
+ if (dim == axisForMode && rebin > 1)
+ rebinFactor[dim] = rebin;
+ else if (dim == kPidDeltaPrime && rebinDeltaPrime > 1)
+ rebinFactor[dim] = rebinDeltaPrime;
+ else
+ rebinFactor[dim] = 1;
+ }
+
+ THnSparse* temp = hPIDdata->Rebin(&rebinFactor[0]);
+ hPIDdata->Reset();
+ hPIDdata = temp;
+ }
+
+ // Set proper errors, if not yet calculated
+ if (!hPIDdata->GetCalculateErrors()) {
+ std::cout << "Re-calculating errors of " << hPIDdata->GetName() << "..." << std::endl;
+ hPIDdata->Sumw2();
+ Long64_t nBinsTHnSparse = hPIDdata->GetNbins();
+ Double_t binContent = 0;
+
+ for (Long64_t bin = 0; bin < nBinsTHnSparse; bin++) {
+ binContent = hPIDdata->GetBinContent(bin);
+ hPIDdata->SetBinError(bin, TMath::Sqrt(binContent));
+ }
+ }
+
+
+ // If desired, restrict centrality axis
+ Int_t lowerCentralityBinLimit = -1;
+ Int_t upperCentralityBinLimit = -1;
+ Bool_t restrictCentralityAxis = kFALSE;
+ Double_t actualLowerCentrality = -1.;
+ Double_t actualUpperCentrality = -1.;
+
+ if (lowerCentrality >= -1 && upperCentrality >= -1) {
+ // Add subtract a very small number to avoid problems with values right on the border between to bins
+ lowerCentralityBinLimit = hPIDdata->GetAxis(kPidCentrality)->FindBin(lowerCentrality + 0.001);
+ upperCentralityBinLimit = hPIDdata->GetAxis(kPidCentrality)->FindBin(upperCentrality - 0.001);
+
+ // Check if the values look reasonable
+ if (lowerCentralityBinLimit <= upperCentralityBinLimit && lowerCentralityBinLimit >= 1
+ && upperCentralityBinLimit <= hPIDdata->GetAxis(kPidCentrality)->GetNbins()) {
+ actualLowerCentrality = hPIDdata->GetAxis(kPidCentrality)->GetBinLowEdge(lowerCentralityBinLimit);
+ actualUpperCentrality = hPIDdata->GetAxis(kPidCentrality)->GetBinUpEdge(upperCentralityBinLimit);
+
+ restrictCentralityAxis = kTRUE;
+ }
+ else {
+ std::cout << std::endl;
+ std::cout << "Requested centrality range out of limits or upper and lower limit are switched!" << std::endl;
+ return -1;
+ }
+ }
+
+ std::cout << "centrality: ";
+ if (restrictCentralityAxis) {
+ std::cout << actualLowerCentrality << " - " << actualUpperCentrality << std::endl;
+ }
+ else {
+ std::cout << "All" << std::endl;
+ }
+
+ if (restrictCentralityAxis) {
+ hPIDdata->GetAxis(kPidCentrality)->SetRange(lowerCentralityBinLimit, upperCentralityBinLimit);
+ }
+
+
+
+ // If desired, restrict jetPt axis
+ Int_t lowerJetPtBinLimit = -1;
+ Int_t upperJetPtBinLimit = -1;
+ Bool_t restrictJetPtAxis = kFALSE;
+ Double_t actualLowerJetPt = -1.;
+ Double_t actualUpperJetPt = -1.;
+
+ if (lowerJetPt >= 0 && upperJetPt >= 0) {
+ // Add subtract a very small number to avoid problems with values right on the border between to bins
+ lowerJetPtBinLimit = hPIDdata->GetAxis(kPidJetPt)->FindBin(lowerJetPt + 0.001);
+ upperJetPtBinLimit = hPIDdata->GetAxis(kPidJetPt)->FindBin(upperJetPt - 0.001);
+
+ // Check if the values look reasonable
+ if (lowerJetPtBinLimit <= upperJetPtBinLimit && lowerJetPtBinLimit >= 1 && upperJetPtBinLimit <= hPIDdata->GetAxis(kPidJetPt)->GetNbins()) {
+ actualLowerJetPt = hPIDdata->GetAxis(kPidJetPt)->GetBinLowEdge(lowerJetPtBinLimit);
+ actualUpperJetPt = hPIDdata->GetAxis(kPidJetPt)->GetBinUpEdge(upperJetPtBinLimit);
+
+ restrictJetPtAxis = kTRUE;
+ }
+ else {
+ std::cout << std::endl;
+ std::cout << "Requested jet pT range out of limits or upper and lower limit are switched!" << std::endl;
+ return -1;
+ }
+ }
+
+ std::cout << "jet pT: ";
+ if (restrictJetPtAxis) {
+ std::cout << actualLowerJetPt << " - " << actualUpperJetPt << std::endl;
+ }
+ else {
+ std::cout << "All" << std::endl;
+ }
+
+ if (restrictJetPtAxis) {
+ hPIDdata->GetAxis(kPidJetPt)->SetRange(lowerJetPtBinLimit, upperJetPtBinLimit);
+ }
+
+
+ // If desired, restrict charge axis
+ const Int_t indexChargeAxisData = GetAxisByTitle(hPIDdata, "Charge (e_{0})");
+ if (indexChargeAxisData < 0 && restrictCharge) {
+ std::cout << "Error: Charge axis not found for data histogram!" << std::endl;
+ return -1;
+ }
+ Int_t lowerChargeBinLimitData = -1;
+ Int_t upperChargeBinLimitData = -2;
+ Double_t actualLowerChargeData = -999;
+ Double_t actualUpperChargeData = -999;
+
+ if (restrictCharge) {
+ // Add subtract a very small number to avoid problems with values right on the border between to bins
+ if (chargeMode == kNegCharge) {
+ lowerChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(-1. + 0.001);
+ upperChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(0. - 0.001);
+ }
+ else if (chargeMode == kPosCharge) {
+ lowerChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(0. + 0.001);
+ upperChargeBinLimitData = hPIDdata->GetAxis(indexChargeAxisData)->FindBin(1. - 0.001);
+ }
+
+ // Check if the values look reasonable
+ if (lowerChargeBinLimitData <= upperChargeBinLimitData && lowerChargeBinLimitData >= 1
+ && upperChargeBinLimitData <= hPIDdata->GetAxis(indexChargeAxisData)->GetNbins()) {
+ actualLowerChargeData = hPIDdata->GetAxis(indexChargeAxisData)->GetBinLowEdge(lowerChargeBinLimitData);
+ actualUpperChargeData = hPIDdata->GetAxis(indexChargeAxisData)->GetBinUpEdge(upperChargeBinLimitData);
+
+ std::cout << "Charge range data: " << actualLowerChargeData << " - " << actualUpperChargeData << std::endl;
+ }
+ else {
+ std::cout << std::endl;
+ std::cout << "Requested charge range out of limits or upper and lower limit are switched!" << std::endl;
+ return -1;
+ }
+
+ hPIDdata->GetAxis(indexChargeAxisData)->SetRange(lowerChargeBinLimitData, upperChargeBinLimitData);
+ }
+
+ std::cout << std::endl;
+
+
+
+ // Open file in which all the projections (= intermediate results) will be saved
+ TString saveInterFName = fileName;
+ TString chargeString = "";
+ if (chargeMode == kPosCharge)
+ chargeString = "_posCharge";
+ else if (chargeMode == kNegCharge)
+ chargeString = "_negCharge";
+
+ saveInterFName = Form("%s_Projections_%s_%d_%s%s%s%s%s.root", saveInterFName.ReplaceAll(".root", "").Data(),
+ modeShortName[mode].Data(),
+ fitMethod, muonFractionHandlingShortName[muonFractionHandlingParameter].Data(),
+ useIdentifiedGeneratedSpectra ? "_idSpectra" : "",
+ restrictCentralityAxis ? Form("_centrality%.0f_%.0f", actualLowerCentrality, actualUpperCentrality) : "",
+ restrictJetPtAxis ? Form("_jetPt%.1f_%.1f", actualLowerJetPt, actualUpperJetPt) : "",
+ chargeString.Data());
+ TFile *saveInterF = TFile::Open(saveInterFName.Data(), "RECREATE");
+ saveInterF->cd();
+
+ // TH1 hist with number of processed events
+ Double_t numEvents = -1;
+ TH1* hNumEvents = dynamic_cast<TH1*>(histList->FindObject("fhEventsProcessed"));
+ if (!hNumEvents) {
+ std::cout << std::endl;
+ std::cout << "Histo with number of processed events not found! Yields will NOT be normalised to this number!" << std::endl
+ << std::endl;
+ }
+ else {
+ numEvents = restrictCentralityAxis ? hNumEvents->Integral(lowerCentralityBinLimit, upperCentralityBinLimit) :
+ hNumEvents->Integral();
+
+ if (numEvents <= 0) {
+ numEvents = -1;
+ std::cout << std::endl;
+ std::cout << "Number of processed events < 1 in selected range! Yields will NOT be normalised to this number!"
+ << std::endl << std::endl;
+ }
+ }
+
+
+ // TH1D hist with total yield per pT bin (-> project to arbitrary selectSpecies to avoid multiple counting)
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(1, 1);
+ TH1D* hYieldPt = hPIDdata->Projection(axisForMode, "e");
+ hYieldPt->SetName(Form("hYield%s", modeShortName[mode].Data()));
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1);
+
+
+ // Fill \Delta\species histograms for each momentum slice
+ Int_t nBins = hPIDdata->GetAxis(dataAxis)->GetNbins();
+ Double_t xLow = hPIDdata->GetAxis(dataAxis)->GetXmin();
+ Double_t xUp = hPIDdata->GetAxis(dataAxis)->GetXmax();
+
+ const Int_t numSlices = (mode == kPMpT) ? nPtBins : hPIDdata->GetAxis(axisForMode)->GetNbins();
+
+ TH1D* hDeltaPi[numSlices];
+ TH1D* hDeltaEl[numSlices];
+ TH1D* hDeltaKa[numSlices];
+ TH1D* hDeltaPr[numSlices];
+
+ TH1D* hDeltaPiFitQA[numSlices];
+ TH1D* hDeltaElFitQA[numSlices];
+ TH1D* hDeltaKaFitQA[numSlices];
+ TH1D* hDeltaPrFitQA[numSlices];
+
+ const Int_t nMCbins = 5;
+ TH1D* hDeltaPiMC[numSlices][nMCbins];
+ TH1D* hDeltaElMC[numSlices][nMCbins];
+ TH1D* hDeltaKaMC[numSlices][nMCbins];
+ TH1D* hDeltaPrMC[numSlices][nMCbins];
+
+
+ TH2D* h2Delta[4];
+ TH2D* h2DeltaMC[4][nMCbins];
+
+ for (Int_t i = 0; i < 4; i++) {
+ TString speciesLabel = hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(i + 1);
+
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(i + 1, i + 1);
+ h2Delta[i] = hPIDdata->Projection(dataAxis, axisForMode, "e");
+ h2Delta[i]->SetName(Form("h2Delta_%s", speciesLabel.Data()));
+ h2Delta[i]->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());
+ h2Delta[i]->GetYaxis()->SetTitle(Form("#Delta%s_{%s} = dE/dx %s <dE/dx>_{%s} (arb. units)", useDeltaPrime ? "'" : "", speciesLabel.Data(),
+ useDeltaPrime ? "/" : "-", speciesLabel.Data()));
+
+ for (Int_t species = 0; species < nMCbins; species++) {
+ hPIDdata->GetAxis(kPidMCpid)->SetRange(species + 1, species + 1); // Select MC species
+ h2DeltaMC[i][species] = hPIDdata->Projection(dataAxis, axisGenForMode, "e");
+ h2DeltaMC[i][species]->SetName(Form("h2Delta_MC_%s", speciesLabel.Data()));
+ h2DeltaMC[i][species]->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisGenForMode)->GetTitle());
+ h2DeltaMC[i][species]->GetYaxis()->SetTitle(h2Delta[i]->GetYaxis()->GetTitle());
+ }
+ hPIDdata->GetAxis(kPidMCpid)->SetRange(0, -1);
+ }
+
+ Int_t firstValidSlice = -1;
+ for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hPIDdata->GetAxis(axisForMode)->GetNbins(); slice++) {
+ if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))
+ continue;
+
+ if (firstValidSlice < 0)
+ firstValidSlice = slice;
+
+ // Add/subtract some very small offset to be sure not to sit on the bin boundary, when looking for the integration/projection limits.
+ // For modes different from pT, just take 1 bin
+ const Int_t pBinLowProjLimit = (mode == kPMpT) ? h2Delta[0]->GetXaxis()->FindBin(binsPt[slice] + 1e-5) : slice + 1;
+ const Int_t pBinUpProjLimit = (mode == kPMpT) ? h2Delta[0]->GetXaxis()->FindBin(binsPt[slice + 1]- 1e-5) : slice + 1;
+
+ const TString binInfo = (mode == kPMpT) ? Form("%.2f_Pt_%.2f", binsPt[slice], binsPt[slice + 1])
+ : Form("%.2f_%s_%.2f", hPIDdata->GetAxis(axisForMode)->GetBinLowEdge(pBinLowProjLimit),
+ modeShortName[mode].Data(),
+ hPIDdata->GetAxis(axisForMode)->GetBinUpEdge(pBinUpProjLimit));
+
+ hDeltaEl[slice] = h2Delta[0]->ProjectionY(Form("hDeltaEl_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaEl[slice]->GetXaxis()->SetTitle(h2Delta[0]->GetYaxis()->GetTitle());
+ hDeltaEl[slice]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaEl[slice]->SetStats(kFALSE);
+
+ hDeltaKa[slice] = h2Delta[1]->ProjectionY(Form("hDeltaKa_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaKa[slice]->SetName(Form("hDeltaKa_%s", binInfo.Data()));
+ hDeltaKa[slice]->GetXaxis()->SetTitle(h2Delta[1]->GetYaxis()->GetTitle());
+ hDeltaKa[slice]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaKa[slice]->SetStats(kFALSE);
+
+ hDeltaPi[slice] = h2Delta[2]->ProjectionY(Form("hDeltaPi_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaPi[slice]->SetName(Form("hDeltaPi_%s", binInfo.Data()));
+ hDeltaPi[slice]->GetXaxis()->SetTitle(h2Delta[2]->GetYaxis()->GetTitle());
+ hDeltaPi[slice]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaPi[slice]->SetStats(kFALSE);
+
+ hDeltaPr[slice] = h2Delta[3]->ProjectionY(Form("hDeltaPr_%s", binInfo.Data()), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaPr[slice]->SetName(Form("hDeltaPr_%s", binInfo.Data()));
+ hDeltaPr[slice]->GetXaxis()->SetTitle(h2Delta[3]->GetYaxis()->GetTitle());
+ hDeltaPr[slice]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaPr[slice]->SetStats(kFALSE);
+
+ if (plotIdentifiedSpectra) {
+ // If identified spectra are available (mainly useful in the MC case) and shall be used,
+ // create histos with signals from identified particles
+
+ // DeltaEl
+ for (Int_t species = 0; species < nMCbins; species++) {
+ hDeltaElMC[slice][species] = h2DeltaMC[0][species]->ProjectionY(Form("hDeltaElMC_%s_species_%d", binInfo.Data(), species),
+ pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaElMC[slice][species]->SetLineColor(getLineColor(species + 1));
+ hDeltaElMC[slice][species]->SetMarkerColor(getLineColor(species + 1));
+ hDeltaElMC[slice][species]->SetMarkerStyle(24);
+ hDeltaElMC[slice][species]->SetLineStyle(1);
+ hDeltaElMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[0][species]->GetYaxis()->GetTitle());
+ hDeltaElMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaElMC[slice][species]->SetStats(kFALSE);
+ }
+
+ // DeltaKa
+ for (Int_t species = 0; species < nMCbins; species++) {
+ hDeltaKaMC[slice][species] = h2DeltaMC[1][species]->ProjectionY(Form("hDeltaKaMC_%s_species_%d", binInfo.Data(), species),
+ pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaKaMC[slice][species]->SetLineColor(getLineColor(species + 1));
+ hDeltaKaMC[slice][species]->SetMarkerColor(getLineColor(species + 1));
+ hDeltaKaMC[slice][species]->SetMarkerStyle(24);
+ hDeltaKaMC[slice][species]->SetLineStyle(1);
+ hDeltaKaMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[1][species]->GetYaxis()->GetTitle());
+ hDeltaKaMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaKaMC[slice][species]->SetStats(kFALSE);
+ }
+
+ // DeltaPi
+ for (Int_t species = 0; species < nMCbins; species++) {
+ hDeltaPiMC[slice][species] = h2DeltaMC[2][species]->ProjectionY(Form("hDeltaPiMC_%s_species_%d", binInfo.Data(), species),
+ pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaPiMC[slice][species]->SetLineColor(getLineColor(species + 1));
+ hDeltaPiMC[slice][species]->SetMarkerColor(getLineColor(species + 1));
+ hDeltaPiMC[slice][species]->SetMarkerStyle(24);
+ hDeltaPiMC[slice][species]->SetLineStyle(1);
+ hDeltaPiMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[2][species]->GetYaxis()->GetTitle());
+ hDeltaPiMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaPiMC[slice][species]->SetStats(kFALSE);
+ }
+
+ // DeltaPr
+ for (Int_t species = 0; species < nMCbins; species++) {
+ hDeltaPrMC[slice][species] = h2DeltaMC[3][species]->ProjectionY(Form("hDeltaPrMC_%s_species_%d", binInfo.Data(), species),
+ pBinLowProjLimit, pBinUpProjLimit, "e");
+ hDeltaPrMC[slice][species]->SetLineColor(getLineColor(species + 1));
+ hDeltaPrMC[slice][species]->SetMarkerColor(getLineColor(species + 1));
+ hDeltaPrMC[slice][species]->SetMarkerStyle(24);
+ hDeltaPrMC[slice][species]->SetLineStyle(1);
+ hDeltaPrMC[slice][species]->GetXaxis()->SetTitle(h2DeltaMC[3][species]->GetYaxis()->GetTitle());
+ hDeltaPrMC[slice][species]->GetXaxis()->SetTitleOffset(1.0);
+ hDeltaPrMC[slice][species]->SetStats(kFALSE);
+ }
+ }
+ }
+ hPIDdata->GetAxis(kPidMCpid)->SetRange(0, -1);
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1);
+
+ hPIDdata->GetAxis(axisForMode)->SetRange(0, -1);
+
+ /*
+ // TOF TODO
+ TCanvas* cTOF = new TCanvas("cTOF", "TOF PID",100,10,1200,800);
+ cTOF->Divide(4,1);
+ cTOF->cd(1);
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(1, 1);
+ TH2D* h2TOFel = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);
+ h2TOFel->SetName("h2TOFel");
+ h2TOFel->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(1)));
+ h2TOFel->Draw("colz");
+
+ cTOF->cd(2);
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(2, 2);
+ TH2D* h2TOFka = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);
+ h2TOFka->SetName("h2TOFka");
+ h2TOFka->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(2)));
+ h2TOFka->Draw("colz");
+
+ cTOF->cd(3);
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(3, 3);
+ TH2D* h2TOFpi = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);
+ h2TOFpi->SetName("h2TOFpi");
+ h2TOFpi->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(3)));
+ h2TOFpi->Draw("colz");
+
+ cTOF->cd(4);
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(4, 4);
+ TH2D* h2TOFpr = hPIDdata->Projection(kPidDeltaTOF, kPidPvertex);
+ h2TOFpr->SetName("h2TOFpr");
+ h2TOFpr->GetYaxis()->SetTitle(Form("#DeltaTOF_{%s} (ps)", hPIDdata->GetAxis(kPidSelectSpecies)->GetBinLabel(4)));
+ h2TOFpr->Draw("colz");
+
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1);
+ */
+
+ // Start fitting of slices
+ TCanvas* cSingleFit[numSlices][4];
+
+ TF1* fitFuncTotalDeltaPion[numSlices];
+ TF1* fitFuncTotalDeltaElectron[numSlices];
+ TF1* fitFuncTotalDeltaKaon[numSlices];
+ TF1* fitFuncTotalDeltaProton[numSlices];
+
+ // Histos for particle fractions
+ TH1F* hFractionElectrons = 0x0;
+ if (mode == kPMpT)
+ hFractionElectrons = new TH1F("hFractionElectrons", "e", nPtBins, binsPt);
+ else {
+ const TArrayD* histBins = hPIDdata->GetAxis(axisForMode)->GetXbins();
+ if (histBins->fN == 0)
+ hFractionElectrons = new TH1F("hFractionElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), hPIDdata->GetAxis(axisForMode)->GetXmin(),
+ hPIDdata->GetAxis(axisForMode)->GetXmax());
+ else
+ hFractionElectrons = new TH1F("hFractionElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), histBins->fArray);
+ }
+
+ hFractionElectrons->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());
+ hFractionElectrons->GetYaxis()->SetTitle("Fraction");
+ hFractionElectrons->SetLineColor(getLineColor(kEl));
+ hFractionElectrons->SetMarkerColor(getLineColor(kEl));
+ hFractionElectrons->SetMarkerStyle(20);
+ hFractionElectrons->Sumw2();
+ hFractionElectrons->SetStats(kFALSE);
+
+ TH1F* hFractionElectronsDeltaPion = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaPion");
+ TH1F* hFractionElectronsDeltaElectron = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaElectron");
+ TH1F* hFractionElectronsDeltaKaon = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaKaon");
+ TH1F* hFractionElectronsDeltaProton = (TH1F*)hFractionElectrons->Clone("hFractionElectronsDeltaProton");
+
+ TH1F* hFractionKaons = (TH1F*)hFractionElectrons->Clone("hFractionKaons");
+ hFractionKaons->SetTitle("K");
+ hFractionKaons->SetLineColor(getLineColor(kKa));
+ hFractionKaons->SetMarkerColor(getLineColor(kKa));
+
+ TH1F* hFractionKaonsDeltaPion = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaPion");
+ TH1F* hFractionKaonsDeltaElectron = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaElectron");
+ TH1F* hFractionKaonsDeltaKaon = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaKaon");
+ TH1F* hFractionKaonsDeltaProton = (TH1F*)hFractionKaons->Clone("hFractionKaonsDeltaProton");
+
+ TH1F* hFractionPions = (TH1F*)hFractionElectrons->Clone("hFractionPions");
+ hFractionPions->SetTitle("#pi");
+ hFractionPions->SetLineColor(getLineColor(kPi));
+ hFractionPions->SetMarkerColor(getLineColor(kPi));
+
+ TH1F* hFractionPionsDeltaPion = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaPion");
+ TH1F* hFractionPionsDeltaElectron = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaElectron");
+ TH1F* hFractionPionsDeltaKaon = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaKaon");
+ TH1F* hFractionPionsDeltaProton = (TH1F*)hFractionPions->Clone("hFractionPionsDeltaProton");
+
+ TH1F* hFractionProtons = (TH1F*)hFractionElectrons->Clone("hFractionProtons");
+ hFractionProtons->SetTitle("p");
+ hFractionProtons->SetLineColor(getLineColor(kPr));
+ hFractionProtons->SetMarkerColor(getLineColor(kPr));
+
+ TH1F* hFractionProtonsDeltaPion = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaPion");
+ TH1F* hFractionProtonsDeltaElectron = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaElectron");
+ TH1F* hFractionProtonsDeltaKaon = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaKaon");
+ TH1F* hFractionProtonsDeltaProton = (TH1F*)hFractionProtons->Clone("hFractionProtonsDeltaProton");
+
+ TH1F* hFractionMuons = (TH1F*)hFractionElectrons->Clone("hFractionMuons");
+ hFractionMuons->SetTitle("#mu");
+ hFractionMuons->SetLineColor(getLineColor(kMu));
+ hFractionMuons->SetMarkerColor(getLineColor(kMu));
+
+ TH1F* hFractionMuonsDeltaPion = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaPion");
+ TH1F* hFractionMuonsDeltaElectron = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaElectron");
+ TH1F* hFractionMuonsDeltaKaon = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaKaon");
+ TH1F* hFractionMuonsDeltaProton = (TH1F*)hFractionMuons->Clone("hFractionMuonsDeltaProton");
+
+ TH1F* hFractionSummed = (TH1F*)hFractionProtons->Clone("hFractionSummed");
+ hFractionSummed->SetTitle("Sum");
+ hFractionSummed->SetLineColor(kBlack);
+ hFractionSummed->SetMarkerColor(kBlack);
+
+
+ // MC fractions
+ TH1F* hFractionElectronsMC = (TH1F*)hFractionElectrons->Clone("hFractionElectronsMC");
+ hFractionElectronsMC->SetMarkerStyle(24);
+ TH1F* hFractionKaonsMC = (TH1F*)hFractionKaons->Clone("hFractionKaonsMC");
+ hFractionKaonsMC->SetMarkerStyle(24);
+ TH1F* hFractionPionsMC = (TH1F*)hFractionPions->Clone("hFractionPionsMC");
+ hFractionPionsMC->SetMarkerStyle(24);
+ TH1F* hFractionMuonsMC = (TH1F*)hFractionMuons->Clone("hFractionMuonsMC");
+ hFractionMuonsMC->SetMarkerStyle(24);
+ TH1F* hFractionProtonsMC = (TH1F*)hFractionProtons->Clone("hFractionProtonsMC");
+ hFractionProtonsMC->SetMarkerStyle(24);
+
+
+ // Comparison fit result<->MC
+ TString fractionComparisonTitle = Form("Fraction fit / fraction %s", identifiedLabels[isMC].Data());
+ TH1F* hFractionComparisonElectrons = (TH1F*)hFractionElectrons->Clone("hFractionComparisonElectrons");
+ hFractionComparisonElectrons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());
+ TH1F* hFractionComparisonMuons = (TH1F*)hFractionMuons->Clone("hFractionComparisonMuons");
+ hFractionComparisonMuons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());
+ TH1F* hFractionComparisonKaons = (TH1F*)hFractionKaons->Clone("hFractionComparisonKaons");
+ hFractionComparisonKaons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());
+ TH1F* hFractionComparisonPions = (TH1F*)hFractionPions->Clone("hFractionComparisonPions");
+ hFractionComparisonPions->GetYaxis()->SetTitle(fractionComparisonTitle.Data());
+ TH1F* hFractionComparisonProtons = (TH1F*)hFractionProtons->Clone("hFractionComparisonProtons");
+ hFractionComparisonProtons->GetYaxis()->SetTitle(fractionComparisonTitle.Data());
+ TH1F* hFractionComparisonTotal = (TH1F*)hFractionSummed->Clone("hFractionComparisonTotal");
+ hFractionComparisonTotal->GetYaxis()->SetTitle(fractionComparisonTitle.Data());
+
+
+
+ // Histos for particle yields
+ TH1F* hYieldElectrons = 0x0;
+ if (mode == kPMpT)
+ hYieldElectrons = new TH1F("hYieldElectrons", "e", nPtBins, binsPt);
+ else {
+ const TArrayD* histBins = hPIDdata->GetAxis(axisForMode)->GetXbins();
+ if (histBins->fN == 0)
+ hYieldElectrons = new TH1F("hYieldElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), hPIDdata->GetAxis(axisForMode)->GetXmin(),
+ hPIDdata->GetAxis(axisForMode)->GetXmax());
+ else
+ hYieldElectrons = new TH1F("hYieldElectrons", "e", hPIDdata->GetAxis(axisForMode)->GetNbins(), histBins->fArray);
+ }
+
+ hYieldElectrons->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());
+ hYieldElectrons->GetYaxis()->SetTitle(Form("%s1/(2#pi%s) d^{2}N/d#etad%s%s", numEvents > 0 ? "1/N_{ev} " : "",
+ modeLatexName[mode].Data(), modeLatexName[mode].Data(),
+ mode == kPMpT ? " (GeV/c)^{-2}" : 0));
+ hYieldElectrons->SetLineColor(getLineColor(kEl));
+ hYieldElectrons->SetMarkerColor(getLineColor(kEl));
+ hYieldElectrons->SetMarkerStyle(20);
+ hYieldElectrons->Sumw2();
+ hYieldElectrons->SetStats(kFALSE);
+
+ TH1F* hYieldElectronsDeltaPion = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaPion");
+ TH1F* hYieldElectronsDeltaElectron = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaElectron");
+ TH1F* hYieldElectronsDeltaKaon = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaKaon");
+ TH1F* hYieldElectronsDeltaProton = (TH1F*)hYieldElectrons->Clone("hYieldElectronsDeltaProton");
+
+ TH1F* hYieldKaons = (TH1F*)hYieldElectrons->Clone("hYieldKaons");
+ hYieldKaons->SetTitle("K");
+ hYieldKaons->SetLineColor(getLineColor(kKa));
+ hYieldKaons->SetMarkerColor(getLineColor(kKa));
+
+ TH1F* hYieldKaonsDeltaPion = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaPion");
+ TH1F* hYieldKaonsDeltaElectron = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaElectron");
+ TH1F* hYieldKaonsDeltaKaon = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaKaon");
+ TH1F* hYieldKaonsDeltaProton = (TH1F*)hYieldKaons->Clone("hYieldKaonsDeltaProton");
+
+ TH1F* hYieldPions = (TH1F*)hYieldElectrons->Clone("hYieldPions");
+ hYieldPions->SetTitle("#pi");
+ hYieldPions->SetLineColor(getLineColor(kPi));
+ hYieldPions->SetMarkerColor(getLineColor(kPi));
+
+ TH1F* hYieldPionsDeltaPion = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaPion");
+ TH1F* hYieldPionsDeltaElectron = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaElectron");
+ TH1F* hYieldPionsDeltaKaon = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaKaon");
+ TH1F* hYieldPionsDeltaProton = (TH1F*)hYieldPions->Clone("hYieldPionsDeltaProton");
+
+ TH1F* hYieldProtons = (TH1F*)hYieldElectrons->Clone("hYieldProtons");
+ hYieldProtons->SetTitle("p");
+ hYieldProtons->SetLineColor(getLineColor(kPr));
+ hYieldProtons->SetMarkerColor(getLineColor(kPr));
+
+ TH1F* hYieldProtonsDeltaPion = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaPion");
+ TH1F* hYieldProtonsDeltaElectron = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaElectron");
+ TH1F* hYieldProtonsDeltaKaon = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaKaon");
+ TH1F* hYieldProtonsDeltaProton = (TH1F*)hYieldProtons->Clone("hYieldProtonsDeltaProton");
+
+ TH1F* hYieldMuons = (TH1F*)hYieldElectrons->Clone("hYieldMuons");
+ hYieldMuons->SetTitle("#mu");
+ hYieldMuons->SetLineColor(getLineColor(kMu));
+ hYieldMuons->SetMarkerColor(getLineColor(kMu));
+
+ TH1F* hYieldMuonsDeltaPion = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaPion");
+ TH1F* hYieldMuonsDeltaElectron = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaElectron");
+ TH1F* hYieldMuonsDeltaKaon = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaKaon");
+ TH1F* hYieldMuonsDeltaProton = (TH1F*)hYieldMuons->Clone("hYieldMuonsDeltaProton");
+
+ // MC yields
+ TH1F* hYieldElectronsMC = (TH1F*)hYieldElectrons->Clone("hYieldElectronsMC");
+ hYieldElectronsMC->SetMarkerStyle(24);
+ TH1F* hYieldMuonsMC = (TH1F*)hYieldElectrons->Clone("hYieldMuonsMC");
+ hYieldMuonsMC->SetMarkerStyle(24);
+ hYieldMuonsMC->SetLineColor(getLineColor(kMu));
+ hYieldMuonsMC->SetMarkerColor(getLineColor(kMu));
+ TH1F* hYieldKaonsMC = (TH1F*)hYieldKaons->Clone("hYieldKaonsMC");
+ hYieldKaonsMC->SetMarkerStyle(24);
+ TH1F* hYieldPionsMC = (TH1F*)hYieldPions->Clone("hYieldPionsMC");
+ hYieldPionsMC->SetMarkerStyle(24);
+ TH1F* hYieldProtonsMC = (TH1F*)hYieldProtons->Clone("hYieldProtonsMC");
+ hYieldProtonsMC->SetMarkerStyle(24);
+ TH1F* hYieldSummedMC = (TH1F*)hYieldProtonsMC->Clone("hYieldSummedMC");
+ hYieldSummedMC->SetTitle("Sum");
+ hYieldSummedMC->SetLineColor(kBlack);
+ hYieldSummedMC->SetMarkerColor(kBlack);
+
+ // Comparison fit result<->MC (yields)
+ TString yieldComparisonTitle = Form("Yield fit / yield %s", identifiedLabels[isMC].Data());
+ TH1F* hYieldComparisonElectrons = (TH1F*)hYieldElectrons->Clone("hYieldComparisonElectrons");
+ hYieldComparisonElectrons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());
+ TH1F* hYieldComparisonMuons = (TH1F*)hYieldMuons->Clone("hYieldComparisonMuons");
+ hYieldComparisonMuons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());
+ TH1F* hYieldComparisonKaons = (TH1F*)hYieldKaons->Clone("hYieldComparisonKaons");
+ hYieldComparisonKaons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());
+ TH1F* hYieldComparisonPions = (TH1F*)hYieldPions->Clone("hYieldComparisonPions");
+ hYieldComparisonPions->GetYaxis()->SetTitle(yieldComparisonTitle.Data());
+ TH1F* hYieldComparisonProtons = (TH1F*)hYieldProtons->Clone("hYieldComparisonProtons");
+ hYieldComparisonProtons->GetYaxis()->SetTitle(yieldComparisonTitle.Data());
+
+
+ // To-pi ratios
+ TString electronString[3] = { "e^{-}", "e^{+}+e^{-}", "e^{+}" };
+ TString muonString[3] = { "#mu^{-}", "#mu^{+}+#mu^{-}", "#mu^{+}" };
+ TString kaonString[3] = { "K^{-}", "K^{+}+K^{-}", "K^{+}" };
+ TString pionString[3] = { "#pi^{-}", "#pi^{+}+#pi^{-}", "#pi^{+}" };
+ TString protonString[3] = { "#bar{p}", "p+#bar{p}", "p" };
+
+ TH1F* hRatioToPiElectrons = (TH1F*)hYieldElectrons->Clone("hRatioToPiElectrons");
+ hRatioToPiElectrons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",
+ electronString[chargeMode+1].Data(),
+ modeLatexName[mode].Data(),
+ pionString[chargeMode+1].Data(),
+ modeLatexName[mode].Data()));
+ hRatioToPiElectrons->SetTitle(Form("%s", chargeMode == 0
+ ? Form("(%s)/(%s)", electronString[chargeMode+1].Data(), pionString[chargeMode+1].Data())
+ : Form("%s/%s", electronString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));
+
+
+ TH1F* hRatioToPiMuons = (TH1F*)hYieldMuons->Clone("hRatioToPiMuons");
+ hRatioToPiMuons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",
+ muonString[chargeMode+1].Data(),
+ modeLatexName[mode].Data(),
+ pionString[chargeMode+1].Data(),
+ modeLatexName[mode].Data()));
+ hRatioToPiMuons->SetTitle(Form("%s", chargeMode == 0
+ ? Form("(%s)/(%s)", muonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())
+ : Form("%s/%s", muonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));
+
+ TH1F* hRatioToPiKaons = (TH1F*)hYieldKaons->Clone("hRatioToPiKaons");
+ hRatioToPiKaons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",
+ kaonString[chargeMode+1].Data(),
+ modeLatexName[mode].Data(),
+ pionString[chargeMode+1].Data(),
+ modeLatexName[mode].Data()));
+ hRatioToPiKaons->SetTitle(Form("%s", chargeMode == 0
+ ? Form("(%s)/(%s)", kaonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())
+ : Form("%s/%s", kaonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));
+
+ TH1F* hRatioToPiProtons = (TH1F*)hYieldProtons->Clone("hRatioToPiProtons");
+ hRatioToPiProtons->GetYaxis()->SetTitle(Form("d^{2}N_{%s}/d#etad%s / d^{2}N_{%s}/d#etad%s",
+ protonString[chargeMode+1].Data(),
+ modeLatexName[mode].Data(),
+ pionString[chargeMode+1].Data(),
+ modeLatexName[mode].Data()));
+ hRatioToPiProtons->SetTitle(Form("%s", chargeMode == 0
+ ? Form("(%s)/(%s)", protonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())
+ : Form("%s/%s", protonString[chargeMode+1].Data(), pionString[chargeMode+1].Data())));
+
+ // MC to-pi ratios
+ TH1F* hRatioToPiElectronsMC = (TH1F*)hRatioToPiElectrons->Clone("hRatioToPiElectronsMC");
+ hRatioToPiElectronsMC->SetMarkerStyle(24);
+ TH1F* hRatioToPiMuonsMC = (TH1F*)hRatioToPiMuons->Clone("hRatioToPiMuonsMC");
+ hRatioToPiMuonsMC->SetMarkerStyle(24);
+ hRatioToPiMuonsMC->SetLineColor(getLineColor(kMu));
+ hRatioToPiMuonsMC->SetMarkerColor(getLineColor(kMu));
+ TH1F* hRatioToPiKaonsMC = (TH1F*)hRatioToPiKaons->Clone("hRatioToPiKaonsMC");
+ hRatioToPiKaonsMC->SetMarkerStyle(24);
+ TH1F* hRatioToPiProtonsMC = (TH1F*)hRatioToPiProtons->Clone("hRatioToPiProtonsMC");
+ hRatioToPiProtonsMC->SetMarkerStyle(24);
+
+ // Reduced Chi^2 of fits vs. pT for all Delta_Species
+ TH2F* hReducedChiSquarePt = 0x0;
+ if (mode == kPMpT)
+ hReducedChiSquarePt = new TH2F("hReducedChiSquarePt", "e", nPtBins, binsPt, 4, 0, 4);
+ else {
+ const TArrayD* histBins = hPIDdata->GetAxis(axisForMode)->GetXbins();
+ if (histBins->fN == 0)
+ hReducedChiSquarePt = new TH2F(Form("hReducedChiSquare%s", modeShortName[mode].Data()), "e",
+ hPIDdata->GetAxis(axisForMode)->GetNbins(), hPIDdata->GetAxis(axisForMode)->GetXmin(),
+ hPIDdata->GetAxis(axisForMode)->GetXmax(), 4, 0, 4);
+ else
+ hReducedChiSquarePt = new TH2F(Form("hReducedChiSquare%s", modeShortName[mode].Data()), "e",
+ hPIDdata->GetAxis(axisForMode)->GetNbins(), histBins->fArray, 4, 0, 4);
+ }
+
+ hReducedChiSquarePt->GetXaxis()->SetTitle(hPIDdata->GetAxis(axisForMode)->GetTitle());
+ hReducedChiSquarePt->GetYaxis()->SetTitle("Delta_{Species}");
+ hReducedChiSquarePt->GetYaxis()->SetBinLabel(1, "e");
+ hReducedChiSquarePt->GetYaxis()->SetBinLabel(2, "K");
+ hReducedChiSquarePt->GetYaxis()->SetBinLabel(3, "#pi");
+ hReducedChiSquarePt->GetYaxis()->SetBinLabel(4, "p");
+ hReducedChiSquarePt->SetMarkerColor(kRed);
+ hReducedChiSquarePt->SetMarkerStyle(20);
+ hReducedChiSquarePt->SetStats(kFALSE);
+
+ // Obtain MC information about particle yields
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(1, 1); // Do not count each particle more than once
+ TH2D* hMCdata = (TH2D*)hPIDdata->Projection(kPidMCpid, axisForMode, "e");
+ hMCdata->SetName("hMCdata");
+ hPIDdata->GetAxis(kPidSelectSpecies)->SetRange(0, -1); // Reset range
+
+
+
+ // Extract the MC truth generated primary yields
+ THnSparse* hMCgeneratedYieldsPrimaries = isMCdataSet ? dynamic_cast<THnSparse*>(histList->FindObject("fhMCgeneratedYieldsPrimaries"))
+ : 0x0;
+
+ TH1D* hMCgenYieldsPrimSpecies[AliPID::kSPECIES];
+ for (Int_t i = 0; i < AliPID::kSPECIES; i++)
+ hMCgenYieldsPrimSpecies[i] = 0x0;
+
+ if (hMCgeneratedYieldsPrimaries) {
+ // Set proper errors, if not yet calculated
+ if (!hMCgeneratedYieldsPrimaries->GetCalculateErrors()) {
+ std::cout << "Re-calculating errors of " << hMCgeneratedYieldsPrimaries->GetName() << "..." << std::endl;
+
+ hMCgeneratedYieldsPrimaries->Sumw2();
+
+ Long64_t nBinsTHnSparseGenYield = hMCgeneratedYieldsPrimaries->GetNbins();
+ Double_t binContentGenYield = 0;
+ for (Long64_t bin = 0; bin < nBinsTHnSparseGenYield; bin++) {
+ binContentGenYield = hMCgeneratedYieldsPrimaries->GetBinContent(bin);
+ hMCgeneratedYieldsPrimaries->SetBinError(bin, TMath::Sqrt(binContentGenYield));
+ }
+ }
+
+ if (restrictJetPtAxis)
+ hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldJetPt)->SetRange(lowerJetPtBinLimit, upperJetPtBinLimit);
+
+ if (restrictCentralityAxis)
+ hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldCentrality)->SetRange(lowerCentralityBinLimit, upperCentralityBinLimit);
+
+
+ if (restrictCharge) {
+ const Int_t indexChargeAxisGenYield = GetAxisByTitle(hMCgeneratedYieldsPrimaries, "Charge (e_{0})");
+ if (indexChargeAxisGenYield < 0) {
+ std::cout << "Error: Charge axis not found for gen yield histogram!" << std::endl;
+ return -1;
+ }
+
+ Int_t lowerChargeBinLimitGenYield = -1;
+ Int_t upperChargeBinLimitGenYield = -2;
+ Double_t actualLowerChargeGenYield = -999;
+ Double_t actualUpperChargeGenYield = -999;
+
+ // Add subtract a very small number to avoid problems with values right on the border between to bins
+ if (chargeMode == kNegCharge) {
+ lowerChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(-1. + 0.001);
+ upperChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(0. - 0.001);
+ }
+ else if (chargeMode == kPosCharge) {
+ lowerChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(0. + 0.001);
+ upperChargeBinLimitGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->FindBin(1. - 0.001);
+ }
+
+ // Check if the values look reasonable
+ if (lowerChargeBinLimitGenYield <= upperChargeBinLimitGenYield && lowerChargeBinLimitGenYield >= 1
+ && upperChargeBinLimitGenYield <= hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->GetNbins()) {
+ actualLowerChargeGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->GetBinLowEdge(lowerChargeBinLimitGenYield);
+ actualUpperChargeGenYield = hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->GetBinUpEdge(upperChargeBinLimitGenYield);
+
+ if (TMath::Abs(actualLowerChargeGenYield - actualLowerChargeData) > 1e-4 ||
+ TMath::Abs(actualUpperChargeGenYield - actualUpperChargeData) > 1e-4) {
+ std::cout << std::endl;
+ std::cout << "Error: Charge range gen yield: " << actualLowerChargeGenYield << " - " << actualUpperChargeGenYield
+ << std::endl << "differs from that of data: " << actualLowerChargeData << " - " << actualUpperChargeData
+ << std::endl;
+ return -1;
+ }
+ }
+ else {
+ std::cout << std::endl;
+ std::cout << "Requested charge range (gen yield) out of limits or upper and lower limit are switched!" << std::endl;
+ return -1;
+ }
+
+ hMCgeneratedYieldsPrimaries->GetAxis(indexChargeAxisGenYield)->SetRange(lowerChargeBinLimitGenYield, upperChargeBinLimitGenYield);
+ }
+
+ for (Int_t MCid = 0; MCid < AliPID::kSPECIES; MCid++) {
+ hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldMCpid)->SetRange(MCid + 1, MCid + 1);
+
+ hMCgenYieldsPrimSpecies[MCid] = hMCgeneratedYieldsPrimaries->Projection(kPidGenYieldPt, "e");
+ hMCgenYieldsPrimSpecies[MCid]->SetName(Form("hMCgenYieldsPrimSpecies_%s", AliPID::ParticleShortName(MCid)));
+ hMCgenYieldsPrimSpecies[MCid]->SetTitle(Form("MC truth generated primary yield, %s", AliPID::ParticleName(MCid)));
+
+ // Choose the same binning as for the fitted yields, i.e. rebin the histogram (Rebin will create a clone!)
+ TH1D* temp = (TH1D*)hMCgenYieldsPrimSpecies[MCid]->Rebin(nPtBins, hMCgenYieldsPrimSpecies[MCid]->GetName(), binsPt);
+ // Delete the old binned histo and take the new binned one
+ delete hMCgenYieldsPrimSpecies[MCid];
+ hMCgenYieldsPrimSpecies[MCid] = temp;
+
+ hMCgeneratedYieldsPrimaries->GetAxis(kPidGenYieldMCpid)->SetRange(0, -1);
+ }
+ }
+
+
+ // Get expected shapes for pT bins
+ TString Ytitle = "";
+
+ // Array index 0 as unused dummy
+ TH2D* hGenDelta[6][6]; // DeltaSpecies (first index) for species (second index)
+ TH2D* hGenDeltaMCid[6][6]; // DeltaSpecies (first index) for species (second index)
+
+ for (Int_t i = 0; i < 6; i++) {
+ for (Int_t j = 0; j < 6; j++) {
+ hGenDelta[i][j] = 0x0;
+ hGenDeltaMCid[i][j] = 0x0;
+ }
+ }
+
+ THnSparse* current = 0x0;
+
+ THnSparse* hGenEl = dynamic_cast<THnSparse*>(histList->FindObject("hGenEl"));
+ if (!hGenEl) {
+ std::cout << "Failed to load expected dEdx signal shape for: Electrons!" << std::endl;
+ return -1;
+ }
+
+ THnSparse* hGenKa = dynamic_cast<THnSparse*>(histList->FindObject("hGenKa"));
+ if (!hGenKa) {
+ std::cout << "Failed to load expected dEdx signal shape for: Kaons!" << std::endl;
+ return -1;
+ }
+
+ THnSparse* hGenPi = dynamic_cast<THnSparse*>(histList->FindObject("hGenPi"));
+ if (!hGenPi) {
+ std::cout << "Failed to load expected dEdx signal shape for: Pions!" << std::endl;
+ return -1;
+ }
+
+ THnSparse* hGenMu = dynamic_cast<THnSparse*>(histList->FindObject("hGenMu"));
+ if (!hGenMu) {
+ std::cout << "Failed to load expected dEdx signal shape for: Muons! Treated muons as pions in the following." << std::endl;
+ takeIntoAccountMuons = kFALSE;
+ }
+
+ THnSparse* hGenPr = dynamic_cast<THnSparse*>(histList->FindObject("hGenPr"));
+ if (!hGenPr) {
+ std::cout << "Failed to load expected dEdx signal shape for: Protons!" << std::endl;
+ return -1;
+ }
+
+ for (Int_t MCid = kEl; MCid <= kPr; MCid++) {
+ if (MCid == kEl)
+ current = hGenEl;
+ else if (MCid == kKa)
+ current = hGenKa;
+ else if (MCid == kMu) {
+ if (takeIntoAccountMuons)
+ current = hGenMu;
+ else
+ continue; // No histo for muons in this case
+ }
+ else if (MCid == kPi)
+ current = hGenPi;
+ else if (MCid == kPr)
+ current = hGenPr;
+ else
+ break;
+
+ // If desired, rebin considered axis
+ if (rebin > 1 || rebinDeltaPrime > 1) {
+ const Int_t nDimensions = current->GetNdimensions();
+ Int_t rebinFactor[nDimensions];
+
+ for (Int_t dim = 0; dim < nDimensions; dim++) {
+ if (dim == axisGenForMode)
+ rebinFactor[dim] = rebin;
+ else if (dim == kPidGenDeltaPrime && rebinDeltaPrime > 1)
+ rebinFactor[dim] = rebinDeltaPrime;
+ else
+ rebinFactor[dim] = 1;
+ }
+
+ THnSparse* temp = current->Rebin(&rebinFactor[0]);
+ current->Reset();
+ current = temp;
+ }
+
+ // Set proper errors, if not yet calculated
+ if (!current->GetCalculateErrors()) {
+ std::cout << "Re-calculating errors of " << current->GetName() << "..." << std::endl;
+
+ current->Sumw2();
+
+ Long64_t nBinsTHnSparseGen = current->GetNbins();
+ Double_t binContentGen = 0;
+ for (Long64_t bin = 0; bin < nBinsTHnSparseGen; bin++) {
+ binContentGen = current->GetBinContent(bin);
+ current->SetBinError(bin, TMath::Sqrt(binContentGen));
+ }
+ }
+
+ // If desired, restrict centrality range
+ if (restrictCentralityAxis) {
+ current->GetAxis(kPidGenCentrality)->SetRange(lowerCentralityBinLimit, upperCentralityBinLimit);
+ }
+
+ // If desired, restrict jet pT range
+ if (restrictJetPtAxis) {
+ current->GetAxis(kPidGenJetPt)->SetRange(lowerJetPtBinLimit, upperJetPtBinLimit);
+ }
+
+ // If desired, restrict charge range
+ if (restrictCharge) {
+ const Int_t indexChargeAxisGen = GetAxisByTitle(current, "Charge (e_{0})");
+ if (indexChargeAxisGen < 0) {
+ std::cout << "Error: Charge axis not found for gen histogram!" << std::endl;
+ return -1;
+ }
+
+ Int_t lowerChargeBinLimitGen = -1;
+ Int_t upperChargeBinLimitGen = -2;
+ Double_t actualLowerChargeGen = -999;
+ Double_t actualUpperChargeGen = -999;
+
+ // Add subtract a very small number to avoid problems with values right on the border between to bins
+ if (chargeMode == kNegCharge) {
+ lowerChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(-1. + 0.001);
+ upperChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(0. - 0.001);
+ }
+ else if (chargeMode == kPosCharge) {
+ lowerChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(0. + 0.001);
+ upperChargeBinLimitGen = current->GetAxis(indexChargeAxisGen)->FindBin(1. - 0.001);
+ }
+
+ // Check if the values look reasonable
+ if (lowerChargeBinLimitGen <= upperChargeBinLimitGen && lowerChargeBinLimitGen >= 1
+ && upperChargeBinLimitGen <= current->GetAxis(indexChargeAxisGen)->GetNbins()) {
+ actualLowerChargeGen = current->GetAxis(indexChargeAxisGen)->GetBinLowEdge(lowerChargeBinLimitGen);
+ actualUpperChargeGen = current->GetAxis(indexChargeAxisGen)->GetBinUpEdge(upperChargeBinLimitGen);
+
+ if (TMath::Abs(actualLowerChargeGen - actualLowerChargeData) > 1e-4 ||
+ TMath::Abs(actualUpperChargeGen - actualUpperChargeData) > 1e-4) {
+ std::cout << std::endl;
+ std::cout << "Error: Charge range gen: " << actualLowerChargeGen << " - " << actualUpperChargeGen
+ << std::endl << "differs from that of data: " << actualLowerChargeData << " - " << actualUpperChargeData
+ << std::endl;
+ return -1;
+ }
+ }
+ else {
+ std::cout << std::endl;
+ std::cout << "Requested charge range (gen) out of limits or upper and lower limit are switched!" << std::endl;
+ return -1;
+ }
+
+ current->GetAxis(indexChargeAxisGen)->SetRange(lowerChargeBinLimitGen, upperChargeBinLimitGen);
+ }
+
+
+
+ for (Int_t selectBin = 1; selectBin <= 4; selectBin++) {
+ Int_t selectMCid = (selectBin >= 3) ? (selectBin+1) : selectBin;
+
+ current->GetAxis(kPidGenSelectSpecies)->SetRange(selectBin, selectBin);
+
+ Ytitle = Form("#Delta%s_{%s} = dE/dx %s <dE/dx>_{%s} (arb. units)", useDeltaPrime ? "'" : "",
+ partShortName[selectMCid - 1].Data(), useDeltaPrime ? "/" : "-",
+ partShortName[selectMCid - 1].Data());
+
+ TH2* hGenCurrent = 0x0;
+ if (!useIdentifiedGeneratedSpectra) {
+ hGenDelta[selectMCid][MCid] = current->Projection(genAxis, axisGenForMode, "e");
+ hGenDelta[selectMCid][MCid]->SetName(Form("hGenDelta%sFor%s", partShortName[selectMCid - 1].Data(),
+ partShortName[MCid - 1].Data()));
+ hGenCurrent = hGenDelta[selectMCid][MCid];
+ }
+ else {
+ current->GetAxis(kPidGenMCpid)->SetRange(MCid, MCid);
+ hGenDeltaMCid[selectMCid][MCid] = current->Projection(genAxis, axisGenForMode, "e");
+ hGenDeltaMCid[selectMCid][MCid]->SetName(Form("hGenDelta%sForMCid%s", partShortName[selectMCid - 1].Data(),
+ partShortName[MCid - 1].Data()));
+
+ hGenCurrent = hGenDeltaMCid[selectMCid][MCid];
+ current->GetAxis(kPidGenMCpid)->SetRange(0, -1);
+ }
+
+ hGenCurrent->GetYaxis()->SetTitle(Ytitle.Data());
+ hGenCurrent->SetLineColor(getLineColor(MCid));
+ hGenCurrent->SetMarkerColor(getLineColor(MCid));
+ hGenCurrent->SetLineWidth(2);
+ hGenCurrent->SetLineStyle(2);
+ hGenCurrent->SetMarkerStyle(20);
+ hGenCurrent->GetXaxis()->SetTitleOffset(1.0);
+ }
+
+ current->GetAxis(kPidGenSelectSpecies)->SetRange(0, -1);
+ }
+
+ // Free a lot of memory for the following procedure. Histogram is not needed anymore (only its projections)
+ delete f;
+
+ // Save intermediate results
+ //TODO save intermediate TOF results
+ saveInterF->cd();
+
+ if (hMCdata)
+ hMCdata->Write();
+
+ for (Int_t i = 0; i < 6; i++) {
+ for (Int_t j = 0; j < 6; j++) {
+ if (hGenDelta[i][j])
+ hGenDelta[i][j]->Write();
+
+ if (hGenDeltaMCid[i][j])
+ hGenDeltaMCid[i][j]->Write();
+ }
+ }
+
+ for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hFractionPions->GetXaxis()->GetNbins(); slice++) {
+ if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))
+ continue;
+
+ if(hDeltaPi[slice])
+ hDeltaPi[slice]->Write();
+ if(hDeltaEl[slice])
+ hDeltaEl[slice]->Write();
+ if(hDeltaKa[slice])
+ hDeltaKa[slice]->Write();
+ if(hDeltaPr[slice])
+ hDeltaPr[slice]->Write();
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++) {
+ hDeltaElMC[slice][species]->Write();
+ hDeltaKaMC[slice][species]->Write();
+ hDeltaPiMC[slice][species]->Write();
+ hDeltaPrMC[slice][species]->Write();
+ }
+ }
+ }
+
+ // File may not be closed because the projections are needed in the following!
+ //saveInterF->Close();
+
+ // Save some first results for the final output
+ TString saveFName = fileName;
+ saveFName = Form("%s_results_%s__%s_%d_reg%d_regFac%.2f_%s%s%s%s%s.root", saveFName.ReplaceAll(".root", "").Data(),
+ useLogLikelihood ? (useWeightsForLogLikelihood ? "weightedLLFit" : "LLFit") : "ChiSquareFit",
+ modeShortName[mode].Data(), fitMethod, regularisation, regularisationFactor,
+ muonFractionHandlingShortName[muonFractionHandlingParameter].Data(),
+ useIdentifiedGeneratedSpectra ? "_idSpectra" : "",
+ restrictCentralityAxis ? Form("_centrality%.0f_%.0f", actualLowerCentrality, actualUpperCentrality) : "",
+ restrictJetPtAxis ? Form("_jetPt%.1f_%.1f", actualLowerJetPt, actualUpperJetPt) : "",
+ chargeString.Data());
+ TFile *saveF = TFile::Open(saveFName.Data(), "RECREATE");
+ saveF->cd();
+
+ if (hFractionElectrons)
+ hFractionElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaons)
+ hFractionKaons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPions)
+ hFractionPions->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtons)
+ hFractionProtons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuons)
+ hFractionMuons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionSummed)
+ hFractionSummed->Write(0, TObject::kWriteDelete);
+
+ if (hFractionElectronsMC)
+ hFractionElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsMC)
+ hFractionKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsMC)
+ hFractionPionsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsMC)
+ hFractionMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsMC)
+ hFractionProtonsMC->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectrons)
+ hYieldElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaons)
+ hYieldKaons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPions)
+ hYieldPions->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtons)
+ hYieldProtons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuons)
+ hYieldMuons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldElectronsMC)
+ hYieldElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsMC)
+ hYieldMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsMC)
+ hYieldKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsMC)
+ hYieldPionsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsMC)
+ hYieldProtonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldSummedMC)
+ hYieldSummedMC->Write(0, TObject::kWriteDelete);
+
+
+ if (hRatioToPiElectrons)
+ hRatioToPiElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiMuons)
+ hRatioToPiMuons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiKaons)
+ hRatioToPiKaons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiProtons)
+ hRatioToPiProtons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiElectronsMC)
+ hRatioToPiElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiMuonsMC)
+ hRatioToPiMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiKaonsMC)
+ hRatioToPiKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiProtonsMC)
+ hRatioToPiProtonsMC->Write(0, TObject::kWriteDelete);
+
+
+ // Dummy histo to create generic legend entries from
+ TH1D* hMCmuonsAndPionsDummy = 0x0;
+ if (plotIdentifiedSpectra && firstValidSlice >= 0) {
+ hMCmuonsAndPionsDummy = new TH1D(*hDeltaPiMC[firstValidSlice][kPi]);
+ hMCmuonsAndPionsDummy->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPionsDummy->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPionsDummy->SetName("hMCmuonsAndPionsDummy");
+ }
+
+
+ muonFractionThresholdForFitting = 0.;//OLD 0.295;
+ muonFractionThresholdBinForFitting = (mode == kPMpT) ? FindMomentumBin(binsPt, muonFractionThresholdForFitting) : -1;
+
+ electronFractionThresholdForFitting = 9.;
+ electronFractionThresholdBinForFitting = (mode == kPMpT) ? FindMomentumBin(binsPt, electronFractionThresholdForFitting) : -1;
+
+ lastPtForCallOfGetElectronFraction = pHigh + 10.; // Make sure that this value is higher than in any call during the fit
+
+ fElectronFraction = new TF1("fElectronFraction", Form("[0]+(x<%f)*[1]*(x-%f)", electronFractionThresholdForFitting,
+ electronFractionThresholdForFitting),
+ pLow, pHigh);
+ fElectronFraction->SetParameters(0.01, 0.0);
+
+
+
+ TString speciesLabel[4] = {"El", "Ka", "Pi", "Pr" };
+
+ const Double_t binWidthFitHisto = 1.0; // Not used any longer
+
+ // In case of regularisation, the actual number of x bins and the (for pT: logs of their) bin centres are required
+ Int_t numXBins = 0;
+ Double_t* xBinCentres = 0x0;
+ Double_t* xBinStatisticalWeight = 0x0;
+ Double_t* xBinStatisticalWeightError = 0x0;
+
+ // Set the number of parameters per x bin:
+ // Regularisation only implemented for simultaneous fit.
+ const Int_t numParamsPerXbin = AliPID::kSPECIES + 1; // Fractions of each species + total yield in x bin
+
+ // Construct the array of all the parameters that are to be regularised, i.e. only the FREE fractions
+ // and NOT the total yields or the x bin
+ Int_t nParToRegulariseSimultaneousFit = 0;
+ Int_t* indexParametersToRegularise = 0x0;
+ Int_t* lastNotFixedIndexOfParameters = 0x0;
+
+ if (regularisation > 0) {
+ Int_t xBinIndexTemp = 0;
+ Int_t internalParIndexTemp = 0;
+
+ // Loop twice over data: Determine the number of bins in the first iteration, allocate the memory and fill in the 2. iteration
+ for (Int_t i = 0; i < 2; i++) {
+ if (i == 1) {
+ if (numXBins == 0) {
+ printf("No bins for fitting! Exiting...\n");
+
+ return -1;
+ }
+ if (nParToRegulariseSimultaneousFit == 0) {
+ printf("No parameters to regularise! Exiting...\n");
+
+ return -1;
+ }
+
+ xBinCentres = new Double_t[numXBins];
+ xBinStatisticalWeight = new Double_t[numXBins];
+ xBinStatisticalWeightError = new Double_t[numXBins];
+
+ indexParametersToRegularise = new Int_t[nParToRegulariseSimultaneousFit];
+
+ lastNotFixedIndexOfParameters = new Int_t[numParamsPerXbin];
+
+ // Set last not fixed index of parameter to numXBins, i.e. a index larger than any existing index.
+ // This will not restrict the parameter regularisation range. In the following, the range for electrons
+ // and muons will be restricted
+ for (Int_t iPar = 0; iPar < numParamsPerXbin; iPar++)
+ lastNotFixedIndexOfParameters[iPar] = numXBins;
+ }
+
+
+ for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hFractionPions->GetXaxis()->GetNbins(); slice++) {
+ if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))
+ continue;
+
+ // There won't (actually: shouldn't) be tracks with a pT larger than the jet pT
+ if (mode == kPMpT && restrictJetPtAxis && binsPt[slice] >= actualUpperJetPt)
+ continue;
+
+ const Int_t pBinLowProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice] + 1e-5) : slice + 1;
+ const Int_t pBinUpProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice + 1]- 1e-5) : slice + 1;
+
+ // NOTE: In case of regularisation, only the simultaneous fit values will be used, i.e. totalYield and not allDeltaSpecies!
+
+ // Also take into account bin width in delta(Prime) plots -> Multiply by binWidthFitHisto
+ Double_t totalYieldError = 0;
+ const Double_t totalYield = binWidthFitHisto * hYieldPt->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, totalYieldError);
+ totalYieldError *= binWidthFitHisto;
+
+ if (totalYield <= 0)
+ continue;
+
+ if (i == 1) {
+ if (mode == kPMpT)
+ // Take the logarithm in case of pT
+ xBinCentres[xBinIndexTemp] = TMath::Log((binsPt[slice + 1] + binsPt[slice]) / 2.);
+ else
+ xBinCentres[xBinIndexTemp] = hFractionPions->GetXaxis()->GetBinCenter(slice + 1);
+
+ xBinStatisticalWeight[xBinIndexTemp] = totalYield;
+
+ // NOTE: The total yield is a fact - a number w/o error. However, one assigns this error here to use it
+ // to calculate the effective weighting for the weighted likelihood fit (and the error is only used for this).
+ // So, it is more like a weighting than an error...
+ xBinStatisticalWeightError[xBinIndexTemp] = totalYieldError;
+
+
+ // Mark the fractions for all species except for electrons and muons in this bin for regularisation
+ for (Int_t speciesIndex = 0; speciesIndex < AliPID::kSPECIES - 2; speciesIndex++)
+ indexParametersToRegularise[internalParIndexTemp++] = numParamsPerXbin * xBinIndexTemp + speciesIndex;
+
+ // Also mark electrons for regularisation in this bin, if not fixed
+ if( !(mode == kPMpT && slice >= electronFractionThresholdBinForFitting) ) {
+ indexParametersToRegularise[internalParIndexTemp++] = numParamsPerXbin * xBinIndexTemp + 3;
+ }
+ else {
+ // Set the index of the last x bin in which the parameter is not fixed.
+ // If the parameter is fixed in all x bins, this index will be -1.
+ if (xBinIndexTemp - 1 < lastNotFixedIndexOfParameters[3])
+ lastNotFixedIndexOfParameters[3] = xBinIndexTemp - 1;
+ }
+
+ // Also mark muons for regularisation in this bin, if not fixed
+ if( !(mode != kPMpT || slice >= muonFractionThresholdBinForFitting) ) {
+ indexParametersToRegularise[internalParIndexTemp++] = numParamsPerXbin * xBinIndexTemp + 4;
+ }
+ else {
+ // Set the index of the last x bin in which the parameter is not fixed.
+ // If the parameter is fixed in all x bins, this index will be -1.
+ if (xBinIndexTemp - 1 < lastNotFixedIndexOfParameters[4])
+ lastNotFixedIndexOfParameters[4] = xBinIndexTemp - 1;
+ }
+
+ xBinIndexTemp++;
+ }
+
+ if (i == 0) {
+ nParToRegulariseSimultaneousFit += AliPID::kSPECIES - 2; // Fracs for all species in this bin except for electrons and muons
+
+ if( !(mode == kPMpT && slice >= electronFractionThresholdBinForFitting) )
+ nParToRegulariseSimultaneousFit++; // Also regularise electrons in this bin (not fixed)
+
+ if( !(mode != kPMpT || slice >= muonFractionThresholdBinForFitting) )
+ nParToRegulariseSimultaneousFit++; // Also regularise muons in this bin (not fixed)
+
+ numXBins++;
+ }
+ }
+ }
+ }
+ AliTPCPIDmathFit* mathFit = 0x0;
+
+ if (regularisation > 0) {
+ mathFit = (fitMethod == 2) ? AliTPCPIDmathFit::Instance(numXBins, 4, 1810)
+ : AliTPCPIDmathFit::Instance(numXBins, 1, 1810);
+ }
+ else {
+ mathFit = (fitMethod == 2) ? AliTPCPIDmathFit::Instance(1, 4, 1810)
+ : AliTPCPIDmathFit::Instance(1, 1, 1810);
+ }
+
+ mathFit->SetDebugLevel(0);
+ mathFit->SetEpsilon(5e-05);
+ mathFit->SetMaxCalls(1e8);
+
+ mathFit->SetMinimisationStrategy(minimisationStrategy);
+
+ mathFit->SetUseLogLikelihood(useLogLikelihood);
+ mathFit->SetUseWeightsForLogLikelihood(useWeightsForLogLikelihood);
+
+ if (fitMethod == 2) {
+ // If the deltaPrime range is large enough, we artificially get a factor 4 in statistics by looking at the four
+ // different deltaPrimeSpecies, which have (except for binning effects) the same information.
+ // Therefore, to get the "real" statistical error, we need to multiply the obtained error by sqrt(4) = 2
+ mathFit->SetScaleFactorError(2.);
+ }
+
+ mathFit->SetRegularisation(regularisation, regularisationFactor);
+
+ // Number of parameters for fitting
+ const Int_t nPar = 11;
+
+ // Fracs of each species + total yield in x bin
+ const Int_t nParSimultaneousFit = AliPID::kSPECIES + 1;
+
+ // Fracs of each species in x bin + tot yield in x bin
+ const Int_t nParSimultaneousFitRegularised = numXBins * (AliPID::kSPECIES + 1);
+
+ if (regularisation > 0) {
+ if (!mathFit->SetParametersToRegularise(nParToRegulariseSimultaneousFit, numParamsPerXbin, indexParametersToRegularise,
+ lastNotFixedIndexOfParameters, xBinCentres, xBinStatisticalWeight,
+ xBinStatisticalWeightError))
+ return -1;
+ }
+
+ delete xBinCentres;
+ xBinCentres = 0x0;
+
+ delete xBinStatisticalWeight;
+ xBinStatisticalWeight = 0x0;
+
+ delete xBinStatisticalWeightError;
+ xBinStatisticalWeight = 0x0;
+
+ delete indexParametersToRegularise;
+ indexParametersToRegularise = 0x0;
+
+ delete lastNotFixedIndexOfParameters;
+ lastNotFixedIndexOfParameters = 0x0;
+
+
+
+ gFractionElectronsData = new TGraphErrors(numXBins);
+
+ // Fit each slice with sum of 4/5 shapes with means and sigmas fixed from last fitting step
+ // For electrons: Fit up to certain pT bin and use constant value for higher momenta
+
+ // Two iterations required for regularisation
+ Bool_t regularisedFitDone = kFALSE;
+ Double_t reducedChiSquareRegularisation = -1;
+
+ Double_t gausParamsSimultaneousFitRegularised[nParSimultaneousFitRegularised];
+ Double_t parameterErrorsOutRegularised[nParSimultaneousFitRegularised];
+ Double_t lowParLimitsSimultaneousFitRegularised[nParSimultaneousFitRegularised];
+ Double_t upParLimitsSimultaneousFitRegularised[nParSimultaneousFitRegularised];
+ Double_t stepSizeSimultaneousFitRegularised[nParSimultaneousFitRegularised];
+
+ for (Int_t i = 0; i < nParSimultaneousFitRegularised; i++) {
+ gausParamsSimultaneousFitRegularised[i] = 0;
+ parameterErrorsOutRegularised[i] = 0;
+ lowParLimitsSimultaneousFitRegularised[i] = 0;
+ upParLimitsSimultaneousFitRegularised[i] = 0;
+ stepSizeSimultaneousFitRegularised[i] = 0;
+ }
+
+ mathFit->ClearRefHistos();
+
+
+ const Int_t nParUsed = (fitMethod == 2) ? ((regularisation <= 0) ? nParSimultaneousFit: nParSimultaneousFitRegularised) : nPar;
+ Double_t parameterErrorsOut[nParUsed];
+ Double_t covMatrix[nParUsed][nParUsed];
+
+ for (Int_t iter = 0; iter < 2; iter++) {
+ if (regularisation <= 0 && iter == 0)
+ continue; // Only one iteration w/o regularisation
+
+ Int_t currXbin = 0;
+
+ for (Int_t slice = 0; (mode == kPMpT) ? slice < nPtBins : slice < hFractionPions->GetXaxis()->GetNbins(); slice++) {
+ if (mode == kPMpT && (slice < pSliceLow || slice > pSliceHigh))
+ continue;
+
+ // There won't (actually: shouldn't) be tracks with a pT larger than the jet pT
+ if (mode == kPMpT && restrictJetPtAxis && binsPt[slice] >= actualUpperJetPt)
+ continue;
+
+ if (regularisation <= 0) {
+ if (mode == kPMpT)
+ std::cout << "Fitting range " << binsPt[slice] << " GeV/c < Pt < " << binsPt[slice + 1] << " GeV/c..." << std::endl;
+ else {
+ std::cout << "Fitting range " << hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1) << " < " << modeShortName[mode].Data() << " < ";
+ std::cout << hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1) << "..." << std::endl;
+ }
+ }
+
+ // Add/subtract some very small offset to be sure not to sit on the bin boundary, when looking for the integration/projection limits.
+ const Int_t pBinLowProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice] + 1e-5) : slice + 1;
+ const Int_t pBinUpProjLimit = (mode == kPMpT) ? hYieldPt->GetXaxis()->FindBin(binsPt[slice + 1]- 1e-5) : slice + 1;
+
+ // Also take into account bin width in delta(Prime) plots -> Multiply by binWidthFitHisto
+ const Double_t totalYield = binWidthFitHisto * hYieldPt->Integral(pBinLowProjLimit, pBinUpProjLimit);
+
+ if (totalYield <= 0) {
+ std::cout << "Skipped bin (yield is zero)!" << std::endl;
+ continue;
+ }
+
+ const Double_t allDeltaPion = hDeltaPi[slice]->Integral();
+ const Double_t allDeltaElectron = hDeltaEl[slice]->Integral();
+ const Double_t allDeltaKaon = hDeltaKa[slice]->Integral();
+ const Double_t allDeltaProton = hDeltaPr[slice]->Integral();
+
+ // inverseBinWidth = 1.0, if the raw yield for each bin is requested.
+ // If divided by the bin size, the histograms give "yield per unit pT in the corresponding bin" or dN/dpT
+ Double_t inverseBinWidth = (mode == kPMpT) ? 1.0 / (binsPt[slice + 1] - binsPt[slice])
+ : 1.0 / hYieldPt->GetBinWidth(slice + 1);
+
+ TH1D *hGenDeltaElForElProj = 0x0, *hGenDeltaKaForElProj = 0x0, *hGenDeltaPiForElProj = 0x0, *hGenDeltaPrForElProj = 0x0;
+ TH1D *hGenDeltaElForKaProj = 0x0, *hGenDeltaKaForKaProj = 0x0, *hGenDeltaPiForKaProj = 0x0, *hGenDeltaPrForKaProj = 0x0;
+ TH1D *hGenDeltaElForPiProj = 0x0, *hGenDeltaKaForPiProj = 0x0, *hGenDeltaPiForPiProj = 0x0, *hGenDeltaPrForPiProj = 0x0;
+ TH1D *hGenDeltaElForMuProj = 0x0, *hGenDeltaKaForMuProj = 0x0, *hGenDeltaPiForMuProj = 0x0, *hGenDeltaPrForMuProj = 0x0;
+ TH1D *hGenDeltaElForPrProj = 0x0, *hGenDeltaKaForPrProj = 0x0, *hGenDeltaPiForPrProj = 0x0, *hGenDeltaPrForPrProj = 0x0;
+
+ TH2D* hGenDeltaUsed[6][6];
+ if (useIdentifiedGeneratedSpectra) {
+ for (Int_t i = 0; i < 6; i++) {
+ for (Int_t j = 0; j < 6; j++) {
+ hGenDeltaUsed[i][j] = hGenDeltaMCid[i][j];
+ }
+ }
+ }
+ else {
+ for (Int_t i = 0; i < 6; i++) {
+ for (Int_t j = 0; j < 6; j++) {
+ hGenDeltaUsed[i][j] = hGenDelta[i][j];
+ }
+ }
+ }
+
+ hGenDeltaElForElProj =(TH1D*)hGenDeltaUsed[kEl][kEl]->ProjectionY(Form("hGenDeltaElForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaKaForElProj =(TH1D*)hGenDeltaUsed[kKa][kEl]->ProjectionY(Form("hGenDeltaKaForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPiForElProj =(TH1D*)hGenDeltaUsed[kPi][kEl]->ProjectionY(Form("hGenDeltaPiForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPrForElProj =(TH1D*)hGenDeltaUsed[kPr][kEl]->ProjectionY(Form("hGenDeltaPrForElProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+
+ hGenDeltaElForKaProj =(TH1D*)hGenDeltaUsed[kEl][kKa]->ProjectionY(Form("hGenDeltaElForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaKaForKaProj =(TH1D*)hGenDeltaUsed[kKa][kKa]->ProjectionY(Form("hGenDeltaKaForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPiForKaProj =(TH1D*)hGenDeltaUsed[kPi][kKa]->ProjectionY(Form("hGenDeltaPiForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPrForKaProj =(TH1D*)hGenDeltaUsed[kPr][kKa]->ProjectionY(Form("hGenDeltaPrForKaProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+
+ hGenDeltaElForPiProj =(TH1D*)hGenDeltaUsed[kEl][kPi]->ProjectionY(Form("hGenDeltaElForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaKaForPiProj =(TH1D*)hGenDeltaUsed[kKa][kPi]->ProjectionY(Form("hGenDeltaKaForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPiForPiProj =(TH1D*)hGenDeltaUsed[kPi][kPi]->ProjectionY(Form("hGenDeltaPiForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPrForPiProj =(TH1D*)hGenDeltaUsed[kPr][kPi]->ProjectionY(Form("hGenDeltaPrForPiProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaElForMuProj =(TH1D*)hGenDeltaUsed[kEl][kMu]->ProjectionY(Form("hGenDeltaElForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaKaForMuProj =(TH1D*)hGenDeltaUsed[kKa][kMu]->ProjectionY(Form("hGenDeltaKaForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPiForMuProj =(TH1D*)hGenDeltaUsed[kPi][kMu]->ProjectionY(Form("hGenDeltaPiForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPrForMuProj =(TH1D*)hGenDeltaUsed[kPr][kMu]->ProjectionY(Form("hGenDeltaPrForMuProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ }
+
+ hGenDeltaElForPrProj =(TH1D*)hGenDeltaUsed[kEl][kPr]->ProjectionY(Form("hGenDeltaElForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaKaForPrProj =(TH1D*)hGenDeltaUsed[kKa][kPr]->ProjectionY(Form("hGenDeltaKaForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPiForPrProj =(TH1D*)hGenDeltaUsed[kPi][kPr]->ProjectionY(Form("hGenDeltaPiForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+ hGenDeltaPrForPrProj =(TH1D*)hGenDeltaUsed[kPr][kPr]->ProjectionY(Form("hGenDeltaPrForPrProj%d", slice), pBinLowProjLimit, pBinUpProjLimit, "e");
+
+
+
+ if (fitMethod == 2) {
+ // Normalise generated histos to TOTAL number of GENERATED particles for this species (i.e. including
+ // entries that lie in the under or overflow bin), so that situations in which the generated spectra lie
+ // at least partly outside the histo are treated properly. To find the total number of generated particle
+ // species X, one can just take the integral of the generated histo for DeltaX (which should include all
+ // generated entries) and apply the same normalisation factor to all other DeltaSpecies.
+ // Also set some cosmetics
+
+ // Generated electrons
+ Double_t normEl = normaliseHist(hGenDeltaElForElProj, -1);
+ normaliseHist(hGenDeltaKaForElProj, normEl);
+ normaliseHist(hGenDeltaPiForElProj, normEl);
+ normaliseHist(hGenDeltaPrForElProj, normEl);
+
+
+ // Generated kaons
+ Double_t normKa = normaliseHist(hGenDeltaKaForKaProj, -1);
+ normaliseHist(hGenDeltaElForKaProj, normKa);
+ normaliseHist(hGenDeltaPiForKaProj, normKa);
+ normaliseHist(hGenDeltaPrForKaProj, normKa);
+
+
+ // Generated pions
+ Double_t normPi = normaliseHist(hGenDeltaPiForPiProj, -1);
+ normaliseHist(hGenDeltaElForPiProj, normPi);
+ normaliseHist(hGenDeltaKaForPiProj, normPi);
+ normaliseHist(hGenDeltaPrForPiProj, normPi);
+
+
+ Double_t normMu = 1;
+ if (takeIntoAccountMuons) {
+ // Generated pions
+ // Since masses of muons and pions are so similar, the normalisation scheme should still work when looking at deltaPion instead
+ normMu = normaliseHist(hGenDeltaPiForMuProj, -1);
+ normaliseHist(hGenDeltaElForMuProj, normMu);
+ normaliseHist(hGenDeltaKaForMuProj, normMu);
+ normaliseHist(hGenDeltaPrForMuProj, normMu);
+ }
+
+
+ // Generated protons
+ Double_t normPr = normaliseHist(hGenDeltaPrForPrProj, -1);
+ normaliseHist(hGenDeltaElForPrProj, normPr);
+ normaliseHist(hGenDeltaKaForPrProj, normPr);
+ normaliseHist(hGenDeltaPiForPrProj, normPr);
+ }
+ else {
+ // Normalise generated histos to total number of particles for this delta
+ // and also set some cosmetics
+
+ // DeltaEl
+ normaliseHist(hGenDeltaElForElProj);
+ normaliseHist(hGenDeltaElForKaProj);
+ normaliseHist(hGenDeltaElForPiProj);
+ if (takeIntoAccountMuons)
+ normaliseHist(hGenDeltaElForMuProj);
+ normaliseHist(hGenDeltaElForPrProj);
+
+ // DeltaKa
+ normaliseHist(hGenDeltaKaForElProj);
+ normaliseHist(hGenDeltaKaForKaProj);
+ normaliseHist(hGenDeltaKaForPiProj);
+ if (takeIntoAccountMuons)
+ normaliseHist(hGenDeltaKaForMuProj);
+ normaliseHist(hGenDeltaKaForPrProj);
+
+ // DeltaPi
+ normaliseHist(hGenDeltaPiForElProj);
+ normaliseHist(hGenDeltaPiForKaProj);
+ normaliseHist(hGenDeltaPiForPiProj);
+ if (takeIntoAccountMuons)
+ normaliseHist(hGenDeltaPiForMuProj);
+ normaliseHist(hGenDeltaPiForPrProj);
+
+ // DeltaPr
+ normaliseHist(hGenDeltaPrForElProj);
+ normaliseHist(hGenDeltaPrForKaProj);
+ normaliseHist(hGenDeltaPrForPiProj);
+ if (takeIntoAccountMuons)
+ normaliseHist(hGenDeltaPrForMuProj);
+ normaliseHist(hGenDeltaPrForPrProj);
+ }
+
+
+ TF1* totalDeltaPion = 0x0;
+ TF1* totalDeltaKaon = 0x0;
+ TF1* totalDeltaProton = 0x0;
+ TF1* totalDeltaElectron = 0x0;
+
+ TLegend* legend = 0x0;
+
+ if (iter == 1) { // Only needed for second iteration (= the only iteration w/o regularisation)
+ // The number of parameters and their values will always be adjusted, such that using nPar parameters is fine
+ totalDeltaPion = new TF1(Form("totalDeltaPion_slice%d", slice), (fitMethod == 2) ? multiGaussFitDeltaPi : multiGaussFit,
+ xLow, xUp, nPar);
+ setUpFitFunction(totalDeltaPion, nBins);
+
+ totalDeltaKaon = new TF1(Form("totalDeltaKaon_slice%d", slice), (fitMethod == 2) ? multiGaussFitDeltaKa : multiGaussFit,
+ xLow, xUp, nPar);
+ setUpFitFunction(totalDeltaKaon, nBins);
+
+ totalDeltaProton = new TF1(Form("totalDeltaProton_slice%d", slice), (fitMethod == 2) ? multiGaussFitDeltaPr : multiGaussFit,
+ xLow, xUp, nPar);
+ setUpFitFunction(totalDeltaProton, nBins);
+
+ totalDeltaElectron = new TF1(Form("totalDeltaElectron_slice%d", slice),
+ (fitMethod == 2) ? multiGaussFitDeltaEl : multiGaussFit,
+ xLow, xUp, nPar);
+ setUpFitFunction(totalDeltaElectron, nBins);
+
+ // Legend is the same for all \Delta "species" plots
+ legend = new TLegend(0.722126, 0.605932, 0.962069, 0.925932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+ if (plotIdentifiedSpectra)
+ legend->SetNColumns(2);
+ legend->AddEntry((TObject*)0x0, "Fit", "");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry((TObject*)0x0, identifiedLabels[isMC].Data(), "");
+
+ legend->AddEntry(hDeltaPi[slice], "Data", "Lp");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry((TObject*)0x0, "", "");
+
+ legend->AddEntry(totalDeltaPion, "Multi-template fit", "L");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hMCmuonsAndPionsDummy, "#mu + #pi", "Lp");
+
+ if (takeIntoAccountMuons)
+ legend->AddEntry(hGenDeltaPiForMuProj, "#mu", "Lp");
+ else if (plotIdentifiedSpectra)
+ legend->AddEntry((TObject*)0x0, "", "");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hDeltaPiMC[slice][kMu - 1], "#mu", "Lp");
+
+ legend->AddEntry(hGenDeltaPiForPiProj, takeIntoAccountMuons ? "#pi" : "#pi + #mu", "Lp");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hDeltaPiMC[slice][kPi - 1], "#pi", "Lp");
+
+ legend->AddEntry(hGenDeltaPiForKaProj, "K", "Lp");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hDeltaPiMC[slice][kKa - 1], "K", "Lp");
+
+ legend->AddEntry(hGenDeltaPiForPrProj, "p", "Lp");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hDeltaPiMC[slice][kPr - 1], "p", "Lp");
+
+ legend->AddEntry(hGenDeltaPiForElProj, "e", "Lp");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hDeltaPiMC[slice][kEl -1], "e", "Lp");
+ }
+
+
+ // Allow tolerance of +-2% (for delta -> assume dEdx = 80 and take +-2%)
+ //const Double_t peakTolerance = (useDeltaPrime ? 0.8 : 1.0) / hGenDeltaElForElProj->GetXaxis()->GetBinWidth(1);
+ //const Double_t shiftStepSize = 0.01;
+ const Double_t peakTolerance = (useDeltaPrime ? 0.02 : 1.6);
+ const Double_t shiftStepSize = 0.01;
+
+ // Assume fractions vs. pT to be smooth. Allow 1 sigma variations from bin to bin. For small pT, the error will be very small.
+ // Therefore, allow at least a change of some percent.
+ const Double_t nSigma = 1.;
+ const Double_t minChange = 1.0; // This disables the sigma restriction
+
+ Double_t fractionPions = (muonContamination ? 0.87 : 0.88);
+
+ Double_t fractionErrorUpPions = 1.;
+ Double_t fractionErrorLowPions = 0.;
+
+ Int_t xBinInit = 0;
+ if (initialiseWithFractionsFromFile) {
+ Double_t xBinCentre = (mode == kPMpT) ? (binsPt[slice + 1] + binsPt[slice]) / 2.
+ : hYieldPt->GetXaxis()->GetBinCenter(slice + 1);
+ xBinInit = hInitFracPi->GetXaxis()->FindBin(xBinCentre);
+ fractionPions = hInitFracPi->GetBinContent(xBinInit) + (muonContamination ? hInitFracMu->GetBinContent(xBinInit) : 0.);
+ }
+ else {
+ // Set found fraction from last slice, if available. Note: Current bin for slice = slice + 1
+ // => Bin for last slice = slice
+ if (hFractionPions->GetBinContent(slice) > 0 && hFractionPions->GetBinError(slice) > 0) {
+ fractionPions = hFractionPions->GetBinContent(slice);
+ fractionErrorUpPions = TMath::Min(1.0, fractionPions + TMath::Max(minChange, nSigma * hFractionPions->GetBinError(slice)));
+ fractionErrorLowPions = TMath::Max(0.0, fractionPions - TMath::Max(minChange, nSigma * hFractionPions->GetBinError(slice)));
+ }
+ }
+
+ Double_t fractionKaons = 0.08;
+ Double_t fractionErrorUpKaons = 1.;
+ Double_t fractionErrorLowKaons = 0.;
+
+ if (initialiseWithFractionsFromFile) {
+ fractionKaons = hInitFracKa->GetBinContent(xBinInit);
+ }
+ else {
+ if (hFractionKaons->GetBinContent(slice) > 0 && hFractionKaons->GetBinError(slice) > 0) {
+ fractionKaons = hFractionKaons->GetBinContent(slice);
+ fractionErrorUpKaons = TMath::Min(1.0, fractionKaons + TMath::Max(minChange, nSigma * hFractionKaons->GetBinError(slice)));
+ fractionErrorLowKaons = TMath::Max(0.0, fractionKaons - TMath::Max(minChange, nSigma * hFractionKaons->GetBinError(slice)));
+ }
+ }
+
+ Double_t fractionProtons = 0.02;
+ Double_t fractionErrorUpProtons = 1.;
+ Double_t fractionErrorLowProtons = 0.;
+
+ if (initialiseWithFractionsFromFile) {
+ fractionProtons = hInitFracPr->GetBinContent(xBinInit);
+ }
+ else {
+ if (hFractionProtons->GetBinContent(slice) > 0 && hFractionProtons->GetBinError(slice) > 0) {
+ fractionProtons = hFractionProtons->GetBinContent(slice);
+ fractionErrorUpProtons = TMath::Min(1.0, fractionProtons +
+ TMath::Max(minChange, nSigma * hFractionProtons->GetBinError(slice)));
+ fractionErrorLowProtons = TMath::Max(0.0, fractionProtons -
+ TMath::Max(minChange, nSigma * hFractionProtons->GetBinError(slice)));
+ }
+ }
+
+ Double_t fractionElectrons = (takeIntoAccountMuons ? 0.01 : 0.02);
+ Double_t fractionErrorUpElectrons = 1.;
+ Double_t fractionErrorLowElectrons = 0.;
+
+ if (initialiseWithFractionsFromFile) {
+ fractionElectrons = hInitFracEl->GetBinContent(xBinInit);
+ }
+ else {
+ if (hFractionElectrons->GetBinContent(slice) > 0 && hFractionElectrons->GetBinError(slice) > 0) {
+ fractionElectrons = hFractionElectrons->GetBinContent(slice);
+ fractionErrorUpElectrons = TMath::Min(1.0, fractionElectrons +
+ TMath::Max(minChange, nSigma * hFractionElectrons->GetBinError(slice)));
+ fractionErrorLowElectrons = TMath::Max(0.0, fractionElectrons -
+ TMath::Max(minChange, nSigma * hFractionElectrons->GetBinError(slice)));
+ }
+ }
+
+ Double_t fractionMuons = (takeIntoAccountMuons ? 0.01 : 0.);
+ Double_t fractionErrorUpMuons = 1.;
+ Double_t fractionErrorLowMuons = 0.;
+ if (!takeIntoAccountMuons) {
+ fractionErrorUpMuons = 0.;
+ fractionErrorLowMuons = 0.;
+ }
+ else {
+ if (initialiseWithFractionsFromFile) {
+ fractionMuons = hInitFracMu->GetBinContent(xBinInit);
+ }
+ else {
+ if (hFractionMuons->GetBinContent(slice) > 0 && hFractionMuons->GetBinError(slice) > 0) {
+ fractionMuons = hFractionMuons->GetBinContent(slice);
+ fractionErrorUpMuons = TMath::Min(1.0, fractionMuons + TMath::Max(minChange, nSigma * hFractionMuons->GetBinError(slice)));
+ fractionErrorLowMuons = TMath::Max(0.0, fractionMuons - TMath::Max(minChange, nSigma * hFractionMuons->GetBinError(slice)));
+ }
+ }
+ }
+
+ Double_t gausParamsPi[nPar] = {
+ fractionPions,
+ fractionKaons,
+ fractionProtons,
+ fractionElectrons,
+ fractionMuons,
+ allDeltaPion,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+ Double_t gausParamsEl[nPar] = {
+ fractionPions,
+ fractionKaons,
+ fractionProtons,
+ fractionElectrons,
+ fractionMuons,
+ allDeltaElectron,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+ Double_t gausParamsKa[nPar] = {
+ fractionPions,
+ fractionKaons,
+ fractionProtons,
+ fractionElectrons,
+ fractionMuons,
+ allDeltaKaon,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+ Double_t gausParamsPr[nPar] = {
+ fractionPions,
+ fractionKaons,
+ fractionProtons,
+ fractionElectrons,
+ fractionMuons,
+ allDeltaProton,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+ Double_t lowParLimitsPi[nPar] = {
+ fractionErrorLowPions,
+ fractionErrorLowKaons,
+ fractionErrorLowProtons,
+ fractionErrorLowElectrons,
+ fractionErrorLowMuons,
+ allDeltaPion,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance
+ };
+
+ Double_t lowParLimitsEl[nPar] = {
+ fractionErrorLowPions,
+ fractionErrorLowKaons,
+ fractionErrorLowProtons,
+ fractionErrorLowElectrons,
+ fractionErrorLowMuons,
+ allDeltaElectron,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance
+ };
+
+ Double_t lowParLimitsKa[nPar] = {
+ fractionErrorLowPions,
+ fractionErrorLowKaons,
+ fractionErrorLowProtons,
+ fractionErrorLowElectrons,
+ fractionErrorLowMuons,
+ allDeltaKaon,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance
+ };
+
+ Double_t lowParLimitsPr[nPar] = {
+ fractionErrorLowPions,
+ fractionErrorLowKaons,
+ fractionErrorLowProtons,
+ fractionErrorLowElectrons,
+ fractionErrorLowMuons,
+ allDeltaProton,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance,
+ -peakTolerance
+ -peakTolerance
+ };
+
+
+ Double_t upParLimitsPi[nPar] = {
+ fractionErrorUpPions,
+ fractionErrorUpKaons,
+ fractionErrorUpProtons,
+ fractionErrorUpElectrons,
+ fractionErrorUpMuons,
+ allDeltaPion,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance
+ };
+
+ Double_t upParLimitsEl[nPar] = {
+ fractionErrorUpPions,
+ fractionErrorUpKaons,
+ fractionErrorUpProtons,
+ fractionErrorUpElectrons,
+ fractionErrorUpMuons,
+ allDeltaElectron,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance
+ };
+
+ Double_t upParLimitsKa[nPar] = {
+ fractionErrorUpPions,
+ fractionErrorUpKaons,
+ fractionErrorUpProtons,
+ fractionErrorUpElectrons,
+ fractionErrorUpMuons,
+ allDeltaKaon,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance
+ };
+
+ Double_t upParLimitsPr[nPar] = {
+ fractionErrorUpPions,
+ fractionErrorUpKaons,
+ fractionErrorUpProtons,
+ fractionErrorUpElectrons,
+ fractionErrorUpMuons,
+ allDeltaProton,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ peakTolerance,
+ };
+
+ Double_t stepSize[nPar] = {
+ 0.1,
+ 0.1,
+ 0.1,
+ 0.1,
+ (takeIntoAccountMuons ? 0.1 : 0.),
+
+ 0.0,
+
+ enableShift ? shiftStepSize : 0.,
+ enableShift ? shiftStepSize : 0.,
+ enableShift ? shiftStepSize : 0.,
+ enableShift ? shiftStepSize : 0.,
+ (enableShift && takeIntoAccountMuons) ? shiftStepSize : 0.
+ };
+
+
+ Double_t gausParamsSimultaneousFit[nParSimultaneousFit] = {
+ fractionPions,
+ fractionKaons,
+ fractionProtons,
+ fractionElectrons,
+ fractionMuons,
+ totalYield
+ // No shifts because they do not make too much sense (different eta + possible deviations from Bethe-Bloch in one x-Bin)
+ };
+
+ Double_t lowParLimitsSimultaneousFit[nParSimultaneousFit] = {
+ fractionErrorLowPions,
+ fractionErrorLowKaons,
+ fractionErrorLowProtons,
+ fractionErrorLowElectrons,
+ fractionErrorLowMuons,
+ totalYield
+ };
+
+ Double_t upParLimitsSimultaneousFit[nParSimultaneousFit] = {
+ fractionErrorUpPions,
+ fractionErrorUpKaons,
+ fractionErrorUpProtons,
+ fractionErrorUpElectrons,
+ fractionErrorUpMuons,
+ totalYield
+ };
+
+ Double_t stepSizeSimultaneousFit[nParSimultaneousFit] = {
+ 0.1,
+ 0.1,
+ 0.1,
+ 0.1,
+ (takeIntoAccountMuons ? 0.1 : 0.),
+
+ 0.0
+ };
+
+ if (regularisation <= 0 && iter == 1) {
+ // In case of no regularisation, do the fit of the electron fraction here (compare comment below)
+ if (mode == kPMpT && slice == electronFractionThresholdBinForFitting)
+ hFractionElectrons->Fit(fElectronFraction, "N", "", lowFittingBoundElectronFraction, electronFractionThresholdForFitting);
+ }
+
+ if ((regularisation > 0 && iter == 0) || (regularisation <= 0 && iter == 1)) {
+ // Set the electron fraction to the negative pT -> A function will be used
+ // to evaluate the electron fraction for each bin above the threshold
+ if(mode == kPMpT && slice >= electronFractionThresholdBinForFitting) {
+ // In case of no regularisation, mathFit has no information about the fraction of other x bins.
+ // Thus, the electron fraction is evaluated and set here. For the case w/ regularisation,
+ // just "-pT" is set and the electron fraction will be evaluated during the fit.
+ Double_t fixElectronFraction = (regularisation <= 0) ? fElectronFraction->Eval((binsPt[slice + 1] + binsPt[slice]) / 2.)
+ : -(binsPt[slice + 1] + binsPt[slice]) / 2.;
+
+ if (regularisation <= 0) {
+ fixElectronFraction = TMath::Min(1.0, fixElectronFraction);
+ fixElectronFraction = TMath::Max(0.0, fixElectronFraction);
+ }
+
+ gausParamsPi[3] = fixElectronFraction;
+ lowParLimitsPi[3] = fixElectronFraction;
+ upParLimitsPi[3] = fixElectronFraction;
+
+ gausParamsEl[3] = fixElectronFraction;
+ lowParLimitsEl[3] = fixElectronFraction;
+ upParLimitsEl[3] = fixElectronFraction;
+
+ gausParamsKa[3] = fixElectronFraction;
+ lowParLimitsKa[3] = fixElectronFraction;
+ upParLimitsKa[3] = fixElectronFraction;
+
+ gausParamsPr[3] = fixElectronFraction;
+ lowParLimitsPr[3] = fixElectronFraction;
+ upParLimitsPr[3] = fixElectronFraction;
+
+ stepSize[3] = 0.0;
+
+ gausParamsSimultaneousFit[3] = fixElectronFraction;
+ lowParLimitsSimultaneousFit[3] = fixElectronFraction;
+ upParLimitsSimultaneousFit[3] = fixElectronFraction;
+
+ stepSizeSimultaneousFit[3] = 0.0;
+ }
+
+
+ // Set muon fraction equal to (some modified) electron fraction above some threshold, which should be a reasonable approximation:
+ // Fixed muon fraction < 0 does this job within the fitting functions
+ if(mode != kPMpT || slice >= muonFractionThresholdBinForFitting) {
+ // "Abuse" the muon fraction to forward the pT, which can then be used to get some modified electron fraction
+ const Double_t fixedValue = -(binsPt[slice] + binsPt[slice + 1]) / 2.;
+ gausParamsPi[4] = fixedValue;
+ lowParLimitsPi[4] = fixedValue;
+ upParLimitsPi[4] = fixedValue;
+
+ gausParamsEl[4] = fixedValue;
+ lowParLimitsEl[4] = fixedValue;
+ upParLimitsEl[4] = fixedValue;
+
+ gausParamsKa[4] = fixedValue;
+ lowParLimitsKa[4] = fixedValue;
+ upParLimitsKa[4] = fixedValue;
+
+ gausParamsPr[4] = fixedValue;
+ lowParLimitsPr[4] = fixedValue;
+ upParLimitsPr[4] = fixedValue;
+
+ stepSize[4] = 0.;
+
+ gausParamsSimultaneousFit[4] = fixedValue;
+ lowParLimitsSimultaneousFit[4] = fixedValue;
+ upParLimitsSimultaneousFit[4] = fixedValue;
+
+ stepSizeSimultaneousFit[4] = 0.0;
+ }
+ }
+
+ // iter 0 used for initialisation
+ if (regularisation > 0 && iter == 0) {
+ const Int_t offset = currXbin * mathFit->GetNumParametersPerXbin();
+ for (Int_t i = 0; i < mathFit->GetNumParametersPerXbin(); i++) {
+ gausParamsSimultaneousFitRegularised[offset + i] = gausParamsSimultaneousFit[i];
+ lowParLimitsSimultaneousFitRegularised[offset + i] = lowParLimitsSimultaneousFit[i];
+ upParLimitsSimultaneousFitRegularised[offset + i] = upParLimitsSimultaneousFit[i];
+ stepSizeSimultaneousFitRegularised[offset + i] = stepSizeSimultaneousFit[i];
+ }
+ }
+
+
+ if (iter == 1) {
+ // The parameters are only used for fitMethod < 2. Thus, they can be set for these methods,
+ // although a different method is used
+ totalDeltaPion->SetParameters(gausParamsPi);
+ totalDeltaElectron->SetParameters(gausParamsEl);
+ totalDeltaKaon->SetParameters(gausParamsKa);
+ totalDeltaProton->SetParameters(gausParamsPr);
+ }
+
+ const TString binInfo = (mode == kPMpT) ? Form("%.2f_Pt_%.2f", binsPt[slice], binsPt[slice + 1])
+ : Form("%.2f_%s_%.2f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1),
+ modeShortName[mode].Data(), hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));
+
+ const TString binInfoTitle = (mode == kPMpT) ? Form("%.2f < Pt <%.2f", binsPt[slice], binsPt[slice + 1])
+ : Form("%.2f < %s < %.2f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1),
+ modeShortName[mode].Data(),
+ hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));
+
+ const TString fitFuncSuffix = (mode == kPMpT) ? Form("%.3f_Pt_%.3f", binsPt[slice], binsPt[slice + 1])
+ : Form("%.3f_%s_%.3f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1),
+ modeShortName[mode].Data(),
+ hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));
+
+ if (iter == 1) {
+ for (Int_t species = 0; species < 4; species++) {
+ cSingleFit[slice][species] = new TCanvas(Form("cSingleFit_%s_%s", binInfo.Data(), speciesLabel[species].Data()),
+ Form("single fit for %s (%s)", binInfoTitle.Data(), speciesLabel[species].Data()),
+ 1366, 768);
+ cSingleFit[slice][species]->Divide(1, 2, 0.01, 0.);
+ cSingleFit[slice][species]->GetPad(1)->SetRightMargin(0.001);
+ cSingleFit[slice][species]->GetPad(2)->SetRightMargin(0.001);
+ cSingleFit[slice][species]->GetPad(1)->SetTopMargin(0.001);
+ cSingleFit[slice][species]->GetPad(2)->SetTopMargin(0.01);
+ cSingleFit[slice][species]->GetPad(1)->SetBottomMargin(0.01);
+
+ cSingleFit[slice][species]->GetPad(1)->SetGridx(kTRUE);
+ cSingleFit[slice][species]->GetPad(2)->SetGridx(kTRUE);
+ cSingleFit[slice][species]->GetPad(1)->SetGridy(kTRUE);
+ cSingleFit[slice][species]->GetPad(2)->SetGridy(kTRUE);
+
+ cSingleFit[slice][species]->GetPad(1)->SetLogy(kTRUE);
+ cSingleFit[slice][species]->GetPad(1)->SetLogx(kTRUE);
+ cSingleFit[slice][species]->GetPad(2)->SetLogx(kTRUE);
+ }
+ }
+
+ // Problem: For p < 0.5 GeV/c, the fractions cannot be simply taken from the parameters because
+ // not all entries of the histogram are inside the considered range.
+ // Also: Small deviations of summed fractions from one if taking the fractions from different Delta species histos.
+ // Therefore: Add up the integrals of the individual fits (\Delta species) and take the fraction of the sum
+ Double_t integralTotal = 0;
+ Double_t integralPions = 0, integralKaons = 0, integralProtons = 0, integralElectrons = 0, integralMuons = 0;
+
+ Double_t integralPionsDeltaPion = 0, integralPionsDeltaElectron = 0, integralPionsDeltaKaon = 0, integralPionsDeltaProton = 0;
+ Double_t integralElectronsDeltaPion = 0, integralElectronsDeltaElectron = 0, integralElectronsDeltaKaon = 0,
+ integralElectronsDeltaProton = 0;
+ Double_t integralKaonsDeltaPion = 0, integralKaonsDeltaElectron = 0, integralKaonsDeltaKaon = 0, integralKaonsDeltaProton = 0;
+ Double_t integralProtonsDeltaPion = 0, integralProtonsDeltaElectron = 0, integralProtonsDeltaKaon = 0,
+ integralProtonsDeltaProton = 0;
+ Double_t integralMuonsDeltaPion = 0, integralMuonsDeltaElectron = 0, integralMuonsDeltaKaon = 0, integralMuonsDeltaProton = 0;
+
+ /*
+ Double_t integralErrorPions = 0, integralErrorKaons = 0, integralErrorProtons = 0, integralErrorElectrons = 0;
+
+ Double_t integralErrorPionsDeltaPion = 0, integralErrorPionsDeltaElectron = 0, integralErrorPionsDeltaKaon = 0,
+ integralErrorPionsDeltaProton = 0;
+ Double_t integralErrorElectronsDeltaPion = 0, integralErrorElectronsDeltaElectron = 0, integralErrorElectronsDeltaKaon = 0,
+ integralErrorElectronsDeltaProton = 0;
+ Double_t integralErrorKaonsDeltaPion = 0, integralErrorKaonsDeltaElectron = 0, integralErrorKaonsDeltaKaon = 0,
+ integralErrorKaonsDeltaProton = 0;
+ Double_t integralErrorProtonsDeltaPion = 0, integralErrorProtonsDeltaElectron = 0, integralErrorProtonsDeltaKaon = 0,
+ integralErrorProtonsDeltaProton = 0;
+
+ Double_t integralErrorTotalDeltaPion = 0, integralErrorTotalDeltaElectron = 0, integralErrorTotalDeltaKaon = 0;
+ Double_t integralErrorTotalDeltaProton = 0;
+ */
+
+ Int_t errFlag = 0;
+
+ // Reset temp arrays for next slice
+ for (Int_t ind = 0; ind < nParUsed; ind++)
+ parameterErrorsOut[ind] = 0;
+
+ // Do not reset, if regularisation is on and the fit is done because the covariance matrix
+ // will not be changed anymore in this case. On the other hand it will only be calculated once,
+ // so resetting it would mean that is not available anymore.
+ if (regularisation <= 0 || !regularisedFitDone) {
+ for (Int_t i = 0; i < nParUsed; i++) {
+ for (Int_t j = 0; j < nParUsed; j++) {
+ covMatrix[i][j] = 0;
+ }
+ }
+ }
+
+ Double_t reducedChiSquare = -1;
+
+ if (fitMethod == 2) {
+ if (regularisation <= 0 && iter == 1)
+ std::cout << "Fitting data simultaneously...." << std::endl << std::endl;
+
+ // Add ref histos in initialisation step (w/ reg) or in the only loop (w/o reg)
+ if ((regularisation > 0 && iter == 0) || (regularisation <= 0 && iter == 1)) {
+
+ if (regularisation <= 0)
+ mathFit->ClearRefHistos();
+
+ mathFit->AddRefHisto(hGenDeltaPiForPiProj);
+ mathFit->AddRefHisto(hGenDeltaPiForKaProj);
+ mathFit->AddRefHisto(hGenDeltaPiForPrProj);
+ mathFit->AddRefHisto(hGenDeltaPiForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaPiForMuProj);
+
+ mathFit->AddRefHisto(hGenDeltaKaForPiProj);
+ mathFit->AddRefHisto(hGenDeltaKaForKaProj);
+ mathFit->AddRefHisto(hGenDeltaKaForPrProj);
+ mathFit->AddRefHisto(hGenDeltaKaForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaKaForMuProj);
+
+ mathFit->AddRefHisto(hGenDeltaPrForPiProj);
+ mathFit->AddRefHisto(hGenDeltaPrForKaProj);
+ mathFit->AddRefHisto(hGenDeltaPrForPrProj);
+ mathFit->AddRefHisto(hGenDeltaPrForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaPrForMuProj);
+
+ mathFit->AddRefHisto(hGenDeltaElForPiProj);
+ mathFit->AddRefHisto(hGenDeltaElForKaProj);
+ mathFit->AddRefHisto(hGenDeltaElForPrProj);
+ mathFit->AddRefHisto(hGenDeltaElForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaElForMuProj);
+
+ // In reg case, fill in the data for this bin and continue with the nex bin
+ if (regularisation > 0) {
+ TH1D* hDeltaSpecies[numSimultaneousFits] = { hDeltaPi[slice], hDeltaKa[slice], hDeltaPr[slice], hDeltaEl[slice] };
+
+ for (Int_t i = 0; i < numSimultaneousFits; i++) {
+ mathFit->InputData(hDeltaSpecies[i], currXbin, i, xLow, xUp, -1., kFALSE);
+ }
+
+ currXbin++;
+ continue;
+ }
+ }
+
+ if (regularisation > 0 && iter == 1 && !regularisedFitDone) {
+ std::cout << "Fitting data simultaneously with regularisation...." << std::endl << std::endl;
+
+ // TODO At the moment, the covariance matrix is NOT forwarded from TMinuit (has completely different dimensions)
+ // -> Since it is not used at the moment, this is not necessary. If it is to be used in future,
+ // this has to be implemented! But one has to be careful, since parameters from different bins then
+ // depend on each other! Furthermore, there will be no errors for fixed parameters like muon fraction or electron fraction
+ // above the corresponding threshold in the covariance matrix, but an estimated error will be set manually.
+ errFlag = errFlag | doSimultaneousFitRegularised(nParSimultaneousFitRegularised, gausParamsSimultaneousFitRegularised,
+ parameterErrorsOutRegularised, &covMatrix[0][0],
+ stepSizeSimultaneousFitRegularised,
+ lowParLimitsSimultaneousFitRegularised,
+ upParLimitsSimultaneousFitRegularised, reducedChiSquare);
+ if (errFlag != 0)
+ std::cout << "errFlag " << errFlag << std::endl << std::endl;
+
+ reducedChiSquareRegularisation = reducedChiSquare;
+
+ // Since everything is fitted in one go, only do this for the first x bin
+ // (more convenient to put the fitting in the x bin loop in order to intialise
+ // the parameters in the same way they are initialised for the fit w/o regularisation.
+ regularisedFitDone = kTRUE;
+ }
+
+ if (regularisation > 0 && iter == 1) {
+ // To allow for an identical processing, just forward the parameter results for the current xBin to the
+ // array used by the standard simultaneous fit. The rest of the code is then the same for regularisation on and off
+
+ for (Int_t i = 0; i < mathFit->GetNumParametersPerXbin(); i++) {
+ const Int_t iRegularised = i + currXbin * mathFit->GetNumParametersPerXbin();
+
+ gausParamsSimultaneousFit[i] = gausParamsSimultaneousFitRegularised[iRegularised];
+ parameterErrorsOut[i] = parameterErrorsOutRegularised[iRegularised];
+ }
+
+ // Same reducedChiSquare for all bins, since only one fit
+ reducedChiSquare = reducedChiSquareRegularisation;
+
+
+ // Also clear reference histos and load those for the current bin
+ mathFit->ClearRefHistos();
+
+ mathFit->AddRefHisto(hGenDeltaPiForPiProj);
+ mathFit->AddRefHisto(hGenDeltaPiForKaProj);
+ mathFit->AddRefHisto(hGenDeltaPiForPrProj);
+ mathFit->AddRefHisto(hGenDeltaPiForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaPiForMuProj);
+
+ mathFit->AddRefHisto(hGenDeltaKaForPiProj);
+ mathFit->AddRefHisto(hGenDeltaKaForKaProj);
+ mathFit->AddRefHisto(hGenDeltaKaForPrProj);
+ mathFit->AddRefHisto(hGenDeltaKaForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaKaForMuProj);
+
+ mathFit->AddRefHisto(hGenDeltaPrForPiProj);
+ mathFit->AddRefHisto(hGenDeltaPrForKaProj);
+ mathFit->AddRefHisto(hGenDeltaPrForPrProj);
+ mathFit->AddRefHisto(hGenDeltaPrForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaPrForMuProj);
+
+ mathFit->AddRefHisto(hGenDeltaElForPiProj);
+ mathFit->AddRefHisto(hGenDeltaElForKaProj);
+ mathFit->AddRefHisto(hGenDeltaElForPrProj);
+ mathFit->AddRefHisto(hGenDeltaElForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaElForMuProj);
+ }
+
+
+ if (regularisation <= 0) {
+ TH1D* hDeltaSpecies[numSimultaneousFits] = { hDeltaPi[slice], hDeltaKa[slice], hDeltaPr[slice], hDeltaEl[slice] };
+ errFlag = errFlag |
+ doSimultaneousFit(hDeltaSpecies, xLow, xUp, nParSimultaneousFit, gausParamsSimultaneousFit, parameterErrorsOut,
+ &covMatrix[0][0], stepSizeSimultaneousFit, lowParLimitsSimultaneousFit,
+ upParLimitsSimultaneousFit, reducedChiSquare);
+ }
+
+ // Forward parameters to single fits
+ for (Int_t parIndex = 0; parIndex < nPar; parIndex++) {
+ // Fractions
+ if (parIndex <= 4) {
+ totalDeltaPion->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);
+ totalDeltaPion->SetParError(parIndex, parameterErrorsOut[parIndex]);
+
+ totalDeltaKaon->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);
+ totalDeltaKaon->SetParError(parIndex, parameterErrorsOut[parIndex]);
+
+ totalDeltaProton->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);
+ totalDeltaProton->SetParError(parIndex, parameterErrorsOut[parIndex]);
+
+ totalDeltaElectron->SetParameter(parIndex, gausParamsSimultaneousFit[parIndex]);
+ totalDeltaElectron->SetParError(parIndex, parameterErrorsOut[parIndex]);
+ }
+ // Total yield
+ else if (parIndex == 5) {
+ totalDeltaPion->SetParameter(parIndex, totalYield);
+ totalDeltaPion->SetParError(parIndex, 0);
+
+ totalDeltaKaon->SetParameter(parIndex, totalYield);
+ totalDeltaKaon->SetParError(parIndex, 0);
+
+ totalDeltaProton->SetParameter(parIndex, totalYield);
+ totalDeltaProton->SetParError(parIndex, 0);
+
+ totalDeltaElectron->SetParameter(parIndex, totalYield);
+ totalDeltaElectron->SetParError(parIndex, 0);
+ }
+ // Hist shifts
+ else {
+ totalDeltaPion->SetParameter(parIndex, 0);
+ totalDeltaPion->SetParError(parIndex, 0);
+
+ totalDeltaKaon->SetParameter(parIndex, 0);
+ totalDeltaKaon->SetParError(parIndex, 0);
+
+ totalDeltaProton->SetParameter(parIndex, 0);
+ totalDeltaProton->SetParError(parIndex, 0);
+
+ totalDeltaElectron->SetParameter(parIndex, 0);
+ totalDeltaElectron->SetParError(parIndex, 0);
+ }
+ }
+
+ const Bool_t useRegularisation = regularisation > 0;
+
+ // Plot single fits
+
+ Int_t binLow = -1;
+ Int_t binHigh = -1;
+
+ // DeltaPions
+ cSingleFit[slice][2]->cd(1);
+
+ hDeltaPi[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaPi[slice], binLow, binHigh);
+ hDeltaPi[slice]->Draw("e");
+
+ fitFuncTotalDeltaPion[slice] = (TF1*)totalDeltaPion->Clone(Form("Fit_Total_DeltaPion_%s", fitFuncSuffix.Data()));
+
+ hDeltaPiFitQA[slice] = (TH1D*)hDeltaPi[slice]->Clone(Form("hDeltaPiFitQA_%d", slice));
+ hDeltaPiFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaPiFitQA[slice]->Add(fitFuncTotalDeltaPion[slice], -1);
+ hDeltaPiFitQA[slice]->Divide(hDeltaPi[slice]);
+
+ hDeltaPi[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaPion[slice]);
+ fitFuncTotalDeltaPion[slice]->Draw("same");
+
+ Double_t* parametersOut = &totalDeltaPion->GetParameters()[0];
+
+ hGenDeltaPiForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));
+ shiftHist(hGenDeltaPiForPiProj, parametersOut[6], useRegularisation);
+ hGenDeltaPiForPiProj->Draw("same");
+
+ hGenDeltaPiForKaProj->Scale(parametersOut[5] * parametersOut[1]);
+ shiftHist(hGenDeltaPiForKaProj, parametersOut[7], useRegularisation);
+ hGenDeltaPiForKaProj->Draw("same");
+
+ hGenDeltaPiForPrProj->Scale(parametersOut[5] * parametersOut[2]);
+ shiftHist(hGenDeltaPiForPrProj, parametersOut[8], useRegularisation);
+ hGenDeltaPiForPrProj->Draw("same");
+
+ hGenDeltaPiForElProj->Scale(parametersOut[5] * parametersOut[3]);
+ shiftHist(hGenDeltaPiForElProj, parametersOut[9], useRegularisation);
+ hGenDeltaPiForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaPiForMuProj->Scale(parametersOut[5] * parametersOut[4]);
+ shiftHist(hGenDeltaPiForMuProj, parametersOut[10], useRegularisation);
+ hGenDeltaPiForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaPiMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPiMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaPiMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPiMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaPi[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][2]->cd(2);
+ hDeltaPiFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaPiFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 3, reducedChiSquare);
+
+ // TMatrixDSym covMatrixPi(nParUsed, &covMatrix[0][0]);
+
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPi, parametersOut, parameterErrorsOut, hFractionPions,
+ hFractionPionsDeltaPion, hFractionElectronsDeltaPion, hFractionKaonsDeltaPion,
+ hFractionProtonsDeltaPion, hFractionMuonsDeltaPion, hYieldPions, hYieldPionsDeltaPion, hYieldElectronsDeltaPion,
+ hYieldKaonsDeltaPion, hYieldProtonsDeltaPion, hYieldMuonsDeltaPion, normaliseResults);
+
+ // Also set specific muon fractions and yields -> The deltaSpecies histos are not needed here: They will be set together with
+ // the fraction and yields for all other species
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kMu, parametersOut, parameterErrorsOut, hFractionMuons,
+ 0x0, 0x0, 0x0, 0x0, 0x0, hYieldMuons, 0x0, 0x0, 0x0, 0x0, 0x0, normaliseResults);
+
+
+ // DeltaElectrons
+ cSingleFit[slice][0]->cd(1);
+
+ hDeltaEl[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaEl[slice], binLow, binHigh);
+ hDeltaEl[slice]->Draw("e");
+
+ fitFuncTotalDeltaElectron[slice] = (TF1*)totalDeltaElectron->Clone(Form("Fit_Total_DeltaElectron_%s", fitFuncSuffix.Data()));
+
+ hDeltaElFitQA[slice] = (TH1D*)hDeltaEl[slice]->Clone(Form("hDeltaElFitQA_%d", slice));
+ hDeltaElFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaElFitQA[slice]->Add(fitFuncTotalDeltaElectron[slice], -1);
+ hDeltaElFitQA[slice]->Divide(hDeltaEl[slice]);
+
+ hDeltaEl[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaElectron[slice]);
+ fitFuncTotalDeltaElectron[slice]->Draw("same");
+
+ parametersOut = &totalDeltaElectron->GetParameters()[0];
+
+ hGenDeltaElForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));
+ shiftHist(hGenDeltaElForPiProj, parametersOut[6], useRegularisation);
+ hGenDeltaElForPiProj->Draw("same");
+
+ hGenDeltaElForKaProj->Scale(parametersOut[5] * parametersOut[1]);
+ shiftHist(hGenDeltaElForKaProj, parametersOut[7], useRegularisation);
+ hGenDeltaElForKaProj->Draw("same");
+
+ hGenDeltaElForPrProj->Scale(parametersOut[5] * parametersOut[2]);
+ shiftHist(hGenDeltaElForPrProj, parametersOut[8], useRegularisation);
+ hGenDeltaElForPrProj->Draw("same");
+
+ hGenDeltaElForElProj->Scale(parametersOut[5] * parametersOut[3]);
+ shiftHist(hGenDeltaElForElProj, parametersOut[9], useRegularisation);
+ hGenDeltaElForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaElForMuProj->Scale(parametersOut[5] * parametersOut[4]);
+ shiftHist(hGenDeltaElForMuProj, parametersOut[10], useRegularisation);
+ hGenDeltaElForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaElMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaElMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaElMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaElMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaEl[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][0]->cd(2);
+ hDeltaElFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaElFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 1, reducedChiSquare);
+
+ //TMatrixDSym covMatrixEl(nParUsed, &covMatrix[0][0]);
+
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kEl, parametersOut, parameterErrorsOut, hFractionElectrons,
+ hFractionPionsDeltaElectron, hFractionElectronsDeltaElectron, hFractionKaonsDeltaElectron,
+ hFractionProtonsDeltaElectron, hFractionMuonsDeltaElectron, hYieldElectrons, hYieldPionsDeltaElectron,
+ hYieldElectronsDeltaElectron, hYieldKaonsDeltaElectron, hYieldProtonsDeltaElectron, hYieldMuonsDeltaElectron,
+ normaliseResults);
+
+
+
+ // DeltaKaons
+ cSingleFit[slice][1]->cd(1);
+
+ hDeltaKa[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaKa[slice], binLow, binHigh);
+ hDeltaKa[slice]->Draw("e");
+
+ fitFuncTotalDeltaKaon[slice] = (TF1*)totalDeltaKaon->Clone(Form("Fit_Total_DeltaKaon_%s", fitFuncSuffix.Data()));
+
+ hDeltaKaFitQA[slice] = (TH1D*)hDeltaKa[slice]->Clone(Form("hDeltaKaFitQA_%d", slice));
+ hDeltaKaFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaKaFitQA[slice]->Add(fitFuncTotalDeltaKaon[slice], -1);
+ hDeltaKaFitQA[slice]->Divide(hDeltaKa[slice]);
+
+ hDeltaKa[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaKaon[slice]);
+ fitFuncTotalDeltaKaon[slice]->Draw("same");
+
+ parametersOut = &totalDeltaKaon->GetParameters()[0];
+
+ hGenDeltaKaForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));
+ shiftHist(hGenDeltaKaForPiProj, parametersOut[6], useRegularisation);
+ hGenDeltaKaForPiProj->Draw("same");
+
+ hGenDeltaKaForKaProj->Scale(parametersOut[5] * parametersOut[1]);
+ shiftHist(hGenDeltaKaForKaProj, parametersOut[7], useRegularisation);
+ hGenDeltaKaForKaProj->Draw("same");
+
+ hGenDeltaKaForPrProj->Scale(parametersOut[5] * parametersOut[2]);
+ shiftHist(hGenDeltaKaForPrProj, parametersOut[8], useRegularisation);
+ hGenDeltaKaForPrProj->Draw("same");
+
+ hGenDeltaKaForElProj->Scale(parametersOut[5] * parametersOut[3]);
+ shiftHist(hGenDeltaKaForElProj, parametersOut[9], useRegularisation);
+ hGenDeltaKaForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaKaForMuProj->Scale(parametersOut[5] * parametersOut[4]);
+ shiftHist(hGenDeltaKaForMuProj, parametersOut[10], useRegularisation);
+ hGenDeltaKaForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaKaMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaKaMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaKaMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaKaMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaKa[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][1]->cd(2);
+ hDeltaKaFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaKaFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 2, reducedChiSquare);
+
+ //TMatrixDSym covMatrixKa(nParUsed, &covMatrix[0][0]);
+
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kKa, parametersOut, parameterErrorsOut, hFractionKaons,
+ hFractionPionsDeltaKaon, hFractionElectronsDeltaKaon, hFractionKaonsDeltaKaon, hFractionProtonsDeltaKaon,
+ hFractionMuonsDeltaKaon, hYieldKaons, hYieldPionsDeltaKaon, hYieldElectronsDeltaKaon, hYieldKaonsDeltaKaon,
+ hYieldProtonsDeltaKaon, hYieldMuonsDeltaKaon, normaliseResults);
+
+
+
+ // DeltaProtons
+ cSingleFit[slice][3]->cd(1);
+
+ hDeltaPr[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaPr[slice], binLow, binHigh);
+ hDeltaPr[slice]->Draw("e");
+
+ fitFuncTotalDeltaProton[slice] = (TF1*)totalDeltaProton->Clone(Form("Fit_Total_DeltaProton_%s", fitFuncSuffix.Data()));
+
+ hDeltaPrFitQA[slice] = (TH1D*)hDeltaPr[slice]->Clone(Form("hDeltaPrFitQA_%d", slice));
+ hDeltaPrFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaPrFitQA[slice]->Add(fitFuncTotalDeltaProton[slice], -1);
+ hDeltaPrFitQA[slice]->Divide(hDeltaPr[slice]);
+
+ hDeltaPr[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaProton[slice]);
+
+ fitFuncTotalDeltaProton[slice]->Draw("same");
+
+ parametersOut = &totalDeltaProton->GetParameters()[0];
+
+ hGenDeltaPrForPiProj->Scale(parametersOut[5] * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0)));
+ shiftHist(hGenDeltaPrForPiProj, parametersOut[6], useRegularisation);
+ hGenDeltaPrForPiProj->Draw("same");
+
+ hGenDeltaPrForKaProj->Scale(parametersOut[5] * parametersOut[1]);
+ shiftHist(hGenDeltaPrForKaProj, parametersOut[7], useRegularisation);
+ hGenDeltaPrForKaProj->Draw("same");
+
+ hGenDeltaPrForPrProj->Scale(parametersOut[5] * parametersOut[2]);
+ shiftHist(hGenDeltaPrForPrProj, parametersOut[8], useRegularisation);
+ hGenDeltaPrForPrProj->Draw("same");
+
+ hGenDeltaPrForElProj->Scale(parametersOut[5] * parametersOut[3]);
+ shiftHist(hGenDeltaPrForElProj, parametersOut[9], useRegularisation);
+ hGenDeltaPrForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaPrForMuProj->Scale(parametersOut[5] * parametersOut[4]);
+ shiftHist(hGenDeltaPrForMuProj, parametersOut[10], useRegularisation);
+ hGenDeltaPrForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaPrMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPrMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaPrMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPrMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaPr[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][3]->cd(2);
+ hDeltaPrFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaPrFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 4, reducedChiSquare);
+
+ //TMatrixDSym covMatrixPr(nParUsed, &covMatrix[0][0]);
+
+ Double_t normalisationFactor = 1.0;
+ normalisationFactor = setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPr, parametersOut, parameterErrorsOut,
+ hFractionProtons, hFractionPionsDeltaProton, hFractionElectronsDeltaProton,
+ hFractionKaonsDeltaProton, hFractionProtonsDeltaProton, hFractionMuonsDeltaProton,
+ hYieldProtons, hYieldPionsDeltaProton, hYieldElectronsDeltaProton,
+ hYieldKaonsDeltaProton, hYieldProtonsDeltaProton, hYieldMuonsDeltaProton,
+ normaliseResults);
+
+ // Fractions are the same for all plots -> just take deltaPion as default
+ Double_t sumFractions = hFractionPionsDeltaPion->GetBinContent(slice + 1) +
+ hFractionElectronsDeltaPion->GetBinContent(slice + 1) + (takeIntoAccountMuons ? hFractionMuonsDeltaPion->GetBinContent(slice + 1) : 0.) +
+ hFractionKaonsDeltaPion->GetBinContent(slice + 1) + hFractionProtonsDeltaPion->GetBinContent(slice + 1);
+
+ hFractionSummed->SetBinContent(slice + 1, sumFractions);
+ hFractionSummed->SetBinError(slice + 1,
+ TMath::Sqrt(TMath::Power(hFractionPionsDeltaPion->GetBinError(slice + 1), 2) +
+ TMath::Power(hFractionElectronsDeltaPion->GetBinError(slice + 1), 2) +
+ (takeIntoAccountMuons ? TMath::Power(hFractionMuonsDeltaPion->GetBinError(slice + 1), 2) : 0.) +
+ TMath::Power(hFractionKaonsDeltaPion->GetBinError(slice + 1), 2) +
+ TMath::Power(hFractionProtonsDeltaPion->GetBinError(slice + 1), 2)));
+
+ for (Int_t species = 0; species < 4; species++) {
+ cSingleFit[slice][species]->Modified();
+ cSingleFit[slice][species]->Update();
+ }
+
+
+ // Compute the to-pi ratios with proper error for the current slice
+ // NOTE: error and covariance matrix are already scaled for the simultaneous fit
+ // by mathFit (it was checked that all (i.e. also off-diagonal) matrix elements grow by fScaleError^2
+ // NOTE 2: take the fractions and error from the histogram (takes correct muon and electrons fractions with errors set manually
+ // in case of fixed fraction; the parameters are fixed, so the elements of the off-diagonal elements of the covariance matrix
+ // remain zero!). The fractions are then also scaled to sum up to 1 (but correction factor usually close to unity).
+ // The covariance matrix is NOT scaled like this. Therefore, scale the matrix elements accordingly.
+ // If the normalisation is not done for the fractions, then this factor is unity by construction.
+
+
+
+ Double_t covMatrixElementToPiForEl = 0.;
+ Double_t covMatrixElementToPiForMu = 0.;
+ Double_t covMatrixElementToPiForKa = 0.;
+ Double_t covMatrixElementToPiForPr = 0.;
+
+ // Get the correct covariance matrix elements and apply the normalisation factor
+ Int_t parOffset = 0;
+
+ // In case of regularisation, there is an offset with respect to the current slice
+ if (useRegularisation)
+ parOffset = currXbin * numParamsPerXbin;
+
+
+ covMatrixElementToPiForEl = covMatrix[3 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;
+ covMatrixElementToPiForMu = covMatrix[4 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;
+ covMatrixElementToPiForKa = covMatrix[1 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;
+ covMatrixElementToPiForPr = covMatrix[2 + parOffset][0 + parOffset] * normalisationFactor * normalisationFactor;
+
+ Double_t ratio = -999.;
+ Double_t ratioError = 999.;
+ Double_t currFractionSpecies = 0.;
+ Double_t currFractionPions = 0.;
+ Double_t currFractionErrorSpecies = 0.;
+ Double_t currFractionErrorPions = 0.;
+ Double_t covMatrixElementAB = 0.; // NOTE that there is only one covariance matrix (simultaneous fit!)
+
+ currFractionPions = hFractionPions->GetBinContent(slice + 1);
+ currFractionErrorPions = hFractionPions->GetBinError(slice + 1);
+
+ // NOTE: Even in case of regularisation, when fractions of different bins become correlated, this does NOT change
+ // the formula. Only the covariance matrix element for the considered fraction in the SAME slice needs to be taken
+ // into account. Explanation: f = f(fracA_slice, fracB_slice), this means that \dell f / \dell fracA_slice+-1 = 0 (etc.).
+ // So, the formula is the same, although the correlation between different slices is contained in the covariance matrix.
+
+ // el-to-pi ratio
+ currFractionSpecies = hFractionElectrons->GetBinContent(slice + 1);
+ currFractionErrorSpecies = hFractionElectrons->GetBinError(slice + 1);
+ covMatrixElementAB = covMatrixElementToPiForEl;
+
+ GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,
+ covMatrixElementAB, ratio, ratioError);
+
+ hRatioToPiElectrons->SetBinContent(slice + 1, ratio);
+ hRatioToPiElectrons->SetBinError(slice + 1, ratioError);
+
+ // mu-to-pi ratio
+ currFractionSpecies = hFractionMuons->GetBinContent(slice + 1);
+ currFractionErrorSpecies = hFractionMuons->GetBinError(slice + 1);
+ covMatrixElementAB = covMatrixElementToPiForMu;
+
+ GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,
+ covMatrixElementAB, ratio, ratioError);
+
+ hRatioToPiMuons->SetBinContent(slice + 1, ratio);
+ hRatioToPiMuons->SetBinError(slice + 1, ratioError);
+
+
+ // K-to-pi ratio
+ currFractionSpecies = hFractionKaons->GetBinContent(slice + 1);
+ currFractionErrorSpecies = hFractionKaons->GetBinError(slice + 1);
+ covMatrixElementAB = covMatrixElementToPiForKa;
+
+ GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,
+ covMatrixElementAB, ratio, ratioError);
+
+ hRatioToPiKaons->SetBinContent(slice + 1, ratio);
+ hRatioToPiKaons->SetBinError(slice + 1, ratioError);
+
+
+ // p-to-pi ratio
+ currFractionSpecies = hFractionProtons->GetBinContent(slice + 1);
+ currFractionErrorSpecies = hFractionProtons->GetBinError(slice + 1);
+ covMatrixElementAB = covMatrixElementToPiForPr;
+
+ GetRatioWithCorrelatedError(currFractionSpecies, currFractionPions, currFractionErrorSpecies, currFractionErrorPions,
+ covMatrixElementAB, ratio, ratioError);
+
+ hRatioToPiProtons->SetBinContent(slice + 1, ratio);
+ hRatioToPiProtons->SetBinError(slice + 1, ratioError);
+
+ /*
+ for (Int_t i = 0; i < nParUsed; i++) {
+ for (Int_t j = 0; j < nParUsed; j++) {
+ printf("\t%e", covMatrix[i][j]);
+ }
+ printf("\n");
+ }
+ */
+
+ currXbin++;
+ }
+ //_____________________________________________________________________
+ // Other methods without simultaneous fitting
+ else {
+ Int_t binLow = -1;
+ Int_t binHigh = -1;
+
+ // DeltaPions
+
+ std::cout << "Fitting deltaPion...." << std::endl << std::endl;
+
+ cSingleFit[slice][2]->cd(1);
+
+ mathFit->ClearRefHistos();
+ mathFit->AddRefHisto(hGenDeltaPiForPiProj);
+ mathFit->AddRefHisto(hGenDeltaPiForKaProj);
+ mathFit->AddRefHisto(hGenDeltaPiForPrProj);
+ mathFit->AddRefHisto(hGenDeltaPiForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaPiForMuProj);
+
+ errFlag = errFlag |
+ doFit(hDeltaPi[slice], xLow, xUp, nPar, gausParamsPi, parameterErrorsOut, &covMatrix[0][0],
+ stepSize, lowParLimitsPi, upParLimitsPi, totalDeltaPion, reducedChiSquare);
+
+ hDeltaPi[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaPi[slice], binLow, binHigh);
+ hDeltaPi[slice]->Draw("e");
+
+ fitFuncTotalDeltaPion[slice] = (TF1*)totalDeltaPion->Clone(Form("Fit_Total_DeltaPion_%s", fitFuncSuffix.Data()));
+
+ hDeltaPiFitQA[slice] = (TH1D*)hDeltaPi[slice]->Clone(Form("hDeltaPiFitQA_%d", slice));
+ hDeltaPiFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaPiFitQA[slice]->Add(fitFuncTotalDeltaPion[slice], -1);
+ hDeltaPiFitQA[slice]->Divide(hDeltaPi[slice]);
+
+ hDeltaPi[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaPion[slice]);
+ fitFuncTotalDeltaPion[slice]->Draw("same");
+
+ Double_t* parametersOut = &gausParamsPi[0];
+
+ hGenDeltaPiForPiProj->Scale(gausParamsPi[5] * (gausParamsPi[0] + (muonContamination ? gausParamsPi[3] : 0)));
+ shiftHist(hGenDeltaPiForPiProj, gausParamsPi[6]);
+ hGenDeltaPiForPiProj->Draw("same");
+
+ hGenDeltaPiForKaProj->Scale(gausParamsPi[5] * gausParamsPi[1]);
+ shiftHist(hGenDeltaPiForKaProj, gausParamsPi[7]);
+ hGenDeltaPiForKaProj->Draw("same");
+
+ hGenDeltaPiForPrProj->Scale(gausParamsPi[5] * gausParamsPi[2]);
+ shiftHist(hGenDeltaPiForPrProj, gausParamsPi[8]);
+ hGenDeltaPiForPrProj->Draw("same");
+
+ hGenDeltaPiForElProj->Scale(gausParamsPi[5] * gausParamsPi[3]);
+ shiftHist(hGenDeltaPiForElProj, gausParamsPi[9]);
+ hGenDeltaPiForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaPiForMuProj->Scale(gausParamsPi[5] * gausParamsPi[4]);
+ shiftHist(hGenDeltaPiForMuProj, gausParamsPi[10]);
+ hGenDeltaPiForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaPiMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPiMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaPiMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPiMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaPi[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][2]->cd(2);
+ hDeltaPiFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaPiFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 3, reducedChiSquare);
+
+ TMatrixDSym covMatrixPi(nParUsed, &covMatrix[0][0]);
+
+ if (fitMethod == 1) {
+ // Histos are normalised => expression equals integral
+ integralPions = allDeltaPion * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));
+ integralTotal += integralPions;
+ if (takeIntoAccountMuons) {
+ integralMuons = allDeltaPion * parametersOut[4];
+ integralTotal += integralMuons;
+ }
+
+ /*
+ integralErrorTotalDeltaPion = getErrorOfTotalIntegral(covMatrixPi) * allDeltaPion;
+
+ integralErrorPions = getErrorOfPionIntegral(covMatrixPi) * allDeltaPion;
+ */
+
+ integralPionsDeltaPion = integralPions;
+
+ // Compare comment above
+ integralElectronsDeltaPion = allDeltaPion * parametersOut[3];
+ integralKaonsDeltaPion = allDeltaPion * parametersOut[1];
+ integralProtonsDeltaPion = allDeltaPion * parametersOut[2];
+ integralMuonsDeltaPion = allDeltaPion * parametersOut[4];
+
+ /*
+ integralErrorPionsDeltaPion = integralErrorPions;
+
+ integralErrorElectronsDeltaPion = allDeltaPion * parameterErrorsOut[3];
+ integralErrorKaonsDeltaPion = allDeltaPion * parameterErrorsOut[1];
+ integralErrorProtonsDeltaPion = allDeltaPion * parameterErrorsOut[2];
+ */
+ }
+ else {
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPi, parametersOut, parameterErrorsOut, hFractionPions,
+ hFractionPionsDeltaPion, hFractionElectronsDeltaPion, hFractionKaonsDeltaPion,
+ hFractionProtonsDeltaPion, hFractionMuonsDeltaPion, hYieldPions, hYieldPionsDeltaPion, hYieldElectronsDeltaPion,
+ hYieldKaonsDeltaPion, hYieldProtonsDeltaPion, hYieldMuonsDeltaPion);
+
+ // Also set specific muon fractions and yields -> The deltaSpecies histos are not needed here: They will be set together with
+ // the fraction and yields for all other species
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kMu, parametersOut, parameterErrorsOut, hFractionMuons,
+ 0x0, 0x0, 0x0, 0x0, 0x0, hYieldMuons, 0x0, 0x0, 0x0, 0x0, 0x0);
+ }
+
+
+ std::cout << std::endl << std::endl;
+
+
+ // DeltaElectrons
+
+ std::cout << "Fitting deltaElectron...." << std::endl << std::endl;
+
+ cSingleFit[slice][0]->cd(1);
+
+ mathFit->ClearRefHistos();
+ mathFit->AddRefHisto(hGenDeltaElForPiProj);
+ mathFit->AddRefHisto(hGenDeltaElForKaProj);
+ mathFit->AddRefHisto(hGenDeltaElForPrProj);
+ mathFit->AddRefHisto(hGenDeltaElForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaElForMuProj);
+
+ errFlag = errFlag |
+ doFit(hDeltaEl[slice], xLow, xUp, nPar, gausParamsEl, parameterErrorsOut, &covMatrix[0][0],
+ stepSize, lowParLimitsEl, upParLimitsEl, totalDeltaElectron, reducedChiSquare);
+
+ hDeltaEl[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaEl[slice], binLow, binHigh);
+ hDeltaEl[slice]->Draw("e");
+
+ fitFuncTotalDeltaElectron[slice] = (TF1*)totalDeltaElectron->Clone(Form("Fit_Total_DeltaElectron_%s", fitFuncSuffix.Data()));
+
+ hDeltaElFitQA[slice] = (TH1D*)hDeltaEl[slice]->Clone(Form("hDeltaElFitQA_%d", slice));
+ hDeltaElFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaElFitQA[slice]->Add(fitFuncTotalDeltaElectron[slice], -1);
+ hDeltaElFitQA[slice]->Divide(hDeltaEl[slice]);
+
+ hDeltaEl[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaElectron[slice]);
+ fitFuncTotalDeltaElectron[slice]->Draw("same");
+
+ parametersOut = &gausParamsEl[0];
+
+ hGenDeltaElForPiProj->Scale(gausParamsEl[5] * (gausParamsEl[0] + (muonContamination ? gausParamsEl[3] : 0)));
+ shiftHist(hGenDeltaElForPiProj, gausParamsEl[6]);
+ hGenDeltaElForPiProj->Draw("same");
+
+ hGenDeltaElForKaProj->Scale(gausParamsEl[5] * gausParamsEl[1]);
+ shiftHist(hGenDeltaElForKaProj, gausParamsEl[7]);
+ hGenDeltaElForKaProj->Draw("same");
+
+ hGenDeltaElForPrProj->Scale(gausParamsEl[5] * gausParamsEl[2]);
+ shiftHist(hGenDeltaElForPrProj, gausParamsEl[8]);
+ hGenDeltaElForPrProj->Draw("same");
+
+ hGenDeltaElForElProj->Scale(gausParamsEl[5] * gausParamsEl[3]);
+ shiftHist(hGenDeltaElForElProj, gausParamsEl[9]);
+ hGenDeltaElForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaElForMuProj->Scale(gausParamsEl[5] * gausParamsEl[4]);
+ shiftHist(hGenDeltaElForMuProj, gausParamsEl[10]);
+ hGenDeltaElForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaElMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaElMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaElMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaElMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaEl[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][0]->cd(2);
+ hDeltaElFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaElFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 1, reducedChiSquare);
+
+ TMatrixDSym covMatrixEl(nParUsed, &covMatrix[0][0]);
+
+ if (fitMethod == 1) {
+ integralElectrons = allDeltaElectron * parametersOut[3]; // Histos are normalised => expression equals integral
+ integralTotal += integralElectrons;
+
+ /*
+ integralErrorTotalDeltaElectron = getErrorOfTotalIntegral(covMatrixEl) * allDeltaElectron;
+
+ integralErrorElectrons = allDeltaElectron * parameterErrorsOut[3];
+ */
+
+ // Factor 2 in case of takeIntoAccountMuons will be applied below
+ integralElectronsDeltaElectron = integralElectrons;
+
+ // Compare comment above
+ integralPionsDeltaElectron = allDeltaElectron * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));
+ integralKaonsDeltaElectron = allDeltaElectron * parametersOut[1];
+ integralProtonsDeltaElectron = allDeltaElectron * parametersOut[2];
+ integralMuonsDeltaElectron = allDeltaElectron * parametersOut[4];
+
+
+ /*
+ integralErrorElectronsDeltaElectron = integralErrorElectrons;
+
+ integralErrorPionsDeltaElectron = getErrorOfPionIntegral(covMatrixEl) * allDeltaElectron;
+ integralErrorKaonsDeltaElectron = allDeltaElectron * parameterErrorsOut[1];
+ integralErrorProtonsDeltaElectron = allDeltaElectron * parameterErrorsOut[2];
+ */
+ }
+ else {
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kEl, parametersOut, parameterErrorsOut, hFractionElectrons,
+ hFractionPionsDeltaElectron, hFractionElectronsDeltaElectron, hFractionKaonsDeltaElectron,
+ hFractionProtonsDeltaElectron, hFractionMuonsDeltaElectron, hYieldElectrons, hYieldPionsDeltaElectron,
+ hYieldElectronsDeltaElectron, hYieldKaonsDeltaElectron, hYieldProtonsDeltaElectron, hYieldMuonsDeltaElectron);
+ }
+
+ std::cout << std::endl << std::endl;
+
+ // DeltaKaons
+
+ std::cout << "Fitting deltaKaon...." << std::endl << std::endl;
+
+ cSingleFit[slice][1]->cd(1);
+
+ mathFit->ClearRefHistos();
+ mathFit->AddRefHisto(hGenDeltaKaForPiProj);
+ mathFit->AddRefHisto(hGenDeltaKaForKaProj);
+ mathFit->AddRefHisto(hGenDeltaKaForPrProj);
+ mathFit->AddRefHisto(hGenDeltaKaForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaKaForMuProj);
+
+ errFlag = errFlag |
+ doFit(hDeltaKa[slice], xLow, xUp, nPar, gausParamsKa, parameterErrorsOut, &covMatrix[0][0],
+ stepSize, lowParLimitsKa, upParLimitsKa, totalDeltaKaon, reducedChiSquare);
+
+ hDeltaKa[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaKa[slice], binLow, binHigh);
+ hDeltaKa[slice]->Draw("e");
+
+ fitFuncTotalDeltaKaon[slice] = (TF1*)totalDeltaKaon->Clone(Form("Fit_Total_DeltaKaon_%s", fitFuncSuffix.Data()));
+
+ hDeltaKaFitQA[slice] = (TH1D*)hDeltaKa[slice]->Clone(Form("hDeltaKaFitQA_%d", slice));
+ hDeltaKaFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaKaFitQA[slice]->Add(fitFuncTotalDeltaKaon[slice], -1);
+ hDeltaKaFitQA[slice]->Divide(hDeltaKa[slice]);
+
+ hDeltaKa[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaKaon[slice]);
+ fitFuncTotalDeltaKaon[slice]->Draw("same");
+
+ parametersOut = &gausParamsKa[0];
+
+ hGenDeltaKaForPiProj->Scale(gausParamsKa[5] * (gausParamsKa[0] + (muonContamination ? gausParamsKa[3] : 0)));
+ shiftHist(hGenDeltaKaForPiProj, gausParamsKa[6]);
+ hGenDeltaKaForPiProj->Draw("same");
+
+ hGenDeltaKaForKaProj->Scale(gausParamsKa[5] * gausParamsKa[1]);
+ shiftHist(hGenDeltaKaForKaProj, gausParamsKa[7]);
+ hGenDeltaKaForKaProj->Draw("same");
+
+ hGenDeltaKaForPrProj->Scale(gausParamsKa[5] * gausParamsKa[2]);
+ shiftHist(hGenDeltaKaForPrProj, gausParamsKa[8]);
+ hGenDeltaKaForPrProj->Draw("same");
+
+ hGenDeltaKaForElProj->Scale(gausParamsKa[5] * gausParamsKa[3]);
+ shiftHist(hGenDeltaKaForElProj, gausParamsKa[9]);
+ hGenDeltaKaForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaKaForMuProj->Scale(gausParamsKa[5] * gausParamsKa[4]);
+ shiftHist(hGenDeltaKaForMuProj, gausParamsKa[10]);
+ hGenDeltaKaForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaKaMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaKaMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaKaMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaKaMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaKa[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][1]->cd(2);
+ hDeltaKaFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaKaFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 2, reducedChiSquare);
+
+ TMatrixDSym covMatrixKa(nParUsed, &covMatrix[0][0]);
+
+ if (fitMethod == 1) {
+ integralKaons = allDeltaKaon * parametersOut[1]; // Histos are normalised => expression equals integral
+ integralTotal += integralKaons;
+ /*
+ integralErrorTotalDeltaKaon = getErrorOfTotalIntegral(covMatrixKa) * allDeltaKaon;
+
+ integralErrorKaons = allDeltaKaon * parameterErrorsOut[1];
+ */
+
+
+ integralKaonsDeltaKaon = integralKaons;
+
+ // Compare comment above
+ integralPionsDeltaKaon = allDeltaKaon * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));
+ integralElectronsDeltaKaon = allDeltaKaon * parametersOut[3];
+ integralProtonsDeltaKaon = allDeltaKaon * parametersOut[2];
+ integralMuonsDeltaKaon = allDeltaKaon * parametersOut[4];
+
+ /*
+ integralErrorKaonsDeltaKaon = integralErrorKaons;
+
+ integralErrorPionsDeltaKaon = getErrorOfPionIntegral(covMatrixKa) * allDeltaKaon;
+ integralErrorElectronsDeltaKaon = allDeltaKaon * parameterErrorsOut[3];
+ integralErrorProtonsDeltaKaon = allDeltaKaon * parameterErrorsOut[2];
+ */
+ }
+ else {
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kKa, parametersOut, parameterErrorsOut, hFractionKaons,
+ hFractionPionsDeltaKaon, hFractionElectronsDeltaKaon, hFractionKaonsDeltaKaon, hFractionProtonsDeltaKaon,
+ hFractionMuonsDeltaKaon, hYieldKaons, hYieldPionsDeltaKaon, hYieldElectronsDeltaKaon, hYieldKaonsDeltaKaon,
+ hYieldProtonsDeltaKaon, hYieldMuonsDeltaKaon);
+ }
+
+ std::cout << std::endl << std::endl;
+
+
+ // DeltaProtons
+
+ std::cout << "Fitting deltaProton...." << std::endl << std::endl;
+
+ cSingleFit[slice][3]->cd(1);
+
+ mathFit->ClearRefHistos();
+ mathFit->AddRefHisto(hGenDeltaPrForPiProj);
+ mathFit->AddRefHisto(hGenDeltaPrForKaProj);
+ mathFit->AddRefHisto(hGenDeltaPrForPrProj);
+ mathFit->AddRefHisto(hGenDeltaPrForElProj);
+ if (takeIntoAccountMuons)
+ mathFit->AddRefHisto(hGenDeltaPrForMuProj);
+
+ errFlag = errFlag |
+ doFit(hDeltaPr[slice], xLow, xUp, nPar, gausParamsPr, parameterErrorsOut, &covMatrix[0][0],
+ stepSize, lowParLimitsPr, upParLimitsPr, totalDeltaProton, reducedChiSquare);
+
+ hDeltaPr[slice]->SetTitle("");
+ SetReasonableXaxisRange(hDeltaPr[slice], binLow, binHigh);
+ hDeltaPr[slice]->Draw("e");
+
+ fitFuncTotalDeltaProton[slice] = (TF1*)totalDeltaProton->Clone(Form("Fit_Total_DeltaProton_%s", fitFuncSuffix.Data()));
+
+ hDeltaPrFitQA[slice] = (TH1D*)hDeltaPr[slice]->Clone(Form("hDeltaPrFitQA_%d", slice));
+ hDeltaPrFitQA[slice]->GetYaxis()->SetTitle("(Data - Fit) / Data");
+ hDeltaPrFitQA[slice]->Add(fitFuncTotalDeltaProton[slice], -1);
+ hDeltaPrFitQA[slice]->Divide(hDeltaPr[slice]);
+
+ hDeltaPr[slice]->GetListOfFunctions()->Add(fitFuncTotalDeltaProton[slice]);
+
+ fitFuncTotalDeltaProton[slice]->Draw("same");
+
+ parametersOut = &gausParamsPr[0];
+
+ hGenDeltaPrForPiProj->Scale(gausParamsPr[5] * (gausParamsPr[0] + (muonContamination ? gausParamsPr[3] : 0)));
+ shiftHist(hGenDeltaPrForPiProj, gausParamsPr[6]);
+ hGenDeltaPrForPiProj->Draw("same");
+
+ hGenDeltaPrForKaProj->Scale(gausParamsPr[5] * gausParamsPr[1]);
+ shiftHist(hGenDeltaPrForKaProj, gausParamsPr[7]);
+ hGenDeltaPrForKaProj->Draw("same");
+
+ hGenDeltaPrForPrProj->Scale(gausParamsPr[5] * gausParamsPr[2]);
+ shiftHist(hGenDeltaPrForPrProj, gausParamsPr[8]);
+ hGenDeltaPrForPrProj->Draw("same");
+
+ hGenDeltaPrForElProj->Scale(gausParamsPr[5] * gausParamsPr[3]);
+ shiftHist(hGenDeltaPrForElProj, gausParamsPr[9]);
+ hGenDeltaPrForElProj->Draw("same");
+
+ if (takeIntoAccountMuons) {
+ hGenDeltaPrForMuProj->Scale(gausParamsPr[5] * gausParamsPr[4]);
+ shiftHist(hGenDeltaPrForMuProj, gausParamsPr[10]);
+ hGenDeltaPrForMuProj->Draw("same");
+ }
+
+ if (plotIdentifiedSpectra) {
+ for (Int_t species = 0; species < 5; species++)
+ hDeltaPrMC[slice][species]->Draw("same");
+
+ // Draw histo for sum of MC muons and pions
+ TH1D* hMCmuonsAndPions = new TH1D(*hDeltaPrMC[slice][kPi - 1]);
+ hMCmuonsAndPions->Add(hDeltaPrMC[slice][kMu - 1]);
+ hMCmuonsAndPions->SetLineColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetMarkerColor(getLineColor(kMuPlusPi));
+ hMCmuonsAndPions->SetName(Form("%s_muonsAdded", hDeltaPrMC[slice][kPi - 1]->GetName()));
+ hMCmuonsAndPions->Draw("same");
+ }
+
+ hDeltaPr[slice]->Draw("esame");
+
+ legend->Draw();
+
+ cSingleFit[slice][3]->cd(2);
+ hDeltaPrFitQA[slice]->GetYaxis()->SetRangeUser(fitQAaxisLowBound, fitQAaxisUpBound);
+ hDeltaPrFitQA[slice]->Draw("e");
+
+ hReducedChiSquarePt->SetBinContent(slice + 1, 4, reducedChiSquare);
+
+ TMatrixDSym covMatrixPr(nParUsed, &covMatrix[0][0]);
+
+ if (fitMethod == 1) {
+ integralProtons = allDeltaProton * parametersOut[2]; // Histos are normalised => expression equals integral
+ integralTotal += integralProtons;
+ /*
+ integralErrorTotalDeltaProton = getErrorOfTotalIntegral(covMatrixPr) * allDeltaProton;
+
+ integralErrorProtons = allDeltaProton * parameterErrorsOut[2];
+ */
+
+ integralProtonsDeltaProton = integralProtons;
+
+ // Compare comment above
+ integralPionsDeltaProton = allDeltaProton * (parametersOut[0] + (muonContamination ? parametersOut[3] : 0));
+ integralElectronsDeltaProton = allDeltaProton * parametersOut[3];
+ integralKaonsDeltaProton = allDeltaProton * parametersOut[1];
+ integralMuonsDeltaProton = allDeltaProton * parametersOut[4];
+
+
+ /*
+ integralErrorProtonsDeltaProton = integralErrorProtons;
+
+ integralErrorPionsDeltaProton = getErrorOfPionIntegral(covMatrixPr) * allDeltaProton;
+ integralErrorElectronsDeltaProton = allDeltaProton * parameterErrorsOut[3];
+ integralErrorKaonsDeltaProton = allDeltaProton * parameterErrorsOut[1];
+ */
+ }
+ else {
+ setFractionsAndYields(slice, inverseBinWidth, binWidthFitHisto, kPr, parametersOut, parameterErrorsOut, hFractionProtons,
+ hFractionPionsDeltaProton, hFractionElectronsDeltaProton, hFractionKaonsDeltaProton,
+ hFractionProtonsDeltaProton, hFractionMuonsDeltaProton, hYieldProtons, hYieldPionsDeltaProton,
+ hYieldElectronsDeltaProton, hYieldKaonsDeltaProton, hYieldProtonsDeltaProton, hYieldMuonsDeltaProton);
+ }
+
+ std::cout << std::endl << std::endl;
+
+
+ if (fitMethod == 1) {
+ // Calculate fractions and yields for method 1
+ if (integralTotal > 0) {
+
+ Double_t sumOfParticles = 0;
+
+ // Check fraction and yield determination for systematics
+ // DeltaPion
+ Double_t integralTotalDeltaPion = integralPionsDeltaPion + integralElectronsDeltaPion +
+ (takeIntoAccountMuons ? integralMuonsDeltaPion : 0.) +
+ integralKaonsDeltaPion + integralProtonsDeltaPion;
+ totalDeltaPion->GetParameters(parametersOut);
+
+ Double_t pionFractionDeltaPion = saveDivide(integralPionsDeltaPion, integralTotalDeltaPion);
+ Double_t pionFractionErrorDeltaPion = getErrorOfPionFraction(parametersOut, covMatrixPi);
+ hFractionPionsDeltaPion->SetBinContent(slice + 1, pionFractionDeltaPion);
+ hFractionPionsDeltaPion->SetBinError(slice + 1, pionFractionErrorDeltaPion);
+
+ Double_t electronFractionDeltaPion = saveDivide(integralElectronsDeltaPion, integralTotalDeltaPion);
+ Double_t electronFractionErrorDeltaPion = getErrorOfElectronFraction(parametersOut, covMatrixPi);
+ hFractionElectronsDeltaPion->SetBinContent(slice + 1, electronFractionDeltaPion);
+ hFractionElectronsDeltaPion->SetBinError(slice + 1, electronFractionErrorDeltaPion);
+
+ Double_t kaonFractionDeltaPion = saveDivide(integralKaonsDeltaPion, integralTotalDeltaPion);
+ Double_t kaonFractionErrorDeltaPion = getErrorOfKaonFraction(parametersOut, covMatrixPi);
+ hFractionKaonsDeltaPion->SetBinContent(slice + 1, kaonFractionDeltaPion);
+ hFractionKaonsDeltaPion->SetBinError(slice + 1, kaonFractionErrorDeltaPion);
+
+ Double_t protonFractionDeltaPion = saveDivide(integralProtonsDeltaPion, integralTotalDeltaPion);
+ Double_t protonFractionErrorDeltaPion = getErrorOfProtonFraction(parametersOut, covMatrixPi);
+ hFractionProtonsDeltaPion->SetBinContent(slice + 1, protonFractionDeltaPion);
+ hFractionProtonsDeltaPion->SetBinError(slice + 1, protonFractionErrorDeltaPion);
+
+ Double_t muonFractionDeltaPion = saveDivide(integralMuonsDeltaPion, integralTotalDeltaPion);
+ // TODO Error is anyway not implemented correctly. Just take electron error as an approximation
+ Double_t muonFractionErrorDeltaPion = getErrorOfElectronFraction(parametersOut, covMatrixPi);
+ hFractionMuonsDeltaPion->SetBinContent(slice + 1, muonFractionDeltaPion);
+ hFractionMuonsDeltaPion->SetBinError(slice + 1, muonFractionErrorDeltaPion);
+
+ sumOfParticles = inverseBinWidth * gausParamsPi[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width
+
+ hYieldPionsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaPion->GetBinContent(slice + 1));
+ hYieldPionsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaPion->GetBinError(slice + 1));
+ hYieldElectronsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaPion->GetBinContent(slice + 1));
+ hYieldElectronsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaPion->GetBinError(slice + 1));
+ hYieldKaonsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaPion->GetBinContent(slice + 1));
+ hYieldKaonsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaPion->GetBinError(slice + 1));
+ hYieldProtonsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaPion->GetBinContent(slice + 1));
+ hYieldProtonsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaPion->GetBinError(slice + 1));
+ hYieldMuonsDeltaPion->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaPion->GetBinContent(slice + 1));
+ hYieldMuonsDeltaPion->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaPion->GetBinError(slice + 1));
+
+
+ // DeltaElectron
+ Double_t integralTotalDeltaElectron = integralPionsDeltaElectron + integralElectronsDeltaElectron +
+ (takeIntoAccountMuons ? integralMuonsDeltaElectron : 0.) +
+ integralKaonsDeltaElectron + integralProtonsDeltaElectron;
+ totalDeltaElectron->GetParameters(parametersOut);
+
+ Double_t pionFractionDeltaElectron = saveDivide(integralPionsDeltaElectron, integralTotalDeltaElectron);
+ Double_t pionFractionErrorDeltaElectron = getErrorOfPionFraction(parametersOut, covMatrixEl);
+ hFractionPionsDeltaElectron->SetBinContent(slice + 1, pionFractionDeltaElectron);
+ hFractionPionsDeltaElectron->SetBinError(slice + 1, pionFractionErrorDeltaElectron);
+
+ Double_t electronFractionDeltaElectron = saveDivide(integralElectronsDeltaElectron, integralTotalDeltaElectron);
+ Double_t electronFractionErrorDeltaElectron = getErrorOfElectronFraction(parametersOut, covMatrixEl);
+ hFractionElectronsDeltaElectron->SetBinContent(slice + 1, electronFractionDeltaElectron);
+ hFractionElectronsDeltaElectron->SetBinError(slice + 1, electronFractionErrorDeltaElectron);
+
+ Double_t kaonFractionDeltaElectron = saveDivide(integralKaonsDeltaElectron, integralTotalDeltaElectron);
+ Double_t kaonFractionErrorDeltaElectron = getErrorOfKaonFraction(parametersOut, covMatrixEl);
+ hFractionKaonsDeltaElectron->SetBinContent(slice + 1, kaonFractionDeltaElectron);
+ hFractionKaonsDeltaElectron->SetBinError(slice + 1, kaonFractionErrorDeltaElectron);
+
+ Double_t protonFractionDeltaElectron = saveDivide(integralProtonsDeltaElectron, integralTotalDeltaElectron);
+ Double_t protonFractionErrorDeltaElectron = getErrorOfProtonFraction(parametersOut, covMatrixEl);
+ hFractionProtonsDeltaElectron->SetBinContent(slice + 1, protonFractionDeltaElectron);
+ hFractionProtonsDeltaElectron->SetBinError(slice + 1, protonFractionErrorDeltaElectron);
+
+ Double_t muonFractionDeltaElectron = saveDivide(integralMuonsDeltaElectron, integralTotalDeltaElectron);
+ // TODO Error is anyway not implemented correctly. Just take electron error as an approximation
+ Double_t muonFractionErrorDeltaElectron = getErrorOfElectronFraction(parametersOut, covMatrixEl);
+ hFractionMuonsDeltaElectron->SetBinContent(slice + 1, muonFractionDeltaElectron);
+ hFractionMuonsDeltaElectron->SetBinError(slice + 1, muonFractionErrorDeltaElectron);
+
+ sumOfParticles = inverseBinWidth * gausParamsEl[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width
+
+ hYieldPionsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaElectron->GetBinContent(slice + 1));
+ hYieldPionsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaElectron->GetBinError(slice + 1));
+ hYieldElectronsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaElectron->GetBinContent(slice + 1));
+ hYieldElectronsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaElectron->GetBinError(slice + 1));
+ hYieldKaonsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaElectron->GetBinContent(slice + 1));
+ hYieldKaonsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaElectron->GetBinError(slice + 1));
+ hYieldProtonsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaElectron->GetBinContent(slice + 1));
+ hYieldProtonsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaElectron->GetBinError(slice + 1));
+ hYieldMuonsDeltaElectron->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaElectron->GetBinContent(slice + 1));
+ hYieldMuonsDeltaElectron->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaElectron->GetBinError(slice + 1));
+
+
+ // DeltaKaon
+ Double_t integralTotalDeltaKaon = integralPionsDeltaKaon + integralElectronsDeltaKaon +
+ (takeIntoAccountMuons ? integralMuonsDeltaKaon : 0.) +
+ integralKaonsDeltaKaon + integralProtonsDeltaKaon;
+ totalDeltaKaon->GetParameters(parametersOut);
+
+ Double_t pionFractionDeltaKaon = saveDivide(integralPionsDeltaKaon, integralTotalDeltaKaon);
+ Double_t pionFractionErrorDeltaKaon = getErrorOfPionFraction(parametersOut, covMatrixKa);
+ hFractionPionsDeltaKaon->SetBinContent(slice + 1, pionFractionDeltaKaon);
+ hFractionPionsDeltaKaon->SetBinError(slice + 1, pionFractionErrorDeltaKaon);
+
+ Double_t electronFractionDeltaKaon = saveDivide(integralElectronsDeltaKaon, integralTotalDeltaKaon);
+ Double_t electronFractionErrorDeltaKaon = getErrorOfElectronFraction(parametersOut, covMatrixKa);
+ hFractionElectronsDeltaKaon->SetBinContent(slice + 1, electronFractionDeltaKaon);
+ hFractionElectronsDeltaKaon->SetBinError(slice + 1, electronFractionErrorDeltaKaon);
+
+ Double_t kaonFractionDeltaKaon = saveDivide(integralKaonsDeltaKaon, integralTotalDeltaKaon);
+ Double_t kaonFractionErrorDeltaKaon = getErrorOfKaonFraction(parametersOut, covMatrixKa);
+ hFractionKaonsDeltaKaon->SetBinContent(slice + 1, kaonFractionDeltaKaon);
+ hFractionKaonsDeltaKaon->SetBinError(slice + 1, kaonFractionErrorDeltaKaon);
+
+ Double_t protonFractionDeltaKaon = saveDivide(integralProtonsDeltaKaon, integralTotalDeltaKaon);
+ Double_t protonFractionErrorDeltaKaon = getErrorOfProtonFraction(parametersOut, covMatrixKa);
+ hFractionProtonsDeltaKaon->SetBinContent(slice + 1, protonFractionDeltaKaon);
+ hFractionProtonsDeltaKaon->SetBinError(slice + 1, protonFractionErrorDeltaKaon);
+
+ Double_t muonFractionDeltaKaon = saveDivide(integralMuonsDeltaKaon, integralTotalDeltaKaon);
+ // TODO Error is anyway not implemented correctly. Just take electron error as an approximation
+ Double_t muonFractionErrorDeltaKaon = getErrorOfElectronFraction(parametersOut, covMatrixKa);
+ hFractionMuonsDeltaKaon->SetBinContent(slice + 1, muonFractionDeltaKaon);
+ hFractionMuonsDeltaKaon->SetBinError(slice + 1, muonFractionErrorDeltaKaon);
+
+ sumOfParticles = inverseBinWidth * gausParamsKa[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width
+
+ hYieldPionsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaKaon->GetBinContent(slice + 1));
+ hYieldPionsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaKaon->GetBinError(slice + 1));
+ hYieldElectronsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaKaon->GetBinContent(slice + 1));
+ hYieldElectronsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaKaon->GetBinError(slice + 1));
+ hYieldKaonsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaKaon->GetBinContent(slice + 1));
+ hYieldKaonsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaKaon->GetBinError(slice + 1));
+ hYieldProtonsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaKaon->GetBinContent(slice + 1));
+ hYieldProtonsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaKaon->GetBinError(slice + 1));
+ hYieldMuonsDeltaKaon->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaKaon->GetBinContent(slice + 1));
+ hYieldMuonsDeltaKaon->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaKaon->GetBinError(slice + 1));
+
+
+
+ // DeltaProton
+ Double_t integralTotalDeltaProton = integralPionsDeltaProton + integralElectronsDeltaProton +
+ (takeIntoAccountMuons ? integralMuonsDeltaProton : 0.) +
+ integralKaonsDeltaProton + integralProtonsDeltaProton;
+ totalDeltaProton->GetParameters(parametersOut);
+
+ Double_t pionFractionDeltaProton = saveDivide(integralPionsDeltaProton, integralTotalDeltaProton);
+ Double_t pionFractionErrorDeltaProton = getErrorOfPionFraction(parametersOut, covMatrixPr);
+ hFractionPionsDeltaProton->SetBinContent(slice + 1, pionFractionDeltaProton);
+ hFractionPionsDeltaProton->SetBinError(slice + 1, pionFractionErrorDeltaProton);
+
+ Double_t electronFractionDeltaProton = saveDivide(integralElectronsDeltaProton, integralTotalDeltaProton);
+ Double_t electronFractionErrorDeltaProton = getErrorOfElectronFraction(parametersOut, covMatrixPr);
+ hFractionElectronsDeltaProton->SetBinContent(slice + 1, electronFractionDeltaProton);
+ hFractionElectronsDeltaProton->SetBinError(slice + 1, electronFractionErrorDeltaProton);
+
+ Double_t kaonFractionDeltaProton = saveDivide(integralKaonsDeltaProton, integralTotalDeltaProton);
+ Double_t kaonFractionErrorDeltaProton = getErrorOfKaonFraction(parametersOut, covMatrixPr);
+ hFractionKaonsDeltaProton->SetBinContent(slice + 1, kaonFractionDeltaProton);
+ hFractionKaonsDeltaProton->SetBinError(slice + 1, kaonFractionErrorDeltaProton);
+
+ Double_t protonFractionDeltaProton = saveDivide(integralProtonsDeltaProton, integralTotalDeltaProton);
+ Double_t protonFractionErrorDeltaProton = getErrorOfProtonFraction(parametersOut, covMatrixPr);
+ hFractionProtonsDeltaProton->SetBinContent(slice + 1, protonFractionDeltaProton);
+ hFractionProtonsDeltaProton->SetBinError(slice + 1, protonFractionErrorDeltaProton);
+
+ Double_t muonFractionDeltaProton = saveDivide(integralMuonsDeltaProton, integralTotalDeltaProton);
+ // TODO Error is anyway not implemented correctly. Just take electron error as an approximation
+ Double_t muonFractionErrorDeltaProton = getErrorOfElectronFraction(parametersOut, covMatrixPr);
+ hFractionMuonsDeltaProton->SetBinContent(slice + 1, muonFractionDeltaProton);
+ hFractionMuonsDeltaProton->SetBinError(slice + 1, muonFractionErrorDeltaProton);
+
+ sumOfParticles = inverseBinWidth * gausParamsPr[5] / binWidthFitHisto; // Divide by binWidthFitHisto, since gausParamsXX includes this width
+
+ hYieldPionsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionPionsDeltaProton->GetBinContent(slice + 1));
+ hYieldPionsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionPionsDeltaProton->GetBinError(slice + 1));
+ hYieldElectronsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionElectronsDeltaProton->GetBinContent(slice + 1));
+ hYieldElectronsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionElectronsDeltaProton->GetBinError(slice + 1));
+ hYieldKaonsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionKaonsDeltaProton->GetBinContent(slice + 1));
+ hYieldKaonsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionKaonsDeltaProton->GetBinError(slice + 1));
+ hYieldProtonsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionProtonsDeltaProton->GetBinContent(slice + 1));
+ hYieldProtonsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionProtonsDeltaProton->GetBinError(slice + 1));
+ hYieldMuonsDeltaProton->SetBinContent(slice + 1, sumOfParticles * hFractionMuonsDeltaProton->GetBinContent(slice + 1));
+ hYieldMuonsDeltaProton->SetBinError(slice + 1, sumOfParticles * hFractionMuonsDeltaProton->GetBinError(slice + 1));
+
+
+
+ // Take for XXXXfractionError the median of XXXXfractionErrorYYYY and do not take into account errors
+ // with value zero, since the should correspond to a failed fit (but the other fits can still converge).
+ // Same for the yields
+ Double_t pionFraction = saveDivide(integralPions, integralTotal);
+ Double_t errorsPions[4] = { pionFractionErrorDeltaPion, pionFractionErrorDeltaElectron,
+ pionFractionErrorDeltaKaon, pionFractionErrorDeltaProton };
+ Double_t pionFractionError = getMedianOfNonZeros(errorsPions);
+
+ Double_t electronFraction = saveDivide(integralElectrons, integralTotal);
+ Double_t errorsElectrons[4] = { electronFractionErrorDeltaPion, electronFractionErrorDeltaElectron,
+ electronFractionErrorDeltaKaon, electronFractionErrorDeltaProton };
+ Double_t electronFractionError = getMedianOfNonZeros(errorsElectrons);
+
+ Double_t kaonFraction = saveDivide(integralKaons, integralTotal);
+ Double_t errorsKaons[4] = { kaonFractionErrorDeltaPion, kaonFractionErrorDeltaElectron,
+ kaonFractionErrorDeltaKaon, kaonFractionErrorDeltaProton };
+ Double_t kaonFractionError = getMedianOfNonZeros(errorsKaons);
+
+ Double_t protonFraction = saveDivide(integralProtons, integralTotal);
+ Double_t errorsProtons[4] = { protonFractionErrorDeltaPion, protonFractionErrorDeltaElectron,
+ protonFractionErrorDeltaKaon, protonFractionErrorDeltaProton };
+ Double_t protonFractionError = getMedianOfNonZeros(errorsProtons);
+
+ Double_t muonFraction = saveDivide(integralMuons, integralTotal);
+ Double_t errorsMuons[4] = { muonFractionErrorDeltaPion, muonFractionErrorDeltaElectron,
+ muonFractionErrorDeltaKaon, muonFractionErrorDeltaProton };
+ Double_t muonFractionError = getMedianOfNonZeros(errorsMuons);
+
+ hFractionPions->SetBinContent(slice + 1, pionFraction);
+ hFractionPions->SetBinError(slice + 1, pionFractionError);
+ hFractionElectrons->SetBinContent(slice + 1, electronFraction);
+ hFractionElectrons->SetBinError(slice + 1, electronFractionError);
+ hFractionKaons->SetBinContent(slice + 1, kaonFraction);
+ hFractionKaons->SetBinError(slice + 1, kaonFractionError);
+ hFractionProtons->SetBinContent(slice + 1, protonFraction);
+ hFractionProtons->SetBinError(slice + 1, protonFractionError);
+ hFractionMuons->SetBinContent(slice + 1, muonFraction);
+ hFractionMuons->SetBinError(slice + 1, muonFractionError);
+
+ hFractionSummed->SetBinContent(slice + 1, pionFraction + electronFraction + (takeIntoAccountMuons ? muonFraction : 0.) +
+ kaonFraction + protonFraction);
+ hFractionSummed->SetBinError(slice + 1,
+ TMath::Sqrt(TMath::Power(pionFractionError, 2) +
+ TMath::Power(electronFractionError, 2) +
+ (takeIntoAccountMuons ? TMath::Power(muonFractionError, 2) : 0.) +
+ TMath::Power(kaonFractionError, 2) +
+ TMath::Power(protonFractionError, 2)));
+
+ sumOfParticles = inverseBinWidth * integralTotal / binWidthFitHisto; // Divide by binWidthFitHisto, since integralTotal includes this width
+
+ hYieldPions->SetBinContent(slice + 1, sumOfParticles * hFractionPions->GetBinContent(slice + 1));
+ hYieldPions->SetBinError(slice + 1, sumOfParticles * hFractionPions->GetBinError(slice + 1));
+ hYieldElectrons->SetBinContent(slice + 1, sumOfParticles * hFractionElectrons->GetBinContent(slice + 1));
+ hYieldElectrons->SetBinError(slice + 1, sumOfParticles * hFractionElectrons->GetBinError(slice + 1));
+ hYieldKaons->SetBinContent(slice + 1, sumOfParticles * hFractionKaons->GetBinContent(slice + 1));
+ hYieldKaons->SetBinError(slice + 1, sumOfParticles * hFractionKaons->GetBinError(slice + 1));
+ hYieldProtons->SetBinContent(slice + 1, sumOfParticles * hFractionProtons->GetBinContent(slice + 1));
+ hYieldProtons->SetBinError(slice + 1, sumOfParticles * hFractionProtons->GetBinError(slice + 1));
+ hYieldMuons->SetBinContent(slice + 1, sumOfParticles * hFractionMuons->GetBinContent(slice + 1));
+ hYieldMuons->SetBinError(slice + 1, sumOfParticles * hFractionMuons->GetBinError(slice + 1));
+ }
+ }
+ else {
+ Double_t SumFractionsDeltaElectron = hFractionPionsDeltaElectron->GetBinContent(slice + 1) +
+ hFractionElectronsDeltaElectron->GetBinContent(slice + 1) +
+ (takeIntoAccountMuons ? hFractionMuonsDeltaElectron->GetBinContent(slice + 1) : 0.) +
+ hFractionKaonsDeltaElectron->GetBinContent(slice + 1) + hFractionProtonsDeltaElectron->GetBinContent(slice + 1);
+
+ Double_t SumFractionsDeltaKaon = hFractionPionsDeltaKaon->GetBinContent(slice + 1) +
+ hFractionElectronsDeltaKaon->GetBinContent(slice + 1) +
+ (takeIntoAccountMuons ? hFractionMuonsDeltaKaon->GetBinContent(slice + 1) : 0.) +
+ hFractionKaonsDeltaKaon->GetBinContent(slice + 1) + hFractionProtonsDeltaKaon->GetBinContent(slice + 1);
+
+ Double_t SumFractionsDeltaPion = hFractionPionsDeltaPion->GetBinContent(slice + 1) +
+ hFractionElectronsDeltaPion->GetBinContent(slice + 1) +
+ (takeIntoAccountMuons ? hFractionMuonsDeltaPion->GetBinContent(slice + 1) : 0.) +
+ hFractionKaonsDeltaPion->GetBinContent(slice + 1) + hFractionProtonsDeltaPion->GetBinContent(slice + 1);
+
+ Double_t SumFractionsDeltaProton = hFractionPionsDeltaProton->GetBinContent(slice + 1) +
+ hFractionElectronsDeltaProton->GetBinContent(slice + 1) +
+ (takeIntoAccountMuons ? hFractionMuonsDeltaProton->GetBinContent(slice + 1) : 0.) +
+ hFractionKaonsDeltaProton->GetBinContent(slice + 1) + hFractionProtonsDeltaProton->GetBinContent(slice + 1);
+
+ Double_t SumFractionsUsed = hFractionPionsDeltaPion->GetBinContent(slice + 1) +
+ hFractionElectronsDeltaElectron->GetBinContent(slice + 1) +
+ (takeIntoAccountMuons ? hFractionMuonsDeltaPion->GetBinContent(slice + 1) : 0.) +
+ hFractionKaonsDeltaKaon->GetBinContent(slice + 1) + hFractionProtonsDeltaProton->GetBinContent(slice + 1);
+
+ hFractionSummed->SetBinContent(slice + 1, SumFractionsUsed);
+ hFractionSummed->SetBinError(slice + 1,
+ TMath::Sqrt(TMath::Power(hFractionPionsDeltaPion->GetBinError(slice + 1), 2) +
+ TMath::Power(hFractionElectronsDeltaElectron->GetBinError(slice + 1), 2) +
+ (takeIntoAccountMuons ? TMath::Power(hFractionMuonsDeltaPion->GetBinError(slice + 1),
+ 2) : 0.) +
+ TMath::Power(hFractionKaonsDeltaKaon->GetBinError(slice + 1), 2) +
+ TMath::Power(hFractionProtonsDeltaProton->GetBinError(slice + 1), 2)));
+
+
+ std::cout << "Sum Fractions DeltaElectron: " << SumFractionsDeltaElectron;
+ std::cout << (TMath::Abs(SumFractionsDeltaElectron - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;
+
+ std::cout << "Sum Fractions DeltaKaon: " << SumFractionsDeltaKaon;
+ std::cout << (TMath::Abs(SumFractionsDeltaKaon - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;
+
+ std::cout << "Sum Fractions DeltaPion: " << SumFractionsDeltaPion;
+ std::cout << (TMath::Abs(SumFractionsDeltaPion - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;
+
+ std::cout << "Sum fractions DeltaProton: " << SumFractionsDeltaProton;
+ std::cout << (TMath::Abs(SumFractionsDeltaProton - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;
+
+ std::cout << "Sum fractions used: " << SumFractionsUsed;
+ std::cout << (TMath::Abs(SumFractionsUsed - 1) >= 0.001 ? " WARNING: Deviation >= 0.001" : "") << std::endl;
+ }
+
+ for (Int_t species = 0; species < 4; species++) {
+ cSingleFit[slice][species]->Modified();
+ cSingleFit[slice][species]->Update();
+ }
+
+
+ }
+
+ if (regularisation <= 0)
+ std::cout << std::endl << std::endl;
+
+
+ // MC results
+ Double_t MCtotal = -1, MCelectrons = -1, MCkaons = -1, MCmuons = -1, MCpions = -1, MCprotons = -1;
+ Double_t MCelectronsErr = 0, MCkaonsErr = 0, MCmuonsErr = 0, MCpionsErr = 0, MCprotonsErr = 0;
+
+ MCelectrons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 1, 1, MCelectronsErr) * inverseBinWidth;
+ MCkaons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 2, 2, MCkaonsErr) * inverseBinWidth;
+ MCmuons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 3, 3, MCmuonsErr) * inverseBinWidth;
+ MCpions = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 4, 4, MCpionsErr) * inverseBinWidth;
+ MCprotons = hMCdata->IntegralAndError(pBinLowProjLimit, pBinUpProjLimit, 5, 5, MCprotonsErr) * inverseBinWidth;
+
+ MCelectronsErr *= inverseBinWidth;
+ MCkaonsErr *= inverseBinWidth;
+ MCmuonsErr *= inverseBinWidth;
+ MCpionsErr *= inverseBinWidth;
+ MCprotonsErr *= inverseBinWidth;
+
+ MCtotal = MCelectrons + MCkaons + MCpions + MCprotons + MCmuons;
+
+ if (MCtotal > 0) {
+ hYieldElectronsMC->SetBinContent(slice + 1, MCelectrons);
+ hYieldElectronsMC->SetBinError(slice + 1, MCelectronsErr);
+
+ hYieldMuonsMC->SetBinContent(slice + 1, MCmuons);
+ hYieldMuonsMC->SetBinError(slice + 1, MCmuonsErr);
+
+ hYieldKaonsMC->SetBinContent(slice + 1, MCkaons);
+ hYieldKaonsMC->SetBinError(slice + 1, MCkaonsErr);
+
+ hYieldPionsMC->SetBinContent(slice + 1, MCpions);
+ hYieldPionsMC->SetBinError(slice + 1, MCpionsErr);
+
+ hYieldProtonsMC->SetBinContent(slice + 1, MCprotons);
+ hYieldProtonsMC->SetBinError(slice + 1, MCprotonsErr);
+
+ hYieldSummedMC->SetBinContent(slice + 1, hYieldElectronsMC->GetBinContent(slice + 1) +
+ hYieldKaonsMC->GetBinContent(slice + 1) +
+ hYieldPionsMC->GetBinContent(slice + 1) +
+ hYieldProtonsMC->GetBinContent(slice + 1) +
+ hYieldMuonsMC->GetBinContent(slice + 1));
+ hYieldSummedMC->SetBinError(slice + 1, TMath::Sqrt(TMath::Power(hYieldPionsMC->GetBinError(slice + 1), 2) +
+ TMath::Power(hYieldElectronsMC->GetBinError(slice + 1), 2) +
+ TMath::Power(hYieldKaonsMC->GetBinError(slice + 1), 2) +
+ TMath::Power(hYieldProtonsMC->GetBinError(slice + 1), 2) +
+ TMath::Power(hYieldMuonsMC->GetBinError(slice + 1), 2)));
+
+ // MCspecies and MCtotal are correlated. This can be taken into account via using the binomial error in the division
+ hFractionElectronsMC->Divide(hYieldElectronsMC, hYieldSummedMC, 1., 1., "B");
+ hFractionMuonsMC->Divide(hYieldMuonsMC, hYieldSummedMC, 1., 1., "B");
+ hFractionKaonsMC->Divide(hYieldKaonsMC, hYieldSummedMC, 1., 1., "B");
+ hFractionPionsMC->Divide(hYieldPionsMC, hYieldSummedMC, 1., 1., "B");
+ hFractionProtonsMC->Divide(hYieldProtonsMC, hYieldSummedMC, 1., 1., "B");
+ }
+
+ // Save further results
+ if (slice % 18 == 0 || slice == pSliceLow) {
+ saveF->cd();
+
+ if (hFractionElectrons)
+ hFractionElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaons)
+ hFractionKaons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPions)
+ hFractionPions->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtons)
+ hFractionProtons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuons)
+ hFractionMuons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionSummed)
+ hFractionSummed->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaElectron)
+ hFractionElectronsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaElectron)
+ hFractionKaonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaElectron)
+ hFractionPionsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaElectron)
+ hFractionProtonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaElectron)
+ hFractionMuonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaPion)
+ hFractionElectronsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaPion)
+ hFractionKaonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaPion)
+ hFractionPionsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaPion)
+ hFractionProtonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaPion)
+ hFractionMuonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaKaon)
+ hFractionElectronsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaKaon)
+ hFractionKaonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaKaon)
+ hFractionPionsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaKaon)
+ hFractionProtonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaKaon)
+ hFractionMuonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaProton)
+ hFractionElectronsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaProton)
+ hFractionKaonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaProton)
+ hFractionPionsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaProton)
+ hFractionProtonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaProton)
+ hFractionMuonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsMC)
+ hFractionElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsMC)
+ hFractionKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsMC)
+ hFractionPionsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsMC)
+ hFractionMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsMC)
+ hFractionProtonsMC->Write(0, TObject::kWriteDelete);
+
+
+
+
+ if (hYieldElectrons)
+ hYieldElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaons)
+ hYieldKaons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPions)
+ hYieldPions->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtons)
+ hYieldProtons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuons)
+ hYieldMuons->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaElectron)
+ hYieldElectronsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaElectron)
+ hYieldKaonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaElectron)
+ hYieldPionsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaElectron)
+ hYieldProtonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaElectron)
+ hYieldMuonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaPion)
+ hYieldElectronsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaPion)
+ hYieldKaonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaPion)
+ hYieldPionsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaPion)
+ hYieldProtonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaPion)
+ hYieldMuonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaKaon)
+ hYieldElectronsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaKaon)
+ hYieldKaonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaKaon)
+ hYieldPionsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaKaon)
+ hYieldProtonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaKaon)
+ hYieldMuonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaProton)
+ hYieldElectronsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaProton)
+ hYieldKaonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaProton)
+ hYieldPionsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaProton)
+ hYieldProtonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaProton)
+ hYieldMuonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsMC)
+ hYieldElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsMC)
+ hYieldKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsMC)
+ hYieldPionsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsMC)
+ hYieldMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsMC)
+ hYieldProtonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldSummedMC)
+ hYieldSummedMC->Write(0, TObject::kWriteDelete);
+ }
+
+ TString saveDir = (mode == kPMpT) ? Form("SingleFit_%.2f_Pt_%.2f", binsPt[slice], binsPt[slice + 1])
+ : Form("SingleFit_%.2f_%s_%.2f", hFractionPions->GetXaxis()->GetBinLowEdge(slice + 1),
+ modeShortName[mode].Data(), hFractionPions->GetXaxis()->GetBinUpEdge(slice + 1));
+ saveF->mkdir(saveDir.Data());
+ saveF->cd(saveDir.Data());
+
+ for (Int_t species = 0; species < 4; species++) {
+ if (cSingleFit[slice][species]) {
+ cSingleFit[slice][species]->Write();
+ delete cSingleFit[slice][species];
+ }
+ }
+
+ if (hDeltaPi[slice])
+ hDeltaPi[slice]->Write();
+
+ if (hDeltaEl[slice])
+ hDeltaEl[slice]->Write();
+
+ if (hDeltaKa[slice])
+ hDeltaKa[slice]->Write();
+
+ if (hDeltaPr[slice])
+ hDeltaPr[slice]->Write();
+
+
+ if (hDeltaPiFitQA[slice])
+ hDeltaPiFitQA[slice]->Write();
+ delete hDeltaPiFitQA[slice];
+
+ if (hDeltaElFitQA[slice])
+ hDeltaElFitQA[slice]->Write();
+ delete hDeltaElFitQA[slice];
+
+ if (hDeltaKaFitQA[slice])
+ hDeltaKaFitQA[slice]->Write();
+ delete hDeltaKaFitQA[slice];
+
+ if (hDeltaPrFitQA[slice])
+ hDeltaPrFitQA[slice]->Write();
+ delete hDeltaPrFitQA[slice];
+
+ if (hGenDeltaElForElProj)
+ hGenDeltaElForElProj->Write();
+ delete hGenDeltaElForElProj;
+
+ if (hGenDeltaElForKaProj)
+ hGenDeltaElForKaProj->Write();
+ delete hGenDeltaElForKaProj;
+
+ if (hGenDeltaElForPiProj)
+ hGenDeltaElForPiProj->Write();
+ delete hGenDeltaElForPiProj;
+
+ if (hGenDeltaElForPrProj)
+ hGenDeltaElForPrProj->Write();
+ delete hGenDeltaElForPrProj;
+
+ if (hGenDeltaElForMuProj)
+ hGenDeltaElForMuProj->Write();
+ delete hGenDeltaElForMuProj;
+
+ //if (fitFuncTotalDeltaElectron[slice])
+ // fitFuncTotalDeltaElectron[slice]->Write();
+ delete fitFuncTotalDeltaElectron[slice];
+
+ if (hGenDeltaKaForElProj)
+ hGenDeltaKaForElProj->Write();
+ delete hGenDeltaKaForElProj;
+
+ if (hGenDeltaKaForKaProj)
+ hGenDeltaKaForKaProj->Write();
+ delete hGenDeltaKaForKaProj;
+
+ if (hGenDeltaKaForPiProj)
+ hGenDeltaKaForPiProj->Write();
+ delete hGenDeltaKaForPiProj;
+
+ if (hGenDeltaKaForPrProj)
+ hGenDeltaKaForPrProj->Write();
+ delete hGenDeltaKaForPrProj;
+
+ if (hGenDeltaKaForMuProj)
+ hGenDeltaKaForMuProj->Write();
+ delete hGenDeltaKaForMuProj;
+
+ //if (fitFuncTotalDeltaKaon[slice])
+ // fitFuncTotalDeltaKaon[slice]->Write();
+ delete fitFuncTotalDeltaKaon[slice];
+
+
+ if (hGenDeltaPiForElProj)
+ hGenDeltaPiForElProj->Write();
+ delete hGenDeltaPiForElProj;
+
+ if (hGenDeltaPiForKaProj)
+ hGenDeltaPiForKaProj->Write();
+ delete hGenDeltaPiForKaProj;
+
+ if (hGenDeltaPiForPiProj)
+ hGenDeltaPiForPiProj->Write();
+ delete hGenDeltaPiForPiProj;
+
+ if (hGenDeltaPiForPrProj)
+ hGenDeltaPiForPrProj->Write();
+ delete hGenDeltaPiForPrProj;
+
+ if (hGenDeltaPiForMuProj)
+ hGenDeltaPiForMuProj->Write();
+ delete hGenDeltaPiForMuProj;
+
+ //if (fitFuncTotalDeltaPion[slice])
+ // fitFuncTotalDeltaPion[slice]->Write();
+ delete fitFuncTotalDeltaPion[slice];
+
+
+ if (hGenDeltaPrForElProj)
+ hGenDeltaPrForElProj->Write();
+ delete hGenDeltaPrForElProj;
+
+ if (hGenDeltaPrForKaProj)
+ hGenDeltaPrForKaProj->Write();
+ delete hGenDeltaPrForKaProj;
+
+ if (hGenDeltaPrForPiProj)
+ hGenDeltaPrForPiProj->Write();
+ delete hGenDeltaPrForPiProj;
+
+ if (hGenDeltaPrForPrProj)
+ hGenDeltaPrForPrProj->Write();
+ delete hGenDeltaPrForPrProj;
+
+ if (hGenDeltaPrForMuProj)
+ hGenDeltaPrForMuProj->Write();
+ delete hGenDeltaPrForMuProj;
+
+ //if (fitFuncTotalDeltaProton[slice])
+ // fitFuncTotalDeltaProton[slice]->Write();
+ delete fitFuncTotalDeltaProton[slice];
+
+ delete totalDeltaElectron;
+ delete totalDeltaKaon;
+ delete totalDeltaPion;
+ delete totalDeltaProton;
+
+ delete legend;
+
+ if (errFlag != 0)
+ std::cout << "errFlag " << errFlag << std::endl << std::endl;
+ }
+ }
+
+ // Calculate MC to-pi ratios -> In MC the yields are uncorrelated, so just divide the histos to get the correct result
+ hRatioToPiElectronsMC->Divide(hYieldElectronsMC, hYieldPionsMC);
+ hRatioToPiMuonsMC->Divide(hYieldMuonsMC, hYieldPionsMC);
+ hRatioToPiKaonsMC->Divide(hYieldKaonsMC, hYieldPionsMC);
+ hRatioToPiProtonsMC->Divide(hYieldProtonsMC, hYieldPionsMC);
+
+
+ TCanvas* cFractions = new TCanvas("cFractions", "Particle fractions",100,10,1200,800);
+ cFractions->SetGridx(1);
+ cFractions->SetGridy(1);
+ cFractions->SetLogx(mode == kPMpT);
+ hFractionPions->GetYaxis()->SetRangeUser(0.0, 1.0);
+ SetReasonableAxisRange(hFractionPions->GetXaxis(), mode, pLow, pHigh);
+ hFractionPions->GetXaxis()->SetMoreLogLabels(kTRUE);
+ hFractionPions->GetXaxis()->SetNoExponent(kTRUE);
+ hFractionPions->Draw("e p");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hFractionPionsMC->GetXaxis(), mode, pLow, pHigh);
+ hFractionPionsMC->Draw("e p same");
+ }
+
+ SetReasonableAxisRange(hFractionKaons->GetXaxis(), mode, pLow, pHigh);
+ hFractionKaons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hFractionKaonsMC->GetXaxis(), mode, pLow, pHigh);
+ hFractionKaonsMC->Draw("e p same");
+ }
+
+ SetReasonableAxisRange(hFractionProtons->GetXaxis(), mode, pLow, pHigh);
+ hFractionProtons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hFractionProtonsMC->GetXaxis(), mode, pLow, pHigh);
+ hFractionProtonsMC->Draw("e p same");
+ }
+
+ SetReasonableAxisRange(hFractionElectrons->GetXaxis(), mode, pLow, pHigh);
+ hFractionElectrons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hFractionElectronsMC->GetXaxis(), mode, pLow, pHigh);
+ hFractionElectronsMC->Draw("e p same");
+ }
+
+ if (takeIntoAccountMuons) {
+ SetReasonableAxisRange(hFractionMuons->GetXaxis(), mode, pLow, pHigh);
+ hFractionMuons->Draw("e p same");
+ }
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hFractionMuonsMC->GetXaxis(), mode, pLow, pHigh);
+ hFractionMuonsMC->Draw("e p same");
+ }
+
+ hFractionSummed->Draw("e p same");
+
+ if (mode == kPMpT) {
+ fElectronFraction->SetRange(lowFittingBoundElectronFraction, pHigh);
+ fElectronFraction->Draw("same");
+ }
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+ if (plotIdentifiedSpectra)
+ legend->SetNColumns(2);
+ if (plotIdentifiedSpectra)
+ legend->AddEntry((TObject*)0x0, "Fit", "");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry((TObject*)0x0, identifiedLabels[isMC].Data(), "");
+ legend->AddEntry(hFractionPions, "#pi", "p");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hFractionPionsMC, "#pi", "p");
+ legend->AddEntry(hFractionKaons, "K", "p");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hFractionKaonsMC, "K", "p");
+ legend->AddEntry(hFractionProtons, "p", "p");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hFractionProtonsMC, "p", "p");
+ legend->AddEntry(hFractionElectrons, "e", "p");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hFractionElectronsMC, "e", "p");
+ if (takeIntoAccountMuons)
+ legend->AddEntry(hFractionMuons, "#mu", "p");
+ else
+ legend->AddEntry((TObject*)0x0, "", "");
+ if (plotIdentifiedSpectra)
+ legend->AddEntry(hFractionMuonsMC, "#mu", "p");
+ legend->AddEntry(hFractionSummed, "Total", "p");
+ legend->Draw();
+
+ ClearTitleFromHistoInCanvas(cFractions);
+
+
+ // Compare data points with MC
+ for (Int_t i = 1; i <= hFractionComparisonPions->GetNbinsX(); i++) {
+ hFractionComparisonPions->SetBinContent(i, hFractionPions->GetBinContent(i));
+ hFractionComparisonPions->SetBinError(i, hFractionPions->GetBinError(i));
+
+ hFractionComparisonElectrons->SetBinContent(i, hFractionElectrons->GetBinContent(i));
+ hFractionComparisonElectrons->SetBinError(i, hFractionElectrons->GetBinError(i));
+
+ if (takeIntoAccountMuons) {
+ hFractionComparisonMuons->SetBinContent(i, hFractionMuons->GetBinContent(i));
+ hFractionComparisonMuons->SetBinError(i, hFractionMuons->GetBinError(i));
+ }
+
+ hFractionComparisonKaons->SetBinContent(i, hFractionKaons->GetBinContent(i));
+ hFractionComparisonKaons->SetBinError(i, hFractionKaons->GetBinError(i));
+
+ hFractionComparisonProtons->SetBinContent(i, hFractionProtons->GetBinContent(i));
+ hFractionComparisonProtons->SetBinError(i, hFractionProtons->GetBinError(i));
+
+ hFractionComparisonTotal->SetBinContent(i, hFractionSummed->GetBinContent(i));
+ hFractionComparisonTotal->SetBinError(i, hFractionSummed->GetBinError(i));
+ }
+
+ hFractionComparisonPions->Divide(hFractionPionsMC);
+ hFractionComparisonElectrons->Divide(hFractionElectronsMC);
+ if (takeIntoAccountMuons)
+ hFractionComparisonMuons->Divide(hFractionMuonsMC);
+ hFractionComparisonKaons->Divide(hFractionKaonsMC);
+ hFractionComparisonProtons->Divide(hFractionProtonsMC);
+
+
+ TCanvas* cFractionComparisons = new TCanvas("cFractionComparisons", "Particle fraction comparisons",100,10,1200,800);
+ cFractionComparisons->SetGridx(1);
+ cFractionComparisons->SetGridy(1);
+ cFractionComparisons->SetLogx(mode == kPMpT);
+ hFractionComparisonPions->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hFractionComparisonPions->GetXaxis(), mode, pLow, pHigh);
+ hFractionComparisonPions->GetXaxis()->SetMoreLogLabels(kTRUE);
+ hFractionComparisonPions->GetXaxis()->SetNoExponent(kTRUE);
+ hFractionComparisonPions->Draw("e p");
+
+ hFractionComparisonElectrons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hFractionComparisonElectrons->GetXaxis(), mode, pLow, pHigh);
+ hFractionComparisonElectrons->Draw("e p same");
+
+ if (takeIntoAccountMuons) {
+ hFractionComparisonMuons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hFractionComparisonMuons->GetXaxis(), mode, pLow, pHigh);
+ hFractionComparisonMuons->Draw("e p same");
+ }
+
+ hFractionComparisonKaons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hFractionComparisonKaons->GetXaxis(), mode, pLow, pHigh);
+ hFractionComparisonKaons->Draw("e p same");
+
+ hFractionComparisonProtons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hFractionComparisonProtons->GetXaxis(), mode, pLow, pHigh);
+ hFractionComparisonProtons->Draw("e p same");
+
+ hFractionComparisonTotal->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hFractionComparisonTotal->GetXaxis(), mode, pLow, pHigh);
+ hFractionComparisonTotal->Draw("e p same");
+
+ TLegend* legend2 = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend2->SetBorderSize(0);
+ legend2->SetFillColor(0);
+ legend2->SetNColumns(2);
+ legend2->AddEntry(hFractionComparisonPions, "#pi", "p");
+ legend2->AddEntry(hFractionComparisonKaons, "K", "p");
+ legend2->AddEntry(hFractionComparisonProtons, "p", "p");
+ legend2->AddEntry(hFractionComparisonElectrons, "e", "p");
+ if (takeIntoAccountMuons)
+ legend2->AddEntry(hFractionComparisonMuons, "#mu", "p");
+ legend2->AddEntry(hFractionComparisonTotal, "Total", "p");
+ legend2->Draw();
+
+ ClearTitleFromHistoInCanvas(cFractionComparisons);
+
+ // Normalise the yields
+ normaliseYieldHist(hYieldPions, numEvents, deta);
+ normaliseYieldHist(hYieldPionsMC, numEvents, deta);
+ normaliseYieldHist(hYieldPionsDeltaElectron, numEvents, deta);
+ normaliseYieldHist(hYieldPionsDeltaPion, numEvents, deta);
+ normaliseYieldHist(hYieldPionsDeltaKaon, numEvents, deta);
+ normaliseYieldHist(hYieldPionsDeltaProton, numEvents, deta);
+
+ normaliseYieldHist(hYieldElectrons, numEvents, deta);
+ normaliseYieldHist(hYieldElectronsMC, numEvents, deta);
+ normaliseYieldHist(hYieldElectronsDeltaElectron, numEvents, deta);
+ normaliseYieldHist(hYieldElectronsDeltaPion, numEvents, deta);
+ normaliseYieldHist(hYieldElectronsDeltaKaon, numEvents, deta);
+ normaliseYieldHist(hYieldElectronsDeltaProton, numEvents, deta);
+
+ normaliseYieldHist(hYieldMuons, numEvents, deta);
+ normaliseYieldHist(hYieldMuonsMC, numEvents, deta);
+ normaliseYieldHist(hYieldMuonsDeltaElectron, numEvents, deta);
+ normaliseYieldHist(hYieldMuonsDeltaPion, numEvents, deta);
+ normaliseYieldHist(hYieldMuonsDeltaKaon, numEvents, deta);
+ normaliseYieldHist(hYieldMuonsDeltaProton, numEvents, deta);
+
+ normaliseYieldHist(hYieldKaons, numEvents, deta);
+ normaliseYieldHist(hYieldKaonsMC, numEvents, deta);
+ normaliseYieldHist(hYieldKaonsDeltaElectron, numEvents, deta);
+ normaliseYieldHist(hYieldKaonsDeltaPion, numEvents, deta);
+ normaliseYieldHist(hYieldKaonsDeltaKaon, numEvents, deta);
+ normaliseYieldHist(hYieldKaonsDeltaProton, numEvents, deta);
+
+ normaliseYieldHist(hYieldProtons, numEvents, deta);
+ normaliseYieldHist(hYieldProtonsMC, numEvents, deta);
+ normaliseYieldHist(hYieldProtonsDeltaElectron, numEvents, deta);
+ normaliseYieldHist(hYieldProtonsDeltaPion, numEvents, deta);
+ normaliseYieldHist(hYieldProtonsDeltaKaon, numEvents, deta);
+ normaliseYieldHist(hYieldProtonsDeltaProton, numEvents, deta);
+
+ normaliseYieldHist(hYieldSummedMC, numEvents, deta);
+
+ for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
+ if (hMCgenYieldsPrimSpecies[i]) {
+ Int_t color = kBlack;
+
+ switch (i) {
+ case AliPID::kElectron:
+ color = getLineColor(kEl);
+ break;
+ case AliPID::kKaon:
+ color = getLineColor(kKa);
+ break;
+ case AliPID::kMuon:
+ color = getLineColor(kMu);
+ break;
+ case AliPID::kPion:
+ color = getLineColor(kPi);
+ break;
+ case AliPID::kProton:
+ color = getLineColor(kPr);
+ break;
+ }
+
+ hMCgenYieldsPrimSpecies[i]->SetLineColor(color);
+ hMCgenYieldsPrimSpecies[i]->SetMarkerColor(color);
+ hMCgenYieldsPrimSpecies[i]->SetMarkerStyle(28);
+ hMCgenYieldsPrimSpecies[i]->SetLineStyle(1);
+ hMCgenYieldsPrimSpecies[i]->GetXaxis()->SetTitleOffset(1.0);
+ hMCgenYieldsPrimSpecies[i]->SetStats(kFALSE);
+
+ SetReasonableAxisRange(hMCgenYieldsPrimSpecies[i]->GetXaxis(), kPMpT, pLow, pHigh);
+ normaliseGenYieldMCtruthHist(hMCgenYieldsPrimSpecies[i], numEvents, deta);
+ }
+ }
+
+
+ // Compare data points with MC (yield)
+ for (Int_t i = 1; i <= hYieldComparisonPions->GetNbinsX(); i++) {
+ hYieldComparisonPions->SetBinContent(i, hYieldPions->GetBinContent(i));
+ hYieldComparisonPions->SetBinError(i, hYieldPions->GetBinError(i));
+
+ hYieldComparisonElectrons->SetBinContent(i, hYieldElectrons->GetBinContent(i));
+ hYieldComparisonElectrons->SetBinError(i, hYieldElectrons->GetBinError(i));
+
+ if (takeIntoAccountMuons) {
+ hYieldComparisonMuons->SetBinContent(i, hYieldMuons->GetBinContent(i));
+ hYieldComparisonMuons->SetBinError(i, hYieldMuons->GetBinError(i));
+ }
+
+ hYieldComparisonKaons->SetBinContent(i, hYieldKaons->GetBinContent(i));
+ hYieldComparisonKaons->SetBinError(i, hYieldKaons->GetBinError(i));
+
+ hYieldComparisonProtons->SetBinContent(i, hYieldProtons->GetBinContent(i));
+ hYieldComparisonProtons->SetBinError(i, hYieldProtons->GetBinError(i));
+ }
+
+ hYieldComparisonPions->Divide(hYieldPionsMC);
+ hYieldComparisonElectrons->Divide(hYieldElectronsMC);
+ if (takeIntoAccountMuons)
+ hYieldComparisonMuons->Divide(hYieldMuonsMC);
+ hYieldComparisonKaons->Divide(hYieldKaonsMC);
+ hYieldComparisonProtons->Divide(hYieldProtonsMC);
+
+
+ TCanvas* cYieldComparisons = new TCanvas("cYieldComparisons", "Particle yield comparisons",100,10,1200,800);
+ cYieldComparisons->SetGridx(1);
+ cYieldComparisons->SetGridy(1);
+ cYieldComparisons->SetLogx(mode == kPMpT);
+ hYieldComparisonPions->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hYieldComparisonPions->GetXaxis(), mode, pLow, pHigh);
+ hYieldComparisonPions->GetXaxis()->SetMoreLogLabels(kTRUE);
+ hYieldComparisonPions->GetXaxis()->SetNoExponent(kTRUE);
+ hYieldComparisonPions->Draw("e p");
+
+ hYieldComparisonElectrons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hYieldComparisonElectrons->GetXaxis(), mode, pLow, pHigh);
+ hYieldComparisonElectrons->Draw("e p same");
+
+ if (takeIntoAccountMuons) {
+ hYieldComparisonMuons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hYieldComparisonMuons->GetXaxis(), mode, pLow, pHigh);
+ hYieldComparisonMuons->Draw("e p same");
+ }
+
+ hYieldComparisonKaons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hYieldComparisonKaons->GetXaxis(), mode, pLow, pHigh);
+ hYieldComparisonKaons->Draw("e p same");
+
+ hYieldComparisonProtons->GetYaxis()->SetRangeUser(0.0, 10.0);
+ SetReasonableAxisRange(hYieldComparisonProtons->GetXaxis(), mode, pLow, pHigh);
+ hYieldComparisonProtons->Draw("e p same");
+
+ TLegend* legend3 = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend3->SetBorderSize(0);
+ legend3->SetFillColor(0);
+ legend3->SetNColumns(2);
+ legend3->AddEntry(hYieldComparisonPions, "#pi", "p");
+ legend3->AddEntry(hYieldComparisonKaons, "K", "p");
+ legend3->AddEntry(hYieldComparisonProtons, "p", "p");
+ legend3->AddEntry(hYieldComparisonElectrons, "e", "p");
+ if (takeIntoAccountMuons)
+ legend3->AddEntry(hYieldComparisonMuons, "#mu", "p");
+ legend3->Draw();
+
+ ClearTitleFromHistoInCanvas(cYieldComparisons);
+
+
+
+
+ TCanvas* cFractionsPions = drawFractionHistos("cFractionsPions", "Pion fractions", mode, pLow, pHigh, hFractionPionsDeltaPion,
+ hFractionPionsDeltaElectron, hFractionPionsDeltaKaon, hFractionPionsDeltaProton,
+ hFractionPionsMC, plotIdentifiedSpectra);
+
+
+ TCanvas* cFractionsElectrons = drawFractionHistos("cFractionsElectrons", "Electron fractions", mode, pLow, pHigh,
+ hFractionElectronsDeltaPion, hFractionElectronsDeltaElectron,
+ hFractionElectronsDeltaKaon, hFractionElectronsDeltaProton, hFractionElectronsMC,
+ plotIdentifiedSpectra);
+
+ TCanvas* cFractionsKaons = drawFractionHistos("cFractionsKaons", "Kaon fractions", mode, pLow, pHigh, hFractionKaonsDeltaPion,
+ hFractionKaonsDeltaElectron, hFractionKaonsDeltaKaon, hFractionKaonsDeltaProton,
+ hFractionKaonsMC, plotIdentifiedSpectra);
+
+ TCanvas* cFractionsProtons = drawFractionHistos("cFractionsProtons", "Proton fractions", mode, pLow, pHigh, hFractionProtonsDeltaPion,
+ hFractionProtonsDeltaElectron, hFractionProtonsDeltaKaon, hFractionProtonsDeltaProton,
+ hFractionProtonsMC, plotIdentifiedSpectra);
+
+ TCanvas* cFractionsMuons = drawFractionHistos("cFractionsMuons", "Muon fractions", mode, pLow, pHigh, hFractionMuonsDeltaPion,
+ hFractionMuonsDeltaElectron, hFractionMuonsDeltaKaon, hFractionMuonsDeltaProton,
+ hFractionMuonsMC, plotIdentifiedSpectra);
+
+
+
+ TCanvas* cYields = new TCanvas("cYields", "Particle yields",100,10,1200,800);
+ cYields->SetGridx(1);
+ cYields->SetGridy(1);
+ cYields->SetLogx(mode == kPMpT);
+ cYields->SetLogy(1);
+ hYieldPions->GetYaxis()->SetRangeUser(hYieldElectrons->GetBinContent(hYieldElectrons->FindLastBinAbove(0.)) / 10.,
+ hYieldPions->GetBinContent(hYieldPions->GetMaximumBin()) * 10.);
+ SetReasonableAxisRange(hYieldPions->GetXaxis(), mode, pLow, pHigh);
+ hYieldPions->GetXaxis()->SetMoreLogLabels(kTRUE);
+ hYieldPions->GetXaxis()->SetNoExponent(kTRUE);
+ hYieldPions->Draw("e p");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hYieldPionsMC->GetXaxis(), mode, pLow, pHigh);
+ hYieldPionsMC->Draw("e p same");
+ }
+
+ SetReasonableAxisRange(hYieldKaons->GetXaxis(), mode, pLow, pHigh);
+ hYieldKaons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hYieldKaonsMC->GetXaxis(), mode, pLow, pHigh);
+ hYieldKaonsMC->Draw("e p same");
+ }
+
+ SetReasonableAxisRange(hYieldProtons->GetXaxis(), mode, pLow, pHigh);
+ hYieldProtons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hYieldProtonsMC->GetXaxis(), mode, pLow, pHigh);
+ hYieldProtonsMC->Draw("e p same");
+ }
+
+ if (takeIntoAccountMuons) {
+ SetReasonableAxisRange(hYieldMuons->GetXaxis(), mode, pLow, pHigh);
+ hYieldMuons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hYieldMuonsMC->GetXaxis(), mode, pLow, pHigh);
+ hYieldMuonsMC->Draw("e p same");
+ }
+ }
+
+ SetReasonableAxisRange(hYieldElectrons->GetXaxis(), mode, pLow, pHigh);
+ hYieldElectrons->Draw("e p same");
+ if (plotIdentifiedSpectra) {
+ SetReasonableAxisRange(hYieldElectronsMC->GetXaxis(), mode, pLow, pHigh);
+ hYieldElectronsMC->Draw("e p same");
+ }
+
+ TLegend* legendYields = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legendYields->SetBorderSize(0);
+ legendYields->SetFillColor(0);
+ if (plotIdentifiedSpectra)
+ legendYields->SetNColumns(2);
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry((TObject*)0x0, "Fit", "");
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry((TObject*)0x0, identifiedLabels[isMC].Data(), "");
+ legendYields->AddEntry(hYieldPions, "#pi", "p");
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry(hYieldPionsMC, "#pi", "p");
+ legendYields->AddEntry(hYieldKaons, "K", "p");
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry(hYieldKaonsMC, "K", "p");
+ legendYields->AddEntry(hYieldProtons, "p", "p");
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry(hYieldProtonsMC, "p", "p");
+ legendYields->AddEntry(hYieldElectrons, "e", "p");
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry(hYieldElectronsMC, "e", "p");
+ if (takeIntoAccountMuons)
+ legendYields->AddEntry(hYieldMuons, "#mu", "p");
+ else
+ legendYields->AddEntry((TObject*)0x0, "", "");
+ if (plotIdentifiedSpectra)
+ legendYields->AddEntry(hYieldMuonsMC, "#mu", "p");
+ legendYields->Draw();
+
+ ClearTitleFromHistoInCanvas(cYields);
+
+
+ TCanvas* cYieldsPions = drawYieldHistos("cYieldsPions", "Pion yields", mode, pLow, pHigh, hYieldPionsDeltaPion, hYieldPionsDeltaElectron,
+ hYieldPionsDeltaKaon, hYieldPionsDeltaProton, hYieldPionsMC, plotIdentifiedSpectra);
+
+
+ TCanvas* cYieldsElectrons = drawYieldHistos("cYieldsElectrons", "Electron yields", mode, pLow, pHigh, hYieldElectronsDeltaPion,
+ hYieldElectronsDeltaElectron, hYieldElectronsDeltaKaon, hYieldElectronsDeltaProton, hYieldElectronsMC,
+ plotIdentifiedSpectra);
+
+ TCanvas* cYieldsKaons = drawYieldHistos("cYieldsKaons", "Kaon yields", mode, pLow, pHigh, hYieldKaonsDeltaPion, hYieldKaonsDeltaElectron,
+ hYieldKaonsDeltaKaon, hYieldKaonsDeltaProton, hYieldKaonsMC, plotIdentifiedSpectra);
+
+ TCanvas* cYieldsProtons = drawYieldHistos("cYieldsProtons", "Proton yields", mode, pLow, pHigh, hYieldProtonsDeltaPion, hYieldProtonsDeltaElectron,
+ hYieldProtonsDeltaKaon, hYieldProtonsDeltaProton, hYieldProtonsMC, plotIdentifiedSpectra);
+
+ TCanvas* cYieldsMuons = drawYieldHistos("cYieldsMuons", "Muon yields", mode, pLow, pHigh, hYieldMuonsDeltaPion, hYieldMuonsDeltaElectron,
+ hYieldMuonsDeltaKaon, hYieldMuonsDeltaProton, hYieldMuonsMC, plotIdentifiedSpectra);
+
+
+ // Save final results
+ saveF->cd();
+
+ if (fElectronFraction)
+ fElectronFraction->Write();
+
+ if (hFractionElectrons)
+ hFractionElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaons)
+ hFractionKaons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPions)
+ hFractionPions->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtons)
+ hFractionProtons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuons)
+ hFractionMuons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionSummed)
+ hFractionSummed->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaElectron)
+ hFractionElectronsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaElectron)
+ hFractionKaonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaElectron)
+ hFractionPionsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaElectron)
+ hFractionProtonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaElectron)
+ hFractionMuonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaPion)
+ hFractionElectronsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaPion)
+ hFractionKaonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaPion)
+ hFractionPionsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaPion)
+ hFractionProtonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaPion)
+ hFractionMuonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaKaon)
+ hFractionElectronsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaKaon)
+ hFractionKaonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaKaon)
+ hFractionPionsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaKaon)
+ hFractionProtonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaKaon)
+ hFractionMuonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionElectronsDeltaProton)
+ hFractionElectronsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsDeltaProton)
+ hFractionKaonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsDeltaProton)
+ hFractionPionsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsDeltaProton)
+ hFractionProtonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsDeltaProton)
+ hFractionMuonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hNumEvents)
+ hNumEvents->Write();
+
+ if (cFractions)
+ cFractions->Write();
+ if (cFractionsPions)
+ cFractionsPions->Write();
+ if (cFractionsElectrons)
+ cFractionsElectrons->Write();
+ if (cFractionsKaons)
+ cFractionsKaons->Write();
+ if (cFractionsProtons)
+ cFractionsProtons->Write();
+ if (cFractionsMuons)
+ cFractionsMuons->Write();
+
+
+ if (hFractionElectronsMC)
+ hFractionElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionKaonsMC)
+ hFractionKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionPionsMC)
+ hFractionPionsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionMuonsMC)
+ hFractionMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hFractionProtonsMC)
+ hFractionProtonsMC->Write(0, TObject::kWriteDelete);
+
+
+ if (hFractionComparisonElectrons)
+ hFractionComparisonElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionComparisonMuons)
+ hFractionComparisonMuons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionComparisonKaons)
+ hFractionComparisonKaons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionComparisonPions)
+ hFractionComparisonPions->Write(0, TObject::kWriteDelete);
+
+ if (hFractionComparisonProtons)
+ hFractionComparisonProtons->Write(0, TObject::kWriteDelete);
+
+ if (hFractionComparisonTotal)
+ hFractionComparisonTotal->Write(0, TObject::kWriteDelete);
+
+ if (cFractionComparisons)
+ cFractionComparisons->Write();
+
+
+ if (hYieldComparisonElectrons)
+ hYieldComparisonElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldComparisonMuons)
+ hYieldComparisonMuons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldComparisonKaons)
+ hYieldComparisonKaons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldComparisonPions)
+ hYieldComparisonPions->Write(0, TObject::kWriteDelete);
+
+ if (hYieldComparisonProtons)
+ hYieldComparisonProtons->Write(0, TObject::kWriteDelete);
+
+ if (cYieldComparisons)
+ cYieldComparisons->Write();
+
+
+ if (hYieldElectrons)
+ hYieldElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaons)
+ hYieldKaons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPions)
+ hYieldPions->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtons)
+ hYieldProtons->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuons)
+ hYieldMuons->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaElectron)
+ hYieldElectronsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaElectron)
+ hYieldKaonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaElectron)
+ hYieldPionsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaElectron)
+ hYieldProtonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaElectron)
+ hYieldMuonsDeltaElectron->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaPion)
+ hYieldElectronsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaPion)
+ hYieldKaonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaPion)
+ hYieldPionsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaPion)
+ hYieldProtonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaPion)
+ hYieldMuonsDeltaPion->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaKaon)
+ hYieldElectronsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaKaon)
+ hYieldKaonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaKaon)
+ hYieldPionsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaKaon)
+ hYieldProtonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaKaon)
+ hYieldMuonsDeltaKaon->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsDeltaProton)
+ hYieldElectronsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsDeltaProton)
+ hYieldKaonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsDeltaProton)
+ hYieldPionsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsDeltaProton)
+ hYieldProtonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsDeltaProton)
+ hYieldMuonsDeltaProton->Write(0, TObject::kWriteDelete);
+
+
+ if (hYieldElectronsMC)
+ hYieldElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldKaonsMC)
+ hYieldKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldPionsMC)
+ hYieldPionsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldMuonsMC)
+ hYieldMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldProtonsMC)
+ hYieldProtonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hYieldSummedMC)
+ hYieldSummedMC->Write(0, TObject::kWriteDelete);
+
+
+ if (hRatioToPiElectrons)
+ hRatioToPiElectrons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiMuons)
+ hRatioToPiMuons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiKaons)
+ hRatioToPiKaons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiProtons)
+ hRatioToPiProtons->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiElectronsMC)
+ hRatioToPiElectronsMC->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiMuonsMC)
+ hRatioToPiMuonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiKaonsMC)
+ hRatioToPiKaonsMC->Write(0, TObject::kWriteDelete);
+
+ if (hRatioToPiProtonsMC)
+ hRatioToPiProtonsMC->Write(0, TObject::kWriteDelete);
+
+
+
+ if (hReducedChiSquarePt)
+ hReducedChiSquarePt->Write(0, TObject::kWriteDelete);
+
+ if (cYields)
+ cYields->Write();
+ if (cYieldsPions)
+ cYieldsPions->Write();
+ if (cYieldsElectrons)
+ cYieldsElectrons->Write();
+ if (cYieldsKaons)
+ cYieldsKaons->Write();
+ if (cYieldsProtons)
+ cYieldsProtons->Write();
+ if (cYieldsMuons)
+ cYieldsMuons->Write();
+
+ for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
+ if (hMCgenYieldsPrimSpecies[i])
+ hMCgenYieldsPrimSpecies[i]->Write();
+ }
+
+ if (filePathNameResults)
+ *filePathNameResults = saveFName;
+
+ if (TMath::Abs(mathFit->GetScaleFactorError() - 1.) > 1e-6) {
+ // If the deltaPrime range is large enough, we artificially get a factor 4 in statistics by looking at the four
+ // different deltaPrimeSpecies, which have (except for binning effects) the same information.
+ // Therefore, to get the "real" statistical error, we need to multiply the obtained error by sqrt(4) = 2
+ std::cout << "NOTE: Errors multiplied by " << mathFit->GetScaleFactorError()
+ << " to take into account artificially higher statistics (by factor of 4) due to same information "
+ << "for all deltaPrimeSpecies (except for binning effects), if deltaPrimeRange sufficiently large!" << std::endl
+ << std::endl;
+ }
+
+ if (fitMethod < 2) {
+ std::cout << "WARNING: Errors might be wrong! Especially, for the to-pi ratios there are no correlations taken into account!"
+ << std::endl;
+ }
+
+ delete gFractionElectronsData;
+ delete fElectronFraction;
+
+ delete mathFit;
+
+ delete cFractions;
+ delete cFractionComparisons;
+ delete cYieldComparisons;
+ delete cFractionsPions;
+ delete cFractionsElectrons;
+ delete cFractionsKaons;
+ delete cFractionsProtons;
+ delete cFractionsMuons;
+ delete cYields;
+ delete cYieldsPions;
+ delete cYieldsKaons;
+ delete cYieldsMuons;
+ delete cYieldsProtons;
+ delete cYieldsElectrons;
+
+ saveF->Close();
+
+ return 0;
+}
-#include "TCanvas.h"\r
-#include "TFile.h"\r
-#include "TGraphErrors.h"\r
-#include "TGraphAsymmErrors.h"\r
-#include "TGraph.h"\r
-#include "TF1.h"\r
-#include "TH1D.h"\r
-#include "TLegend.h"\r
-#include "TMath.h"\r
-#include "TString.h"\r
-#include "TStyle.h"\r
-\r
-#include "AliPID.h"\r
-\r
-#include <iostream>\r
-#include <iomanip>\r
-\r
-#include "SystematicErrorUtils.h"\r
-\r
-const Int_t numSpecies = 5;\r
-\r
-//________________________________________________________\r
-TCanvas* calculateSystematics(TString canvName, TString canvTitle, TH1F** histos, Int_t numHistos, Int_t speciesID, Double_t /*nSigma*/,\r
- const TString* systematicsHistosName, Int_t reference, TH1F** hSystematics, TGraphAsymmErrors** gr,\r
- Bool_t ignoreSigmaErrors)\r
-{\r
- // For every bin:\r
- // Since the method with the root finding already takes into account the statistical error,\r
- // there is no need to use nSigma > 0.\r
- // If the statistical error is ignored, nevertheless don't use nSigma > 0 because this might\r
- // give zero systematic error for high pT, which is usually not accepted by people, although\r
- // the natural point of view "no systematic visible for given statistical error" is reasonable to me.\r
- \r
- Double_t ymax = 0;\r
- Double_t ymin = 0;\r
- \r
- \r
- // Just for drawing\r
- for (Int_t j = 0; j < numHistos; j++) {\r
- hSystematics[j] = new TH1F(*histos[j]);\r
- hSystematics[j]->SetName(Form("%s_%s", systematicsHistosName[j].Data(), AliPID::ParticleName(speciesID)));\r
- hSystematics[j]->Reset(); \r
- hSystematics[j]->GetXaxis()->SetRange(0, -1);\r
- \r
- for (Int_t bin = 1; bin <= histos[j]->GetNbinsX(); bin++) {\r
- hSystematics[j]->SetBinContent(bin, histos[reference]->GetBinContent(bin) - histos[j]->GetBinContent(bin));\r
- hSystematics[j]->SetBinError(bin, TMath::Sqrt(TMath::Abs(TMath::Power(histos[reference]->GetBinError(bin), 2) - \r
- TMath::Power(histos[j]->GetBinError(bin), 2))));\r
- \r
- if (hSystematics[j]->GetBinError(bin) == 0)\r
- hSystematics[j]->SetBinError(bin, 1e-10);\r
- Double_t temp = hSystematics[j]->GetBinContent(bin) + hSystematics[j]->GetBinError(bin);\r
- if (temp > ymax)\r
- ymax = temp;\r
- \r
- temp = hSystematics[j]->GetBinContent(bin) - hSystematics[j]->GetBinError(bin);\r
- if (temp < ymin)\r
- ymin = temp;\r
- }\r
- }\r
- \r
- TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);\r
- canv->SetGridy(1);\r
- \r
- hSystematics[reference]->Draw("e p");\r
- hSystematics[reference]->GetYaxis()->SetRangeUser(ymin, ymax);\r
- for (Int_t j = 0; j < numHistos; j++) {\r
- if (j == reference)\r
- continue;\r
- \r
- hSystematics[j]->SetMarkerStyle(20 + j);\r
- hSystematics[j]->Draw("e p same");\r
- }\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- \r
- for (Int_t j = 0; j < numHistos; j++) {\r
- legend->AddEntry(hSystematics[j], Form("%s", systematicsHistosName[j].Data()), "p");\r
- }\r
- legend->Draw();\r
- \r
- \r
- const Int_t nBins = histos[reference]->GetNbinsX();\r
- Double_t x[nBins];\r
- Double_t y[nBins];\r
- Double_t xerr[nBins];\r
- Double_t yerrl[nBins];\r
- Double_t yerrh[nBins];\r
- \r
- Double_t meansForFit[numHistos];\r
- Double_t sigmasForFit[numHistos];\r
- \r
- for (Int_t bin = 0; bin < nBins; bin++) {\r
- x[bin] = histos[reference]->GetBinCenter(bin + 1);\r
- xerr[bin] = histos[reference]->GetBinWidth(bin + 1) / 2.;\r
- y[bin] = histos[reference]->GetBinContent(bin + 1);\r
- \r
- for (Int_t j = 0; j < numHistos; j++) {\r
- meansForFit[j] = histos[j]->GetBinContent(bin + 1);\r
- sigmasForFit[j] = histos[j]->GetBinError(bin + 1);\r
- }\r
- \r
- yerrl[bin] = yerrh[bin] = findSystematicError(numHistos, meansForFit, sigmasForFit, ignoreSigmaErrors);\r
- }\r
- \r
- TGraphAsymmErrors* gTemp = new TGraphAsymmErrors(nBins, x, y, xerr, xerr, yerrl, yerrh);\r
- *gr = gTemp;\r
- (*gr)->SetName(Form("systematicError_%s", AliPID::ParticleName(speciesID)));\r
- (*gr)->SetLineColor(hSystematics[0]->GetMarkerColor());\r
- //(*gr)->SetFillColor(kGray);\r
- (*gr)->SetFillStyle(0);//3004 + reference);\r
- \r
- return canv;\r
-}\r
-\r
-\r
-/*OLD\r
-//________________________________________________________\r
-TCanvas* calculateSystematics(TString canvName, TString canvTitle, TH1F** histos, Int_t numHistos, Int_t speciesID, Double_t nSigma,\r
- const TString* systematicsHistosName, Int_t reference, TH1F** hSystematics, TGraphAsymmErrors** gr)\r
-{\r
- Double_t ymax = 0;\r
- Double_t ymin = 0;\r
- \r
- for (Int_t j = 0; j < numHistos; j++) {\r
- hSystematics[j] = new TH1F(*histos[j]);\r
- hSystematics[j]->SetName(Form("%s_%s", systematicsHistosName[j].Data(), AliPID::ParticleName(speciesID)));\r
- hSystematics[j]->Reset(); \r
- hSystematics[j]->GetXaxis()->SetRange(0, -1);\r
- \r
- for (Int_t bin = 1; bin <= histos[j]->GetNbinsX(); bin++) {\r
- hSystematics[j]->SetBinContent(bin, histos[reference]->GetBinContent(bin) - histos[j]->GetBinContent(bin));\r
- hSystematics[j]->SetBinError(bin, TMath::Sqrt(TMath::Abs(TMath::Power(histos[reference]->GetBinError(bin), 2) - \r
- TMath::Power(histos[j]->GetBinError(bin), 2))));\r
- \r
- if (hSystematics[j]->GetBinError(bin) == 0)\r
- hSystematics[j]->SetBinError(bin, 1e-10);\r
- Double_t temp = hSystematics[j]->GetBinContent(bin) + hSystematics[j]->GetBinError(bin);\r
- if (temp > ymax)\r
- ymax = temp;\r
- \r
- temp = hSystematics[j]->GetBinContent(bin) - hSystematics[j]->GetBinError(bin);\r
- if (temp < ymin)\r
- ymin = temp;\r
- }\r
- }\r
- \r
- TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);\r
- canv->SetGridy(1);\r
- \r
- hSystematics[reference]->Draw("e p");\r
- hSystematics[reference]->GetYaxis()->SetRangeUser(ymin, ymax);\r
- for (Int_t j = 0; j < numHistos; j++) {\r
- if (j == reference)\r
- continue;\r
- \r
- hSystematics[j]->SetMarkerStyle(20 + j);\r
- hSystematics[j]->Draw("e p same");\r
- }\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- \r
- for (Int_t j = 0; j < numHistos; j++) {\r
- legend->AddEntry(hSystematics[j], Form("%s", systematicsHistosName[j].Data()), "p");\r
- }\r
- legend->Draw();\r
- \r
- \r
- const Int_t nBins = histos[reference]->GetNbinsX();\r
- Double_t x[nBins];\r
- Double_t y[nBins];\r
- Double_t xerr[nBins];\r
- Double_t yerrl[nBins];\r
- Double_t yerrh[nBins];\r
- \r
- for (Int_t bin = 0; bin < nBins; bin++) {\r
- x[bin] = histos[reference]->GetBinCenter(bin + 1);\r
- xerr[bin] = histos[reference]->GetBinWidth(bin + 1) / 2.;\r
- y[bin] = histos[reference]->GetBinContent(bin + 1);\r
- \r
- // Take all points that are more than nSigma sigma away from 0.\r
- // If there are at least 2 such points, take the difference between\r
- // the extreme values (i.e. maximum and minimum) as a measure of\r
- // the systematics\r
- Int_t count = 0;\r
- Double_t deltaMin = 0;\r
- Double_t deltaMax = 0;\r
- \r
- for (Int_t j = 0; j < numHistos; j++) {\r
- if (hSystematics[j]->GetBinError(bin + 1) == 0) // Per definition always true for reference histo\r
- continue;\r
- \r
- Double_t delta = hSystematics[j]->GetBinContent(bin + 1);\r
- if (TMath::Abs(delta / hSystematics[j]->GetBinError(bin + 1)) > nSigma) {\r
- //if (count == 0) {\r
- // deltaMin = delta;\r
- // deltaMax = delta;\r
- //}\r
- //else {\r
- if (delta < deltaMin)\r
- deltaMin = delta;\r
- if (delta > deltaMax)\r
- deltaMax = delta;\r
- //}\r
- count++;\r
- }\r
- }\r
- \r
- //if (deltaMax > 0.) \r
- // yerrh[bin] = deltaMax;\r
- //else\r
- // yerrh[bin] = 0.;\r
- // \r
- //if (deltaMin < 0.)\r
- // yerrl[bin] = -deltaMin;\r
- //else\r
- // yerrl[bin] = 0.;\r
- \r
- if (count < 1) // Reference histo is not counted. One can only do systematics if there is at least one other histogram\r
- yerrl[bin] = yerrh[bin] = 0.;\r
- else\r
- yerrl[bin] = yerrh[bin] = (deltaMax - deltaMin) / TMath::Sqrt(2);\r
- \r
- }\r
- \r
- TGraphAsymmErrors* gTemp = new TGraphAsymmErrors(nBins, x, y, xerr, xerr, yerrl, yerrh);\r
- *gr = gTemp;\r
- (*gr)->SetName(Form("systematicError_%s", AliPID::ParticleName(speciesID)));\r
- (*gr)->SetLineColor(hSystematics[0]->GetMarkerColor());\r
- //(*gr)->SetFillColor(kGray);\r
- (*gr)->SetFillStyle(0);//3004 + reference);\r
- \r
- return canv;\r
-}*/\r
-\r
-\r
-//________________________________________________________\r
-TCanvas* DrawFractionHistos(TString canvName, TString canvTitle, Double_t pLow, Double_t pHigh, TH1F*** hist, Int_t reference,\r
- TGraphAsymmErrors** gr)\r
-{\r
- TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);\r
- canv->SetGridx(1);\r
- canv->SetGridy(1);\r
- canv->SetLogx(1);\r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- hist[i][reference]->GetYaxis()->SetRangeUser(0.0, 1.0);\r
- hist[i][reference]->GetYaxis()->SetTitle(canvTitle.Data());\r
- hist[i][reference]->GetXaxis()->SetRangeUser(pLow, pHigh);\r
- //hist[i][reference]->SetFillStyle(3004 + i);\r
- //hist[i][reference]->SetFillColor(kGray);\r
- hist[i][reference]->SetFillStyle(0);\r
- hist[i][reference]->SetFillColor(hist[i][reference]->GetMarkerColor());\r
- hist[i][reference]->SetLineColor(hist[i][reference]->GetMarkerColor());\r
- }\r
- hist[2][reference]->SetMarkerStyle(20);\r
- hist[2][reference]->Draw("e p");\r
- hist[0][reference]->SetMarkerStyle(21);\r
- hist[0][reference]->Draw("e p same");\r
- hist[1][reference]->SetMarkerStyle(22);\r
- hist[1][reference]->Draw("e p same");\r
- hist[3][reference]->SetMarkerStyle(29);\r
- hist[3][reference]->Draw("e p same");\r
- hist[4][reference]->SetMarkerStyle(30);\r
- hist[4][reference]->Draw("e p same");\r
- \r
- gr[0]->Draw("2 same");\r
- gr[1]->Draw("2 same");\r
- gr[2]->Draw("2 same");\r
- gr[3]->Draw("2 same");\r
- gr[4]->Draw("2 same");\r
- \r
- TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932); \r
- legend->SetBorderSize(0);\r
- legend->SetFillColor(0);\r
- legend->AddEntry(hist[2][reference], "#pi", "flp");\r
- legend->AddEntry(hist[0][reference], "e", "flp");\r
- legend->AddEntry(hist[1][reference], "K", "flp");\r
- legend->AddEntry(hist[3][reference], "p", "flp");\r
- legend->AddEntry(hist[4][reference], "#mu", "flp");\r
- legend->Draw();\r
- \r
- return canv;\r
-}\r
-\r
-\r
-//________________________________________________________\r
-TH1F* loadHisto(const TString histName, TFile* f)\r
-{\r
- if (!f) {\r
- std::cout << "No file. Cannot load hist \"" << histName.Data() << "\n!" << std::endl;\r
- return 0x0;\r
- }\r
- \r
- TH1F* hTemp = dynamic_cast<TH1F*>(f->Get(histName.Data()));\r
- if (!hTemp) {\r
- std::cout << "Failed to load histo \"" << histName.Data() << "\"!" << std::endl;\r
- return 0x0;\r
- } \r
- \r
- return hTemp;\r
-}\r
-\r
-\r
-//________________________________________________________\r
-Int_t SystematicErrorEstimation(const TString path, const TString outFileTitle, const TString* fileNames, const TString* histTitles,\r
- const Int_t numFiles, const Double_t nSigma, const Bool_t ignoreSigmaErrors) \r
-{ \r
- if (!fileNames || numFiles < 1)\r
- return -1;\r
- \r
- TFile* f[numFiles];\r
- TH1F** hFractions[numSpecies];\r
- for (Int_t i = 0; i < numSpecies; i++) \r
- hFractions[i] = new TH1F*[numFiles];\r
- \r
- const Int_t reference = 0;\r
- TH1F* hYields[numSpecies]; // Only the reference yields\r
- \r
- const TString histNames[numSpecies] = {"hFractionElectrons", "hFractionKaons", "hFractionPions", "hFractionProtons", "hFractionMuons" };\r
- \r
- const TString histNamesYields[numSpecies] = {"hYieldElectrons", "hYieldKaons", "hYieldPions", "hYieldProtons", "hYieldMuons" };\r
- \r
- for (Int_t iFile = 0; iFile < numFiles; iFile++) {\r
- f[iFile] = TFile::Open(fileNames[iFile].Data());\r
- if (!f[iFile]) {\r
- std::cout << "Failed to open file \"" << fileNames[iFile].Data() << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- // Extract the data histograms\r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- hFractions[i][iFile] = loadHisto(histNames[i], f[iFile]);\r
- if (!hFractions[i][iFile])\r
- return -1;\r
- \r
- if (iFile == reference) {\r
- hYields[i] = loadHisto(histNamesYields[i], f[iFile]);\r
- if (!hYields[i])\r
- return -1;\r
- }\r
- }\r
- }\r
- \r
- \r
- TGraphAsymmErrors* grSysErrors[numSpecies] = {0x0,};\r
- TGraphAsymmErrors* grSysErrorsYields[numSpecies] = {0x0,};\r
- \r
- TH1F* hSystematicsPions[numFiles];\r
- TCanvas* cSystematicsPions = calculateSystematics("cSystematicsPions", "Systematics Pions", hFractions[2], numFiles,\r
- AliPID::kPion, nSigma,\r
- histTitles, reference, hSystematicsPions, &grSysErrors[2], ignoreSigmaErrors);\r
-\r
- TH1F* hSystematicsElectrons[numFiles];\r
- TCanvas* cSystematicsElectrons = calculateSystematics("cSystematicsElectrons", "Systematics Electrons", hFractions[0], numFiles,\r
- AliPID::kElectron,\r
- nSigma, histTitles, reference, hSystematicsElectrons,\r
- &grSysErrors[0], ignoreSigmaErrors);\r
- \r
- TH1F* hSystematicsKaons[numFiles];\r
- TCanvas* cSystematicsKaons = calculateSystematics("cSystematicsKaons", "Systematics Kaons", hFractions[1], numFiles, AliPID::kKaon, nSigma,\r
- histTitles, reference, hSystematicsKaons, &grSysErrors[1], ignoreSigmaErrors);\r
- \r
- TH1F* hSystematicsProtons[numFiles]; \r
- TCanvas* cSystematicsProtons = calculateSystematics("cSystematicsProtons", "Systematics Protons", hFractions[3], numFiles,\r
- AliPID::kProton, nSigma,\r
- histTitles, reference, hSystematicsProtons, &grSysErrors[3], ignoreSigmaErrors);\r
- \r
- TH1F* hSystematicsMuons[numFiles];\r
- TCanvas* cSystematicsMuons = calculateSystematics("cSystematicsMuons", "Systematics Muons", hFractions[4], numFiles,\r
- AliPID::kMuon, nSigma,\r
- histTitles, reference, hSystematicsMuons, &grSysErrors[4], ignoreSigmaErrors);\r
- \r
- Double_t pLow = 0.15;\r
- Double_t pHigh = 50.;\r
- TCanvas* cFractionsWithSystematicError = DrawFractionHistos("cFractionsWithSystematicError", "Particle fractions", pLow, pHigh, hFractions, reference, \r
- grSysErrors);\r
- \r
- \r
- //TODO At the moment, the error of the fractions and the yield is just a constant factor (number of tracks in that bin)\r
- // (-> But this can change in future (I have to think about it a little bit more carefully)).\r
- // Thus, the relative errors are the same for fractions and yields and I can just use this fact to\r
- // transform the errors from the fractions to those of the yields.\r
- // However, this causes trouble in case of fraction = 0. Therefore, sum up the yields to the total yield and use this for scaling\r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- grSysErrorsYields[i] = new TGraphAsymmErrors(*grSysErrors[i]);\r
- TString name = grSysErrors[i]->GetName();\r
- name.ReplaceAll("systematicError_", "systematicErrorYields_");\r
- grSysErrorsYields[i]->SetName(name.Data());\r
- \r
- for (Int_t ind = 0; ind < grSysErrorsYields[i]->GetN(); ind++) {\r
- Double_t totalYield = 0;\r
- for (Int_t j = 0; j < numSpecies; j++)\r
- totalYield += hYields[j]->GetBinContent(ind + 1);\r
- \r
- const Double_t yield = hYields[i]->GetBinContent(ind + 1);\r
- const Double_t sysErrorLow = grSysErrors[i]->GetErrorYlow(ind);\r
- const Double_t sysErrorHigh = grSysErrors[i]->GetErrorYhigh(ind);\r
- \r
- grSysErrorsYields[i]->SetPoint(ind, grSysErrorsYields[i]->GetX()[ind], yield);\r
- grSysErrorsYields[i]->SetPointEYhigh(ind, totalYield * sysErrorHigh);\r
- grSysErrorsYields[i]->SetPointEYlow(ind, totalYield * sysErrorLow);\r
- \r
- /*\r
- Double_t totalYield = 0;\r
- for (Int_t j = 0; j < numSpecies; j++)\r
- totalYield += hYields[j]->GetBinContent(ind + 1);\r
- \r
- const Double_t yield = hYields[i]->GetBinContent(ind + 1);\r
- const Double_t fraction = hFractions[i][reference]->GetBinContent(ind + 1);\r
- const Double_t sysErrorLow = grSysErrors[i]->GetErrorYlow(ind);\r
- const Double_t sysErrorHigh = grSysErrors[i]->GetErrorYhigh(ind);\r
- \r
- if (fraction <= 0.) {\r
- printf("Error: Fraction = 0 for species %d. Cannot transform error....\n", i);\r
- return -1;\r
- }\r
- const Double_t sysErrorLowRel = sysErrorLow / fraction;\r
- const Double_t sysErrorHighRel = sysErrorHigh / fraction;\r
- \r
- grSysErrorsYields[i]->SetPoint(ind, grSysErrorsYields[i]->GetX()[ind], yield);\r
- grSysErrorsYields[i]->SetPointEYhigh(ind, sysErrorHighRel * yield);\r
- grSysErrorsYields[i]->SetPointEYlow(ind, sysErrorLowRel * yield);\r
- */\r
- }\r
- }\r
- \r
- \r
- // Output file\r
- TFile* fSave = 0x0;\r
- TDatime daTime;\r
- TString saveFileName;\r
- \r
- saveFileName = Form("outputSystematics_%s_nSigma%.1f__%04d_%02d_%02d.root", outFileTitle.Data(), nSigma, daTime.GetYear(),\r
- daTime.GetMonth(), daTime.GetDay());\r
- \r
- fSave = TFile::Open(Form("%s/%s", path.Data(), saveFileName.Data()), "recreate");\r
- if (!fSave) {\r
- std::cout << "Failed to open save file \"" << Form("%s/%s", path.Data(), saveFileName.Data()) << "\"!" << std::endl;\r
- return -1;\r
- }\r
- \r
- // Save final results\r
- fSave->cd();\r
- \r
- for (Int_t i = 0; i < numFiles; i++) {\r
- if (hSystematicsElectrons[i])\r
- hSystematicsElectrons[i]->Write();\r
- \r
- if (hSystematicsPions[i])\r
- hSystematicsPions[i]->Write();\r
- \r
- if (hSystematicsKaons[i])\r
- hSystematicsKaons[i]->Write();\r
- \r
- if (hSystematicsProtons[i])\r
- hSystematicsProtons[i]->Write();\r
- if (hSystematicsMuons[i])\r
- hSystematicsMuons[i]->Write();\r
- }\r
- \r
- if (cSystematicsElectrons)\r
- cSystematicsElectrons->Write();\r
- \r
- if (cSystematicsPions)\r
- cSystematicsPions->Write();\r
- \r
- if (cSystematicsKaons)\r
- cSystematicsKaons->Write();\r
- \r
- if (cSystematicsProtons)\r
- cSystematicsProtons->Write();\r
- \r
- if (cSystematicsMuons)\r
- cSystematicsMuons->Write();\r
- \r
- if (cFractionsWithSystematicError)\r
- cFractionsWithSystematicError->Write();\r
- \r
- for (Int_t i = 0; i < numSpecies; i++) {\r
- if (hFractions[i][reference])\r
- hFractions[i][reference]->Write();\r
- \r
- if (grSysErrors[i])\r
- grSysErrors[i]->Write();\r
- \r
- if (hYields[i])\r
- hYields[i]->Write();\r
- \r
- if (grSysErrorsYields[i])\r
- grSysErrorsYields[i]->Write();\r
- }\r
- \r
- // Save list of file names in output file\r
- TString listOfFileNames = "";\r
- for (Int_t i = 0; i < numFiles; i++) {\r
- listOfFileNames.Append(Form("%s%d: %s", i == 0 ? "" : ", ", i, fileNames[i].Data()));\r
- }\r
- \r
- TNamed* settings = new TNamed(Form("Used files for systematics: %s\n", listOfFileNames.Data()),\r
- Form("Used files for systematics: %s\n", listOfFileNames.Data()));\r
- settings->Write();\r
- \r
- fSave->Close();\r
- \r
- delete cSystematicsElectrons;\r
- delete cSystematicsPions;\r
- delete cSystematicsKaons;\r
- delete cSystematicsMuons;\r
- delete cSystematicsProtons;\r
- delete cFractionsWithSystematicError;\r
- \r
- return 0;\r
-}\r
+#include "TCanvas.h"
+#include "TFile.h"
+#include "TGraphErrors.h"
+#include "TGraphAsymmErrors.h"
+#include "TGraph.h"
+#include "TF1.h"
+#include "TH1D.h"
+#include "TLegend.h"
+#include "TMath.h"
+#include "TString.h"
+#include "TStyle.h"
+
+#include "AliPID.h"
+
+#include <iostream>
+#include <iomanip>
+
+#include "SystematicErrorUtils.h"
+
+const Int_t numSpecies = 5;
+
+//________________________________________________________
+TCanvas* calculateSystematics(TString canvName, TString canvTitle, TH1F** histos, Int_t numHistos, Int_t speciesID, Double_t /*nSigma*/,
+ const TString* systematicsHistosName, Int_t reference, TH1F** hSystematics, TGraphAsymmErrors** gr,
+ Bool_t ignoreSigmaErrors)
+{
+ // For every bin:
+ // Since the method with the root finding already takes into account the statistical error,
+ // there is no need to use nSigma > 0.
+ // If the statistical error is ignored, nevertheless don't use nSigma > 0 because this might
+ // give zero systematic error for high pT, which is usually not accepted by people, although
+ // the natural point of view "no systematic visible for given statistical error" is reasonable to me.
+
+ Double_t ymax = 0;
+ Double_t ymin = 0;
+
+
+ // Just for drawing
+ for (Int_t j = 0; j < numHistos; j++) {
+ hSystematics[j] = new TH1F(*histos[j]);
+ hSystematics[j]->SetName(Form("%s_%s", systematicsHistosName[j].Data(), AliPID::ParticleName(speciesID)));
+ hSystematics[j]->Reset();
+ hSystematics[j]->GetXaxis()->SetRange(0, -1);
+
+ for (Int_t bin = 1; bin <= histos[j]->GetNbinsX(); bin++) {
+ hSystematics[j]->SetBinContent(bin, histos[reference]->GetBinContent(bin) - histos[j]->GetBinContent(bin));
+ hSystematics[j]->SetBinError(bin, TMath::Sqrt(TMath::Abs(TMath::Power(histos[reference]->GetBinError(bin), 2) -
+ TMath::Power(histos[j]->GetBinError(bin), 2))));
+
+ if (hSystematics[j]->GetBinError(bin) == 0)
+ hSystematics[j]->SetBinError(bin, 1e-10);
+ Double_t temp = hSystematics[j]->GetBinContent(bin) + hSystematics[j]->GetBinError(bin);
+ if (temp > ymax)
+ ymax = temp;
+
+ temp = hSystematics[j]->GetBinContent(bin) - hSystematics[j]->GetBinError(bin);
+ if (temp < ymin)
+ ymin = temp;
+ }
+ }
+
+ TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);
+ canv->SetGridy(1);
+
+ hSystematics[reference]->Draw("e p");
+ hSystematics[reference]->GetYaxis()->SetRangeUser(ymin, ymax);
+ for (Int_t j = 0; j < numHistos; j++) {
+ if (j == reference)
+ continue;
+
+ hSystematics[j]->SetMarkerStyle(20 + j);
+ hSystematics[j]->Draw("e p same");
+ }
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+
+ for (Int_t j = 0; j < numHistos; j++) {
+ legend->AddEntry(hSystematics[j], Form("%s", systematicsHistosName[j].Data()), "p");
+ }
+ legend->Draw();
+
+
+ const Int_t nBins = histos[reference]->GetNbinsX();
+ Double_t x[nBins];
+ Double_t y[nBins];
+ Double_t xerr[nBins];
+ Double_t yerrl[nBins];
+ Double_t yerrh[nBins];
+
+ Double_t meansForFit[numHistos];
+ Double_t sigmasForFit[numHistos];
+
+ for (Int_t bin = 0; bin < nBins; bin++) {
+ x[bin] = histos[reference]->GetBinCenter(bin + 1);
+ xerr[bin] = histos[reference]->GetBinWidth(bin + 1) / 2.;
+ y[bin] = histos[reference]->GetBinContent(bin + 1);
+
+ for (Int_t j = 0; j < numHistos; j++) {
+ meansForFit[j] = histos[j]->GetBinContent(bin + 1);
+ sigmasForFit[j] = histos[j]->GetBinError(bin + 1);
+ }
+
+ yerrl[bin] = yerrh[bin] = findSystematicError(numHistos, meansForFit, sigmasForFit, ignoreSigmaErrors);
+ }
+
+ TGraphAsymmErrors* gTemp = new TGraphAsymmErrors(nBins, x, y, xerr, xerr, yerrl, yerrh);
+ *gr = gTemp;
+ (*gr)->SetName(Form("systematicError_%s", AliPID::ParticleName(speciesID)));
+ (*gr)->SetLineColor(hSystematics[0]->GetMarkerColor());
+ //(*gr)->SetFillColor(kGray);
+ (*gr)->SetFillStyle(0);//3004 + reference);
+
+ return canv;
+}
+
+
+/*OLD
+//________________________________________________________
+TCanvas* calculateSystematics(TString canvName, TString canvTitle, TH1F** histos, Int_t numHistos, Int_t speciesID, Double_t nSigma,
+ const TString* systematicsHistosName, Int_t reference, TH1F** hSystematics, TGraphAsymmErrors** gr)
+{
+ Double_t ymax = 0;
+ Double_t ymin = 0;
+
+ for (Int_t j = 0; j < numHistos; j++) {
+ hSystematics[j] = new TH1F(*histos[j]);
+ hSystematics[j]->SetName(Form("%s_%s", systematicsHistosName[j].Data(), AliPID::ParticleName(speciesID)));
+ hSystematics[j]->Reset();
+ hSystematics[j]->GetXaxis()->SetRange(0, -1);
+
+ for (Int_t bin = 1; bin <= histos[j]->GetNbinsX(); bin++) {
+ hSystematics[j]->SetBinContent(bin, histos[reference]->GetBinContent(bin) - histos[j]->GetBinContent(bin));
+ hSystematics[j]->SetBinError(bin, TMath::Sqrt(TMath::Abs(TMath::Power(histos[reference]->GetBinError(bin), 2) -
+ TMath::Power(histos[j]->GetBinError(bin), 2))));
+
+ if (hSystematics[j]->GetBinError(bin) == 0)
+ hSystematics[j]->SetBinError(bin, 1e-10);
+ Double_t temp = hSystematics[j]->GetBinContent(bin) + hSystematics[j]->GetBinError(bin);
+ if (temp > ymax)
+ ymax = temp;
+
+ temp = hSystematics[j]->GetBinContent(bin) - hSystematics[j]->GetBinError(bin);
+ if (temp < ymin)
+ ymin = temp;
+ }
+ }
+
+ TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);
+ canv->SetGridy(1);
+
+ hSystematics[reference]->Draw("e p");
+ hSystematics[reference]->GetYaxis()->SetRangeUser(ymin, ymax);
+ for (Int_t j = 0; j < numHistos; j++) {
+ if (j == reference)
+ continue;
+
+ hSystematics[j]->SetMarkerStyle(20 + j);
+ hSystematics[j]->Draw("e p same");
+ }
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+
+ for (Int_t j = 0; j < numHistos; j++) {
+ legend->AddEntry(hSystematics[j], Form("%s", systematicsHistosName[j].Data()), "p");
+ }
+ legend->Draw();
+
+
+ const Int_t nBins = histos[reference]->GetNbinsX();
+ Double_t x[nBins];
+ Double_t y[nBins];
+ Double_t xerr[nBins];
+ Double_t yerrl[nBins];
+ Double_t yerrh[nBins];
+
+ for (Int_t bin = 0; bin < nBins; bin++) {
+ x[bin] = histos[reference]->GetBinCenter(bin + 1);
+ xerr[bin] = histos[reference]->GetBinWidth(bin + 1) / 2.;
+ y[bin] = histos[reference]->GetBinContent(bin + 1);
+
+ // Take all points that are more than nSigma sigma away from 0.
+ // If there are at least 2 such points, take the difference between
+ // the extreme values (i.e. maximum and minimum) as a measure of
+ // the systematics
+ Int_t count = 0;
+ Double_t deltaMin = 0;
+ Double_t deltaMax = 0;
+
+ for (Int_t j = 0; j < numHistos; j++) {
+ if (hSystematics[j]->GetBinError(bin + 1) == 0) // Per definition always true for reference histo
+ continue;
+
+ Double_t delta = hSystematics[j]->GetBinContent(bin + 1);
+ if (TMath::Abs(delta / hSystematics[j]->GetBinError(bin + 1)) > nSigma) {
+ //if (count == 0) {
+ // deltaMin = delta;
+ // deltaMax = delta;
+ //}
+ //else {
+ if (delta < deltaMin)
+ deltaMin = delta;
+ if (delta > deltaMax)
+ deltaMax = delta;
+ //}
+ count++;
+ }
+ }
+
+ //if (deltaMax > 0.)
+ // yerrh[bin] = deltaMax;
+ //else
+ // yerrh[bin] = 0.;
+ //
+ //if (deltaMin < 0.)
+ // yerrl[bin] = -deltaMin;
+ //else
+ // yerrl[bin] = 0.;
+
+ if (count < 1) // Reference histo is not counted. One can only do systematics if there is at least one other histogram
+ yerrl[bin] = yerrh[bin] = 0.;
+ else
+ yerrl[bin] = yerrh[bin] = (deltaMax - deltaMin) / TMath::Sqrt(2);
+
+ }
+
+ TGraphAsymmErrors* gTemp = new TGraphAsymmErrors(nBins, x, y, xerr, xerr, yerrl, yerrh);
+ *gr = gTemp;
+ (*gr)->SetName(Form("systematicError_%s", AliPID::ParticleName(speciesID)));
+ (*gr)->SetLineColor(hSystematics[0]->GetMarkerColor());
+ //(*gr)->SetFillColor(kGray);
+ (*gr)->SetFillStyle(0);//3004 + reference);
+
+ return canv;
+}*/
+
+
+//________________________________________________________
+TCanvas* DrawFractionHistos(TString canvName, TString canvTitle, Double_t pLow, Double_t pHigh, TH1F*** hist, Int_t reference,
+ TGraphAsymmErrors** gr)
+{
+ TCanvas* canv = new TCanvas(canvName.Data(), canvTitle.Data(),100,10,1200,800);
+ canv->SetGridx(1);
+ canv->SetGridy(1);
+ canv->SetLogx(1);
+ for (Int_t i = 0; i < numSpecies; i++) {
+ hist[i][reference]->GetYaxis()->SetRangeUser(0.0, 1.0);
+ hist[i][reference]->GetYaxis()->SetTitle(canvTitle.Data());
+ hist[i][reference]->GetXaxis()->SetRangeUser(pLow, pHigh);
+ //hist[i][reference]->SetFillStyle(3004 + i);
+ //hist[i][reference]->SetFillColor(kGray);
+ hist[i][reference]->SetFillStyle(0);
+ hist[i][reference]->SetFillColor(hist[i][reference]->GetMarkerColor());
+ hist[i][reference]->SetLineColor(hist[i][reference]->GetMarkerColor());
+ }
+ hist[2][reference]->SetMarkerStyle(20);
+ hist[2][reference]->Draw("e p");
+ hist[0][reference]->SetMarkerStyle(21);
+ hist[0][reference]->Draw("e p same");
+ hist[1][reference]->SetMarkerStyle(22);
+ hist[1][reference]->Draw("e p same");
+ hist[3][reference]->SetMarkerStyle(29);
+ hist[3][reference]->Draw("e p same");
+ hist[4][reference]->SetMarkerStyle(30);
+ hist[4][reference]->Draw("e p same");
+
+ gr[0]->Draw("2 same");
+ gr[1]->Draw("2 same");
+ gr[2]->Draw("2 same");
+ gr[3]->Draw("2 same");
+ gr[4]->Draw("2 same");
+
+ TLegend* legend = new TLegend(0.622126, 0.605932, 0.862069, 0.855932);
+ legend->SetBorderSize(0);
+ legend->SetFillColor(0);
+ legend->AddEntry(hist[2][reference], "#pi", "flp");
+ legend->AddEntry(hist[0][reference], "e", "flp");
+ legend->AddEntry(hist[1][reference], "K", "flp");
+ legend->AddEntry(hist[3][reference], "p", "flp");
+ legend->AddEntry(hist[4][reference], "#mu", "flp");
+ legend->Draw();
+
+ return canv;
+}
+
+
+//________________________________________________________
+TH1F* loadHisto(const TString histName, TFile* f)
+{
+ if (!f) {
+ std::cout << "No file. Cannot load hist \"" << histName.Data() << "\n!" << std::endl;
+ return 0x0;
+ }
+
+ TH1F* hTemp = dynamic_cast<TH1F*>(f->Get(histName.Data()));
+ if (!hTemp) {
+ std::cout << "Failed to load histo \"" << histName.Data() << "\"!" << std::endl;
+ return 0x0;
+ }
+
+ return hTemp;
+}
+
+
+//________________________________________________________
+Int_t SystematicErrorEstimation(const TString path, const TString outFileTitle, const TString* fileNames, const TString* histTitles,
+ const Int_t numFiles, const Double_t nSigma, const Bool_t ignoreSigmaErrors)
+{
+ if (!fileNames || numFiles < 1)
+ return -1;
+
+ TFile* f[numFiles];
+ TH1F** hFractions[numSpecies];
+ for (Int_t i = 0; i < numSpecies; i++)
+ hFractions[i] = new TH1F*[numFiles];
+
+ const Int_t reference = 0;
+ TH1F* hYields[numSpecies]; // Only the reference yields
+
+ const TString histNames[numSpecies] = {"hFractionElectrons", "hFractionKaons", "hFractionPions", "hFractionProtons", "hFractionMuons" };
+
+ const TString histNamesYields[numSpecies] = {"hYieldElectrons", "hYieldKaons", "hYieldPions", "hYieldProtons", "hYieldMuons" };
+
+ for (Int_t iFile = 0; iFile < numFiles; iFile++) {
+ f[iFile] = TFile::Open(fileNames[iFile].Data());
+ if (!f[iFile]) {
+ std::cout << "Failed to open file \"" << fileNames[iFile].Data() << "\"!" << std::endl;
+ return -1;
+ }
+
+ // Extract the data histograms
+ for (Int_t i = 0; i < numSpecies; i++) {
+ hFractions[i][iFile] = loadHisto(histNames[i], f[iFile]);
+ if (!hFractions[i][iFile])
+ return -1;
+
+ if (iFile == reference) {
+ hYields[i] = loadHisto(histNamesYields[i], f[iFile]);
+ if (!hYields[i])
+ return -1;
+ }
+ }
+ }
+
+
+ TGraphAsymmErrors* grSysErrors[numSpecies] = {0x0,};
+ TGraphAsymmErrors* grSysErrorsYields[numSpecies] = {0x0,};
+
+ TH1F* hSystematicsPions[numFiles];
+ TCanvas* cSystematicsPions = calculateSystematics("cSystematicsPions", "Systematics Pions", hFractions[2], numFiles,
+ AliPID::kPion, nSigma,
+ histTitles, reference, hSystematicsPions, &grSysErrors[2], ignoreSigmaErrors);
+
+ TH1F* hSystematicsElectrons[numFiles];
+ TCanvas* cSystematicsElectrons = calculateSystematics("cSystematicsElectrons", "Systematics Electrons", hFractions[0], numFiles,
+ AliPID::kElectron,
+ nSigma, histTitles, reference, hSystematicsElectrons,
+ &grSysErrors[0], ignoreSigmaErrors);
+
+ TH1F* hSystematicsKaons[numFiles];
+ TCanvas* cSystematicsKaons = calculateSystematics("cSystematicsKaons", "Systematics Kaons", hFractions[1], numFiles, AliPID::kKaon, nSigma,
+ histTitles, reference, hSystematicsKaons, &grSysErrors[1], ignoreSigmaErrors);
+
+ TH1F* hSystematicsProtons[numFiles];
+ TCanvas* cSystematicsProtons = calculateSystematics("cSystematicsProtons", "Systematics Protons", hFractions[3], numFiles,
+ AliPID::kProton, nSigma,
+ histTitles, reference, hSystematicsProtons, &grSysErrors[3], ignoreSigmaErrors);
+
+ TH1F* hSystematicsMuons[numFiles];
+ TCanvas* cSystematicsMuons = calculateSystematics("cSystematicsMuons", "Systematics Muons", hFractions[4], numFiles,
+ AliPID::kMuon, nSigma,
+ histTitles, reference, hSystematicsMuons, &grSysErrors[4], ignoreSigmaErrors);
+
+ Double_t pLow = 0.15;
+ Double_t pHigh = 50.;
+ TCanvas* cFractionsWithSystematicError = DrawFractionHistos("cFractionsWithSystematicError", "Particle fractions", pLow, pHigh, hFractions, reference,
+ grSysErrors);
+
+
+ //TODO At the moment, the error of the fractions and the yield is just a constant factor (number of tracks in that bin)
+ // (-> But this can change in future (I have to think about it a little bit more carefully)).
+ // Thus, the relative errors are the same for fractions and yields and I can just use this fact to
+ // transform the errors from the fractions to those of the yields.
+ // However, this causes trouble in case of fraction = 0. Therefore, sum up the yields to the total yield and use this for scaling
+ for (Int_t i = 0; i < numSpecies; i++) {
+ grSysErrorsYields[i] = new TGraphAsymmErrors(*grSysErrors[i]);
+ TString name = grSysErrors[i]->GetName();
+ name.ReplaceAll("systematicError_", "systematicErrorYields_");
+ grSysErrorsYields[i]->SetName(name.Data());
+
+ for (Int_t ind = 0; ind < grSysErrorsYields[i]->GetN(); ind++) {
+ Double_t totalYield = 0;
+ for (Int_t j = 0; j < numSpecies; j++)
+ totalYield += hYields[j]->GetBinContent(ind + 1);
+
+ const Double_t yield = hYields[i]->GetBinContent(ind + 1);
+ const Double_t sysErrorLow = grSysErrors[i]->GetErrorYlow(ind);
+ const Double_t sysErrorHigh = grSysErrors[i]->GetErrorYhigh(ind);
+
+ grSysErrorsYields[i]->SetPoint(ind, grSysErrorsYields[i]->GetX()[ind], yield);
+ grSysErrorsYields[i]->SetPointEYhigh(ind, totalYield * sysErrorHigh);
+ grSysErrorsYields[i]->SetPointEYlow(ind, totalYield * sysErrorLow);
+
+ /*
+ Double_t totalYield = 0;
+ for (Int_t j = 0; j < numSpecies; j++)
+ totalYield += hYields[j]->GetBinContent(ind + 1);
+
+ const Double_t yield = hYields[i]->GetBinContent(ind + 1);
+ const Double_t fraction = hFractions[i][reference]->GetBinContent(ind + 1);
+ const Double_t sysErrorLow = grSysErrors[i]->GetErrorYlow(ind);
+ const Double_t sysErrorHigh = grSysErrors[i]->GetErrorYhigh(ind);
+
+ if (fraction <= 0.) {
+ printf("Error: Fraction = 0 for species %d. Cannot transform error....\n", i);
+ return -1;
+ }
+ const Double_t sysErrorLowRel = sysErrorLow / fraction;
+ const Double_t sysErrorHighRel = sysErrorHigh / fraction;
+
+ grSysErrorsYields[i]->SetPoint(ind, grSysErrorsYields[i]->GetX()[ind], yield);
+ grSysErrorsYields[i]->SetPointEYhigh(ind, sysErrorHighRel * yield);
+ grSysErrorsYields[i]->SetPointEYlow(ind, sysErrorLowRel * yield);
+ */
+ }
+ }
+
+
+ // Output file
+ TFile* fSave = 0x0;
+ TDatime daTime;
+ TString saveFileName;
+
+ saveFileName = Form("outputSystematics_%s_nSigma%.1f__%04d_%02d_%02d.root", outFileTitle.Data(), nSigma, daTime.GetYear(),
+ daTime.GetMonth(), daTime.GetDay());
+
+ fSave = TFile::Open(Form("%s/%s", path.Data(), saveFileName.Data()), "recreate");
+ if (!fSave) {
+ std::cout << "Failed to open save file \"" << Form("%s/%s", path.Data(), saveFileName.Data()) << "\"!" << std::endl;
+ return -1;
+ }
+
+ // Save final results
+ fSave->cd();
+
+ for (Int_t i = 0; i < numFiles; i++) {
+ if (hSystematicsElectrons[i])
+ hSystematicsElectrons[i]->Write();
+
+ if (hSystematicsPions[i])
+ hSystematicsPions[i]->Write();
+
+ if (hSystematicsKaons[i])
+ hSystematicsKaons[i]->Write();
+
+ if (hSystematicsProtons[i])
+ hSystematicsProtons[i]->Write();
+ if (hSystematicsMuons[i])
+ hSystematicsMuons[i]->Write();
+ }
+
+ if (cSystematicsElectrons)
+ cSystematicsElectrons->Write();
+
+ if (cSystematicsPions)
+ cSystematicsPions->Write();
+
+ if (cSystematicsKaons)
+ cSystematicsKaons->Write();
+
+ if (cSystematicsProtons)
+ cSystematicsProtons->Write();
+
+ if (cSystematicsMuons)
+ cSystematicsMuons->Write();
+
+ if (cFractionsWithSystematicError)
+ cFractionsWithSystematicError->Write();
+
+ for (Int_t i = 0; i < numSpecies; i++) {
+ if (hFractions[i][reference])
+ hFractions[i][reference]->Write();
+
+ if (grSysErrors[i])
+ grSysErrors[i]->Write();
+
+ if (hYields[i])
+ hYields[i]->Write();
+
+ if (grSysErrorsYields[i])
+ grSysErrorsYields[i]->Write();
+ }
+
+ // Save list of file names in output file
+ TString listOfFileNames = "";
+ for (Int_t i = 0; i < numFiles; i++) {
+ listOfFileNames.Append(Form("%s%d: %s", i == 0 ? "" : ", ", i, fileNames[i].Data()));
+ }
+
+ TNamed* settings = new TNamed(Form("Used files for systematics: %s\n", listOfFileNames.Data()),
+ Form("Used files for systematics: %s\n", listOfFileNames.Data()));
+ settings->Write();
+
+ fSave->Close();
+
+ delete cSystematicsElectrons;
+ delete cSystematicsPions;
+ delete cSystematicsKaons;
+ delete cSystematicsMuons;
+ delete cSystematicsProtons;
+ delete cFractionsWithSystematicError;
+
+ return 0;
+}
- /*************************************************************************\r
-* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. * **************************************************************************/\r
-\r
-\r
-#include "AliAnalysisTaskQAHighPtDeDx.h"\r
-\r
-// ROOT includes\r
-#include <TList.h>\r
-#include <TTree.h>\r
-#include <TMath.h>\r
-#include <TH1.h>\r
-#include <TF1.h>\r
-#include <TProfile.h>\r
-#include <TParticle.h>\r
-#include <TFile.h>\r
-\r
-// AliRoot includes\r
-#include <AliAnalysisManager.h>\r
-#include <AliAnalysisFilter.h>\r
-#include <AliESDInputHandler.h>\r
-#include <AliESDEvent.h>\r
-#include <AliESDVertex.h>\r
-#include <AliLog.h>\r
-#include <AliExternalTrackParam.h>\r
-#include <AliESDtrackCuts.h>\r
-#include <AliESDVZERO.h>\r
-#include <AliAODVZERO.h>\r
-\r
-#include <AliMCEventHandler.h>\r
-#include <AliMCEvent.h>\r
-#include <AliStack.h>\r
-\r
-#include <TTreeStream.h>\r
-\r
-#include <AliHeader.h>\r
-#include <AliGenPythiaEventHeader.h>\r
-#include <AliGenDPMjetEventHeader.h>\r
-\r
-#include "AliCentrality.h" \r
-#include <AliESDv0.h>\r
-#include <AliKFVertex.h>\r
-#include <AliAODVertex.h>\r
-\r
-#include <AliAODTrack.h> \r
-#include <AliAODPid.h> \r
-#include <AliAODMCHeader.h> \r
-\r
-\r
-// STL includes\r
-#include <iostream>\r
-using namespace std;\r
-\r
-\r
-//\r
-// Responsible:\r
-// Antonio Ortiz (Lund)\r
-// Peter Christiansen (Lund)\r
-//\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-const Double_t AliAnalysisTaskQAHighPtDeDx::fgkClight = 2.99792458e-2;\r
-Float_t magf = -1;\r
-TF1* cutLow = new TF1("StandardPhiCutLow", "0.1/x/x+pi/18.0-0.025", 0, 50);\r
-TF1* cutHigh = new TF1("StandardPhiCutHigh", "0.12/x+pi/18.0+0.035", 0, 50);\r
-Double_t DeDxMIPMin = 30;\r
-Double_t DeDxMIPMax = 65;\r
-const Int_t nHists = 9;\r
-Float_t centralityGlobal = -10;\r
-Int_t etaLow[nHists] = {-8, -8, -6, -4, -2, 0, 2, 4, 6};\r
-Int_t etaHigh[nHists] = { 8, -6, -4, -2, 0, 2, 4, 6, 8};\r
-\r
-Int_t nDeltaPiBins = 80;\r
-Double_t deltaPiLow = 20;\r
-Double_t deltaPiHigh = 100;\r
-const Char_t *Pid[7]={"Ch","Pion","Kaon","Proton","Electron","Muon","Oher"};\r
-ClassImp(AliAnalysisTaskQAHighPtDeDx)\r
-//_____________________________________________________________________________\r
-//AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx(const char *name):\r
-AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx():\r
- AliAnalysisTaskSE(),\r
- fESD(0x0),\r
- fAOD(0x0),\r
- fMC(0x0),\r
- fMCStack(0x0),\r
- fMCArray(0x0),\r
- fTrackFilterGolden(0x0),\r
- fTrackFilterTPC(0x0),\r
- fCentEst("V0M"),\r
- fAnalysisType("ESD"),\r
- fAnalysisMC(kFALSE),\r
- fAnalysisPbPb(kFALSE),\r
- ftrigBit(0x0),\r
- fRandom(0x0),\r
- fPileUpRej(kFALSE),\r
- fVtxCut(10.0), \r
- fEtaCut(0.9), \r
- fMinCent(0.0),\r
- fMaxCent(100.0),\r
- fStoreMcIn(kFALSE),//\r
- fMcProcessType(-999),\r
- fTriggeredEventMB(-999),\r
- fVtxStatus(-999),\r
- fZvtx(-999),\r
- fZvtxMC(-999),\r
- fRun(-999),\r
- fEventId(-999),\r
- fListOfObjects(0), \r
- fEvents(0x0), fVtx(0x0), fVtxMC(0x0), fVtxBeforeCuts(0x0), fVtxAfterCuts(0x0),\r
- fn1(0x0),\r
- fcent(0x0),\r
- hMIPVsEta(0x0),\r
- pMIPVsEta(0x0),\r
- hMIPVsEtaV0s(0x0),\r
- pMIPVsEtaV0s(0x0),\r
- hPlateauVsEta(0x0),\r
- pPlateauVsEta(0x0),\r
- hPhi(0x0)\r
-\r
-\r
-{\r
- //default constructor\r
-}\r
-\r
-\r
-AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx(const char *name):\r
- AliAnalysisTaskSE(name),\r
- fESD(0x0),\r
- fAOD(0x0),\r
- fMC(0x0),\r
- fMCStack(0x0),\r
- fMCArray(0x0),\r
- fTrackFilterGolden(0x0),\r
- fTrackFilterTPC(0x0),\r
- fCentEst("V0M"),\r
- fAnalysisType("ESD"),\r
- fAnalysisMC(kFALSE),\r
- fAnalysisPbPb(kFALSE),\r
- ftrigBit(0x0),\r
- fRandom(0x0),\r
- fPileUpRej(kFALSE),\r
- fVtxCut(10.0), \r
- fEtaCut(0.9), \r
- fMinCent(0.0),\r
- fMaxCent(100.0),\r
- fStoreMcIn(kFALSE),//\r
- fMcProcessType(-999),\r
- fTriggeredEventMB(-999),\r
- fVtxStatus(-999),\r
- fZvtx(-999),\r
- fZvtxMC(-999),\r
- fRun(-999),\r
- fEventId(-999),\r
- fListOfObjects(0), \r
- fEvents(0x0), fVtx(0x0), fVtxMC(0x0), fVtxBeforeCuts(0x0), fVtxAfterCuts(0x0),\r
- fn1(0x0),\r
- fcent(0x0),\r
- hMIPVsEta(0x0),\r
- pMIPVsEta(0x0),\r
- hMIPVsEtaV0s(0x0),\r
- pMIPVsEtaV0s(0x0),\r
- hPlateauVsEta(0x0),\r
- pPlateauVsEta(0x0),\r
- hPhi(0x0)\r
-\r
-\r
-{\r
- // Default constructor (should not be used)\r
- for(Int_t i=0;i<9;++i){\r
- \r
- hMIPVsNch[i]=0;//TH2D, MIP vs Nch for different eta intervals\r
- pMIPVsNch[i]=0;//TProfile, MIP vs Nch for different eta intervals\r
- hMIPVsPhi[i]=0;//TH2D, MIP vs phi for different eta intervals\r
- pMIPVsPhi[i]=0;//TProfile, MIP vs phi for different eta intervals\r
- hPlateauVsPhi[i]=0;//TH2D, dE/dx vs Phi, electrons 0.4<p<0.6 GeV/c\r
- pPlateauVsPhi[i]=0;//TProfile, dE/dx vs Phi, electrons 0.4<p<0.6 GeV/c\r
- histPiV0[i]=0;//TH2D, dE/dx vs p, pi id by V0s\r
- histpPiV0[i]=0;//TH1D, pi id by V0s\r
- histPV0[i]=0;// TH2D, dE/dx vs p, p id by V0s\r
- histpPV0[i]=0;// TH1D, p id by V0s\r
- histAllCh[i]=0;//TH2D, dE/dx vs p for all charged particles\r
- histPiTof[i]=0;//TH2D, dE/dx vs p for a "clean" sample of pions, beta>1\r
- histpPiTof[i]=0;//TH1D, for a "clean" sample of pions, beta>1\r
- histEV0[i]=0;\r
-\r
- for(Int_t pid=0;pid<7;++pid){\r
- hMcIn[pid][i]=0;\r
- hMcOut[pid][i]=0;\r
- }\r
-\r
- }\r
- DefineOutput(1, TList::Class());//esto es nuevo\r
-}\r
-\r
-\r
-\r
-\r
-AliAnalysisTaskQAHighPtDeDx::~AliAnalysisTaskQAHighPtDeDx() {\r
- //\r
- // Destructor\r
- //\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-//______________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::UserCreateOutputObjects()\r
-{ \r
- // This method is called once per worker node\r
- // Here we define the output: histograms and debug tree if requested \r
- // We also create the random generator here so it might get different seeds...\r
- fRandom = new TRandom(0); // 0 means random seed\r
- \r
-\r
-\r
- //OpenFile(1);\r
- fListOfObjects = new TList();\r
- fListOfObjects->SetOwner();\r
- \r
-\r
-\r
-\r
- //\r
- // Histograms\r
- // \r
- fEvents = new TH1I("fEvents","Number of analyzed events; Events; Counts", 3, 0, 3);\r
- fListOfObjects->Add(fEvents);\r
-\r
- fn1=new TH1F("fn1","fn1",11,-1,10);\r
- fListOfObjects->Add(fn1);\r
-\r
- fcent=new TH1F("fcent","fcent",104,-2,102);\r
- fListOfObjects->Add(fcent);\r
-\r
- fVtx = new TH1I("fVtx","Vtx info (0=no, 1=yes); Vtx; Counts", 2, -0.5, 1.5);\r
- fListOfObjects->Add(fVtx);\r
-\r
- fVtxBeforeCuts = new TH1F("fVtxBeforeCuts", "Vtx distribution (before cuts); Vtx z [cm]; Counts", 120, -30, 30);\r
- fListOfObjects->Add(fVtxBeforeCuts);\r
- \r
- fVtxAfterCuts = new TH1F("fVtxAfterCuts", "Vtx distribution (before cuts); Vtx z [cm]; Counts", 120, -30, 30);\r
- fListOfObjects->Add(fVtxAfterCuts);\r
-\r
-\r
- const Int_t nPtBinsV0s = 25;\r
- Double_t ptBinsV0s[nPtBinsV0s+1] = { 0.0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 ,\r
- 1.2 , 1.4 , 1.6 , 1.8 , 2.0 , 2.5 , 3.0 , 3.5 , 4.0 , 5.0 , 7.0 ,\r
- 9.0 , 12.0, 15.0, 20.0 };\r
- \r
-\r
-\r
-\r
- const Char_t* ending[nHists] = {"", "86", "64", "42", "20", "02", "24", "46", "68"};\r
- \r
- const Char_t* LatexEta[nHists] = {\r
- "|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", \r
- "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8" \r
- };\r
- hPhi = new TH2D("histPhi", "pt; #phi'", nPtBinsV0s, ptBinsV0s, 90, -0.05, 0.4); \r
- //dE/dx vs phi, pions at the MIP\r
- fListOfObjects->Add(hPhi);\r
-\r
-\r
- \r
-\r
- Int_t nPhiBins = 36;\r
- \r
- for(Int_t i = 0; i < nHists; i++) {\r
- \r
- \r
- hMIPVsPhi[i] = new TH2D(Form("hMIPVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx MIP",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(), \r
- DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);\r
- hMIPVsPhi[i]->Sumw2();\r
- \r
- pMIPVsPhi[i] = new TProfile(Form("pMIPVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx MIP",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),\r
- DeDxMIPMin, DeDxMIPMax);\r
- pMIPVsPhi[i]->SetMarkerStyle(20);\r
- pMIPVsPhi[i]->SetMarkerColor(1);\r
- pMIPVsPhi[i]->SetLineColor(1);\r
- pMIPVsPhi[i]->Sumw2();\r
-\r
- fListOfObjects->Add(hMIPVsPhi[i]);\r
- fListOfObjects->Add(pMIPVsPhi[i]);\r
-\r
- hPlateauVsPhi[i] = new TH2D(Form("hPlateauVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx Plateau",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),\r
- 95-DeDxMIPMax, DeDxMIPMax, 95);\r
- hPlateauVsPhi[i]->Sumw2();\r
- \r
- pPlateauVsPhi[i] = new TProfile(Form("pPlateauVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx Plateau",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),\r
- DeDxMIPMax, 95);\r
- pPlateauVsPhi[i]->SetMarkerStyle(20);\r
- pPlateauVsPhi[i]->SetMarkerColor(1);\r
- pPlateauVsPhi[i]->SetLineColor(1);\r
- pPlateauVsPhi[i]->Sumw2();\r
-\r
- fListOfObjects->Add(hPlateauVsPhi[i]);\r
- fListOfObjects->Add(pPlateauVsPhi[i]);\r
-\r
-\r
- hMIPVsNch[i] = new TH2D(Form("hMIPVsNch%s", ending[i]), Form("%s; TPC track mult. |#eta|<0.8; dE/dx MIP",LatexEta[i]), 400, 1, 2001, \r
- DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);\r
- hMIPVsNch[i]->Sumw2();\r
- \r
- pMIPVsNch[i] = new TProfile(Form("pMIPVsNch%s", ending[i]), Form("%s; TPC track mult. |#eta|<0.8; dE/dx MIP",LatexEta[i]), 400, 1, 2001, DeDxMIPMin, DeDxMIPMax);\r
- pMIPVsNch[i]->SetMarkerStyle(20);\r
- pMIPVsNch[i]->SetMarkerColor(1);\r
- pMIPVsNch[i]->SetLineColor(1);\r
- pMIPVsNch[i]->Sumw2();\r
-\r
- fListOfObjects->Add(hMIPVsNch[i]);\r
- fListOfObjects->Add(pMIPVsNch[i]);\r
-\r
- //two dimmesional distributions dE/dx vs p for secondary pions\r
- histPiV0[i] = new TH2D(Form("histPiV0%s", ending[i]), "Pions id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);\r
- histPiV0[i]->Sumw2();\r
- fListOfObjects->Add(histPiV0[i]);\r
-\r
- histpPiV0[i] = new TH1D(Form("histPiV01D%s", ending[i]), "Pions id by V0; #it{p} (GeV/#it{c}); counts", 200, 0, 20);\r
- histpPiV0[i]->Sumw2();\r
- fListOfObjects->Add(histpPiV0[i]);\r
-\r
- //two dimmesional distributions dE/dx vs p for secondary protons\r
- histPV0[i] = new TH2D(Form("histPV0%s", ending[i]), "Protons id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);\r
- histPV0[i]->Sumw2();\r
- fListOfObjects->Add(histPV0[i]);\r
-\r
- histpPV0[i] = new TH1D(Form("histPV01D%s", ending[i]), "Protons id by V0; #it{p} (GeV/#it{c}); counts", 200, 0, 20);\r
- histpPV0[i]->Sumw2();\r
- fListOfObjects->Add(histpPV0[i]);\r
-\r
- //two dimmesional distributions dE/dx vs p for primary pions\r
- histPiTof[i] = new TH2D(Form("histPiTof%s", ending[i]), "all charged", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);\r
- histPiTof[i]->Sumw2();\r
-\r
- histpPiTof[i] = new TH1D(Form("histPiTof1D%s", ending[i]), "Protons id by V0; #it{p} (GeV/#it{c}); counts", 200, 0, 20);\r
- histpPiTof[i]->Sumw2();\r
- fListOfObjects->Add(histpPiTof[i]);\r
-\r
-\r
- histAllCh[i] = new TH2D(Form("histAllCh%s", ending[i]), "Pions id by TOF", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);\r
- histAllCh[i]->Sumw2();\r
-\r
- fListOfObjects->Add(histPiTof[i]);\r
- fListOfObjects->Add(histAllCh[i]);\r
-\r
- histEV0[i] = new TH2D(Form("histEV0%s", ending[i]), "Electrons id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);\r
- histEV0[i]->Sumw2();\r
- fListOfObjects->Add(histEV0[i]);\r
-\r
-\r
-\r
- }\r
-\r
-\r
- hMIPVsEta = new TH2D("hMIPVsEta","; #eta; dE/dx_{MIP, primary tracks}",16,-0.8,0.8,DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);\r
- pMIPVsEta = new TProfile("pMIPVsEta","; #eta; #LT dE/dx #GT_{MIP, primary tracks}",16,-0.8,0.8, DeDxMIPMin, DeDxMIPMax);\r
- hMIPVsEtaV0s = new TH2D("hMIPVsEtaV0s","; #eta; dE/dx_{MIP, secondary tracks}",16,-0.8,0.8,DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);\r
- pMIPVsEtaV0s = new TProfile("pMIPVsEtaV0s","; #eta; #LT dE/dx #GT_{MIP, secondary tracks}",16,-0.8,0.8,DeDxMIPMin, DeDxMIPMax);\r
- \r
- hPlateauVsEta = new TH2D("hPlateauVsEta","; #eta; dE/dx_{Plateau, primary tracks}",16,-0.8,0.8,95-DeDxMIPMax, DeDxMIPMax, 95);\r
- pPlateauVsEta = new TProfile("pPlateauVsEta","; #eta; #LT dE/dx #GT_{Plateau, primary tracks}",16,-0.8,0.8, DeDxMIPMax, 95);\r
-\r
- fListOfObjects->Add(hMIPVsEta);\r
- fListOfObjects->Add(pMIPVsEta);\r
- fListOfObjects->Add(hMIPVsEtaV0s);\r
- fListOfObjects->Add(pMIPVsEtaV0s);\r
- fListOfObjects->Add(hPlateauVsEta);\r
- fListOfObjects->Add(pPlateauVsEta);\r
-\r
-\r
-\r
-\r
-\r
-\r
- if (fAnalysisMC) { \r
- for(Int_t i = 0; i < nHists; i++) {\r
- for(Int_t pid = 0; pid < 7; pid++) {\r
- \r
- hMcIn[pid][i] = new TH1D(Form("hIn%s%s", Pid[pid],ending[i]), Form("MC in (pid %s)", Pid[pid]), \r
- nPtBinsV0s, ptBinsV0s);\r
- fListOfObjects->Add(hMcIn[pid][i]);\r
- \r
- hMcOut[pid][i] = new TH1D(Form("hMcOut%s%s", Pid[pid],ending[i]), Form("MC out (pid %s)", Pid[pid]), \r
- nPtBinsV0s, ptBinsV0s);\r
- fListOfObjects->Add(hMcOut[pid][i]);\r
- \r
- \r
- }\r
- }\r
-\r
- fVtxMC = new TH1F("fVtxMC","mc vtx", 120, -30, 30);\r
- fListOfObjects->Add(fVtxMC);\r
- \r
- }\r
- \r
- // Post output data.\r
- PostData(1, fListOfObjects);\r
-}\r
-\r
-//______________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::UserExec(Option_t *) \r
-{\r
- // Main loop\r
-\r
- //\r
- // First we make sure that we have valid input(s)!\r
- //\r
-\r
-\r
-\r
- AliVEvent *event = InputEvent();\r
- if (!event) {\r
- Error("UserExec", "Could not retrieve event");\r
- return;\r
- }\r
-\r
-\r
-\r
- if (fAnalysisType == "ESD"){\r
- fESD = dynamic_cast<AliESDEvent*>(event);\r
- if(!fESD){\r
- Printf("%s:%d ESDEvent not found in Input Manager",(char*)__FILE__,__LINE__);\r
- this->Dump();\r
- return;\r
- } \r
- } else {\r
- fAOD = dynamic_cast<AliAODEvent*>(event);\r
- if(!fAOD){\r
- Printf("%s:%d AODEvent not found in Input Manager",(char*)__FILE__,__LINE__);\r
- this->Dump();\r
- return;\r
- } \r
- }\r
-\r
-\r
-\r
- if (fAnalysisMC) {\r
-\r
- if (fAnalysisType == "ESD"){\r
- fMC = dynamic_cast<AliMCEvent*>(MCEvent());\r
- if(!fMC){\r
- Printf("%s:%d MCEvent not found in Input Manager",(char*)__FILE__,__LINE__);\r
- this->Dump();\r
- return;\r
- } \r
-\r
- fMCStack = fMC->Stack();\r
- \r
- if(!fMCStack){\r
- Printf("%s:%d MCStack not found in Input Manager",(char*)__FILE__,__LINE__);\r
- this->Dump();\r
- return;\r
- } \r
- } else { // AOD\r
-\r
- fMC = dynamic_cast<AliMCEvent*>(MCEvent());\r
- if(fMC)\r
- fMC->Dump();\r
-\r
- fMCArray = (TClonesArray*)fAOD->FindListObject("mcparticles");\r
- if(!fMCArray){\r
- Printf("%s:%d AOD MC array not found in Input Manager",(char*)__FILE__,__LINE__);\r
- this->Dump();\r
- return;\r
- } \r
- }\r
- }\r
-\r
- \r
- // Get trigger decision\r
- fTriggeredEventMB = 0; //init\r
- \r
- fn1->Fill(0);\r
- \r
- if(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))\r
- ->IsEventSelected() & ftrigBit ){\r
- fTriggeredEventMB = 1; //event triggered as minimum bias\r
- }\r
-\r
- // Get process type for MC\r
- fMcProcessType = 0; // -1=invalid, 0=data, 1=ND, 2=SD, 3=DD\r
-\r
- // real data that are not triggered we skip\r
- if(!fAnalysisMC && !fTriggeredEventMB)\r
- return; \r
- \r
- fn1->Fill(1);\r
-\r
-\r
- if (fAnalysisMC) {\r
- \r
-\r
-\r
- if (fAnalysisType == "ESD"){\r
-\r
- \r
-\r
- AliHeader* headerMC = fMC->Header();\r
- if (headerMC) {\r
- \r
- AliGenEventHeader* genHeader = headerMC->GenEventHeader();\r
- TArrayF vtxMC(3); // primary vertex MC \r
- vtxMC[0]=9999; vtxMC[1]=9999; vtxMC[2]=9999; //initialize with dummy\r
- if (genHeader) {\r
- genHeader->PrimaryVertex(vtxMC);\r
- }\r
- fZvtxMC = vtxMC[2];\r
- \r
- // PYTHIA:\r
- AliGenPythiaEventHeader* pythiaGenHeader =\r
- dynamic_cast<AliGenPythiaEventHeader*>(headerMC->GenEventHeader());\r
- if (pythiaGenHeader) { //works only for pythia\r
- fMcProcessType = GetPythiaEventProcessType(pythiaGenHeader->ProcessType());\r
- }\r
- // PHOJET:\r
- AliGenDPMjetEventHeader* dpmJetGenHeader =\r
- dynamic_cast<AliGenDPMjetEventHeader*>(headerMC->GenEventHeader());\r
- if (dpmJetGenHeader) {\r
- fMcProcessType = GetDPMjetEventProcessType(dpmJetGenHeader->ProcessType());\r
- }\r
- }\r
- } else { // AOD\r
- \r
- \r
-\r
- AliAODMCHeader* mcHeader = dynamic_cast<AliAODMCHeader*>(fAOD->FindListObject("mcHeader")); \r
-\r
-\r
- if(mcHeader) {\r
- fZvtxMC = mcHeader->GetVtxZ();\r
- \r
-\r
-\r
- if(strstr(mcHeader->GetGeneratorName(), "Pythia")) {\r
- fMcProcessType = GetPythiaEventProcessType(mcHeader->GetEventType());\r
- } else {\r
- fMcProcessType = GetDPMjetEventProcessType(mcHeader->GetEventType());\r
- }\r
- }\r
- }\r
-\r
-\r
- }\r
- \r
- \r
-\r
- if (fAnalysisType == "ESD"){\r
- \r
- const AliESDVertex *vtxESD = fESD->GetPrimaryVertexTracks();\r
- if(vtxESD->GetNContributors()<1) {\r
- // SPD vertex\r
- vtxESD = fESD->GetPrimaryVertexSPD();\r
- /* quality checks on SPD-vertex */\r
- TString vertexType = vtxESD->GetTitle();\r
- if (vertexType.Contains("vertexer: Z") && (vtxESD->GetDispersion() > 0.04 || vtxESD->GetZRes() > 0.25)) \r
- fZvtx = -1599; //vertex = 0x0; //\r
- else if (vtxESD->GetNContributors()<1) \r
- fZvtx = -999; //vertex = 0x0; //\r
- else\r
- fZvtx = vtxESD->GetZ();\r
- } \r
- else\r
- fZvtx = vtxESD->GetZ();\r
- \r
- }\r
- else // AOD\r
- fZvtx = GetVertex(fAOD);\r
- \r
- fVtxBeforeCuts->Fill(fZvtx);\r
- \r
- //cut on the z position of vertex\r
- if (TMath::Abs(fZvtx) > fVtxCut) { \r
- return;\r
- }\r
- fn1->Fill(2);\r
- \r
-\r
-\r
-\r
-\r
-\r
- Float_t centrality = -10;\r
-\r
- // only analyze triggered events\r
- if(fTriggeredEventMB) {\r
- \r
- if (fAnalysisType == "ESD"){\r
- if(fAnalysisPbPb){\r
- AliCentrality *centObject = fESD->GetCentrality();\r
- centrality = centObject->GetCentralityPercentile(fCentEst);\r
- centralityGlobal = centrality;\r
- if((centrality>fMaxCent)||(centrality<fMinCent))return;\r
- }\r
- fcent->Fill(centrality);\r
- fn1->Fill(3);\r
- if(fAnalysisMC){\r
- if(TMath::Abs(fZvtxMC)<fVtxCut){\r
- ProcessMCTruthESD();\r
- fVtxMC->Fill(fZvtxMC);\r
- }\r
- }\r
- AnalyzeESD(fESD);\r
- } else { // AOD\r
- if(fAnalysisPbPb){\r
- AliCentrality *centObject = fAOD->GetCentrality();\r
- if(centObject){\r
- centrality = centObject->GetCentralityPercentile(fCentEst); \r
- }\r
- //cout<<"centrality="<<centrality<<endl;\r
- if((centrality>fMaxCent)||(centrality<fMinCent))return;\r
- }\r
- fcent->Fill(centrality);\r
- fn1->Fill(3);\r
- if(fAnalysisMC){\r
- if(TMath::Abs(fZvtxMC)<fVtxCut){\r
-\r
- ProcessMCTruthAOD();\r
- fVtxMC->Fill(fZvtxMC);\r
- }\r
- }\r
- AnalyzeAOD(fAOD);\r
- }\r
- }\r
-\r
- fVtxAfterCuts->Fill(fZvtx);\r
-\r
- \r
- \r
-\r
- // Post output data.\r
- PostData(1, fListOfObjects);\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::AnalyzeESD(AliESDEvent* esdEvent)\r
-{\r
- fRun = esdEvent->GetRunNumber();\r
- fEventId = 0;\r
- if(esdEvent->GetHeader())\r
- fEventId = GetEventIdAsLong(esdEvent->GetHeader());\r
- \r
- cout << "centrality=" << centralityGlobal << endl;\r
-\r
-\r
- Bool_t isPileup = esdEvent->IsPileupFromSPD();\r
- if(fPileUpRej)\r
- if(isPileup)\r
- return;\r
- fn1->Fill(4);\r
-\r
-\r
- // Int_t event = esdEvent->GetEventNumberInFile();\r
- //UInt_t time = esdEvent->GetTimeStamp();\r
- // ULong64_t trigger = esdEvent->GetTriggerMask();\r
- magf = esdEvent->GetMagneticField();\r
-\r
-\r
-\r
-\r
-\r
- if(fTriggeredEventMB) {// Only MC case can we have not triggered events\r
- \r
- // accepted event\r
- fEvents->Fill(0);\r
- \r
- \r
- //Change, 10/04/13. Now accept all events to do a correct normalization\r
- //if(fVtxStatus!=1) return; // accepted vertex\r
- //Int_t nESDTracks = esdEvent->GetNumberOfTracks();\r
- \r
- ProduceArrayTrksESD( esdEvent );//produce array with global track parameters\r
- ProduceArrayV0ESD( esdEvent );//v0's\r
-\r
- \r
- fEvents->Fill(1);\r
-\r
-\r
-\r
-\r
- } // end if triggered\r
-\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::AnalyzeAOD(AliAODEvent* aodEvent)\r
-{\r
- fRun = aodEvent->GetRunNumber();\r
- fEventId = 0;\r
- if(aodEvent->GetHeader())\r
- fEventId = GetEventIdAsLong(aodEvent->GetHeader());\r
- \r
- //UInt_t time = 0; // Missing AOD info? aodEvent->GetTimeStamp();\r
- magf = aodEvent->GetMagneticField();\r
-\r
- //Int_t trackmult = 0; // no pt cuts\r
- //Int_t nadded = 0;\r
-\r
- Bool_t isPileup = aodEvent->IsPileupFromSPD();\r
- if(fPileUpRej)\r
- if(isPileup)\r
- return;\r
- fn1->Fill(4);\r
-\r
-\r
-\r
- if(fTriggeredEventMB) {// Only MC case can we have not triggered events\r
- \r
- // accepted event\r
- fEvents->Fill(0);\r
- \r
- //if(fVtxStatus!=1) return; // accepted vertex\r
- //Int_t nAODTracks = aodEvent->GetNumberOfTracks(); \r
-\r
- ProduceArrayTrksAOD( aodEvent );\r
- ProduceArrayV0AOD( aodEvent );\r
-\r
- fEvents->Fill(1);\r
- \r
-\r
-\r
-\r
- } // end if triggered\r
-\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Float_t AliAnalysisTaskQAHighPtDeDx::GetVertex(const AliVEvent* event) const\r
-{\r
- Float_t zvtx = -999;\r
- \r
- const AliVVertex* primaryVertex = event->GetPrimaryVertex(); \r
- \r
- if(primaryVertex->GetNContributors()>0)\r
- zvtx = primaryVertex->GetZ();\r
-\r
- return zvtx;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Short_t AliAnalysisTaskQAHighPtDeDx::GetPidCode(Int_t pdgCode) const \r
-{\r
- // return our internal code for pions, kaons, and protons\r
- \r
- Short_t pidCode = 6;\r
- \r
- switch (TMath::Abs(pdgCode)) {\r
- case 211:\r
- pidCode = 1; // pion\r
- break;\r
- case 321:\r
- pidCode = 2; // kaon\r
- break;\r
- case 2212:\r
- pidCode = 3; // proton\r
- break;\r
- case 11:\r
- pidCode = 4; // electron\r
- break;\r
- case 13:\r
- pidCode = 5; // muon\r
- break;\r
- default:\r
- pidCode = 6; // something else?\r
- };\r
- \r
- return pidCode;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::ProcessMCTruthESD() \r
-{\r
- // Fill the special MC histogram with the MC truth info\r
- \r
- const Int_t nTracksMC = fMCStack->GetNtrack();\r
-\r
- for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) {\r
- \r
- //Cuts\r
- if(!(fMCStack->IsPhysicalPrimary(iTracks)))\r
- continue;\r
- \r
- TParticle* trackMC = fMCStack->Particle(iTracks);\r
- \r
- TParticlePDG* pdgPart = trackMC ->GetPDG();\r
- Double_t chargeMC = pdgPart->Charge();\r
-\r
- if(chargeMC==0)\r
- continue;\r
- \r
- if (TMath::Abs(trackMC->Eta()) > fEtaCut )\r
- continue;\r
-\r
- Double_t etaMC = trackMC->Eta();\r
- Int_t pdgCode = trackMC->GetPdgCode();\r
- Short_t pidCodeMC = 0;\r
- pidCodeMC = GetPidCode(pdgCode);\r
- \r
- \r
- for(Int_t nh = 0; nh < 9; nh++) {\r
- \r
- if( etaMC > etaHigh[nh]/10.0 || etaMC < etaLow[nh]/10.0 )\r
- continue;\r
- \r
- hMcIn[0][nh]->Fill(trackMC->Pt());\r
- hMcIn[pidCodeMC][nh]->Fill(trackMC->Pt());\r
- \r
- \r
- }\r
-\r
- }//MC track loop\r
- \r
- \r
- \r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::ProcessMCTruthAOD() \r
-{\r
- // Fill the special MC histogram with the MC truth info\r
- \r
-\r
- const Int_t nTracksMC = fMCArray->GetEntriesFast();\r
- \r
- for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) {\r
- \r
- AliAODMCParticle* trackMC = dynamic_cast<AliAODMCParticle*>(fMCArray->At(iTracks));\r
-\r
- if(!trackMC){\r
- AliError("Cannot get MC particle");\r
- continue;\r
- } \r
- \r
- //Cuts\r
- if(!(trackMC->IsPhysicalPrimary()))\r
- continue;\r
- \r
- \r
- Double_t chargeMC = trackMC->Charge();\r
- if(chargeMC==0)\r
- continue;\r
-\r
- \r
- if (TMath::Abs(trackMC->Eta()) > fEtaCut )\r
- continue;\r
- \r
- Double_t etaMC = trackMC->Eta();\r
- Int_t pdgCode = trackMC->GetPdgCode();\r
- Short_t pidCodeMC = 0;\r
- pidCodeMC = GetPidCode(pdgCode);\r
- \r
- //cout<<"pidcode="<<pidCodeMC<<endl;\r
- for(Int_t nh = 0; nh < 9; nh++) {\r
- \r
- if( etaMC > etaHigh[nh]/10.0 || etaMC < etaLow[nh]/10.0 )\r
- continue;\r
- \r
- hMcIn[0][nh]->Fill(trackMC->Pt());\r
- hMcIn[pidCodeMC][nh]->Fill(trackMC->Pt());\r
- \r
- \r
- }\r
- \r
- }//MC track loop\r
- \r
- \r
-}\r
-\r
-\r
-//_____________________________________________________________________________\r
-Short_t AliAnalysisTaskQAHighPtDeDx::GetPythiaEventProcessType(Int_t pythiaType) {\r
- //\r
- // Get the process type of the event. PYTHIA\r
- //\r
- // source PWG0 dNdpt \r
-\r
- Short_t globalType = -1; //init\r
- \r
- if(pythiaType==92||pythiaType==93){\r
- globalType = 2; //single diffractive\r
- }\r
- else if(pythiaType==94){\r
- globalType = 3; //double diffractive\r
- }\r
- //else if(pythiaType != 91){ // also exclude elastic to be sure... CKB??\r
- else {\r
- globalType = 1; //non diffractive\r
- }\r
- return globalType;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Short_t AliAnalysisTaskQAHighPtDeDx::GetDPMjetEventProcessType(Int_t dpmJetType) {\r
- //\r
- // get the process type of the event. PHOJET\r
- //\r
- //source PWG0 dNdpt \r
- // can only read pythia headers, either directly or from cocktalil header\r
- Short_t globalType = -1;\r
- \r
- if (dpmJetType == 1 || dpmJetType == 4) { // explicitly inelastic plus central diffraction\r
- globalType = 1;\r
- }\r
- else if (dpmJetType==5 || dpmJetType==6) {\r
- globalType = 2;\r
- }\r
- else if (dpmJetType==7) {\r
- globalType = 3;\r
- }\r
- return globalType;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-ULong64_t AliAnalysisTaskQAHighPtDeDx::GetEventIdAsLong(AliVHeader* header) const\r
-{\r
- // To have a unique id for each event in a run!\r
- // Modified from AliRawReader.h\r
- return ((ULong64_t)header->GetBunchCrossNumber()+\r
- (ULong64_t)header->GetOrbitNumber()*3564+\r
- (ULong64_t)header->GetPeriodNumber()*16777215*3564);\r
-}\r
-\r
-\r
-//____________________________________________________________________\r
-TParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMother(AliStack* stack, Int_t label)\r
-{\r
- //\r
- // Finds the first mother among the primary particles of the particle identified by <label>,\r
- // i.e. the primary that "caused" this particle\r
- //\r
- // Taken from AliPWG0Helper class\r
- //\r
-\r
- Int_t motherLabel = FindPrimaryMotherLabel(stack, label);\r
- if (motherLabel < 0)\r
- return 0;\r
-\r
- return stack->Particle(motherLabel);\r
-}\r
-\r
-//____________________________________________________________________\r
-Int_t AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherLabel(AliStack* stack, Int_t label)\r
-{\r
- //\r
- // Finds the first mother among the primary particles of the particle identified by <label>,\r
- // i.e. the primary that "caused" this particle\r
- //\r
- // returns its label\r
- //\r
- // Taken from AliPWG0Helper class\r
- //\r
- const Int_t nPrim = stack->GetNprimary();\r
- \r
- while (label >= nPrim) {\r
-\r
- //printf("Particle %d (pdg %d) is not a primary. Let's check its mother %d\n", label, mother->GetPdgCode(), mother->GetMother(0));\r
-\r
- TParticle* particle = stack->Particle(label);\r
- if (!particle) {\r
- \r
- AliDebugGeneral("FindPrimaryMotherLabel", AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack.", label));\r
- return -1;\r
- }\r
- \r
- // find mother\r
- if (particle->GetMother(0) < 0) {\r
-\r
- AliDebugGeneral("FindPrimaryMotherLabel", AliLog::kError, Form("UNEXPECTED: Could not find mother of secondary particle %d.", label));\r
- return -1;\r
- }\r
- \r
- label = particle->GetMother(0);\r
- }\r
- \r
- return label;\r
-}\r
-\r
-//____________________________________________________________________\r
-AliAODMCParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherAOD(AliAODMCParticle* startParticle)\r
-{\r
- //\r
- // Finds the first mother among the primary particles of the particle identified by <label>,\r
- // i.e. the primary that "caused" this particle\r
- //\r
- // Taken from AliPWG0Helper class\r
- //\r
-\r
- AliAODMCParticle* mcPart = startParticle;\r
-\r
- while (mcPart)\r
- {\r
- \r
- if(mcPart->IsPrimary())\r
- return mcPart;\r
- \r
- Int_t mother = mcPart->GetMother();\r
-\r
- mcPart = dynamic_cast<AliAODMCParticle*>(fMCArray->At(mother));\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-//V0______________________________________\r
-//____________________________________________________________________\r
-TParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherV0(AliStack* stack, Int_t label)\r
-{\r
- //\r
- // Finds the first mother among the primary particles of the particle identified by <label>,\r
- // i.e. the primary that "caused" this particle\r
- //\r
- // Taken from AliPWG0Helper class\r
- //\r
-\r
- Int_t nSteps = 0;\r
-\r
- Int_t motherLabel = FindPrimaryMotherLabelV0(stack, label, nSteps);\r
- if (motherLabel < 0)\r
- return 0;\r
-\r
- return stack->Particle(motherLabel);\r
-}\r
-\r
-//____________________________________________________________________\r
-Int_t AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherLabelV0(AliStack* stack, Int_t label, Int_t& nSteps)\r
-{\r
- //\r
- // Finds the first mother among the primary particles of the particle identified by <label>,\r
- // i.e. the primary that "caused" this particle\r
- //\r
- // returns its label\r
- //\r
- // Taken from AliPWG0Helper class\r
- //\r
- nSteps = 0;\r
- const Int_t nPrim = stack->GetNprimary();\r
- \r
- while (label >= nPrim) {\r
-\r
- //printf("Particle %d (pdg %d) is not a primary. Let's check its mother %d\n", label, mother->GetPdgCode(), mother->GetMother(0));\r
-\r
- nSteps++; // 1 level down\r
- \r
- TParticle* particle = stack->Particle(label);\r
- if (!particle) {\r
- \r
- AliDebugGeneral("FindPrimaryMotherLabelV0", AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack.", label));\r
- return -1;\r
- }\r
- \r
- // find mother\r
- if (particle->GetMother(0) < 0) {\r
-\r
- AliDebugGeneral("FindPrimaryMotherLabelV0", AliLog::kError, Form("UNEXPECTED: Could not find mother of secondary particle %d.", label));\r
- return -1;\r
- }\r
- \r
- label = particle->GetMother(0);\r
- }\r
- \r
- return label;\r
-}\r
-\r
-//____________________________________________________________________\r
-AliAODMCParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherAODV0(AliAODMCParticle* startParticle, Int_t& nSteps)\r
-{\r
- //\r
- // Finds the first mother among the primary particles of the particle identified by <label>,\r
- // i.e. the primary that "caused" this particle\r
- //\r
- // Taken from AliPWG0Helper class\r
- //\r
-\r
- nSteps = 0;\r
-\r
- AliAODMCParticle* mcPart = startParticle;\r
-\r
- while (mcPart)\r
- {\r
- \r
- if(mcPart->IsPrimary())\r
- return mcPart;\r
- \r
- Int_t mother = mcPart->GetMother();\r
-\r
- mcPart = dynamic_cast<AliAODMCParticle*>(fMCArray->At(mother));\r
- nSteps++; // 1 level down\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-\r
-//__________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::ProduceArrayTrksESD( AliESDEvent *ESDevent ){\r
- \r
- const Int_t nESDTracks = ESDevent->GetNumberOfTracks();\r
- //Int_t trackmult=0;\r
-\r
-\r
- Int_t multTPC = 0;\r
- \r
- //get multiplicity tpc only track cuts\r
- for(Int_t iT = 0; iT < nESDTracks; iT++) {\r
- \r
- AliESDtrack* esdTrack = ESDevent->GetTrack(iT);\r
- \r
- \r
- if(TMath::Abs(esdTrack->Eta()) > fEtaCut)\r
- continue;\r
- \r
- //only golden track cuts\r
- UInt_t selectDebug = 0;\r
- if (fTrackFilterTPC) {\r
- selectDebug = fTrackFilterTPC->IsSelected(esdTrack);\r
- if (!selectDebug) {\r
- //cout<<"this is not a golden track"<<endl;\r
- continue;\r
- }\r
- }\r
- \r
- multTPC++;\r
- \r
- }\r
-\r
-\r
-\r
- for(Int_t iT = 0; iT < nESDTracks; iT++) {\r
- \r
- AliESDtrack* esdTrack = ESDevent->GetTrack(iT);\r
- \r
- \r
- if(TMath::Abs(esdTrack->Eta()) > fEtaCut)\r
- continue;\r
- \r
- //only golden track cuts\r
- UInt_t selectDebug = 0;\r
- if (fTrackFilterGolden) {\r
- selectDebug = fTrackFilterGolden->IsSelected(esdTrack);\r
- if (!selectDebug) {\r
- //cout<<"this is not a golden track"<<endl;\r
- continue;\r
- }\r
- }\r
- \r
- \r
- //Int_t sharedtpcclusters = esdTrack->GetTPCnclsS();\r
- Short_t ncl = esdTrack->GetTPCsignalN();\r
-\r
-\r
- if(ncl<70)\r
- continue;\r
- Double_t eta = esdTrack->Eta();\r
- Double_t phi = esdTrack->Phi();\r
- Double_t momentum = esdTrack->P();\r
- Float_t dedx = esdTrack->GetTPCsignal();\r
-\r
- //cout<<"magf="<<magf<<endl;\r
-\r
- if(!PhiCut(esdTrack->Pt(), phi, esdTrack->Charge(), magf, cutLow, cutHigh))\r
- continue;\r
-\r
- \r
-\r
-\r
- //TOF\r
- \r
- Bool_t IsTOFout=kFALSE;\r
- if ((esdTrack->GetStatus()&AliESDtrack::kTOFout)==0)\r
- IsTOFout=kTRUE;\r
- Float_t lengthtrack=esdTrack->GetIntegratedLength();\r
- Float_t timeTOF=esdTrack->GetTOFsignal();\r
- Double_t inttime[5]={0,0,0,0,0}; \r
- esdTrack->GetIntegratedTimes(inttime);// Returns the array with integrated times for each particle hypothesis\r
- Float_t beta = -99;\r
- if ( !IsTOFout ){\r
- if ( ( lengthtrack != 0 ) && ( timeTOF != 0) )\r
- beta = inttime[0] / timeTOF;\r
- }\r
-\r
- Short_t pidCode = 0; \r
- \r
- if(fAnalysisMC) {\r
- \r
- const Int_t label = TMath::Abs(esdTrack->GetLabel());\r
- TParticle* mcTrack = fMCStack->Particle(label); \r
- if (mcTrack){\r
- \r
- Int_t pdgCode = mcTrack->GetPdgCode();\r
- pidCode = GetPidCode(pdgCode);\r
- \r
- }\r
- \r
- }\r
-\r
-\r
- if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP\r
- \r
- if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){ \r
- if(momentum<0.6&&momentum>0.4){\r
- hMIPVsEta->Fill(eta,dedx);\r
- pMIPVsEta->Fill(eta,dedx);\r
- }\r
- }\r
- if( dedx > DeDxMIPMax+1 && dedx < 95 ){\r
- if(TMath::Abs(beta-1)<0.1){\r
- hPlateauVsEta->Fill(eta,dedx);\r
- pPlateauVsEta->Fill(eta,dedx); \r
- }\r
- }\r
- }\r
- \r
- \r
- for(Int_t nh = 0; nh < 9; nh++) {\r
- \r
- if( eta > etaHigh[nh]/10.0 || eta < etaLow[nh]/10.0 )\r
- continue;\r
- \r
- \r
- if(fAnalysisMC){\r
- hMcOut[0][nh]->Fill(esdTrack->Pt());\r
- hMcOut[pidCode][nh]->Fill(esdTrack->Pt());\r
- }\r
-\r
- histAllCh[nh]->Fill(momentum, dedx);\r
- if(beta>1){\r
- histPiTof[nh]->Fill(momentum, dedx);\r
- histpPiTof[nh]->Fill(momentum);\r
- }\r
-\r
- if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP\r
- //Fill pion MIP, before calibration\r
- if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){ \r
- hMIPVsPhi[nh]->Fill(phi,dedx);\r
- pMIPVsPhi[nh]->Fill(phi,dedx);\r
- \r
- \r
- hMIPVsNch[nh]->Fill(multTPC,dedx);\r
- pMIPVsNch[nh]->Fill(multTPC,dedx);\r
- \r
- }\r
- \r
- //Fill electrons, before calibration\r
- if( dedx > DeDxMIPMax+1 && dedx < 95 ){\r
- if(TMath::Abs(beta-1)<0.1){\r
- hPlateauVsPhi[nh]->Fill(phi,dedx);\r
- pPlateauVsPhi[nh]->Fill(phi,dedx);\r
- }\r
- }\r
-\r
- }\r
-\r
-\r
- }//end loop over eta intervals\r
-\r
- \r
-\r
- \r
- \r
- }//end of track loop\r
- \r
- \r
-\r
- \r
-}\r
-//__________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::ProduceArrayTrksAOD( AliAODEvent *AODevent ){\r
-\r
-\r
- Int_t nAODTracks = AODevent->GetNumberOfTracks();\r
- Int_t multTPC = 0;\r
- \r
- //get multiplicity tpc only track cuts\r
- for(Int_t iT = 0; iT < nAODTracks; iT++) {\r
- \r
- AliAODTrack* aodTrack = AODevent->GetTrack(iT);\r
- \r
- if(TMath::Abs(aodTrack->Eta()) > fEtaCut)\r
- continue;\r
- \r
-\r
- if (fTrackFilterTPC) {\r
- // TPC only cuts is bit 1\r
- if(!aodTrack->TestFilterBit(1))\r
- continue;\r
- }\r
- \r
- multTPC++;\r
- \r
- }\r
-\r
-\r
- for(Int_t iT = 0; iT < nAODTracks; iT++) {\r
- \r
- AliAODTrack* aodTrack = AODevent->GetTrack(iT);\r
- \r
- if (fTrackFilterGolden) { \r
- // "Global track RAA analysis QM2011 + Chi2ITS<36"; bit 1024\r
- if(!aodTrack->TestFilterBit(1024))\r
- continue;\r
- }\r
- \r
- \r
- if(TMath::Abs(aodTrack->Eta()) > fEtaCut)\r
- continue;\r
- \r
- \r
- Double_t eta = aodTrack->Eta();\r
- Double_t phi = aodTrack->Phi();\r
- Double_t momentum = aodTrack->P();\r
- \r
- \r
- if(!PhiCut(aodTrack->Pt(), phi, aodTrack->Charge(), magf, cutLow, cutHigh))\r
- continue;\r
- \r
-\r
- \r
- AliAODPid* aodPid = aodTrack->GetDetPid();\r
- Short_t ncl = -10;\r
- Float_t dedx = -10;\r
-\r
- //TOF \r
- Float_t beta = -99;\r
-\r
-\r
- if(aodPid) {\r
- ncl = aodPid->GetTPCsignalN();\r
- dedx = aodPid->GetTPCsignal();\r
- //TOF\r
- Bool_t IsTOFout=kFALSE;\r
- Float_t lengthtrack=-999;//in aod we do not have that information, beta must be: beta=inttime/timeTOF \r
- Float_t timeTOF=-999;\r
-\r
- if ((aodTrack->GetStatus()&AliESDtrack::kTOFout)==0)\r
- IsTOFout=kTRUE;\r
- \r
- lengthtrack=-999;//in aod we do not have that information, beta must be: beta=inttime/timeTOF \r
- \r
- timeTOF=aodPid->GetTOFsignal();\r
- \r
- Double_t inttime[5]={0,0,0,0,0}; \r
- aodPid->GetIntegratedTimes(inttime);// Returns the array with integrated times for each particle hypothesis\r
-\r
- \r
- if ( !IsTOFout ){\r
- if ( ( lengthtrack != 0 ) && ( timeTOF != 0) )\r
- beta = inttime[0] / timeTOF;\r
- }\r
- \r
- }\r
-\r
-\r
- if(ncl<70)\r
- continue;\r
-\r
-\r
- Short_t pidCode = 0; \r
- \r
- if(fAnalysisMC) {\r
- \r
- const Int_t label = TMath::Abs(aodTrack->GetLabel());\r
- AliAODMCParticle* mcTrack = dynamic_cast<AliAODMCParticle*>(fMCArray->At(label));\r
- \r
- if (mcTrack){\r
- \r
- Int_t pdgCode = mcTrack->GetPdgCode();\r
- pidCode = GetPidCode(pdgCode);\r
- \r
- }\r
- \r
- }\r
-\r
-\r
-\r
-\r
- //if(momentum>0.6||momentum<0.4)//only p:0.4-0.6 GeV\r
- //continue;\r
- \r
- //etaLow\r
- //etaHigh\r
- if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP\r
- if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){ \r
- if(momentum<0.6&&momentum>0.4){\r
- hMIPVsEta->Fill(eta,dedx);\r
- pMIPVsEta->Fill(eta,dedx);\r
- }\r
- }\r
- if( dedx > DeDxMIPMax+1 && dedx < 95 ){\r
- if(TMath::Abs(beta-1)<0.1){\r
- hPlateauVsEta->Fill(eta,dedx);\r
- pPlateauVsEta->Fill(eta,dedx); \r
- }\r
- }\r
- }\r
- \r
- \r
- for(Int_t nh = 0; nh < 9; nh++) {\r
- \r
- if( eta > etaHigh[nh]/10.0 || eta < etaLow[nh]/10.0 )\r
- continue;\r
- \r
- \r
- if(fAnalysisMC){\r
- hMcOut[0][nh]->Fill(aodTrack->Pt());\r
- hMcOut[pidCode][nh]->Fill(aodTrack->Pt());\r
- }\r
- \r
- histAllCh[nh]->Fill(momentum, dedx);\r
- if(beta>1){\r
- histPiTof[nh]->Fill(momentum, dedx);\r
- histpPiTof[nh]->Fill(momentum);\r
- }\r
-\r
- if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP\r
- //Fill pion MIP, before calibration\r
- if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){ \r
- hMIPVsPhi[nh]->Fill(phi,dedx);\r
- pMIPVsPhi[nh]->Fill(phi,dedx);\r
- \r
- \r
- hMIPVsNch[nh]->Fill(multTPC,dedx);\r
- pMIPVsNch[nh]->Fill(multTPC,dedx);\r
- \r
- }\r
- \r
- //Fill electrons, before calibration\r
- if( dedx > DeDxMIPMax+1 && dedx < 95 ){\r
- if(TMath::Abs(beta-1)<0.1){\r
- hPlateauVsPhi[nh]->Fill(phi,dedx);\r
- pPlateauVsPhi[nh]->Fill(phi,dedx);\r
- }\r
- }\r
-\r
- }\r
-\r
- }//end loop over eta intervals\r
- \r
- \r
-\r
- \r
- \r
- }//end of track loop\r
- \r
- \r
- \r
- \r
- \r
- \r
- \r
-}\r
-//__________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::ProduceArrayV0ESD( AliESDEvent *ESDevent ){\r
- Int_t nv0s = ESDevent->GetNumberOfV0s();\r
- /*\r
- if(nv0s<1){\r
- return;\r
- }*/\r
- \r
- const AliESDVertex *myBestPrimaryVertex = ESDevent->GetPrimaryVertex();\r
- if (!myBestPrimaryVertex) return;\r
- if (!(myBestPrimaryVertex->GetStatus())) return;\r
- Double_t lPrimaryVtxPosition[3];\r
- myBestPrimaryVertex->GetXYZ(lPrimaryVtxPosition);\r
- \r
- Double_t lPrimaryVtxCov[6];\r
- myBestPrimaryVertex->GetCovMatrix(lPrimaryVtxCov);\r
- Double_t lPrimaryVtxChi2 = myBestPrimaryVertex->GetChi2toNDF();\r
- \r
- AliAODVertex* myPrimaryVertex = new AliAODVertex(lPrimaryVtxPosition, lPrimaryVtxCov, lPrimaryVtxChi2, NULL, -1, AliAODVertex::kPrimary);\r
-\r
-\r
- \r
- //\r
- // LOOP OVER V0s, K0s, L, AL\r
- //\r
- \r
- \r
- for (Int_t iV0 = 0; iV0 < nv0s; iV0++) {\r
- \r
- // This is the begining of the V0 loop \r
- AliESDv0 *esdV0 = ESDevent->GetV0(iV0);\r
- if (!esdV0) continue;\r
- \r
- //check onfly status\r
- if(esdV0->GetOnFlyStatus()!=0)\r
- continue;\r
-\r
-\r
- // AliESDTrack (V0 Daughters)\r
- UInt_t lKeyPos = (UInt_t)TMath::Abs(esdV0->GetPindex());\r
- UInt_t lKeyNeg = (UInt_t)TMath::Abs(esdV0->GetNindex());\r
- \r
- AliESDtrack *pTrack = ESDevent->GetTrack(lKeyPos);\r
- AliESDtrack *nTrack = ESDevent->GetTrack(lKeyNeg);\r
- if (!pTrack || !nTrack) {\r
- Printf("ERROR: Could not retreive one of the daughter track");\r
- continue;\r
- }\r
- \r
- // Remove like-sign\r
- if (pTrack->GetSign() == nTrack->GetSign()) {\r
- //cout<< "like sign, continue"<< endl;\r
- continue;\r
- } \r
- \r
- // Eta cut on decay products\r
- if(TMath::Abs(pTrack->Eta()) > fEtaCut || TMath::Abs(nTrack->Eta()) > fEtaCut)\r
- continue;\r
- \r
- \r
- // Check if switch does anything!\r
- Bool_t isSwitched = kFALSE;\r
- if (pTrack->GetSign() < 0) { // switch\r
- \r
- isSwitched = kTRUE;\r
- AliESDtrack* helpTrack = nTrack;\r
- nTrack = pTrack;\r
- pTrack = helpTrack;\r
- } \r
- \r
- //Double_t lV0Position[3];\r
- //esdV0->GetXYZ(lV0Position[0], lV0Position[1], lV0Position[2]);\r
- \r
-\r
- AliKFVertex primaryVtxKF( *myPrimaryVertex );\r
- AliKFParticle::SetField(ESDevent->GetMagneticField());\r
- \r
- // Also implement switch here!!!!!!\r
- AliKFParticle* negEKF = 0; // e-\r
- AliKFParticle* posEKF = 0; // e+\r
- AliKFParticle* negPiKF = 0; // pi -\r
- AliKFParticle* posPiKF = 0; // pi +\r
- AliKFParticle* posPKF = 0; // p\r
- AliKFParticle* negAPKF = 0; // p-bar\r
- \r
- if(!isSwitched) {\r
- negEKF = new AliKFParticle( *(esdV0->GetParamN()) , 11);\r
- posEKF = new AliKFParticle( *(esdV0->GetParamP()) ,-11);\r
- negPiKF = new AliKFParticle( *(esdV0->GetParamN()) ,-211);\r
- posPiKF = new AliKFParticle( *(esdV0->GetParamP()) , 211);\r
- posPKF = new AliKFParticle( *(esdV0->GetParamP()) , 2212);\r
- negAPKF = new AliKFParticle( *(esdV0->GetParamN()) ,-2212);\r
- } else { // switch + and - \r
- negEKF = new AliKFParticle( *(esdV0->GetParamP()) , 11);\r
- posEKF = new AliKFParticle( *(esdV0->GetParamN()) ,-11);\r
- negPiKF = new AliKFParticle( *(esdV0->GetParamP()) ,-211);\r
- posPiKF = new AliKFParticle( *(esdV0->GetParamN()) , 211);\r
- posPKF = new AliKFParticle( *(esdV0->GetParamN()) , 2212);\r
- negAPKF = new AliKFParticle( *(esdV0->GetParamP()) ,-2212);\r
- }\r
- \r
- AliKFParticle v0GKF; // Gamma e.g. from pi0\r
- v0GKF+=(*negEKF);\r
- v0GKF+=(*posEKF);\r
- v0GKF.SetProductionVertex(primaryVtxKF);\r
- \r
- AliKFParticle v0K0sKF; // K0 short\r
- v0K0sKF+=(*negPiKF);\r
- v0K0sKF+=(*posPiKF);\r
- v0K0sKF.SetProductionVertex(primaryVtxKF);\r
- \r
- AliKFParticle v0LambdaKF; // Lambda\r
- v0LambdaKF+=(*negPiKF);\r
- v0LambdaKF+=(*posPKF); \r
- v0LambdaKF.SetProductionVertex(primaryVtxKF);\r
- \r
- AliKFParticle v0AntiLambdaKF; // Lambda-bar\r
- v0AntiLambdaKF+=(*posPiKF);\r
- v0AntiLambdaKF+=(*negAPKF);\r
- v0AntiLambdaKF.SetProductionVertex(primaryVtxKF);\r
- \r
- Double_t dmassG = v0GKF.GetMass();\r
- Double_t dmassK = v0K0sKF.GetMass()-0.498;\r
- Double_t dmassL = v0LambdaKF.GetMass()-1.116;\r
- Double_t dmassAL = v0AntiLambdaKF.GetMass()-1.116;\r
-\r
-\r
- for( Int_t case_v0 = 0; case_v0 < 2; ++case_v0 ){\r
-\r
-\r
- switch(case_v0){\r
- case 0:{ \r
- \r
- Bool_t fillPos = kFALSE;\r
- Bool_t fillNeg = kFALSE;\r
- \r
- if(dmassG < 0.1)\r
- continue;\r
- \r
- if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01){\r
- continue;\r
- }\r
- \r
- if(dmassL<0.01){\r
- fillPos = kTRUE;\r
- }\r
- if(dmassAL<0.01) {\r
- if(fillPos)\r
- continue;\r
- fillNeg = kTRUE;\r
- }\r
- \r
- if(dmassK<0.01) {\r
- if(fillPos||fillNeg)\r
- continue;\r
- fillPos = kTRUE;\r
- fillNeg = kTRUE;\r
- }\r
- \r
- \r
- for(Int_t j = 0; j < 2; j++) {\r
- \r
- AliESDtrack* track = 0;\r
- \r
- if(j==0) {\r
- \r
- if(fillNeg)\r
- track = nTrack;\r
- else\r
- continue;\r
- } else {\r
- \r
- if(fillPos)\r
- track = pTrack;\r
- else\r
- continue;\r
- }\r
- \r
- if(track->GetTPCsignalN()<=70)continue;\r
- Double_t phi = track->Phi();\r
- \r
- if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))\r
- continue;\r
- \r
- \r
- //if(!PhiCut(pt, phi, charge, magf, cutLow, cutHigh, hPhi))\r
- // continue;\r
- \r
- Double_t eta = track->Eta();\r
- Double_t momentum = track->Pt();\r
- Double_t dedx = track->GetTPCsignal();\r
- \r
- if(fillPos&&fillNeg){\r
- \r
- \r
- if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){ \r
- if(momentum<0.6&&momentum>0.4){\r
- hMIPVsEtaV0s->Fill(eta,dedx);\r
- pMIPVsEtaV0s->Fill(eta,dedx);\r
- }\r
- }\r
- \r
- \r
- }\r
- \r
- for(Int_t nh = 0; nh < nHists; nh++) {\r
- \r
- \r
- \r
- if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )\r
- continue;\r
- \r
- if(fillPos&&fillNeg){\r
- \r
- histPiV0[nh]->Fill(momentum, dedx); \r
- histpPiV0[nh]->Fill(momentum);\r
-\r
- }\r
- else{\r
- \r
- histPV0[nh]->Fill(momentum, dedx);\r
- histpPV0[nh]->Fill(momentum);\r
-\r
- }\r
- \r
- }\r
- \r
- }//end loop over two tracks\r
-\r
- };\r
- break;\r
-\r
- case 1:{//gammas \r
- \r
- Bool_t fillPos = kFALSE;\r
- Bool_t fillNeg = kFALSE;\r
- \r
-\r
-\r
- if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01) {\r
- if(dmassG<0.01 && dmassG>0.0001) {\r
- \r
-\r
- if( TMath::Abs(nTrack->GetTPCsignal() - 85.0) < 5)\r
- fillPos = kTRUE;\r
- if( TMath::Abs(pTrack->GetTPCsignal() - 85.0) < 5)\r
- fillNeg = kTRUE;\r
- \r
- } else {\r
- continue;\r
- }\r
- }\r
-\r
- //cout<<"fillPos="<<fillPos<<endl;\r
-\r
- if(fillPos == kTRUE && fillNeg == kTRUE) \r
- continue;\r
- \r
- \r
- AliESDtrack* track = 0;\r
- if(fillNeg)\r
- track = nTrack;\r
- else if(fillPos)\r
- track = pTrack;\r
- else\r
- continue;\r
-\r
- Double_t dedx = track->GetTPCsignal();\r
- Double_t eta = track->Eta();\r
- Double_t phi = track->Phi();\r
- Double_t momentum = track->P();\r
-\r
- if(track->GetTPCsignalN()<=70)continue;\r
-\r
- if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))\r
- continue;\r
- \r
- for(Int_t nh = 0; nh < nHists; nh++) {\r
- \r
- if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )\r
- continue;\r
-\r
- histEV0[nh]->Fill(momentum, dedx);\r
-\r
- }\r
- \r
- };\r
- break;\r
- \r
- \r
- }//end switch\r
- \r
- }//end loop over case V0\r
-\r
- \r
- // clean up loop over v0\r
- \r
- delete negPiKF;\r
- delete posPiKF;\r
- delete posPKF;\r
- delete negAPKF;\r
- \r
- \r
- \r
- }\r
- \r
- \r
- delete myPrimaryVertex;\r
- \r
- \r
-}\r
-//__________________________________________________________________________\r
-void AliAnalysisTaskQAHighPtDeDx::ProduceArrayV0AOD( AliAODEvent *AODevent ){\r
- Int_t nv0s = AODevent->GetNumberOfV0s();\r
- /*\r
- if(nv0s<1){\r
- return;\r
- }*/\r
- \r
- AliAODVertex *myBestPrimaryVertex = AODevent->GetPrimaryVertex();\r
- if (!myBestPrimaryVertex) return;\r
- \r
-\r
- \r
- // ################################\r
- // #### BEGINNING OF V0 CODE ######\r
- // ################################\r
- // This is the begining of the V0 loop \r
- for (Int_t iV0 = 0; iV0 < nv0s; iV0++) {\r
- AliAODv0 *aodV0 = AODevent->GetV0(iV0);\r
- if (!aodV0) continue;\r
- \r
- \r
- //check onfly status\r
- if(aodV0->GetOnFlyStatus()!=0)\r
- continue;\r
-\r
- // AliAODTrack (V0 Daughters)\r
- AliAODVertex* vertex = aodV0->GetSecondaryVtx();\r
- if (!vertex) {\r
- Printf("ERROR: Could not retrieve vertex");\r
- continue;\r
- }\r
- \r
- AliAODTrack *pTrack = (AliAODTrack*)vertex->GetDaughter(0);\r
- AliAODTrack *nTrack = (AliAODTrack*)vertex->GetDaughter(1);\r
- if (!pTrack || !nTrack) {\r
- Printf("ERROR: Could not retrieve one of the daughter track");\r
- continue;\r
- }\r
- \r
- // Remove like-sign\r
- if (pTrack->Charge() == nTrack->Charge()) {\r
- //cout<< "like sign, continue"<< endl;\r
- continue;\r
- } \r
- \r
- // Make sure charge ordering is ok\r
- if (pTrack->Charge() < 0) {\r
- AliAODTrack* helpTrack = pTrack;\r
- pTrack = nTrack;\r
- nTrack = helpTrack;\r
- } \r
- \r
- // Eta cut on decay products\r
- if(TMath::Abs(pTrack->Eta()) > fEtaCut || TMath::Abs(nTrack->Eta()) > fEtaCut)\r
- continue;\r
- \r
- \r
- Double_t dmassG = aodV0->InvMass2Prongs(0,1,11,11);\r
- Double_t dmassK = aodV0->MassK0Short()-0.498;\r
- Double_t dmassL = aodV0->MassLambda()-1.116;\r
- Double_t dmassAL = aodV0->MassAntiLambda()-1.116;\r
- \r
- for( Int_t case_v0 = 0; case_v0 < 2; ++case_v0 ){\r
- \r
- \r
- switch(case_v0){\r
- case 0:{ \r
- Bool_t fillPos = kFALSE;\r
- Bool_t fillNeg = kFALSE;\r
- \r
- \r
- if(dmassG < 0.1)\r
- continue;\r
- \r
- if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01){\r
- continue;\r
- }\r
- \r
- if(dmassL<0.01){\r
- fillPos = kTRUE;\r
- }\r
- if(dmassAL<0.01) {\r
- if(fillPos)\r
- continue;\r
- fillNeg = kTRUE;\r
- }\r
- \r
- if(dmassK<0.01) {\r
- if(fillPos||fillNeg)\r
- continue;\r
- fillPos = kTRUE;\r
- fillNeg = kTRUE;\r
- }\r
- \r
- \r
- \r
- for(Int_t j = 0; j < 2; j++) {\r
- \r
- AliAODTrack* track = 0;\r
- \r
- if(j==0) {\r
- \r
- if(fillNeg)\r
- track = nTrack;\r
- else\r
- continue;\r
- } else {\r
- \r
- if(fillPos)\r
- track = pTrack;\r
- else\r
- continue;\r
- }\r
- \r
- if(track->GetTPCsignalN()<=70)continue;\r
- \r
- Double_t phi = track->Phi();\r
- \r
- if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))\r
- continue;\r
- \r
- \r
- //if(!PhiCut(pt, phi, charge, magf, cutLow, cutHigh, hPhi))\r
- // continue;\r
- \r
- Double_t eta = track->Eta();\r
- Double_t momentum = track->Pt();\r
- Double_t dedx = track->GetTPCsignal();\r
- \r
- if(fillPos&&fillNeg){\r
- \r
- \r
- if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){ \r
- if(momentum<0.6&&momentum>0.4){\r
- hMIPVsEtaV0s->Fill(eta,dedx);\r
- pMIPVsEtaV0s->Fill(eta,dedx);\r
- }\r
- }\r
- \r
- \r
- }\r
- \r
- for(Int_t nh = 0; nh < nHists; nh++) {\r
- \r
- \r
- \r
- if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )\r
- continue;\r
- \r
- if(fillPos&&fillNeg){\r
- \r
- histPiV0[nh]->Fill(momentum, dedx); \r
- histpPiV0[nh]->Fill(momentum); \r
-\r
- }\r
- else{\r
- \r
- histPV0[nh]->Fill(momentum, dedx);\r
- histpPV0[nh]->Fill(momentum);\r
-\r
- }\r
- \r
- }\r
- \r
-\r
- }//end loop over two tracks\r
- };\r
- break;\r
- \r
- case 1:{//gammas \r
- \r
- Bool_t fillPos = kFALSE;\r
- Bool_t fillNeg = kFALSE;\r
- \r
- if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01) {\r
- if(dmassG<0.01 && dmassG>0.0001) {\r
- \r
- if( TMath::Abs(nTrack->GetTPCsignal() - 85.0) < 5)\r
- fillPos = kTRUE;\r
- if( TMath::Abs(pTrack->GetTPCsignal() - 85.0) < 5)\r
- fillNeg = kTRUE;\r
- \r
- } else {\r
- continue;\r
- }\r
- }\r
-\r
- \r
- if(fillPos == kTRUE && fillNeg == kTRUE) \r
- continue;\r
- \r
- \r
- AliAODTrack* track = 0;\r
- if(fillNeg)\r
- track = nTrack;\r
- else if(fillPos)\r
- track = pTrack;\r
- else\r
- continue;\r
-\r
- Double_t dedx = track->GetTPCsignal();\r
- Double_t eta = track->Eta();\r
- Double_t phi = track->Phi();\r
- Double_t momentum = track->P();\r
-\r
- if(track->GetTPCsignalN()<=70)continue;\r
-\r
- if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))\r
- continue;\r
- \r
- for(Int_t nh = 0; nh < nHists; nh++) {\r
- \r
- if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )\r
- continue;\r
-\r
- histEV0[nh]->Fill(momentum, dedx);\r
-\r
- }\r
- \r
- };\r
- break;\r
-\r
-\r
- }//end switch\r
- }//end loop over V0s cases\r
- \r
- }//end loop over v0's\r
- \r
- \r
- \r
- \r
-}\r
-Bool_t AliAnalysisTaskQAHighPtDeDx::PhiCut(Double_t pt, Double_t phi, Double_t q, Float_t mag, TF1* phiCutLow, TF1* phiCutHigh)\r
-{\r
- if(pt < 2.0)\r
- return kTRUE;\r
- \r
- //Double_t phi = track->Phi();\r
- if(mag < 0) // for negatve polarity field\r
- phi = TMath::TwoPi() - phi;\r
- if(q < 0) // for negatve charge\r
- phi = TMath::TwoPi()-phi;\r
- \r
- phi += TMath::Pi()/18.0; // to center gap in the middle\r
- phi = fmod(phi, TMath::Pi()/9.0);\r
- \r
- if(phi<phiCutHigh->Eval(pt) \r
- && phi>phiCutLow->Eval(pt))\r
- return kFALSE; // reject track\r
-\r
- hPhi->Fill(pt, phi);\r
-\r
- return kTRUE;\r
-}\r
+ /*************************************************************************
+* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. * **************************************************************************/
+
+
+#include "AliAnalysisTaskQAHighPtDeDx.h"
+
+// ROOT includes
+#include <TList.h>
+#include <TTree.h>
+#include <TMath.h>
+#include <TH1.h>
+#include <TF1.h>
+#include <TProfile.h>
+#include <TParticle.h>
+#include <TFile.h>
+
+// AliRoot includes
+#include <AliAnalysisManager.h>
+#include <AliAnalysisFilter.h>
+#include <AliESDInputHandler.h>
+#include <AliESDEvent.h>
+#include <AliESDVertex.h>
+#include <AliLog.h>
+#include <AliExternalTrackParam.h>
+#include <AliESDtrackCuts.h>
+#include <AliESDVZERO.h>
+#include <AliAODVZERO.h>
+
+#include <AliMCEventHandler.h>
+#include <AliMCEvent.h>
+#include <AliStack.h>
+
+#include <TTreeStream.h>
+
+#include <AliHeader.h>
+#include <AliGenPythiaEventHeader.h>
+#include <AliGenDPMjetEventHeader.h>
+
+#include "AliCentrality.h"
+#include <AliESDv0.h>
+#include <AliKFVertex.h>
+#include <AliAODVertex.h>
+
+#include <AliAODTrack.h>
+#include <AliAODPid.h>
+#include <AliAODMCHeader.h>
+
+
+// STL includes
+#include <iostream>
+using namespace std;
+
+
+//
+// Responsible:
+// Antonio Ortiz (Lund)
+// Peter Christiansen (Lund)
+//
+
+
+
+
+
+
+
+
+const Double_t AliAnalysisTaskQAHighPtDeDx::fgkClight = 2.99792458e-2;
+Float_t magf = -1;
+TF1* cutLow = new TF1("StandardPhiCutLow", "0.1/x/x+pi/18.0-0.025", 0, 50);
+TF1* cutHigh = new TF1("StandardPhiCutHigh", "0.12/x+pi/18.0+0.035", 0, 50);
+Double_t DeDxMIPMin = 30;
+Double_t DeDxMIPMax = 65;
+const Int_t nHists = 9;
+Float_t centralityGlobal = -10;
+Int_t etaLow[nHists] = {-8, -8, -6, -4, -2, 0, 2, 4, 6};
+Int_t etaHigh[nHists] = { 8, -6, -4, -2, 0, 2, 4, 6, 8};
+
+Int_t nDeltaPiBins = 80;
+Double_t deltaPiLow = 20;
+Double_t deltaPiHigh = 100;
+const Char_t *Pid[7]={"Ch","Pion","Kaon","Proton","Electron","Muon","Oher"};
+ClassImp(AliAnalysisTaskQAHighPtDeDx)
+//_____________________________________________________________________________
+//AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx(const char *name):
+AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx():
+ AliAnalysisTaskSE(),
+ fESD(0x0),
+ fAOD(0x0),
+ fMC(0x0),
+ fMCStack(0x0),
+ fMCArray(0x0),
+ fTrackFilterGolden(0x0),
+ fTrackFilterTPC(0x0),
+ fCentEst("V0M"),
+ fAnalysisType("ESD"),
+ fAnalysisMC(kFALSE),
+ fAnalysisPbPb(kFALSE),
+ ftrigBit(0x0),
+ fRandom(0x0),
+ fPileUpRej(kFALSE),
+ fVtxCut(10.0),
+ fEtaCut(0.9),
+ fMinCent(0.0),
+ fMaxCent(100.0),
+ fStoreMcIn(kFALSE),//
+ fMcProcessType(-999),
+ fTriggeredEventMB(-999),
+ fVtxStatus(-999),
+ fZvtx(-999),
+ fZvtxMC(-999),
+ fRun(-999),
+ fEventId(-999),
+ fListOfObjects(0),
+ fEvents(0x0), fVtx(0x0), fVtxMC(0x0), fVtxBeforeCuts(0x0), fVtxAfterCuts(0x0),
+ fn1(0x0),
+ fcent(0x0),
+ hMIPVsEta(0x0),
+ pMIPVsEta(0x0),
+ hMIPVsEtaV0s(0x0),
+ pMIPVsEtaV0s(0x0),
+ hPlateauVsEta(0x0),
+ pPlateauVsEta(0x0),
+ hPhi(0x0)
+
+
+{
+ //default constructor
+}
+
+
+AliAnalysisTaskQAHighPtDeDx::AliAnalysisTaskQAHighPtDeDx(const char *name):
+ AliAnalysisTaskSE(name),
+ fESD(0x0),
+ fAOD(0x0),
+ fMC(0x0),
+ fMCStack(0x0),
+ fMCArray(0x0),
+ fTrackFilterGolden(0x0),
+ fTrackFilterTPC(0x0),
+ fCentEst("V0M"),
+ fAnalysisType("ESD"),
+ fAnalysisMC(kFALSE),
+ fAnalysisPbPb(kFALSE),
+ ftrigBit(0x0),
+ fRandom(0x0),
+ fPileUpRej(kFALSE),
+ fVtxCut(10.0),
+ fEtaCut(0.9),
+ fMinCent(0.0),
+ fMaxCent(100.0),
+ fStoreMcIn(kFALSE),//
+ fMcProcessType(-999),
+ fTriggeredEventMB(-999),
+ fVtxStatus(-999),
+ fZvtx(-999),
+ fZvtxMC(-999),
+ fRun(-999),
+ fEventId(-999),
+ fListOfObjects(0),
+ fEvents(0x0), fVtx(0x0), fVtxMC(0x0), fVtxBeforeCuts(0x0), fVtxAfterCuts(0x0),
+ fn1(0x0),
+ fcent(0x0),
+ hMIPVsEta(0x0),
+ pMIPVsEta(0x0),
+ hMIPVsEtaV0s(0x0),
+ pMIPVsEtaV0s(0x0),
+ hPlateauVsEta(0x0),
+ pPlateauVsEta(0x0),
+ hPhi(0x0)
+
+
+{
+ // Default constructor (should not be used)
+ for(Int_t i=0;i<9;++i){
+
+ hMIPVsNch[i]=0;//TH2D, MIP vs Nch for different eta intervals
+ pMIPVsNch[i]=0;//TProfile, MIP vs Nch for different eta intervals
+ hMIPVsPhi[i]=0;//TH2D, MIP vs phi for different eta intervals
+ pMIPVsPhi[i]=0;//TProfile, MIP vs phi for different eta intervals
+ hPlateauVsPhi[i]=0;//TH2D, dE/dx vs Phi, electrons 0.4<p<0.6 GeV/c
+ pPlateauVsPhi[i]=0;//TProfile, dE/dx vs Phi, electrons 0.4<p<0.6 GeV/c
+ histPiV0[i]=0;//TH2D, dE/dx vs p, pi id by V0s
+ histpPiV0[i]=0;//TH1D, pi id by V0s
+ histPV0[i]=0;// TH2D, dE/dx vs p, p id by V0s
+ histpPV0[i]=0;// TH1D, p id by V0s
+ histAllCh[i]=0;//TH2D, dE/dx vs p for all charged particles
+ histPiTof[i]=0;//TH2D, dE/dx vs p for a "clean" sample of pions, beta>1
+ histpPiTof[i]=0;//TH1D, for a "clean" sample of pions, beta>1
+ histEV0[i]=0;
+
+ for(Int_t pid=0;pid<7;++pid){
+ hMcIn[pid][i]=0;
+ hMcOut[pid][i]=0;
+ }
+
+ }
+ DefineOutput(1, TList::Class());//esto es nuevo
+}
+
+
+
+
+AliAnalysisTaskQAHighPtDeDx::~AliAnalysisTaskQAHighPtDeDx() {
+ //
+ // Destructor
+ //
+
+}
+
+
+
+
+
+
+
+
+//______________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::UserCreateOutputObjects()
+{
+ // This method is called once per worker node
+ // Here we define the output: histograms and debug tree if requested
+ // We also create the random generator here so it might get different seeds...
+ fRandom = new TRandom(0); // 0 means random seed
+
+
+
+ //OpenFile(1);
+ fListOfObjects = new TList();
+ fListOfObjects->SetOwner();
+
+
+
+
+ //
+ // Histograms
+ //
+ fEvents = new TH1I("fEvents","Number of analyzed events; Events; Counts", 3, 0, 3);
+ fListOfObjects->Add(fEvents);
+
+ fn1=new TH1F("fn1","fn1",11,-1,10);
+ fListOfObjects->Add(fn1);
+
+ fcent=new TH1F("fcent","fcent",104,-2,102);
+ fListOfObjects->Add(fcent);
+
+ fVtx = new TH1I("fVtx","Vtx info (0=no, 1=yes); Vtx; Counts", 2, -0.5, 1.5);
+ fListOfObjects->Add(fVtx);
+
+ fVtxBeforeCuts = new TH1F("fVtxBeforeCuts", "Vtx distribution (before cuts); Vtx z [cm]; Counts", 120, -30, 30);
+ fListOfObjects->Add(fVtxBeforeCuts);
+
+ fVtxAfterCuts = new TH1F("fVtxAfterCuts", "Vtx distribution (before cuts); Vtx z [cm]; Counts", 120, -30, 30);
+ fListOfObjects->Add(fVtxAfterCuts);
+
+
+ const Int_t nPtBinsV0s = 25;
+ Double_t ptBinsV0s[nPtBinsV0s+1] = { 0.0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 ,
+ 1.2 , 1.4 , 1.6 , 1.8 , 2.0 , 2.5 , 3.0 , 3.5 , 4.0 , 5.0 , 7.0 ,
+ 9.0 , 12.0, 15.0, 20.0 };
+
+
+
+
+ const Char_t* ending[nHists] = {"", "86", "64", "42", "20", "02", "24", "46", "68"};
+
+ const Char_t* LatexEta[nHists] = {
+ "|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0",
+ "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"
+ };
+ hPhi = new TH2D("histPhi", "pt; #phi'", nPtBinsV0s, ptBinsV0s, 90, -0.05, 0.4);
+ //dE/dx vs phi, pions at the MIP
+ fListOfObjects->Add(hPhi);
+
+
+
+
+ Int_t nPhiBins = 36;
+
+ for(Int_t i = 0; i < nHists; i++) {
+
+
+ hMIPVsPhi[i] = new TH2D(Form("hMIPVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx MIP",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),
+ DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);
+ hMIPVsPhi[i]->Sumw2();
+
+ pMIPVsPhi[i] = new TProfile(Form("pMIPVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx MIP",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),
+ DeDxMIPMin, DeDxMIPMax);
+ pMIPVsPhi[i]->SetMarkerStyle(20);
+ pMIPVsPhi[i]->SetMarkerColor(1);
+ pMIPVsPhi[i]->SetLineColor(1);
+ pMIPVsPhi[i]->Sumw2();
+
+ fListOfObjects->Add(hMIPVsPhi[i]);
+ fListOfObjects->Add(pMIPVsPhi[i]);
+
+ hPlateauVsPhi[i] = new TH2D(Form("hPlateauVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx Plateau",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),
+ 95-DeDxMIPMax, DeDxMIPMax, 95);
+ hPlateauVsPhi[i]->Sumw2();
+
+ pPlateauVsPhi[i] = new TProfile(Form("pPlateauVsPhi%s", ending[i]), Form("%s; #phi (rad); dE/dx Plateau",LatexEta[i]), nPhiBins, 0, 2*TMath::Pi(),
+ DeDxMIPMax, 95);
+ pPlateauVsPhi[i]->SetMarkerStyle(20);
+ pPlateauVsPhi[i]->SetMarkerColor(1);
+ pPlateauVsPhi[i]->SetLineColor(1);
+ pPlateauVsPhi[i]->Sumw2();
+
+ fListOfObjects->Add(hPlateauVsPhi[i]);
+ fListOfObjects->Add(pPlateauVsPhi[i]);
+
+
+ hMIPVsNch[i] = new TH2D(Form("hMIPVsNch%s", ending[i]), Form("%s; TPC track mult. |#eta|<0.8; dE/dx MIP",LatexEta[i]), 400, 1, 2001,
+ DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);
+ hMIPVsNch[i]->Sumw2();
+
+ pMIPVsNch[i] = new TProfile(Form("pMIPVsNch%s", ending[i]), Form("%s; TPC track mult. |#eta|<0.8; dE/dx MIP",LatexEta[i]), 400, 1, 2001, DeDxMIPMin, DeDxMIPMax);
+ pMIPVsNch[i]->SetMarkerStyle(20);
+ pMIPVsNch[i]->SetMarkerColor(1);
+ pMIPVsNch[i]->SetLineColor(1);
+ pMIPVsNch[i]->Sumw2();
+
+ fListOfObjects->Add(hMIPVsNch[i]);
+ fListOfObjects->Add(pMIPVsNch[i]);
+
+ //two dimmesional distributions dE/dx vs p for secondary pions
+ histPiV0[i] = new TH2D(Form("histPiV0%s", ending[i]), "Pions id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);
+ histPiV0[i]->Sumw2();
+ fListOfObjects->Add(histPiV0[i]);
+
+ histpPiV0[i] = new TH1D(Form("histPiV01D%s", ending[i]), "Pions id by V0; #it{p} (GeV/#it{c}); counts", 200, 0, 20);
+ histpPiV0[i]->Sumw2();
+ fListOfObjects->Add(histpPiV0[i]);
+
+ //two dimmesional distributions dE/dx vs p for secondary protons
+ histPV0[i] = new TH2D(Form("histPV0%s", ending[i]), "Protons id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);
+ histPV0[i]->Sumw2();
+ fListOfObjects->Add(histPV0[i]);
+
+ histpPV0[i] = new TH1D(Form("histPV01D%s", ending[i]), "Protons id by V0; #it{p} (GeV/#it{c}); counts", 200, 0, 20);
+ histpPV0[i]->Sumw2();
+ fListOfObjects->Add(histpPV0[i]);
+
+ //two dimmesional distributions dE/dx vs p for primary pions
+ histPiTof[i] = new TH2D(Form("histPiTof%s", ending[i]), "all charged", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);
+ histPiTof[i]->Sumw2();
+
+ histpPiTof[i] = new TH1D(Form("histPiTof1D%s", ending[i]), "Protons id by V0; #it{p} (GeV/#it{c}); counts", 200, 0, 20);
+ histpPiTof[i]->Sumw2();
+ fListOfObjects->Add(histpPiTof[i]);
+
+
+ histAllCh[i] = new TH2D(Form("histAllCh%s", ending[i]), "Pions id by TOF", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);
+ histAllCh[i]->Sumw2();
+
+ fListOfObjects->Add(histPiTof[i]);
+ fListOfObjects->Add(histAllCh[i]);
+
+ histEV0[i] = new TH2D(Form("histEV0%s", ending[i]), "Electrons id by V0", nPtBinsV0s, ptBinsV0s, nDeltaPiBins, deltaPiLow, deltaPiHigh);
+ histEV0[i]->Sumw2();
+ fListOfObjects->Add(histEV0[i]);
+
+
+
+ }
+
+
+ hMIPVsEta = new TH2D("hMIPVsEta","; #eta; dE/dx_{MIP, primary tracks}",16,-0.8,0.8,DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);
+ pMIPVsEta = new TProfile("pMIPVsEta","; #eta; #LT dE/dx #GT_{MIP, primary tracks}",16,-0.8,0.8, DeDxMIPMin, DeDxMIPMax);
+ hMIPVsEtaV0s = new TH2D("hMIPVsEtaV0s","; #eta; dE/dx_{MIP, secondary tracks}",16,-0.8,0.8,DeDxMIPMax-DeDxMIPMin, DeDxMIPMin, DeDxMIPMax);
+ pMIPVsEtaV0s = new TProfile("pMIPVsEtaV0s","; #eta; #LT dE/dx #GT_{MIP, secondary tracks}",16,-0.8,0.8,DeDxMIPMin, DeDxMIPMax);
+
+ hPlateauVsEta = new TH2D("hPlateauVsEta","; #eta; dE/dx_{Plateau, primary tracks}",16,-0.8,0.8,95-DeDxMIPMax, DeDxMIPMax, 95);
+ pPlateauVsEta = new TProfile("pPlateauVsEta","; #eta; #LT dE/dx #GT_{Plateau, primary tracks}",16,-0.8,0.8, DeDxMIPMax, 95);
+
+ fListOfObjects->Add(hMIPVsEta);
+ fListOfObjects->Add(pMIPVsEta);
+ fListOfObjects->Add(hMIPVsEtaV0s);
+ fListOfObjects->Add(pMIPVsEtaV0s);
+ fListOfObjects->Add(hPlateauVsEta);
+ fListOfObjects->Add(pPlateauVsEta);
+
+
+
+
+
+
+ if (fAnalysisMC) {
+ for(Int_t i = 0; i < nHists; i++) {
+ for(Int_t pid = 0; pid < 7; pid++) {
+
+ hMcIn[pid][i] = new TH1D(Form("hIn%s%s", Pid[pid],ending[i]), Form("MC in (pid %s)", Pid[pid]),
+ nPtBinsV0s, ptBinsV0s);
+ fListOfObjects->Add(hMcIn[pid][i]);
+
+ hMcOut[pid][i] = new TH1D(Form("hMcOut%s%s", Pid[pid],ending[i]), Form("MC out (pid %s)", Pid[pid]),
+ nPtBinsV0s, ptBinsV0s);
+ fListOfObjects->Add(hMcOut[pid][i]);
+
+
+ }
+ }
+
+ fVtxMC = new TH1F("fVtxMC","mc vtx", 120, -30, 30);
+ fListOfObjects->Add(fVtxMC);
+
+ }
+
+ // Post output data.
+ PostData(1, fListOfObjects);
+}
+
+//______________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::UserExec(Option_t *)
+{
+ // Main loop
+
+ //
+ // First we make sure that we have valid input(s)!
+ //
+
+
+
+ AliVEvent *event = InputEvent();
+ if (!event) {
+ Error("UserExec", "Could not retrieve event");
+ return;
+ }
+
+
+
+ if (fAnalysisType == "ESD"){
+ fESD = dynamic_cast<AliESDEvent*>(event);
+ if(!fESD){
+ Printf("%s:%d ESDEvent not found in Input Manager",(char*)__FILE__,__LINE__);
+ this->Dump();
+ return;
+ }
+ } else {
+ fAOD = dynamic_cast<AliAODEvent*>(event);
+ if(!fAOD){
+ Printf("%s:%d AODEvent not found in Input Manager",(char*)__FILE__,__LINE__);
+ this->Dump();
+ return;
+ }
+ }
+
+
+
+ if (fAnalysisMC) {
+
+ if (fAnalysisType == "ESD"){
+ fMC = dynamic_cast<AliMCEvent*>(MCEvent());
+ if(!fMC){
+ Printf("%s:%d MCEvent not found in Input Manager",(char*)__FILE__,__LINE__);
+ this->Dump();
+ return;
+ }
+
+ fMCStack = fMC->Stack();
+
+ if(!fMCStack){
+ Printf("%s:%d MCStack not found in Input Manager",(char*)__FILE__,__LINE__);
+ this->Dump();
+ return;
+ }
+ } else { // AOD
+
+ fMC = dynamic_cast<AliMCEvent*>(MCEvent());
+ if(fMC)
+ fMC->Dump();
+
+ fMCArray = (TClonesArray*)fAOD->FindListObject("mcparticles");
+ if(!fMCArray){
+ Printf("%s:%d AOD MC array not found in Input Manager",(char*)__FILE__,__LINE__);
+ this->Dump();
+ return;
+ }
+ }
+ }
+
+
+ // Get trigger decision
+ fTriggeredEventMB = 0; //init
+
+ fn1->Fill(0);
+
+ if(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))
+ ->IsEventSelected() & ftrigBit ){
+ fTriggeredEventMB = 1; //event triggered as minimum bias
+ }
+
+ // Get process type for MC
+ fMcProcessType = 0; // -1=invalid, 0=data, 1=ND, 2=SD, 3=DD
+
+ // real data that are not triggered we skip
+ if(!fAnalysisMC && !fTriggeredEventMB)
+ return;
+
+ fn1->Fill(1);
+
+
+ if (fAnalysisMC) {
+
+
+
+ if (fAnalysisType == "ESD"){
+
+
+
+ AliHeader* headerMC = fMC->Header();
+ if (headerMC) {
+
+ AliGenEventHeader* genHeader = headerMC->GenEventHeader();
+ TArrayF vtxMC(3); // primary vertex MC
+ vtxMC[0]=9999; vtxMC[1]=9999; vtxMC[2]=9999; //initialize with dummy
+ if (genHeader) {
+ genHeader->PrimaryVertex(vtxMC);
+ }
+ fZvtxMC = vtxMC[2];
+
+ // PYTHIA:
+ AliGenPythiaEventHeader* pythiaGenHeader =
+ dynamic_cast<AliGenPythiaEventHeader*>(headerMC->GenEventHeader());
+ if (pythiaGenHeader) { //works only for pythia
+ fMcProcessType = GetPythiaEventProcessType(pythiaGenHeader->ProcessType());
+ }
+ // PHOJET:
+ AliGenDPMjetEventHeader* dpmJetGenHeader =
+ dynamic_cast<AliGenDPMjetEventHeader*>(headerMC->GenEventHeader());
+ if (dpmJetGenHeader) {
+ fMcProcessType = GetDPMjetEventProcessType(dpmJetGenHeader->ProcessType());
+ }
+ }
+ } else { // AOD
+
+
+
+ AliAODMCHeader* mcHeader = dynamic_cast<AliAODMCHeader*>(fAOD->FindListObject("mcHeader"));
+
+
+ if(mcHeader) {
+ fZvtxMC = mcHeader->GetVtxZ();
+
+
+
+ if(strstr(mcHeader->GetGeneratorName(), "Pythia")) {
+ fMcProcessType = GetPythiaEventProcessType(mcHeader->GetEventType());
+ } else {
+ fMcProcessType = GetDPMjetEventProcessType(mcHeader->GetEventType());
+ }
+ }
+ }
+
+
+ }
+
+
+
+ if (fAnalysisType == "ESD"){
+
+ const AliESDVertex *vtxESD = fESD->GetPrimaryVertexTracks();
+ if(vtxESD->GetNContributors()<1) {
+ // SPD vertex
+ vtxESD = fESD->GetPrimaryVertexSPD();
+ /* quality checks on SPD-vertex */
+ TString vertexType = vtxESD->GetTitle();
+ if (vertexType.Contains("vertexer: Z") && (vtxESD->GetDispersion() > 0.04 || vtxESD->GetZRes() > 0.25))
+ fZvtx = -1599; //vertex = 0x0; //
+ else if (vtxESD->GetNContributors()<1)
+ fZvtx = -999; //vertex = 0x0; //
+ else
+ fZvtx = vtxESD->GetZ();
+ }
+ else
+ fZvtx = vtxESD->GetZ();
+
+ }
+ else // AOD
+ fZvtx = GetVertex(fAOD);
+
+ fVtxBeforeCuts->Fill(fZvtx);
+
+ //cut on the z position of vertex
+ if (TMath::Abs(fZvtx) > fVtxCut) {
+ return;
+ }
+ fn1->Fill(2);
+
+
+
+
+
+
+ Float_t centrality = -10;
+
+ // only analyze triggered events
+ if(fTriggeredEventMB) {
+
+ if (fAnalysisType == "ESD"){
+ if(fAnalysisPbPb){
+ AliCentrality *centObject = fESD->GetCentrality();
+ centrality = centObject->GetCentralityPercentile(fCentEst);
+ centralityGlobal = centrality;
+ if((centrality>fMaxCent)||(centrality<fMinCent))return;
+ }
+ fcent->Fill(centrality);
+ fn1->Fill(3);
+ if(fAnalysisMC){
+ if(TMath::Abs(fZvtxMC)<fVtxCut){
+ ProcessMCTruthESD();
+ fVtxMC->Fill(fZvtxMC);
+ }
+ }
+ AnalyzeESD(fESD);
+ } else { // AOD
+ if(fAnalysisPbPb){
+ AliCentrality *centObject = fAOD->GetCentrality();
+ if(centObject){
+ centrality = centObject->GetCentralityPercentile(fCentEst);
+ }
+ //cout<<"centrality="<<centrality<<endl;
+ if((centrality>fMaxCent)||(centrality<fMinCent))return;
+ }
+ fcent->Fill(centrality);
+ fn1->Fill(3);
+ if(fAnalysisMC){
+ if(TMath::Abs(fZvtxMC)<fVtxCut){
+
+ ProcessMCTruthAOD();
+ fVtxMC->Fill(fZvtxMC);
+ }
+ }
+ AnalyzeAOD(fAOD);
+ }
+ }
+
+ fVtxAfterCuts->Fill(fZvtx);
+
+
+
+
+ // Post output data.
+ PostData(1, fListOfObjects);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::AnalyzeESD(AliESDEvent* esdEvent)
+{
+ fRun = esdEvent->GetRunNumber();
+ fEventId = 0;
+ if(esdEvent->GetHeader())
+ fEventId = GetEventIdAsLong(esdEvent->GetHeader());
+
+ cout << "centrality=" << centralityGlobal << endl;
+
+
+ Bool_t isPileup = esdEvent->IsPileupFromSPD();
+ if(fPileUpRej)
+ if(isPileup)
+ return;
+ fn1->Fill(4);
+
+
+ // Int_t event = esdEvent->GetEventNumberInFile();
+ //UInt_t time = esdEvent->GetTimeStamp();
+ // ULong64_t trigger = esdEvent->GetTriggerMask();
+ magf = esdEvent->GetMagneticField();
+
+
+
+
+
+ if(fTriggeredEventMB) {// Only MC case can we have not triggered events
+
+ // accepted event
+ fEvents->Fill(0);
+
+
+ //Change, 10/04/13. Now accept all events to do a correct normalization
+ //if(fVtxStatus!=1) return; // accepted vertex
+ //Int_t nESDTracks = esdEvent->GetNumberOfTracks();
+
+ ProduceArrayTrksESD( esdEvent );//produce array with global track parameters
+ ProduceArrayV0ESD( esdEvent );//v0's
+
+
+ fEvents->Fill(1);
+
+
+
+
+ } // end if triggered
+
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::AnalyzeAOD(AliAODEvent* aodEvent)
+{
+ fRun = aodEvent->GetRunNumber();
+ fEventId = 0;
+ if(aodEvent->GetHeader())
+ fEventId = GetEventIdAsLong(aodEvent->GetHeader());
+
+ //UInt_t time = 0; // Missing AOD info? aodEvent->GetTimeStamp();
+ magf = aodEvent->GetMagneticField();
+
+ //Int_t trackmult = 0; // no pt cuts
+ //Int_t nadded = 0;
+
+ Bool_t isPileup = aodEvent->IsPileupFromSPD();
+ if(fPileUpRej)
+ if(isPileup)
+ return;
+ fn1->Fill(4);
+
+
+
+ if(fTriggeredEventMB) {// Only MC case can we have not triggered events
+
+ // accepted event
+ fEvents->Fill(0);
+
+ //if(fVtxStatus!=1) return; // accepted vertex
+ //Int_t nAODTracks = aodEvent->GetNumberOfTracks();
+
+ ProduceArrayTrksAOD( aodEvent );
+ ProduceArrayV0AOD( aodEvent );
+
+ fEvents->Fill(1);
+
+
+
+
+ } // end if triggered
+
+}
+
+//_____________________________________________________________________________
+Float_t AliAnalysisTaskQAHighPtDeDx::GetVertex(const AliVEvent* event) const
+{
+ Float_t zvtx = -999;
+
+ const AliVVertex* primaryVertex = event->GetPrimaryVertex();
+
+ if(primaryVertex->GetNContributors()>0)
+ zvtx = primaryVertex->GetZ();
+
+ return zvtx;
+}
+
+//_____________________________________________________________________________
+Short_t AliAnalysisTaskQAHighPtDeDx::GetPidCode(Int_t pdgCode) const
+{
+ // return our internal code for pions, kaons, and protons
+
+ Short_t pidCode = 6;
+
+ switch (TMath::Abs(pdgCode)) {
+ case 211:
+ pidCode = 1; // pion
+ break;
+ case 321:
+ pidCode = 2; // kaon
+ break;
+ case 2212:
+ pidCode = 3; // proton
+ break;
+ case 11:
+ pidCode = 4; // electron
+ break;
+ case 13:
+ pidCode = 5; // muon
+ break;
+ default:
+ pidCode = 6; // something else?
+ };
+
+ return pidCode;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::ProcessMCTruthESD()
+{
+ // Fill the special MC histogram with the MC truth info
+
+ const Int_t nTracksMC = fMCStack->GetNtrack();
+
+ for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) {
+
+ //Cuts
+ if(!(fMCStack->IsPhysicalPrimary(iTracks)))
+ continue;
+
+ TParticle* trackMC = fMCStack->Particle(iTracks);
+
+ TParticlePDG* pdgPart = trackMC ->GetPDG();
+ Double_t chargeMC = pdgPart->Charge();
+
+ if(chargeMC==0)
+ continue;
+
+ if (TMath::Abs(trackMC->Eta()) > fEtaCut )
+ continue;
+
+ Double_t etaMC = trackMC->Eta();
+ Int_t pdgCode = trackMC->GetPdgCode();
+ Short_t pidCodeMC = 0;
+ pidCodeMC = GetPidCode(pdgCode);
+
+
+ for(Int_t nh = 0; nh < 9; nh++) {
+
+ if( etaMC > etaHigh[nh]/10.0 || etaMC < etaLow[nh]/10.0 )
+ continue;
+
+ hMcIn[0][nh]->Fill(trackMC->Pt());
+ hMcIn[pidCodeMC][nh]->Fill(trackMC->Pt());
+
+
+ }
+
+ }//MC track loop
+
+
+
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::ProcessMCTruthAOD()
+{
+ // Fill the special MC histogram with the MC truth info
+
+
+ const Int_t nTracksMC = fMCArray->GetEntriesFast();
+
+ for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) {
+
+ AliAODMCParticle* trackMC = dynamic_cast<AliAODMCParticle*>(fMCArray->At(iTracks));
+
+ if(!trackMC){
+ AliError("Cannot get MC particle");
+ continue;
+ }
+
+ //Cuts
+ if(!(trackMC->IsPhysicalPrimary()))
+ continue;
+
+
+ Double_t chargeMC = trackMC->Charge();
+ if(chargeMC==0)
+ continue;
+
+
+ if (TMath::Abs(trackMC->Eta()) > fEtaCut )
+ continue;
+
+ Double_t etaMC = trackMC->Eta();
+ Int_t pdgCode = trackMC->GetPdgCode();
+ Short_t pidCodeMC = 0;
+ pidCodeMC = GetPidCode(pdgCode);
+
+ //cout<<"pidcode="<<pidCodeMC<<endl;
+ for(Int_t nh = 0; nh < 9; nh++) {
+
+ if( etaMC > etaHigh[nh]/10.0 || etaMC < etaLow[nh]/10.0 )
+ continue;
+
+ hMcIn[0][nh]->Fill(trackMC->Pt());
+ hMcIn[pidCodeMC][nh]->Fill(trackMC->Pt());
+
+
+ }
+
+ }//MC track loop
+
+
+}
+
+
+//_____________________________________________________________________________
+Short_t AliAnalysisTaskQAHighPtDeDx::GetPythiaEventProcessType(Int_t pythiaType) {
+ //
+ // Get the process type of the event. PYTHIA
+ //
+ // source PWG0 dNdpt
+
+ Short_t globalType = -1; //init
+
+ if(pythiaType==92||pythiaType==93){
+ globalType = 2; //single diffractive
+ }
+ else if(pythiaType==94){
+ globalType = 3; //double diffractive
+ }
+ //else if(pythiaType != 91){ // also exclude elastic to be sure... CKB??
+ else {
+ globalType = 1; //non diffractive
+ }
+ return globalType;
+}
+
+//_____________________________________________________________________________
+Short_t AliAnalysisTaskQAHighPtDeDx::GetDPMjetEventProcessType(Int_t dpmJetType) {
+ //
+ // get the process type of the event. PHOJET
+ //
+ //source PWG0 dNdpt
+ // can only read pythia headers, either directly or from cocktalil header
+ Short_t globalType = -1;
+
+ if (dpmJetType == 1 || dpmJetType == 4) { // explicitly inelastic plus central diffraction
+ globalType = 1;
+ }
+ else if (dpmJetType==5 || dpmJetType==6) {
+ globalType = 2;
+ }
+ else if (dpmJetType==7) {
+ globalType = 3;
+ }
+ return globalType;
+}
+
+//_____________________________________________________________________________
+ULong64_t AliAnalysisTaskQAHighPtDeDx::GetEventIdAsLong(AliVHeader* header) const
+{
+ // To have a unique id for each event in a run!
+ // Modified from AliRawReader.h
+ return ((ULong64_t)header->GetBunchCrossNumber()+
+ (ULong64_t)header->GetOrbitNumber()*3564+
+ (ULong64_t)header->GetPeriodNumber()*16777215*3564);
+}
+
+
+//____________________________________________________________________
+TParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMother(AliStack* stack, Int_t label)
+{
+ //
+ // Finds the first mother among the primary particles of the particle identified by <label>,
+ // i.e. the primary that "caused" this particle
+ //
+ // Taken from AliPWG0Helper class
+ //
+
+ Int_t motherLabel = FindPrimaryMotherLabel(stack, label);
+ if (motherLabel < 0)
+ return 0;
+
+ return stack->Particle(motherLabel);
+}
+
+//____________________________________________________________________
+Int_t AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherLabel(AliStack* stack, Int_t label)
+{
+ //
+ // Finds the first mother among the primary particles of the particle identified by <label>,
+ // i.e. the primary that "caused" this particle
+ //
+ // returns its label
+ //
+ // Taken from AliPWG0Helper class
+ //
+ const Int_t nPrim = stack->GetNprimary();
+
+ while (label >= nPrim) {
+
+ //printf("Particle %d (pdg %d) is not a primary. Let's check its mother %d\n", label, mother->GetPdgCode(), mother->GetMother(0));
+
+ TParticle* particle = stack->Particle(label);
+ if (!particle) {
+
+ AliDebugGeneral("FindPrimaryMotherLabel", AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack.", label));
+ return -1;
+ }
+
+ // find mother
+ if (particle->GetMother(0) < 0) {
+
+ AliDebugGeneral("FindPrimaryMotherLabel", AliLog::kError, Form("UNEXPECTED: Could not find mother of secondary particle %d.", label));
+ return -1;
+ }
+
+ label = particle->GetMother(0);
+ }
+
+ return label;
+}
+
+//____________________________________________________________________
+AliAODMCParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherAOD(AliAODMCParticle* startParticle)
+{
+ //
+ // Finds the first mother among the primary particles of the particle identified by <label>,
+ // i.e. the primary that "caused" this particle
+ //
+ // Taken from AliPWG0Helper class
+ //
+
+ AliAODMCParticle* mcPart = startParticle;
+
+ while (mcPart)
+ {
+
+ if(mcPart->IsPrimary())
+ return mcPart;
+
+ Int_t mother = mcPart->GetMother();
+
+ mcPart = dynamic_cast<AliAODMCParticle*>(fMCArray->At(mother));
+ }
+
+ return 0;
+}
+
+
+//V0______________________________________
+//____________________________________________________________________
+TParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherV0(AliStack* stack, Int_t label)
+{
+ //
+ // Finds the first mother among the primary particles of the particle identified by <label>,
+ // i.e. the primary that "caused" this particle
+ //
+ // Taken from AliPWG0Helper class
+ //
+
+ Int_t nSteps = 0;
+
+ Int_t motherLabel = FindPrimaryMotherLabelV0(stack, label, nSteps);
+ if (motherLabel < 0)
+ return 0;
+
+ return stack->Particle(motherLabel);
+}
+
+//____________________________________________________________________
+Int_t AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherLabelV0(AliStack* stack, Int_t label, Int_t& nSteps)
+{
+ //
+ // Finds the first mother among the primary particles of the particle identified by <label>,
+ // i.e. the primary that "caused" this particle
+ //
+ // returns its label
+ //
+ // Taken from AliPWG0Helper class
+ //
+ nSteps = 0;
+ const Int_t nPrim = stack->GetNprimary();
+
+ while (label >= nPrim) {
+
+ //printf("Particle %d (pdg %d) is not a primary. Let's check its mother %d\n", label, mother->GetPdgCode(), mother->GetMother(0));
+
+ nSteps++; // 1 level down
+
+ TParticle* particle = stack->Particle(label);
+ if (!particle) {
+
+ AliDebugGeneral("FindPrimaryMotherLabelV0", AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack.", label));
+ return -1;
+ }
+
+ // find mother
+ if (particle->GetMother(0) < 0) {
+
+ AliDebugGeneral("FindPrimaryMotherLabelV0", AliLog::kError, Form("UNEXPECTED: Could not find mother of secondary particle %d.", label));
+ return -1;
+ }
+
+ label = particle->GetMother(0);
+ }
+
+ return label;
+}
+
+//____________________________________________________________________
+AliAODMCParticle* AliAnalysisTaskQAHighPtDeDx::FindPrimaryMotherAODV0(AliAODMCParticle* startParticle, Int_t& nSteps)
+{
+ //
+ // Finds the first mother among the primary particles of the particle identified by <label>,
+ // i.e. the primary that "caused" this particle
+ //
+ // Taken from AliPWG0Helper class
+ //
+
+ nSteps = 0;
+
+ AliAODMCParticle* mcPart = startParticle;
+
+ while (mcPart)
+ {
+
+ if(mcPart->IsPrimary())
+ return mcPart;
+
+ Int_t mother = mcPart->GetMother();
+
+ mcPart = dynamic_cast<AliAODMCParticle*>(fMCArray->At(mother));
+ nSteps++; // 1 level down
+ }
+
+ return 0;
+}
+
+
+
+//__________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::ProduceArrayTrksESD( AliESDEvent *ESDevent ){
+
+ const Int_t nESDTracks = ESDevent->GetNumberOfTracks();
+ //Int_t trackmult=0;
+
+
+ Int_t multTPC = 0;
+
+ //get multiplicity tpc only track cuts
+ for(Int_t iT = 0; iT < nESDTracks; iT++) {
+
+ AliESDtrack* esdTrack = ESDevent->GetTrack(iT);
+
+
+ if(TMath::Abs(esdTrack->Eta()) > fEtaCut)
+ continue;
+
+ //only golden track cuts
+ UInt_t selectDebug = 0;
+ if (fTrackFilterTPC) {
+ selectDebug = fTrackFilterTPC->IsSelected(esdTrack);
+ if (!selectDebug) {
+ //cout<<"this is not a golden track"<<endl;
+ continue;
+ }
+ }
+
+ multTPC++;
+
+ }
+
+
+
+ for(Int_t iT = 0; iT < nESDTracks; iT++) {
+
+ AliESDtrack* esdTrack = ESDevent->GetTrack(iT);
+
+
+ if(TMath::Abs(esdTrack->Eta()) > fEtaCut)
+ continue;
+
+ //only golden track cuts
+ UInt_t selectDebug = 0;
+ if (fTrackFilterGolden) {
+ selectDebug = fTrackFilterGolden->IsSelected(esdTrack);
+ if (!selectDebug) {
+ //cout<<"this is not a golden track"<<endl;
+ continue;
+ }
+ }
+
+
+ //Int_t sharedtpcclusters = esdTrack->GetTPCnclsS();
+ Short_t ncl = esdTrack->GetTPCsignalN();
+
+
+ if(ncl<70)
+ continue;
+ Double_t eta = esdTrack->Eta();
+ Double_t phi = esdTrack->Phi();
+ Double_t momentum = esdTrack->P();
+ Float_t dedx = esdTrack->GetTPCsignal();
+
+ //cout<<"magf="<<magf<<endl;
+
+ if(!PhiCut(esdTrack->Pt(), phi, esdTrack->Charge(), magf, cutLow, cutHigh))
+ continue;
+
+
+
+
+ //TOF
+
+ Bool_t IsTOFout=kFALSE;
+ if ((esdTrack->GetStatus()&AliESDtrack::kTOFout)==0)
+ IsTOFout=kTRUE;
+ Float_t lengthtrack=esdTrack->GetIntegratedLength();
+ Float_t timeTOF=esdTrack->GetTOFsignal();
+ Double_t inttime[5]={0,0,0,0,0};
+ esdTrack->GetIntegratedTimes(inttime);// Returns the array with integrated times for each particle hypothesis
+ Float_t beta = -99;
+ if ( !IsTOFout ){
+ if ( ( lengthtrack != 0 ) && ( timeTOF != 0) )
+ beta = inttime[0] / timeTOF;
+ }
+
+ Short_t pidCode = 0;
+
+ if(fAnalysisMC) {
+
+ const Int_t label = TMath::Abs(esdTrack->GetLabel());
+ TParticle* mcTrack = fMCStack->Particle(label);
+ if (mcTrack){
+
+ Int_t pdgCode = mcTrack->GetPdgCode();
+ pidCode = GetPidCode(pdgCode);
+
+ }
+
+ }
+
+
+ if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP
+
+ if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){
+ if(momentum<0.6&&momentum>0.4){
+ hMIPVsEta->Fill(eta,dedx);
+ pMIPVsEta->Fill(eta,dedx);
+ }
+ }
+ if( dedx > DeDxMIPMax+1 && dedx < 95 ){
+ if(TMath::Abs(beta-1)<0.1){
+ hPlateauVsEta->Fill(eta,dedx);
+ pPlateauVsEta->Fill(eta,dedx);
+ }
+ }
+ }
+
+
+ for(Int_t nh = 0; nh < 9; nh++) {
+
+ if( eta > etaHigh[nh]/10.0 || eta < etaLow[nh]/10.0 )
+ continue;
+
+
+ if(fAnalysisMC){
+ hMcOut[0][nh]->Fill(esdTrack->Pt());
+ hMcOut[pidCode][nh]->Fill(esdTrack->Pt());
+ }
+
+ histAllCh[nh]->Fill(momentum, dedx);
+ if(beta>1){
+ histPiTof[nh]->Fill(momentum, dedx);
+ histpPiTof[nh]->Fill(momentum);
+ }
+
+ if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP
+ //Fill pion MIP, before calibration
+ if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){
+ hMIPVsPhi[nh]->Fill(phi,dedx);
+ pMIPVsPhi[nh]->Fill(phi,dedx);
+
+
+ hMIPVsNch[nh]->Fill(multTPC,dedx);
+ pMIPVsNch[nh]->Fill(multTPC,dedx);
+
+ }
+
+ //Fill electrons, before calibration
+ if( dedx > DeDxMIPMax+1 && dedx < 95 ){
+ if(TMath::Abs(beta-1)<0.1){
+ hPlateauVsPhi[nh]->Fill(phi,dedx);
+ pPlateauVsPhi[nh]->Fill(phi,dedx);
+ }
+ }
+
+ }
+
+
+ }//end loop over eta intervals
+
+
+
+
+
+ }//end of track loop
+
+
+
+
+}
+//__________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::ProduceArrayTrksAOD( AliAODEvent *AODevent ){
+
+
+ Int_t nAODTracks = AODevent->GetNumberOfTracks();
+ Int_t multTPC = 0;
+
+ //get multiplicity tpc only track cuts
+ for(Int_t iT = 0; iT < nAODTracks; iT++) {
+
+ AliAODTrack* aodTrack = AODevent->GetTrack(iT);
+
+ if(TMath::Abs(aodTrack->Eta()) > fEtaCut)
+ continue;
+
+
+ if (fTrackFilterTPC) {
+ // TPC only cuts is bit 1
+ if(!aodTrack->TestFilterBit(1))
+ continue;
+ }
+
+ multTPC++;
+
+ }
+
+
+ for(Int_t iT = 0; iT < nAODTracks; iT++) {
+
+ AliAODTrack* aodTrack = AODevent->GetTrack(iT);
+
+ if (fTrackFilterGolden) {
+ // "Global track RAA analysis QM2011 + Chi2ITS<36"; bit 1024
+ if(!aodTrack->TestFilterBit(1024))
+ continue;
+ }
+
+
+ if(TMath::Abs(aodTrack->Eta()) > fEtaCut)
+ continue;
+
+
+ Double_t eta = aodTrack->Eta();
+ Double_t phi = aodTrack->Phi();
+ Double_t momentum = aodTrack->P();
+
+
+ if(!PhiCut(aodTrack->Pt(), phi, aodTrack->Charge(), magf, cutLow, cutHigh))
+ continue;
+
+
+
+ AliAODPid* aodPid = aodTrack->GetDetPid();
+ Short_t ncl = -10;
+ Float_t dedx = -10;
+
+ //TOF
+ Float_t beta = -99;
+
+
+ if(aodPid) {
+ ncl = aodPid->GetTPCsignalN();
+ dedx = aodPid->GetTPCsignal();
+ //TOF
+ Bool_t IsTOFout=kFALSE;
+ Float_t lengthtrack=-999;//in aod we do not have that information, beta must be: beta=inttime/timeTOF
+ Float_t timeTOF=-999;
+
+ if ((aodTrack->GetStatus()&AliESDtrack::kTOFout)==0)
+ IsTOFout=kTRUE;
+
+ lengthtrack=-999;//in aod we do not have that information, beta must be: beta=inttime/timeTOF
+
+ timeTOF=aodPid->GetTOFsignal();
+
+ Double_t inttime[5]={0,0,0,0,0};
+ aodPid->GetIntegratedTimes(inttime);// Returns the array with integrated times for each particle hypothesis
+
+
+ if ( !IsTOFout ){
+ if ( ( lengthtrack != 0 ) && ( timeTOF != 0) )
+ beta = inttime[0] / timeTOF;
+ }
+
+ }
+
+
+ if(ncl<70)
+ continue;
+
+
+ Short_t pidCode = 0;
+
+ if(fAnalysisMC) {
+
+ const Int_t label = TMath::Abs(aodTrack->GetLabel());
+ AliAODMCParticle* mcTrack = dynamic_cast<AliAODMCParticle*>(fMCArray->At(label));
+
+ if (mcTrack){
+
+ Int_t pdgCode = mcTrack->GetPdgCode();
+ pidCode = GetPidCode(pdgCode);
+
+ }
+
+ }
+
+
+
+
+ //if(momentum>0.6||momentum<0.4)//only p:0.4-0.6 GeV
+ //continue;
+
+ //etaLow
+ //etaHigh
+ if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP
+ if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){
+ if(momentum<0.6&&momentum>0.4){
+ hMIPVsEta->Fill(eta,dedx);
+ pMIPVsEta->Fill(eta,dedx);
+ }
+ }
+ if( dedx > DeDxMIPMax+1 && dedx < 95 ){
+ if(TMath::Abs(beta-1)<0.1){
+ hPlateauVsEta->Fill(eta,dedx);
+ pPlateauVsEta->Fill(eta,dedx);
+ }
+ }
+ }
+
+
+ for(Int_t nh = 0; nh < 9; nh++) {
+
+ if( eta > etaHigh[nh]/10.0 || eta < etaLow[nh]/10.0 )
+ continue;
+
+
+ if(fAnalysisMC){
+ hMcOut[0][nh]->Fill(aodTrack->Pt());
+ hMcOut[pidCode][nh]->Fill(aodTrack->Pt());
+ }
+
+ histAllCh[nh]->Fill(momentum, dedx);
+ if(beta>1){
+ histPiTof[nh]->Fill(momentum, dedx);
+ histpPiTof[nh]->Fill(momentum);
+ }
+
+ if( momentum <= 0.6 && momentum >= 0.4 ){//only p:0.4-0.6 GeV, pion MIP
+ //Fill pion MIP, before calibration
+ if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){
+ hMIPVsPhi[nh]->Fill(phi,dedx);
+ pMIPVsPhi[nh]->Fill(phi,dedx);
+
+
+ hMIPVsNch[nh]->Fill(multTPC,dedx);
+ pMIPVsNch[nh]->Fill(multTPC,dedx);
+
+ }
+
+ //Fill electrons, before calibration
+ if( dedx > DeDxMIPMax+1 && dedx < 95 ){
+ if(TMath::Abs(beta-1)<0.1){
+ hPlateauVsPhi[nh]->Fill(phi,dedx);
+ pPlateauVsPhi[nh]->Fill(phi,dedx);
+ }
+ }
+
+ }
+
+ }//end loop over eta intervals
+
+
+
+
+
+ }//end of track loop
+
+
+
+
+
+
+
+}
+//__________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::ProduceArrayV0ESD( AliESDEvent *ESDevent ){
+ Int_t nv0s = ESDevent->GetNumberOfV0s();
+ /*
+ if(nv0s<1){
+ return;
+ }*/
+
+ const AliESDVertex *myBestPrimaryVertex = ESDevent->GetPrimaryVertex();
+ if (!myBestPrimaryVertex) return;
+ if (!(myBestPrimaryVertex->GetStatus())) return;
+ Double_t lPrimaryVtxPosition[3];
+ myBestPrimaryVertex->GetXYZ(lPrimaryVtxPosition);
+
+ Double_t lPrimaryVtxCov[6];
+ myBestPrimaryVertex->GetCovMatrix(lPrimaryVtxCov);
+ Double_t lPrimaryVtxChi2 = myBestPrimaryVertex->GetChi2toNDF();
+
+ AliAODVertex* myPrimaryVertex = new AliAODVertex(lPrimaryVtxPosition, lPrimaryVtxCov, lPrimaryVtxChi2, NULL, -1, AliAODVertex::kPrimary);
+
+
+
+ //
+ // LOOP OVER V0s, K0s, L, AL
+ //
+
+
+ for (Int_t iV0 = 0; iV0 < nv0s; iV0++) {
+
+ // This is the begining of the V0 loop
+ AliESDv0 *esdV0 = ESDevent->GetV0(iV0);
+ if (!esdV0) continue;
+
+ //check onfly status
+ if(esdV0->GetOnFlyStatus()!=0)
+ continue;
+
+
+ // AliESDTrack (V0 Daughters)
+ UInt_t lKeyPos = (UInt_t)TMath::Abs(esdV0->GetPindex());
+ UInt_t lKeyNeg = (UInt_t)TMath::Abs(esdV0->GetNindex());
+
+ AliESDtrack *pTrack = ESDevent->GetTrack(lKeyPos);
+ AliESDtrack *nTrack = ESDevent->GetTrack(lKeyNeg);
+ if (!pTrack || !nTrack) {
+ Printf("ERROR: Could not retreive one of the daughter track");
+ continue;
+ }
+
+ // Remove like-sign
+ if (pTrack->GetSign() == nTrack->GetSign()) {
+ //cout<< "like sign, continue"<< endl;
+ continue;
+ }
+
+ // Eta cut on decay products
+ if(TMath::Abs(pTrack->Eta()) > fEtaCut || TMath::Abs(nTrack->Eta()) > fEtaCut)
+ continue;
+
+
+ // Check if switch does anything!
+ Bool_t isSwitched = kFALSE;
+ if (pTrack->GetSign() < 0) { // switch
+
+ isSwitched = kTRUE;
+ AliESDtrack* helpTrack = nTrack;
+ nTrack = pTrack;
+ pTrack = helpTrack;
+ }
+
+ //Double_t lV0Position[3];
+ //esdV0->GetXYZ(lV0Position[0], lV0Position[1], lV0Position[2]);
+
+
+ AliKFVertex primaryVtxKF( *myPrimaryVertex );
+ AliKFParticle::SetField(ESDevent->GetMagneticField());
+
+ // Also implement switch here!!!!!!
+ AliKFParticle* negEKF = 0; // e-
+ AliKFParticle* posEKF = 0; // e+
+ AliKFParticle* negPiKF = 0; // pi -
+ AliKFParticle* posPiKF = 0; // pi +
+ AliKFParticle* posPKF = 0; // p
+ AliKFParticle* negAPKF = 0; // p-bar
+
+ if(!isSwitched) {
+ negEKF = new AliKFParticle( *(esdV0->GetParamN()) , 11);
+ posEKF = new AliKFParticle( *(esdV0->GetParamP()) ,-11);
+ negPiKF = new AliKFParticle( *(esdV0->GetParamN()) ,-211);
+ posPiKF = new AliKFParticle( *(esdV0->GetParamP()) , 211);
+ posPKF = new AliKFParticle( *(esdV0->GetParamP()) , 2212);
+ negAPKF = new AliKFParticle( *(esdV0->GetParamN()) ,-2212);
+ } else { // switch + and -
+ negEKF = new AliKFParticle( *(esdV0->GetParamP()) , 11);
+ posEKF = new AliKFParticle( *(esdV0->GetParamN()) ,-11);
+ negPiKF = new AliKFParticle( *(esdV0->GetParamP()) ,-211);
+ posPiKF = new AliKFParticle( *(esdV0->GetParamN()) , 211);
+ posPKF = new AliKFParticle( *(esdV0->GetParamN()) , 2212);
+ negAPKF = new AliKFParticle( *(esdV0->GetParamP()) ,-2212);
+ }
+
+ AliKFParticle v0GKF; // Gamma e.g. from pi0
+ v0GKF+=(*negEKF);
+ v0GKF+=(*posEKF);
+ v0GKF.SetProductionVertex(primaryVtxKF);
+
+ AliKFParticle v0K0sKF; // K0 short
+ v0K0sKF+=(*negPiKF);
+ v0K0sKF+=(*posPiKF);
+ v0K0sKF.SetProductionVertex(primaryVtxKF);
+
+ AliKFParticle v0LambdaKF; // Lambda
+ v0LambdaKF+=(*negPiKF);
+ v0LambdaKF+=(*posPKF);
+ v0LambdaKF.SetProductionVertex(primaryVtxKF);
+
+ AliKFParticle v0AntiLambdaKF; // Lambda-bar
+ v0AntiLambdaKF+=(*posPiKF);
+ v0AntiLambdaKF+=(*negAPKF);
+ v0AntiLambdaKF.SetProductionVertex(primaryVtxKF);
+
+ Double_t dmassG = v0GKF.GetMass();
+ Double_t dmassK = v0K0sKF.GetMass()-0.498;
+ Double_t dmassL = v0LambdaKF.GetMass()-1.116;
+ Double_t dmassAL = v0AntiLambdaKF.GetMass()-1.116;
+
+
+ for( Int_t case_v0 = 0; case_v0 < 2; ++case_v0 ){
+
+
+ switch(case_v0){
+ case 0:{
+
+ Bool_t fillPos = kFALSE;
+ Bool_t fillNeg = kFALSE;
+
+ if(dmassG < 0.1)
+ continue;
+
+ if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01){
+ continue;
+ }
+
+ if(dmassL<0.01){
+ fillPos = kTRUE;
+ }
+ if(dmassAL<0.01) {
+ if(fillPos)
+ continue;
+ fillNeg = kTRUE;
+ }
+
+ if(dmassK<0.01) {
+ if(fillPos||fillNeg)
+ continue;
+ fillPos = kTRUE;
+ fillNeg = kTRUE;
+ }
+
+
+ for(Int_t j = 0; j < 2; j++) {
+
+ AliESDtrack* track = 0;
+
+ if(j==0) {
+
+ if(fillNeg)
+ track = nTrack;
+ else
+ continue;
+ } else {
+
+ if(fillPos)
+ track = pTrack;
+ else
+ continue;
+ }
+
+ if(track->GetTPCsignalN()<=70)continue;
+ Double_t phi = track->Phi();
+
+ if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))
+ continue;
+
+
+ //if(!PhiCut(pt, phi, charge, magf, cutLow, cutHigh, hPhi))
+ // continue;
+
+ Double_t eta = track->Eta();
+ Double_t momentum = track->Pt();
+ Double_t dedx = track->GetTPCsignal();
+
+ if(fillPos&&fillNeg){
+
+
+ if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){
+ if(momentum<0.6&&momentum>0.4){
+ hMIPVsEtaV0s->Fill(eta,dedx);
+ pMIPVsEtaV0s->Fill(eta,dedx);
+ }
+ }
+
+
+ }
+
+ for(Int_t nh = 0; nh < nHists; nh++) {
+
+
+
+ if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )
+ continue;
+
+ if(fillPos&&fillNeg){
+
+ histPiV0[nh]->Fill(momentum, dedx);
+ histpPiV0[nh]->Fill(momentum);
+
+ }
+ else{
+
+ histPV0[nh]->Fill(momentum, dedx);
+ histpPV0[nh]->Fill(momentum);
+
+ }
+
+ }
+
+ }//end loop over two tracks
+
+ };
+ break;
+
+ case 1:{//gammas
+
+ Bool_t fillPos = kFALSE;
+ Bool_t fillNeg = kFALSE;
+
+
+
+ if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01) {
+ if(dmassG<0.01 && dmassG>0.0001) {
+
+
+ if( TMath::Abs(nTrack->GetTPCsignal() - 85.0) < 5)
+ fillPos = kTRUE;
+ if( TMath::Abs(pTrack->GetTPCsignal() - 85.0) < 5)
+ fillNeg = kTRUE;
+
+ } else {
+ continue;
+ }
+ }
+
+ //cout<<"fillPos="<<fillPos<<endl;
+
+ if(fillPos == kTRUE && fillNeg == kTRUE)
+ continue;
+
+
+ AliESDtrack* track = 0;
+ if(fillNeg)
+ track = nTrack;
+ else if(fillPos)
+ track = pTrack;
+ else
+ continue;
+
+ Double_t dedx = track->GetTPCsignal();
+ Double_t eta = track->Eta();
+ Double_t phi = track->Phi();
+ Double_t momentum = track->P();
+
+ if(track->GetTPCsignalN()<=70)continue;
+
+ if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))
+ continue;
+
+ for(Int_t nh = 0; nh < nHists; nh++) {
+
+ if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )
+ continue;
+
+ histEV0[nh]->Fill(momentum, dedx);
+
+ }
+
+ };
+ break;
+
+
+ }//end switch
+
+ }//end loop over case V0
+
+
+ // clean up loop over v0
+
+ delete negPiKF;
+ delete posPiKF;
+ delete posPKF;
+ delete negAPKF;
+
+
+
+ }
+
+
+ delete myPrimaryVertex;
+
+
+}
+//__________________________________________________________________________
+void AliAnalysisTaskQAHighPtDeDx::ProduceArrayV0AOD( AliAODEvent *AODevent ){
+ Int_t nv0s = AODevent->GetNumberOfV0s();
+ /*
+ if(nv0s<1){
+ return;
+ }*/
+
+ AliAODVertex *myBestPrimaryVertex = AODevent->GetPrimaryVertex();
+ if (!myBestPrimaryVertex) return;
+
+
+
+ // ################################
+ // #### BEGINNING OF V0 CODE ######
+ // ################################
+ // This is the begining of the V0 loop
+ for (Int_t iV0 = 0; iV0 < nv0s; iV0++) {
+ AliAODv0 *aodV0 = AODevent->GetV0(iV0);
+ if (!aodV0) continue;
+
+
+ //check onfly status
+ if(aodV0->GetOnFlyStatus()!=0)
+ continue;
+
+ // AliAODTrack (V0 Daughters)
+ AliAODVertex* vertex = aodV0->GetSecondaryVtx();
+ if (!vertex) {
+ Printf("ERROR: Could not retrieve vertex");
+ continue;
+ }
+
+ AliAODTrack *pTrack = (AliAODTrack*)vertex->GetDaughter(0);
+ AliAODTrack *nTrack = (AliAODTrack*)vertex->GetDaughter(1);
+ if (!pTrack || !nTrack) {
+ Printf("ERROR: Could not retrieve one of the daughter track");
+ continue;
+ }
+
+ // Remove like-sign
+ if (pTrack->Charge() == nTrack->Charge()) {
+ //cout<< "like sign, continue"<< endl;
+ continue;
+ }
+
+ // Make sure charge ordering is ok
+ if (pTrack->Charge() < 0) {
+ AliAODTrack* helpTrack = pTrack;
+ pTrack = nTrack;
+ nTrack = helpTrack;
+ }
+
+ // Eta cut on decay products
+ if(TMath::Abs(pTrack->Eta()) > fEtaCut || TMath::Abs(nTrack->Eta()) > fEtaCut)
+ continue;
+
+
+ Double_t dmassG = aodV0->InvMass2Prongs(0,1,11,11);
+ Double_t dmassK = aodV0->MassK0Short()-0.498;
+ Double_t dmassL = aodV0->MassLambda()-1.116;
+ Double_t dmassAL = aodV0->MassAntiLambda()-1.116;
+
+ for( Int_t case_v0 = 0; case_v0 < 2; ++case_v0 ){
+
+
+ switch(case_v0){
+ case 0:{
+ Bool_t fillPos = kFALSE;
+ Bool_t fillNeg = kFALSE;
+
+
+ if(dmassG < 0.1)
+ continue;
+
+ if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01){
+ continue;
+ }
+
+ if(dmassL<0.01){
+ fillPos = kTRUE;
+ }
+ if(dmassAL<0.01) {
+ if(fillPos)
+ continue;
+ fillNeg = kTRUE;
+ }
+
+ if(dmassK<0.01) {
+ if(fillPos||fillNeg)
+ continue;
+ fillPos = kTRUE;
+ fillNeg = kTRUE;
+ }
+
+
+
+ for(Int_t j = 0; j < 2; j++) {
+
+ AliAODTrack* track = 0;
+
+ if(j==0) {
+
+ if(fillNeg)
+ track = nTrack;
+ else
+ continue;
+ } else {
+
+ if(fillPos)
+ track = pTrack;
+ else
+ continue;
+ }
+
+ if(track->GetTPCsignalN()<=70)continue;
+
+ Double_t phi = track->Phi();
+
+ if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))
+ continue;
+
+
+ //if(!PhiCut(pt, phi, charge, magf, cutLow, cutHigh, hPhi))
+ // continue;
+
+ Double_t eta = track->Eta();
+ Double_t momentum = track->Pt();
+ Double_t dedx = track->GetTPCsignal();
+
+ if(fillPos&&fillNeg){
+
+
+ if( dedx < DeDxMIPMax && dedx > DeDxMIPMin ){
+ if(momentum<0.6&&momentum>0.4){
+ hMIPVsEtaV0s->Fill(eta,dedx);
+ pMIPVsEtaV0s->Fill(eta,dedx);
+ }
+ }
+
+
+ }
+
+ for(Int_t nh = 0; nh < nHists; nh++) {
+
+
+
+ if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )
+ continue;
+
+ if(fillPos&&fillNeg){
+
+ histPiV0[nh]->Fill(momentum, dedx);
+ histpPiV0[nh]->Fill(momentum);
+
+ }
+ else{
+
+ histPV0[nh]->Fill(momentum, dedx);
+ histpPV0[nh]->Fill(momentum);
+
+ }
+
+ }
+
+
+ }//end loop over two tracks
+ };
+ break;
+
+ case 1:{//gammas
+
+ Bool_t fillPos = kFALSE;
+ Bool_t fillNeg = kFALSE;
+
+ if(dmassK>0.01 && dmassL>0.01 && dmassAL>0.01) {
+ if(dmassG<0.01 && dmassG>0.0001) {
+
+ if( TMath::Abs(nTrack->GetTPCsignal() - 85.0) < 5)
+ fillPos = kTRUE;
+ if( TMath::Abs(pTrack->GetTPCsignal() - 85.0) < 5)
+ fillNeg = kTRUE;
+
+ } else {
+ continue;
+ }
+ }
+
+
+ if(fillPos == kTRUE && fillNeg == kTRUE)
+ continue;
+
+
+ AliAODTrack* track = 0;
+ if(fillNeg)
+ track = nTrack;
+ else if(fillPos)
+ track = pTrack;
+ else
+ continue;
+
+ Double_t dedx = track->GetTPCsignal();
+ Double_t eta = track->Eta();
+ Double_t phi = track->Phi();
+ Double_t momentum = track->P();
+
+ if(track->GetTPCsignalN()<=70)continue;
+
+ if(!PhiCut(track->Pt(), phi, track->Charge(), magf, cutLow, cutHigh))
+ continue;
+
+ for(Int_t nh = 0; nh < nHists; nh++) {
+
+ if( eta < etaLow[nh]/10.0 || eta > etaHigh[nh]/10.0 )
+ continue;
+
+ histEV0[nh]->Fill(momentum, dedx);
+
+ }
+
+ };
+ break;
+
+
+ }//end switch
+ }//end loop over V0s cases
+
+ }//end loop over v0's
+
+
+
+
+}
+Bool_t AliAnalysisTaskQAHighPtDeDx::PhiCut(Double_t pt, Double_t phi, Double_t q, Float_t mag, TF1* phiCutLow, TF1* phiCutHigh)
+{
+ if(pt < 2.0)
+ return kTRUE;
+
+ //Double_t phi = track->Phi();
+ if(mag < 0) // for negatve polarity field
+ phi = TMath::TwoPi() - phi;
+ if(q < 0) // for negatve charge
+ phi = TMath::TwoPi()-phi;
+
+ phi += TMath::Pi()/18.0; // to center gap in the middle
+ phi = fmod(phi, TMath::Pi()/9.0);
+
+ if(phi<phiCutHigh->Eval(pt)
+ && phi>phiCutLow->Eval(pt))
+ return kFALSE; // reject track
+
+ hPhi->Fill(pt, phi);
+
+ return kTRUE;
+}
-AliAnalysisTask* AddTaskQAHighPtDeDx(Bool_t AnalysisMC = kFALSE,\r
- Int_t typerun =1, // 0 for pp and 1 for Pb-Pb or pPb\r
- TString type ="ESD",\r
- UInt_t kTriggerInt = AliVEvent::kINT7, //for pPb kINT7, for pp or PbPb kMB\r
- Float_t minCent = 0.,\r
- Float_t maxCent = 80.,\r
- char *centralityEstimator = "V0A",//for pPb V0A for PbPb V0M\r
- Bool_t ispileuprej = kFALSE\r
- )\r
-{\r
- // Creates a pid task and adds it to the analysis manager\r
- \r
- // Get the pointer to the existing analysis manager via the static\r
- //access method\r
- //=========================================================================\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTaskHighPtDeDx", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
- \r
- // Check the analysis type using the event handlers connected to the\r
- // analysis manager The availability of MC handler can also be\r
- // checked here.\r
- // =========================================================================\r
- if (!mgr->GetInputEventHandler()) {\r
- Error("AddTaskHighPtDeDx", "This task requires an input event handler");\r
- return NULL;\r
- } \r
- \r
-\r
-\r
-\r
- AliAnalysisFilter* trackFilterGolden = new AliAnalysisFilter("trackFilter");\r
- AliESDtrackCuts* esdTrackCutsGolden = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE,1);\r
- trackFilterGolden->AddCuts(esdTrackCutsGolden);\r
- \r
- AliAnalysisFilter* trackFilterTPC = new AliAnalysisFilter("trackFilterTPC");\r
- AliESDtrackCuts* esdTrackCutsTPC = \r
- AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
- trackFilterTPC->AddCuts(esdTrackCutsTPC);\r
- \r
-\r
-\r
- \r
- AliAnalysisTaskQAHighPtDeDx* taskHighPtDeDx = new AliAnalysisTaskQAHighPtDeDx("taskHighPtDeDxpp");\r
- TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
- taskHighPtDeDx->SetAnalysisType(type);\r
- taskHighPtDeDx->SetAnalysisMC(AnalysisMC);\r
- if(typerun==1){\r
- taskHighPtDeDx->SetAnalysisPbPb(kTRUE);\r
- taskHighPtDeDx->SetMinCent(minCent);\r
- taskHighPtDeDx->SetMaxCent(maxCent);\r
- taskHighPtDeDx->SetCentralityEstimator(centralityEstimator);\r
- }\r
- else\r
- taskHighPtDeDx->SetAnalysisPbPb(kFALSE);\r
- taskHighPtDeDx->SetDebugLevel(0);\r
- taskHighPtDeDx->SetEtaCut(0.8);\r
- taskHighPtDeDx->SetVtxCut(10.0);\r
- taskHighPtDeDx->SetTrigger(kTriggerInt);\r
- taskHighPtDeDx->SetPileUpRej(ispileuprej);\r
- //Set Filtesr\r
- taskHighPtDeDx->SetTrackFilterGolden(trackFilterGolden);\r
- taskHighPtDeDx->SetTrackFilterTPC(trackFilterTPC);\r
- taskHighPtDeDx->SetStoreMcIn(AnalysisMC); // def: kFALSE\r
- \r
- mgr->AddTask(taskHighPtDeDx);\r
- \r
- // Create ONLY the output containers for the data produced by the\r
- // task. Get and connect other common input/output containers via\r
- // the manager as below\r
- //=======================================================================\r
- TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
- \r
- AliAnalysisDataContainer *cout_histdedx;\r
- cout_histdedx=0;\r
- cout_histdedx = mgr->CreateContainer("outputdedx", TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);\r
- mgr->ConnectInput (taskHighPtDeDx, 0, mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(taskHighPtDeDx, 1, cout_histdedx);\r
- \r
- // Return task pointer at the end\r
- return taskHighPtDeDx;\r
- \r
- \r
- \r
-}\r
+AliAnalysisTask* AddTaskQAHighPtDeDx(Bool_t AnalysisMC = kFALSE,
+ Int_t typerun =1, // 0 for pp and 1 for Pb-Pb or pPb
+ TString type ="ESD",
+ UInt_t kTriggerInt = AliVEvent::kINT7, //for pPb kINT7, for pp or PbPb kMB
+ Float_t minCent = 0.,
+ Float_t maxCent = 80.,
+ char *centralityEstimator = "V0A",//for pPb V0A for PbPb V0M
+ Bool_t ispileuprej = kFALSE
+ )
+{
+ // Creates a pid task and adds it to the analysis manager
+
+ // Get the pointer to the existing analysis manager via the static
+ //access method
+ //=========================================================================
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTaskHighPtDeDx", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the
+ // analysis manager The availability of MC handler can also be
+ // checked here.
+ // =========================================================================
+ if (!mgr->GetInputEventHandler()) {
+ Error("AddTaskHighPtDeDx", "This task requires an input event handler");
+ return NULL;
+ }
+
+
+
+
+ AliAnalysisFilter* trackFilterGolden = new AliAnalysisFilter("trackFilter");
+ AliESDtrackCuts* esdTrackCutsGolden = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE,1);
+ trackFilterGolden->AddCuts(esdTrackCutsGolden);
+
+ AliAnalysisFilter* trackFilterTPC = new AliAnalysisFilter("trackFilterTPC");
+ AliESDtrackCuts* esdTrackCutsTPC =
+ AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+ trackFilterTPC->AddCuts(esdTrackCutsTPC);
+
+
+
+
+ AliAnalysisTaskQAHighPtDeDx* taskHighPtDeDx = new AliAnalysisTaskQAHighPtDeDx("taskHighPtDeDxpp");
+ TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+ taskHighPtDeDx->SetAnalysisType(type);
+ taskHighPtDeDx->SetAnalysisMC(AnalysisMC);
+ if(typerun==1){
+ taskHighPtDeDx->SetAnalysisPbPb(kTRUE);
+ taskHighPtDeDx->SetMinCent(minCent);
+ taskHighPtDeDx->SetMaxCent(maxCent);
+ taskHighPtDeDx->SetCentralityEstimator(centralityEstimator);
+ }
+ else
+ taskHighPtDeDx->SetAnalysisPbPb(kFALSE);
+ taskHighPtDeDx->SetDebugLevel(0);
+ taskHighPtDeDx->SetEtaCut(0.8);
+ taskHighPtDeDx->SetVtxCut(10.0);
+ taskHighPtDeDx->SetTrigger(kTriggerInt);
+ taskHighPtDeDx->SetPileUpRej(ispileuprej);
+ //Set Filtesr
+ taskHighPtDeDx->SetTrackFilterGolden(trackFilterGolden);
+ taskHighPtDeDx->SetTrackFilterTPC(trackFilterTPC);
+ taskHighPtDeDx->SetStoreMcIn(AnalysisMC); // def: kFALSE
+
+ mgr->AddTask(taskHighPtDeDx);
+
+ // Create ONLY the output containers for the data produced by the
+ // task. Get and connect other common input/output containers via
+ // the manager as below
+ //=======================================================================
+ TString outputFileName = AliAnalysisManager::GetCommonFileName();
+
+ AliAnalysisDataContainer *cout_histdedx;
+ cout_histdedx=0;
+ cout_histdedx = mgr->CreateContainer("outputdedx", TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
+ mgr->ConnectInput (taskHighPtDeDx, 0, mgr->GetCommonInputContainer());
+ mgr->ConnectOutput(taskHighPtDeDx, 1, cout_histdedx);
+
+ // Return task pointer at the end
+ return taskHighPtDeDx;
+
+
+
+}
-//////////////////////////////////////////////////\r
-//\r
-// This macro was written by Domenico Colella (domenico.colella@cern.ch).\r
-// 12 November 2013\r
-//\r
-// ------ Arguments\r
-// -- icasType = 0) Xi- 1) Xi+ 2) Omega- 3) Omega+\r
-// -- collidingsystem = 0) PbPb 1) pp\r
-// -- fileDir = "Input file directory"\r
-// -- filein = "Input file name"\r
-//\r
-// ------ QATask output content\r
-// The output produced by the QATask is a CFContainer with 4 steps and 21 variables.\r
-// The meaning of each variable within the container are listed here:\r
-// -- 0 = Max DCA Cascade Daughters pp: 2.0 PbPb: 0.3\r
-// -- 1 = Min DCA Bach To PV pp: 0.01 PbPb: 0.03\r
-// -- 2 = Min Cascade Cosine Of PA pp: 0.98 PbPb: 0.999\r
-// -- 3 = Min Cascade Radius Fid. Vol. pp: 0.2 PbPb: 0.9\r
-// -- 4 = Window Invariant Mass Lambda pp: 0.008 PbPb: 0.0008\r
-// -- 5 = Max DCA V0 Daughters pp: 1.5 PbPb: 1.0\r
-// -- 6 = Min V0 Cosine Of PA To PV pp: pT dep. PbPb: 0.98\r
-// -- 7 = Min V0 Radius Fid. Vol. pp: 0.2 PbPb: 0.9\r
-// -- 8 = Min DCA V0 To PV pp: 0.01 PbPb: 0.05\r
-// -- 9 = Min DCA Pos To PV pp: 0.05 PbPb: 0.1\r
-// -- 10 = Min DCA Neg To PV pp: 0.05 PbPb: 0.1\r
-// -- 11 = Invariant Mass distribution for Xi\r
-// -- 12 = Invariant Mass distribution for Omega\r
-// -- 13 = Transverse Momentum distribution\r
-// -- 14 = Rapidity distribution for Xi\r
-// -- 15 = Rapidity distribution for Omega\r
-// -- 16 = Proper length distribution for the cascade\r
-// -- 17 = Proper length distribution for the V0\r
-// -- 18 = Min V0 Cosine Of PA To Xi Vertex pp: pT dep. PbPb: pT dep.\r
-// -- 19 = Centrality\r
-// -- 20 = ESD track multiplicity\r
-// The last two variables are empty in the case proton-proton collisions.\r
-//\r
-// ------ Present Macro Check\r
-// With this macro are produced the plots of the distributions for the topological\r
-// variables used during the reconstruction of the cascades and defined in the two\r
-// classes AliCascadeVertexer.cxx and AliV0vertexer.cxx contained in /STEER/ESD/ \r
-// folder in Aliroot.\r
-//\r
-// -- First Canvas: DCA cascade daughters, Bachelor IP to PV, Cascade cosine of PA\r
-// Cascade radius of fiducial volume, Invariant mass Lambda,\r
-// DCA V0 daughters.\r
-// -- Second Canvas: V0 cosine of PA to PV, Min V0 Radius Fid. Vol., Min DCA V0 To PV\r
-// Min DCA Pos To PV, Min DCA Neg To PV, V0 cosine of PA to XiV\r
-//\r
-// In this plots, in correspondence to the min/max cut value adopted in the reconstruction\r
-// a line is drawn, to check if there is same problem in the cuts definition.\r
-//\r
-// Also, other specific distribution for the selected cascades are ploted as: the\r
-// invariant mass distribution, the transverse momentum distribution, the rapidity\r
-// distribution, proper length distribution for the cascade and the v0.\r
-//\r
-// -- Third Canvas: InvMass, Transverse momentum, Cascade proper length, V0 proper length\r
-//\r
-// In the end, only for thr PbPb collision the centrality distribution and the\r
-// track multiplicity distribution are sored.\r
-//\r
-// -- Fourth Canvas: Centrality, track multiplicity\r
-//\r
-//\r
-//////////////////////////////////////////////////////\r
-\r
-\r
-\r
-\r
-class AliCFContainer;\r
-\r
-void multistrangeQA(Int_t icasType = 0, // 0) Xi- 1) Xi+ 2) Omega- 3) Omega+\r
- Int_t collidingsystem = 0, // 0) PbPb 1) pp\r
- Char_t *fileDir = "./", // Input file directory\r
- Char_t *filein = "AnalysisResults_AOD.root" // Input file name\r
- ) {\r
-\r
-\r
- /////////////\r
- gStyle->SetOptStat(1110);\r
- gStyle->SetOptStat(kFALSE);\r
- gStyle->SetOptTitle(kFALSE);\r
- gStyle->SetFrameLineWidth(2.5);\r
- gStyle->SetCanvasColor(0);\r
- gStyle->SetPadColor(0);\r
- gStyle->SetHistLineWidth(2.5);\r
- gStyle->SetLabelSize(0.05, "x");\r
- gStyle->SetLabelSize(0.05, "y");\r
- gStyle->SetTitleSize(0.05, "x");\r
- gStyle->SetTitleSize(0.05, "y");\r
- gStyle->SetTitleOffset(1.1, "x");\r
- gStyle->SetPadBottomMargin(0.14);\r
- gSystem->Load("libANALYSIS.so");\r
- gSystem->Load("libANALYSISalice.so");\r
- gSystem->Load("libCORRFW.so");\r
-\r
- \r
-\r
- TFile *f1 = new TFile(Form("%s/%s",fileDir,filein));\r
- AliCFContainer *cf = (AliCFContainer*) (f1->Get("PWGLFStrangeness.outputCheckCascade/fCFContCascadeCuts"));\r
- \r
-\r
- //DEEFINE TEXT\r
- TLatex* t1 = new TLatex(0.6,0.55,"#color[3]{OK!!}");\r
- t1->SetTextSize(0.1);\r
- t1->SetNDC();\r
- TLatex* t2 = new TLatex(0.6,0.55,"#color[2]{NOT OK!!}");\r
- t2->SetTextSize(0.1);\r
- t2->SetNDC();\r
- t2->SetTextColor(2);\r
- TLatex* tcasc;\r
- if (icasType == 0) tcasc = new TLatex(0.8,0.7,"#color[1]{#Xi^{-}}");\r
- else if (icasType == 1) tcasc = new TLatex(0.8,0.7,"#color[1]{#Xi^{+}}");\r
- else if (icasType == 2) tcasc = new TLatex(0.8,0.7,"#color[1]{#Omega^{-}}");\r
- else if (icasType == 3) tcasc = new TLatex(0.8,0.7,"#color[1]{#Omega^{+}}");\r
- tcasc->SetTextSize(0.2);\r
- tcasc->SetNDC();\r
- tcasc->SetTextColor(2);\r
- TLatex* tpdgmass;\r
- if (icasType == 0) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.321 GeV/c^{2}}");\r
- else if (icasType == 1) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.321 GeV/c^{2}}");\r
- else if (icasType == 2) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.672 GeV/c^{2}}");\r
- else if (icasType == 3) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.672 GeV/c^{2}}");\r
- tpdgmass->SetTextSize(0.07);\r
- tpdgmass->SetNDC();\r
- tpdgmass->SetTextColor(2);\r
- \r
- //DEFINE 1st CANVAS AND DRAW PLOTS\r
- TCanvas *c1 = new TCanvas("c1","",1200,800);\r
- c1->Divide(2,3); \r
- //Pad 1: DCA cascade daughters\r
- c1->cd(1);\r
- gPad->SetLogy();\r
- TH1D *hvar0 = cf->ShowProjection(0,icasType);\r
- hvar0->Draw("histo");\r
- Double_t x0;\r
- if (collidingsystem == 0) x0 = 0.3;\r
- else if (collidingsystem == 1) x0 = 2.0;\r
- TLine *line0 = new TLine(x0,0.,x0,hvar0->GetBinContent(hvar0->GetMaximumBin()));\r
- line0->SetLineColor(kRed);\r
- line0->SetLineStyle(9);\r
- line0->SetLineWidth(2.0);\r
- line0->Draw("same");\r
- Bool_t check_0 = checkOverTheLimit(hvar0, x0);\r
- if (check_0) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- tcasc->Draw();\r
- //Pad 2: Bachelor IP to PV\r
- c1->cd(2);\r
- gPad->SetLogy();\r
- TH1D *hvar1 = cf->ShowProjection(1,icasType);\r
- hvar1->GetXaxis()->SetRangeUser(0.,0.24);\r
- hvar1->Draw("histo");\r
- Double_t x1;\r
- if (collidingsystem == 0) x1 = 0.03;\r
- else if (collidingsystem == 1) x1 = 0.01;\r
- TLine *line1 = new TLine(x1,0.,x1,hvar1->GetBinContent(hvar1->GetMaximumBin()));\r
- line1->SetLineColor(kRed);\r
- line1->SetLineStyle(9);\r
- line1->SetLineWidth(2.0);\r
- line1->Draw("same");\r
- Bool_t check_1 = checkUnderTheLimit(hvar1, x1);\r
- if (check_1) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 3: Cascade cosine of Pointing Angle\r
- c1->cd(3);\r
- gPad->SetLogy();\r
- TH1D *hvar2 = cf->ShowProjection(2,icasType);\r
- Double_t max2 = hvar2->GetBinContent(hvar2->GetMaximumBin());\r
- hvar2->GetYaxis()->SetRangeUser(0.01,max2*1.5);\r
- hvar2->Draw("histo");\r
- Double_t x2;\r
- if (collidingsystem == 0) x2 = 0.999;\r
- else if (collidingsystem == 1) x2 = 0.98;\r
- TLine *line2 = new TLine(x2,0.,x2,hvar2->GetBinContent(hvar2->GetMaximumBin()));\r
- line2->SetLineColor(kRed);\r
- line2->SetLineStyle(9);\r
- line2->SetLineWidth(2.0);\r
- line2->Draw("same");\r
- line1->Draw("same");\r
- Bool_t check_2 = checkUnderTheLimit(hvar2, x2);\r
- if (check_2) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 4: Cascade radius of fiducial volume\r
- c1->cd(4);\r
- gPad->SetLogy();\r
- TH1D *hvar3 = cf->ShowProjection(3,icasType);\r
- hvar3->GetXaxis()->SetRangeUser(0.,3.8);\r
- hvar3->Draw("histo");\r
- Double_t x3;\r
- if (collidingsystem == 0) x3 = 0.9;\r
- else if (collidingsystem == 1) x3 = 0.2;\r
- TLine *line3 = new TLine(x3,0.,x3,hvar3->GetBinContent(hvar3->GetMaximumBin()));\r
- line3->SetLineColor(kRed);\r
- line3->SetLineStyle(9);\r
- line3->SetLineWidth(2.0);\r
- line3->Draw("same");\r
- Bool_t check_3 = checkUnderTheLimit(hvar3, x3);\r
- if (check_3) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 5: Invariant mass Lambda\r
- c1->cd(5);\r
- TH1D *hvar4 = cf->ShowProjection(4,icasType);\r
- hvar4->Draw("histo");\r
- Double_t x41 = 1.116 + 0.008;\r
- TLine *line41 = new TLine(x41,0.,x41,hvar4->GetBinContent(hvar4->GetMaximumBin()));\r
- line41->SetLineColor(kRed);\r
- line41->SetLineStyle(9);\r
- line41->SetLineWidth(2.0);\r
- line41->Draw("same");\r
- Double_t x42 = 1.115 - 0.008;\r
- TLine *line42 = new TLine(x42,0.,x42,hvar4->GetBinContent(hvar4->GetMaximumBin()));\r
- line42->SetLineColor(kRed);\r
- line42->SetLineStyle(9);\r
- line42->SetLineWidth(2.0);\r
- line42->Draw("same");\r
- Bool_t check_4_1 = checkUnderTheLimit(hvar3, x3);\r
- Bool_t check_4_2 = checkOverTheLimit(hvar0, x0);\r
- if (check_4_1 && check_4_2) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 6: DCA V0 daughters\r
- c1->cd(6);\r
- gPad->SetLogy();\r
- TH1D *hvar5 = cf->ShowProjection(5,icasType);\r
- hvar5->Draw("histo");\r
- Double_t x5;\r
- if (collidingsystem == 0) x5 = 1.0;\r
- else if (collidingsystem == 1) x5 = 1.5;\r
- TLine *line5 = new TLine(x5,0.,x5,hvar5->GetBinContent(hvar5->GetMaximumBin()));\r
- line5->SetLineColor(kRed);\r
- line5->SetLineStyle(9);\r
- line5->SetLineWidth(2.0);\r
- line5->Draw("same");\r
- Bool_t check_5 = checkOverTheLimit(hvar5, x5);\r
- if (check_5) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- c1->SaveAs("MultistrangeQA.pdf(");\r
- \r
-\r
- //DEFINE 2st CANVAS AND DRAW PLOTS\r
- TCanvas *c2 = new TCanvas("c2","",1200,800);\r
- c2->Divide(2,3);\r
- //Pad 1: V0 cosine of Pointing Angle to PV\r
- c2->cd(1);\r
- gPad->SetLogy();\r
- TH1D *hvar6 = cf->ShowProjection(6,icasType);\r
- Double_t max6 = hvar6->GetBinContent(hvar6->GetMaximumBin());\r
- hvar6->GetYaxis()->SetRangeUser(0.01,max6*1.5);\r
- hvar6->Draw("histo");\r
- //Pad 2: Min V0 Radius Fid. Vol. \r
- c2->cd(2);\r
- gPad->SetLogy();\r
- TH1D *hvar7 = cf->ShowProjection(7,icasType);\r
- hvar7->GetXaxis()->SetRangeUser(0.,3.0);\r
- hvar7->Draw("histo");\r
- Double_t x7;\r
- if (collidingsystem == 0) x7 = 0.9;\r
- else if (collidingsystem == 1) x7 = 0.2;\r
- TLine *line7 = new TLine(x7,0.,x7,hvar7->GetBinContent(hvar7->GetMaximumBin()));\r
- line7->SetLineColor(kRed);\r
- line7->SetLineStyle(9);\r
- line7->SetLineWidth(2.0);\r
- line7->Draw("same");\r
- Bool_t check_7 = checkUnderTheLimit(hvar7, x7);\r
- if (check_7) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad3: Min DCA V0 To PV\r
- c2->cd(3);\r
- gPad->SetLogy();\r
- TH1D *hvar8 = cf->ShowProjection(8,icasType);\r
- hvar8->GetXaxis()->SetRangeUser(0.,0.3);\r
- hvar8->Draw("histo");\r
- Double_t x8;\r
- if (collidingsystem == 0) x8 = 0.05;\r
- else if (collidingsystem == 1) x8 = 0.01;\r
- TLine *line8 = new TLine(x8,0.,x8,hvar8->GetBinContent(hvar8->GetMaximumBin()));\r
- line8->SetLineColor(kRed);\r
- line8->SetLineStyle(9);\r
- line8->SetLineWidth(2.0);\r
- line8->Draw("same");\r
- Bool_t check_8 = checkUnderTheLimit(hvar8, x8);\r
- if (check_8) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 4: Min DCA Pos To PV\r
- c2->cd(4);\r
- gPad->SetLogy();\r
- TH1D *hvar9 = cf->ShowProjection(9,icasType);\r
- hvar9->GetXaxis()->SetRangeUser(0.,0.2);\r
- hvar9->Draw("histo");\r
- Double_t x9;\r
- if (collidingsystem == 0) x9 = 0.1;\r
- else if (collidingsystem == 1) x9 = 0.05;\r
- TLine *line9 = new TLine(x9,0.,x9,hvar9->GetBinContent(hvar9->GetMaximumBin()));\r
- line9->SetLineColor(kRed);\r
- line9->SetLineStyle(9);\r
- line9->SetLineWidth(2.0);\r
- line9->Draw("same");\r
- Bool_t check_9 = checkUnderTheLimit(hvar9, x9);\r
- if (check_9) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 5: Min DCA Neg To PV\r
- c2->cd(5);\r
- gPad->SetLogy();\r
- TH1D *hvar10 = cf->ShowProjection(10,icasType);\r
- hvar10->GetXaxis()->SetRangeUser(0.,0.2);\r
- hvar10->Draw("histo");\r
- Double_t x10;\r
- if (collidingsystem == 0) x10 = 0.1;\r
- else if (collidingsystem == 1) x10 = 0.05;\r
- TLine *line10 = new TLine(x10,0.,x10,hvar10->GetBinContent(hvar10->GetMaximumBin()));\r
- line10->SetLineColor(kRed);\r
- line10->SetLineStyle(9);\r
- line10->SetLineWidth(2.0);\r
- line10->Draw("same");\r
- Bool_t check_10 = checkUnderTheLimit(hvar10, x10);\r
- if (check_10) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }\r
- else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }\r
- //Pad 6: V0 cosine of Pointing Angle to XiV\r
- c2->cd(6);\r
- gPad->SetLogy();\r
- TH1D *hvar20 = cf->ShowProjection(18,icasType);\r
- Double_t max20 = hvar20->GetBinContent(hvar20->GetMaximumBin());\r
- hvar20->GetYaxis()->SetRangeUser(0.01,max20*1.5);\r
- hvar20->Draw("histo");\r
- c2->SaveAs("MultistrangeQA.pdf");\r
-\r
- //DEFINE 3st CANVAS AND DRAW PLOTS\r
- TCanvas *c3 = new TCanvas("c3","",1200,800);\r
- c3->Divide(2,3);\r
- //Pad 1: InvMass\r
- c3->cd(1);\r
- TH1D *hvar12 = cf->ShowProjection(11+icasType/2,icasType);\r
- hvar12->Draw("histo");\r
- tpdgmass->Draw(); \r
- TLine *linemass;\r
- if (icasType == 0) linemass = new TLine(1.32171,0.,1.32171,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));\r
- else if (icasType == 1) linemass = new TLine(1.32171,0.,1.32171,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));\r
- else if (icasType == 2) linemass = new TLine(1.67245,0.,1.67245,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));\r
- else if (icasType == 3) linemass = new TLine(1.67245,0.,1.67245,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));\r
- linemass->SetLineColor(kRed);\r
- linemass->SetLineStyle(1);\r
- linemass->SetLineWidth(2.0);\r
- linemass->Draw("same");\r
- //Pad 2: Transverse momentum\r
- c3->cd(2);\r
- TH1D *hvar13 = cf->ShowProjection(13,icasType);\r
- hvar13->Draw("histo");\r
- //Pad 3: Y\r
- c3->cd(3);\r
- TH1D *hvar14 = cf->ShowProjection(14+icasType/2,icasType);\r
- hvar14->Draw("histo");\r
- //Pad 4: Cascade proper length\r
- c3->cd(4);\r
- TH1D *hvar18;\r
- hvar18 = cf->ShowProjection(16,icasType);\r
- hvar18->GetXaxis()->SetRangeUser(0.,90.);\r
- hvar18->Draw("histo");\r
- //Pad 5: V0 proper length \r
- c3->cd(5);\r
- TH1D *hvar19;\r
- hvar19 = cf->ShowProjection(17,icasType);\r
- hvar19->GetXaxis()->SetRangeUser(0.,90.);\r
- hvar19->Draw("histo");\r
- //Pad 6\r
- // empty \r
- if (collidingsystem == 1) c3->SaveAs("MultistrangeQA.pdf)");\r
- else if (collidingsystem == 0) c3->SaveAs("MultistrangeQA.pdf");\r
-\r
- \r
- //DEFINE 4st CANVAS AND DRAW PLOTS\r
- TCanvas *c4 = new TCanvas("c4","",600,400);\r
- c4->Divide(2,1);\r
- //Pad1: invariant mass fit\r
- c4->cd(1);\r
- TH1D *hvar18 = cf->ShowProjection(11+icasType/2,icasType);\r
- hvar18->Draw("histo");\r
- // - SOME PARAMETER VALUE\r
- Bool_t kfitgauss = kFALSE;\r
- Bool_t kfitleft = kFALSE;\r
- Bool_t kfitright = kFALSE;\r
- Int_t ptbinNarrowY = 0;\r
- if (icasType < 2) ptbinNarrowY = 10; // 6;\r
- else ptbinNarrowY = 3; // 2;\r
- // - SOME DEFINITIONS\r
- Float_t lowlimmass;\r
- Float_t uplimmass;\r
- Float_t lowgausslim;\r
- Float_t upgausslim;\r
- if (icasType==0||icasType==1) {\r
- lowlimmass=1.30;\r
- uplimmass=1.34;\r
- lowgausslim=1.312;\r
- upgausslim=1.332;\r
- } else {\r
- lowlimmass=1.645;\r
- uplimmass=1.70;\r
- lowgausslim=1.668;\r
- upgausslim=1.678;\r
- }\r
- TF1* fitinvmass = new TF1("fitinvmass","gaus(0)+pol2(3)",lowlimmass,uplimmass);\r
- fitinvmass->SetParName(0, "cnstntG");\r
- fitinvmass->SetParName(1, "meanG");\r
- fitinvmass->SetParName(2, "sigmaG");\r
- fitinvmass->SetParLimits(0,0.,500000.);\r
- if (icasType==0||icasType==1) {\r
- fitinvmass->SetParameter(1, 1.32171);\r
- fitinvmass->SetParLimits(1, 1.31,1.33);\r
- fitinvmass->SetParLimits(2,0.001,0.005);\r
- } else {\r
- fitinvmass->SetParameter(1, 1.67245);\r
- fitinvmass->SetParLimits(1, 1.664,1.68);\r
- fitinvmass->SetParLimits(2,0.0008,0.006);\r
- }\r
- hvar18->Fit("fitinvmass","rimeN");\r
- fitinvmass->SetLineColor(kRed);\r
- fitinvmass->Draw("same");\r
- Float_t meanGauss = fitinvmass->GetParameter(1);\r
- Float_t sigmaGauss = fitinvmass->GetParameter(2);\r
- cout<<"Mean: "<<meanGauss<<endl;\r
- cout<<"Sigma: "<<sigmaGauss<<endl;\r
- //Pad2: Text\r
- c4->cd(2);\r
- Float_t refwidth = 0.002;\r
- TPaveText *pave1 = new TPaveText(0.05,0.3,0.95,0.5);\r
- pave1->SetFillColor(0);\r
- pave1->SetTextSize(0.04);\r
- pave1->SetTextAlign(12);\r
- if (icasType < 2) pave1->AddText("PDG mass: 1.32171 GeV/c^{2}");\r
- else pave1->AddText("PDG mass: 1.67245 GeV/c^{2}");\r
- pave1->AddText(Form("#color[1]{Mass form Fit: %.5f #pm %.5f GeV/c^{2}}",meanGauss,sigmaGauss));\r
- if (sigmaGauss > refwidth - 0.0003 && sigmaGauss < refwidth + 0.0003) pave1->AddText("#color[3]{OK!! The width is compatible with standard.}");\r
- else pave1->AddText("#color[2]{NOT OK!! Problem.}");\r
- pave1->Draw();\r
- cout<<" "<<refwidth - 0.0003<<"<"<<sigmaGauss<<"<"<<refwidth + 0.0003<<endl;\r
- \r
- //DEFINE 5st CANVAS AND DRAW PLOTS\r
- if (collidingsystem == 0) {\r
- TCanvas *c5 = new TCanvas("c5","",1200,270);\r
- c5->Divide(2,1);\r
- //Pad 1: centrality\r
- c5->cd(1);\r
- TH1D *hvar16 = cf->ShowProjection(19,icasType);\r
- hvar16->Draw("histo");\r
- //Pad 2: track multiplicity\r
- c5->cd(2);\r
- TH1D *hvar17 = cf->ShowProjection(20,icasType);\r
- hvar17->Draw("histo");\r
- c5->SaveAs("MultistrangeQA.pdf)");\r
- }\r
- \r
-\r
-}\r
-\r
-\r
-\r
-\r
-Bool_t checkUnderTheLimit(TH1D *lHist, Double_t limit) {\r
-\r
- Int_t binlimit = lHist->FindBin(limit);\r
- Bool_t checkOk = kTRUE;\r
- for (Int_t i = 1; i < binlimit; i++) {\r
- Int_t content = 0;\r
- content = lHist->GetBinContent(i);\r
- if (content != 0) checkOk = kFALSE;\r
- //cout<<"Content bin "<<i<<": "<<content<<endl;\r
- }\r
- return checkOk;\r
-\r
-}\r
-\r
-\r
-Bool_t checkOverTheLimit(TH1D *lHist, Double_t limit) {\r
-\r
- Int_t binlimit = lHist->FindBin(limit);\r
- Int_t lastbin = lHist->GetNbinsX();\r
- Bool_t checkOk = kTRUE;\r
- for (Int_t i = binlimit; i < lastbin+1; i++) {\r
- Int_t content = 0;\r
- content = lHist->GetBinContent(i);\r
- if (content != 0) checkOk = kFALSE;\r
- //cout<<"Content bin "<<i<<": "<<content<<endl;\r
- }\r
- return checkOk;\r
-\r
-}\r
-\r
-\r
+//////////////////////////////////////////////////
+//
+// This macro was written by Domenico Colella (domenico.colella@cern.ch).
+// 12 November 2013
+//
+// ------ Arguments
+// -- icasType = 0) Xi- 1) Xi+ 2) Omega- 3) Omega+
+// -- collidingsystem = 0) PbPb 1) pp
+// -- fileDir = "Input file directory"
+// -- filein = "Input file name"
+//
+// ------ QATask output content
+// The output produced by the QATask is a CFContainer with 4 steps and 21 variables.
+// The meaning of each variable within the container are listed here:
+// -- 0 = Max DCA Cascade Daughters pp: 2.0 PbPb: 0.3
+// -- 1 = Min DCA Bach To PV pp: 0.01 PbPb: 0.03
+// -- 2 = Min Cascade Cosine Of PA pp: 0.98 PbPb: 0.999
+// -- 3 = Min Cascade Radius Fid. Vol. pp: 0.2 PbPb: 0.9
+// -- 4 = Window Invariant Mass Lambda pp: 0.008 PbPb: 0.0008
+// -- 5 = Max DCA V0 Daughters pp: 1.5 PbPb: 1.0
+// -- 6 = Min V0 Cosine Of PA To PV pp: pT dep. PbPb: 0.98
+// -- 7 = Min V0 Radius Fid. Vol. pp: 0.2 PbPb: 0.9
+// -- 8 = Min DCA V0 To PV pp: 0.01 PbPb: 0.05
+// -- 9 = Min DCA Pos To PV pp: 0.05 PbPb: 0.1
+// -- 10 = Min DCA Neg To PV pp: 0.05 PbPb: 0.1
+// -- 11 = Invariant Mass distribution for Xi
+// -- 12 = Invariant Mass distribution for Omega
+// -- 13 = Transverse Momentum distribution
+// -- 14 = Rapidity distribution for Xi
+// -- 15 = Rapidity distribution for Omega
+// -- 16 = Proper length distribution for the cascade
+// -- 17 = Proper length distribution for the V0
+// -- 18 = Min V0 Cosine Of PA To Xi Vertex pp: pT dep. PbPb: pT dep.
+// -- 19 = Centrality
+// -- 20 = ESD track multiplicity
+// The last two variables are empty in the case proton-proton collisions.
+//
+// ------ Present Macro Check
+// With this macro are produced the plots of the distributions for the topological
+// variables used during the reconstruction of the cascades and defined in the two
+// classes AliCascadeVertexer.cxx and AliV0vertexer.cxx contained in /STEER/ESD/
+// folder in Aliroot.
+//
+// -- First Canvas: DCA cascade daughters, Bachelor IP to PV, Cascade cosine of PA
+// Cascade radius of fiducial volume, Invariant mass Lambda,
+// DCA V0 daughters.
+// -- Second Canvas: V0 cosine of PA to PV, Min V0 Radius Fid. Vol., Min DCA V0 To PV
+// Min DCA Pos To PV, Min DCA Neg To PV, V0 cosine of PA to XiV
+//
+// In this plots, in correspondence to the min/max cut value adopted in the reconstruction
+// a line is drawn, to check if there is same problem in the cuts definition.
+//
+// Also, other specific distribution for the selected cascades are ploted as: the
+// invariant mass distribution, the transverse momentum distribution, the rapidity
+// distribution, proper length distribution for the cascade and the v0.
+//
+// -- Third Canvas: InvMass, Transverse momentum, Cascade proper length, V0 proper length
+//
+// In the end, only for thr PbPb collision the centrality distribution and the
+// track multiplicity distribution are sored.
+//
+// -- Fourth Canvas: Centrality, track multiplicity
+//
+//
+//////////////////////////////////////////////////////
+
+
+
+
+class AliCFContainer;
+
+void multistrangeQA(Int_t icasType = 0, // 0) Xi- 1) Xi+ 2) Omega- 3) Omega+
+ Int_t collidingsystem = 0, // 0) PbPb 1) pp
+ Char_t *fileDir = "./", // Input file directory
+ Char_t *filein = "AnalysisResults_AOD.root" // Input file name
+ ) {
+
+
+ /////////////
+ gStyle->SetOptStat(1110);
+ gStyle->SetOptStat(kFALSE);
+ gStyle->SetOptTitle(kFALSE);
+ gStyle->SetFrameLineWidth(2.5);
+ gStyle->SetCanvasColor(0);
+ gStyle->SetPadColor(0);
+ gStyle->SetHistLineWidth(2.5);
+ gStyle->SetLabelSize(0.05, "x");
+ gStyle->SetLabelSize(0.05, "y");
+ gStyle->SetTitleSize(0.05, "x");
+ gStyle->SetTitleSize(0.05, "y");
+ gStyle->SetTitleOffset(1.1, "x");
+ gStyle->SetPadBottomMargin(0.14);
+ gSystem->Load("libANALYSIS.so");
+ gSystem->Load("libANALYSISalice.so");
+ gSystem->Load("libCORRFW.so");
+
+
+
+ TFile *f1 = new TFile(Form("%s/%s",fileDir,filein));
+ AliCFContainer *cf = (AliCFContainer*) (f1->Get("PWGLFStrangeness.outputCheckCascade/fCFContCascadeCuts"));
+
+
+ //DEEFINE TEXT
+ TLatex* t1 = new TLatex(0.6,0.55,"#color[3]{OK!!}");
+ t1->SetTextSize(0.1);
+ t1->SetNDC();
+ TLatex* t2 = new TLatex(0.6,0.55,"#color[2]{NOT OK!!}");
+ t2->SetTextSize(0.1);
+ t2->SetNDC();
+ t2->SetTextColor(2);
+ TLatex* tcasc;
+ if (icasType == 0) tcasc = new TLatex(0.8,0.7,"#color[1]{#Xi^{-}}");
+ else if (icasType == 1) tcasc = new TLatex(0.8,0.7,"#color[1]{#Xi^{+}}");
+ else if (icasType == 2) tcasc = new TLatex(0.8,0.7,"#color[1]{#Omega^{-}}");
+ else if (icasType == 3) tcasc = new TLatex(0.8,0.7,"#color[1]{#Omega^{+}}");
+ tcasc->SetTextSize(0.2);
+ tcasc->SetNDC();
+ tcasc->SetTextColor(2);
+ TLatex* tpdgmass;
+ if (icasType == 0) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.321 GeV/c^{2}}");
+ else if (icasType == 1) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.321 GeV/c^{2}}");
+ else if (icasType == 2) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.672 GeV/c^{2}}");
+ else if (icasType == 3) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.672 GeV/c^{2}}");
+ tpdgmass->SetTextSize(0.07);
+ tpdgmass->SetNDC();
+ tpdgmass->SetTextColor(2);
+
+ //DEFINE 1st CANVAS AND DRAW PLOTS
+ TCanvas *c1 = new TCanvas("c1","",1200,800);
+ c1->Divide(2,3);
+ //Pad 1: DCA cascade daughters
+ c1->cd(1);
+ gPad->SetLogy();
+ TH1D *hvar0 = cf->ShowProjection(0,icasType);
+ hvar0->Draw("histo");
+ Double_t x0;
+ if (collidingsystem == 0) x0 = 0.3;
+ else if (collidingsystem == 1) x0 = 2.0;
+ TLine *line0 = new TLine(x0,0.,x0,hvar0->GetBinContent(hvar0->GetMaximumBin()));
+ line0->SetLineColor(kRed);
+ line0->SetLineStyle(9);
+ line0->SetLineWidth(2.0);
+ line0->Draw("same");
+ Bool_t check_0 = checkOverTheLimit(hvar0, x0);
+ if (check_0) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ tcasc->Draw();
+ //Pad 2: Bachelor IP to PV
+ c1->cd(2);
+ gPad->SetLogy();
+ TH1D *hvar1 = cf->ShowProjection(1,icasType);
+ hvar1->GetXaxis()->SetRangeUser(0.,0.24);
+ hvar1->Draw("histo");
+ Double_t x1;
+ if (collidingsystem == 0) x1 = 0.03;
+ else if (collidingsystem == 1) x1 = 0.01;
+ TLine *line1 = new TLine(x1,0.,x1,hvar1->GetBinContent(hvar1->GetMaximumBin()));
+ line1->SetLineColor(kRed);
+ line1->SetLineStyle(9);
+ line1->SetLineWidth(2.0);
+ line1->Draw("same");
+ Bool_t check_1 = checkUnderTheLimit(hvar1, x1);
+ if (check_1) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 3: Cascade cosine of Pointing Angle
+ c1->cd(3);
+ gPad->SetLogy();
+ TH1D *hvar2 = cf->ShowProjection(2,icasType);
+ Double_t max2 = hvar2->GetBinContent(hvar2->GetMaximumBin());
+ hvar2->GetYaxis()->SetRangeUser(0.01,max2*1.5);
+ hvar2->Draw("histo");
+ Double_t x2;
+ if (collidingsystem == 0) x2 = 0.999;
+ else if (collidingsystem == 1) x2 = 0.98;
+ TLine *line2 = new TLine(x2,0.,x2,hvar2->GetBinContent(hvar2->GetMaximumBin()));
+ line2->SetLineColor(kRed);
+ line2->SetLineStyle(9);
+ line2->SetLineWidth(2.0);
+ line2->Draw("same");
+ line1->Draw("same");
+ Bool_t check_2 = checkUnderTheLimit(hvar2, x2);
+ if (check_2) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 4: Cascade radius of fiducial volume
+ c1->cd(4);
+ gPad->SetLogy();
+ TH1D *hvar3 = cf->ShowProjection(3,icasType);
+ hvar3->GetXaxis()->SetRangeUser(0.,3.8);
+ hvar3->Draw("histo");
+ Double_t x3;
+ if (collidingsystem == 0) x3 = 0.9;
+ else if (collidingsystem == 1) x3 = 0.2;
+ TLine *line3 = new TLine(x3,0.,x3,hvar3->GetBinContent(hvar3->GetMaximumBin()));
+ line3->SetLineColor(kRed);
+ line3->SetLineStyle(9);
+ line3->SetLineWidth(2.0);
+ line3->Draw("same");
+ Bool_t check_3 = checkUnderTheLimit(hvar3, x3);
+ if (check_3) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 5: Invariant mass Lambda
+ c1->cd(5);
+ TH1D *hvar4 = cf->ShowProjection(4,icasType);
+ hvar4->Draw("histo");
+ Double_t x41 = 1.116 + 0.008;
+ TLine *line41 = new TLine(x41,0.,x41,hvar4->GetBinContent(hvar4->GetMaximumBin()));
+ line41->SetLineColor(kRed);
+ line41->SetLineStyle(9);
+ line41->SetLineWidth(2.0);
+ line41->Draw("same");
+ Double_t x42 = 1.115 - 0.008;
+ TLine *line42 = new TLine(x42,0.,x42,hvar4->GetBinContent(hvar4->GetMaximumBin()));
+ line42->SetLineColor(kRed);
+ line42->SetLineStyle(9);
+ line42->SetLineWidth(2.0);
+ line42->Draw("same");
+ Bool_t check_4_1 = checkUnderTheLimit(hvar3, x3);
+ Bool_t check_4_2 = checkOverTheLimit(hvar0, x0);
+ if (check_4_1 && check_4_2) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 6: DCA V0 daughters
+ c1->cd(6);
+ gPad->SetLogy();
+ TH1D *hvar5 = cf->ShowProjection(5,icasType);
+ hvar5->Draw("histo");
+ Double_t x5;
+ if (collidingsystem == 0) x5 = 1.0;
+ else if (collidingsystem == 1) x5 = 1.5;
+ TLine *line5 = new TLine(x5,0.,x5,hvar5->GetBinContent(hvar5->GetMaximumBin()));
+ line5->SetLineColor(kRed);
+ line5->SetLineStyle(9);
+ line5->SetLineWidth(2.0);
+ line5->Draw("same");
+ Bool_t check_5 = checkOverTheLimit(hvar5, x5);
+ if (check_5) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ c1->SaveAs("MultistrangeQA.pdf(");
+
+
+ //DEFINE 2st CANVAS AND DRAW PLOTS
+ TCanvas *c2 = new TCanvas("c2","",1200,800);
+ c2->Divide(2,3);
+ //Pad 1: V0 cosine of Pointing Angle to PV
+ c2->cd(1);
+ gPad->SetLogy();
+ TH1D *hvar6 = cf->ShowProjection(6,icasType);
+ Double_t max6 = hvar6->GetBinContent(hvar6->GetMaximumBin());
+ hvar6->GetYaxis()->SetRangeUser(0.01,max6*1.5);
+ hvar6->Draw("histo");
+ //Pad 2: Min V0 Radius Fid. Vol.
+ c2->cd(2);
+ gPad->SetLogy();
+ TH1D *hvar7 = cf->ShowProjection(7,icasType);
+ hvar7->GetXaxis()->SetRangeUser(0.,3.0);
+ hvar7->Draw("histo");
+ Double_t x7;
+ if (collidingsystem == 0) x7 = 0.9;
+ else if (collidingsystem == 1) x7 = 0.2;
+ TLine *line7 = new TLine(x7,0.,x7,hvar7->GetBinContent(hvar7->GetMaximumBin()));
+ line7->SetLineColor(kRed);
+ line7->SetLineStyle(9);
+ line7->SetLineWidth(2.0);
+ line7->Draw("same");
+ Bool_t check_7 = checkUnderTheLimit(hvar7, x7);
+ if (check_7) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad3: Min DCA V0 To PV
+ c2->cd(3);
+ gPad->SetLogy();
+ TH1D *hvar8 = cf->ShowProjection(8,icasType);
+ hvar8->GetXaxis()->SetRangeUser(0.,0.3);
+ hvar8->Draw("histo");
+ Double_t x8;
+ if (collidingsystem == 0) x8 = 0.05;
+ else if (collidingsystem == 1) x8 = 0.01;
+ TLine *line8 = new TLine(x8,0.,x8,hvar8->GetBinContent(hvar8->GetMaximumBin()));
+ line8->SetLineColor(kRed);
+ line8->SetLineStyle(9);
+ line8->SetLineWidth(2.0);
+ line8->Draw("same");
+ Bool_t check_8 = checkUnderTheLimit(hvar8, x8);
+ if (check_8) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 4: Min DCA Pos To PV
+ c2->cd(4);
+ gPad->SetLogy();
+ TH1D *hvar9 = cf->ShowProjection(9,icasType);
+ hvar9->GetXaxis()->SetRangeUser(0.,0.2);
+ hvar9->Draw("histo");
+ Double_t x9;
+ if (collidingsystem == 0) x9 = 0.1;
+ else if (collidingsystem == 1) x9 = 0.05;
+ TLine *line9 = new TLine(x9,0.,x9,hvar9->GetBinContent(hvar9->GetMaximumBin()));
+ line9->SetLineColor(kRed);
+ line9->SetLineStyle(9);
+ line9->SetLineWidth(2.0);
+ line9->Draw("same");
+ Bool_t check_9 = checkUnderTheLimit(hvar9, x9);
+ if (check_9) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 5: Min DCA Neg To PV
+ c2->cd(5);
+ gPad->SetLogy();
+ TH1D *hvar10 = cf->ShowProjection(10,icasType);
+ hvar10->GetXaxis()->SetRangeUser(0.,0.2);
+ hvar10->Draw("histo");
+ Double_t x10;
+ if (collidingsystem == 0) x10 = 0.1;
+ else if (collidingsystem == 1) x10 = 0.05;
+ TLine *line10 = new TLine(x10,0.,x10,hvar10->GetBinContent(hvar10->GetMaximumBin()));
+ line10->SetLineColor(kRed);
+ line10->SetLineStyle(9);
+ line10->SetLineWidth(2.0);
+ line10->Draw("same");
+ Bool_t check_10 = checkUnderTheLimit(hvar10, x10);
+ if (check_10) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
+ else { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
+ //Pad 6: V0 cosine of Pointing Angle to XiV
+ c2->cd(6);
+ gPad->SetLogy();
+ TH1D *hvar20 = cf->ShowProjection(18,icasType);
+ Double_t max20 = hvar20->GetBinContent(hvar20->GetMaximumBin());
+ hvar20->GetYaxis()->SetRangeUser(0.01,max20*1.5);
+ hvar20->Draw("histo");
+ c2->SaveAs("MultistrangeQA.pdf");
+
+ //DEFINE 3st CANVAS AND DRAW PLOTS
+ TCanvas *c3 = new TCanvas("c3","",1200,800);
+ c3->Divide(2,3);
+ //Pad 1: InvMass
+ c3->cd(1);
+ TH1D *hvar12 = cf->ShowProjection(11+icasType/2,icasType);
+ hvar12->Draw("histo");
+ tpdgmass->Draw();
+ TLine *linemass;
+ if (icasType == 0) linemass = new TLine(1.32171,0.,1.32171,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
+ else if (icasType == 1) linemass = new TLine(1.32171,0.,1.32171,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
+ else if (icasType == 2) linemass = new TLine(1.67245,0.,1.67245,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
+ else if (icasType == 3) linemass = new TLine(1.67245,0.,1.67245,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
+ linemass->SetLineColor(kRed);
+ linemass->SetLineStyle(1);
+ linemass->SetLineWidth(2.0);
+ linemass->Draw("same");
+ //Pad 2: Transverse momentum
+ c3->cd(2);
+ TH1D *hvar13 = cf->ShowProjection(13,icasType);
+ hvar13->Draw("histo");
+ //Pad 3: Y
+ c3->cd(3);
+ TH1D *hvar14 = cf->ShowProjection(14+icasType/2,icasType);
+ hvar14->Draw("histo");
+ //Pad 4: Cascade proper length
+ c3->cd(4);
+ TH1D *hvar18;
+ hvar18 = cf->ShowProjection(16,icasType);
+ hvar18->GetXaxis()->SetRangeUser(0.,90.);
+ hvar18->Draw("histo");
+ //Pad 5: V0 proper length
+ c3->cd(5);
+ TH1D *hvar19;
+ hvar19 = cf->ShowProjection(17,icasType);
+ hvar19->GetXaxis()->SetRangeUser(0.,90.);
+ hvar19->Draw("histo");
+ //Pad 6
+ // empty
+ if (collidingsystem == 1) c3->SaveAs("MultistrangeQA.pdf)");
+ else if (collidingsystem == 0) c3->SaveAs("MultistrangeQA.pdf");
+
+
+ //DEFINE 4st CANVAS AND DRAW PLOTS
+ TCanvas *c4 = new TCanvas("c4","",600,400);
+ c4->Divide(2,1);
+ //Pad1: invariant mass fit
+ c4->cd(1);
+ TH1D *hvar18 = cf->ShowProjection(11+icasType/2,icasType);
+ hvar18->Draw("histo");
+ // - SOME PARAMETER VALUE
+ Bool_t kfitgauss = kFALSE;
+ Bool_t kfitleft = kFALSE;
+ Bool_t kfitright = kFALSE;
+ Int_t ptbinNarrowY = 0;
+ if (icasType < 2) ptbinNarrowY = 10; // 6;
+ else ptbinNarrowY = 3; // 2;
+ // - SOME DEFINITIONS
+ Float_t lowlimmass;
+ Float_t uplimmass;
+ Float_t lowgausslim;
+ Float_t upgausslim;
+ if (icasType==0||icasType==1) {
+ lowlimmass=1.30;
+ uplimmass=1.34;
+ lowgausslim=1.312;
+ upgausslim=1.332;
+ } else {
+ lowlimmass=1.645;
+ uplimmass=1.70;
+ lowgausslim=1.668;
+ upgausslim=1.678;
+ }
+ TF1* fitinvmass = new TF1("fitinvmass","gaus(0)+pol2(3)",lowlimmass,uplimmass);
+ fitinvmass->SetParName(0, "cnstntG");
+ fitinvmass->SetParName(1, "meanG");
+ fitinvmass->SetParName(2, "sigmaG");
+ fitinvmass->SetParLimits(0,0.,500000.);
+ if (icasType==0||icasType==1) {
+ fitinvmass->SetParameter(1, 1.32171);
+ fitinvmass->SetParLimits(1, 1.31,1.33);
+ fitinvmass->SetParLimits(2,0.001,0.005);
+ } else {
+ fitinvmass->SetParameter(1, 1.67245);
+ fitinvmass->SetParLimits(1, 1.664,1.68);
+ fitinvmass->SetParLimits(2,0.0008,0.006);
+ }
+ hvar18->Fit("fitinvmass","rimeN");
+ fitinvmass->SetLineColor(kRed);
+ fitinvmass->Draw("same");
+ Float_t meanGauss = fitinvmass->GetParameter(1);
+ Float_t sigmaGauss = fitinvmass->GetParameter(2);
+ cout<<"Mean: "<<meanGauss<<endl;
+ cout<<"Sigma: "<<sigmaGauss<<endl;
+ //Pad2: Text
+ c4->cd(2);
+ Float_t refwidth = 0.002;
+ TPaveText *pave1 = new TPaveText(0.05,0.3,0.95,0.5);
+ pave1->SetFillColor(0);
+ pave1->SetTextSize(0.04);
+ pave1->SetTextAlign(12);
+ if (icasType < 2) pave1->AddText("PDG mass: 1.32171 GeV/c^{2}");
+ else pave1->AddText("PDG mass: 1.67245 GeV/c^{2}");
+ pave1->AddText(Form("#color[1]{Mass form Fit: %.5f #pm %.5f GeV/c^{2}}",meanGauss,sigmaGauss));
+ if (sigmaGauss > refwidth - 0.0003 && sigmaGauss < refwidth + 0.0003) pave1->AddText("#color[3]{OK!! The width is compatible with standard.}");
+ else pave1->AddText("#color[2]{NOT OK!! Problem.}");
+ pave1->Draw();
+ cout<<" "<<refwidth - 0.0003<<"<"<<sigmaGauss<<"<"<<refwidth + 0.0003<<endl;
+
+ //DEFINE 5st CANVAS AND DRAW PLOTS
+ if (collidingsystem == 0) {
+ TCanvas *c5 = new TCanvas("c5","",1200,270);
+ c5->Divide(2,1);
+ //Pad 1: centrality
+ c5->cd(1);
+ TH1D *hvar16 = cf->ShowProjection(19,icasType);
+ hvar16->Draw("histo");
+ //Pad 2: track multiplicity
+ c5->cd(2);
+ TH1D *hvar17 = cf->ShowProjection(20,icasType);
+ hvar17->Draw("histo");
+ c5->SaveAs("MultistrangeQA.pdf)");
+ }
+
+
+}
+
+
+
+
+Bool_t checkUnderTheLimit(TH1D *lHist, Double_t limit) {
+
+ Int_t binlimit = lHist->FindBin(limit);
+ Bool_t checkOk = kTRUE;
+ for (Int_t i = 1; i < binlimit; i++) {
+ Int_t content = 0;
+ content = lHist->GetBinContent(i);
+ if (content != 0) checkOk = kFALSE;
+ //cout<<"Content bin "<<i<<": "<<content<<endl;
+ }
+ return checkOk;
+
+}
+
+
+Bool_t checkOverTheLimit(TH1D *lHist, Double_t limit) {
+
+ Int_t binlimit = lHist->FindBin(limit);
+ Int_t lastbin = lHist->GetNbinsX();
+ Bool_t checkOk = kTRUE;
+ for (Int_t i = binlimit; i < lastbin+1; i++) {
+ Int_t content = 0;
+ content = lHist->GetBinContent(i);
+ if (content != 0) checkOk = kFALSE;
+ //cout<<"Content bin "<<i<<": "<<content<<endl;
+ }
+ return checkOk;
+
+}
+
+
-#ifndef __CINT__\r
-#include <AliRsnCutTrackQuality.h>\r
-#endif\r
-Int_t AddRsnDaughterCutsPhiNsigma(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)\r
-{\r
-\r
- if (!rsnIH) return 0;\r
- \r
- Bool_t valid = kTRUE;\r
- // Int_t collisionType = AliRsnTrainManager::GetGlobalInt("IsCollisionType",valid);\r
- Int_t useCommonQualityCut = AliRsnTrainManager::GetGlobalInt("RsnCommonQualityCut",valid);\r
- TString rsnQualityCut = AliRsnTrainManager::GetGlobalStr("RsnQualityCut",valid);\r
- Int_t isMC = AliRsnTrainManager::GetGlobalInt("IsMC",valid);\r
- Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid);\r
- Int_t isMixing = AliRsnTrainManager::GetGlobalInt("IsMixing",valid);\r
-\r
- // experts only (don't touch)\r
- Int_t isRsnDev = AliAnalysisManager::GetGlobalInt("rsnUseRSNParDev",valid);\r
-\r
- // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====\r
- Int_t numberOfCuts = 1;\r
-\r
- //---------------------------------------------\r
- // Define single cuts\r
- //---------------------------------------------\r
-\r
- Printf("AliRsnCutPIDNSigma Option : %s",opt.Data());\r
-\r
- Double_t nSigmaTPC=3.0;\r
- Double_t nSigmaTOF=3.0;\r
- Double_t etaMin=-0.8;\r
- Double_t etaMax=0.8;\r
- Double_t trackPtMin=0.;\r
- Double_t trackPtMax=1.e10;\r
- Int_t NclTPC=70;\r
- Char_t DCAxyFormula[100]="0.0182+0.035/pt^1.01";\r
-\r
- Bool_t useTPC_K=kFALSE;\r
- Bool_t useTOF_K=kFALSE;\r
- Bool_t rejectUnmatchedTOF_K=kTRUE;\r
- Bool_t useTrackPtCut=kFALSE;\r
-\r
- if (opt.Contains("qualityonly")) {\r
- useTPC_K=kFALSE;\r
- useTOF_K=kFALSE;\r
- }\r
-\r
- if (opt.Contains("KTPCnsig")) useTPC_K=kTRUE;\r
- if (opt.Contains("KTOFnsig")) useTOF_K=kTRUE;\r
- if (opt.Contanns("KTOFacceptUnmatched")) rejectUnmatchedTOF_K=kFALSE;\r
-\r
- if (opt.Contains("KTPCnsig05")) nSigmaTPC = 0.5;\r
- if (opt.Contains("KTPCnsig08")) nSigmaTPC = 0.8;\r
- if (opt.Contains("KTPCnsig10")) nSigmaTPC = 1.0;\r
- if (opt.Contains("KTPCnsig15")) nSigmaTPC = 1.5;\r
- if (opt.Contains("KTPCnsig20")) nSigmaTPC = 2.0;\r
- if (opt.Contains("KTPCnsig25")) nSigmaTPC = 2.5;\r
- if (opt.Contains("KTPCnsig30")) nSigmaTPC = 3.0;\r
- if (opt.Contains("KTPCnsig40")) nSigmaTPC = 4.0;\r
- if (opt.Contains("KTPCnsig50")) nSigmaTPC = 5.0;\r
- if (opt.Contains("KTPCnsig1000")) nSigmaTPC = 100.0;\r
-\r
- if (opt.Contains("KTOFnsig10")) nSigmaTOF = 1.0;\r
- if (opt.Contains("KTOFnsig15")) nSigmaTOF = 1.5;\r
- if (opt.Contains("KTOFnsig20")) nSigmaTOF = 2.0;\r
- if (opt.Contains("KTOFnsig25")) nSigmaTOF = 2.5;\r
- if (opt.Contains("KTOFnsig30")) nSigmaTOF = 3.0;\r
- if (opt.Contains("KTOFnsig40")) nSigmaTOF = 4.0;\r
- if (opt.Contains("KTOFnsig50")) nSigmaTOF = 5.0;\r
- if (opt.Contains("KTOFnsig1000")) nSigmaTOF = 100.0;\r
-\r
- if (opt.Contains("trackPt")) {\r
- useTrackPtCut = kTRUE;\r
- if (opt.Contains("trackPtMin015")) trackPtMin = 0.15;\r
- if (opt.Contains("trackPtMin02")) trackPtMin = 0.2;\r
- if (opt.Contains("trackPtMin05")) trackPtMin = 0.5;\r
- if (opt.Contains("trackPtMin06")) trackPtMin = 0.6;\r
-\r
- if (opt.Contains("trackPtMax18")) trackPtMax = 1.8;\r
- if (opt.Contains("trackPtMax20")) trackPtMax = 2.0;\r
- if (opt.Contains("trackPtMax25")) trackPtMax = 2.5;\r
- }\r
-\r
- Bool_t usePDG=kFALSE;\r
- if (opt.Contains("pdg")) {\r
- Printf("Using PDG");\r
- usePDG = kTRUE;\r
- }\r
-\r
- Bool_t useEta = kFALSE;\r
- if (opt.Contains("eta")) {\r
- for(int j=1;j<=9;j++) if(opt.Contains(Form("eta0%i",j))){etaMin=-0.1*j; etaMax=0.1*j;}\r
-\r
- for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinMinus0%i",j))) etaMin=-0.1*j;\r
- if(opt.Contains("etaMin00")) etaMin=0.;\r
- for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinPlus0%i",j))) etaMin=0.1*j;\r
-\r
- for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxMinus0%i",j))) etaMax=-0.1*j;\r
- if(opt.Contains("etaMax00")) etaMax=0.;\r
- for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxPlus0%i",j))) etaMax=0.1*j;\r
-\r
- Printf("Using ETA range (%.2f,%.2f)",etaMin,etaMax);\r
- useEta = kTRUE;\r
- }\r
-\r
- Bool_t useNclTPC = kFALSE;\r
- if (opt.Contains("NclTPC")) {\r
- if (opt.Contains("NclTPC70")) NclTPC=70;\r
- if (opt.Contains("NclTPC75")) NclTPC=75;\r
- if (opt.Contains("NclTPC80")) NclTPC=80;\r
- if (opt.Contains("NclTPC85")) NclTPC=85;\r
- if (opt.Contains("NclTPC90")) NclTPC=90;\r
- useNclTPC = kTRUE;\r
- }\r
-\r
- Bool_t useDCAxy = kFALSE;\r
- if (opt.Contains("DCAxy")) {\r
- if (opt.Contains("DCAxyFormula7s")) sprintf(DCAxyFormula,"0.0182+0.035/pt^1.01");\r
- if (opt.Contains("DCAxyFormula6s")) sprintf(DCAxyFormula,"0.0156+0.03/pt^1.01");\r
- if (opt.Contains("DCAxyFormula5s")) sprintf(DCAxyFormula,"0.013+0.025/pt^1.01");\r
- useDCAxy = kTRUE;\r
- }\r
-\r
- //---------------------------------------------\r
- // Combine cuts\r
- //---------------------------------------------\r
-\r
- TString cutname = "K_Phi";\r
- if (!opt.IsNull()) cutname += Form("_%s",opt.Data());\r
- AliRsnCutSet *cuts = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter);\r
-\r
- TString scheme="";\r
- AliRsnCutTrackQuality *qualityCut = new AliRsnCutTrackQuality("cutQualityK");\r
- if (!rsnQualityCut.IsNull()) {\r
- AliESDtrackCuts *esdTK = RsnQualityCut(rsnQualityCut.Data());\r
- if(useDCAxy) esdTK->SetMaxDCAToVertexXYPtDep(DCAxyFormula);\r
- qualityCut->SetESDtrackCuts(esdTK);\r
- } else {\r
- if (useCommonQualityCut>=0) {\r
- qualityCut->SetAODTestFilterBit(useCommonQualityCut);\r
- if(useDCAxy) {qualityCut->SetCheckOnlyFilterBit(kFALSE); qualityCut->SetDCARPtFormula(DCAxyFormula);}\r
- } else {\r
- qualityCut->SetDefaults2010();\r
- if(useDCAxy) qualityCut->SetDCARPtFormula(DCAxyFormula);\r
- }\r
- }\r
-\r
- cuts->AddCut(qualityCut);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += qualityCut->GetName();\r
-\r
-\r
- if (useTPC_K) {\r
- AliRsnCutPIDNSigma *cutKTPC = new AliRsnCutPIDNSigma("cutPIDNSigmaTPCK",AliPID::kKaon,AliRsnCutPIDNSigma::kTPC);\r
- cutKTPC->SinglePIDRange(nSigmaTPC);\r
- cuts->AddCut(cutKTPC);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += cutKTPC->GetName();\r
- }\r
-\r
- if (useTOF_K) {\r
- AliRsnCutPIDNSigma *cutKTOF = new AliRsnCutPIDNSigma("cutPIDNSigmaTOFK",AliPID::kKaon,AliRsnCutPIDNSigma::kTOF);\r
- cutKTOF->SinglePIDRange(nSigmaTOF);\r
- if(rejectUnmatchedTOF_K){\r
- cuts->AddCut(cutKTOF);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += cutKTOF->GetName();\r
- }else{\r
- AliRsnCutTOFMatch *cutTOFMatch = new AliRsnCutTOFMatch("cutTOFMatch");\r
- cuts->AddCut(cutTOFMatch);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += Form("(%s|(!%s))",cutKTOF->GetName(),cutTOFMatch->GetName());\r
- }\r
- }\r
-\r
- if (useEta) {\r
- Printf("Adding ETA ...");\r
- AliRsnValueDaughter *valEta = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta);\r
- AliRsnCutValue *cutEta = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),etaMin,etaMax);\r
- cutEta->SetTargetType(AliRsnTarget::kDaughter);\r
- cutEta->SetValueObj(valEta);\r
- cuts->AddCut(cutEta);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += cutEta->GetName();\r
- }\r
-\r
- if (useTrackPtCut) {\r
- Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax);\r
- AliRsnValueDaughter *valTrackPt = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kPt);\r
-\r
- AliRsnCutValue *cutTrackPt = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),trackPtMin,trackPtMax);\r
- cutTrackPt->SetTargetType(AliRsnTarget::kDaughter);\r
- cutTrackPt->SetValueObj(valTrackPt);\r
- cuts->AddCut(cutTrackPt);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += cutTrackPt->GetName();\r
- }\r
-\r
- if (useNclTPC) {\r
- Printf("Adding NclTPC >= %i",NclTPC);\r
- AliRsnValueDaughter *valNclTPC = new AliRsnValueDaughter(Form("val%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters);\r
- AliRsnCutValue *cutNclTPC = new AliRsnCutValue(Form("cut%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),NclTPC-0.1,1000.);\r
- cutNclTPC->SetTargetType(AliRsnTarget::kDaughter);\r
- cutNclTPC->SetValueObj(valNclTPC);\r
- cuts->AddCut(cutNclTPC);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += cutNclTPC->GetName();\r
- }\r
-\r
- if (usePDG) {\r
- Printf("Adding PDG ...");\r
- AliRsnCutPID *cutPDG = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);\r
- cuts->AddCut(cutPDG);\r
- if (!scheme.IsNull()) scheme += "&";\r
- scheme += cutPDG->GetName();\r
- }\r
-\r
- Printf ("CUT Scheme is '%s'",scheme.Data());\r
- cuts->SetCutScheme(scheme.Data());\r
-\r
- if (opt.Contains("mon")) {\r
- AddMonitorOutput(cuts->GetMonitorOutput(),opt);\r
- }\r
- if (isRsnMini) {\r
- AliRsnMiniAnalysisTask *taskRsnMini = (AliRsnMiniAnalysisTask *)task;\r
- if (taskRsnMini) {\r
- taskRsnMini->AddTrackCuts(cuts);\r
- }\r
- } else {\r
- AliRsnDaughterSelector *sel = rsnIH->GetSelector();\r
- // sel->SetLabelCheck(kFALSE);\r
- sel->Add(cuts, kTRUE);\r
- if (isRsnDev>=0 && opt.Contains("pairPID")) {\r
- AliRsnActPostDaughterSelection *pairPID = new AliRsnActPostDaughterSelection();\r
- pairPID->SetID(0);\r
-\r
- const char *fn="rsnRange.txt";\r
- if (!gSystem->AccessPathName(fn)) {\r
- TString minStr = gSystem->GetFromPipe(TString::Format("head -n 1 %s").Data());\r
- TString maxStr = gSystem->GetFromPipe(TString::Format("tail -n 1 %s").Data());\r
- pairPID->SetMass(minStr.Atof(),maxStr.Atof());\r
- } else {\r
- // pairPID->SetMass(1.01,1.03);\r
- pairPID->SetMass(1.015,1.025);\r
- pairPID->SetMass(1.019,1.021);\r
- pairPID->SetMass(1.0195,1.0205);\r
- pairPID->SetMass(1.1000,1.1005);\r
- // pairPID->SetMass(1.1005,1.1010);\r
- }\r
- sel->AddAction(pairPID);\r
- }\r
-\r
- }\r
- return numberOfCuts;\r
-\r
-}\r
+#ifndef __CINT__
+#include <AliRsnCutTrackQuality.h>
+#endif
+Int_t AddRsnDaughterCutsPhiNsigma(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
+{
+
+ if (!rsnIH) return 0;
+
+ Bool_t valid = kTRUE;
+ // Int_t collisionType = AliRsnTrainManager::GetGlobalInt("IsCollisionType",valid);
+ Int_t useCommonQualityCut = AliRsnTrainManager::GetGlobalInt("RsnCommonQualityCut",valid);
+ TString rsnQualityCut = AliRsnTrainManager::GetGlobalStr("RsnQualityCut",valid);
+ Int_t isMC = AliRsnTrainManager::GetGlobalInt("IsMC",valid);
+ Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid);
+ Int_t isMixing = AliRsnTrainManager::GetGlobalInt("IsMixing",valid);
+
+ // experts only (don't touch)
+ Int_t isRsnDev = AliAnalysisManager::GetGlobalInt("rsnUseRSNParDev",valid);
+
+ // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
+ Int_t numberOfCuts = 1;
+
+ //---------------------------------------------
+ // Define single cuts
+ //---------------------------------------------
+
+ Printf("AliRsnCutPIDNSigma Option : %s",opt.Data());
+
+ Double_t nSigmaTPC=3.0;
+ Double_t nSigmaTOF=3.0;
+ Double_t etaMin=-0.8;
+ Double_t etaMax=0.8;
+ Double_t trackPtMin=0.;
+ Double_t trackPtMax=1.e10;
+ Int_t NclTPC=70;
+ Char_t DCAxyFormula[100]="0.0182+0.035/pt^1.01";
+
+ Bool_t useTPC_K=kFALSE;
+ Bool_t useTOF_K=kFALSE;
+ Bool_t rejectUnmatchedTOF_K=kTRUE;
+ Bool_t useTrackPtCut=kFALSE;
+
+ if (opt.Contains("qualityonly")) {
+ useTPC_K=kFALSE;
+ useTOF_K=kFALSE;
+ }
+
+ if (opt.Contains("KTPCnsig")) useTPC_K=kTRUE;
+ if (opt.Contains("KTOFnsig")) useTOF_K=kTRUE;
+ if (opt.Contanns("KTOFacceptUnmatched")) rejectUnmatchedTOF_K=kFALSE;
+
+ if (opt.Contains("KTPCnsig05")) nSigmaTPC = 0.5;
+ if (opt.Contains("KTPCnsig08")) nSigmaTPC = 0.8;
+ if (opt.Contains("KTPCnsig10")) nSigmaTPC = 1.0;
+ if (opt.Contains("KTPCnsig15")) nSigmaTPC = 1.5;
+ if (opt.Contains("KTPCnsig20")) nSigmaTPC = 2.0;
+ if (opt.Contains("KTPCnsig25")) nSigmaTPC = 2.5;
+ if (opt.Contains("KTPCnsig30")) nSigmaTPC = 3.0;
+ if (opt.Contains("KTPCnsig40")) nSigmaTPC = 4.0;
+ if (opt.Contains("KTPCnsig50")) nSigmaTPC = 5.0;
+ if (opt.Contains("KTPCnsig1000")) nSigmaTPC = 100.0;
+
+ if (opt.Contains("KTOFnsig10")) nSigmaTOF = 1.0;
+ if (opt.Contains("KTOFnsig15")) nSigmaTOF = 1.5;
+ if (opt.Contains("KTOFnsig20")) nSigmaTOF = 2.0;
+ if (opt.Contains("KTOFnsig25")) nSigmaTOF = 2.5;
+ if (opt.Contains("KTOFnsig30")) nSigmaTOF = 3.0;
+ if (opt.Contains("KTOFnsig40")) nSigmaTOF = 4.0;
+ if (opt.Contains("KTOFnsig50")) nSigmaTOF = 5.0;
+ if (opt.Contains("KTOFnsig1000")) nSigmaTOF = 100.0;
+
+ if (opt.Contains("trackPt")) {
+ useTrackPtCut = kTRUE;
+ if (opt.Contains("trackPtMin015")) trackPtMin = 0.15;
+ if (opt.Contains("trackPtMin02")) trackPtMin = 0.2;
+ if (opt.Contains("trackPtMin05")) trackPtMin = 0.5;
+ if (opt.Contains("trackPtMin06")) trackPtMin = 0.6;
+
+ if (opt.Contains("trackPtMax18")) trackPtMax = 1.8;
+ if (opt.Contains("trackPtMax20")) trackPtMax = 2.0;
+ if (opt.Contains("trackPtMax25")) trackPtMax = 2.5;
+ }
+
+ Bool_t usePDG=kFALSE;
+ if (opt.Contains("pdg")) {
+ Printf("Using PDG");
+ usePDG = kTRUE;
+ }
+
+ Bool_t useEta = kFALSE;
+ if (opt.Contains("eta")) {
+ for(int j=1;j<=9;j++) if(opt.Contains(Form("eta0%i",j))){etaMin=-0.1*j; etaMax=0.1*j;}
+
+ for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinMinus0%i",j))) etaMin=-0.1*j;
+ if(opt.Contains("etaMin00")) etaMin=0.;
+ for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinPlus0%i",j))) etaMin=0.1*j;
+
+ for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxMinus0%i",j))) etaMax=-0.1*j;
+ if(opt.Contains("etaMax00")) etaMax=0.;
+ for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxPlus0%i",j))) etaMax=0.1*j;
+
+ Printf("Using ETA range (%.2f,%.2f)",etaMin,etaMax);
+ useEta = kTRUE;
+ }
+
+ Bool_t useNclTPC = kFALSE;
+ if (opt.Contains("NclTPC")) {
+ if (opt.Contains("NclTPC70")) NclTPC=70;
+ if (opt.Contains("NclTPC75")) NclTPC=75;
+ if (opt.Contains("NclTPC80")) NclTPC=80;
+ if (opt.Contains("NclTPC85")) NclTPC=85;
+ if (opt.Contains("NclTPC90")) NclTPC=90;
+ useNclTPC = kTRUE;
+ }
+
+ Bool_t useDCAxy = kFALSE;
+ if (opt.Contains("DCAxy")) {
+ if (opt.Contains("DCAxyFormula7s")) sprintf(DCAxyFormula,"0.0182+0.035/pt^1.01");
+ if (opt.Contains("DCAxyFormula6s")) sprintf(DCAxyFormula,"0.0156+0.03/pt^1.01");
+ if (opt.Contains("DCAxyFormula5s")) sprintf(DCAxyFormula,"0.013+0.025/pt^1.01");
+ useDCAxy = kTRUE;
+ }
+
+ //---------------------------------------------
+ // Combine cuts
+ //---------------------------------------------
+
+ TString cutname = "K_Phi";
+ if (!opt.IsNull()) cutname += Form("_%s",opt.Data());
+ AliRsnCutSet *cuts = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter);
+
+ TString scheme="";
+ AliRsnCutTrackQuality *qualityCut = new AliRsnCutTrackQuality("cutQualityK");
+ if (!rsnQualityCut.IsNull()) {
+ AliESDtrackCuts *esdTK = RsnQualityCut(rsnQualityCut.Data());
+ if(useDCAxy) esdTK->SetMaxDCAToVertexXYPtDep(DCAxyFormula);
+ qualityCut->SetESDtrackCuts(esdTK);
+ } else {
+ if (useCommonQualityCut>=0) {
+ qualityCut->SetAODTestFilterBit(useCommonQualityCut);
+ if(useDCAxy) {qualityCut->SetCheckOnlyFilterBit(kFALSE); qualityCut->SetDCARPtFormula(DCAxyFormula);}
+ } else {
+ qualityCut->SetDefaults2010();
+ if(useDCAxy) qualityCut->SetDCARPtFormula(DCAxyFormula);
+ }
+ }
+
+ cuts->AddCut(qualityCut);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += qualityCut->GetName();
+
+
+ if (useTPC_K) {
+ AliRsnCutPIDNSigma *cutKTPC = new AliRsnCutPIDNSigma("cutPIDNSigmaTPCK",AliPID::kKaon,AliRsnCutPIDNSigma::kTPC);
+ cutKTPC->SinglePIDRange(nSigmaTPC);
+ cuts->AddCut(cutKTPC);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += cutKTPC->GetName();
+ }
+
+ if (useTOF_K) {
+ AliRsnCutPIDNSigma *cutKTOF = new AliRsnCutPIDNSigma("cutPIDNSigmaTOFK",AliPID::kKaon,AliRsnCutPIDNSigma::kTOF);
+ cutKTOF->SinglePIDRange(nSigmaTOF);
+ if(rejectUnmatchedTOF_K){
+ cuts->AddCut(cutKTOF);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += cutKTOF->GetName();
+ }else{
+ AliRsnCutTOFMatch *cutTOFMatch = new AliRsnCutTOFMatch("cutTOFMatch");
+ cuts->AddCut(cutTOFMatch);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += Form("(%s|(!%s))",cutKTOF->GetName(),cutTOFMatch->GetName());
+ }
+ }
+
+ if (useEta) {
+ Printf("Adding ETA ...");
+ AliRsnValueDaughter *valEta = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta);
+ AliRsnCutValue *cutEta = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),etaMin,etaMax);
+ cutEta->SetTargetType(AliRsnTarget::kDaughter);
+ cutEta->SetValueObj(valEta);
+ cuts->AddCut(cutEta);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += cutEta->GetName();
+ }
+
+ if (useTrackPtCut) {
+ Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax);
+ AliRsnValueDaughter *valTrackPt = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kPt);
+
+ AliRsnCutValue *cutTrackPt = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),trackPtMin,trackPtMax);
+ cutTrackPt->SetTargetType(AliRsnTarget::kDaughter);
+ cutTrackPt->SetValueObj(valTrackPt);
+ cuts->AddCut(cutTrackPt);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += cutTrackPt->GetName();
+ }
+
+ if (useNclTPC) {
+ Printf("Adding NclTPC >= %i",NclTPC);
+ AliRsnValueDaughter *valNclTPC = new AliRsnValueDaughter(Form("val%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
+ AliRsnCutValue *cutNclTPC = new AliRsnCutValue(Form("cut%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),NclTPC-0.1,1000.);
+ cutNclTPC->SetTargetType(AliRsnTarget::kDaughter);
+ cutNclTPC->SetValueObj(valNclTPC);
+ cuts->AddCut(cutNclTPC);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += cutNclTPC->GetName();
+ }
+
+ if (usePDG) {
+ Printf("Adding PDG ...");
+ AliRsnCutPID *cutPDG = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);
+ cuts->AddCut(cutPDG);
+ if (!scheme.IsNull()) scheme += "&";
+ scheme += cutPDG->GetName();
+ }
+
+ Printf ("CUT Scheme is '%s'",scheme.Data());
+ cuts->SetCutScheme(scheme.Data());
+
+ if (opt.Contains("mon")) {
+ AddMonitorOutput(cuts->GetMonitorOutput(),opt);
+ }
+ if (isRsnMini) {
+ AliRsnMiniAnalysisTask *taskRsnMini = (AliRsnMiniAnalysisTask *)task;
+ if (taskRsnMini) {
+ taskRsnMini->AddTrackCuts(cuts);
+ }
+ } else {
+ AliRsnDaughterSelector *sel = rsnIH->GetSelector();
+ // sel->SetLabelCheck(kFALSE);
+ sel->Add(cuts, kTRUE);
+ if (isRsnDev>=0 && opt.Contains("pairPID")) {
+ AliRsnActPostDaughterSelection *pairPID = new AliRsnActPostDaughterSelection();
+ pairPID->SetID(0);
+
+ const char *fn="rsnRange.txt";
+ if (!gSystem->AccessPathName(fn)) {
+ TString minStr = gSystem->GetFromPipe(TString::Format("head -n 1 %s").Data());
+ TString maxStr = gSystem->GetFromPipe(TString::Format("tail -n 1 %s").Data());
+ pairPID->SetMass(minStr.Atof(),maxStr.Atof());
+ } else {
+ // pairPID->SetMass(1.01,1.03);
+ pairPID->SetMass(1.015,1.025);
+ pairPID->SetMass(1.019,1.021);
+ pairPID->SetMass(1.0195,1.0205);
+ pairPID->SetMass(1.1000,1.1005);
+ // pairPID->SetMass(1.1005,1.1010);
+ }
+ sel->AddAction(pairPID);
+ }
+
+ }
+ return numberOfCuts;
+
+}
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-// LHC10x config for deuterons and antideuterons\r
-// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>\r
-\r
-#if !defined(__CINT__) || defined(__MAKECINT__)\r
-#include <TROOT.h>\r
-#include <TString.h>\r
-#include "AliLnDriver.h"\r
-#endif\r
-\r
-#include "Config.h"\r
-\r
-Int_t Config_Deuteron_TOF_LHC10x( const TString& inputDir = "~/alice/input"\r
- , const TString& outputDir = "~/alice/output"\r
- , const TString& period = "lhc10bcde"\r
- , const TString& outputTag = "lhc10bcde"\r
- , const TString& trkselTag = "-tpc3-nsd-moc"\r
- , const TString& multTag = ""\r
- , const TString& multCorTag = ""\r
- , Double_t ymax = 0.5\r
- , Bool_t inel = 0 // for mult\r
- , Bool_t drawOutput = 1 // for batch\r
- , Double_t ptmin = 0.7\r
- , Double_t ptmax = 3.0\r
- , Double_t ptpid = 0.8\r
- , Bool_t makeStats = 1\r
- , Bool_t makeCor = 1\r
- , Bool_t makePt = 1\r
- , Bool_t makeRatio = 1\r
- , Bool_t makeSpectra = 1)\r
-{\r
-//\r
-// lhc10b, lhc10c, lhc10d, lhc10e config for deuterons and antideuterons\r
-//\r
- const TString kSpecies = "Deuteron";\r
- const TString kTrkSel = "its_tpc_tof_dca";\r
- const TString kTrigName = "mband";\r
- const Bool_t kMCtoINEL = 1;\r
- const Bool_t kPid = 1;\r
- const Int_t kPidProc = 0; // 0 m2, 1 dm2, 2 time\r
- const Double_t kPidEff = 1.;\r
- const Bool_t kSecondaries = 1;\r
- const Int_t kSecProc = 0; // 0 tff, 1 mc\r
- const Int_t kMatDCAxyMod = 1; // 0 geant, 1 flat\r
- const Bool_t kAntiNucTemplate = 0;\r
- const Int_t kNbin = 5;\r
- const Double_t kDCAxy[2] = {-0.2,0.2};\r
- const Bool_t kEfficiency = 1;\r
- const Bool_t kFitFrac = 1;\r
- const Int_t kDebugLevel = 1;\r
- \r
- Double_t bkgLimitToF[2] = {-2, 2};\r
- Double_t pidLimitToF[2] = {-2.,6.};\r
- \r
- Double_t bkgLimitM2[2] = {1.8,6.0};\r
- Double_t pidLimitM2[2] = {1.8,6.};\r
- \r
- if(kPidProc==1)\r
- {\r
- for(Int_t i=0; i<2; ++i)\r
- {\r
- bkgLimitM2[i] -= 3.51792;\r
- pidLimitM2[i] -= 3.51792;\r
- }\r
- }\r
- \r
- Double_t trigEff[3];\r
- GetTriggerEfficiency(trigEff, kTrigName, period);\r
- \r
- // input and output filenames\r
- \r
- TString inputData = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + ".root";\r
- TString inputSimu = inputDir + "/" + period + "/" + MakeSimuName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";\r
- TString inputSimuFix = inputDir + "/" + period + "/" + MakeSimuFixName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";\r
- TString inputCorr = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + "-corr.root";\r
- \r
- TString outputPt = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Pt.root";\r
- TString outputRatio = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Ratio.root";\r
- TString outputSpectra = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Spectra.root";\r
- \r
- // configure the driver and run\r
- \r
- AliLnDriver driver;\r
- \r
- driver.SetSpecies(kSpecies);\r
- \r
- driver.SetInputFilenames(inputData, inputSimu, inputSimuFix, inputCorr);\r
- driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);\r
- \r
- driver.SetRapidityInterval(-ymax,ymax);\r
- \r
- driver.SetOutputTag(outputTag);\r
- driver.SetOutputCorTag(outputTag);\r
- \r
- driver.SetTriggerEfficiency(trigEff);\r
- driver.SetExtrapolateToINEL(inel);\r
- driver.SetMCtoINEL(kMCtoINEL);\r
- driver.SetPtInterval(ptmin, ptmax);\r
- driver.SetPid(kPid);\r
- driver.SetPidProcedure(kPidProc);\r
- driver.SetPidEfficiency(kPidEff);\r
- driver.SetPidPt(ptpid);\r
- \r
- if(kPidProc==2)\r
- {\r
- driver.SetBkgInterval(bkgLimitToF[0], bkgLimitToF[1]);\r
- driver.SetPidInterval(pidLimitToF[0], pidLimitToF[1]);\r
- }\r
- else\r
- {\r
- driver.SetBkgInterval(bkgLimitM2[0], bkgLimitM2[1]);\r
- driver.SetPidInterval(pidLimitM2[0], pidLimitM2[1]);\r
- }\r
- \r
- driver.SetSecondaries(kSecondaries);\r
- driver.SetSecProcedure(kSecProc);\r
- driver.SetMatDCAxyModel(kMatDCAxyMod);\r
- driver.SetAntiNucleusAsTemplate(kAntiNucTemplate);\r
- driver.SetNBin(kNbin);\r
- driver.SetDCAxyInterval(kDCAxy[0], kDCAxy[1]);\r
- driver.SetEfficiency(kEfficiency,0);\r
- driver.SetFitFractionCorr(kFitFrac);\r
- \r
- driver.SetDebugLevel(kDebugLevel);\r
- \r
- driver.SetMakeStats(makeStats);\r
- driver.SetMakeCorrections(makeCor);\r
- driver.SetMakePt(makePt);\r
- driver.SetMakeRatio(makeRatio);\r
- driver.SetMakeSpectra(makeSpectra);\r
- \r
- driver.Run();\r
- \r
- // draw output\r
- \r
- if(!drawOutput) return 0;\r
- \r
- DrawOutputCorr(kSpecies, inputCorr, driver.GetOutputCorrTag());\r
- \r
- if(kSecProc == 0) gROOT->ProcessLine(Form(".x DrawSec.C+g(\"%s\",\"%s\",\"Deuteron\", %f, %f, %f, %f)", driver.GetPtCorrDebugFilename().Data(), driver.GetOutputCorrTag().Data(), ptmin, ptmax, kDCAxy[0], kDCAxy[1]));\r
- \r
- DrawPtDebug(driver.GetPtDebugFilename(), outputTag, kSpecies, kPid, ptmax, ptpid);\r
- DrawOutputRatio(outputRatio, outputTag, kSpecies);\r
- DrawOutputSpectra(outputSpectra, outputTag, kSpecies);\r
- \r
- return 0;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// LHC10x config for deuterons and antideuterons
+// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TROOT.h>
+#include <TString.h>
+#include "AliLnDriver.h"
+#endif
+
+#include "Config.h"
+
+Int_t Config_Deuteron_TOF_LHC10x( const TString& inputDir = "~/alice/input"
+ , const TString& outputDir = "~/alice/output"
+ , const TString& period = "lhc10bcde"
+ , const TString& outputTag = "lhc10bcde"
+ , const TString& trkselTag = "-tpc3-nsd-moc"
+ , const TString& multTag = ""
+ , const TString& multCorTag = ""
+ , Double_t ymax = 0.5
+ , Bool_t inel = 0 // for mult
+ , Bool_t drawOutput = 1 // for batch
+ , Double_t ptmin = 0.7
+ , Double_t ptmax = 3.0
+ , Double_t ptpid = 0.8
+ , Bool_t makeStats = 1
+ , Bool_t makeCor = 1
+ , Bool_t makePt = 1
+ , Bool_t makeRatio = 1
+ , Bool_t makeSpectra = 1)
+{
+//
+// lhc10b, lhc10c, lhc10d, lhc10e config for deuterons and antideuterons
+//
+ const TString kSpecies = "Deuteron";
+ const TString kTrkSel = "its_tpc_tof_dca";
+ const TString kTrigName = "mband";
+ const Bool_t kMCtoINEL = 1;
+ const Bool_t kPid = 1;
+ const Int_t kPidProc = 0; // 0 m2, 1 dm2, 2 time
+ const Double_t kPidEff = 1.;
+ const Bool_t kSecondaries = 1;
+ const Int_t kSecProc = 0; // 0 tff, 1 mc
+ const Int_t kMatDCAxyMod = 1; // 0 geant, 1 flat
+ const Bool_t kAntiNucTemplate = 0;
+ const Int_t kNbin = 5;
+ const Double_t kDCAxy[2] = {-0.2,0.2};
+ const Bool_t kEfficiency = 1;
+ const Bool_t kFitFrac = 1;
+ const Int_t kDebugLevel = 1;
+
+ Double_t bkgLimitToF[2] = {-2, 2};
+ Double_t pidLimitToF[2] = {-2.,6.};
+
+ Double_t bkgLimitM2[2] = {1.8,6.0};
+ Double_t pidLimitM2[2] = {1.8,6.};
+
+ if(kPidProc==1)
+ {
+ for(Int_t i=0; i<2; ++i)
+ {
+ bkgLimitM2[i] -= 3.51792;
+ pidLimitM2[i] -= 3.51792;
+ }
+ }
+
+ Double_t trigEff[3];
+ GetTriggerEfficiency(trigEff, kTrigName, period);
+
+ // input and output filenames
+
+ TString inputData = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + ".root";
+ TString inputSimu = inputDir + "/" + period + "/" + MakeSimuName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";
+ TString inputSimuFix = inputDir + "/" + period + "/" + MakeSimuFixName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";
+ TString inputCorr = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + "-corr.root";
+
+ TString outputPt = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Pt.root";
+ TString outputRatio = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Ratio.root";
+ TString outputSpectra = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Spectra.root";
+
+ // configure the driver and run
+
+ AliLnDriver driver;
+
+ driver.SetSpecies(kSpecies);
+
+ driver.SetInputFilenames(inputData, inputSimu, inputSimuFix, inputCorr);
+ driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);
+
+ driver.SetRapidityInterval(-ymax,ymax);
+
+ driver.SetOutputTag(outputTag);
+ driver.SetOutputCorTag(outputTag);
+
+ driver.SetTriggerEfficiency(trigEff);
+ driver.SetExtrapolateToINEL(inel);
+ driver.SetMCtoINEL(kMCtoINEL);
+ driver.SetPtInterval(ptmin, ptmax);
+ driver.SetPid(kPid);
+ driver.SetPidProcedure(kPidProc);
+ driver.SetPidEfficiency(kPidEff);
+ driver.SetPidPt(ptpid);
+
+ if(kPidProc==2)
+ {
+ driver.SetBkgInterval(bkgLimitToF[0], bkgLimitToF[1]);
+ driver.SetPidInterval(pidLimitToF[0], pidLimitToF[1]);
+ }
+ else
+ {
+ driver.SetBkgInterval(bkgLimitM2[0], bkgLimitM2[1]);
+ driver.SetPidInterval(pidLimitM2[0], pidLimitM2[1]);
+ }
+
+ driver.SetSecondaries(kSecondaries);
+ driver.SetSecProcedure(kSecProc);
+ driver.SetMatDCAxyModel(kMatDCAxyMod);
+ driver.SetAntiNucleusAsTemplate(kAntiNucTemplate);
+ driver.SetNBin(kNbin);
+ driver.SetDCAxyInterval(kDCAxy[0], kDCAxy[1]);
+ driver.SetEfficiency(kEfficiency,0);
+ driver.SetFitFractionCorr(kFitFrac);
+
+ driver.SetDebugLevel(kDebugLevel);
+
+ driver.SetMakeStats(makeStats);
+ driver.SetMakeCorrections(makeCor);
+ driver.SetMakePt(makePt);
+ driver.SetMakeRatio(makeRatio);
+ driver.SetMakeSpectra(makeSpectra);
+
+ driver.Run();
+
+ // draw output
+
+ if(!drawOutput) return 0;
+
+ DrawOutputCorr(kSpecies, inputCorr, driver.GetOutputCorrTag());
+
+ if(kSecProc == 0) gROOT->ProcessLine(Form(".x DrawSec.C+g(\"%s\",\"%s\",\"Deuteron\", %f, %f, %f, %f)", driver.GetPtCorrDebugFilename().Data(), driver.GetOutputCorrTag().Data(), ptmin, ptmax, kDCAxy[0], kDCAxy[1]));
+
+ DrawPtDebug(driver.GetPtDebugFilename(), outputTag, kSpecies, kPid, ptmax, ptpid);
+ DrawOutputRatio(outputRatio, outputTag, kSpecies);
+ DrawOutputSpectra(outputSpectra, outputTag, kSpecies);
+
+ return 0;
+}
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-// LHC10x config for deuterons and antideuterons\r
-// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>\r
-\r
-#if !defined(__CINT__) || defined(__MAKECINT__)\r
-#include <TROOT.h>\r
-#include <TString.h>\r
-#include "AliLnDriver.h"\r
-#endif\r
-\r
-#include "Config.h"\r
-\r
-Int_t Config_Deuteron_TPC_LHC10x( const TString& inputDir = "~/alice/input"\r
- , const TString& outputDir = "~/alice/output"\r
- , const TString& period = "lhc10d"\r
- , const TString& outputTag = "lhc10d"\r
- , const TString& trkselTag = "-tpc3-nsd-moc"\r
- , const TString& multTag = ""\r
- , const TString& multCorTag = ""\r
- , Double_t ymax = 0.5\r
- , Bool_t inel = 0\r
- , Bool_t drawOutput = 1\r
- , Double_t ptmin = 0.5 // GeV/c\r
- , Double_t ptmax = 1.1 // GeV/c\r
- , Bool_t makeStats = 1\r
- , Bool_t makeCor = 1\r
- , Bool_t makePt = 1\r
- , Bool_t makeRatio = 1\r
- , Bool_t makeSpectra = 1 )\r
-{\r
-//\r
-// lhc10b, lhc10c, lhc10d, lhc10e config for deuterons and antideuterons\r
-// (TPC)\r
-//\r
- const TString kSpecies = "Deuteron";\r
- const TString kTrkSel = "its_tpc_dca";\r
- const TString kTrigName = "mband";\r
- const Bool_t kMCtoINEL = 1;\r
- const Double_t kPidEff = 1.;\r
- const Bool_t kSecondaries = 1;\r
- const Int_t kSecProc = 0; // 0 tff, 1 mc\r
- const Int_t kMatDCAxyMod = 1; // 0 geant, 1 flat\r
- const Bool_t kAntiNucTemplate = 0;\r
- const Int_t kNbin = 5;\r
- const Double_t kDCAxy[2] = {-0.2, 0.2};\r
- const Bool_t kEfficiency = 1;\r
- const Int_t kDebugLevel = 1;\r
- \r
- Double_t trigEff[3];\r
- GetTriggerEfficiency(trigEff, kTrigName, period);\r
- \r
- // input and output filenames\r
- \r
- TString inputData = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + ".root";\r
- TString inputSimu = inputDir + "/" + period + "/" + MakeSimuName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";\r
- TString inputSimuFix = inputDir + "/" + period + "/" + MakeSimuFixName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";\r
- TString inputCorr = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + "-corr.root";\r
- \r
- TString outputPt = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Pt.root";\r
- TString outputRatio = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Ratio.root";\r
- TString outputSpectra = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Spectra.root";\r
- \r
- // configure the driver and run\r
- \r
- AliLnDriver driver;\r
- \r
- driver.SetSpecies(kSpecies);\r
- \r
- driver.SetInputFilenames(inputData, inputSimu, inputSimuFix, inputCorr);\r
- driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);\r
- \r
- driver.SetRapidityInterval(-ymax,ymax);\r
- \r
- driver.SetOutputTag(outputTag);\r
- driver.SetOutputCorTag(outputTag);\r
- \r
- driver.SetTriggerEfficiency(trigEff);\r
- driver.SetExtrapolateToINEL(inel);\r
- driver.SetMCtoINEL(kMCtoINEL);\r
- driver.SetPtInterval(ptmin, ptmax);\r
- driver.SetPid(0);\r
- driver.SetPidEfficiency(kPidEff);\r
- driver.SetSecondaries(kSecondaries);\r
- driver.SetSecProcedure(kSecProc);\r
- driver.SetMatDCAxyModel(kMatDCAxyMod);\r
- driver.SetAntiNucleusAsTemplate(kAntiNucTemplate);\r
- driver.SetNBin(kNbin);\r
- driver.SetDCAxyInterval(kDCAxy[0], kDCAxy[1]);\r
- driver.SetEfficiency(kEfficiency,0);\r
- \r
- driver.SetMakeStats(makeStats);\r
- driver.SetMakeCorrections(makeCor);\r
- driver.SetMakePt(makePt);\r
- driver.SetMakeRatio(makeRatio);\r
- driver.SetMakeSpectra(makeSpectra);\r
- \r
- driver.SetDebugLevel(kDebugLevel);\r
- \r
- driver.Run();\r
- \r
- // draw output\r
- \r
- if(!drawOutput) return 0;\r
- \r
- DrawOutputCorr(kSpecies, inputCorr, driver.GetOutputCorrTag());\r
- \r
- if(kSecProc == 0) gROOT->ProcessLine(Form(".x DrawSec.C+g(\"%s\",\"%s\",\"Deuteron\", %f, %f, %f, %f)", driver.GetPtCorrDebugFilename().Data(), driver.GetOutputCorrTag().Data(), ptmin, ptmax, kDCAxy[0], kDCAxy[1]));\r
- \r
- DrawPtDebug(driver.GetPtDebugFilename(), outputTag, kSpecies, 0);\r
- DrawOutputRatio(outputRatio, outputTag, kSpecies);\r
- DrawOutputSpectra(outputSpectra, outputTag, kSpecies);\r
- \r
- return 0;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// LHC10x config for deuterons and antideuterons
+// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TROOT.h>
+#include <TString.h>
+#include "AliLnDriver.h"
+#endif
+
+#include "Config.h"
+
+Int_t Config_Deuteron_TPC_LHC10x( const TString& inputDir = "~/alice/input"
+ , const TString& outputDir = "~/alice/output"
+ , const TString& period = "lhc10d"
+ , const TString& outputTag = "lhc10d"
+ , const TString& trkselTag = "-tpc3-nsd-moc"
+ , const TString& multTag = ""
+ , const TString& multCorTag = ""
+ , Double_t ymax = 0.5
+ , Bool_t inel = 0
+ , Bool_t drawOutput = 1
+ , Double_t ptmin = 0.5 // GeV/c
+ , Double_t ptmax = 1.1 // GeV/c
+ , Bool_t makeStats = 1
+ , Bool_t makeCor = 1
+ , Bool_t makePt = 1
+ , Bool_t makeRatio = 1
+ , Bool_t makeSpectra = 1 )
+{
+//
+// lhc10b, lhc10c, lhc10d, lhc10e config for deuterons and antideuterons
+// (TPC)
+//
+ const TString kSpecies = "Deuteron";
+ const TString kTrkSel = "its_tpc_dca";
+ const TString kTrigName = "mband";
+ const Bool_t kMCtoINEL = 1;
+ const Double_t kPidEff = 1.;
+ const Bool_t kSecondaries = 1;
+ const Int_t kSecProc = 0; // 0 tff, 1 mc
+ const Int_t kMatDCAxyMod = 1; // 0 geant, 1 flat
+ const Bool_t kAntiNucTemplate = 0;
+ const Int_t kNbin = 5;
+ const Double_t kDCAxy[2] = {-0.2, 0.2};
+ const Bool_t kEfficiency = 1;
+ const Int_t kDebugLevel = 1;
+
+ Double_t trigEff[3];
+ GetTriggerEfficiency(trigEff, kTrigName, period);
+
+ // input and output filenames
+
+ TString inputData = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + ".root";
+ TString inputSimu = inputDir + "/" + period + "/" + MakeSimuName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";
+ TString inputSimuFix = inputDir + "/" + period + "/" + MakeSimuFixName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";
+ TString inputCorr = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + "-corr.root";
+
+ TString outputPt = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Pt.root";
+ TString outputRatio = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Ratio.root";
+ TString outputSpectra = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Spectra.root";
+
+ // configure the driver and run
+
+ AliLnDriver driver;
+
+ driver.SetSpecies(kSpecies);
+
+ driver.SetInputFilenames(inputData, inputSimu, inputSimuFix, inputCorr);
+ driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);
+
+ driver.SetRapidityInterval(-ymax,ymax);
+
+ driver.SetOutputTag(outputTag);
+ driver.SetOutputCorTag(outputTag);
+
+ driver.SetTriggerEfficiency(trigEff);
+ driver.SetExtrapolateToINEL(inel);
+ driver.SetMCtoINEL(kMCtoINEL);
+ driver.SetPtInterval(ptmin, ptmax);
+ driver.SetPid(0);
+ driver.SetPidEfficiency(kPidEff);
+ driver.SetSecondaries(kSecondaries);
+ driver.SetSecProcedure(kSecProc);
+ driver.SetMatDCAxyModel(kMatDCAxyMod);
+ driver.SetAntiNucleusAsTemplate(kAntiNucTemplate);
+ driver.SetNBin(kNbin);
+ driver.SetDCAxyInterval(kDCAxy[0], kDCAxy[1]);
+ driver.SetEfficiency(kEfficiency,0);
+
+ driver.SetMakeStats(makeStats);
+ driver.SetMakeCorrections(makeCor);
+ driver.SetMakePt(makePt);
+ driver.SetMakeRatio(makeRatio);
+ driver.SetMakeSpectra(makeSpectra);
+
+ driver.SetDebugLevel(kDebugLevel);
+
+ driver.Run();
+
+ // draw output
+
+ if(!drawOutput) return 0;
+
+ DrawOutputCorr(kSpecies, inputCorr, driver.GetOutputCorrTag());
+
+ if(kSecProc == 0) gROOT->ProcessLine(Form(".x DrawSec.C+g(\"%s\",\"%s\",\"Deuteron\", %f, %f, %f, %f)", driver.GetPtCorrDebugFilename().Data(), driver.GetOutputCorrTag().Data(), ptmin, ptmax, kDCAxy[0], kDCAxy[1]));
+
+ DrawPtDebug(driver.GetPtDebugFilename(), outputTag, kSpecies, 0);
+ DrawOutputRatio(outputRatio, outputTag, kSpecies);
+ DrawOutputSpectra(outputSpectra, outputTag, kSpecies);
+
+ return 0;
+}
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-// LHC10x config for He3 and AntiHe3\r
-// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>\r
-\r
-#if !defined(__CINT__) || defined(__MAKECINT__)\r
-#include <TROOT.h>\r
-#include <TString.h>\r
-#include "AliLnDriver.h"\r
-#endif\r
-\r
-#include "Config.h"\r
-\r
-Int_t Config_He3_TPC_LHC10x( const TString& inputDir = "~/alice/input"\r
- , const TString& outputDir = "~/alice/output"\r
- , const TString& period = "lhc10bcde"\r
- , const TString& outputTag = "pp-mband-7TeV"\r
- , const TString& trkselTag = "-tpc3-nsd-moc-vbin"\r
- , const TString& multTag = ""\r
- , const TString& multCorTag = ""\r
- , Double_t ymax = 0.5\r
- , Bool_t inel = kFALSE\r
- , Bool_t drawOutput = kTRUE\r
- , Double_t ptmin = 0.4 // GeV/c\r
- , Double_t ptmax = 10. // GeV/c\r
- , Bool_t makeStats = kTRUE\r
- , Bool_t makeCor = kTRUE\r
- , Bool_t makePt = kTRUE\r
- , Bool_t makeRatio = kTRUE\r
- , Bool_t makeSpectra = kTRUE )\r
-{\r
-//\r
-// lhc10b, lhc10c, lhc10d, lhc10e config for He3 and AntiHe3\r
-// (TPC)\r
-//\r
- const TString kSpecies = "He3";\r
- const TString kTrkSel = "its_tpc_dca";\r
- const TString kTrigName = "mband";\r
- const Bool_t kMCtoINEL = kTRUE;\r
- const Double_t kPidEff = 1.;\r
- const Bool_t kSecondaries = kFALSE;\r
- const Int_t kSecProc = 1; // 0 tff, 1 mc\r
- const Int_t kMatDCAxyMod = 1; // 0 geant, 1 flat\r
- const Bool_t kAntiNucTemplate = kFALSE;\r
- const Int_t kNbin = 5;\r
- const Double_t kDCAxy[2] = {-0.2, 0.2};\r
- const Bool_t kEfficiency = kTRUE;\r
- const Int_t kDebugLevel = 1;\r
- \r
- Double_t trigEff[3];\r
- GetTriggerEfficiency(trigEff, kTrigName, period);\r
- \r
- // input and output filenames\r
- \r
- TString inputData = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + ".root";\r
- TString inputSimu = inputDir + "/" + period + "/" + MakeSimuName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";\r
- TString inputSimuFix = inputDir + "/" + period + "/" + MakeSimuFixName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";\r
- TString inputCorr = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + "-corr.root";\r
- \r
- TString outputPt = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Pt.root";\r
- TString outputRatio = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Ratio.root";\r
- TString outputSpectra = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Spectra.root";\r
- \r
- // configure the driver and run\r
- \r
- AliLnDriver driver;\r
- \r
- driver.SetSpecies(kSpecies);\r
- \r
- driver.SetInputFilenames(inputData, inputSimu, inputSimuFix, inputCorr);\r
- driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);\r
- \r
- driver.SetRapidityInterval(-ymax,ymax);\r
- \r
- driver.SetOutputTag(outputTag);\r
- driver.SetOutputCorTag(outputTag);\r
- \r
- driver.SetTriggerEfficiency(trigEff);\r
- driver.SetExtrapolateToINEL(inel);\r
- driver.SetMCtoINEL(kMCtoINEL);\r
- driver.SetPtInterval(ptmin, ptmax);\r
- driver.SetPid(0);\r
- driver.SetPidEfficiency(kPidEff);\r
- driver.SetSecondaries(kSecondaries);\r
- driver.SetSecProcedure(kSecProc);\r
- driver.SetMatDCAxyModel(kMatDCAxyMod);\r
- driver.SetAntiNucleusAsTemplate(kAntiNucTemplate);\r
- driver.SetNBin(kNbin);\r
- driver.SetDCAxyInterval(kDCAxy[0], kDCAxy[1]);\r
- driver.SetEfficiency(kEfficiency,0);\r
- \r
- driver.SetMakeStats(makeStats);\r
- driver.SetMakeCorrections(makeCor);\r
- driver.SetMakePt(makePt);\r
- driver.SetMakeRatio(makeRatio);\r
- driver.SetMakeSpectra(makeSpectra);\r
- \r
- driver.SetDebugLevel(kDebugLevel);\r
- \r
- driver.Run();\r
- \r
- // draw output\r
- \r
- if(!drawOutput) return 0;\r
- \r
- DrawOutputCorr(kSpecies, inputCorr, driver.GetOutputCorrTag());\r
- \r
- DrawPtDebug(driver.GetPtDebugFilename(), outputTag, kSpecies, 0);\r
- DrawOutputRatio(outputRatio, outputTag, kSpecies);\r
- DrawOutputSpectra(outputSpectra, outputTag, kSpecies);\r
- \r
- return 0;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// LHC10x config for He3 and AntiHe3
+// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TROOT.h>
+#include <TString.h>
+#include "AliLnDriver.h"
+#endif
+
+#include "Config.h"
+
+Int_t Config_He3_TPC_LHC10x( const TString& inputDir = "~/alice/input"
+ , const TString& outputDir = "~/alice/output"
+ , const TString& period = "lhc10bcde"
+ , const TString& outputTag = "pp-mband-7TeV"
+ , const TString& trkselTag = "-tpc3-nsd-moc-vbin"
+ , const TString& multTag = ""
+ , const TString& multCorTag = ""
+ , Double_t ymax = 0.5
+ , Bool_t inel = kFALSE
+ , Bool_t drawOutput = kTRUE
+ , Double_t ptmin = 0.4 // GeV/c
+ , Double_t ptmax = 10. // GeV/c
+ , Bool_t makeStats = kTRUE
+ , Bool_t makeCor = kTRUE
+ , Bool_t makePt = kTRUE
+ , Bool_t makeRatio = kTRUE
+ , Bool_t makeSpectra = kTRUE )
+{
+//
+// lhc10b, lhc10c, lhc10d, lhc10e config for He3 and AntiHe3
+// (TPC)
+//
+ const TString kSpecies = "He3";
+ const TString kTrkSel = "its_tpc_dca";
+ const TString kTrigName = "mband";
+ const Bool_t kMCtoINEL = kTRUE;
+ const Double_t kPidEff = 1.;
+ const Bool_t kSecondaries = kFALSE;
+ const Int_t kSecProc = 1; // 0 tff, 1 mc
+ const Int_t kMatDCAxyMod = 1; // 0 geant, 1 flat
+ const Bool_t kAntiNucTemplate = kFALSE;
+ const Int_t kNbin = 5;
+ const Double_t kDCAxy[2] = {-0.2, 0.2};
+ const Bool_t kEfficiency = kTRUE;
+ const Int_t kDebugLevel = 1;
+
+ Double_t trigEff[3];
+ GetTriggerEfficiency(trigEff, kTrigName, period);
+
+ // input and output filenames
+
+ TString inputData = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + ".root";
+ TString inputSimu = inputDir + "/" + period + "/" + MakeSimuName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";
+ TString inputSimuFix = inputDir + "/" + period + "/" + MakeSimuFixName(kSpecies, period, kTrkSel+trkselTag+multCorTag) + ".root";
+ TString inputCorr = inputDir + "/" + period + "/" + MakeInputName(kSpecies, period, kTrkSel+trkselTag+multTag) + "-corr.root";
+
+ TString outputPt = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Pt.root";
+ TString outputRatio = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Ratio.root";
+ TString outputSpectra = outputDir + "/" + MakeOutputName(kSpecies, outputTag) + "-Spectra.root";
+
+ // configure the driver and run
+
+ AliLnDriver driver;
+
+ driver.SetSpecies(kSpecies);
+
+ driver.SetInputFilenames(inputData, inputSimu, inputSimuFix, inputCorr);
+ driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);
+
+ driver.SetRapidityInterval(-ymax,ymax);
+
+ driver.SetOutputTag(outputTag);
+ driver.SetOutputCorTag(outputTag);
+
+ driver.SetTriggerEfficiency(trigEff);
+ driver.SetExtrapolateToINEL(inel);
+ driver.SetMCtoINEL(kMCtoINEL);
+ driver.SetPtInterval(ptmin, ptmax);
+ driver.SetPid(0);
+ driver.SetPidEfficiency(kPidEff);
+ driver.SetSecondaries(kSecondaries);
+ driver.SetSecProcedure(kSecProc);
+ driver.SetMatDCAxyModel(kMatDCAxyMod);
+ driver.SetAntiNucleusAsTemplate(kAntiNucTemplate);
+ driver.SetNBin(kNbin);
+ driver.SetDCAxyInterval(kDCAxy[0], kDCAxy[1]);
+ driver.SetEfficiency(kEfficiency,0);
+
+ driver.SetMakeStats(makeStats);
+ driver.SetMakeCorrections(makeCor);
+ driver.SetMakePt(makePt);
+ driver.SetMakeRatio(makeRatio);
+ driver.SetMakeSpectra(makeSpectra);
+
+ driver.SetDebugLevel(kDebugLevel);
+
+ driver.Run();
+
+ // draw output
+
+ if(!drawOutput) return 0;
+
+ DrawOutputCorr(kSpecies, inputCorr, driver.GetOutputCorrTag());
+
+ DrawPtDebug(driver.GetPtDebugFilename(), outputTag, kSpecies, 0);
+ DrawOutputRatio(outputRatio, outputTag, kSpecies);
+ DrawOutputSpectra(outputSpectra, outputTag, kSpecies);
+
+ return 0;
+}
-/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-// call Config_XXX for each period\r
-// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>\r
-\r
-#if !defined(__CINT__) || defined(__MAKECINT__)\r
-#include <Riostream.h>\r
-#include <TROOT.h>\r
-#include <TSystem.h>\r
-#include <TString.h>\r
-#include <TFileMerger.h>\r
-#include "AliLnDriver.h"\r
-#endif\r
-\r
-#include "Config.h"\r
-\r
-Int_t LHC10bcde( const TString& species = "Deuteron"\r
- , const TString& inputDir = "~/alice/input"\r
- , const TString& outputDir = "~/alice/output"\r
- , const TString& outputTag = "lhc10bcde"\r
- , const TString& trkselTag = "-tpc3-nsd-moc"\r
- , const TString& multTag = ""\r
- , const TString& multCorTag = ""\r
- , Double_t ymax = 0.5\r
- , Bool_t inel = 0 // for mult\r
- , Bool_t drawOutput = 1 // for batch\r
- , Double_t ptmin = 0.8\r
- , Double_t ptmax = 3.2\r
- , Double_t ptjoint = 1.0\r
- , Double_t ptpid = 1.4\r
- , Int_t option = 2)\r
-{\r
-//\r
-// call Config_XXX for each period, merge the corrected pt and then get the results\r
-//\r
- const Int_t kNper = 4;\r
- const TString kPeriod[kNper] = { "lhc10b", "lhc10c", "lhc10d", "lhc10e" };\r
- const TString kOutputTag[kNper] = { "lhc10b", "lhc10c", "lhc10d", "lhc10e" };\r
- \r
- using namespace std;\r
- \r
- if( (option<0) || (option>2))\r
- {\r
- cerr << "unknown option: " << option << endl;\r
- cerr << "valid options : 0 (TPC), 1 (TOF), 2 (TPCTOF)" << endl;\r
- exit(1);\r
- }\r
- \r
- TFileMerger m;\r
- \r
- for(Int_t i=0; i<kNper; ++i)\r
- {\r
- cout << endl << "Period: " << kPeriod[i] << endl;\r
- \r
- TString arg = inputDir + "\","\r
- + "\"" + outputDir + "\","\r
- + "\"" + kPeriod[i] + "\","\r
- + "\"" + kOutputTag[i] + "\","\r
- + "\"" + trkselTag + "\","\r
- + "\"" + multTag + "\","\r
- + "\"" + multCorTag;\r
- \r
- switch(option)\r
- {\r
- case 0:\r
- cout << "Config_" << species << "_TPC_LHC10x.C" << endl << endl;\r
- gROOT->ProcessLine(Form(".x Config_%s_TPC_LHC10x.C+g(\"%s\", %f, %d, 0, %f, %f,1,1,1,1,1)", species.Data(), arg.Data(), ymax, inel, ptmin, ptmax));\r
- break;\r
- case 1:\r
- cout << "Config_" << species << "_LHC10x.C" << endl << endl;\r
- gROOT->ProcessLine(Form(".x Config_%s_TOF_LHC10x.C+g(\"%s\", %f, %d, 0, %f, %f, %f,1,1,1,1,1)", species.Data(), arg.Data(), ymax, inel, ptmin, ptmax, ptpid));\r
- break;\r
- case 2:\r
- cout << "Config_TPCTOF_LHC10x.C" << endl << endl;\r
- gROOT->ProcessLine(Form(".x Config_TPCTOF_LHC10x.C+g(\"%s\", %f, %d, 0, \"%s\", %f, %f, %f, %f)", arg.Data(), ymax, inel, species.Data(), ptmin, ptjoint, ptmax, ptpid));\r
- break;\r
- }\r
- \r
- TString ptfile = outputDir + "/" + species + "-" + kOutputTag[i] + "-Pt.root";\r
- m.AddFile(ptfile,0);\r
- }\r
- \r
- TString outputPt = outputDir + "/" + species + "-" + outputTag + multTag + "-Pt.root";\r
- TString outputRatio = outputDir + "/" + species + "-" + outputTag + multTag + "-Ratio.root";\r
- TString outputSpectra = outputDir + "/" + species + "-" + outputTag + multTag + "-Spectra.root";\r
- \r
- // pt\r
- \r
- m.OutputFile(outputPt.Data());\r
- m.Merge();\r
- \r
- // spectra\r
- \r
- AliLnDriver driver;\r
- \r
- driver.SetSpecies(species);\r
- \r
- driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);\r
- driver.SetOutputTag(outputTag);\r
- \r
- driver.SetRapidityInterval(-ymax,ymax);\r
- driver.SetExtrapolateToINEL(inel);\r
- \r
- driver.SetMakeCorrections(0);\r
- driver.SetMakePt(0);\r
- driver.SetMakeRatio(1);\r
- driver.SetMakeSpectra(1);\r
- \r
- driver.Run();\r
- \r
- // merge all results for comparison\r
- \r
- TFileMerger m2, m3;\r
- \r
- for(Int_t i=0; i<kNper; ++i)\r
- {\r
- m2.AddFile((outputDir + "/" + species + "-" + kPeriod[i] + "-Ratio.root").Data(),0);\r
- m3.AddFile((outputDir + "/" + species + "-" + kPeriod[i] + "-Spectra.root").Data(),0);\r
- }\r
- \r
- m2.AddFile(outputRatio.Data(),0);\r
- m3.AddFile(outputSpectra.Data(),0);\r
- \r
- TString allRatios = outputDir + "/" + species + "-" + outputTag + "-2" + multTag + "-Ratio.root";\r
- TString allSpectra = outputDir + "/" + species + "-" + outputTag + "-2" + multTag + "-Spectra.root";\r
- \r
- m2.OutputFile(allRatios.Data());\r
- m3.OutputFile(allSpectra.Data());\r
- \r
- m2.Merge();\r
- m3.Merge();\r
- \r
- // compare periods\r
- \r
- if(!drawOutput) return 0;\r
- \r
- gROOT->ProcessLine(Form(".x DrawDir.C+g(\"%s\",\"Anti%s%s_Ratio_Pt\",\"%s\",0,4.5, 0., 1.8, \"p_{T} (GeV/c)\", \"neg/pos\", 2, \"cRatio\",\"Particle ratio\")", allRatios.Data(), species.Data(), species.Data(),outputTag.Data()));\r
- \r
- Double_t minYield = (species=="Proton") ? 1.1e-6 : 2.e-8;\r
- Double_t maxYield = (species=="Proton") ? 4.e-1 : 9.e-4;\r
- \r
- DrawOutputSpectraMult(allSpectra, species, minYield, maxYield, 2, outputTag);\r
- \r
- return 0;\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// call Config_XXX for each period
+// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <Riostream.h>
+#include <TROOT.h>
+#include <TSystem.h>
+#include <TString.h>
+#include <TFileMerger.h>
+#include "AliLnDriver.h"
+#endif
+
+#include "Config.h"
+
+Int_t LHC10bcde( const TString& species = "Deuteron"
+ , const TString& inputDir = "~/alice/input"
+ , const TString& outputDir = "~/alice/output"
+ , const TString& outputTag = "lhc10bcde"
+ , const TString& trkselTag = "-tpc3-nsd-moc"
+ , const TString& multTag = ""
+ , const TString& multCorTag = ""
+ , Double_t ymax = 0.5
+ , Bool_t inel = 0 // for mult
+ , Bool_t drawOutput = 1 // for batch
+ , Double_t ptmin = 0.8
+ , Double_t ptmax = 3.2
+ , Double_t ptjoint = 1.0
+ , Double_t ptpid = 1.4
+ , Int_t option = 2)
+{
+//
+// call Config_XXX for each period, merge the corrected pt and then get the results
+//
+ const Int_t kNper = 4;
+ const TString kPeriod[kNper] = { "lhc10b", "lhc10c", "lhc10d", "lhc10e" };
+ const TString kOutputTag[kNper] = { "lhc10b", "lhc10c", "lhc10d", "lhc10e" };
+
+ using namespace std;
+
+ if( (option<0) || (option>2))
+ {
+ cerr << "unknown option: " << option << endl;
+ cerr << "valid options : 0 (TPC), 1 (TOF), 2 (TPCTOF)" << endl;
+ exit(1);
+ }
+
+ TFileMerger m;
+
+ for(Int_t i=0; i<kNper; ++i)
+ {
+ cout << endl << "Period: " << kPeriod[i] << endl;
+
+ TString arg = inputDir + "\","
+ + "\"" + outputDir + "\","
+ + "\"" + kPeriod[i] + "\","
+ + "\"" + kOutputTag[i] + "\","
+ + "\"" + trkselTag + "\","
+ + "\"" + multTag + "\","
+ + "\"" + multCorTag;
+
+ switch(option)
+ {
+ case 0:
+ cout << "Config_" << species << "_TPC_LHC10x.C" << endl << endl;
+ gROOT->ProcessLine(Form(".x Config_%s_TPC_LHC10x.C+g(\"%s\", %f, %d, 0, %f, %f,1,1,1,1,1)", species.Data(), arg.Data(), ymax, inel, ptmin, ptmax));
+ break;
+ case 1:
+ cout << "Config_" << species << "_LHC10x.C" << endl << endl;
+ gROOT->ProcessLine(Form(".x Config_%s_TOF_LHC10x.C+g(\"%s\", %f, %d, 0, %f, %f, %f,1,1,1,1,1)", species.Data(), arg.Data(), ymax, inel, ptmin, ptmax, ptpid));
+ break;
+ case 2:
+ cout << "Config_TPCTOF_LHC10x.C" << endl << endl;
+ gROOT->ProcessLine(Form(".x Config_TPCTOF_LHC10x.C+g(\"%s\", %f, %d, 0, \"%s\", %f, %f, %f, %f)", arg.Data(), ymax, inel, species.Data(), ptmin, ptjoint, ptmax, ptpid));
+ break;
+ }
+
+ TString ptfile = outputDir + "/" + species + "-" + kOutputTag[i] + "-Pt.root";
+ m.AddFile(ptfile,0);
+ }
+
+ TString outputPt = outputDir + "/" + species + "-" + outputTag + multTag + "-Pt.root";
+ TString outputRatio = outputDir + "/" + species + "-" + outputTag + multTag + "-Ratio.root";
+ TString outputSpectra = outputDir + "/" + species + "-" + outputTag + multTag + "-Spectra.root";
+
+ // pt
+
+ m.OutputFile(outputPt.Data());
+ m.Merge();
+
+ // spectra
+
+ AliLnDriver driver;
+
+ driver.SetSpecies(species);
+
+ driver.SetOutputFilenames(outputPt, outputRatio, outputSpectra);
+ driver.SetOutputTag(outputTag);
+
+ driver.SetRapidityInterval(-ymax,ymax);
+ driver.SetExtrapolateToINEL(inel);
+
+ driver.SetMakeCorrections(0);
+ driver.SetMakePt(0);
+ driver.SetMakeRatio(1);
+ driver.SetMakeSpectra(1);
+
+ driver.Run();
+
+ // merge all results for comparison
+
+ TFileMerger m2, m3;
+
+ for(Int_t i=0; i<kNper; ++i)
+ {
+ m2.AddFile((outputDir + "/" + species + "-" + kPeriod[i] + "-Ratio.root").Data(),0);
+ m3.AddFile((outputDir + "/" + species + "-" + kPeriod[i] + "-Spectra.root").Data(),0);
+ }
+
+ m2.AddFile(outputRatio.Data(),0);
+ m3.AddFile(outputSpectra.Data(),0);
+
+ TString allRatios = outputDir + "/" + species + "-" + outputTag + "-2" + multTag + "-Ratio.root";
+ TString allSpectra = outputDir + "/" + species + "-" + outputTag + "-2" + multTag + "-Spectra.root";
+
+ m2.OutputFile(allRatios.Data());
+ m3.OutputFile(allSpectra.Data());
+
+ m2.Merge();
+ m3.Merge();
+
+ // compare periods
+
+ if(!drawOutput) return 0;
+
+ gROOT->ProcessLine(Form(".x DrawDir.C+g(\"%s\",\"Anti%s%s_Ratio_Pt\",\"%s\",0,4.5, 0., 1.8, \"p_{T} (GeV/c)\", \"neg/pos\", 2, \"cRatio\",\"Particle ratio\")", allRatios.Data(), species.Data(), species.Data(),outputTag.Data()));
+
+ Double_t minYield = (species=="Proton") ? 1.1e-6 : 2.e-8;
+ Double_t maxYield = (species=="Proton") ? 4.e-1 : 9.e-4;
+
+ DrawOutputSpectraMult(allSpectra, species, minYield, maxYield, 2, outputTag);
+
+ return 0;
+}
-\r
-\r
-AliAnalysisTask *AddTaskTPCTOFpA(Int_t identifier = 0, Bool_t isMC = kFALSE, Bool_t isTPConly = kFALSE, Bool_t writeOwnFile = kFALSE, Bool_t saveMotherPDG = kFALSE, Bool_t useEvenDcaBinning = kFALSE, Bool_t smallTHnSparse = kFALSE, Double_t nSigmaTPCLow= -3., Double_t nSigmaTPCHigh = 3., Double_t rapidityLow = -0.5, Double_t rapidityHigh = 0.5, Bool_t ispA=kTRUE, Bool_t rapCMS = kFALSE, TString multEst = "V0A", Bool_t setTrackCuts = kFALSE, AliESDtrackCuts *ESDtrackCuts = 0){\r
-\r
-\r
- //get the current analysis manager\r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) {\r
- Error("AddTask_janielsk_TPCTOFpA", "No analysis manager found.");\r
- return 0;\r
- }\r
- //============= Set Task Name ===================\r
- //TString taskName=("AliAnalysisTPCTOFpA.cxx+g");\r
- //===============================================\r
- // Load the task\r
- //gROOT->LoadMacro(taskName.Data());\r
-\r
-\r
- \r
- //========= Add task to the ANALYSIS manager =====\r
-\r
- //normal tracks\r
- AliAnalysisTPCTOFpA *task = new AliAnalysisTPCTOFpA("janielskTaskTPCTOFpA");\r
- //task->SelectCollisionCandidates(trigger.Data());\r
-\r
- //switches\r
- if (isMC) task->SetIsMCtrue(isMC);\r
- if (isTPConly)task->SetUseTPConlyTracks(isTPConly);\r
- if (saveMotherPDG) task->SetSaveMotherPDG(saveMotherPDG);\r
- if (useEvenDcaBinning) task->SetEvenDCAbinning(kTRUE);\r
- if (smallTHnSparse){\r
- task->SetSmallTHnSparse(kTRUE);\r
- task->SetTPCnSigmaCuts(nSigmaTPCLow,nSigmaTPCHigh);\r
- task->SetRapidityCuts(rapidityLow,rapidityHigh);\r
- }\r
- if (ispA) task->SetIspA(kTRUE);\r
- if (rapCMS) task->SetRapCMS(kTRUE);\r
- task->SetCentEst(multEst.Data());\r
-\r
- //initialize task\r
- task->Initialize();\r
-\r
- //esd cuts need to be set after initialize or cuts will be replaced by standard cuts in initialize\r
- if (setTrackCuts) task->SetESDtrackCuts(ESDtrackCuts);\r
-\r
- //add task to manager\r
- mgr->AddTask(task);\r
-\r
-\r
- \r
-\r
- //================================================\r
- // data containers\r
- //================================================\r
- // find input container\r
- //below the trunk version\r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();\r
-\r
-/*\r
- //dumm output container\r
- AliAnalysisDataContainer *coutput0 =\r
- mgr->CreateContainer(Form("akalweit_tree%i",identifier),\r
- TTree::Class(),\r
- AliAnalysisManager::kExchangeContainer,\r
- Form("akalweit_default%i",identifier));\r
-\r
-\r
- //define output containers, please use 'username'_'somename'\r
- AliAnalysisDataContainer *coutput1 = \r
- mgr->CreateContainer(Form("akalweit_TPCTOFpA%i",identifier), TList::Class(),\r
- AliAnalysisManager::kOutputContainer,Form("akalweit_TPCTOFpA%i.root",identifier));\r
-*/\r
-\r
- AliAnalysisDataContainer *coutput1;\r
-\r
- if (!writeOwnFile) {\r
- coutput1 = mgr->CreateContainer(Form("janielsk_TPCTOFpA%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:janielsk_TPCTOFpA", AliAnalysisManager::GetCommonFileName())); \r
- }\r
- else {\r
- coutput1 = mgr->CreateContainer(Form("janielsk_TPCTOFpA%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("janielsk_TPCTOFpA.root"));\r
- }\r
-\r
-\r
-\r
- //connect containers\r
-\r
- //\r
- mgr->ConnectInput (task, 0, cinput );\r
- //mgr->ConnectOutput (task, 0, coutput0);\r
- mgr->ConnectOutput (task, 1, coutput1);\r
-\r
- return task;\r
-}\r
+
+
+AliAnalysisTask *AddTaskTPCTOFpA(Int_t identifier = 0, Bool_t isMC = kFALSE, Bool_t isTPConly = kFALSE, Bool_t writeOwnFile = kFALSE, Bool_t saveMotherPDG = kFALSE, Bool_t useEvenDcaBinning = kFALSE, Bool_t smallTHnSparse = kFALSE, Double_t nSigmaTPCLow= -3., Double_t nSigmaTPCHigh = 3., Double_t rapidityLow = -0.5, Double_t rapidityHigh = 0.5, Bool_t ispA=kTRUE, Bool_t rapCMS = kFALSE, TString multEst = "V0A", Bool_t setTrackCuts = kFALSE, AliESDtrackCuts *ESDtrackCuts = 0){
+
+
+ //get the current analysis manager
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ Error("AddTask_janielsk_TPCTOFpA", "No analysis manager found.");
+ return 0;
+ }
+ //============= Set Task Name ===================
+ //TString taskName=("AliAnalysisTPCTOFpA.cxx+g");
+ //===============================================
+ // Load the task
+ //gROOT->LoadMacro(taskName.Data());
+
+
+
+ //========= Add task to the ANALYSIS manager =====
+
+ //normal tracks
+ AliAnalysisTPCTOFpA *task = new AliAnalysisTPCTOFpA("janielskTaskTPCTOFpA");
+ //task->SelectCollisionCandidates(trigger.Data());
+
+ //switches
+ if (isMC) task->SetIsMCtrue(isMC);
+ if (isTPConly)task->SetUseTPConlyTracks(isTPConly);
+ if (saveMotherPDG) task->SetSaveMotherPDG(saveMotherPDG);
+ if (useEvenDcaBinning) task->SetEvenDCAbinning(kTRUE);
+ if (smallTHnSparse){
+ task->SetSmallTHnSparse(kTRUE);
+ task->SetTPCnSigmaCuts(nSigmaTPCLow,nSigmaTPCHigh);
+ task->SetRapidityCuts(rapidityLow,rapidityHigh);
+ }
+ if (ispA) task->SetIspA(kTRUE);
+ if (rapCMS) task->SetRapCMS(kTRUE);
+ task->SetCentEst(multEst.Data());
+
+ //initialize task
+ task->Initialize();
+
+ //esd cuts need to be set after initialize or cuts will be replaced by standard cuts in initialize
+ if (setTrackCuts) task->SetESDtrackCuts(ESDtrackCuts);
+
+ //add task to manager
+ mgr->AddTask(task);
+
+
+
+
+ //================================================
+ // data containers
+ //================================================
+ // find input container
+ //below the trunk version
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+
+/*
+ //dumm output container
+ AliAnalysisDataContainer *coutput0 =
+ mgr->CreateContainer(Form("akalweit_tree%i",identifier),
+ TTree::Class(),
+ AliAnalysisManager::kExchangeContainer,
+ Form("akalweit_default%i",identifier));
+
+
+ //define output containers, please use 'username'_'somename'
+ AliAnalysisDataContainer *coutput1 =
+ mgr->CreateContainer(Form("akalweit_TPCTOFpA%i",identifier), TList::Class(),
+ AliAnalysisManager::kOutputContainer,Form("akalweit_TPCTOFpA%i.root",identifier));
+*/
+
+ AliAnalysisDataContainer *coutput1;
+
+ if (!writeOwnFile) {
+ coutput1 = mgr->CreateContainer(Form("janielsk_TPCTOFpA%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:janielsk_TPCTOFpA", AliAnalysisManager::GetCommonFileName()));
+ }
+ else {
+ coutput1 = mgr->CreateContainer(Form("janielsk_TPCTOFpA%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("janielsk_TPCTOFpA.root"));
+ }
+
+
+
+ //connect containers
+
+ //
+ mgr->ConnectInput (task, 0, cinput );
+ //mgr->ConnectOutput (task, 0, coutput0);
+ mgr->ConnectOutput (task, 1, coutput1);
+
+ return task;
+}
-AliAnalysisTaskSpectraAOD* AddTaskSpectraAOD(Bool_t mc=kFALSE,\r
- Double_t CentCutMin=0,\r
- Double_t CentCutMax=100,\r
- Double_t QvecCutMin=0,\r
- Double_t QvecCutMax=100,\r
- Double_t EtaMin=-0.8,\r
- Double_t EtaMax=0.8,\r
- Double_t Nsigmapid=3.,\r
- Double_t pt=5.,\r
- Double_t p=5.,\r
- Double_t y=.5,\r
- Double_t ptTofMatch=.6,\r
- UInt_t trkbit=1,\r
- UInt_t trkbitQVector=1,\r
- Double_t DCA=100000,\r
- UInt_t minNclsTPC=70,\r
- Int_t nrebin=0,\r
- TString opt=""){\r
- \r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) \r
- {\r
- ::Error("AddAliAnalysisTaskSpectraAOD", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
- \r
- // Check the analysis type using the event handlers connected to the analysis manager.\r
- //==============================================================================\r
- if (!mgr->GetInputEventHandler()) \r
- {\r
- ::Error("AddTaskITSsaTracks", "This task requires an input event handler");\r
- return NULL;\r
- } \r
- \r
- TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
- if(type.Contains("ESD"))\r
- {\r
- ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");\r
- return NULL;\r
- }\r
- \r
- using namespace AliSpectraNameSpace;\r
- \r
- AliSpectraAODPID *pid = new AliSpectraAODPID(); \r
- pid->SetNSigmaCut(Nsigmapid);\r
- \r
- AliSpectraAODTrackCuts * trcuts = new AliSpectraAODTrackCuts("Track Cuts"); \r
- trcuts->SetDCA(DCA);\r
- trcuts->SetTrackBits(trkbit);\r
- trcuts->SetPt(pt);\r
- trcuts->SetP(p);\r
- trcuts->SetY(y);\r
- trcuts->SetPtTOFMatching(ptTofMatch); \r
- trcuts->SetEta(EtaMin,EtaMax);\r
- trcuts->SetMinTPCcls(minNclsTPC);\r
- trcuts->PrintCuts();\r
- \r
- AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts("Event Cuts");\r
- evcuts->SetQVectorCut(QvecCutMin,QvecCutMax);\r
- evcuts->SetCentralityCutMax(CentCutMax); \r
- evcuts->SetCentralityCutMin(CentCutMin);\r
- evcuts->SetTrackBits(trkbitQVector);\r
- if(mc==1)evcuts->SetIsMC(kTRUE);\r
- evcuts->PrintCuts();\r
- \r
- AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD(Form("TaskAODSpectraCent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s", \r
- CentCutMin,\r
- CentCutMax,\r
- QvecCutMin,\r
- QvecCutMax,\r
- EtaMin,\r
- EtaMax,\r
- Nsigmapid,\r
- trkbit,\r
- opt.Data()));\r
- task->SetPID(pid); \r
- task->SetEventCuts(evcuts);\r
- task->SetTrackCuts(trcuts);\r
- task->SetNRebin(nrebin);\r
- if(mc==1)task->SetIsMC(kTRUE);\r
- \r
- TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
- \r
- TString typeofdata=mc?"MC":"Data";\r
- \r
- outputFileName += Form(":OutputAODSpectraTask_%s_Cent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),evcuts->GetQVectorCutMin(), evcuts->GetQVectorCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax(),pid->GetNSigmaCut(),trcuts->GetTrackType(),opt.Data());\r
- \r
- cout<<"outputFileName: "<<outputFileName<<endl;\r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); \r
- AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer("chistpt", AliSpectraAODHistoManager::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("cvcutpt", AliSpectraAODEventCuts::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer("ctcutpt", AliSpectraAODTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);\r
- AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer("cpidpt", AliSpectraAODPID::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
-\r
- mgr->AddTask(task);\r
- \r
- mgr->ConnectInput(task, 0, cinput);\r
- mgr->ConnectOutput(task, 1, coutputpt1);\r
- mgr->ConnectOutput(task, 2, coutputpt2);\r
- mgr->ConnectOutput(task, 3, coutputpt3);\r
- mgr->ConnectOutput(task, 4, coutputpt4);\r
-\r
- return task;\r
-}\r
+AliAnalysisTaskSpectraAOD* AddTaskSpectraAOD(Bool_t mc=kFALSE,
+ Double_t CentCutMin=0,
+ Double_t CentCutMax=100,
+ Double_t QvecCutMin=0,
+ Double_t QvecCutMax=100,
+ Double_t EtaMin=-0.8,
+ Double_t EtaMax=0.8,
+ Double_t Nsigmapid=3.,
+ Double_t pt=5.,
+ Double_t p=5.,
+ Double_t y=.5,
+ Double_t ptTofMatch=.6,
+ UInt_t trkbit=1,
+ UInt_t trkbitQVector=1,
+ Double_t DCA=100000,
+ UInt_t minNclsTPC=70,
+ Int_t nrebin=0,
+ TString opt=""){
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr)
+ {
+ ::Error("AddAliAnalysisTaskSpectraAOD", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis manager.
+ //==============================================================================
+ if (!mgr->GetInputEventHandler())
+ {
+ ::Error("AddTaskITSsaTracks", "This task requires an input event handler");
+ return NULL;
+ }
+
+ TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+ if(type.Contains("ESD"))
+ {
+ ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");
+ return NULL;
+ }
+
+ using namespace AliSpectraNameSpace;
+
+ AliSpectraAODPID *pid = new AliSpectraAODPID();
+ pid->SetNSigmaCut(Nsigmapid);
+
+ AliSpectraAODTrackCuts * trcuts = new AliSpectraAODTrackCuts("Track Cuts");
+ trcuts->SetDCA(DCA);
+ trcuts->SetTrackBits(trkbit);
+ trcuts->SetPt(pt);
+ trcuts->SetP(p);
+ trcuts->SetY(y);
+ trcuts->SetPtTOFMatching(ptTofMatch);
+ trcuts->SetEta(EtaMin,EtaMax);
+ trcuts->SetMinTPCcls(minNclsTPC);
+ trcuts->PrintCuts();
+
+ AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts("Event Cuts");
+ evcuts->SetQVectorCut(QvecCutMin,QvecCutMax);
+ evcuts->SetCentralityCutMax(CentCutMax);
+ evcuts->SetCentralityCutMin(CentCutMin);
+ evcuts->SetTrackBits(trkbitQVector);
+ if(mc==1)evcuts->SetIsMC(kTRUE);
+ evcuts->PrintCuts();
+
+ AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD(Form("TaskAODSpectraCent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",
+ CentCutMin,
+ CentCutMax,
+ QvecCutMin,
+ QvecCutMax,
+ EtaMin,
+ EtaMax,
+ Nsigmapid,
+ trkbit,
+ opt.Data()));
+ task->SetPID(pid);
+ task->SetEventCuts(evcuts);
+ task->SetTrackCuts(trcuts);
+ task->SetNRebin(nrebin);
+ if(mc==1)task->SetIsMC(kTRUE);
+
+ TString outputFileName = AliAnalysisManager::GetCommonFileName();
+
+ TString typeofdata=mc?"MC":"Data";
+
+ outputFileName += Form(":OutputAODSpectraTask_%s_Cent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),evcuts->GetQVectorCutMin(), evcuts->GetQVectorCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax(),pid->GetNSigmaCut(),trcuts->GetTrackType(),opt.Data());
+
+ cout<<"outputFileName: "<<outputFileName<<endl;
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+ AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer("chistpt", AliSpectraAODHistoManager::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+ AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("cvcutpt", AliSpectraAODEventCuts::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+ AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer("ctcutpt", AliSpectraAODTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
+ AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer("cpidpt", AliSpectraAODPID::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+
+ mgr->AddTask(task);
+
+ mgr->ConnectInput(task, 0, cinput);
+ mgr->ConnectOutput(task, 1, coutputpt1);
+ mgr->ConnectOutput(task, 2, coutputpt2);
+ mgr->ConnectOutput(task, 3, coutputpt3);
+ mgr->ConnectOutput(task, 4, coutputpt4);
+
+ return task;
+}
-AliAnalysisTaskSpectraAllChAOD* AddTaskSpectraAllChAOD(\r
- Bool_t mc=kFALSE,\r
- Double_t CentCutMin=0,\r
- Double_t CentCutMax=100,\r
- Double_t QvecCutMin=0,\r
- Double_t QvecCutMax=100,\r
- Double_t EtaMin=-0.8,\r
- Double_t EtaMax=0.8,\r
- Double_t pt=50.,\r
- Double_t ptTofMatch=.6,\r
- UInt_t trkbit=1,\r
- Double_t DCA=100000,\r
- UInt_t minNclsTPC=70,\r
- Double_t nsigmacut=5.,\r
- Int_t PIDtype=3,\r
- TString opt=""){\r
- \r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) \r
- {\r
- ::Error("AddAliAnalysisTaskSpectraAllChAOD", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
- \r
- // Check the analysis type using the event handlers connected to the analysis manager.\r
- //==============================================================================\r
- if (!mgr->GetInputEventHandler()) \r
- {\r
- ::Error("AliAnalysisTaskSpectraAllChAOD", "This task requires an input event handler");\r
- return NULL;\r
- } \r
- \r
- TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
- if(type.Contains("ESD"))\r
- {\r
- ::Error("AliAnalysisTaskSpectraAllChAOD", "This task requires to run on AOD");\r
- return NULL;\r
- }\r
- \r
- AliSpectraAODTrackCuts * trcuts = new AliSpectraAODTrackCuts(Form("TrackCuts%s",opt.Data())); \r
- trcuts->SetDCA(DCA);\r
- trcuts->SetTrackBits(trkbit);\r
- trcuts->SetPt(pt);\r
- trcuts->SetPtTOFMatching(ptTofMatch); \r
- trcuts->SetEta(EtaMin,EtaMax);\r
- trcuts->SetMinTPCcls(minNclsTPC);\r
- trcuts->PrintCuts();\r
- \r
- AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts(Form("EventCuts%s",opt.Data()));\r
- evcuts->SetQVectorCut(QvecCutMin,QvecCutMax);\r
- evcuts->SetCentralityCutMax(CentCutMax); \r
- evcuts->SetCentralityCutMin(CentCutMin);\r
- if(mc==1)evcuts->SetIsMC(kTRUE);\r
- evcuts->PrintCuts();\r
- \r
- AliHelperPID *pid=new AliHelperPID();\r
- pid->SetName(Form("HelperPID%s",opt.Data()));\r
- pid->SetNSigmaCut(nsigmacut);\r
- pid->SetPIDType(PIDtype);\r
- if(PIDtype==3){\r
- AliPIDCombined *pidc=new AliPIDCombined();\r
- pidc->SetDefaultTPCPriors();\r
- pid->SetPIDCombined(pidc);\r
- }\r
- \r
- AliAnalysisTaskSpectraAllChAOD *task = new AliAnalysisTaskSpectraAllChAOD(Form("TaskAODSpectraCent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_TrBit%d%s", \r
- CentCutMin,\r
- CentCutMax,\r
- QvecCutMin,\r
- QvecCutMax,\r
- EtaMin,\r
- EtaMax,\r
- trkbit,\r
- opt.Data()));\r
- task->SetEventCuts(evcuts);\r
- task->SetTrackCuts(trcuts);\r
- task->SetHelperPID(pid);\r
- if(mc==1)task->SetIsMC(kTRUE);\r
- \r
- TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
- \r
- TString typeofdata=mc?"MC":"Data";\r
- \r
- outputFileName += Form(":SpectraESE_%s%s",typeofdata.Data(),opt.Data());\r
- \r
- cout<<"outputFileName: "<<outputFileName<<endl;\r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); \r
- AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chist%s",opt.Data()), TList::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcut%s",opt.Data()), AliSpectraAODEventCuts::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcut%s",opt.Data()), AliSpectraAODTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);\r
- AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpid%s",opt.Data()), AliHelperPID::Class(), AliAnalysisManager::kOutputContainer, outputFileName);\r
- mgr->AddTask(task);\r
- \r
- mgr->ConnectInput(task, 0, cinput);\r
- mgr->ConnectOutput(task, 1, coutputpt1);\r
- mgr->ConnectOutput(task, 2, coutputpt2);\r
- mgr->ConnectOutput(task, 3, coutputpt3);\r
- mgr->ConnectOutput(task, 4, coutputpt4);\r
- \r
- return task;\r
-}\r
+AliAnalysisTaskSpectraAllChAOD* AddTaskSpectraAllChAOD(
+ Bool_t mc=kFALSE,
+ Double_t CentCutMin=0,
+ Double_t CentCutMax=100,
+ Double_t QvecCutMin=0,
+ Double_t QvecCutMax=100,
+ Double_t EtaMin=-0.8,
+ Double_t EtaMax=0.8,
+ Double_t pt=50.,
+ Double_t ptTofMatch=.6,
+ UInt_t trkbit=1,
+ Double_t DCA=100000,
+ UInt_t minNclsTPC=70,
+ Double_t nsigmacut=5.,
+ Int_t PIDtype=3,
+ TString opt=""){
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr)
+ {
+ ::Error("AddAliAnalysisTaskSpectraAllChAOD", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis manager.
+ //==============================================================================
+ if (!mgr->GetInputEventHandler())
+ {
+ ::Error("AliAnalysisTaskSpectraAllChAOD", "This task requires an input event handler");
+ return NULL;
+ }
+
+ TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+ if(type.Contains("ESD"))
+ {
+ ::Error("AliAnalysisTaskSpectraAllChAOD", "This task requires to run on AOD");
+ return NULL;
+ }
+
+ AliSpectraAODTrackCuts * trcuts = new AliSpectraAODTrackCuts(Form("TrackCuts%s",opt.Data()));
+ trcuts->SetDCA(DCA);
+ trcuts->SetTrackBits(trkbit);
+ trcuts->SetPt(pt);
+ trcuts->SetPtTOFMatching(ptTofMatch);
+ trcuts->SetEta(EtaMin,EtaMax);
+ trcuts->SetMinTPCcls(minNclsTPC);
+ trcuts->PrintCuts();
+
+ AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts(Form("EventCuts%s",opt.Data()));
+ evcuts->SetQVectorCut(QvecCutMin,QvecCutMax);
+ evcuts->SetCentralityCutMax(CentCutMax);
+ evcuts->SetCentralityCutMin(CentCutMin);
+ if(mc==1)evcuts->SetIsMC(kTRUE);
+ evcuts->PrintCuts();
+
+ AliHelperPID *pid=new AliHelperPID();
+ pid->SetName(Form("HelperPID%s",opt.Data()));
+ pid->SetNSigmaCut(nsigmacut);
+ pid->SetPIDType(PIDtype);
+ if(PIDtype==3){
+ AliPIDCombined *pidc=new AliPIDCombined();
+ pidc->SetDefaultTPCPriors();
+ pid->SetPIDCombined(pidc);
+ }
+
+ AliAnalysisTaskSpectraAllChAOD *task = new AliAnalysisTaskSpectraAllChAOD(Form("TaskAODSpectraCent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_TrBit%d%s",
+ CentCutMin,
+ CentCutMax,
+ QvecCutMin,
+ QvecCutMax,
+ EtaMin,
+ EtaMax,
+ trkbit,
+ opt.Data()));
+ task->SetEventCuts(evcuts);
+ task->SetTrackCuts(trcuts);
+ task->SetHelperPID(pid);
+ if(mc==1)task->SetIsMC(kTRUE);
+
+ TString outputFileName = AliAnalysisManager::GetCommonFileName();
+
+ TString typeofdata=mc?"MC":"Data";
+
+ outputFileName += Form(":SpectraESE_%s%s",typeofdata.Data(),opt.Data());
+
+ cout<<"outputFileName: "<<outputFileName<<endl;
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+ AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chist%s",opt.Data()), TList::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+ AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcut%s",opt.Data()), AliSpectraAODEventCuts::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+ AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcut%s",opt.Data()), AliSpectraAODTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
+ AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpid%s",opt.Data()), AliHelperPID::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
+ mgr->AddTask(task);
+
+ mgr->ConnectInput(task, 0, cinput);
+ mgr->ConnectOutput(task, 1, coutputpt1);
+ mgr->ConnectOutput(task, 2, coutputpt2);
+ mgr->ConnectOutput(task, 3, coutputpt3);
+ mgr->ConnectOutput(task, 4, coutputpt4);
+
+ return task;
+}
-AliAnalysisTaskSpectraBoth* AddTaskSpectraBoth(Bool_t mc=kFALSE,\r
- Double_t CentCutMin=0,\r
- Double_t CentCutMax=100,\r
- Double_t QvecCutMin=0,\r
- Double_t QvecCutMax=100,\r
- Double_t EtaMin=-0.8,\r
- Double_t EtaMax=0.8,\r
- Double_t Nsigmapid=3.,\r
- Double_t pt=5.,\r
- Double_t p=5.,\r
- Double_t ymin=-0.5,\r
- Double_t ymax=.5, \r
- Double_t ptTofMatch=.6,\r
- UInt_t trkbit=1,\r
- UInt_t trkbitQVector=1,\r
- Bool_t UseCentPatchAOD049=kFALSE,\r
- Double_t DCA=100000,\r
- UInt_t minNclsTPC=70,\r
- Int_t nrebin=0,\r
- TString centestimator="V0M",\r
- Int_t pidmethod=2, \r
- Float_t tpcshift=0.0,\r
- Float_t tofshift=0.0){\r
- \r
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
- if (!mgr) \r
- {\r
- ::Error("AddAliAnalysisTaskSpectraAOD", "No analysis manager to connect to.");\r
- return NULL;\r
- } \r
- \r
- // Check the analysis type using the event handlers connected to the analysis manager.\r
- //==============================================================================\r
- if (!mgr->GetInputEventHandler()) \r
- {\r
- ::Error("AddTaskITSsaTracks", "This task requires an input event handler");\r
- return NULL;\r
- } \r
- \r
- TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
- // if(type.Contains("ESD"))\r
- // {\r
- // ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");\r
- // return NULL;\r
- // }\r
- \r
- using namespace AliSpectraNameSpaceBoth;\r
- \r
- TString opt=Form("Est_%s_Pid_%d_Y%.1fto%.1f", centestimator.Data(),pidmethod,ymin,ymax); \r
- AliSpectraBothPID *pid = new AliSpectraBothPID(); \r
- pid->SetNSigmaCut(Nsigmapid);\r
- pid->SetShiftTPC(tpcshift);\r
- pid->SetShiftTOF(tofshift);\r
- if(pidmethod==0)\r
- pid->SetPIDtype(AliSpectraBothPID::kNSigmaTPC);\r
- else if (pidmethod==1)\r
- pid->SetPIDtype(AliSpectraBothPID::kNSigmaTOF);\r
- else if (pidmethod==2) \r
- pid->SetPIDtype(AliSpectraBothPID::kNSigmacircleTPCTOF);\r
- else \r
- pid->SetPIDtype(AliSpectraBothPID::kNSigmasquareTPCTOF); \r
-\r
- AliSpectraBothTrackCuts * trcuts = new AliSpectraBothTrackCuts("Track Cuts"); \r
- trcuts->SetDCA(DCA);\r
- trcuts->SetTrackBits(trkbit);\r
- trcuts->SetPt(pt);\r
- trcuts->SetP(p);\r
- trcuts->SetY(ymax,ymin);\r
- trcuts->SetPtTOFMatching(ptTofMatch); \r
- trcuts->SetEta(EtaMin,EtaMax);\r
- trcuts->SetMinTPCcls(minNclsTPC);\r
- trcuts->PrintCuts();\r
- \r
- AliSpectraBothEventCuts * evcuts = new AliSpectraBothEventCuts("Event Cuts");\r
- evcuts->SetQVectorCut(QvecCutMin,QvecCutMax);\r
- evcuts->SetCentralityCutMax(CentCutMax); \r
- evcuts->SetCentralityCutMin(CentCutMin);\r
- evcuts->SetTrackBits(trkbitQVector);\r
- evcuts->SetCentEstimator(centestimator); \r
- if(mc==1)evcuts->SetIsMC(kTRUE);\r
- evcuts->PrintCuts();\r
- \r
- AliAnalysisTaskSpectraBoth *task = new AliAnalysisTaskSpectraBoth(Form("TaskBothSpectraCent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s", \r
- CentCutMin,\r
- CentCutMax,\r
- QvecCutMin,\r
- QvecCutMax,\r
- EtaMin,\r
- EtaMax,\r
- Nsigmapid,\r
- trkbit,\r
- opt.Data()));\r
- task->SetPID(pid); \r
- task->SetEventCuts(evcuts);\r
- task->SetTrackCuts(trcuts);\r
- task->SetNRebin(nrebin);\r
- if(mc==1)task->SetIsMC(kTRUE);\r
- \r
- TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
- \r
- TString typeofdata=mc?"MC":"Data";\r
- outputFileName += Form(":OutputBothSpectraTask_%s_Cent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),evcuts->GetQVectorCutMin(), evcuts->GetQVectorCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax(),pid->GetNSigmaCut(),trcuts->GetTrackType(),opt.Data());\r
- \r
- TString tmpstring= Form("OutputBothSpectraTask_%s_Cent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),evcuts->GetQVectorCutMin(), evcuts->GetQVectorCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax(),pid->GetNSigmaCut(),trcuts->GetTrackType(),opt.Data());\r
- \r
- cout<<"outputFileName: "<<outputFileName<<endl;\r
- AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); \r
- AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("%schistpt",tmpstring.Data()), AliSpectraBothHistoManager::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("%scvcutpt",tmpstring.Data()), AliSpectraBothEventCuts::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("%sctcutpt",tmpstring.Data()), AliSpectraBothTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);\r
- AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("%scpidpt",tmpstring.Data()), AliSpectraBothPID::Class(), AliAnalysisManager::kOutputContainer,outputFileName);\r
- \r
- mgr->ConnectInput(task, 0, cinput);\r
- mgr->ConnectOutput(task, 1, coutputpt1);\r
- mgr->ConnectOutput(task, 2, coutputpt2);\r
- mgr->ConnectOutput(task, 3, coutputpt3);\r
- mgr->ConnectOutput(task, 4, coutputpt4);\r
- \r
- mgr->AddTask(task);\r
- return task;\r
-}\r
+AliAnalysisTaskSpectraBoth* AddTaskSpectraBoth(Bool_t mc=kFALSE,
+ Double_t CentCutMin=0,
+ Double_t CentCutMax=100,
+ Double_t QvecCutMin=0,
+ Double_t QvecCutMax=100,
+ Double_t EtaMin=-0.8,
+ Double_t EtaMax=0.8,
+ Double_t Nsigmapid=3.,
+ Double_t pt=5.,
+ Double_t p=5.,
+ Double_t ymin=-0.5,
+ Double_t ymax=.5,
+ Double_t ptTofMatch=.6,
+ UInt_t trkbit=1,
+ UInt_t trkbitQVector=1,
+ Bool_t UseCentPatchAOD049=kFALSE,
+ Double_t DCA=100000,
+ UInt_t minNclsTPC=70,
+ Int_t nrebin=0,
+ TString centestimator="V0M",
+ Int_t pidmethod=2,
+ Float_t tpcshift=0.0,
+ Float_t tofshift=0.0){
+
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr)
+ {
+ ::Error("AddAliAnalysisTaskSpectraAOD", "No analysis manager to connect to.");
+ return NULL;
+ }
+
+ // Check the analysis type using the event handlers connected to the analysis manager.
+ //==============================================================================
+ if (!mgr->GetInputEventHandler())
+ {
+ ::Error("AddTaskITSsaTracks", "This task requires an input event handler");
+ return NULL;
+ }
+
+ TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+ // if(type.Contains("ESD"))
+ // {
+ // ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");
+ // return NULL;
+ // }
+
+ using namespace AliSpectraNameSpaceBoth;
+
+ TString opt=Form("Est_%s_Pid_%d_Y%.1fto%.1f", centestimator.Data(),pidmethod,ymin,ymax);
+ AliSpectraBothPID *pid = new AliSpectraBothPID();
+ pid->SetNSigmaCut(Nsigmapid);
+ pid->SetShiftTPC(tpcshift);
+ pid->SetShiftTOF(tofshift);
+ if(pidmethod==0)
+ pid->SetPIDtype(AliSpectraBothPID::kNSigmaTPC);
+ else if (pidmethod==1)
+ pid->SetPIDtype(AliSpectraBothPID::kNSigmaTOF);
+ else if (pidmethod==2)
+ pid->SetPIDtype(AliSpectraBothPID::kNSigmacircleTPCTOF);
+ else
+ pid->SetPIDtype(AliSpectraBothPID::kNSigmasquareTPCTOF);
+
+ AliSpectraBothTrackCuts * trcuts = new AliSpectraBothTrackCuts("Track Cuts");
+ trcuts->SetDCA(DCA);
+ trcuts->SetTrackBits(trkbit);
+ trcuts->SetPt(pt);
+ trcuts->SetP(p);
+ trcuts->SetY(ymax,ymin);
+ trcuts->SetPtTOFMatching(ptTofMatch);
+ trcuts->SetEta(EtaMin,EtaMax);
+ trcuts->SetMinTPCcls(minNclsTPC);
+ trcuts->PrintCuts();
+
+ AliSpectraBothEventCuts * evcuts = new AliSpectraBothEventCuts("Event Cuts");
+ evcuts->SetQVectorCut(QvecCutMin,QvecCutMax);
+ evcuts->SetCentralityCutMax(CentCutMax);
+ evcuts->SetCentralityCutMin(CentCutMin);
+ evcuts->SetTrackBits(trkbitQVector);
+ evcuts->SetCentEstimator(centestimator);
+ if(mc==1)evcuts->SetIsMC(kTRUE);
+ evcuts->PrintCuts();
+
+ AliAnalysisTaskSpectraBoth *task = new AliAnalysisTaskSpectraBoth(Form("TaskBothSpectraCent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",
+ CentCutMin,
+ CentCutMax,
+ QvecCutMin,
+ QvecCutMax,
+ EtaMin,
+ EtaMax,
+ Nsigmapid,
+ trkbit,
+ opt.Data()));
+ task->SetPID(pid);
+ task->SetEventCuts(evcuts);
+ task->SetTrackCuts(trcuts);
+ task->SetNRebin(nrebin);
+ if(mc==1)task->SetIsMC(kTRUE);
+
+ TString outputFileName = AliAnalysisManager::GetCommonFileName();
+
+ TString typeofdata=mc?"MC":"Data";
+ outputFileName += Form(":OutputBothSpectraTask_%s_Cent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),evcuts->GetQVectorCutMin(), evcuts->GetQVectorCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax(),pid->GetNSigmaCut(),trcuts->GetTrackType(),opt.Data());
+
+ TString tmpstring= Form("OutputBothSpectraTask_%s_Cent%.0fto%.0f_QVec%.1fto%.1f_Eta%.1fto%.1f_%.1fSigmaPID_TrBit%d%s",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),evcuts->GetQVectorCutMin(), evcuts->GetQVectorCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax(),pid->GetNSigmaCut(),trcuts->GetTrackType(),opt.Data());
+
+ cout<<"outputFileName: "<<outputFileName<<endl;
+ AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+ AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("%schistpt",tmpstring.Data()), AliSpectraBothHistoManager::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+ AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("%scvcutpt",tmpstring.Data()), AliSpectraBothEventCuts::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+ AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("%sctcutpt",tmpstring.Data()), AliSpectraBothTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
+ AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("%scpidpt",tmpstring.Data()), AliSpectraBothPID::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
+
+ mgr->ConnectInput(task, 0, cinput);
+ mgr->ConnectOutput(task, 1, coutputpt1);
+ mgr->ConnectOutput(task, 2, coutputpt2);
+ mgr->ConnectOutput(task, 3, coutputpt3);
+ mgr->ConnectOutput(task, 4, coutputpt4);
+
+ mgr->AddTask(task);
+ return task;
+}
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskSpectraAOD class\r
-//-----------------------------------------------------------------\r
-\r
-#include "TChain.h"\r
-#include "TTree.h"\r
-#include "TLegend.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TCanvas.h"\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliAODTrack.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliVParticle.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODInputHandler.h"\r
-#include "AliAnalysisTaskSpectraAOD.h"\r
-#include "AliAnalysisTaskESDfilter.h"\r
-#include "AliAnalysisDataContainer.h"\r
-#include "AliSpectraAODHistoManager.h"\r
-#include "AliSpectraAODTrackCuts.h"\r
-#include "AliSpectraAODEventCuts.h"\r
-#include "AliCentrality.h"\r
-#include "TProof.h"\r
-#include "AliPID.h"\r
-#include "AliVEvent.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliStack.h"\r
-#include "AliSpectraAODPID.h"\r
-#include <TMCProcess.h>\r
-\r
-#include <iostream>\r
-\r
-\r
-\r
-\r
-using namespace AliSpectraNameSpace;\r
-using namespace std;\r
-\r
-ClassImp(AliAnalysisTaskSpectraAOD) // EX1 This stuff tells root to implement the streamer, inspector methods etc (we discussed about it today)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskSpectraAOD::AliAnalysisTaskSpectraAOD(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0)\r
-{\r
- // Default constructor\r
- \r
- DefineInput(0, TChain::Class());\r
- DefineOutput(1, AliSpectraAODHistoManager::Class());\r
- DefineOutput(2, AliSpectraAODEventCuts::Class());\r
- DefineOutput(3, AliSpectraAODTrackCuts::Class());\r
- DefineOutput(4, AliSpectraAODPID::Class());\r
- fNRebin=0;\r
- \r
-}\r
-//________________________________________________________________________\r
-//________________________________________________________________________\r
-void AliAnalysisTaskSpectraAOD::UserCreateOutputObjects()\r
-{\r
- // create output objects\r
- fHistMan = new AliSpectraAODHistoManager("SpectraHistos",fNRebin);\r
-\r
- if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");\r
- if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");\r
- if (!fPID) AliFatal("PID object should be set in the steering macro");\r
-\r
- PostData(1, fHistMan );\r
- PostData(2, fEventCuts);\r
- PostData(3, fTrackCuts);\r
- PostData(4, fPID );\r
-\r
-}\r
-//________________________________________________________________________\r
-void AliAnalysisTaskSpectraAOD::UserExec(Option_t *)\r
-{\r
- // main event loop\r
- //Printf("ALIVE");\r
- fAOD = dynamic_cast<AliAODEvent*>(fInputEvent);\r
- if (!fAOD) {\r
- AliWarning("ERROR: AliAODEvent not available \n");\r
- return;\r
- }\r
- \r
- if (strcmp(fAOD->ClassName(), "AliAODEvent"))\r
- {\r
- AliFatal("Not processing AODs");\r
- }\r
- \r
- if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection\r
- \r
- //AliCentrality fAliCentral*;\r
- // if ((fAOD->GetCentrality())->GetCentralityPercentile("V0M") > 5.) return;\r
- \r
- // First do MC to fill up the MC particle array, such that we can use it later\r
- TClonesArray *arrayMC = 0;\r
- if (fIsMC)\r
- {\r
- arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());\r
- if (!arrayMC) {\r
- AliFatal("Error: MC particles branch not found!\n");\r
- }\r
- Int_t nMC = arrayMC->GetEntries();\r
- for (Int_t iMC = 0; iMC < nMC; iMC++)\r
- {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);\r
- if(!partMC->Charge()) continue;//Skip neutrals\r
- //if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax()){//charged hadron are filled inside the eta acceptance\r
- //Printf("%f %f-%f",partMC->Eta(),fTrackCuts->GetEtaMin(),fTrackCuts->GetEtaMax());\r
- if(partMC->Eta() < fTrackCuts->GetEtaMin() || partMC->Eta() > fTrackCuts->GetEtaMax())continue;//ETA CUT ON GENERATED!!!!!!!!!!!!!!!!!!!!!!!!!!\r
- fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());\r
- \r
- //rapidity cut\r
- if(TMath::Abs(partMC->Y()) > fTrackCuts->GetY() ) continue; \r
- // check for true PID + and fill P_t histos \r
- Int_t charge = partMC->Charge() > 0 ? kChPos : kChNeg ;\r
- Int_t id = fPID->GetParticleSpecie(partMC);\r
- if(id != kSpUndefined) {\r
- fHistMan->GetHistogram2D(kHistPtGenTruePrimary,id,charge)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());\r
- }\r
- }\r
- }\r
- \r
- Double_t mass[3]={1.39570000000000000e-01,4.93676999999999977e-01,9.38271999999999995e-01};//FIXME masses to be taken from AliHelperPID\r
- //main loop on tracks\r
- for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {\r
- AliAODTrack* track = fAOD->GetTrack(iTracks);\r
- if (!fTrackCuts->IsSelected(track,kTRUE)) continue;\r
- \r
- fPID->FillQAHistos(fHistMan, track, fTrackCuts);\r
- \r
- //calculate DCA for AOD track\r
- Double_t dca=track->DCA();\r
- if(dca==-999.){// track->DCA() does not work in old AOD production\r
- Double_t d[2], covd[3];\r
- AliAODTrack* track_clone=(AliAODTrack*)track->Clone("track_clone"); // need to clone because PropagateToDCA updates the track parameters\r
- Bool_t isDCA = track_clone->PropagateToDCA(fAOD->GetPrimaryVertex(),fAOD->GetMagneticField(),9999.,d,covd);\r
- delete track_clone;\r
- if(!isDCA)d[0]=-999.;\r
- dca=d[0];\r
- }\r
- fHistMan->GetPtHistogram(kHistPtRec)->Fill(track->Pt(),dca); // PT histo\r
- \r
- // get identity and charge\r
- Int_t idRec = fPID->GetParticleSpecie(fHistMan,track, fTrackCuts);\r
- \r
- Int_t charge = track->Charge() > 0 ? kChPos : kChNeg;\r
- \r
- // Fill histograms, only if inside y and nsigma acceptance\r
- if(idRec != kSpUndefined){\r
- if(fTrackCuts->CheckYCut (mass[idRec]))fHistMan->GetHistogram2D(kHistPtRecSigma,idRec,charge)->Fill(track->Pt(),dca);\r
- }//can't put a continue because we still have to fill allcharged primaries, done later\r
- \r
- /* MC Part */\r
- if (arrayMC) {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));\r
- if (!partMC) { \r
- AliError("Cannot get MC particle");\r
- continue; \r
- }\r
- // Check if it is primary, secondary from material or secondary from weak decay\r
- Bool_t isPrimary = partMC->IsPhysicalPrimary();\r
- Bool_t isSecondaryMaterial = kFALSE; \r
- Bool_t isSecondaryWeak = kFALSE; \r
- if(!isPrimary) {\r
- Int_t mfl=-999,codemoth=-999;\r
- Int_t indexMoth=partMC->GetMother(); // FIXME ignore fakes? TO BE CHECKED, on ESD is GetFirstMother()\r
- if(indexMoth>=0){//is not fake\r
- AliAODMCParticle* moth = (AliAODMCParticle*) arrayMC->At(indexMoth);\r
- codemoth = TMath::Abs(moth->GetPdgCode());\r
- mfl = Int_t (codemoth/ TMath::Power(10, Int_t(TMath::Log10(codemoth))));\r
- }\r
- //Int_t uniqueID = partMC->GetUniqueID();\r
- //cout<<"uniqueID: "<<partMC->GetUniqueID()<<" "<<kPDecay<<endl;\r
- //cout<<"status: "<<partMC->GetStatus()<<" "<<kPDecay<<endl;\r
- // if(uniqueID == kPDecay)Printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");\r
- if(mfl==3) isSecondaryWeak = kTRUE; // add if(partMC->GetStatus() & kPDecay)? FIXME\r
- else isSecondaryMaterial = kTRUE;\r
- }\r
- \r
- if (isPrimary)fHistMan->GetPtHistogram(kHistPtRecPrimary)->Fill(track->Pt(),dca); // PT histo of primaries\r
- \r
- //nsigma cut (reconstructed nsigma)\r
- if(idRec == kSpUndefined) continue;\r
- \r
- // rapidity cut (reconstructed pt and identity)\r
- if(!fTrackCuts->CheckYCut (mass[idRec])) continue;\r
- \r
- // Get true ID\r
- Int_t idGen = fPID->GetParticleSpecie(partMC);\r
- //if(TMath::Abs(partMC->Y()) > fTrackCuts->GetY() ) continue; // FIXME: do we need a rapidity cut on the generated?\r
- // Fill histograms for primaries\r
- \r
- if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTrue, idGen, charge)->Fill(track->Pt(),dca); \r
- \r
- if (isPrimary) {\r
- fHistMan ->GetHistogram2D(kHistPtRecSigmaPrimary, idRec, charge)->Fill(track->Pt(),dca); \r
- if(idGen != kSpUndefined) {\r
- fHistMan ->GetHistogram2D(kHistPtRecPrimary, idGen, charge)->Fill(track->Pt(),dca);\r
- if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTruePrimary, idGen, charge)->Fill(track->Pt(),dca); \r
- }\r
- }\r
- //25th Apr - Muons are added to Pions -- FIXME\r
- if ( partMC->PdgCode() == 13 && idRec == kSpPion) { \r
- fHistMan->GetPtHistogram(kHistPtRecTrueMuonPlus)->Fill(track->Pt(),dca); \r
- if(isPrimary)\r
- fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonPlus)->Fill(track->Pt(),dca); \r
- }\r
- if ( partMC->PdgCode() == -13 && idRec == kSpPion) { \r
- fHistMan->GetPtHistogram(kHistPtRecTrueMuonMinus)->Fill(track->Pt(),dca); \r
- if (isPrimary) {\r
- fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonMinus)->Fill(track->Pt(),dca); \r
- }\r
- }\r
- \r
- ///..... END FIXME\r
- \r
- // Fill secondaries\r
- if(isSecondaryWeak ) fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);\r
- if(isSecondaryMaterial) fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryMaterial , idRec, charge)->Fill(track->Pt(),dca);\r
- \r
- }//end if(arrayMC)\r
- } // end loop on tracks\r
- \r
- PostData(1, fHistMan );\r
- PostData(2, fEventCuts);\r
- PostData(3, fTrackCuts);\r
- PostData(4, fPID );\r
-}\r
-\r
-//_________________________________________________________________\r
-void AliAnalysisTaskSpectraAOD::Terminate(Option_t *)\r
-{\r
- // Terminate\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskSpectraAOD class
+//-----------------------------------------------------------------
+
+#include "TChain.h"
+#include "TTree.h"
+#include "TLegend.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TCanvas.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliAODTrack.h"
+#include "AliAODMCParticle.h"
+#include "AliVParticle.h"
+#include "AliAODEvent.h"
+#include "AliAODInputHandler.h"
+#include "AliAnalysisTaskSpectraAOD.h"
+#include "AliAnalysisTaskESDfilter.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliSpectraAODHistoManager.h"
+#include "AliSpectraAODTrackCuts.h"
+#include "AliSpectraAODEventCuts.h"
+#include "AliCentrality.h"
+#include "TProof.h"
+#include "AliPID.h"
+#include "AliVEvent.h"
+#include "AliPIDResponse.h"
+#include "AliStack.h"
+#include "AliSpectraAODPID.h"
+#include <TMCProcess.h>
+
+#include <iostream>
+
+
+
+
+using namespace AliSpectraNameSpace;
+using namespace std;
+
+ClassImp(AliAnalysisTaskSpectraAOD) // EX1 This stuff tells root to implement the streamer, inspector methods etc (we discussed about it today)
+
+//________________________________________________________________________
+AliAnalysisTaskSpectraAOD::AliAnalysisTaskSpectraAOD(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0)
+{
+ // Default constructor
+
+ DefineInput(0, TChain::Class());
+ DefineOutput(1, AliSpectraAODHistoManager::Class());
+ DefineOutput(2, AliSpectraAODEventCuts::Class());
+ DefineOutput(3, AliSpectraAODTrackCuts::Class());
+ DefineOutput(4, AliSpectraAODPID::Class());
+ fNRebin=0;
+
+}
+//________________________________________________________________________
+//________________________________________________________________________
+void AliAnalysisTaskSpectraAOD::UserCreateOutputObjects()
+{
+ // create output objects
+ fHistMan = new AliSpectraAODHistoManager("SpectraHistos",fNRebin);
+
+ if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
+ if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
+ if (!fPID) AliFatal("PID object should be set in the steering macro");
+
+ PostData(1, fHistMan );
+ PostData(2, fEventCuts);
+ PostData(3, fTrackCuts);
+ PostData(4, fPID );
+
+}
+//________________________________________________________________________
+void AliAnalysisTaskSpectraAOD::UserExec(Option_t *)
+{
+ // main event loop
+ //Printf("ALIVE");
+ fAOD = dynamic_cast<AliAODEvent*>(fInputEvent);
+ if (!fAOD) {
+ AliWarning("ERROR: AliAODEvent not available \n");
+ return;
+ }
+
+ if (strcmp(fAOD->ClassName(), "AliAODEvent"))
+ {
+ AliFatal("Not processing AODs");
+ }
+
+ if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
+
+ //AliCentrality fAliCentral*;
+ // if ((fAOD->GetCentrality())->GetCentralityPercentile("V0M") > 5.) return;
+
+ // First do MC to fill up the MC particle array, such that we can use it later
+ TClonesArray *arrayMC = 0;
+ if (fIsMC)
+ {
+ arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+ if (!arrayMC) {
+ AliFatal("Error: MC particles branch not found!\n");
+ }
+ Int_t nMC = arrayMC->GetEntries();
+ for (Int_t iMC = 0; iMC < nMC; iMC++)
+ {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);
+ if(!partMC->Charge()) continue;//Skip neutrals
+ //if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax()){//charged hadron are filled inside the eta acceptance
+ //Printf("%f %f-%f",partMC->Eta(),fTrackCuts->GetEtaMin(),fTrackCuts->GetEtaMax());
+ if(partMC->Eta() < fTrackCuts->GetEtaMin() || partMC->Eta() > fTrackCuts->GetEtaMax())continue;//ETA CUT ON GENERATED!!!!!!!!!!!!!!!!!!!!!!!!!!
+ fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());
+
+ //rapidity cut
+ if(TMath::Abs(partMC->Y()) > fTrackCuts->GetY() ) continue;
+ // check for true PID + and fill P_t histos
+ Int_t charge = partMC->Charge() > 0 ? kChPos : kChNeg ;
+ Int_t id = fPID->GetParticleSpecie(partMC);
+ if(id != kSpUndefined) {
+ fHistMan->GetHistogram2D(kHistPtGenTruePrimary,id,charge)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());
+ }
+ }
+ }
+
+ Double_t mass[3]={1.39570000000000000e-01,4.93676999999999977e-01,9.38271999999999995e-01};//FIXME masses to be taken from AliHelperPID
+ //main loop on tracks
+ for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
+ AliAODTrack* track = fAOD->GetTrack(iTracks);
+ if (!fTrackCuts->IsSelected(track,kTRUE)) continue;
+
+ fPID->FillQAHistos(fHistMan, track, fTrackCuts);
+
+ //calculate DCA for AOD track
+ Double_t dca=track->DCA();
+ if(dca==-999.){// track->DCA() does not work in old AOD production
+ Double_t d[2], covd[3];
+ AliAODTrack* track_clone=(AliAODTrack*)track->Clone("track_clone"); // need to clone because PropagateToDCA updates the track parameters
+ Bool_t isDCA = track_clone->PropagateToDCA(fAOD->GetPrimaryVertex(),fAOD->GetMagneticField(),9999.,d,covd);
+ delete track_clone;
+ if(!isDCA)d[0]=-999.;
+ dca=d[0];
+ }
+ fHistMan->GetPtHistogram(kHistPtRec)->Fill(track->Pt(),dca); // PT histo
+
+ // get identity and charge
+ Int_t idRec = fPID->GetParticleSpecie(fHistMan,track, fTrackCuts);
+
+ Int_t charge = track->Charge() > 0 ? kChPos : kChNeg;
+
+ // Fill histograms, only if inside y and nsigma acceptance
+ if(idRec != kSpUndefined){
+ if(fTrackCuts->CheckYCut (mass[idRec]))fHistMan->GetHistogram2D(kHistPtRecSigma,idRec,charge)->Fill(track->Pt(),dca);
+ }//can't put a continue because we still have to fill allcharged primaries, done later
+
+ /* MC Part */
+ if (arrayMC) {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));
+ if (!partMC) {
+ AliError("Cannot get MC particle");
+ continue;
+ }
+ // Check if it is primary, secondary from material or secondary from weak decay
+ Bool_t isPrimary = partMC->IsPhysicalPrimary();
+ Bool_t isSecondaryMaterial = kFALSE;
+ Bool_t isSecondaryWeak = kFALSE;
+ if(!isPrimary) {
+ Int_t mfl=-999,codemoth=-999;
+ Int_t indexMoth=partMC->GetMother(); // FIXME ignore fakes? TO BE CHECKED, on ESD is GetFirstMother()
+ if(indexMoth>=0){//is not fake
+ AliAODMCParticle* moth = (AliAODMCParticle*) arrayMC->At(indexMoth);
+ codemoth = TMath::Abs(moth->GetPdgCode());
+ mfl = Int_t (codemoth/ TMath::Power(10, Int_t(TMath::Log10(codemoth))));
+ }
+ //Int_t uniqueID = partMC->GetUniqueID();
+ //cout<<"uniqueID: "<<partMC->GetUniqueID()<<" "<<kPDecay<<endl;
+ //cout<<"status: "<<partMC->GetStatus()<<" "<<kPDecay<<endl;
+ // if(uniqueID == kPDecay)Printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ if(mfl==3) isSecondaryWeak = kTRUE; // add if(partMC->GetStatus() & kPDecay)? FIXME
+ else isSecondaryMaterial = kTRUE;
+ }
+
+ if (isPrimary)fHistMan->GetPtHistogram(kHistPtRecPrimary)->Fill(track->Pt(),dca); // PT histo of primaries
+
+ //nsigma cut (reconstructed nsigma)
+ if(idRec == kSpUndefined) continue;
+
+ // rapidity cut (reconstructed pt and identity)
+ if(!fTrackCuts->CheckYCut (mass[idRec])) continue;
+
+ // Get true ID
+ Int_t idGen = fPID->GetParticleSpecie(partMC);
+ //if(TMath::Abs(partMC->Y()) > fTrackCuts->GetY() ) continue; // FIXME: do we need a rapidity cut on the generated?
+ // Fill histograms for primaries
+
+ if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTrue, idGen, charge)->Fill(track->Pt(),dca);
+
+ if (isPrimary) {
+ fHistMan ->GetHistogram2D(kHistPtRecSigmaPrimary, idRec, charge)->Fill(track->Pt(),dca);
+ if(idGen != kSpUndefined) {
+ fHistMan ->GetHistogram2D(kHistPtRecPrimary, idGen, charge)->Fill(track->Pt(),dca);
+ if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTruePrimary, idGen, charge)->Fill(track->Pt(),dca);
+ }
+ }
+ //25th Apr - Muons are added to Pions -- FIXME
+ if ( partMC->PdgCode() == 13 && idRec == kSpPion) {
+ fHistMan->GetPtHistogram(kHistPtRecTrueMuonPlus)->Fill(track->Pt(),dca);
+ if(isPrimary)
+ fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonPlus)->Fill(track->Pt(),dca);
+ }
+ if ( partMC->PdgCode() == -13 && idRec == kSpPion) {
+ fHistMan->GetPtHistogram(kHistPtRecTrueMuonMinus)->Fill(track->Pt(),dca);
+ if (isPrimary) {
+ fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonMinus)->Fill(track->Pt(),dca);
+ }
+ }
+
+ ///..... END FIXME
+
+ // Fill secondaries
+ if(isSecondaryWeak ) fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+ if(isSecondaryMaterial) fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryMaterial , idRec, charge)->Fill(track->Pt(),dca);
+
+ }//end if(arrayMC)
+ } // end loop on tracks
+
+ PostData(1, fHistMan );
+ PostData(2, fEventCuts);
+ PostData(3, fTrackCuts);
+ PostData(4, fPID );
+}
+
+//_________________________________________________________________
+void AliAnalysisTaskSpectraAOD::Terminate(Option_t *)
+{
+ // Terminate
+}
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskSpectraAllChAOD class\r
-//-----------------------------------------------------------------\r
-\r
-#include "TChain.h"\r
-#include "TTree.h"\r
-#include "TLegend.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "THnSparse.h"\r
-#include "TCanvas.h"\r
-#include "AliAnalysisTask.h"\r
-#include "AliAODTrack.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliVParticle.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODInputHandler.h"\r
-#include "AliAnalysisTaskSpectraAllChAOD.h"\r
-#include "AliAnalysisTaskESDfilter.h"\r
-#include "AliAnalysisDataContainer.h"\r
-#include "AliSpectraAODTrackCuts.h"\r
-#include "AliSpectraAODEventCuts.h"\r
-#include "AliHelperPID.h"\r
-#include "AliPIDCombined.h"\r
-#include "AliCentrality.h"\r
-#include "TProof.h"\r
-#include "AliVEvent.h"\r
-#include "AliStack.h"\r
-#include <TMCProcess.h>\r
-\r
-#include <iostream>\r
-\r
-using namespace AliHelperPIDNameSpace;\r
-using namespace std;\r
-\r
-ClassImp(AliAnalysisTaskSpectraAllChAOD)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskSpectraAllChAOD::AliAnalysisTaskSpectraAllChAOD(const char *name) : AliAnalysisTaskSE(name), \r
- fAOD(0x0),\r
- fTrackCuts(0x0),\r
- fEventCuts(0x0),\r
- fHelperPID(0x0),\r
- fIsMC(0),\r
- fCharge(0),\r
- fVZEROside(0),\r
- fOutput(0x0),\r
- fnCentBins(20),\r
- fnQvecBins(40)\r
-{\r
- // Default constructor\r
- DefineInput(0, TChain::Class());\r
- DefineOutput(1, TList::Class());\r
- DefineOutput(2, AliSpectraAODEventCuts::Class());\r
- DefineOutput(3, AliSpectraAODTrackCuts::Class());\r
- DefineOutput(4, AliHelperPID::Class());\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskSpectraAllChAOD::UserCreateOutputObjects()\r
-{\r
- // create output objects\r
- fOutput=new TList();\r
- fOutput->SetOwner();\r
- fOutput->SetName("fOutput");\r
- \r
- if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");\r
- if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");\r
- if (!fHelperPID) AliFatal("HelperPID should be set in the steering macro");\r
- \r
- // binning common to all the THn\r
- const Double_t ptBins[] = {0.20,0.30,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.4,2.8,3.2,3.6,4.0,5.0,6.0,7.0,8.0,9.0,10.,12.,15.};\r
- const Int_t nptBins=26;\r
- \r
- //dimensions of THnSparse for tracks\r
- const Int_t nvartrk=8;\r
- // pt cent Q vec IDrec IDgen isph iswd y\r
- Int_t binsHistRealTrk[nvartrk] = { nptBins, fnCentBins, fnQvecBins, 4, 3, 2, 2, 2};\r
- Double_t xminHistRealTrk[nvartrk] = { 0., 0., 0., -1.5, -0.5, -0.5, -0.5, -0.5};\r
- Double_t xmaxHistRealTrk[nvartrk] = { 10., 100., 8., 2.5, 2.5, 1.5, 1.5, 0.5}; \r
- THnSparseF* NSparseHistTrk = new THnSparseF("NSparseHistTrk","NSparseHistTrk",nvartrk,binsHistRealTrk,xminHistRealTrk,xmaxHistRealTrk);\r
- NSparseHistTrk->GetAxis(0)->SetTitle("#it{p}_{T,rec}");\r
- NSparseHistTrk->GetAxis(0)->SetName("pT_rec");\r
- NSparseHistTrk->SetBinEdges(0,ptBins);\r
- NSparseHistTrk->GetAxis(1)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));\r
- NSparseHistTrk->GetAxis(1)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));\r
- NSparseHistTrk->GetAxis(2)->SetTitle("Q vec");\r
- NSparseHistTrk->GetAxis(2)->SetName("Q_vec");\r
- NSparseHistTrk->GetAxis(3)->SetTitle("ID rec");\r
- NSparseHistTrk->GetAxis(3)->SetName("ID_rec");\r
- NSparseHistTrk->GetAxis(4)->SetTitle("ID gen");\r
- NSparseHistTrk->GetAxis(4)->SetName("ID_gen");\r
- NSparseHistTrk->GetAxis(5)->SetTitle("isph");\r
- NSparseHistTrk->GetAxis(5)->SetName("isph");\r
- NSparseHistTrk->GetAxis(6)->SetTitle("iswd");\r
- NSparseHistTrk->GetAxis(6)->SetName("iswd");\r
- NSparseHistTrk->GetAxis(7)->SetTitle("y");\r
- NSparseHistTrk->GetAxis(7)->SetName("y");\r
- fOutput->Add(NSparseHistTrk);\r
- \r
- //dimensions of THnSparse for stack\r
- const Int_t nvarst=5;\r
- // pt cent IDgen isph y\r
- Int_t binsHistRealSt[nvarst] = { nptBins, fnCentBins, 3, 2, 2};\r
- Double_t xminHistRealSt[nvarst] = { 0., 0., -0.5, -0.5, -0.5};\r
- Double_t xmaxHistRealSt[nvarst] = { 10., 100., 2.5, 1.5, 0.5};\r
- THnSparseF* NSparseHistSt = new THnSparseF("NSparseHistSt","NSparseHistSt",nvarst,binsHistRealSt,xminHistRealSt,xmaxHistRealSt);\r
- NSparseHistSt->GetAxis(0)->SetTitle("#it{p}_{T,gen}");\r
- NSparseHistSt->SetBinEdges(0,ptBins);\r
- NSparseHistSt->GetAxis(0)->SetName("pT_rec");\r
- NSparseHistSt->GetAxis(1)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));\r
- NSparseHistSt->GetAxis(1)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));\r
- NSparseHistSt->GetAxis(2)->SetTitle("ID gen");\r
- NSparseHistSt->GetAxis(2)->SetName("ID_gen");\r
- NSparseHistSt->GetAxis(3)->SetTitle("isph");\r
- NSparseHistSt->GetAxis(3)->SetName("isph");\r
- NSparseHistSt->GetAxis(4)->SetTitle("y");\r
- NSparseHistSt->GetAxis(4)->SetName("y");\r
- fOutput->Add(NSparseHistSt);\r
- \r
- //dimensions of THnSparse for the normalization\r
- const Int_t nvarev=2;\r
- // cent Q vec \r
- Int_t binsHistRealEv[nvarev] = { fnCentBins, fnQvecBins};\r
- Double_t xminHistRealEv[nvarev] = { 0., 0.};\r
- Double_t xmaxHistRealEv[nvarev] = { 100., 10.};\r
- THnSparseF* NSparseHistEv = new THnSparseF("NSparseHistEv","NSparseHistEv",nvarev,binsHistRealEv,xminHistRealEv,xmaxHistRealEv);\r
- NSparseHistEv->GetAxis(0)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));\r
- NSparseHistEv->GetAxis(0)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));\r
- NSparseHistEv->GetAxis(1)->SetTitle("Q vec");\r
- NSparseHistEv->GetAxis(1)->SetName("Q_vec");\r
- fOutput->Add(NSparseHistEv);\r
- \r
- PostData(1, fOutput );\r
- PostData(2, fEventCuts);\r
- PostData(3, fTrackCuts);\r
- PostData(4, fHelperPID);\r
-}\r
-\r
-//________________________________________________________________________\r
-\r
-void AliAnalysisTaskSpectraAllChAOD::UserExec(Option_t *)\r
-{\r
- //Printf("An event");\r
- // main event loop\r
- fAOD = dynamic_cast<AliAODEvent*>(fInputEvent);\r
- if (!fAOD) {\r
- AliWarning("ERROR: AliAODEvent not available \n");\r
- return;\r
- }\r
- \r
- if (strcmp(fAOD->ClassName(), "AliAODEvent"))\r
- {\r
- AliFatal("Not processing AODs");\r
- }\r
- \r
- if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection\r
-\r
- //Default TPC priors\r
- if(fHelperPID->GetPIDType()==kBayes)fHelperPID->GetPIDCombined()->SetDefaultTPCPriors();//FIXME maybe this can go in the UserCreateOutputObject?\r
- \r
- Double_t Qvec=0.;//in case of MC we save space in the memory\r
- if(!fIsMC){\r
- if(fVZEROside==0)Qvec=fEventCuts->GetqV0A();\r
- else if (fVZEROside==1)Qvec=fEventCuts->GetqV0C();\r
- }\r
-\r
- Double_t Cent=fEventCuts->GetCent();\r
- \r
- // First do MC to fill up the MC particle array\r
- TClonesArray *arrayMC = 0;\r
- if (fIsMC)\r
- {\r
- arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());\r
- if (!arrayMC) {\r
- AliFatal("Error: MC particles branch not found!\n");\r
- }\r
- Int_t nMC = arrayMC->GetEntries();\r
- for (Int_t iMC = 0; iMC < nMC; iMC++)\r
- {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);\r
- if(!partMC->Charge()) continue;//Skip neutrals\r
- if(fCharge != 0 && partMC->Charge() != fCharge) continue;//if fCharge != 0 only select fCharge\r
- \r
- if(partMC->Eta() < fTrackCuts->GetEtaMin() || partMC->Eta() > fTrackCuts->GetEtaMax())continue;//ETA CUT ON GENERATED!!!!!!!!!!!!!!!!!!!!!!!!!!\r
- \r
- //pt cent IDgen isph y\r
- Double_t varSt[5];\r
- varSt[0]=partMC->Pt();\r
- varSt[1]=Cent;\r
- varSt[2]=(Double_t)fHelperPID->GetParticleSpecies(partMC);\r
- varSt[3]=(Double_t)partMC->IsPhysicalPrimary();\r
- varSt[4]=partMC->Y();\r
- ((THnSparseF*)fOutput->FindObject("NSparseHistSt"))->Fill(varSt);//stack loop\r
- \r
- //Printf("a particle");\r
- \r
- }\r
- }\r
- \r
- //main loop on tracks\r
- for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {\r
- AliAODTrack* track = fAOD->GetTrack(iTracks);\r
- if(fCharge != 0 && track->Charge() != fCharge) continue;//if fCharge != 0 only select fCharge \r
- if (!fTrackCuts->IsSelected(track,kTRUE)) continue; //track selection (rapidity selection NOT in the standard cuts)\r
- Int_t IDrec=fHelperPID->GetParticleSpecies(track,kTRUE);//id from detector\r
- Double_t y= track->Y(fHelperPID->GetMass((AliHelperParticleSpecies_t)IDrec));\r
- Int_t IDgen=kSpUndefined;//set if MC\r
- Int_t isph=-999;\r
- Int_t iswd=-999;\r
- \r
- if (arrayMC) {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));\r
- if (!partMC) { \r
- AliError("Cannot get MC particle");\r
- continue; \r
- }\r
- IDgen=fHelperPID->GetParticleSpecies(partMC);\r
- isph=partMC->IsPhysicalPrimary();\r
- iswd=partMC->IsSecondaryFromWeakDecay();//FIXME not working on old productions\r
- }\r
- \r
- //pt cent Q vec IDrec IDgen isph iswd y\r
- Double_t varTrk[8];\r
- varTrk[0]=track->Pt();\r
- varTrk[1]=Cent;\r
- varTrk[2]=Qvec;\r
- varTrk[3]=(Double_t)IDrec;\r
- varTrk[4]=(Double_t)IDgen;\r
- varTrk[5]=(Double_t)isph;\r
- varTrk[6]=(Double_t)iswd;\r
- varTrk[7]=y;\r
- ((THnSparseF*)fOutput->FindObject("NSparseHistTrk"))->Fill(varTrk);//track loop\r
- \r
- //for nsigma PID fill double counting of ID\r
- if(fHelperPID->GetPIDType()<kBayes){//only nsigma\r
- Bool_t *HasDC;\r
- HasDC=fHelperPID->GetDoubleCounting(track,kTRUE);//get the array with double counting\r
- for(Int_t ipart=0;ipart<kNSpecies;ipart++){\r
- if(HasDC[ipart]==kTRUE){\r
- varTrk[3]=(Double_t)ipart;\r
- ((THnSparseF*)fOutput->FindObject("NSparseHistTrk"))->Fill(varTrk);//track loop\r
- }\r
- }\r
- }\r
- \r
- //fill all charged (-1)\r
- varTrk[3]=-1.;\r
- ((THnSparseF*)fOutput->FindObject("NSparseHistTrk"))->Fill(varTrk);//track loop\r
- \r
- //Printf("a track");\r
- \r
- } // end loop on tracks\r
- \r
- Double_t varEv[2];\r
- varEv[0]=Cent;\r
- varEv[1]=Qvec;\r
- ((THnSparseF*)fOutput->FindObject("NSparseHistEv"))->Fill(varEv);//event loop\r
- \r
- PostData(1, fOutput );\r
- PostData(2, fEventCuts);\r
- PostData(3, fTrackCuts);\r
- PostData(4, fHelperPID);\r
-}\r
-\r
-//_________________________________________________________________\r
-void AliAnalysisTaskSpectraAllChAOD::Terminate(Option_t *)\r
-{\r
- // Terminate\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskSpectraAllChAOD class
+//-----------------------------------------------------------------
+
+#include "TChain.h"
+#include "TTree.h"
+#include "TLegend.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "THnSparse.h"
+#include "TCanvas.h"
+#include "AliAnalysisTask.h"
+#include "AliAODTrack.h"
+#include "AliAODMCParticle.h"
+#include "AliVParticle.h"
+#include "AliAODEvent.h"
+#include "AliAODInputHandler.h"
+#include "AliAnalysisTaskSpectraAllChAOD.h"
+#include "AliAnalysisTaskESDfilter.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliSpectraAODTrackCuts.h"
+#include "AliSpectraAODEventCuts.h"
+#include "AliHelperPID.h"
+#include "AliPIDCombined.h"
+#include "AliCentrality.h"
+#include "TProof.h"
+#include "AliVEvent.h"
+#include "AliStack.h"
+#include <TMCProcess.h>
+
+#include <iostream>
+
+using namespace AliHelperPIDNameSpace;
+using namespace std;
+
+ClassImp(AliAnalysisTaskSpectraAllChAOD)
+
+//________________________________________________________________________
+AliAnalysisTaskSpectraAllChAOD::AliAnalysisTaskSpectraAllChAOD(const char *name) : AliAnalysisTaskSE(name),
+ fAOD(0x0),
+ fTrackCuts(0x0),
+ fEventCuts(0x0),
+ fHelperPID(0x0),
+ fIsMC(0),
+ fCharge(0),
+ fVZEROside(0),
+ fOutput(0x0),
+ fnCentBins(20),
+ fnQvecBins(40)
+{
+ // Default constructor
+ DefineInput(0, TChain::Class());
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, AliSpectraAODEventCuts::Class());
+ DefineOutput(3, AliSpectraAODTrackCuts::Class());
+ DefineOutput(4, AliHelperPID::Class());
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSpectraAllChAOD::UserCreateOutputObjects()
+{
+ // create output objects
+ fOutput=new TList();
+ fOutput->SetOwner();
+ fOutput->SetName("fOutput");
+
+ if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
+ if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
+ if (!fHelperPID) AliFatal("HelperPID should be set in the steering macro");
+
+ // binning common to all the THn
+ const Double_t ptBins[] = {0.20,0.30,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.4,2.8,3.2,3.6,4.0,5.0,6.0,7.0,8.0,9.0,10.,12.,15.};
+ const Int_t nptBins=26;
+
+ //dimensions of THnSparse for tracks
+ const Int_t nvartrk=8;
+ // pt cent Q vec IDrec IDgen isph iswd y
+ Int_t binsHistRealTrk[nvartrk] = { nptBins, fnCentBins, fnQvecBins, 4, 3, 2, 2, 2};
+ Double_t xminHistRealTrk[nvartrk] = { 0., 0., 0., -1.5, -0.5, -0.5, -0.5, -0.5};
+ Double_t xmaxHistRealTrk[nvartrk] = { 10., 100., 8., 2.5, 2.5, 1.5, 1.5, 0.5};
+ THnSparseF* NSparseHistTrk = new THnSparseF("NSparseHistTrk","NSparseHistTrk",nvartrk,binsHistRealTrk,xminHistRealTrk,xmaxHistRealTrk);
+ NSparseHistTrk->GetAxis(0)->SetTitle("#it{p}_{T,rec}");
+ NSparseHistTrk->GetAxis(0)->SetName("pT_rec");
+ NSparseHistTrk->SetBinEdges(0,ptBins);
+ NSparseHistTrk->GetAxis(1)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
+ NSparseHistTrk->GetAxis(1)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));
+ NSparseHistTrk->GetAxis(2)->SetTitle("Q vec");
+ NSparseHistTrk->GetAxis(2)->SetName("Q_vec");
+ NSparseHistTrk->GetAxis(3)->SetTitle("ID rec");
+ NSparseHistTrk->GetAxis(3)->SetName("ID_rec");
+ NSparseHistTrk->GetAxis(4)->SetTitle("ID gen");
+ NSparseHistTrk->GetAxis(4)->SetName("ID_gen");
+ NSparseHistTrk->GetAxis(5)->SetTitle("isph");
+ NSparseHistTrk->GetAxis(5)->SetName("isph");
+ NSparseHistTrk->GetAxis(6)->SetTitle("iswd");
+ NSparseHistTrk->GetAxis(6)->SetName("iswd");
+ NSparseHistTrk->GetAxis(7)->SetTitle("y");
+ NSparseHistTrk->GetAxis(7)->SetName("y");
+ fOutput->Add(NSparseHistTrk);
+
+ //dimensions of THnSparse for stack
+ const Int_t nvarst=5;
+ // pt cent IDgen isph y
+ Int_t binsHistRealSt[nvarst] = { nptBins, fnCentBins, 3, 2, 2};
+ Double_t xminHistRealSt[nvarst] = { 0., 0., -0.5, -0.5, -0.5};
+ Double_t xmaxHistRealSt[nvarst] = { 10., 100., 2.5, 1.5, 0.5};
+ THnSparseF* NSparseHistSt = new THnSparseF("NSparseHistSt","NSparseHistSt",nvarst,binsHistRealSt,xminHistRealSt,xmaxHistRealSt);
+ NSparseHistSt->GetAxis(0)->SetTitle("#it{p}_{T,gen}");
+ NSparseHistSt->SetBinEdges(0,ptBins);
+ NSparseHistSt->GetAxis(0)->SetName("pT_rec");
+ NSparseHistSt->GetAxis(1)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
+ NSparseHistSt->GetAxis(1)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));
+ NSparseHistSt->GetAxis(2)->SetTitle("ID gen");
+ NSparseHistSt->GetAxis(2)->SetName("ID_gen");
+ NSparseHistSt->GetAxis(3)->SetTitle("isph");
+ NSparseHistSt->GetAxis(3)->SetName("isph");
+ NSparseHistSt->GetAxis(4)->SetTitle("y");
+ NSparseHistSt->GetAxis(4)->SetName("y");
+ fOutput->Add(NSparseHistSt);
+
+ //dimensions of THnSparse for the normalization
+ const Int_t nvarev=2;
+ // cent Q vec
+ Int_t binsHistRealEv[nvarev] = { fnCentBins, fnQvecBins};
+ Double_t xminHistRealEv[nvarev] = { 0., 0.};
+ Double_t xmaxHistRealEv[nvarev] = { 100., 10.};
+ THnSparseF* NSparseHistEv = new THnSparseF("NSparseHistEv","NSparseHistEv",nvarev,binsHistRealEv,xminHistRealEv,xmaxHistRealEv);
+ NSparseHistEv->GetAxis(0)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
+ NSparseHistEv->GetAxis(0)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));
+ NSparseHistEv->GetAxis(1)->SetTitle("Q vec");
+ NSparseHistEv->GetAxis(1)->SetName("Q_vec");
+ fOutput->Add(NSparseHistEv);
+
+ PostData(1, fOutput );
+ PostData(2, fEventCuts);
+ PostData(3, fTrackCuts);
+ PostData(4, fHelperPID);
+}
+
+//________________________________________________________________________
+
+void AliAnalysisTaskSpectraAllChAOD::UserExec(Option_t *)
+{
+ //Printf("An event");
+ // main event loop
+ fAOD = dynamic_cast<AliAODEvent*>(fInputEvent);
+ if (!fAOD) {
+ AliWarning("ERROR: AliAODEvent not available \n");
+ return;
+ }
+
+ if (strcmp(fAOD->ClassName(), "AliAODEvent"))
+ {
+ AliFatal("Not processing AODs");
+ }
+
+ if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
+
+ //Default TPC priors
+ if(fHelperPID->GetPIDType()==kBayes)fHelperPID->GetPIDCombined()->SetDefaultTPCPriors();//FIXME maybe this can go in the UserCreateOutputObject?
+
+ Double_t Qvec=0.;//in case of MC we save space in the memory
+ if(!fIsMC){
+ if(fVZEROside==0)Qvec=fEventCuts->GetqV0A();
+ else if (fVZEROside==1)Qvec=fEventCuts->GetqV0C();
+ }
+
+ Double_t Cent=fEventCuts->GetCent();
+
+ // First do MC to fill up the MC particle array
+ TClonesArray *arrayMC = 0;
+ if (fIsMC)
+ {
+ arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+ if (!arrayMC) {
+ AliFatal("Error: MC particles branch not found!\n");
+ }
+ Int_t nMC = arrayMC->GetEntries();
+ for (Int_t iMC = 0; iMC < nMC; iMC++)
+ {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);
+ if(!partMC->Charge()) continue;//Skip neutrals
+ if(fCharge != 0 && partMC->Charge() != fCharge) continue;//if fCharge != 0 only select fCharge
+
+ if(partMC->Eta() < fTrackCuts->GetEtaMin() || partMC->Eta() > fTrackCuts->GetEtaMax())continue;//ETA CUT ON GENERATED!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ //pt cent IDgen isph y
+ Double_t varSt[5];
+ varSt[0]=partMC->Pt();
+ varSt[1]=Cent;
+ varSt[2]=(Double_t)fHelperPID->GetParticleSpecies(partMC);
+ varSt[3]=(Double_t)partMC->IsPhysicalPrimary();
+ varSt[4]=partMC->Y();
+ ((THnSparseF*)fOutput->FindObject("NSparseHistSt"))->Fill(varSt);//stack loop
+
+ //Printf("a particle");
+
+ }
+ }
+
+ //main loop on tracks
+ for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
+ AliAODTrack* track = fAOD->GetTrack(iTracks);
+ if(fCharge != 0 && track->Charge() != fCharge) continue;//if fCharge != 0 only select fCharge
+ if (!fTrackCuts->IsSelected(track,kTRUE)) continue; //track selection (rapidity selection NOT in the standard cuts)
+ Int_t IDrec=fHelperPID->GetParticleSpecies(track,kTRUE);//id from detector
+ Double_t y= track->Y(fHelperPID->GetMass((AliHelperParticleSpecies_t)IDrec));
+ Int_t IDgen=kSpUndefined;//set if MC
+ Int_t isph=-999;
+ Int_t iswd=-999;
+
+ if (arrayMC) {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));
+ if (!partMC) {
+ AliError("Cannot get MC particle");
+ continue;
+ }
+ IDgen=fHelperPID->GetParticleSpecies(partMC);
+ isph=partMC->IsPhysicalPrimary();
+ iswd=partMC->IsSecondaryFromWeakDecay();//FIXME not working on old productions
+ }
+
+ //pt cent Q vec IDrec IDgen isph iswd y
+ Double_t varTrk[8];
+ varTrk[0]=track->Pt();
+ varTrk[1]=Cent;
+ varTrk[2]=Qvec;
+ varTrk[3]=(Double_t)IDrec;
+ varTrk[4]=(Double_t)IDgen;
+ varTrk[5]=(Double_t)isph;
+ varTrk[6]=(Double_t)iswd;
+ varTrk[7]=y;
+ ((THnSparseF*)fOutput->FindObject("NSparseHistTrk"))->Fill(varTrk);//track loop
+
+ //for nsigma PID fill double counting of ID
+ if(fHelperPID->GetPIDType()<kBayes){//only nsigma
+ Bool_t *HasDC;
+ HasDC=fHelperPID->GetDoubleCounting(track,kTRUE);//get the array with double counting
+ for(Int_t ipart=0;ipart<kNSpecies;ipart++){
+ if(HasDC[ipart]==kTRUE){
+ varTrk[3]=(Double_t)ipart;
+ ((THnSparseF*)fOutput->FindObject("NSparseHistTrk"))->Fill(varTrk);//track loop
+ }
+ }
+ }
+
+ //fill all charged (-1)
+ varTrk[3]=-1.;
+ ((THnSparseF*)fOutput->FindObject("NSparseHistTrk"))->Fill(varTrk);//track loop
+
+ //Printf("a track");
+
+ } // end loop on tracks
+
+ Double_t varEv[2];
+ varEv[0]=Cent;
+ varEv[1]=Qvec;
+ ((THnSparseF*)fOutput->FindObject("NSparseHistEv"))->Fill(varEv);//event loop
+
+ PostData(1, fOutput );
+ PostData(2, fEventCuts);
+ PostData(3, fTrackCuts);
+ PostData(4, fHelperPID);
+}
+
+//_________________________________________________________________
+void AliAnalysisTaskSpectraAllChAOD::Terminate(Option_t *)
+{
+ // Terminate
+}
-#ifndef ALIANALYSISTASKSPECTRAALLCHAOD_H\r
-#define ALIANALYSISTASKSPECTRAALLCHAOD_H\r
-\r
-/* See cxx source for full Copyright notice */\r
-\r
-//-------------------------------------------------------------------------\r
-// AliAnalysisTaskSpectraAllChAOD\r
-//\r
-//\r
-//\r
-//\r
-// Author: Leonardo Milano, CERN\r
-//-------------------------------------------------------------------------\r
-\r
-class AliAODEvent;\r
-class AliSpectraAODTrackCuts;\r
-class AliSpectraAODEventCuts;\r
-class AliHelperPID;\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-\r
-class AliAnalysisTaskSpectraAllChAOD : public AliAnalysisTaskSE\r
-{\r
- public:\r
- // constructors\r
- AliAnalysisTaskSpectraAllChAOD() : AliAnalysisTaskSE(),\r
- fAOD(0x0),\r
- fTrackCuts(0x0),\r
- fEventCuts(0x0),\r
- fHelperPID(0x0),\r
- fIsMC(0),\r
- fCharge(0),\r
- fVZEROside(0),\r
- fOutput(0x0),\r
- fnCentBins(20),\r
- fnQvecBins(40)\r
- {}\r
- AliAnalysisTaskSpectraAllChAOD(const char *name);\r
- virtual ~AliAnalysisTaskSpectraAllChAOD() {\r
- Printf("calling detructor of AliAnalysisTaskSpectraAllChAOD - To be implemented");\r
- }\r
- \r
- void SetIsMC(Bool_t isMC = kFALSE) {fIsMC = isMC; };\r
- Bool_t GetIsMC() const { return fIsMC;};\r
- \r
- void SetCharge(Int_t charge = 0) {fCharge = charge; };\r
- Int_t GetCharge() const { return fCharge;};\r
- \r
- void SetVZEROside(Int_t side = 0) {fVZEROside = side; };\r
- Int_t GetVZEROside() const { return fVZEROside;};\r
- \r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- \r
- AliSpectraAODTrackCuts * GetTrackCuts() { return fTrackCuts; }\r
- AliSpectraAODEventCuts * GetEventCuts() { return fEventCuts; }\r
- AliHelperPID * GetHelperPID() { return fHelperPID; }\r
- TList * GetOutputList() { return fOutput; }\r
- \r
- void SetTrackCuts(AliSpectraAODTrackCuts * tc) { fTrackCuts = tc; }\r
- void SetEventCuts(AliSpectraAODEventCuts * vc) { fEventCuts = vc; }\r
- void SetHelperPID(AliHelperPID* pid) { fHelperPID = pid; }\r
- void SetnCentBins(Int_t val) { fnCentBins = val; }\r
- void SetnQvecBins(Int_t val) { fnQvecBins = val; }\r
- \r
- private:\r
- \r
- AliAODEvent * fAOD; //! AOD object\r
- AliSpectraAODTrackCuts * fTrackCuts; // Track Cuts\r
- AliSpectraAODEventCuts * fEventCuts; // Event Cuts\r
- AliHelperPID * fHelperPID; // points to class for PID\r
- Bool_t fIsMC; // true if processing MC\r
- Int_t fCharge; // charge to be selected\r
- Int_t fVZEROside; // 0: VZERO-A 1: VZERO-C\r
- TList * fOutput; // output list\r
- Int_t fnCentBins; // number of bins for the centrality axis\r
- Int_t fnQvecBins; // number of bins for the q vector axis\r
- AliAnalysisTaskSpectraAllChAOD(const AliAnalysisTaskSpectraAllChAOD&);\r
- AliAnalysisTaskSpectraAllChAOD& operator=(const AliAnalysisTaskSpectraAllChAOD&);\r
- \r
- ClassDef(AliAnalysisTaskSpectraAllChAOD, 4);\r
-};\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKSPECTRAALLCHAOD_H
+#define ALIANALYSISTASKSPECTRAALLCHAOD_H
+
+/* See cxx source for full Copyright notice */
+
+//-------------------------------------------------------------------------
+// AliAnalysisTaskSpectraAllChAOD
+//
+//
+//
+//
+// Author: Leonardo Milano, CERN
+//-------------------------------------------------------------------------
+
+class AliAODEvent;
+class AliSpectraAODTrackCuts;
+class AliSpectraAODEventCuts;
+class AliHelperPID;
+
+#include "AliAnalysisTaskSE.h"
+
+class AliAnalysisTaskSpectraAllChAOD : public AliAnalysisTaskSE
+{
+ public:
+ // constructors
+ AliAnalysisTaskSpectraAllChAOD() : AliAnalysisTaskSE(),
+ fAOD(0x0),
+ fTrackCuts(0x0),
+ fEventCuts(0x0),
+ fHelperPID(0x0),
+ fIsMC(0),
+ fCharge(0),
+ fVZEROside(0),
+ fOutput(0x0),
+ fnCentBins(20),
+ fnQvecBins(40)
+ {}
+ AliAnalysisTaskSpectraAllChAOD(const char *name);
+ virtual ~AliAnalysisTaskSpectraAllChAOD() {
+ Printf("calling detructor of AliAnalysisTaskSpectraAllChAOD - To be implemented");
+ }
+
+ void SetIsMC(Bool_t isMC = kFALSE) {fIsMC = isMC; };
+ Bool_t GetIsMC() const { return fIsMC;};
+
+ void SetCharge(Int_t charge = 0) {fCharge = charge; };
+ Int_t GetCharge() const { return fCharge;};
+
+ void SetVZEROside(Int_t side = 0) {fVZEROside = side; };
+ Int_t GetVZEROside() const { return fVZEROside;};
+
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+
+ AliSpectraAODTrackCuts * GetTrackCuts() { return fTrackCuts; }
+ AliSpectraAODEventCuts * GetEventCuts() { return fEventCuts; }
+ AliHelperPID * GetHelperPID() { return fHelperPID; }
+ TList * GetOutputList() { return fOutput; }
+
+ void SetTrackCuts(AliSpectraAODTrackCuts * tc) { fTrackCuts = tc; }
+ void SetEventCuts(AliSpectraAODEventCuts * vc) { fEventCuts = vc; }
+ void SetHelperPID(AliHelperPID* pid) { fHelperPID = pid; }
+ void SetnCentBins(Int_t val) { fnCentBins = val; }
+ void SetnQvecBins(Int_t val) { fnQvecBins = val; }
+
+ private:
+
+ AliAODEvent * fAOD; //! AOD object
+ AliSpectraAODTrackCuts * fTrackCuts; // Track Cuts
+ AliSpectraAODEventCuts * fEventCuts; // Event Cuts
+ AliHelperPID * fHelperPID; // points to class for PID
+ Bool_t fIsMC; // true if processing MC
+ Int_t fCharge; // charge to be selected
+ Int_t fVZEROside; // 0: VZERO-A 1: VZERO-C
+ TList * fOutput; // output list
+ Int_t fnCentBins; // number of bins for the centrality axis
+ Int_t fnQvecBins; // number of bins for the q vector axis
+ AliAnalysisTaskSpectraAllChAOD(const AliAnalysisTaskSpectraAllChAOD&);
+ AliAnalysisTaskSpectraAllChAOD& operator=(const AliAnalysisTaskSpectraAllChAOD&);
+
+ ClassDef(AliAnalysisTaskSpectraAllChAOD, 4);
+};
+
+#endif
-/**************************************************************************\r
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskSpectraBoth class\r
-//-----------------------------------------------------------------\r
-\r
-#include "TChain.h"\r
-#include "TTree.h"\r
-#include "TLegend.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h"\r
-#include "TCanvas.h"\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliAODTrack.h"\r
-#include "AliAODMCParticle.h"\r
-#include "AliVParticle.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODInputHandler.h"\r
-#include "AliAnalysisTaskSpectraBoth.h"\r
-#include "AliAnalysisTaskESDfilter.h"\r
-#include "AliAnalysisDataContainer.h"\r
-#include "AliSpectraBothHistoManager.h"\r
-#include "AliSpectraBothTrackCuts.h"\r
-#include "AliSpectraBothEventCuts.h"\r
-#include "AliCentrality.h"\r
-#include "TProof.h"\r
-#include "AliPID.h"\r
-#include "AliVEvent.h"\r
-#include "AliESDEvent.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliStack.h"\r
-#include "AliSpectraBothPID.h"\r
-#include "AliGenEventHeader.h" \r
-#include <TMCProcess.h>\r
-\r
-#include <iostream>\r
-\r
-\r
-\r
-\r
-using namespace AliSpectraNameSpaceBoth;\r
-using namespace std;\r
-\r
-ClassImp(AliAnalysisTaskSpectraBoth)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0)\r
-{\r
- // Default constructor\r
- \r
- DefineInput(0, TChain::Class());\r
- DefineOutput(1, AliSpectraBothHistoManager::Class());\r
- DefineOutput(2, AliSpectraBothEventCuts::Class());\r
- DefineOutput(3, AliSpectraBothTrackCuts::Class());\r
- DefineOutput(4, AliSpectraBothPID::Class());\r
- fNRebin=0;\r
- \r
-}\r
-//________________________________________________________________________\r
-//________________________________________________________________________\r
-void AliAnalysisTaskSpectraBoth::UserCreateOutputObjects()\r
-{\r
- // create output objects\r
- fHistMan = new AliSpectraBothHistoManager("SpectraHistos",fNRebin);\r
-\r
- if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");\r
- if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");\r
- if (!fPID) AliFatal("PID object should be set in the steering macro");\r
- fTrackCuts->SetAliESDtrackCuts(fCuts);\r
- fEventCuts->InitHisto();\r
- fTrackCuts->InitHisto();\r
-\r
- PostData(1, fHistMan );\r
- PostData(2, fEventCuts);\r
- PostData(3, fTrackCuts);\r
- PostData(4, fPID );\r
-}\r
-//________________________________________________________________________\r
-void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)\r
-{\r
- // main event loop\r
- Int_t ifAODEvent=AliSpectraBothTrackCuts::kotherobject;\r
- fAOD = dynamic_cast<AliVEvent*>(InputEvent());\r
- // AliESDEvent* esdevent=0x0;\r
- // AliAODEvent* aodevent=0x0;\r
- \r
- TString nameoftrack(fAOD->ClassName()); \r
- if(!nameoftrack.CompareTo("AliESDEvent"))\r
- {\r
- ifAODEvent=AliSpectraBothTrackCuts::kESDobject;\r
- //esdevent=dynamic_cast<AliESDEvent*>(fAOD);\r
- }\r
- else if(!nameoftrack.CompareTo("AliAODEvent"))\r
- {\r
- ifAODEvent=AliSpectraBothTrackCuts::kAODobject;\r
- //aodevent=dynamic_cast<AliAODEvent*>(fAOD);\r
- }\r
- else\r
- AliFatal("Not processing AODs or ESDS") ;\r
- if(fdotheMCLoopAfterEventCuts)\r
- if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection\r
- TClonesArray *arrayMC = 0;\r
- Int_t npar=0;\r
- AliStack* stack=0x0;\r
- Double_t mcZ=-100;\r
-\r
- if (fIsMC)\r
- {\r
- TArrayF mcVertex(3);\r
- mcVertex[0]=9999.; mcVertex[1]=9999.; mcVertex[2]=9999.;\r
- AliMCEvent* mcEvent=(AliMCEvent*)MCEvent();\r
- if (!mcEvent) \r
- {\r
- AliFatal("Error: MC particles branch not found!\n");\r
- }\r
- AliHeader* header = mcEvent->Header();\r
- if (!header) \r
- {\r
- AliDebug(AliLog::kError, "Header not available");\r
- return;\r
- }\r
- \r
- AliGenEventHeader* genHeader = header->GenEventHeader();\r
- if(genHeader)\r
- {\r
- genHeader->PrimaryVertex(mcVertex);\r
- mcZ=mcVertex[2];\r
- }\r
- if(ifAODEvent==AliSpectraBothTrackCuts::kAODobject)\r
- {\r
- arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());\r
- if (!arrayMC) \r
- {\r
- AliFatal("Error: MC particles branch not found!\n");\r
- }\r
- Int_t nMC = arrayMC->GetEntries();\r
- for (Int_t iMC = 0; iMC < nMC; iMC++)\r
- {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);\r
- if(!partMC->Charge()) continue;//Skip neutrals\r
- //if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax()){//charged hadron are filled inside the eta acceptance\r
- //Printf("%f %f-%f",partMC->Eta(),fTrackCuts->GetEtaMin(),fTrackCuts->GetEtaMax());\r
- if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax())\r
- fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary()); \r
- //rapidity cut\r
- if(partMC->Y() > fTrackCuts->GetYMax()|| partMC->Y() < fTrackCuts->GetYMin() ) \r
- continue; \r
- if(partMC->IsPhysicalPrimary())\r
- npar++; \r
- // check for true PID + and fill P_t histos \r
- Int_t charge = partMC->Charge() > 0 ? kChPos : kChNeg ;\r
- Int_t id = fPID->GetParticleSpecie(partMC);\r
- if(id != kSpUndefined) \r
- {\r
- fHistMan->GetHistogram2D(kHistPtGenTruePrimary,id,charge)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());\r
- }\r
- }\r
- }\r
- if(ifAODEvent==AliSpectraBothTrackCuts::kESDobject)\r
- {\r
- stack = mcEvent->Stack();\r
- Int_t nMC = stack->GetNtrack();\r
- for (Int_t iMC = 0; iMC < nMC; iMC++)\r
- {\r
- \r
- TParticle *partMC = stack->Particle(iMC);\r
- \r
- if(!partMC) \r
- continue; \r
- \r
- if(!partMC->GetPDG(0))\r
- continue;\r
- if(TMath::Abs(partMC->GetPDG(0)->Charge()/3.0)<0.01) \r
- continue;//Skip neutrals\r
- if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax())\r
- fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),stack->IsPhysicalPrimary(iMC));\r
- if(partMC->Y() > fTrackCuts->GetYMax() ||partMC->Y() < fTrackCuts->GetYMin() ) \r
- continue;\r
- if(stack->IsPhysicalPrimary(iMC))\r
- npar++; \r
- // check for true PID + and fill P_t histos \r
- Int_t charge = partMC->GetPDG(0)->Charge()/3.0 > 0 ? kChPos : kChNeg ;\r
- Int_t id = fPID->GetParticleSpecie(partMC);\r
- if(id != kSpUndefined) \r
- {\r
- fHistMan->GetHistogram2D(kHistPtGenTruePrimary,id,charge)->Fill(partMC->Pt(),stack->IsPhysicalPrimary(iMC));\r
- }\r
- }\r
- }\r
- }\r
- if(!fdotheMCLoopAfterEventCuts)\r
- if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ))return;//event selection\r
- //main loop on tracks\r
- Int_t ntracks=0;\r
- //cout<<fAOD->GetNumberOfTracks()<<endl;\r
- for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) \r
- {\r
- AliVTrack* track = dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));\r
- AliAODTrack* aodtrack=0;\r
- AliESDtrack* esdtrack=0;\r
- Float_t dca=-999.;\r
- Float_t dcaz=-999.;\r
- Short_t ncls=-1; \r
- Float_t chi2perndf=-1.0;\r
- if(ifAODEvent==AliSpectraBothTrackCuts::kESDobject)\r
- {\r
- esdtrack=dynamic_cast<AliESDtrack*>(track);\r
- if(!esdtrack)\r
- continue;\r
- esdtrack->GetImpactParameters(dca,dcaz);\r
- ncls=esdtrack->GetTPCNcls();\r
- if ( ncls > 5) \r
- chi2perndf=(esdtrack->GetTPCchi2()/Float_t(ncls - 5));\r
- \r
- else \r
- chi2perndf=-1;\r
- \r
- }\r
- else if (ifAODEvent==AliSpectraBothTrackCuts::kAODobject)\r
- {\r
- aodtrack=dynamic_cast<AliAODTrack*>(track);\r
- if(!aodtrack)\r
- continue; \r
- dca=aodtrack->DCA();\r
- dcaz=aodtrack->ZAtDCA();\r
- ncls=aodtrack->GetTPCNcls();\r
- chi2perndf=aodtrack->Chi2perNDF();\r
- }\r
- else\r
- continue;\r
- if (!fTrackCuts->IsSelected(track,kTRUE)) \r
- continue;\r
- ntracks++;\r
- fPID->FillQAHistos(fHistMan, track, fTrackCuts);\r
- \r
- //calculate DCA for AOD track\r
- if(dca==-999.)\r
- {// track->DCA() does not work in old AOD production\r
- Double_t d[2], covd[3];\r
- AliVTrack* track_clone=(AliVTrack*)track->Clone("track_clone"); // need to clone because PropagateToDCA updates the track parameters\r
- Bool_t isDCA = track_clone->PropagateToDCA(fAOD->GetPrimaryVertex(),fAOD->GetMagneticField(),9999.,d,covd);\r
- delete track_clone;\r
- if(!isDCA)\r
- d[0]=-999.;\r
- dca=d[0];\r
- dcaz=d[1]; \r
- }\r
- \r
- fHistMan->GetPtHistogram(kHistPtRec)->Fill(track->Pt(),dca); // PT histo\r
- // get identity and charge\r
- Bool_t rec[3]={false,false,false};\r
- Int_t idRec = fPID->GetParticleSpecie(fHistMan,track, fTrackCuts,rec);\r
- for(int irec=kSpPion;irec<kNSpecies;irec++)\r
- {\r
- \r
- if(fUseMinSigma)\r
- {\r
- if(irec>kSpPion)\r
- break;\r
- }\r
- else\r
- { \r
- if(!rec[irec]) \r
- idRec = kSpUndefined;\r
- else \r
- idRec=irec;\r
- } \r
- \r
- Int_t charge = track->Charge() > 0 ? kChPos : kChNeg;\r
- \r
- // Fill histograms, only if inside y and nsigma acceptance\r
- if(idRec != kSpUndefined && fTrackCuts->CheckYCut ((BothParticleSpecies_t)idRec))\r
- {\r
- fHistMan->GetHistogram2D(kHistPtRecSigma,idRec,charge)->Fill(track->Pt(),dca);\r
- fTrackCuts->GetHistoDCAzQA()->Fill(idRec,track->Pt(),dcaz);\r
- fTrackCuts->GetHistoNclustersQA()->Fill(idRec,track->Pt(),ncls);\r
- fTrackCuts->GetHistochi2perNDFQA()->Fill(idRec,track->Pt(),chi2perndf);\r
- }\r
- //can't put a continue because we still have to fill allcharged primaries, done later\r
- \r
- /* MC Part */\r
- if (arrayMC||stack) \r
- {\r
- Bool_t isPrimary = kFALSE;\r
- Bool_t isSecondaryMaterial = kFALSE; \r
- Bool_t isSecondaryWeak = kFALSE; \r
- Int_t idGen =kSpUndefined;\r
- Int_t pdgcode=0;\r
- if (ifAODEvent==AliSpectraBothTrackCuts::kAODobject)\r
- {\r
- AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));\r
- if (!partMC) \r
- { \r
- AliError("Cannot get MC particle");\r
- continue; \r
- }\r
- // Check if it is primary, secondary from material or secondary from weak decay\r
- isPrimary = partMC->IsPhysicalPrimary();\r
- isSecondaryWeak = partMC->IsSecondaryFromWeakDecay();\r
- isSecondaryMaterial = partMC->IsSecondaryFromMaterial();\r
- //cout<<"AOD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;\r
-\r
- if(!isPrimary&&!isSecondaryWeak&&!isSecondaryMaterial) \r
- {\r
- AliError("old tagging");\r
- Int_t mfl=-999,codemoth=-999;\r
- Int_t indexMoth=partMC->GetMother(); // FIXME ignore fakes? TO BE CHECKED, on ESD is GetFirstMother()\r
- if(indexMoth>=0)\r
- {//is not fake\r
- AliAODMCParticle* moth = (AliAODMCParticle*) arrayMC->At(indexMoth);\r
- codemoth = TMath::Abs(moth->GetPdgCode());\r
- mfl = Int_t (codemoth/ TMath::Power(10, Int_t(TMath::Log10(codemoth))));\r
- }\r
- //Int_t uniqueID = partMC->GetUniqueID();\r
- //cout<<"uniqueID: "<<partMC->GetUniqueID()<<" "<<kPDecay<<endl;\r
- //cout<<"status: "<<partMC->GetStatus()<<" "<<kPDecay<<endl;\r
- // if(uniqueID == kPDecay)Printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");\r
- if(mfl==3) \r
- isSecondaryWeak = kTRUE; // add if(partMC->GetStatus() & kPDecay)? FIXME\r
- else \r
- isSecondaryMaterial = kTRUE;\r
- }\r
- //cout<<"AOD 2 tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;\r
-\r
-\r
- idGen = fPID->GetParticleSpecie(partMC);\r
- pdgcode=partMC->GetPdgCode(); \r
- }\r
- else if (ifAODEvent==AliSpectraBothTrackCuts::kESDobject)\r
- {\r
- TParticle *partMC =stack->Particle(TMath::Abs(track->GetLabel()));\r
- if (!partMC) \r
- { \r
- AliError("Cannot get MC particle");\r
- continue; \r
- }\r
- isPrimary = stack->IsPhysicalPrimary(TMath::Abs(track->GetLabel()));\r
- isSecondaryWeak = stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()));\r
- isSecondaryMaterial = stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()));\r
- //cout<<"ESD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<endl;\r
- \r
- idGen = fPID->GetParticleSpecie(partMC);\r
- pdgcode=partMC->GetPdgCode(); \r
- }\r
- else\r
- return;\r
- \r
- // cout<<isPrimary<<" "<<isSecondaryWeak<<" "<<isSecondaryMaterial<<endl;\r
- // cout<<" functions "<<partMC->IsPhysicalPrimary()<<" "<<partMC->IsSecondaryFromWeakDecay()<<" "<<partMC->IsSecondaryFromMaterial()<<endl;\r
- \r
- if (isPrimary&&irec==kSpPion)\r
- fHistMan->GetPtHistogram(kHistPtRecPrimaryAll)->Fill(track->Pt(),dca); // PT histo of reconstrutsed primaries in defined eta\r
- \r
- //nsigma cut (reconstructed nsigma)\r
- if(idRec == kSpUndefined) \r
- continue;\r
- \r
- // rapidity cut (reconstructed pt and identity)\r
- if(!fTrackCuts->CheckYCut ((BothParticleSpecies_t)idRec)) continue;\r
- \r
- // Get true ID\r
- \r
- \r
- if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTrue, idGen, charge)->Fill(track->Pt(),dca); \r
- \r
- if (isPrimary) \r
- {\r
- fHistMan->GetHistogram2D(kHistPtRecSigmaPrimary, idRec, charge)->Fill(track->Pt(),dca); \r
- if(idGen != kSpUndefined) \r
- {\r
- fHistMan->GetHistogram2D(kHistPtRecPrimary, idGen, charge)->Fill(track->Pt(),dca);\r
- if (idRec == idGen) \r
- fHistMan->GetHistogram2D(kHistPtRecTruePrimary, idGen, charge)->Fill(track->Pt(),dca); \r
- }\r
- }\r
- //25th Apr - Muons are added to Pions -- FIXME\r
- if ( pdgcode == 13 && idRec == kSpPion) \r
- { \r
- fHistMan->GetPtHistogram(kHistPtRecTrueMuonPlus)->Fill(track->Pt(),dca); \r
- if(isPrimary)\r
- fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonPlus)->Fill(track->Pt(),dca); \r
- }\r
- if ( pdgcode == -13 && idRec == kSpPion) \r
- { \r
- fHistMan->GetPtHistogram(kHistPtRecTrueMuonMinus)->Fill(track->Pt(),dca); \r
- if (isPrimary) \r
- {\r
- fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonMinus)->Fill(track->Pt(),dca); \r
- }\r
- }\r
- \r
- ///..... END FIXME\r
- \r
- // Fill secondaries\r
- if(isSecondaryWeak ) \r
- fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);\r
- if(isSecondaryMaterial) \r
- fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryMaterial , idRec, charge)->Fill(track->Pt(),dca);\r
- \r
- }//end if(arrayMC)\r
- }\r
- \r
- \r
- } // end loop on tracks\r
-\r
- // cout<< ntracks<<endl;\r
- fHistMan->GetGenMulvsRawMulHistogram("hHistGenMulvsRawMul")->Fill(npar,ntracks);\r
- PostData(1, fHistMan );\r
- PostData(2, fEventCuts);\r
- PostData(3, fTrackCuts);\r
- PostData(4, fPID );\r
-}\r
-\r
-//_________________________________________________________________\r
-void AliAnalysisTaskSpectraBoth::Terminate(Option_t *)\r
-{\r
- // Terminate\r
-}\r
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskSpectraBoth class
+//-----------------------------------------------------------------
+
+#include "TChain.h"
+#include "TTree.h"
+#include "TLegend.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TCanvas.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliAODTrack.h"
+#include "AliAODMCParticle.h"
+#include "AliVParticle.h"
+#include "AliAODEvent.h"
+#include "AliAODInputHandler.h"
+#include "AliAnalysisTaskSpectraBoth.h"
+#include "AliAnalysisTaskESDfilter.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliSpectraBothHistoManager.h"
+#include "AliSpectraBothTrackCuts.h"
+#include "AliSpectraBothEventCuts.h"
+#include "AliCentrality.h"
+#include "TProof.h"
+#include "AliPID.h"
+#include "AliVEvent.h"
+#include "AliESDEvent.h"
+#include "AliPIDResponse.h"
+#include "AliStack.h"
+#include "AliSpectraBothPID.h"
+#include "AliGenEventHeader.h"
+#include <TMCProcess.h>
+
+#include <iostream>
+
+
+
+
+using namespace AliSpectraNameSpaceBoth;
+using namespace std;
+
+ClassImp(AliAnalysisTaskSpectraBoth)
+
+//________________________________________________________________________
+AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0)
+{
+ // Default constructor
+
+ DefineInput(0, TChain::Class());
+ DefineOutput(1, AliSpectraBothHistoManager::Class());
+ DefineOutput(2, AliSpectraBothEventCuts::Class());
+ DefineOutput(3, AliSpectraBothTrackCuts::Class());
+ DefineOutput(4, AliSpectraBothPID::Class());
+ fNRebin=0;
+
+}
+//________________________________________________________________________
+//________________________________________________________________________
+void AliAnalysisTaskSpectraBoth::UserCreateOutputObjects()
+{
+ // create output objects
+ fHistMan = new AliSpectraBothHistoManager("SpectraHistos",fNRebin);
+
+ if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
+ if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
+ if (!fPID) AliFatal("PID object should be set in the steering macro");
+ fTrackCuts->SetAliESDtrackCuts(fCuts);
+ fEventCuts->InitHisto();
+ fTrackCuts->InitHisto();
+
+ PostData(1, fHistMan );
+ PostData(2, fEventCuts);
+ PostData(3, fTrackCuts);
+ PostData(4, fPID );
+}
+//________________________________________________________________________
+void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
+{
+ // main event loop
+ Int_t ifAODEvent=AliSpectraBothTrackCuts::kotherobject;
+ fAOD = dynamic_cast<AliVEvent*>(InputEvent());
+ // AliESDEvent* esdevent=0x0;
+ // AliAODEvent* aodevent=0x0;
+
+ TString nameoftrack(fAOD->ClassName());
+ if(!nameoftrack.CompareTo("AliESDEvent"))
+ {
+ ifAODEvent=AliSpectraBothTrackCuts::kESDobject;
+ //esdevent=dynamic_cast<AliESDEvent*>(fAOD);
+ }
+ else if(!nameoftrack.CompareTo("AliAODEvent"))
+ {
+ ifAODEvent=AliSpectraBothTrackCuts::kAODobject;
+ //aodevent=dynamic_cast<AliAODEvent*>(fAOD);
+ }
+ else
+ AliFatal("Not processing AODs or ESDS") ;
+ if(fdotheMCLoopAfterEventCuts)
+ if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
+ TClonesArray *arrayMC = 0;
+ Int_t npar=0;
+ AliStack* stack=0x0;
+ Double_t mcZ=-100;
+
+ if (fIsMC)
+ {
+ TArrayF mcVertex(3);
+ mcVertex[0]=9999.; mcVertex[1]=9999.; mcVertex[2]=9999.;
+ AliMCEvent* mcEvent=(AliMCEvent*)MCEvent();
+ if (!mcEvent)
+ {
+ AliFatal("Error: MC particles branch not found!\n");
+ }
+ AliHeader* header = mcEvent->Header();
+ if (!header)
+ {
+ AliDebug(AliLog::kError, "Header not available");
+ return;
+ }
+
+ AliGenEventHeader* genHeader = header->GenEventHeader();
+ if(genHeader)
+ {
+ genHeader->PrimaryVertex(mcVertex);
+ mcZ=mcVertex[2];
+ }
+ if(ifAODEvent==AliSpectraBothTrackCuts::kAODobject)
+ {
+ arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+ if (!arrayMC)
+ {
+ AliFatal("Error: MC particles branch not found!\n");
+ }
+ Int_t nMC = arrayMC->GetEntries();
+ for (Int_t iMC = 0; iMC < nMC; iMC++)
+ {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);
+ if(!partMC->Charge()) continue;//Skip neutrals
+ //if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax()){//charged hadron are filled inside the eta acceptance
+ //Printf("%f %f-%f",partMC->Eta(),fTrackCuts->GetEtaMin(),fTrackCuts->GetEtaMax());
+ if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax())
+ fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());
+ //rapidity cut
+ if(partMC->Y() > fTrackCuts->GetYMax()|| partMC->Y() < fTrackCuts->GetYMin() )
+ continue;
+ if(partMC->IsPhysicalPrimary())
+ npar++;
+ // check for true PID + and fill P_t histos
+ Int_t charge = partMC->Charge() > 0 ? kChPos : kChNeg ;
+ Int_t id = fPID->GetParticleSpecie(partMC);
+ if(id != kSpUndefined)
+ {
+ fHistMan->GetHistogram2D(kHistPtGenTruePrimary,id,charge)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());
+ }
+ }
+ }
+ if(ifAODEvent==AliSpectraBothTrackCuts::kESDobject)
+ {
+ stack = mcEvent->Stack();
+ Int_t nMC = stack->GetNtrack();
+ for (Int_t iMC = 0; iMC < nMC; iMC++)
+ {
+
+ TParticle *partMC = stack->Particle(iMC);
+
+ if(!partMC)
+ continue;
+
+ if(!partMC->GetPDG(0))
+ continue;
+ if(TMath::Abs(partMC->GetPDG(0)->Charge()/3.0)<0.01)
+ continue;//Skip neutrals
+ if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax())
+ fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),stack->IsPhysicalPrimary(iMC));
+ if(partMC->Y() > fTrackCuts->GetYMax() ||partMC->Y() < fTrackCuts->GetYMin() )
+ continue;
+ if(stack->IsPhysicalPrimary(iMC))
+ npar++;
+ // check for true PID + and fill P_t histos
+ Int_t charge = partMC->GetPDG(0)->Charge()/3.0 > 0 ? kChPos : kChNeg ;
+ Int_t id = fPID->GetParticleSpecie(partMC);
+ if(id != kSpUndefined)
+ {
+ fHistMan->GetHistogram2D(kHistPtGenTruePrimary,id,charge)->Fill(partMC->Pt(),stack->IsPhysicalPrimary(iMC));
+ }
+ }
+ }
+ }
+ if(!fdotheMCLoopAfterEventCuts)
+ if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ))return;//event selection
+ //main loop on tracks
+ Int_t ntracks=0;
+ //cout<<fAOD->GetNumberOfTracks()<<endl;
+ for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++)
+ {
+ AliVTrack* track = dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
+ AliAODTrack* aodtrack=0;
+ AliESDtrack* esdtrack=0;
+ Float_t dca=-999.;
+ Float_t dcaz=-999.;
+ Short_t ncls=-1;
+ Float_t chi2perndf=-1.0;
+ if(ifAODEvent==AliSpectraBothTrackCuts::kESDobject)
+ {
+ esdtrack=dynamic_cast<AliESDtrack*>(track);
+ if(!esdtrack)
+ continue;
+ esdtrack->GetImpactParameters(dca,dcaz);
+ ncls=esdtrack->GetTPCNcls();
+ if ( ncls > 5)
+ chi2perndf=(esdtrack->GetTPCchi2()/Float_t(ncls - 5));
+
+ else
+ chi2perndf=-1;
+
+ }
+ else if (ifAODEvent==AliSpectraBothTrackCuts::kAODobject)
+ {
+ aodtrack=dynamic_cast<AliAODTrack*>(track);
+ if(!aodtrack)
+ continue;
+ dca=aodtrack->DCA();
+ dcaz=aodtrack->ZAtDCA();
+ ncls=aodtrack->GetTPCNcls();
+ chi2perndf=aodtrack->Chi2perNDF();
+ }
+ else
+ continue;
+ if (!fTrackCuts->IsSelected(track,kTRUE))
+ continue;
+ ntracks++;
+ fPID->FillQAHistos(fHistMan, track, fTrackCuts);
+
+ //calculate DCA for AOD track
+ if(dca==-999.)
+ {// track->DCA() does not work in old AOD production
+ Double_t d[2], covd[3];
+ AliVTrack* track_clone=(AliVTrack*)track->Clone("track_clone"); // need to clone because PropagateToDCA updates the track parameters
+ Bool_t isDCA = track_clone->PropagateToDCA(fAOD->GetPrimaryVertex(),fAOD->GetMagneticField(),9999.,d,covd);
+ delete track_clone;
+ if(!isDCA)
+ d[0]=-999.;
+ dca=d[0];
+ dcaz=d[1];
+ }
+
+ fHistMan->GetPtHistogram(kHistPtRec)->Fill(track->Pt(),dca); // PT histo
+ // get identity and charge
+ Bool_t rec[3]={false,false,false};
+ Int_t idRec = fPID->GetParticleSpecie(fHistMan,track, fTrackCuts,rec);
+ for(int irec=kSpPion;irec<kNSpecies;irec++)
+ {
+
+ if(fUseMinSigma)
+ {
+ if(irec>kSpPion)
+ break;
+ }
+ else
+ {
+ if(!rec[irec])
+ idRec = kSpUndefined;
+ else
+ idRec=irec;
+ }
+
+ Int_t charge = track->Charge() > 0 ? kChPos : kChNeg;
+
+ // Fill histograms, only if inside y and nsigma acceptance
+ if(idRec != kSpUndefined && fTrackCuts->CheckYCut ((BothParticleSpecies_t)idRec))
+ {
+ fHistMan->GetHistogram2D(kHistPtRecSigma,idRec,charge)->Fill(track->Pt(),dca);
+ fTrackCuts->GetHistoDCAzQA()->Fill(idRec,track->Pt(),dcaz);
+ fTrackCuts->GetHistoNclustersQA()->Fill(idRec,track->Pt(),ncls);
+ fTrackCuts->GetHistochi2perNDFQA()->Fill(idRec,track->Pt(),chi2perndf);
+ }
+ //can't put a continue because we still have to fill allcharged primaries, done later
+
+ /* MC Part */
+ if (arrayMC||stack)
+ {
+ Bool_t isPrimary = kFALSE;
+ Bool_t isSecondaryMaterial = kFALSE;
+ Bool_t isSecondaryWeak = kFALSE;
+ Int_t idGen =kSpUndefined;
+ Int_t pdgcode=0;
+ if (ifAODEvent==AliSpectraBothTrackCuts::kAODobject)
+ {
+ AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));
+ if (!partMC)
+ {
+ AliError("Cannot get MC particle");
+ continue;
+ }
+ // Check if it is primary, secondary from material or secondary from weak decay
+ isPrimary = partMC->IsPhysicalPrimary();
+ isSecondaryWeak = partMC->IsSecondaryFromWeakDecay();
+ isSecondaryMaterial = partMC->IsSecondaryFromMaterial();
+ //cout<<"AOD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;
+
+ if(!isPrimary&&!isSecondaryWeak&&!isSecondaryMaterial)
+ {
+ AliError("old tagging");
+ Int_t mfl=-999,codemoth=-999;
+ Int_t indexMoth=partMC->GetMother(); // FIXME ignore fakes? TO BE CHECKED, on ESD is GetFirstMother()
+ if(indexMoth>=0)
+ {//is not fake
+ AliAODMCParticle* moth = (AliAODMCParticle*) arrayMC->At(indexMoth);
+ codemoth = TMath::Abs(moth->GetPdgCode());
+ mfl = Int_t (codemoth/ TMath::Power(10, Int_t(TMath::Log10(codemoth))));
+ }
+ //Int_t uniqueID = partMC->GetUniqueID();
+ //cout<<"uniqueID: "<<partMC->GetUniqueID()<<" "<<kPDecay<<endl;
+ //cout<<"status: "<<partMC->GetStatus()<<" "<<kPDecay<<endl;
+ // if(uniqueID == kPDecay)Printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ if(mfl==3)
+ isSecondaryWeak = kTRUE; // add if(partMC->GetStatus() & kPDecay)? FIXME
+ else
+ isSecondaryMaterial = kTRUE;
+ }
+ //cout<<"AOD 2 tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;
+
+
+ idGen = fPID->GetParticleSpecie(partMC);
+ pdgcode=partMC->GetPdgCode();
+ }
+ else if (ifAODEvent==AliSpectraBothTrackCuts::kESDobject)
+ {
+ TParticle *partMC =stack->Particle(TMath::Abs(track->GetLabel()));
+ if (!partMC)
+ {
+ AliError("Cannot get MC particle");
+ continue;
+ }
+ isPrimary = stack->IsPhysicalPrimary(TMath::Abs(track->GetLabel()));
+ isSecondaryWeak = stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()));
+ isSecondaryMaterial = stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()));
+ //cout<<"ESD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<endl;
+
+ idGen = fPID->GetParticleSpecie(partMC);
+ pdgcode=partMC->GetPdgCode();
+ }
+ else
+ return;
+
+ // cout<<isPrimary<<" "<<isSecondaryWeak<<" "<<isSecondaryMaterial<<endl;
+ // cout<<" functions "<<partMC->IsPhysicalPrimary()<<" "<<partMC->IsSecondaryFromWeakDecay()<<" "<<partMC->IsSecondaryFromMaterial()<<endl;
+
+ if (isPrimary&&irec==kSpPion)
+ fHistMan->GetPtHistogram(kHistPtRecPrimaryAll)->Fill(track->Pt(),dca); // PT histo of reconstrutsed primaries in defined eta
+
+ //nsigma cut (reconstructed nsigma)
+ if(idRec == kSpUndefined)
+ continue;
+
+ // rapidity cut (reconstructed pt and identity)
+ if(!fTrackCuts->CheckYCut ((BothParticleSpecies_t)idRec)) continue;
+
+ // Get true ID
+
+
+ if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTrue, idGen, charge)->Fill(track->Pt(),dca);
+
+ if (isPrimary)
+ {
+ fHistMan->GetHistogram2D(kHistPtRecSigmaPrimary, idRec, charge)->Fill(track->Pt(),dca);
+ if(idGen != kSpUndefined)
+ {
+ fHistMan->GetHistogram2D(kHistPtRecPrimary, idGen, charge)->Fill(track->Pt(),dca);
+ if (idRec == idGen)
+ fHistMan->GetHistogram2D(kHistPtRecTruePrimary, idGen, charge)->Fill(track->Pt(),dca);
+ }
+ }
+ //25th Apr - Muons are added to Pions -- FIXME
+ if ( pdgcode == 13 && idRec == kSpPion)
+ {
+ fHistMan->GetPtHistogram(kHistPtRecTrueMuonPlus)->Fill(track->Pt(),dca);
+ if(isPrimary)
+ fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonPlus)->Fill(track->Pt(),dca);
+ }
+ if ( pdgcode == -13 && idRec == kSpPion)
+ {
+ fHistMan->GetPtHistogram(kHistPtRecTrueMuonMinus)->Fill(track->Pt(),dca);
+ if (isPrimary)
+ {
+ fHistMan->GetPtHistogram(kHistPtRecTruePrimaryMuonMinus)->Fill(track->Pt(),dca);
+ }
+ }
+
+ ///..... END FIXME
+
+ // Fill secondaries
+ if(isSecondaryWeak )
+ fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+ if(isSecondaryMaterial)
+ fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryMaterial , idRec, charge)->Fill(track->Pt(),dca);
+
+ }//end if(arrayMC)
+ }
+
+
+ } // end loop on tracks
+
+ // cout<< ntracks<<endl;
+ fHistMan->GetGenMulvsRawMulHistogram("hHistGenMulvsRawMul")->Fill(npar,ntracks);
+ PostData(1, fHistMan );
+ PostData(2, fEventCuts);
+ PostData(3, fTrackCuts);
+ PostData(4, fPID );
+}
+
+//_________________________________________________________________
+void AliAnalysisTaskSpectraBoth::Terminate(Option_t *)
+{
+ // Terminate
+}
-/**************************************************************************\r
- * Authors : Antonin Maire, Boris Hippolyte *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskCheckCascadepp276 class\r
-//\r
-// Origin AliAnalysisTaskCheckCascade which has four roles :\r
-// 1. QAing the Cascades from ESD and AOD\r
-// Origin: AliAnalysisTaskESDCheckV0 by Boris Hippolyte Nov2007, hippolyt@in2p3.fr\r
-// 2. Prepare the plots which stand as raw material for yield extraction (wi/wo PID)\r
-// 3. Supply an AliCFContainer meant to define the optimised topological selections\r
-// 4. Rough azimuthal correlation study (Eta, Phi)\r
-// Adapted to Cascade : A.Maire Mar2008, antonin.maire@ires.in2p3.fr\r
-// Modified : A.Maire Mar2010 \r
-//\r
-// Adapted to PbPb analysis: M. Nicassio, maria.nicassio@ba.infn.it\r
-// Feb-August2011\r
-// - Physics selection moved to the run.C macro\r
-// - Centrality selection added (+ setters) and histos\r
-// - flag and setters added (CF container usage, vertex range)\r
-// - histo added and histo/container binning changed \r
-// - protection in the destructor for CAF usage \r
-// - AliWarning disabled\r
-// - number of tracklets from AOD also \r
-// - automatic settings for PID\r
-// September2011\r
-// - proper time histos/container added (V0 and Cascades)\r
-// - cosine PA V0 wrt Xi vertex in the container \r
-// November2011\r
-// - re-run V0's and cascade's vertexers (SetCuts instead SetDefaultCuts!!)\r
-// - problems of libraries on Grid --> code copied in the task (from AliRoot v5-10-AN\r
-// where new pt dependent V0's cosPA cut implemented by Iouri) \r
-// - AOD analysis part completed \r
-//\r
-//\r
-// Adapted to pp 2.76 analysis: D. Colella, domenico.colella@ba.infn.it\r
-// Gen-now 2012\r
-// - Physics selection re-moved here (mainly for normalization in the efficiency calcuation)\r
-// - Centrality selection deleted\r
-// - \r
-//\r
-//-----------------------------------------------------------------\r
-\r
-class TTree;\r
-class TParticle;\r
-class TVector3;\r
-\r
-class AliESDVertex;\r
-class AliAODVertex;\r
-class AliESDv0;\r
-class AliAODv0;\r
-\r
-#include <Riostream.h>\r
-#include "TList.h"\r
-#include "TH1.h"\r
-#include "TH2.h"\r
-#include "TH3.h"\r
-#include "THnSparse.h"\r
-#include "TVector3.h"\r
-#include "TCanvas.h"\r
-#include "TMath.h"\r
-#include "TLegend.h"\r
-\r
-#include "AliLog.h"\r
-#include "AliESDEvent.h"\r
-#include "AliAODEvent.h"\r
-#include "AliV0vertexer.h"\r
-#include "AliCascadeVertexer.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliPIDResponse.h"\r
-\r
-#include "AliESDVZERO.h"\r
-\r
-#include "AliInputEventHandler.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliESDInputHandler.h" \r
-#include "AliAODInputHandler.h"\r
-#include "AliCFContainer.h"\r
-#include "AliMultiplicity.h"\r
-\r
-#include "AliESDcascade.h"\r
-#include "AliAODcascade.h"\r
-#include "AliAODTrack.h"\r
-\r
-#include "AliAnalysisTaskCheckCascadepp276.h"\r
-\r
-\r
-using std::cout;\r
-using std::endl;\r
-\r
-ClassImp(AliAnalysisTaskCheckCascadepp276)\r
-\r
-\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276() \r
- : AliAnalysisTaskSE(), \r
- fAnalysisType ("ESD"),\r
- fESDtrackCuts (0),\r
- fPIDResponse (0),\r
- fkRerunV0CascVertexers (0),\r
- fkSDDSelectionOn (kTRUE),\r
- fkQualityCutZprimVtxPos (kTRUE),\r
- fkQualityCutNoTPConlyPrimVtx(kTRUE),\r
- fkQualityCutTPCrefit (kTRUE),\r
- fkQualityCutnTPCcls (kTRUE),\r
- fkQualityCutPileup (kTRUE),\r
- fwithSDD (kTRUE),\r
- fMinnTPCcls (0),\r
- fkExtraSelections (0),\r
- fVtxRange (0),\r
- fVtxRangeMin (0),\r
- fMinPtCutOnDaughterTracks (0),\r
- fEtaCutOnDaughterTracks (0),\r
-\r
- // - Plots initialisation\r
- fListHistCascade(0),\r
- // Cascades multiplicity plots\r
- fHistCascadeMultiplicityBeforeAnySel(0),\r
- fHistCascadeMultiplicityAfterSDDSel(0),\r
- fHistCascadeMultiplicityAfterPhysicsSel(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistCascadeMultiplicityAfterVertexCutSel(0),\r
- // Tracks multiplicity plots\r
- fHistTrackMultiplicityBeforeAnySel(0),\r
- fHistTrackMultiplicityAfterSDDSel(0),\r
- fHistTrackMultiplicityAfterPhysicsSel(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistTrackMultiplicityAfterVertexCutSel(0),\r
- // Vertex position plots (BestVertex)\r
- fHistPVx(0), fHistPVy(0), fHistPVz(0),\r
- fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0), \r
- // TPC cluster distributions for daughters\r
- fHistPosV0TPCClusters(0), \r
- fHistNegV0TPCClusters(0), \r
- fHistBachTPCClusters(0),\r
- // Cut's variables distributions\r
- fHistEffMassXi(0), \r
- fHistDcaXiDaughters(0), \r
- fHistDcaBachToPrimVertex(0), \r
- fHistXiCosineOfPointingAngle(0), \r
- fHistXiRadius(0),\r
- fHistMassLambdaAsCascDghter(0),\r
- fHistDcaV0DaughtersXi(0),\r
- fHistDcaV0ToPrimVertexXi(0), \r
- fHistV0CosineOfPointingAngleXi(0),\r
- fHistV0RadiusXi(0),\r
- fHistDcaPosToPrimVertexXi(0), \r
- fHistDcaNegToPrimVertexXi(0), \r
- // Invariant mass distributions\r
- fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),\r
- // Transverse and total momentum distributions\r
- fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),\r
- // Others QA plots\r
- fHistChargeXi(0),\r
- fHistV0toXiCosineOfPointingAngle(0),\r
- fHistRapXi(0), fHistRapOmega(0), \r
- fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),\r
- fHistThetaXi(0), \r
- fHistPhiXi(0),\r
- f2dHistArmenteros(0), \r
- f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),\r
- f2dHistEffMassLambdaVsEffMassXiPlus(0), f2dHistEffMassXiVsEffMassOmegaPlus(0),\r
- f2dHistXiRadiusVsEffMassXiMinus(0), f2dHistXiRadiusVsEffMassXiPlus(0),\r
- f2dHistXiRadiusVsEffMassOmegaMinus(0), f2dHistXiRadiusVsEffMassOmegaPlus(0),\r
- f2dHistTPCdEdxOfCascDghters(0),\r
- f2dHistDcaXiDaughtersvsInvMass(0), \r
- f2dHistDcaBachToPrimVertexvsInvMass(0), \r
- f2dHistXiCosineOfPointingAnglevsInvMass(0),\r
- f2dHistMassLambdaAsCascDghtervsInvMass(0),\r
- f2dHistDcaV0DaughtersXivsInvMass(0),\r
- f2dHistDcaV0ToPrimVertexXivsInvMass(0),\r
- // Containers for cuts study \r
- fCFContCascadePIDXiMinus(0),\r
- fCFContCascadePIDXiPlus(0),\r
- fCFContCascadePIDOmegaMinus(0),\r
- fCFContCascadePIDOmegaPlus(0),\r
- fCFContCascadeCuts(0)\r
- \r
- {\r
- // Dummy Constructor\r
- for(Int_t iV0selIdx = 0; iV0selIdx < 7; iV0selIdx++ ) { fV0Sels [iV0selIdx ] = -1.; }\r
- for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels [iCascSelIdx ] = -1.; }\r
- }\r
-\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276(const char *name) \r
- : AliAnalysisTaskSE(name), \r
- fAnalysisType ("ESD"), \r
- fESDtrackCuts (0), \r
- fPIDResponse (0),\r
- fkRerunV0CascVertexers (0),\r
- fkSDDSelectionOn (kTRUE),\r
- fkQualityCutZprimVtxPos (kTRUE),\r
- fkQualityCutNoTPConlyPrimVtx(kTRUE),\r
- fkQualityCutTPCrefit (kTRUE),\r
- fkQualityCutnTPCcls (kTRUE),\r
- fkQualityCutPileup (kTRUE),\r
- fwithSDD (kTRUE),\r
- fMinnTPCcls (0),\r
- fkExtraSelections (0),\r
- fVtxRange (0),\r
- fVtxRangeMin (0),\r
- fMinPtCutOnDaughterTracks (0),\r
- fEtaCutOnDaughterTracks (0),\r
- \r
- // - Plots initialisation\r
- fListHistCascade(0),\r
-\r
- // Cascades multiplicity plots\r
- fHistCascadeMultiplicityBeforeAnySel(0),\r
- fHistCascadeMultiplicityAfterSDDSel(0),\r
- fHistCascadeMultiplicityAfterPhysicsSel(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistCascadeMultiplicityAfterVertexCutSel(0),\r
- // Tracks multiplicity plots\r
- fHistTrackMultiplicityBeforeAnySel(0),\r
- fHistTrackMultiplicityAfterSDDSel(0),\r
- fHistTrackMultiplicityAfterPhysicsSel(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistTrackMultiplicityAfterVertexCutSel(0),\r
- // Vertex position plots (BestVertex)\r
- fHistPVx(0), fHistPVy(0), fHistPVz(0),\r
- fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),\r
- // TPC cluster distributions for daughters\r
- fHistPosV0TPCClusters(0), fHistNegV0TPCClusters(0), fHistBachTPCClusters(0),\r
- // Cut's variables distributions\r
- fHistEffMassXi(0),\r
- fHistDcaXiDaughters(0),\r
- fHistDcaBachToPrimVertex(0),\r
- fHistXiCosineOfPointingAngle(0),\r
- fHistXiRadius(0),\r
- fHistMassLambdaAsCascDghter(0),\r
- fHistDcaV0DaughtersXi(0),\r
- fHistDcaV0ToPrimVertexXi(0),\r
- fHistV0CosineOfPointingAngleXi(0),\r
- fHistV0RadiusXi(0),\r
- fHistDcaPosToPrimVertexXi(0),\r
- fHistDcaNegToPrimVertexXi(0),\r
- // Invariant mass distributions\r
- fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),\r
- // Transverse and total momentum distributions\r
- fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),\r
- // Others QA plots\r
- fHistChargeXi(0),\r
- fHistV0toXiCosineOfPointingAngle(0),\r
- fHistRapXi(0), fHistRapOmega(0),\r
- fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),\r
- fHistThetaXi(0),\r
- fHistPhiXi(0),\r
- f2dHistArmenteros(0),\r
- f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),\r
- f2dHistEffMassLambdaVsEffMassXiPlus(0), f2dHistEffMassXiVsEffMassOmegaPlus(0),\r
- f2dHistXiRadiusVsEffMassXiMinus(0), f2dHistXiRadiusVsEffMassXiPlus(0),\r
- f2dHistXiRadiusVsEffMassOmegaMinus(0), f2dHistXiRadiusVsEffMassOmegaPlus(0),\r
- f2dHistTPCdEdxOfCascDghters(0),\r
- f2dHistDcaXiDaughtersvsInvMass(0),\r
- f2dHistDcaBachToPrimVertexvsInvMass(0),\r
- f2dHistXiCosineOfPointingAnglevsInvMass(0),\r
- f2dHistMassLambdaAsCascDghtervsInvMass(0),\r
- f2dHistDcaV0DaughtersXivsInvMass(0),\r
- f2dHistDcaV0ToPrimVertexXivsInvMass(0),\r
- // Containers for cuts study \r
- fCFContCascadePIDXiMinus(0),\r
- fCFContCascadePIDXiPlus(0),\r
- fCFContCascadePIDOmegaMinus(0),\r
- fCFContCascadePIDOmegaPlus(0),\r
- fCFContCascadeCuts(0)\r
- \r
- //_____Costructor____\r
- {\r
- // Define input and output slots here\r
- // Input slot #0 works with a TChain\r
- // DefineInput(0, TChain::Class());\r
- // Output slot #1 writes into a TList container (cascade)\r
- // default p-p values\r
- fV0Sels[0] = 33. ; // max allowed chi2\r
- fV0Sels[1] = 0.01; // min allowed impact parameter for the 1st daughter \r
- fV0Sels[2] = 0.01; // min allowed impact parameter for the 2nd daughter \r
- fV0Sels[3] = 1.5; // max allowed DCA between the daughter tracks \r
- fV0Sels[4] = 0.9; // min allowed cosine of V0's pointing angle - This is pT dependent \r
- fV0Sels[5] = 0.2; // min radius of the fiducial volume \r
- fV0Sels[6] = 200.; // max radius of the fiducial volume \r
-\r
- fCascSels[0] = 33.; // max allowed chi2 (same as PDC07)\r
- fCascSels[1] = 0.01; // min allowed V0 impact parameter \r
- fCascSels[2] = 0.008; // "window" around the Lambda mass \r
- fCascSels[3] = 0.01; // min allowed bachelor's impact parameter \r
- fCascSels[4] = 2.0; // max allowed DCA between the V0 and the bachelor \r
- fCascSels[5] = 0.95; // min allowed cosine of the cascade pointing angle \r
- fCascSels[6] = 0.2; // min radius of the fiducial volume \r
- fCascSels[7] = 100.; // max radius of the fiducial volume \r
-\r
- // Output slot #0 writes into a TList container (Cascade)\r
- DefineOutput(1, TList::Class());\r
- DefineOutput(2, AliCFContainer::Class());\r
- DefineOutput(3, AliCFContainer::Class());\r
- DefineOutput(4, AliCFContainer::Class());\r
- DefineOutput(5, AliCFContainer::Class());\r
- DefineOutput(6, AliCFContainer::Class());\r
- AliLog::SetClassDebugLevel("AliAnalysisTaskCheckCascadepp276",1);\r
- } \r
-\r
-\r
- //_____Destructor_____\r
- AliAnalysisTaskCheckCascadepp276::~AliAnalysisTaskCheckCascadepp276() {\r
- // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.\r
- // They will be deleted when fListCascade is deleted by the TSelector dtor\r
- // Because of TList::SetOwner() ... \r
- if (fListHistCascade && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fListHistCascade; fListHistCascade = 0x0; }\r
- if (fCFContCascadePIDXiMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDXiMinus; fCFContCascadePIDXiMinus = 0x0; }\r
- if (fCFContCascadePIDXiPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDXiPlus; fCFContCascadePIDXiPlus = 0x0; }\r
- if (fCFContCascadePIDOmegaMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){ delete fCFContCascadePIDOmegaMinus; fCFContCascadePIDOmegaMinus = 0x0; }\r
- if (fCFContCascadePIDOmegaPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDOmegaPlus; fCFContCascadePIDOmegaPlus = 0x0; } \r
- if (fCFContCascadeCuts && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadeCuts; fCFContCascadeCuts = 0x0; }\r
- if (fESDtrackCuts) { delete fESDtrackCuts; fESDtrackCuts = 0x0; }\r
- }\r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskCheckCascadepp276::UserCreateOutputObjects() {\r
- // Create histograms\r
- // Called once\r
-\r
-\r
- fListHistCascade = new TList();\r
- fListHistCascade->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner\r
-\r
- //-----------------------------------------------\r
- // Particle Identification Setup (new PID object)\r
- //-----------------------------------------------\r
- AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());\r
- fPIDResponse = inputHandler->GetPIDResponse();\r
-\r
- // Only used to get the number of primary reconstructed tracks\r
- if (fAnalysisType == "ESD" && (! fESDtrackCuts )){\r
- fESDtrackCuts = new AliESDtrackCuts();\r
- }\r
-\r
- //---------------------------------------------------\r
- // Initialize cuts to re-run V0 and cascade vertexers\r
- //---------------------------------------------------\r
- // Not validated; to be checked\r
- fV0Sels[0] = 33. ; // max allowed chi2\r
- fV0Sels[1] = 0.01; // min allowed impact parameter for the 1st daughter \r
- fV0Sels[2] = 0.01; // min allowed impact parameter for the 2nd daughter \r
- fV0Sels[3] = 1.5; // max allowed DCA between the daughter tracks \r
- fV0Sels[4] = 0.9; // min allowed cosine of V0's pointing angle \r
- fV0Sels[5] = 0.2; // min radius of the fiducial volume \r
- fV0Sels[6] = 200.; // max radius of the fiducial volume \r
-\r
- fCascSels[0] = 33.; // max allowed chi2 (same as PDC07)\r
- fCascSels[1] = 0.01; // min allowed V0 impact parameter \r
- fCascSels[2] = 0.008; // "window" around the Lambda mass \r
- fCascSels[3] = 0.01; // min allowed bachelor's impact parameter \r
- fCascSels[4] = 2.0; // max allowed DCA between the V0 and the bachelor \r
- fCascSels[5] = 0.95; // min allowed cosine of the cascade pointing angle \r
- fCascSels[6] = 0.2; // min radius of the fiducial volume \r
- fCascSels[7] = 100.; // max radius of the fiducial volume \r
-\r
- //----------------------\r
- // Initialize the histos\r
- //----------------------\r
- \r
- // - Cascades multiplicity plots \r
- if(! fHistCascadeMultiplicityBeforeAnySel) {\r
- fHistCascadeMultiplicityBeforeAnySel = new TH1F("fHistCascadeMultiplicityBeforeAnySel",\r
- "Cascades per event (before any selections);Nbr of Cascades/Evt;Events", \r
- 20, 0, 20);\r
- fListHistCascade->Add(fHistCascadeMultiplicityBeforeAnySel);\r
- }\r
- if(! fHistCascadeMultiplicityAfterSDDSel) {\r
- fHistCascadeMultiplicityAfterSDDSel = new TH1F("fHistCascadeMultiplicityAfterSDDSel", \r
- "Cascades per event (after the SDD selection);Nbr of Cascades/Evt;Events", \r
- 20, 0, 20); \r
- fListHistCascade->Add(fHistCascadeMultiplicityAfterSDDSel);\r
- }\r
- if(! fHistCascadeMultiplicityAfterPhysicsSel) {\r
- fHistCascadeMultiplicityAfterPhysicsSel = new TH1F("fHistCascadeMultiplicityAfterPhysicsSel",\r
- "Cascades per event (after physics selection);Nbr of Cascades/Evt;Events",\r
- 20, 0, 20);\r
- fListHistCascade->Add(fHistCascadeMultiplicityAfterPhysicsSel);\r
- }\r
- if(! fHistCascadeMultiplicityForSelEvtNoTPCOnly) {\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnly",\r
- "Cascades per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",\r
- 20, 0, 20);\r
- fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnly);\r
- }\r
- if(! fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup) {\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup",\r
- "Cascades per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",\r
- 20, 0, 20);\r
- fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup);\r
- }\r
- if(! fHistCascadeMultiplicityAfterVertexCutSel) {\r
- fHistCascadeMultiplicityAfterVertexCutSel = new TH1F("fHistCascadeMultiplicityAfterVertexCutSel",\r
- "Cascades per event (after vertex cut selection);Nbr of Cascades/Evt;Events",\r
- 20, 0, 20);\r
- fListHistCascade->Add(fHistCascadeMultiplicityAfterVertexCutSel);\r
- }\r
- // - Tracks multiplicity plots \r
- if(! fHistTrackMultiplicityBeforeAnySel) {\r
- fHistTrackMultiplicityBeforeAnySel = new TH1F("fHistTrackMultiplicityBeforeAnySel", \r
- "Tracks per event (before any selections);Nbr of Cascades/Evt;Events", \r
- 100, 0, 100); \r
- fListHistCascade->Add(fHistTrackMultiplicityBeforeAnySel);\r
- } \r
- if(! fHistTrackMultiplicityAfterSDDSel) {\r
- fHistTrackMultiplicityAfterSDDSel = new TH1F("fHistTrackMultiplicityAfterSDDSel", \r
- "Tracks per event (after the SDD selection);Nbr of Cascades/Evt;Events",\r
- 100, 0, 100);\r
- fListHistCascade->Add(fHistTrackMultiplicityAfterSDDSel);\r
- }\r
- if(! fHistTrackMultiplicityAfterPhysicsSel) {\r
- fHistTrackMultiplicityAfterPhysicsSel = new TH1F("fHistTrackMultiplicityAfterPhysicsSel",\r
- "Tracks per event (after physics selection);Nbr of Cascades/Evt;Events",\r
- 100, 0, 100);\r
- fListHistCascade->Add(fHistTrackMultiplicityAfterPhysicsSel);\r
- }\r
- if(! fHistTrackMultiplicityForSelEvtNoTPCOnly) {\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnly",\r
- "Tracks per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",\r
- 100, 0, 100);\r
- fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnly);\r
- }\r
- if(! fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup) {\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup",\r
- "Tracks per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",\r
- 100, 0, 100);\r
- fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);\r
- }\r
- if(! fHistTrackMultiplicityAfterVertexCutSel) {\r
- fHistTrackMultiplicityAfterVertexCutSel = new TH1F("fHistTrackMultiplicityAfterVertexCutSel",\r
- "Tracks per event (after vertex cut selection);Nbr of Cascades/Evt;Events",\r
- 100, 0, 100);\r
- fListHistCascade->Add(fHistTrackMultiplicityAfterVertexCutSel);\r
- }\r
- // - Vertex position plots\r
- if(! fHistPVx ){\r
- fHistPVx = new TH1F("fHistPVx", "Best PV position in x; x (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVx);\r
- }\r
- if(! fHistPVy ){\r
- fHistPVy = new TH1F("fHistPVy", "Best PV position in y; y (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVy);\r
- }\r
- if(! fHistPVz ){\r
- fHistPVz = new TH1F("fHistPVz", "Best PV position in z; z (cm); Events", 400, -20, 20);\r
- fListHistCascade->Add(fHistPVz);\r
- } \r
- if(! fHistPVxAnalysis ){\r
- fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", "Best PV position in x (after events selections); x (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVxAnalysis);\r
- }\r
- if(! fHistPVyAnalysis ){\r
- fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", "Best PV position in y (after events selections); y (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVyAnalysis);\r
- }\r
- if(! fHistPVzAnalysis ){\r
- fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", "Best PV position in z (after events selections); z (cm); Events", 400, -20, 20);\r
- fListHistCascade->Add(fHistPVzAnalysis);\r
- }\r
- // - TPC clusetr sdistributions for daughters (histos for events containing at least ONE CASCADE)\r
- if(! fHistPosV0TPCClusters ){\r
- fHistPosV0TPCClusters = new TH1F("fHistPosV0TPCClusters", "TPC clusters for Pos. V0 daughter track, in Casc; Nbr of TPC clusters (V0 Pos.); Track counts", 165, 0.0, 165.0);\r
- fListHistCascade->Add(fHistPosV0TPCClusters);\r
- }\r
- if(! fHistNegV0TPCClusters ){\r
- fHistNegV0TPCClusters = new TH1F("fHistNegV0TPCClusters", "TPC clusters for Neg. V0 daughter track, in Casc; Nbr of TPC clusters (V0 Neg.); Track counts", 165, 0.0, 165.0);\r
- fListHistCascade->Add(fHistNegV0TPCClusters);\r
- }\r
- if(! fHistBachTPCClusters ){\r
- fHistBachTPCClusters = new TH1F("fHistBachTPCClusters", "TPC clusters for Bachelor track; Nbr of TPC clusters (Bach); Track counts", 165, 0.0, 165.0);\r
- fListHistCascade->Add(fHistBachTPCClusters);\r
- }\r
- // - Cut's variables distributions (typical histos for cascades): as example only for the Xi (both particle and anti-particle)\r
- if(! fHistEffMassXi) {\r
- fHistEffMassXi = new TH1F("fHistEffMassXi", "Xi candidates; Invariant Mass (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistEffMassXi);\r
- } \r
- if(! fHistDcaXiDaughters ){\r
- fHistDcaXiDaughters = new TH1F("fHistDcaXiDaughters", "DCA between Xi daughters; DCA (cm); Counts", 210, 0., 2.1);\r
- fListHistCascade->Add(fHistDcaXiDaughters);\r
- }\r
- if(! fHistDcaBachToPrimVertex) {\r
- fHistDcaBachToPrimVertex = new TH1F("fHistDcaBachToPrimVertex", "Impact parameter of Bach. to Prim. Vertex; DCA (cm); Counts", 250, 0., 0.25);\r
- fListHistCascade->Add(fHistDcaBachToPrimVertex);\r
- }\r
- if(! fHistXiCosineOfPointingAngle) {\r
- fHistXiCosineOfPointingAngle = new TH1F("fHistXiCosineOfPointingAngle", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Counts", 601, 0.94, 1.0001);\r
- fListHistCascade->Add(fHistXiCosineOfPointingAngle);\r
- }\r
- if(! fHistXiRadius ){\r
- fHistXiRadius = new TH1F("fHistXiRadius", "Cascade decay transv. radius; r (cm); Counts" , 2050, 0., 205.0);\r
- fListHistCascade->Add(fHistXiRadius);\r
- }\r
- if(! fHistMassLambdaAsCascDghter) {\r
- fHistMassLambdaAsCascDghter = new TH1F("fHistMassLambdaAsCascDghter", "#Lambda associated to cascade candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.0, 1.3);\r
- fListHistCascade->Add(fHistMassLambdaAsCascDghter);\r
- }\r
- if(! fHistDcaV0DaughtersXi) {\r
- fHistDcaV0DaughtersXi = new TH1F("fHistDcaV0DaughtersXi", "DCA between V0 daughters, in cascade; DCA (cm); Counts", 320, 0., 1.6);\r
- fListHistCascade->Add(fHistDcaV0DaughtersXi);\r
- }\r
- if(! fHistDcaV0ToPrimVertexXi) {\r
- fHistDcaV0ToPrimVertexXi = new TH1F("fHistDcaV0ToPrimVertexXi", "Impact parameter of V0 to Prim. Vertex, in cascade; DCA (cm); Counts", 200, 0., 1.);\r
- fListHistCascade->Add(fHistDcaV0ToPrimVertexXi);\r
- }\r
- if(! fHistV0CosineOfPointingAngleXi) {\r
- fHistV0CosineOfPointingAngleXi = new TH1F("fHistV0CosineOfPointingAngleXi", "Cosine of V0 Pointing Angle, in cascade; Cos(V0 Point. Angl); Counts", 201, 0.8, 1.001);\r
- fListHistCascade->Add(fHistV0CosineOfPointingAngleXi);\r
- }\r
- if(! fHistV0RadiusXi) {\r
- fHistV0RadiusXi = new TH1F("fHistV0RadiusXi", "V0 decay radius, in cascade; radius (cm); Counts", 2050, 0., 205.0);\r
- fListHistCascade->Add(fHistV0RadiusXi);\r
- }\r
- if(! fHistDcaPosToPrimVertexXi) {\r
- fHistDcaPosToPrimVertexXi = new TH1F("fHistDcaPosToPrimVertexXi", "Impact parameter of V0 pos daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);\r
- fListHistCascade->Add(fHistDcaPosToPrimVertexXi);\r
- }\r
- if(! fHistDcaNegToPrimVertexXi) {\r
- fHistDcaNegToPrimVertexXi = new TH1F("fHistDcaNegToPrimVertexXi", "Impact parameter of V0 neg daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);\r
- fListHistCascade->Add(fHistDcaNegToPrimVertexXi);\r
- }\r
- // - Effective mass histos for cascades.\r
- //By cascade hyp \r
- if(! fHistMassXiMinus) {\r
- fHistMassXiMinus = new TH1F("fHistMassXiMinus", "#Xi^{-} candidates; M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassXiMinus);\r
- } \r
- if(! fHistMassXiPlus) {\r
- fHistMassXiPlus = new TH1F("fHistMassXiPlus", "#Xi^{+} candidates; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassXiPlus);\r
- }\r
- if(! fHistMassOmegaMinus) {\r
- fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus", "#Omega^{-} candidates; M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassOmegaMinus);\r
- }\r
- if(! fHistMassOmegaPlus) {\r
- fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus", "#Omega^{+} candidates;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassOmegaPlus);\r
- }\r
- // - Transverse and total momentum distributions\r
- if(! fHistXiTransvMom ){\r
- fHistXiTransvMom = new TH1F("fHistXiTransvMom", "#Xi transverse momentum (cand. around the mass peak); p_{t}(#Xi) (GeV/c); Counts", 100, 0.0, 10.0);\r
- fListHistCascade->Add(fHistXiTransvMom);\r
- }\r
- if(! fHistXiTotMom ){\r
- fHistXiTotMom = new TH1F("fHistXiTotMom", "#Xi momentum norm (cand. around the mass peak); p_{tot}(#Xi) (GeV/c); Counts", 150, 0.0, 15.0);\r
- fListHistCascade->Add(fHistXiTotMom);\r
- }\r
- if(! fHistBachTransvMomXi ){\r
- fHistBachTransvMomXi = new TH1F("fHistBachTransvMomXi", "#Xi Bach. transverse momentum (cand. around the mass peak); p_{t}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);\r
- fListHistCascade->Add(fHistBachTransvMomXi);\r
- }\r
- if(! fHistBachTotMomXi ){\r
- fHistBachTotMomXi = new TH1F("fHistBachTotMomXi", "#Xi Bach. momentum norm (cand. around the mass peak); p_{tot}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);\r
- fListHistCascade->Add(fHistBachTotMomXi);\r
- }\r
- // - Others QA plots\r
- //TH1\r
- if(! fHistChargeXi ){\r
- fHistChargeXi = new TH1F("fHistChargeXi", "Charge of Xi candidates; Sign; Counts", 5, -2.0, 3.0);\r
- fListHistCascade->Add(fHistChargeXi);\r
- }\r
- if(! fHistV0toXiCosineOfPointingAngle) {\r
- fHistV0toXiCosineOfPointingAngle = new TH1F("fHistV0toXiCosineOfPointingAngle", "Cos. of V0 Ptng Angl / Xi vtx ; Cos(V0 Point. Angl / Xi vtx); Counts", 1101, 0.89, 1.0001);\r
- fListHistCascade->Add(fHistV0toXiCosineOfPointingAngle);\r
- }\r
- if(! fHistRapXi ){\r
- fHistRapXi = new TH1F("fHistRapXi", "Rapidity of #Xi candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);\r
- fListHistCascade->Add(fHistRapXi);\r
- }\r
- if(! fHistRapOmega ){\r
- fHistRapOmega = new TH1F("fHistRapOmega", "Rapidity of #Omega candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);\r
- fListHistCascade->Add(fHistRapOmega);\r
- }\r
- if(! fHistEtaXi ){\r
- fHistEtaXi = new TH1F("fHistEtaXi", "Pseudo-rap. of #Xi candidates (around the mass peak); #eta; Counts", 20, -1.0, 1.0);\r
- fListHistCascade->Add(fHistEtaXi);\r
- }\r
- if(! fHistEtaBachXi){\r
- fHistEtaBachXi = new TH1F("fHistEtaBachXi", "Pseudo-rap. of #Xi bachelor; #eta; Counts", 40, -2.0, 2.0);\r
- fListHistCascade->Add(fHistEtaBachXi);\r
- }\r
- if(! fHistEtaPosXi){\r
- fHistEtaPosXi = new TH1F("fHistEtaPosXi", "Pseudo-rap. of #Xi positive meson daughter; #eta; Counts", 40, -2.0, 2.0);\r
- fListHistCascade->Add(fHistEtaPosXi);\r
- }\r
- if(! fHistEtaNegXi){\r
- fHistEtaNegXi = new TH1F("fHistEtaNegXi", "Pseudo-rap. of #Xi negative meson daughter; #eta; Counts", 40, -2.0, 2.0);\r
- fListHistCascade->Add(fHistEtaNegXi);\r
- }\r
- if(! fHistThetaXi ){\r
- fHistThetaXi = new TH1F("fHistThetaXi", "#theta of #Xi candidates (around the mass peak); #theta (deg); Counts", 180, 0., 180.0);\r
- fListHistCascade->Add(fHistThetaXi);\r
- }\r
- if(! fHistPhiXi ){\r
- fHistPhiXi = new TH1F("fHistPhiXi", "#phi of #Xi candidates (around the mass peak); #phi (deg); Counts", 360, 0., 360.);\r
- fListHistCascade->Add(fHistPhiXi);\r
- }\r
- if(! f2dHistArmenteros) {\r
- f2dHistArmenteros = new TH2F("f2dHistArmenteros", "#alpha_{Arm}(casc. cand.) Vs Pt_{Arm}(casc. cand.); #alpha_{Arm}; Pt_{Arm} (GeV/c)", 140, -1.2, 1.2, 300, 0., 0.3);\r
- fListHistCascade->Add(f2dHistArmenteros);\r
- }\r
- //TH2\r
- if(! f2dHistEffMassLambdaVsEffMassXiMinus) {\r
- f2dHistEffMassLambdaVsEffMassXiMinus = new TH2F("f2dHistEffMassLambdaVsEffMassXiMinus", "M_{#Lambda} Vs M_{#Xi^{-} candidates}; Inv. M_{#Lambda^{0}} (GeV/c^{2}); M( #Lambda , #pi^{-} ) (GeV/c^{2})", 300, 1.1, 1.13, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiMinus);\r
- }\r
- if(! f2dHistEffMassXiVsEffMassOmegaMinus) {\r
- f2dHistEffMassXiVsEffMassOmegaMinus = new TH2F("f2dHistEffMassXiVsEffMassOmegaMinus", "M_{#Xi^{-} candidates} Vs M_{#Omega^{-} candidates}; M( #Lambda , #pi^{-} ) (GeV/c^{2}); M( #Lambda , K^{-} ) (GeV/c^{2})", 400, 1.2, 2.0, 500, 1.5, 2.5);\r
- fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaMinus);\r
- }\r
- if(! f2dHistEffMassLambdaVsEffMassXiPlus) {\r
- f2dHistEffMassLambdaVsEffMassXiPlus = new TH2F("f2dHistEffMassLambdaVsEffMassXiPlus", "M_{#Lambda} Vs M_{#Xi^{+} candidates}; Inv. M_{#Lambda^{0}} (GeV/c^{2}); M( #Lambda , #pi^{+} ) (GeV/c^{2})", 300, 1.1, 1.13, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiPlus);\r
- }\r
- if(! f2dHistEffMassXiVsEffMassOmegaPlus) {\r
- f2dHistEffMassXiVsEffMassOmegaPlus = new TH2F("f2dHistEffMassXiVsEffMassOmegaPlus", "M_{#Xi^{+} candidates} Vs M_{#Omega^{+} candidates}; M( #Lambda , #pi^{+} ) (GeV/c^{2}); M( #Lambda , K^{+} ) (GeV/c^{2})", 400, 1.2, 2.0, 500, 1.5, 2.5);\r
- fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaPlus);\r
- }\r
- if(! f2dHistXiRadiusVsEffMassXiMinus) {\r
- f2dHistXiRadiusVsEffMassXiMinus = new TH2F("f2dHistXiRadiusVsEffMassXiMinus", "Transv. R_{Xi Decay} Vs M_{#Xi^{-} candidates}; r_{cascade} (cm); M( #Lambda , #pi^{-} ) (GeV/c^{2})", 450, 0., 45.0, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiMinus);\r
- }\r
- if(! f2dHistXiRadiusVsEffMassXiPlus) {\r
- f2dHistXiRadiusVsEffMassXiPlus = new TH2F("f2dHistXiRadiusVsEffMassXiPlus", "Transv. R_{Xi Decay} Vs M_{#Xi^{+} candidates}; r_{cascade} (cm); M( #Lambda , #pi^{+} ) (GeV/c^{2})", 450, 0., 45.0, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiPlus);\r
- }\r
- if(! f2dHistXiRadiusVsEffMassOmegaMinus) {\r
- f2dHistXiRadiusVsEffMassOmegaMinus = new TH2F("f2dHistXiRadiusVsEffMassOmegaMinus", "Transv. R_{Xi Decay} Vs M_{#Omega^{-} candidates}; r_{cascade} (cm); M( #Lambda , K^{-} ) (GeV/c^{2}) ", 450, 0., 45.0, 500, 1.5, 2.5);\r
- fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaMinus);\r
- }\r
- if(! f2dHistXiRadiusVsEffMassOmegaPlus) {\r
- f2dHistXiRadiusVsEffMassOmegaPlus = new TH2F("f2dHistXiRadiusVsEffMassOmegaPlus", "Transv. R_{Xi Decay} Vs M_{#Omega^{+} candidates}; r_{cascade} (cm); M( #Lambda , K^{+} ) (GeV/c^{2}) ", 450, 0., 45.0, 500, 1.5, 2.5);\r
- fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaPlus);\r
- }\r
- if(! f2dHistTPCdEdxOfCascDghters){\r
- f2dHistTPCdEdxOfCascDghters = new TH2F("f2dHistTPCdEdxOfCascDghters", "TPC dE/dx of the cascade daughters; charge x || #vec{p}_{TPC inner wall}(Casc. daughter) || (GeV/c); TPC signal (ADC)", 2000, -10.0, 10.0, 450, 0., 900.);\r
- fListHistCascade->Add(f2dHistTPCdEdxOfCascDghters);\r
- }\r
- if(! f2dHistDcaXiDaughtersvsInvMass){\r
- f2dHistDcaXiDaughtersvsInvMass = new TH2F("f2dHistDcaXiDaughtersvsInvMass", "DCA between Xi Daughters; DCA (cm); Number of Cascades", 100, 0., 0.5, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistDcaXiDaughtersvsInvMass);\r
- }\r
- if(! f2dHistDcaBachToPrimVertexvsInvMass) {\r
- f2dHistDcaBachToPrimVertexvsInvMass = new TH2F("f2dHistDcaBachToPrimVertexvsInvMass", "DCA of Bach. to Prim. Vertex; DCA (cm); Number of Cascades", 250, 0., 0.25, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistDcaBachToPrimVertexvsInvMass);\r
- }\r
- if(! f2dHistXiCosineOfPointingAnglevsInvMass){\r
- f2dHistXiCosineOfPointingAnglevsInvMass = new TH2F("f2dHistXiCosineOfPointingAnglevsInvMass", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Number of Xis", 200, 0.99, 1.0, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistXiCosineOfPointingAnglevsInvMass);\r
- }\r
- if(! f2dHistMassLambdaAsCascDghtervsInvMass){ \r
- f2dHistMassLambdaAsCascDghtervsInvMass = new TH2F("f2dHistMassLambdaAsCascDghtervsInvMass","#Lambda associated to Casc. candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.00, 1.3, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistMassLambdaAsCascDghtervsInvMass);\r
- }\r
- if(! f2dHistDcaV0DaughtersXivsInvMass){\r
- f2dHistDcaV0DaughtersXivsInvMass = new TH2F("f2dHistDcaV0DaughtersXivsInvMass", "DCA between V0 daughters, in cascade; DCA (cm); Number of V0s", 120, 0., 0.6, 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistDcaV0DaughtersXivsInvMass);\r
- }\r
- if(! f2dHistDcaV0ToPrimVertexXivsInvMass){\r
- f2dHistDcaV0ToPrimVertexXivsInvMass = new TH2F("f2dHistDcaV0ToPrimVertexXivsInvMass", "DCA of V0 to Prim. Vertex, in cascade; DCA (cm); Number of Cascades", 200, 0., 1., 400, 1.2, 2.0);\r
- fListHistCascade->Add(f2dHistDcaV0ToPrimVertexXivsInvMass);\r
- }\r
- // - CFContainer PID study Xi minus\r
- if(!fCFContCascadePIDXiMinus) {\r
- const Int_t lNbSteps = 7 ;\r
- const Int_t lNbVariables = 3 ;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 800;\r
- lNbBinsPerVar[2] = 22;\r
- if (fkSDDSelectionOn) {\r
- if (fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- else if (!fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar ); \r
- } else if (!fkSDDSelectionOn) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDXiMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDXiMinus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass\r
- fCFContCascadePIDXiMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity\r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDXiMinus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson"); \r
- //Setting the variable title, per axis\r
- fCFContCascadePIDXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");\r
- fCFContCascadePIDXiMinus->SetVarTitle(2, "Y_{#Xi}");\r
- fListHistCascade->Add(fCFContCascadePIDXiMinus);\r
- }\r
- // - CFContainer PID study Xi plus\r
- if (!fCFContCascadePIDXiPlus) {\r
- const Int_t lNbSteps = 7 ;\r
- const Int_t lNbVariables = 3 ;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 800;\r
- lNbBinsPerVar[2] = 22;\r
- if (fkSDDSelectionOn) {\r
- if (fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- else if (!fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- } else if (!fkSDDSelectionOn) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDXiPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDXiPlus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass\r
- fCFContCascadePIDXiPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity\r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDXiPlus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");\r
- //Setting the variable title, per axis\r
- fCFContCascadePIDXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");\r
- fCFContCascadePIDXiPlus->SetVarTitle(2, "Y_{#Xi}");\r
- fListHistCascade->Add(fCFContCascadePIDXiPlus);\r
- }\r
- // - CFContainer PID study Omega minus\r
- if(!fCFContCascadePIDOmegaMinus) {\r
- const Int_t lNbSteps = 7 ;\r
- const Int_t lNbVariables = 3 ;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 1000;\r
- lNbBinsPerVar[2] = 22;\r
- if (fkSDDSelectionOn) {\r
- if (fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- else if (!fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- } else if (!fkSDDSelectionOn) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDOmegaMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDOmegaMinus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass\r
- fCFContCascadePIDOmegaMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity\r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");\r
- //Setting the variable title, per axis\r
- fCFContCascadePIDOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");\r
- fCFContCascadePIDOmegaMinus->SetVarTitle(2, "Y_{#Omega}");\r
- fListHistCascade->Add(fCFContCascadePIDOmegaMinus);\r
- }\r
- // - CFContainer PID study Omega plus\r
- if(!fCFContCascadePIDOmegaPlus) {\r
- const Int_t lNbSteps = 7 ;\r
- const Int_t lNbVariables = 3 ;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 1000;\r
- lNbBinsPerVar[2] = 22; \r
- if (fkSDDSelectionOn) {\r
- if (fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- else if (!fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- } else if (!fkSDDSelectionOn) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDOmegaPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDOmegaPlus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass\r
- fCFContCascadePIDOmegaPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity \r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");\r
- //Setting the variable title, per axis\r
- fCFContCascadePIDOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");\r
- fCFContCascadePIDOmegaPlus->SetVarTitle(2, "Y_{#Omega}"); \r
- fListHistCascade->Add(fCFContCascadePIDOmegaPlus);\r
- }\r
- // - CFContainer: towards the optimisation of topological selections\r
- if(! fCFContCascadeCuts) {\r
- // Container meant to store all the relevant distributions corresponding to the cut variables.\r
- // NB: overflow/underflow of variables on which we want to cut later should be 0!!! \r
- const Int_t lNbSteps = 4 ;\r
- const Int_t lNbVariables = 19 ;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[lNbVariables] = {0};\r
- lNbBinsPerVar[0] = 25; //DcaCascDaughters : [0.0,2.4,3.0] -> Rec.Cut = 2.0;\r
- lNbBinsPerVar[1] = 25; //DcaBachToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.01; \r
- lNbBinsPerVar[2] = 60; //CascCosineOfPointingAngle : [0.94,1.0] -> Rec.Cut = 0.95;\r
- lNbBinsPerVar[3] = 40; //CascRadius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;\r
- lNbBinsPerVar[4] = 30; //InvMassLambdaAsCascDghter : [1.1,1.3] -> Rec.Cut = 0.008;\r
- lNbBinsPerVar[5] = 20; //DcaV0Daughters : [0.0,2.0] -> Rec.Cut = 1.5;\r
- lNbBinsPerVar[6] = 201; //V0CosineOfPointingAngleToXi : [0.89,1.0] -> No Rec.Cut;\r
- lNbBinsPerVar[7] = 40; //V0Radius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;\r
- lNbBinsPerVar[8] = 40; //DcaV0ToPrimVertex : [0.0,0.39,110.0] -> Rec.Cut = 0.01; \r
- lNbBinsPerVar[9] = 25; //DcaPosToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.01;\r
- lNbBinsPerVar[10] = 25; //DcaNegToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.01;\r
- lNbBinsPerVar[11] = 150; //InvMassXi : 2-MeV/c2 bins\r
- lNbBinsPerVar[12] = 120; //InvMassOmega : 2-MeV/c2 bins\r
- lNbBinsPerVar[13] = 100; //XiTransvMom : [0.0,10.0]\r
- lNbBinsPerVar[14] = 110; //Y(Xi) : 0.02 in rapidity units\r
- lNbBinsPerVar[15] = 110; //Y(Omega) : 0.02 in rapidity units\r
- lNbBinsPerVar[16] = 112; //Proper lenght of cascade \r
- lNbBinsPerVar[17] = 112; //Proper lenght of V0\r
- lNbBinsPerVar[18] = 112; //Distance V0-Xi in transverse plane\r
- if (fkSDDSelectionOn) {\r
- if (fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);\r
- else if (!fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);\r
- } else if (!fkSDDSelectionOn) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);\r
- //Setting the bin limits \r
- //0 - DcaXiDaughters\r
- Double_t *lBinLim0 = new Double_t[ lNbBinsPerVar[0] + 1 ];\r
- for(Int_t i=0; i< lNbBinsPerVar[0]; i++) lBinLim0[i] = (Double_t)0.0 + (2.4 - 0.0)/(lNbBinsPerVar[0] - 1) * (Double_t)i;\r
- lBinLim0[ lNbBinsPerVar[0] ] = 3.0;\r
- fCFContCascadeCuts -> SetBinLimits(0, lBinLim0); \r
- delete [] lBinLim0;\r
- //1 - DcaToPrimVertexXi\r
- Double_t *lBinLim1 = new Double_t[ lNbBinsPerVar[1] + 1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[1]; i++) lBinLim1[i] = (Double_t)0.0 + (0.24 - 0.0)/(lNbBinsPerVar[1] - 1) * (Double_t)i;\r
- lBinLim1[ lNbBinsPerVar[1] ] = 100.0;\r
- fCFContCascadeCuts -> SetBinLimits(1, lBinLim1); \r
- delete [] lBinLim1; \r
- //2 - CascCosineOfPointingAngle \r
- fCFContCascadeCuts->SetBinLimits(2, 0.94, 1.);\r
- //3 - CascRadius\r
- Double_t *lBinLim3 = new Double_t[ lNbBinsPerVar[3]+1 ];\r
- for(Int_t i=0; i< lNbBinsPerVar[3]; i++) lBinLim3[i] = (Double_t)0.0 + (3.9 - 0.0 )/(lNbBinsPerVar[3] - 1) * (Double_t)i ;\r
- lBinLim3[ lNbBinsPerVar[3] ] = 1000.0;\r
- fCFContCascadeCuts -> SetBinLimits(3, lBinLim3 ); \r
- delete [] lBinLim3;\r
- //4 - InvMassLambdaAsCascDghter\r
- fCFContCascadeCuts->SetBinLimits(4, 1.1, 1.13);\r
- //5 - DcaV0Daughters\r
- fCFContCascadeCuts -> SetBinLimits(5, 0., 2.);\r
- //6 - V0CosineOfPointingAngle\r
- fCFContCascadeCuts -> SetBinLimits(6, 0.8, 1.001);\r
- //7 - V0Radius\r
- Double_t *lBinLim7 = new Double_t[ lNbBinsPerVar[7] + 1];\r
- for(Int_t i=0; i< lNbBinsPerVar[7];i++) lBinLim7[i] = (Double_t)0.0 + (3.9 - 0.0)/(lNbBinsPerVar[7] - 1) * (Double_t)i;\r
- lBinLim7[ lNbBinsPerVar[7] ] = 1000.0;\r
- fCFContCascadeCuts -> SetBinLimits(7, lBinLim7); \r
- delete [] lBinLim7;\r
- //8 - DcaV0ToPrimVertex\r
- Double_t *lBinLim8 = new Double_t[ lNbBinsPerVar[8]+1 ];\r
- for(Int_t i=0; i< lNbBinsPerVar[8];i++) lBinLim8[i] = (Double_t)0.0 + (0.39 - 0.0 )/(lNbBinsPerVar[8]-1) * (Double_t)i ;\r
- lBinLim8[ lNbBinsPerVar[8] ] = 100.0;\r
- fCFContCascadeCuts -> SetBinLimits(8, lBinLim8 ); \r
- delete [] lBinLim8;\r
- //9 - DcaPosToPrimVertex\r
- Double_t *lBinLim9 = new Double_t[ lNbBinsPerVar[9]+1 ];\r
- for(Int_t i=0; i< lNbBinsPerVar[9];i++) lBinLim9[i] = (Double_t)0.0 + (0.24 - 0.0 )/(lNbBinsPerVar[9]-1) * (Double_t)i ;\r
- lBinLim9[ lNbBinsPerVar[9] ] = 100.0;\r
- fCFContCascadeCuts -> SetBinLimits(9, lBinLim9 ); \r
- delete [] lBinLim9;\r
- //10 - DcaNegToPrimVertex\r
- Double_t *lBinLim10 = new Double_t[ lNbBinsPerVar[10]+1 ];\r
- for(Int_t i=0; i< lNbBinsPerVar[10];i++) lBinLim10[i] = (Double_t)0.0 + (0.24 - 0.0 )/(lNbBinsPerVar[10]-1) * (Double_t)i ;\r
- lBinLim10[ lNbBinsPerVar[10] ] = 100.0;\r
- fCFContCascadeCuts -> SetBinLimits(10, lBinLim10 ); // DcaPosToPrimVertexXi : 0.0 to 0.25 \r
- delete [] lBinLim10;\r
- //11 - InvMassXi\r
- fCFContCascadeCuts->SetBinLimits(11, 1.25, 1.40);\r
- //12 - InvMassOmega\r
- fCFContCascadeCuts->SetBinLimits(12, 1.62, 1.74);\r
- //13 - XiTransvMom\r
- fCFContCascadeCuts->SetBinLimits(13, 0.0, 10.0); \r
- //14 - Y(Xi)\r
- fCFContCascadeCuts->SetBinLimits(14, -1.1, 1.1);\r
- //15 - Y(Omega)\r
- fCFContCascadeCuts->SetBinLimits(15, -1.1, 1.1);\r
- //16 - Proper time of cascade\r
- Double_t *lBinLim16 = new Double_t[ lNbBinsPerVar[16]+1 ];\r
- for(Int_t i=0; i< lNbBinsPerVar[16];i++) lBinLim16[i] = (Double_t) -1. + (110. + 1.0 ) / (lNbBinsPerVar[16] - 1) * (Double_t) i;\r
- lBinLim16[ lNbBinsPerVar[16] ] = 2000.0;\r
- fCFContCascadeCuts->SetBinLimits(16, lBinLim16);\r
- //17 - Proper time of V0\r
- fCFContCascadeCuts->SetBinLimits(17, lBinLim16);\r
- //18 - Distance V0-Xi in transverse plane\r
- fCFContCascadeCuts->SetBinLimits(18, lBinLim16);\r
- // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)\r
- fCFContCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates");\r
- fCFContCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates");\r
- fCFContCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates");\r
- fCFContCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates");\r
- // Setting the variable title, per axis\r
- fCFContCascadeCuts->SetVarTitle(0, "Dca(cascade daughters) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(1, "ImpactParamToPV(bachelor) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(2, "cos(cascade PA)");\r
- fCFContCascadeCuts->SetVarTitle(3, "R_{2d}(cascade decay) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(4, "M_{#Lambda}(as casc dghter) (GeV/c^{2})");\r
- fCFContCascadeCuts->SetVarTitle(5, "Dca(V0 daughters) in Xi (cm)");\r
- fCFContCascadeCuts->SetVarTitle(6, "cos(V0 PA) to cascade vtx");\r
- fCFContCascadeCuts->SetVarTitle(7, "R_{2d}(V0 decay) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(8, "ImpactParamToPV(V0) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(9, "ImpactParamToPV(Pos) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(10, "ImpactParamToPV(Neg) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");\r
- fCFContCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");\r
- fCFContCascadeCuts->SetVarTitle(13, "pt(cascade) (GeV/c)");\r
- fCFContCascadeCuts->SetVarTitle(14, "Y(Xi)");\r
- fCFContCascadeCuts->SetVarTitle(15, "Y(Omega)");\r
- fCFContCascadeCuts->SetVarTitle(16, "mL/p (cascade) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(17, "mL/p (V0) (cm)");\r
- fCFContCascadeCuts->SetVarTitle(18, "Distance V0-Cascade in transverse plane (cm)");\r
- fListHistCascade->Add(fCFContCascadeCuts);\r
- }\r
-\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
-} // end UserCreateOutputObjects\r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskCheckCascadepp276::UserExec(Option_t *) {\r
-\r
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
- // Main loop (called for each event)\r
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
- \r
- //----------------\r
- //Define variables \r
- AliESDEvent *lESDevent = 0x0;\r
- AliAODEvent *lAODevent = 0x0;\r
-\r
- //---------------------\r
- //Check the PIDresponse\r
- if(!fPIDResponse) {\r
- AliError("Cannot get pid response");\r
- return;\r
- }\r
-\r
- ///////////////////\r
- // EVENT SELECTIONS\r
- ///////////////////\r
- // In order:\r
- // 1) SDD selection\r
- // 2) Physics selection\r
- // 3) Select only looking at events with well-established PV\r
- // 4) Pileup selection\r
- // 5) |Z| < 10 cm\r
-\r
- //----------------------\r
- // Before any selections\r
- //----------------------\r
- //- Define the variables\r
- Int_t ncascadesBeforeAnySel = 0;\r
- Int_t nTrackMultiplicityBeforeAnySel = 0;\r
- if (fAnalysisType == "ESD") {\r
- // - Load the InputEvent and check\r
- lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );\r
- if (!lESDevent) {\r
- AliWarning("ERROR: lESDevent not available \n");\r
- return;\r
- }\r
- // - Take the number of cascades and tracks before any events selection\r
- ncascadesBeforeAnySel = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityBeforeAnySel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- // - Load the InputEvent and check\r
- lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() );\r
- if (!lAODevent) {\r
- AliWarning("ERROR: lAODevent not available \n");\r
- return;\r
- }\r
- // - Take the number of cascades and tracks before any events selection\r
- ncascadesBeforeAnySel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityBeforeAnySel = -100; //FIXME: I can't find the equivalent method for the AOD \r
- } else {\r
- Printf("Analysis type (ESD or AOD) not specified \n");\r
- return;\r
- }\r
- // - Fill the plots\r
- fHistCascadeMultiplicityBeforeAnySel->Fill(ncascadesBeforeAnySel);\r
- fHistTrackMultiplicityBeforeAnySel->Fill(nTrackMultiplicityBeforeAnySel);\r
- \r
- //--------------\r
- // SDD selection\r
- //--------------\r
- // - Define the variables\r
- Int_t ncascadesAfterSDDSel = 0;\r
- Int_t nTrackMultiplicityAfterSDDSel = 0;\r
- // - Selection for ESD and AOD\r
- if (fAnalysisType == "ESD") {\r
- if (fkSDDSelectionOn) {\r
- TString trcl = lESDevent->GetFiredTriggerClasses();\r
- //cout<<"Fired Trigger Classes: "<<trcl<<endl;\r
- if (fwithSDD){\r
- if(!(trcl.Contains("ALLNOTRD"))) {\r
- cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. => RETURN!! (Exclude it)..."<<endl;\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- } else if (!fwithSDD){\r
- if((trcl.Contains("ALLNOTRD"))) {\r
- cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. => RETURN!! (Exclude it)..."<<endl;\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- }\r
- // - Take the number of cascades and tracks after the SDD selection\r
- ncascadesAfterSDDSel = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterSDDSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- if (fkSDDSelectionOn) {\r
- TString trcl = lAODevent->GetFiredTriggerClasses();\r
- if (fwithSDD){\r
- if(!(trcl.Contains("ALLNOTRD"))) {\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. => RETURN!! (Exclude it)..."<<endl;\r
- return;\r
- }\r
- } else if (!fwithSDD) {\r
- if((trcl.Contains("ALLNOTRD"))) {\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. => RETURN!! (Exclude it)..."<<endl;\r
- return;\r
- }\r
- }\r
- }\r
- // - Take the number of cascades and tracks after the SDD selection\r
- ncascadesAfterSDDSel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterSDDSel = -100; //FIXME: I can't find the equivalent method for the AOD\r
- }\r
- // - Fill the plots\r
- fHistCascadeMultiplicityAfterSDDSel->Fill(ncascadesAfterSDDSel);\r
- fHistTrackMultiplicityAfterSDDSel->Fill(nTrackMultiplicityAfterSDDSel);\r
-\r
- //----------------------------------------------\r
- // Physics selection (+ re-vertexer for the ESD)\r
- //----------------------------------------------\r
- // - Define the variables\r
- Int_t ncascadesAfterPhysicsSel = 0;\r
- Int_t nTrackMultiplicityAfterPhysicsSel = 0;\r
- // - Selection for ESD and AOD\r
- if (fAnalysisType == "ESD") {\r
- UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
- Bool_t isSelected = 0;\r
- isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;\r
- if(! isSelected){\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. => RETURN!! (Exclude it)..."<<endl;\r
- return;\r
- }\r
- // - Take the number of cascades and tracks after physics selection\r
- ncascadesAfterPhysicsSel = lESDevent->GetNumberOfCascades(); \r
- nTrackMultiplicityAfterPhysicsSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5); \r
- // - Cascade vertexer (ESD)\r
- // Relaunch V0 and Cascade vertexers\r
- if (fkRerunV0CascVertexers) { \r
- lESDevent->ResetCascades();\r
- lESDevent->ResetV0s();\r
- AliV0vertexer *lV0vtxer = new AliV0vertexer();\r
- AliCascadeVertexer *lCascVtxer = new AliCascadeVertexer();\r
- //lV0vtxer->GetCuts(fV0Sels);\r
- //lCascVtxer->GetCuts(fCascSels);\r
- lV0vtxer->SetCuts(fV0Sels); // NB don't use SetDefaultCuts!! because it acts on static variables \r
- lCascVtxer->SetCuts(fCascSels);\r
- lV0vtxer->Tracks2V0vertices(lESDevent);\r
- lCascVtxer->V0sTracks2CascadeVertices(lESDevent);\r
- //delete lV0vtxer;\r
- //delete lCascVtxer;\r
- } \r
- } else if (fAnalysisType == "AOD") {\r
- UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
- Bool_t isSelected = 0;\r
- isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;\r
- if(! isSelected){\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. => RETURN!! (Exclude it)..."<<endl;\r
- return;\r
- } \r
- // - Take the number of cascades and tracks after the physics selection\r
- ncascadesAfterPhysicsSel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterPhysicsSel = -100; //FIXME: I can't find the equivalent method for the AOD \r
- } \r
- // - Fill the plots\r
- fHistCascadeMultiplicityAfterPhysicsSel->Fill(ncascadesAfterPhysicsSel);\r
- fHistTrackMultiplicityAfterPhysicsSel->Fill(nTrackMultiplicityAfterPhysicsSel);\r
-\r
- //------------------------------\r
- // Well-established PV selection\r
- //------------------------------\r
- // - Define variables\r
- Int_t ncascadesForSelEvtNoTPCOnly = 0;\r
- Int_t nTrackMultiplicityForSelEvtNoTPCOnly = 0;\r
- // - Selection for ESD and AOD\r
- if (fAnalysisType == "ESD") {\r
- // - Vertex coordinates: get the PVs stored in the ESD found with tracks and SPD\r
- const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();\r
- const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();\r
- // - Select only looking at events with well-established PV\r
- if (fkQualityCutNoTPConlyPrimVtx) {\r
- if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() ){\r
- AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after TPConly selection\r
- ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- // - Vertex coordinates: get the PVs stored in the AOD found with tracks and SPD\r
- const AliAODVertex *lPrimarySPDVtx = lAODevent->GetPrimaryVertexSPD();\r
- const AliAODVertex *lPrimaryTrackingAODVtx = lAODevent->GetPrimaryVertex();\r
- // - Select only looking at events with well-established PV\r
- if (fkQualityCutNoTPConlyPrimVtx) {\r
- if (!lPrimarySPDVtx && !lPrimaryTrackingAODVtx) {\r
- AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after TPConly selection\r
- ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnly = -100; //FIXME: I can't find the equivalent method for the AOD\r
- }\r
- // - Fill the plots\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly->Fill(ncascadesForSelEvtNoTPCOnly);\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly->Fill(nTrackMultiplicityForSelEvtNoTPCOnly);\r
- \r
- //----------------\r
- // Pilup selection\r
- //----------------\r
- // - Define variables\r
- Int_t ncascadesForSelEvtNoTPCOnlyNoPileup = 0;\r
- Int_t nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = 0;\r
- // - Selection for ESD and AOD\r
- if (fAnalysisType == "ESD") {\r
- if (fkQualityCutPileup) {\r
- if(lESDevent->IsPileupFromSPD()){\r
- AliWarning("Pb / Pile-up event ... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after Pileup selection\r
- ncascadesForSelEvtNoTPCOnlyNoPileup = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- if (fkQualityCutPileup) {\r
- if(lAODevent->IsPileupFromSPD()){\r
- AliWarning("Pb / Pile-up event ... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after Pileup selection\r
- ncascadesForSelEvtNoTPCOnlyNoPileup = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -100; //FIXME: I can't find the equivalent method for the AOD\r
- }\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(ncascadesForSelEvtNoTPCOnlyNoPileup);\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);\r
- \r
- //----------------------------------------------------\r
- // Vertex Z position selection (+ magnetic field info)\r
- //----------------------------------------------------\r
- // - Define variables\r
- Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};\r
- Double_t lMagneticField = -10.;\r
- Double_t tPrimaryVtxPosition[3] = {-100.0, -100.0, -100.0};\r
- Int_t ncascadesAfterVertexSel = 0;\r
- Int_t nTrackMultiplicityAfterVertexSel = 0; \r
- // - Selection for ESD and AOD\r
- if (fAnalysisType == "ESD") {\r
- // - Vertex coordinates: get the best primary vertex available for the event \r
- const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex(); \r
- if (!lPrimaryBestESDVtx){\r
- AliWarning("No prim. vertex in ESD... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );\r
- // - Fill the vertex plots before any event selection on vertex position\r
- const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- fHistPVx->Fill( tPrimaryVtxPosition[0] );\r
- fHistPVy->Fill( tPrimaryVtxPosition[1] );\r
- fHistPVz->Fill( tPrimaryVtxPosition[2] ); \r
- // - Get magnetic filed info\r
- lMagneticField = lESDevent->GetMagneticField();\r
- //if(TMath::Abs(lMagneticField ) < 10e-6) continue;\r
- // - Selection on the primary vertex Z position \r
- if (fkQualityCutZprimVtxPos) {\r
- if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {\r
- AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after vertex Z position selection\r
- ncascadesAfterVertexSel = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterVertexSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5); \r
- } else if (fAnalysisType == "AOD") {\r
- // - Vertex coordinates: get the best primary vertex available for the event\r
- const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex();\r
- if (!lPrimaryBestAODVtx){\r
- AliWarning("No prim. vertex in AOD... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );\r
- // - Fill the vertex plots before any event selection on vertex position\r
- const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- fHistPVx->Fill( tPrimaryVtxPosition[0] );\r
- fHistPVy->Fill( tPrimaryVtxPosition[1] );\r
- fHistPVz->Fill( tPrimaryVtxPosition[2] );\r
- // - Get magnetic filed info\r
- lMagneticField = lAODevent->GetMagneticField();\r
- //if(TMath::Abs(lMagneticField ) < 10e-6) continue;\r
- // - Selection on the primary vertex Z position \r
- if (fkQualityCutZprimVtxPos) {\r
- if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {\r
- AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after vertex Z position selection\r
- ncascadesAfterVertexSel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterVertexSel = -100; //FIXME: I can't find the equivalent method for the AOD\r
- } \r
- // - Fill the plots\r
- fHistCascadeMultiplicityAfterVertexCutSel->Fill(ncascadesAfterVertexSel);\r
- fHistTrackMultiplicityAfterVertexCutSel->Fill(nTrackMultiplicityAfterVertexSel);\r
-\r
- // - Vertex position plots: after any event selections\r
- tPrimaryVtxPosition[0] = -100.0;\r
- tPrimaryVtxPosition[1] = -100.0;\r
- tPrimaryVtxPosition[2] = -100.0;\r
- if (fAnalysisType == "ESD") {\r
- const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- } else if (fAnalysisType == "AOD") {\r
- const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- }\r
- fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] );\r
- fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] );\r
- fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] );\r
- \r
-\r
-\r
- //////////////////////////////\r
- // CASCADE RECONSTRUCTION PART\r
- //////////////////////////////\r
- \r
- //%%%%%%%%%%%%%\r
- // Cascade loop\r
- Int_t ncascades = 0;\r
- if (fAnalysisType == "ESD") ncascades = lESDevent->GetNumberOfCascades();\r
- else if (fAnalysisType == "AOD") ncascades = lAODevent->GetNumberOfCascades();\r
-\r
- for (Int_t iXi = 0; iXi < ncascades; iXi++) {// This is the begining of the Cascade loop (ESD or AOD)\r
- \r
- // -----------------------------------------------------------------------\r
- // - Initialisation of the local variables that will be needed for ESD/AOD\r
-\r
- // - 0th part of initialisation : around primary vertex ...\r
- //Double_t lBestPrimaryVtxRadius3D = -500.0;\r
- // - 1st part of initialisation : variables needed to store AliESDCascade data members\r
- Double_t lEffMassXi = 0.;\r
- Double_t lDcaXiDaughters = -1.;\r
- Double_t lXiCosineOfPointingAngle = -1.;\r
- Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };\r
- Double_t lXiRadius = -1000. ;\r
- // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks\r
- UShort_t lPosTPCClusters = -1; // For ESD only ...\r
- UShort_t lNegTPCClusters = -1; // For ESD only ...\r
- UShort_t lBachTPCClusters = -1; // For ESD only ...\r
- Double_t lInnerWallMomCascDghters[3] = {-100., -100., -100.};\r
- Double_t lTPCSignalCascDghters [3] = {-100., -100., -100.};\r
- // - 3rd part of initialisation : about V0 part in cascades\r
- Double_t lInvMassLambdaAsCascDghter = 0.;\r
- Double_t lDcaV0DaughtersXi = -1.;\r
- Double_t lDcaBachToPrimVertexXi = -1.;\r
- Double_t lDcaV0ToPrimVertexXi = -1.;\r
- Double_t lDcaPosToPrimVertexXi = -1.;\r
- Double_t lDcaNegToPrimVertexXi = -1.;\r
- Double_t lV0CosineOfPointingAngleXi = -1. ;\r
- Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade\r
- Double_t lV0RadiusXi = -1000.0;\r
- Double_t lV0quality = 0.;\r
- // - 4th part of initialisation : Effective masses\r
- Double_t lInvMassXiMinus = 0.;\r
- Double_t lInvMassXiPlus = 0.;\r
- Double_t lInvMassOmegaMinus = 0.;\r
- Double_t lInvMassOmegaPlus = 0.;\r
- // - 5th part of initialisation : PID treatment\r
- Bool_t lIsPosInXiProton = kFALSE;\r
- Bool_t lIsPosInXiPion = kFALSE;\r
- Bool_t lIsPosInOmegaProton = kFALSE;\r
- Bool_t lIsPosInOmegaPion = kFALSE;\r
- Bool_t lIsNegInXiProton = kFALSE;\r
- Bool_t lIsNegInXiPion = kFALSE;\r
- Bool_t lIsNegInOmegaProton = kFALSE;\r
- Bool_t lIsNegInOmegaPion = kFALSE;\r
- Bool_t lIsBachelorKaon = kFALSE;\r
- Bool_t lIsBachelorPion = kFALSE; \r
- Bool_t lIsBachelorKaonForTPC = kFALSE; \r
- Bool_t lIsBachelorPionForTPC = kFALSE; \r
- Bool_t lIsNegPionForTPC = kFALSE; \r
- Bool_t lIsPosPionForTPC = kFALSE; \r
- Bool_t lIsNegProtonForTPC = kFALSE; \r
- Bool_t lIsPosProtonForTPC = kFALSE; \r
- // - 6th part of initialisation : extra info for QA\r
- Double_t lXiMomX = 0.;\r
- Double_t lXiMomY = 0.;\r
- Double_t lXiMomZ = 0.;\r
- Double_t lXiTransvMom = 0.;\r
- Double_t lXiTotMom = 0.;\r
- Double_t lV0PMomX = 0.;\r
- Double_t lV0PMomY = 0.;\r
- Double_t lV0PMomZ = 0.;\r
- Double_t lV0NMomX = 0.;\r
- Double_t lV0NMomY = 0.;\r
- Double_t lV0NMomZ = 0.;\r
- Double_t lV0TotMom = 0.;\r
- Double_t lBachMomX = 0.;\r
- Double_t lBachMomY = 0.;\r
- Double_t lBachMomZ = 0.;\r
- Double_t lBachTransvMom = 0.;\r
- Double_t lBachTotMom = 0.;\r
- Double_t lpTrackTransvMom = 0.;\r
- Double_t lnTrackTransvMom = 0.;\r
- Short_t lChargeXi = -2;\r
- Double_t lV0toXiCosineOfPointingAngle = 0.;\r
- Double_t lRapXi = -20.0, lRapOmega = -20.0, lEta = -20.0, lTheta = 360., lPhi = 720.;\r
- Double_t lAlphaXi = -200., lPtArmXi = -200.0;\r
- Double_t etaPos = 0., etaNeg = 0., etaBach = 0.;\r
- \r
- if (fAnalysisType == "ESD") { \r
- \r
- // -------------------------------------\r
- // - Load the cascades from the handler\r
- AliESDcascade *xi = lESDevent->GetCascade(iXi);\r
- if (!xi) continue;\r
-\r
- //---------------------------------------------------------------------------- \r
- // - Assigning the necessary variables for specific AliESDcascade data members \r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis: cascade = Xi-decay\r
- lEffMassXi = xi->GetEffMassXi();\r
- lDcaXiDaughters = xi->GetDcaXiDaughters();\r
- lXiCosineOfPointingAngle = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );\r
- //Take care : the best available vertex should be used (like in AliCascadeVertexer)\r
- xi->GetXYZcascade( lPosXi[0], lPosXi[1], lPosXi[2] ); \r
- lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );\r
- \r
- //-------------------------------------------------------------------------------------------------------------------------------\r
- // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)\r
- UInt_t lIdxPosXi = (UInt_t) TMath::Abs( xi->GetPindex() );\r
- UInt_t lIdxNegXi = (UInt_t) TMath::Abs( xi->GetNindex() );\r
- UInt_t lBachIdx = (UInt_t) TMath::Abs( xi->GetBindex() );\r
- //Care track label can be negative in MC production (linked with the track quality)\r
- //However = normally, not the case for track index ...\r
- // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)\r
- if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }\r
- if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }\r
- // - Get the track for the daughters\r
- AliESDtrack *pTrackXi = lESDevent->GetTrack( lIdxPosXi );\r
- AliESDtrack *nTrackXi = lESDevent->GetTrack( lIdxNegXi );\r
- AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );\r
- if (!pTrackXi || !nTrackXi || !bachTrackXi ) {\r
- AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");\r
- continue;\r
- }\r
- // - Get the TPCnumber of cluster for the daughters\r
- lPosTPCClusters = pTrackXi->GetTPCNcls();\r
- lNegTPCClusters = nTrackXi->GetTPCNcls();\r
- lBachTPCClusters = bachTrackXi->GetTPCNcls();\r
-\r
- //-------------------------------------\r
- // - Rejection of a poor quality tracks\r
- if (fkQualityCutTPCrefit) {\r
- // - Poor quality related to TPCrefit\r
- ULong_t pStatus = pTrackXi->GetStatus();\r
- ULong_t nStatus = nTrackXi->GetStatus();\r
- ULong_t bachStatus = bachTrackXi->GetStatus();\r
- if ((pStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }\r
- if ((nStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }\r
- if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }\r
- }\r
- if (fkQualityCutnTPCcls) {\r
- // - Poor quality related to TPC clusters\r
- if (lPosTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }\r
- if (lNegTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }\r
- if (lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!"); continue; }\r
- }\r
-\r
- //-----------------------------------\r
- const AliExternalTrackParam *pExtTrack = pTrackXi->GetInnerParam();\r
- const AliExternalTrackParam *nExtTrack = nTrackXi->GetInnerParam();\r
- const AliExternalTrackParam *bachExtTrack = bachTrackXi->GetInnerParam();\r
- if (pExtTrack) {\r
- lInnerWallMomCascDghters[0] = pExtTrack->GetP() * pExtTrack->Charge();\r
- lTPCSignalCascDghters [0] = pTrackXi->GetTPCsignal();\r
- }\r
- if (nExtTrack) {\r
- lInnerWallMomCascDghters[1] = nExtTrack->GetP() * nExtTrack->Charge();\r
- lTPCSignalCascDghters [1] = nTrackXi->GetTPCsignal();\r
- }\r
- if (bachExtTrack) {\r
- lInnerWallMomCascDghters[2] = bachExtTrack->GetP() * bachExtTrack->Charge();\r
- lTPCSignalCascDghters [2] = bachTrackXi->GetTPCsignal();\r
- }\r
- etaPos = pTrackXi->Eta();\r
- etaNeg = nTrackXi->Eta();\r
- etaBach = bachTrackXi->Eta();\r
- lInvMassLambdaAsCascDghter = xi->GetEffMass(); //This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+\r
- lDcaV0DaughtersXi = xi->GetDcaV0Daughters(); \r
- lV0CosineOfPointingAngleXi = xi->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],\r
- lBestPrimaryVtxPos[1],\r
- lBestPrimaryVtxPos[2] );\r
- lDcaV0ToPrimVertexXi = xi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );\r
- lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); //Note: AliExternalTrackParam::GetD returns an algebraic value ...\r
- xi->GetXYZ( lPosV0Xi[0], lPosV0Xi[1], lPosV0Xi[2] ); \r
- lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] ); \r
- lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); \r
- lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); \r
-\r
- //-----------------------------------------\r
- // - Extra-selection for cascade candidates\r
- if (fkExtraSelections) { //in AliCascadeVertexer\r
- if (lDcaXiDaughters > 0.3) continue; \r
- if (lXiCosineOfPointingAngle < 0.999 ) continue; \r
- if (lDcaV0ToPrimVertexXi < 0.05) continue; \r
- if (lDcaBachToPrimVertexXi < 0.03) continue; \r
- //if (TMath::Abs(lInvMassLambdaAsCascDghter-1.11568) > 0.006 ) continue; \r
- if (lDcaV0DaughtersXi > 1.) continue; \r
- if (lV0CosineOfPointingAngleXi < 0.998) continue; \r
- if (lDcaPosToPrimVertexXi < 0.1) continue; \r
- if (lDcaNegToPrimVertexXi < 0.1) continue; \r
- if (lXiRadius < .9) continue; \r
- //if (lXiRadius > 100) continue; \r
- if (lV0RadiusXi < 0.9) continue; \r
- //if (lV0RadiusXi > 100) continue; \r
- }\r
-\r
- //---------------------------------------------------------------------------------------------------- \r
- // - Around effective masses. Change mass hypotheses to cover all the possibilities: Xi-/+, Omega -/+\r
- if ( bachTrackXi->Charge() < 0 ) {\r
- //Calculate the effective mass of the Xi- candidate: Xi- hyp. (pdg code 3312)\r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , 3312); \r
- lInvMassXiMinus = xi->GetEffMassXi();\r
- //Calculate the effective mass of the Xi- candidate: Omega- hyp. (pdg code 3334)\r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , 3334); \r
- lInvMassOmegaMinus = xi->GetEffMassXi();\r
- //Back to "default" hyp. (Xi-)\r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , 3312); \r
- } // end if negative bachelor\r
- if ( bachTrackXi->Charge() > 0 ) {\r
- //Calculate the effective mass of the Xi- candidate: Xi+ hyp. (pdg code -3312)\r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , -3312); \r
- lInvMassXiPlus = xi->GetEffMassXi();\r
- //Calculate the effective mass of the Xi- candidate: Omega+ hyp. (pdg code -3334)\r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , -3334); \r
- lInvMassOmegaPlus = xi->GetEffMassXi();\r
- //Back to "default" hyp. (Xi-)\r
- lV0quality = 0.;\r
- xi->ChangeMassHypothesis(lV0quality , -3312); \r
- } // end if positive bachelor\r
-\r
- //--------------------------------\r
- // - PID on the daughter tracks\r
- // - Combined PID -> removed, add when will be used\r
-\r
- // - TPC PID : 3-sigma bands on Bethe-Bloch curve\r
- //Bachelor\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;\r
- //Negative V0 daughter\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;\r
- //Positive V0 daughter\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;\r
- /*\r
- const AliExternalTrackParam *pInnerWallTrackXi = pTrackXi ->GetInnerParam();\r
- const AliExternalTrackParam *nInnerWallTrackXi = nTrackXi ->GetInnerParam();\r
- const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();\r
- if (pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ) { \r
- Double_t pMomInnerWall = pInnerWallTrackXi ->GetP();\r
- Double_t nMomInnerWall = nInnerWallTrackXi ->GetP();\r
- Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();\r
- //Bachelor\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3) lIsBachelorPionForTPC = kTRUE;\r
- if (bachMomInnerWall < 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;\r
- if (bachMomInnerWall > 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE; \r
- //Negative V0 daughter\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 3 ) lIsNegPionForTPC = kTRUE;\r
- if (nMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 ) lIsNegProtonForTPC = kTRUE;\r
- if (nMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 ) lIsNegProtonForTPC = kTRUE; \r
- //Positive V0 daughter\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 3 ) lIsPosPionForTPC = kTRUE;\r
- if (pMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5) lIsPosProtonForTPC = kTRUE;\r
- if (pMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3) lIsPosProtonForTPC = kTRUE;\r
- }*/\r
- \r
- //---------------------------------\r
- // - Extra info for QA (ESD)\r
- // Miscellaneous pieces of info that may help regarding data quality assessment.\r
- // Cascade transverse and total momentum\r
- xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );\r
- lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );\r
- lXiTotMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );\r
- // V0 total momentum\r
- xi->GetNPxPyPz(lV0NMomX,lV0NMomY,lV0NMomZ);\r
- xi->GetPPxPyPz(lV0PMomX,lV0PMomY,lV0PMomZ);\r
- lV0TotMom = TMath::Sqrt(TMath::Power(lV0NMomX+lV0PMomX,2) + TMath::Power(lV0NMomY+lV0PMomY,2) + TMath::Power(lV0NMomZ+lV0PMomZ,2));\r
- // Bachelor total momentum\r
- xi->GetBPxPyPz( lBachMomX, lBachMomY, lBachMomZ );\r
- lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );\r
- lBachTotMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );\r
- lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX + lV0NMomY*lV0NMomY );\r
- lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX + lV0PMomY*lV0PMomY );\r
- lChargeXi = xi->Charge();\r
- lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );\r
- lRapXi = xi->RapXi();\r
- lRapOmega = xi->RapOmega();\r
- lEta = xi->Eta();\r
- lTheta = xi->Theta()*180.0/TMath::Pi();\r
- lPhi = xi->Phi()*180.0/TMath::Pi();\r
- lAlphaXi = xi->AlphaXi();\r
- lPtArmXi = xi->PtArmXi();\r
- // Extra-cut = Anti-splitting cut for lambda daughters\r
- Bool_t kAntiSplittingLambda = kFALSE; \r
- if (kAntiSplittingLambda) { // not used\r
- Double_t lNMomX = 0., lNMomY = 0., lNMomZ = 0.;\r
- Double_t lPMomX = 0., lPMomY = 0., lPMomZ = 0.;\r
- xi->GetPPxPyPz(lPMomX, lPMomY, lPMomZ); \r
- xi->GetNPxPyPz(lNMomX, lNMomY, lNMomZ); \r
- if ( xi->Charge() < 0) {// Xi- or Omega-\r
- if (TMath::Abs(lBachTransvMom - TMath::Sqrt( lNMomX*lNMomX + lNMomY*lNMomY ) ) < 0.075) continue;\r
- } else { //Xi+ or Omega+\r
- if(TMath::Abs(lBachTransvMom - TMath::Sqrt( lPMomX*lPMomX + lPMomY*lPMomY ) ) < 0.075) continue;\r
- }\r
- }\r
-\r
- } // end of ESD treatment\r
- \r
- else if (fAnalysisType == "AOD") {\r
-\r
- // -------------------------------------\r
- // - Load the cascades from the handler\r
- const AliAODcascade *xi = lAODevent->GetCascade(iXi);\r
- if (!xi) continue;\r
- \r
- //---------------------------------------------------------------------------- \r
- // - Assigning the necessary variables for specific AliESDcascade data members \r
- lEffMassXi = xi->MassXi(); // default working hypothesis : cascade = Xi- decay\r
- lDcaXiDaughters = xi->DcaXiDaughters();\r
- lXiCosineOfPointingAngle = xi->CosPointingAngleXi( lBestPrimaryVtxPos[0], \r
- lBestPrimaryVtxPos[1], \r
- lBestPrimaryVtxPos[2] );\r
- lPosXi[0] = xi->DecayVertexXiX();\r
- lPosXi[1] = xi->DecayVertexXiY();\r
- lPosXi[2] = xi->DecayVertexXiZ();\r
- lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );\r
-\r
- //-------------------------------------------------------------------------------------------------------------------------------\r
- // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)\r
- AliAODTrack *pTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );\r
- AliAODTrack *nTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );\r
- AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );\r
- if (!pTrackXi || !nTrackXi || !bachTrackXi ) {\r
- AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");\r
- continue;\r
- }\r
- UInt_t lIdxPosXi = (UInt_t) TMath::Abs( pTrackXi->GetID() ); \r
- UInt_t lIdxNegXi = (UInt_t) TMath::Abs( nTrackXi->GetID() );\r
- UInt_t lBachIdx = (UInt_t) TMath::Abs( bachTrackXi->GetID() );\r
- // Care track label can be negative in MC production (linked with the track quality)\r
- // However = normally, not the case for track index ...\r
- // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)\r
- if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }\r
- if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }\r
- // - Get the TPCnumber of cluster for the daughters\r
- lPosTPCClusters = pTrackXi->GetTPCNcls(); // FIXME: Is this ok? or something like in LambdaK0PbPb task AOD?\r
- lNegTPCClusters = nTrackXi->GetTPCNcls();\r
- lBachTPCClusters = bachTrackXi->GetTPCNcls();\r
-\r
- //-------------------------------------\r
- // - Rejection of a poor quality tracks\r
- if (fkQualityCutTPCrefit) {\r
- // - Poor quality related to TPCrefit\r
- if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }\r
- if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }\r
- if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }\r
- }\r
- if (fkQualityCutnTPCcls) {\r
- // - Poor quality related to TPC clusters\r
- if (lPosTPCClusters < fMinnTPCcls) { //AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!");\r
- continue; }\r
- if (lNegTPCClusters < fMinnTPCcls) { //AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!");\r
- continue; }\r
- if (lBachTPCClusters < fMinnTPCcls) { //AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!");\r
- continue; }\r
- }\r
-\r
- //---------------------------------------\r
- // - Around the tracks: Bach + V0 (AOD). Necessary variables for AODcascade data members coming from the AODv0 part (inheritance)\r
- etaPos = pTrackXi->Eta();\r
- etaNeg = nTrackXi->Eta();\r
- etaBach = bachTrackXi->Eta();\r
- lChargeXi = xi->ChargeXi();\r
- if ( lChargeXi < 0) lInvMassLambdaAsCascDghter = xi->MassLambda();\r
- else lInvMassLambdaAsCascDghter = xi->MassAntiLambda();\r
- lDcaV0DaughtersXi = xi->DcaV0Daughters(); \r
- lDcaV0ToPrimVertexXi = xi->DcaV0ToPrimVertex();\r
- lDcaBachToPrimVertexXi = xi->DcaBachToPrimVertex(); \r
- lPosV0Xi[0] = xi->DecayVertexV0X();\r
- lPosV0Xi[1] = xi->DecayVertexV0Y();\r
- lPosV0Xi[2] = xi->DecayVertexV0Z(); \r
- lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );\r
- lV0CosineOfPointingAngleXi = xi->CosPointingAngle( lBestPrimaryVtxPos ); \r
- lDcaPosToPrimVertexXi = xi->DcaPosToPrimVertex(); \r
- lDcaNegToPrimVertexXi = xi->DcaNegToPrimVertex(); \r
-\r
- //---------------------------------------------------------------------------------------------------- \r
- // - Around effective masses. Change mass hypotheses to cover all the possibilities: Xi-/+, Omega -/+\r
- if ( lChargeXi < 0 ) lInvMassXiMinus = xi->MassXi();\r
- if ( lChargeXi > 0 ) lInvMassXiPlus = xi->MassXi();\r
- if ( lChargeXi < 0 ) lInvMassOmegaMinus = xi->MassOmega();\r
- if ( lChargeXi > 0 ) lInvMassOmegaPlus = xi->MassOmega();\r
-\r
- //--------------------------------\r
- // - PID on the daughter tracks\r
- // - Combined PID -> removed, add when will be used\r
-\r
- // - TPC PID : 3-sigma bands on Bethe-Bloch curve\r
- //Bachelor\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;\r
- //Negative V0 daughter\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;\r
- //Positive V0 daughter\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;\r
- if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;\r
-\r
- //---------------------------------\r
- // - Extra info for QA (AOD)\r
- // Miscellaneous pieces of info that may help regarding data quality assessment.\r
- // Cascade transverse and total momentum \r
- lXiMomX = xi->MomXiX();\r
- lXiMomY = xi->MomXiY();\r
- lXiMomZ = xi->MomXiZ();\r
- lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );\r
- lXiTotMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );\r
- Double_t lV0MomX = xi->MomV0X();\r
- Double_t lV0MomY = xi->MomV0Y();\r
- Double_t lV0MomZ = xi->MomV0Z();\r
- lV0TotMom = TMath::Sqrt(TMath::Power(lV0MomX,2)+TMath::Power(lV0MomY,2)+TMath::Power(lV0MomZ,2));\r
- lBachMomX = xi->MomBachX();\r
- lBachMomY = xi->MomBachY();\r
- lBachMomZ = xi->MomBachZ(); \r
- lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );\r
- lBachTotMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );\r
- lV0NMomX = xi->MomNegX();\r
- lV0NMomY = xi->MomNegY();\r
- lV0PMomX = xi->MomPosX();\r
- lV0PMomY = xi->MomPosY();\r
- lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX + lV0NMomY*lV0NMomY );\r
- lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX + lV0PMomY*lV0PMomY );\r
- lV0toXiCosineOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );\r
- lRapXi = xi->RapXi();\r
- lRapOmega = xi->RapOmega();\r
- lEta = xi->Eta(); // Will not work ! need a method Pz(), Py() Px() \r
- lTheta = xi->Theta() *180.0/TMath::Pi(); // in AODcascade.\r
- lPhi = xi->Phi() *180.0/TMath::Pi(); // Here, we will get eta, theta, phi for the V0 ...\r
- lAlphaXi = xi->AlphaXi();\r
- lPtArmXi = xi->PtArmXi();\r
-\r
- } // end of AOD treatment\r
-\r
- // Cut on pt of the three daughter tracks\r
- if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;\r
- if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;\r
- if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;\r
- \r
- // Cut on pseudorapidity of the three daughter tracks\r
- if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;\r
- if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;\r
- if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;\r
- \r
- \r
- //----------------------------------\r
- // Calculate proper lenght for cascade\r
- Double_t cascadeMass = 0.;\r
- if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||\r
- ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) ) cascadeMass = 1.321;\r
- if ( ( (lChargeXi<0) && lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||\r
- ( (lChargeXi>0) && lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) ) cascadeMass = 1.672;\r
- Double_t lctau = TMath::Sqrt(TMath::Power((lPosXi[0]-lBestPrimaryVtxPos[0]),2)+TMath::Power((lPosXi[1]-lBestPrimaryVtxPos[1]),2)+TMath::Power(( lPosXi[2]-lBestPrimaryVtxPos[2]),2));\r
- if (lXiTotMom!=0) lctau = lctau*cascadeMass/lXiTotMom;\r
- else lctau = -1.;\r
-\r
- //-------------------------------------------------\r
- // Calculate proper lenght for Lambda (reconstructed)\r
- Float_t lambdaMass = 1.115683; // PDG mass\r
- Float_t distV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2)+TMath::Power((lPosV0Xi[2]-lPosXi[2]),2));\r
- Float_t lctauV0 = -1.;\r
- if (lV0TotMom!=0) lctauV0 = distV0Xi*lambdaMass/lV0TotMom;\r
- Float_t distTV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));\r
-\r
- //--------------\r
- /*// For AliEVE \r
- if(lChargeXi < 0&& lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {\r
- if (lXiTransvMom>2.&&lXiTransvMom<4.&&(lInvMassXiMinus<1.322&&lInvMassXiMinus>1.320)&&(lXiRadius<8.&&lXiRadius>3.)) {\r
- // FIXME : Just to know which file is currently open : locate the file containing Xi\r
- cout << "Name of the file containing Xi candidate(s) :" \r
- << CurrentFileName() \r
- << " / entry: " << Entry()\r
- << " / in file: " << lESDevent->GetEventNumberInFile() // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();\r
- << " AliESDcascade number " << iXi \r
- << " : mass(Xi-) = " << lInvMassXiMinus\r
- << " / charge = " << lChargeXi\r
- << " / pt(Casc) = " << lXiTransvMom\r
- << " / Decay 2d R(Xi) = " << lXiRadius \r
- << endl;\r
- }\r
- }\r
- if(lChargeXi < 0&& lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {\r
- if (lXiTransvMom>2&&lXiTransvMom<4&&(lInvMassOmegaMinus<1.674&&lInvMassOmegaMinus>1.670)&&(lXiRadius<8.&&lXiRadius>3.)) {\r
- cout << "Name of the file containing Omega candidate(s) :"\r
- << CurrentFileName()\r
- << " / entry: " << Entry()\r
- << " / in file: " << lESDevent->GetEventNumberInFile() // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();\r
- << " AliESDcascade number " << iXi \r
- << " : mass(Omega-) = " << lInvMassOmegaMinus\r
- << " / charge = " << lChargeXi\r
- << " / pt(Casc) = " << lXiTransvMom\r
- << " / Decay 2d R(Xi) = " << lXiRadius\r
- << endl;\r
-\r
- }\r
- }*/\r
- \r
-\r
- // - \r
- fHistPosV0TPCClusters->Fill( lPosTPCClusters );\r
- fHistNegV0TPCClusters->Fill( lNegTPCClusters );\r
- fHistBachTPCClusters->Fill( lBachTPCClusters );\r
- f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[0] , lTPCSignalCascDghters[0] );\r
- f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[1] , lTPCSignalCascDghters[1] );\r
- f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[2] , lTPCSignalCascDghters[2] );\r
-\r
- //----------------\r
- //Plot with PID on \r
- if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||\r
- ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) ) {\r
- // NOTE : \r
- // with this condition, it could happen that a cascade candidate satisfies the wrong requirement,\r
- // e.g. one looks at a Xi- candidate for which lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC = kFALSE\r
- // Expectation: it should be excluded, but lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC = kTRUE\r
- // then this bad Xi-candidate will contribute anyway (OR condition).\r
- // Hence: the extra condition on the sign of the Cascade\r
- //if (TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.010 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.010)\r
- fHistEffMassXi->Fill( lEffMassXi );\r
- fHistDcaXiDaughters->Fill( lDcaXiDaughters ); // Flag CascadeVtxer: Cut Variable e \r
- fHistDcaBachToPrimVertex->Fill( lDcaBachToPrimVertexXi ); // Flag CascadeVtxer: Cut Variable d\r
- fHistXiCosineOfPointingAngle->Fill( lXiCosineOfPointingAngle ); // Flag CascadeVtxer: Cut Variable f\r
- fHistXiRadius->Fill( lXiRadius ); // Flag CascadeVtxer: Cut Variable g+h\r
- fHistMassLambdaAsCascDghter->Fill( lInvMassLambdaAsCascDghter ); // Flag CascadeVtxer: Cut Variable c\r
- fHistDcaV0DaughtersXi->Fill( lDcaV0DaughtersXi );\r
- fHistV0CosineOfPointingAngleXi->Fill( lV0CosineOfPointingAngleXi ); \r
- fHistV0RadiusXi->Fill( lV0RadiusXi );\r
- fHistDcaV0ToPrimVertexXi->Fill( lDcaV0ToPrimVertexXi ); // Flag CascadeVtxer: Cut Variable b\r
- fHistDcaPosToPrimVertexXi->Fill( lDcaPosToPrimVertexXi );\r
- fHistDcaNegToPrimVertexXi->Fill( lDcaNegToPrimVertexXi );\r
- fHistChargeXi->Fill( lChargeXi );\r
- fHistV0toXiCosineOfPointingAngle->Fill( lV0toXiCosineOfPointingAngle );\r
- if ( TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.012 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.012) { // One InvMass should be different from 0\r
- fHistXiTransvMom->Fill( lXiTransvMom );\r
- fHistXiTotMom->Fill( lXiTotMom );\r
- fHistBachTransvMomXi->Fill( lBachTransvMom );\r
- fHistBachTotMomXi->Fill( lBachTotMom );\r
- fHistRapXi->Fill( lRapXi );\r
- fHistEtaXi->Fill( lEta );\r
- if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) {\r
- fHistEtaBachXi->Fill( etaBach );\r
- fHistEtaPosXi->Fill( etaPos );\r
- fHistEtaNegXi->Fill( etaNeg );\r
- }\r
- fHistThetaXi->Fill( lTheta );\r
- fHistPhiXi->Fill( lPhi );\r
- }\r
- if ( TMath::Abs( lInvMassOmegaMinus-1.672 ) < 0.012 || TMath::Abs( lInvMassOmegaPlus-1.672 ) < 0.012 ) { // One InvMass should be different from 0\r
- fHistRapOmega->Fill( lRapOmega ); \r
- }\r
- f2dHistArmenteros->Fill( lAlphaXi, lPtArmXi );\r
- } // end with PID ...\r
-\r
- //-----------------------\r
- // - Invariant mass plots\r
- //Plots 1D\r
- if ( lChargeXi < 0 ) {\r
- fHistMassXiMinus->Fill( lInvMassXiMinus );\r
- fHistMassOmegaMinus->Fill( lInvMassOmegaMinus );\r
- f2dHistDcaXiDaughtersvsInvMass->Fill(lDcaXiDaughters,lInvMassXiMinus);\r
- f2dHistDcaBachToPrimVertexvsInvMass->Fill(lDcaBachToPrimVertexXi,lInvMassXiMinus); \r
- f2dHistXiCosineOfPointingAnglevsInvMass->Fill(lXiCosineOfPointingAngle,lInvMassXiMinus);\r
- f2dHistMassLambdaAsCascDghtervsInvMass->Fill(lInvMassLambdaAsCascDghter,lInvMassXiMinus);\r
- f2dHistDcaV0DaughtersXivsInvMass->Fill(lDcaV0DaughtersXi,lInvMassXiMinus);\r
- f2dHistDcaV0ToPrimVertexXivsInvMass->Fill(lDcaV0ToPrimVertexXi,lInvMassXiMinus);\r
- }\r
- if ( lChargeXi > 0 ) {\r
- fHistMassXiPlus->Fill( lInvMassXiPlus );\r
- fHistMassOmegaPlus->Fill( lInvMassOmegaPlus );\r
- }\r
- //Plots 2D, 3D\r
- if ( lChargeXi < 0 ) {\r
- f2dHistEffMassLambdaVsEffMassXiMinus->Fill( lInvMassLambdaAsCascDghter, lInvMassXiMinus ); \r
- f2dHistEffMassXiVsEffMassOmegaMinus ->Fill( lInvMassXiMinus, lInvMassOmegaMinus );\r
- f2dHistXiRadiusVsEffMassXiMinus ->Fill( lXiRadius, lInvMassXiMinus );\r
- f2dHistXiRadiusVsEffMassOmegaMinus ->Fill( lXiRadius, lInvMassOmegaMinus );\r
- } else {\r
- f2dHistEffMassLambdaVsEffMassXiPlus ->Fill( lInvMassLambdaAsCascDghter, lInvMassXiPlus );\r
- f2dHistEffMassXiVsEffMassOmegaPlus ->Fill( lInvMassXiPlus, lInvMassOmegaPlus );\r
- f2dHistXiRadiusVsEffMassXiPlus ->Fill( lXiRadius, lInvMassXiPlus);\r
- f2dHistXiRadiusVsEffMassOmegaPlus ->Fill( lXiRadius, lInvMassOmegaPlus );\r
- }\r
-\r
- //--------------------------------------------- \r
- // - Filling the AliCFContainers related to PID\r
- Double_t lContainerPIDVars[3] = {0.0};\r
- // Xi Minus \r
- if ( lChargeXi < 0 ) {\r
- lContainerPIDVars[0] = lXiTransvMom;\r
- lContainerPIDVars[1] = lInvMassXiMinus;\r
- lContainerPIDVars[2] = lRapXi;\r
- //No PID\r
- fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 0); // No PID\r
- //TPC PID\r
- if ( lIsBachelorPionForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track \r
- if ( lIsBachelorPionForTPC && lIsPosProtonForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if ( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- //Combined PID\r
- if ( lIsBachelorPion ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor \r
- if ( lIsBachelorPion && lIsPosInXiProton ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if (lIsBachelorPion && lIsPosInXiProton && lIsNegInXiPion ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- }\r
- lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; \r
- // Xi Plus \r
- if ( lChargeXi > 0 ) {\r
- lContainerPIDVars[0] = lXiTransvMom;\r
- lContainerPIDVars[1] = lInvMassXiPlus;\r
- lContainerPIDVars[2] = lRapXi;\r
- //No PID\r
- fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 0); // No PID\r
- //TPC PID\r
- if ( lIsBachelorPionForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if ( lIsBachelorPionForTPC && lIsNegProtonForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if ( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- //Combined PID\r
- if ( lIsBachelorPion ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if ( lIsBachelorPion && lIsNegInXiProton ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if (lIsBachelorPion && lIsNegInXiProton && lIsPosInXiPion ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- }\r
- lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; \r
- // Omega Minus \r
- if ( lChargeXi < 0 ) {\r
- lContainerPIDVars[0] = lXiTransvMom;\r
- lContainerPIDVars[1] = lInvMassOmegaMinus;\r
- lContainerPIDVars[2] = lRapOmega;\r
- //No PID\r
- fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 0); // No PID\r
- //TPC PID\r
- if ( lIsBachelorKaonForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- //Combined PID\r
- if ( lIsBachelorKaon ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if ( lIsBachelorKaon && lIsPosInOmegaProton ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if (lIsBachelorKaon && lIsPosInOmegaProton && lIsNegInOmegaPion ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- }\r
- lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;\r
- // Omega Plus \r
- if ( lChargeXi > 0 ) {\r
- lContainerPIDVars[0] = lXiTransvMom;\r
- lContainerPIDVars[1] = lInvMassOmegaPlus;\r
- lContainerPIDVars[2] = lRapOmega;\r
- // No PID\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 0); // No PID\r
- // TPC PID\r
- if ( lIsBachelorKaonForTPC )\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if( lIsBachelorKaonForTPC && \r
- lIsNegProtonForTPC )\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if ( lIsBachelorKaonForTPC && \r
- lIsNegProtonForTPC && \r
- lIsPosPionForTPC )\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- // Combined PID\r
- if ( lIsBachelorKaon )\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if ( lIsBachelorKaon && \r
- lIsNegInOmegaProton )\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if (lIsBachelorKaon && \r
- lIsNegInOmegaProton && \r
- lIsPosInOmegaPion )\r
- fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- }\r
- \r
- //--------------------------------------------------------------------\r
- // Filling the AliCFContainer (optimisation of topological selections)\r
- Double_t lContainerCutVars[19] = {0.0};\r
- \r
- lContainerCutVars[0] = lDcaXiDaughters;\r
- lContainerCutVars[1] = lDcaBachToPrimVertexXi;\r
- lContainerCutVars[2] = lXiCosineOfPointingAngle;\r
- lContainerCutVars[3] = lXiRadius;\r
- lContainerCutVars[4] = lInvMassLambdaAsCascDghter;\r
- lContainerCutVars[5] = lDcaV0DaughtersXi;\r
- lContainerCutVars[6] = lV0toXiCosineOfPointingAngle;\r
- lContainerCutVars[7] = lV0RadiusXi;\r
- lContainerCutVars[8] = lDcaV0ToPrimVertexXi; \r
- lContainerCutVars[9] = lDcaPosToPrimVertexXi;\r
- lContainerCutVars[10] = lDcaNegToPrimVertexXi;\r
- lContainerCutVars[13] = lXiTransvMom;\r
- lContainerCutVars[16] = lctau;\r
- lContainerCutVars[17] = lctauV0;\r
- lContainerCutVars[18] = distTV0Xi;\r
- \r
- if ( lChargeXi < 0 ) {\r
- lContainerCutVars[11] = lInvMassXiMinus;\r
- lContainerCutVars[12] = lInvMassOmegaMinus;\r
- lContainerCutVars[14] = lRapXi;\r
- lContainerCutVars[15] = -1.;\r
- if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,0); // for Xi-\r
- lContainerCutVars[11] = lInvMassXiMinus;\r
- lContainerCutVars[12] = lInvMassOmegaMinus;\r
- lContainerCutVars[14] = -1.;\r
- lContainerCutVars[15] = lRapOmega;\r
- if (lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,2); // for Omega-\r
- } else {\r
- lContainerCutVars[11] = lInvMassXiPlus;\r
- lContainerCutVars[12] = lInvMassOmegaPlus; \r
- lContainerCutVars[14] = lRapXi;\r
- lContainerCutVars[15] = -1.; \r
- if (lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,1); // for Xi+\r
- lContainerCutVars[11] = lInvMassXiPlus;\r
- lContainerCutVars[12] = lInvMassOmegaPlus;\r
- lContainerCutVars[14] = -1.;\r
- lContainerCutVars[15] = lRapOmega;\r
- if (lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,3); // for Omega+ \r
- } \r
- } //end of the Cascade loop (ESD or AOD)\r
- \r
- // Post output data.\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDXiMinus);\r
- PostData(3, fCFContCascadePIDXiPlus);\r
- PostData(4, fCFContCascadePIDOmegaMinus);\r
- PostData(5, fCFContCascadePIDOmegaPlus);\r
- PostData(6, fCFContCascadeCuts);\r
-}\r
-\r
-//________________________________________________________________________\r
-Int_t AliAnalysisTaskCheckCascadepp276::DoESDTrackWithTPCrefitMultiplicity(const AliESDEvent *lESDevent) {\r
- // Checking the number of tracks with TPCrefit for each event\r
- // Needed for a rough assessment of the event multiplicity\r
- \r
- Int_t nTrackWithTPCrefitMultiplicity = 0;\r
- for (Int_t iTrackIdx = 0; iTrackIdx < (InputEvent())->GetNumberOfTracks(); iTrackIdx++) {\r
- AliESDtrack *esdTrack = 0x0;\r
- esdTrack = lESDevent->GetTrack( iTrackIdx );\r
- if (!esdTrack) { AliWarning("Pb / Could not retrieve one track within the track loop for TPCrefit check ..."); continue; }\r
-\r
- ULong_t lTrackStatus = esdTrack->GetStatus();\r
- if ((lTrackStatus&AliESDtrack::kTPCrefit) == 0) continue;\r
- else nTrackWithTPCrefitMultiplicity++;\r
- // FIXME :\r
- // The goal here is to get a better assessment of the event multiplicity.\r
- // (InputEvent())->GetNumberOfTracks() takes into account ITS std alone tracks + global tracks\r
- // This may introduce a bias. Hence the number of TPC refit tracks.\r
- // Note : the event multiplicity = analysis on its own... See Jacek's or Jan Fiete's analysis on dN/d(eta)\r
-\r
- } // end loop over all event tracks\r
- return nTrackWithTPCrefitMultiplicity;\r
-}\r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskCheckCascadepp276::Terminate(Option_t *) \r
-{\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
-\r
-/* TList *cRetrievedList = 0x0;\r
- cRetrievedList = (TList*)GetOutputData(1);\r
- if(!cRetrievedList){\r
- AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: ouput data container list not available\n"); return;\r
- }\r
- fHistTrackMultiplicity = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistTrackMultiplicity") );\r
- if (!fHistTrackMultiplicity) {\r
- AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistTrackMultiplicity not available\n"); return;\r
- }\r
- fHistMassXiMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiMinus") ); \r
- if (!fHistMassXiMinus) {\r
- AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiMinus not available\n"); return;\r
- }\r
- fHistMassXiPlus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiPlus") );\r
- if (!fHistMassXiPlus) {\r
- AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiPlus not available\n"); return;\r
- } \r
- fHistMassOmegaMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaMinus") );\r
- if (!fHistMassOmegaMinus) {\r
- AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaMinus not available\n"); return;\r
- }\r
- fHistMassOmegaPlus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaPlus") ); \r
- if (!fHistMassOmegaPlus) {\r
- AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaPlus not available\n"); return;\r
- }\r
- \r
- TCanvas *canCheckCascade = new TCanvas("AliAnalysisTaskCheckCascadep276","CheckCascade overview",10,10,1010,660);\r
- canCheckCascade->Divide(2,2);\r
- \r
- canCheckCascade->cd(1);\r
- canCheckCascade->cd(1)->SetLogy();\r
- fHistTrackMultiplicity->SetMarkerStyle(kFullStar); \r
- fHistTrackMultiplicity->GetXaxis()->SetLabelFont(42);\r
- fHistTrackMultiplicity->GetYaxis()->SetLabelFont(42);\r
- fHistTrackMultiplicity->SetTitleFont(42, "xy");\r
- fHistTrackMultiplicity->GetXaxis()->SetTitleOffset(1.1);\r
- fHistTrackMultiplicity->DrawCopy("H");\r
- \r
- canCheckCascade->cd(2); \r
- fHistMassXiMinus ->SetMarkerStyle(kFullCircle);\r
- fHistMassXiMinus ->SetMarkerSize(0.5);\r
- fHistMassXiMinus ->GetXaxis()->SetLabelFont(42);\r
- fHistMassXiMinus ->GetYaxis()->SetLabelFont(42);\r
- fHistMassXiMinus ->SetTitleFont(42, "xy");\r
- fHistMassXiMinus ->GetXaxis()->SetTitleOffset(1.1);\r
- fHistMassXiMinus ->GetYaxis()->SetTitleOffset(1.3);\r
- //fHistMassXiMinus->Rebin(2);\r
- fHistMassXiMinus ->GetXaxis()->SetRangeUser(1.24, 1.42);\r
- fHistMassXiMinus ->DrawCopy("E");\r
- \r
- fHistMassXiPlus ->SetMarkerStyle(kOpenCircle);\r
- fHistMassXiPlus ->SetMarkerColor(kRed+2);\r
- fHistMassXiPlus ->SetLineColor(kRed+2);\r
- fHistMassXiPlus ->SetMarkerSize(0.5);\r
- //fHistMassXiPlus ->Rebin(2);\r
- fHistMassXiPlus ->DrawCopy("ESAME");\r
- \r
- \r
- TLegend *legendXi =new TLegend(0.67,0.34,0.97,0.54);\r
- legendXi->SetTextFont(42);\r
- legendXi->SetTextSize(0.05);\r
- legendXi->SetFillColor(kWhite);\r
- legendXi->AddEntry( fHistMassXiMinus,"#Xi^{-} candidates","lp");\r
- legendXi->AddEntry( fHistMassXiPlus,"#Xi^{+} candidates","lp");\r
- legendXi->Draw();\r
- \r
- \r
- canCheckCascade->cd(3); \r
- fHistMassOmegaPlus ->SetMarkerStyle(kOpenCircle);\r
- fHistMassOmegaPlus ->SetMarkerColor(kRed+2);\r
- fHistMassOmegaPlus ->SetLineColor(kRed+2);\r
- fHistMassOmegaPlus ->SetMarkerSize(0.5);\r
- fHistMassOmegaPlus ->GetXaxis()->SetLabelFont(42);\r
- fHistMassOmegaPlus ->GetYaxis()->SetLabelFont(42);\r
- fHistMassOmegaPlus ->SetTitleFont(42, "xy");\r
- fHistMassOmegaPlus ->GetXaxis()->SetTitleOffset(1.1);\r
- fHistMassOmegaPlus ->GetYaxis()->SetTitleOffset(1.25);\r
- //fHistMassOmegaPlus ->Rebin(2);\r
- fHistMassOmegaPlus ->GetXaxis()->SetRangeUser(1.6, 1.84);\r
- fHistMassOmegaPlus ->DrawCopy("E");\r
- \r
- fHistMassOmegaMinus->SetMarkerStyle(kFullCircle);\r
- fHistMassOmegaMinus->SetMarkerSize(0.5);\r
- //fHistMassOmegaMinus->Rebin(2);\r
- fHistMassOmegaMinus->DrawCopy("ESAME");\r
-\r
- \r
- TLegend *legendOmega = new TLegend(0.67,0.34,0.97,0.54);\r
- legendOmega->SetTextFont(42);\r
- legendOmega->SetTextSize(0.05);\r
- legendOmega->SetFillColor(kWhite);\r
- legendOmega->AddEntry( fHistMassOmegaMinus,"#Omega^{-} candidates","lp");\r
- legendOmega->AddEntry( fHistMassOmegaPlus,"#Omega^{+} candidates","lp");\r
- legendOmega->Draw();\r
- */\r
-}\r
+/**************************************************************************
+ * Authors : Antonin Maire, Boris Hippolyte *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskCheckCascadepp276 class
+//
+// Origin AliAnalysisTaskCheckCascade which has four roles :
+// 1. QAing the Cascades from ESD and AOD
+// Origin: AliAnalysisTaskESDCheckV0 by Boris Hippolyte Nov2007, hippolyt@in2p3.fr
+// 2. Prepare the plots which stand as raw material for yield extraction (wi/wo PID)
+// 3. Supply an AliCFContainer meant to define the optimised topological selections
+// 4. Rough azimuthal correlation study (Eta, Phi)
+// Adapted to Cascade : A.Maire Mar2008, antonin.maire@ires.in2p3.fr
+// Modified : A.Maire Mar2010
+//
+// Adapted to PbPb analysis: M. Nicassio, maria.nicassio@ba.infn.it
+// Feb-August2011
+// - Physics selection moved to the run.C macro
+// - Centrality selection added (+ setters) and histos
+// - flag and setters added (CF container usage, vertex range)
+// - histo added and histo/container binning changed
+// - protection in the destructor for CAF usage
+// - AliWarning disabled
+// - number of tracklets from AOD also
+// - automatic settings for PID
+// September2011
+// - proper time histos/container added (V0 and Cascades)
+// - cosine PA V0 wrt Xi vertex in the container
+// November2011
+// - re-run V0's and cascade's vertexers (SetCuts instead SetDefaultCuts!!)
+// - problems of libraries on Grid --> code copied in the task (from AliRoot v5-10-AN
+// where new pt dependent V0's cosPA cut implemented by Iouri)
+// - AOD analysis part completed
+//
+//
+// Adapted to pp 2.76 analysis: D. Colella, domenico.colella@ba.infn.it
+// Gen-now 2012
+// - Physics selection re-moved here (mainly for normalization in the efficiency calcuation)
+// - Centrality selection deleted
+// -
+//
+//-----------------------------------------------------------------
+
+class TTree;
+class TParticle;
+class TVector3;
+
+class AliESDVertex;
+class AliAODVertex;
+class AliESDv0;
+class AliAODv0;
+
+#include <Riostream.h>
+#include "TList.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "THnSparse.h"
+#include "TVector3.h"
+#include "TCanvas.h"
+#include "TMath.h"
+#include "TLegend.h"
+
+#include "AliLog.h"
+#include "AliESDEvent.h"
+#include "AliAODEvent.h"
+#include "AliV0vertexer.h"
+#include "AliCascadeVertexer.h"
+#include "AliESDtrackCuts.h"
+#include "AliPIDResponse.h"
+
+#include "AliESDVZERO.h"
+
+#include "AliInputEventHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliMCEventHandler.h"
+#include "AliESDInputHandler.h"
+#include "AliAODInputHandler.h"
+#include "AliCFContainer.h"
+#include "AliMultiplicity.h"
+
+#include "AliESDcascade.h"
+#include "AliAODcascade.h"
+#include "AliAODTrack.h"
+
+#include "AliAnalysisTaskCheckCascadepp276.h"
+
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliAnalysisTaskCheckCascadepp276)
+
+
+
+//________________________________________________________________________
+AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276()
+ : AliAnalysisTaskSE(),
+ fAnalysisType ("ESD"),
+ fESDtrackCuts (0),
+ fPIDResponse (0),
+ fkRerunV0CascVertexers (0),
+ fkSDDSelectionOn (kTRUE),
+ fkQualityCutZprimVtxPos (kTRUE),
+ fkQualityCutNoTPConlyPrimVtx(kTRUE),
+ fkQualityCutTPCrefit (kTRUE),
+ fkQualityCutnTPCcls (kTRUE),
+ fkQualityCutPileup (kTRUE),
+ fwithSDD (kTRUE),
+ fMinnTPCcls (0),
+ fkExtraSelections (0),
+ fVtxRange (0),
+ fVtxRangeMin (0),
+ fMinPtCutOnDaughterTracks (0),
+ fEtaCutOnDaughterTracks (0),
+
+ // - Plots initialisation
+ fListHistCascade(0),
+ // Cascades multiplicity plots
+ fHistCascadeMultiplicityBeforeAnySel(0),
+ fHistCascadeMultiplicityAfterSDDSel(0),
+ fHistCascadeMultiplicityAfterPhysicsSel(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistCascadeMultiplicityAfterVertexCutSel(0),
+ // Tracks multiplicity plots
+ fHistTrackMultiplicityBeforeAnySel(0),
+ fHistTrackMultiplicityAfterSDDSel(0),
+ fHistTrackMultiplicityAfterPhysicsSel(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistTrackMultiplicityAfterVertexCutSel(0),
+ // Vertex position plots (BestVertex)
+ fHistPVx(0), fHistPVy(0), fHistPVz(0),
+ fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),
+ // TPC cluster distributions for daughters
+ fHistPosV0TPCClusters(0),
+ fHistNegV0TPCClusters(0),
+ fHistBachTPCClusters(0),
+ // Cut's variables distributions
+ fHistEffMassXi(0),
+ fHistDcaXiDaughters(0),
+ fHistDcaBachToPrimVertex(0),
+ fHistXiCosineOfPointingAngle(0),
+ fHistXiRadius(0),
+ fHistMassLambdaAsCascDghter(0),
+ fHistDcaV0DaughtersXi(0),
+ fHistDcaV0ToPrimVertexXi(0),
+ fHistV0CosineOfPointingAngleXi(0),
+ fHistV0RadiusXi(0),
+ fHistDcaPosToPrimVertexXi(0),
+ fHistDcaNegToPrimVertexXi(0),
+ // Invariant mass distributions
+ fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),
+ // Transverse and total momentum distributions
+ fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),
+ // Others QA plots
+ fHistChargeXi(0),
+ fHistV0toXiCosineOfPointingAngle(0),
+ fHistRapXi(0), fHistRapOmega(0),
+ fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),
+ fHistThetaXi(0),
+ fHistPhiXi(0),
+ f2dHistArmenteros(0),
+ f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),
+ f2dHistEffMassLambdaVsEffMassXiPlus(0), f2dHistEffMassXiVsEffMassOmegaPlus(0),
+ f2dHistXiRadiusVsEffMassXiMinus(0), f2dHistXiRadiusVsEffMassXiPlus(0),
+ f2dHistXiRadiusVsEffMassOmegaMinus(0), f2dHistXiRadiusVsEffMassOmegaPlus(0),
+ f2dHistTPCdEdxOfCascDghters(0),
+ f2dHistDcaXiDaughtersvsInvMass(0),
+ f2dHistDcaBachToPrimVertexvsInvMass(0),
+ f2dHistXiCosineOfPointingAnglevsInvMass(0),
+ f2dHistMassLambdaAsCascDghtervsInvMass(0),
+ f2dHistDcaV0DaughtersXivsInvMass(0),
+ f2dHistDcaV0ToPrimVertexXivsInvMass(0),
+ // Containers for cuts study
+ fCFContCascadePIDXiMinus(0),
+ fCFContCascadePIDXiPlus(0),
+ fCFContCascadePIDOmegaMinus(0),
+ fCFContCascadePIDOmegaPlus(0),
+ fCFContCascadeCuts(0)
+
+ {
+ // Dummy Constructor
+ for(Int_t iV0selIdx = 0; iV0selIdx < 7; iV0selIdx++ ) { fV0Sels [iV0selIdx ] = -1.; }
+ for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels [iCascSelIdx ] = -1.; }
+ }
+
+
+//________________________________________________________________________
+AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276(const char *name)
+ : AliAnalysisTaskSE(name),
+ fAnalysisType ("ESD"),
+ fESDtrackCuts (0),
+ fPIDResponse (0),
+ fkRerunV0CascVertexers (0),
+ fkSDDSelectionOn (kTRUE),
+ fkQualityCutZprimVtxPos (kTRUE),
+ fkQualityCutNoTPConlyPrimVtx(kTRUE),
+ fkQualityCutTPCrefit (kTRUE),
+ fkQualityCutnTPCcls (kTRUE),
+ fkQualityCutPileup (kTRUE),
+ fwithSDD (kTRUE),
+ fMinnTPCcls (0),
+ fkExtraSelections (0),
+ fVtxRange (0),
+ fVtxRangeMin (0),
+ fMinPtCutOnDaughterTracks (0),
+ fEtaCutOnDaughterTracks (0),
+
+ // - Plots initialisation
+ fListHistCascade(0),
+
+ // Cascades multiplicity plots
+ fHistCascadeMultiplicityBeforeAnySel(0),
+ fHistCascadeMultiplicityAfterSDDSel(0),
+ fHistCascadeMultiplicityAfterPhysicsSel(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistCascadeMultiplicityAfterVertexCutSel(0),
+ // Tracks multiplicity plots
+ fHistTrackMultiplicityBeforeAnySel(0),
+ fHistTrackMultiplicityAfterSDDSel(0),
+ fHistTrackMultiplicityAfterPhysicsSel(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistTrackMultiplicityAfterVertexCutSel(0),
+ // Vertex position plots (BestVertex)
+ fHistPVx(0), fHistPVy(0), fHistPVz(0),
+ fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),
+ // TPC cluster distributions for daughters
+ fHistPosV0TPCClusters(0), fHistNegV0TPCClusters(0), fHistBachTPCClusters(0),
+ // Cut's variables distributions
+ fHistEffMassXi(0),
+ fHistDcaXiDaughters(0),
+ fHistDcaBachToPrimVertex(0),
+ fHistXiCosineOfPointingAngle(0),
+ fHistXiRadius(0),
+ fHistMassLambdaAsCascDghter(0),
+ fHistDcaV0DaughtersXi(0),
+ fHistDcaV0ToPrimVertexXi(0),
+ fHistV0CosineOfPointingAngleXi(0),
+ fHistV0RadiusXi(0),
+ fHistDcaPosToPrimVertexXi(0),
+ fHistDcaNegToPrimVertexXi(0),
+ // Invariant mass distributions
+ fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),
+ // Transverse and total momentum distributions
+ fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),
+ // Others QA plots
+ fHistChargeXi(0),
+ fHistV0toXiCosineOfPointingAngle(0),
+ fHistRapXi(0), fHistRapOmega(0),
+ fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),
+ fHistThetaXi(0),
+ fHistPhiXi(0),
+ f2dHistArmenteros(0),
+ f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),
+ f2dHistEffMassLambdaVsEffMassXiPlus(0), f2dHistEffMassXiVsEffMassOmegaPlus(0),
+ f2dHistXiRadiusVsEffMassXiMinus(0), f2dHistXiRadiusVsEffMassXiPlus(0),
+ f2dHistXiRadiusVsEffMassOmegaMinus(0), f2dHistXiRadiusVsEffMassOmegaPlus(0),
+ f2dHistTPCdEdxOfCascDghters(0),
+ f2dHistDcaXiDaughtersvsInvMass(0),
+ f2dHistDcaBachToPrimVertexvsInvMass(0),
+ f2dHistXiCosineOfPointingAnglevsInvMass(0),
+ f2dHistMassLambdaAsCascDghtervsInvMass(0),
+ f2dHistDcaV0DaughtersXivsInvMass(0),
+ f2dHistDcaV0ToPrimVertexXivsInvMass(0),
+ // Containers for cuts study
+ fCFContCascadePIDXiMinus(0),
+ fCFContCascadePIDXiPlus(0),
+ fCFContCascadePIDOmegaMinus(0),
+ fCFContCascadePIDOmegaPlus(0),
+ fCFContCascadeCuts(0)
+
+ //_____Costructor____
+ {
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ // DefineInput(0, TChain::Class());
+ // Output slot #1 writes into a TList container (cascade)
+ // default p-p values
+ fV0Sels[0] = 33. ; // max allowed chi2
+ fV0Sels[1] = 0.01; // min allowed impact parameter for the 1st daughter
+ fV0Sels[2] = 0.01; // min allowed impact parameter for the 2nd daughter
+ fV0Sels[3] = 1.5; // max allowed DCA between the daughter tracks
+ fV0Sels[4] = 0.9; // min allowed cosine of V0's pointing angle - This is pT dependent
+ fV0Sels[5] = 0.2; // min radius of the fiducial volume
+ fV0Sels[6] = 200.; // max radius of the fiducial volume
+
+ fCascSels[0] = 33.; // max allowed chi2 (same as PDC07)
+ fCascSels[1] = 0.01; // min allowed V0 impact parameter
+ fCascSels[2] = 0.008; // "window" around the Lambda mass
+ fCascSels[3] = 0.01; // min allowed bachelor's impact parameter
+ fCascSels[4] = 2.0; // max allowed DCA between the V0 and the bachelor
+ fCascSels[5] = 0.95; // min allowed cosine of the cascade pointing angle
+ fCascSels[6] = 0.2; // min radius of the fiducial volume
+ fCascSels[7] = 100.; // max radius of the fiducial volume
+
+ // Output slot #0 writes into a TList container (Cascade)
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, AliCFContainer::Class());
+ DefineOutput(3, AliCFContainer::Class());
+ DefineOutput(4, AliCFContainer::Class());
+ DefineOutput(5, AliCFContainer::Class());
+ DefineOutput(6, AliCFContainer::Class());
+ AliLog::SetClassDebugLevel("AliAnalysisTaskCheckCascadepp276",1);
+ }
+
+
+ //_____Destructor_____
+ AliAnalysisTaskCheckCascadepp276::~AliAnalysisTaskCheckCascadepp276() {
+ // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.
+ // They will be deleted when fListCascade is deleted by the TSelector dtor
+ // Because of TList::SetOwner() ...
+ if (fListHistCascade && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fListHistCascade; fListHistCascade = 0x0; }
+ if (fCFContCascadePIDXiMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDXiMinus; fCFContCascadePIDXiMinus = 0x0; }
+ if (fCFContCascadePIDXiPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDXiPlus; fCFContCascadePIDXiPlus = 0x0; }
+ if (fCFContCascadePIDOmegaMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){ delete fCFContCascadePIDOmegaMinus; fCFContCascadePIDOmegaMinus = 0x0; }
+ if (fCFContCascadePIDOmegaPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDOmegaPlus; fCFContCascadePIDOmegaPlus = 0x0; }
+ if (fCFContCascadeCuts && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadeCuts; fCFContCascadeCuts = 0x0; }
+ if (fESDtrackCuts) { delete fESDtrackCuts; fESDtrackCuts = 0x0; }
+ }
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCheckCascadepp276::UserCreateOutputObjects() {
+ // Create histograms
+ // Called once
+
+
+ fListHistCascade = new TList();
+ fListHistCascade->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
+
+ //-----------------------------------------------
+ // Particle Identification Setup (new PID object)
+ //-----------------------------------------------
+ AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+ fPIDResponse = inputHandler->GetPIDResponse();
+
+ // Only used to get the number of primary reconstructed tracks
+ if (fAnalysisType == "ESD" && (! fESDtrackCuts )){
+ fESDtrackCuts = new AliESDtrackCuts();
+ }
+
+ //---------------------------------------------------
+ // Initialize cuts to re-run V0 and cascade vertexers
+ //---------------------------------------------------
+ // Not validated; to be checked
+ fV0Sels[0] = 33. ; // max allowed chi2
+ fV0Sels[1] = 0.01; // min allowed impact parameter for the 1st daughter
+ fV0Sels[2] = 0.01; // min allowed impact parameter for the 2nd daughter
+ fV0Sels[3] = 1.5; // max allowed DCA between the daughter tracks
+ fV0Sels[4] = 0.9; // min allowed cosine of V0's pointing angle
+ fV0Sels[5] = 0.2; // min radius of the fiducial volume
+ fV0Sels[6] = 200.; // max radius of the fiducial volume
+
+ fCascSels[0] = 33.; // max allowed chi2 (same as PDC07)
+ fCascSels[1] = 0.01; // min allowed V0 impact parameter
+ fCascSels[2] = 0.008; // "window" around the Lambda mass
+ fCascSels[3] = 0.01; // min allowed bachelor's impact parameter
+ fCascSels[4] = 2.0; // max allowed DCA between the V0 and the bachelor
+ fCascSels[5] = 0.95; // min allowed cosine of the cascade pointing angle
+ fCascSels[6] = 0.2; // min radius of the fiducial volume
+ fCascSels[7] = 100.; // max radius of the fiducial volume
+
+ //----------------------
+ // Initialize the histos
+ //----------------------
+
+ // - Cascades multiplicity plots
+ if(! fHistCascadeMultiplicityBeforeAnySel) {
+ fHistCascadeMultiplicityBeforeAnySel = new TH1F("fHistCascadeMultiplicityBeforeAnySel",
+ "Cascades per event (before any selections);Nbr of Cascades/Evt;Events",
+ 20, 0, 20);
+ fListHistCascade->Add(fHistCascadeMultiplicityBeforeAnySel);
+ }
+ if(! fHistCascadeMultiplicityAfterSDDSel) {
+ fHistCascadeMultiplicityAfterSDDSel = new TH1F("fHistCascadeMultiplicityAfterSDDSel",
+ "Cascades per event (after the SDD selection);Nbr of Cascades/Evt;Events",
+ 20, 0, 20);
+ fListHistCascade->Add(fHistCascadeMultiplicityAfterSDDSel);
+ }
+ if(! fHistCascadeMultiplicityAfterPhysicsSel) {
+ fHistCascadeMultiplicityAfterPhysicsSel = new TH1F("fHistCascadeMultiplicityAfterPhysicsSel",
+ "Cascades per event (after physics selection);Nbr of Cascades/Evt;Events",
+ 20, 0, 20);
+ fListHistCascade->Add(fHistCascadeMultiplicityAfterPhysicsSel);
+ }
+ if(! fHistCascadeMultiplicityForSelEvtNoTPCOnly) {
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnly",
+ "Cascades per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",
+ 20, 0, 20);
+ fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnly);
+ }
+ if(! fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup) {
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup",
+ "Cascades per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",
+ 20, 0, 20);
+ fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup);
+ }
+ if(! fHistCascadeMultiplicityAfterVertexCutSel) {
+ fHistCascadeMultiplicityAfterVertexCutSel = new TH1F("fHistCascadeMultiplicityAfterVertexCutSel",
+ "Cascades per event (after vertex cut selection);Nbr of Cascades/Evt;Events",
+ 20, 0, 20);
+ fListHistCascade->Add(fHistCascadeMultiplicityAfterVertexCutSel);
+ }
+ // - Tracks multiplicity plots
+ if(! fHistTrackMultiplicityBeforeAnySel) {
+ fHistTrackMultiplicityBeforeAnySel = new TH1F("fHistTrackMultiplicityBeforeAnySel",
+ "Tracks per event (before any selections);Nbr of Cascades/Evt;Events",
+ 100, 0, 100);
+ fListHistCascade->Add(fHistTrackMultiplicityBeforeAnySel);
+ }
+ if(! fHistTrackMultiplicityAfterSDDSel) {
+ fHistTrackMultiplicityAfterSDDSel = new TH1F("fHistTrackMultiplicityAfterSDDSel",
+ "Tracks per event (after the SDD selection);Nbr of Cascades/Evt;Events",
+ 100, 0, 100);
+ fListHistCascade->Add(fHistTrackMultiplicityAfterSDDSel);
+ }
+ if(! fHistTrackMultiplicityAfterPhysicsSel) {
+ fHistTrackMultiplicityAfterPhysicsSel = new TH1F("fHistTrackMultiplicityAfterPhysicsSel",
+ "Tracks per event (after physics selection);Nbr of Cascades/Evt;Events",
+ 100, 0, 100);
+ fListHistCascade->Add(fHistTrackMultiplicityAfterPhysicsSel);
+ }
+ if(! fHistTrackMultiplicityForSelEvtNoTPCOnly) {
+ fHistTrackMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnly",
+ "Tracks per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",
+ 100, 0, 100);
+ fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnly);
+ }
+ if(! fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup) {
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup",
+ "Tracks per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",
+ 100, 0, 100);
+ fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
+ }
+ if(! fHistTrackMultiplicityAfterVertexCutSel) {
+ fHistTrackMultiplicityAfterVertexCutSel = new TH1F("fHistTrackMultiplicityAfterVertexCutSel",
+ "Tracks per event (after vertex cut selection);Nbr of Cascades/Evt;Events",
+ 100, 0, 100);
+ fListHistCascade->Add(fHistTrackMultiplicityAfterVertexCutSel);
+ }
+ // - Vertex position plots
+ if(! fHistPVx ){
+ fHistPVx = new TH1F("fHistPVx", "Best PV position in x; x (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVx);
+ }
+ if(! fHistPVy ){
+ fHistPVy = new TH1F("fHistPVy", "Best PV position in y; y (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVy);
+ }
+ if(! fHistPVz ){
+ fHistPVz = new TH1F("fHistPVz", "Best PV position in z; z (cm); Events", 400, -20, 20);
+ fListHistCascade->Add(fHistPVz);
+ }
+ if(! fHistPVxAnalysis ){
+ fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", "Best PV position in x (after events selections); x (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVxAnalysis);
+ }
+ if(! fHistPVyAnalysis ){
+ fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", "Best PV position in y (after events selections); y (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVyAnalysis);
+ }
+ if(! fHistPVzAnalysis ){
+ fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", "Best PV position in z (after events selections); z (cm); Events", 400, -20, 20);
+ fListHistCascade->Add(fHistPVzAnalysis);
+ }
+ // - TPC clusetr sdistributions for daughters (histos for events containing at least ONE CASCADE)
+ if(! fHistPosV0TPCClusters ){
+ fHistPosV0TPCClusters = new TH1F("fHistPosV0TPCClusters", "TPC clusters for Pos. V0 daughter track, in Casc; Nbr of TPC clusters (V0 Pos.); Track counts", 165, 0.0, 165.0);
+ fListHistCascade->Add(fHistPosV0TPCClusters);
+ }
+ if(! fHistNegV0TPCClusters ){
+ fHistNegV0TPCClusters = new TH1F("fHistNegV0TPCClusters", "TPC clusters for Neg. V0 daughter track, in Casc; Nbr of TPC clusters (V0 Neg.); Track counts", 165, 0.0, 165.0);
+ fListHistCascade->Add(fHistNegV0TPCClusters);
+ }
+ if(! fHistBachTPCClusters ){
+ fHistBachTPCClusters = new TH1F("fHistBachTPCClusters", "TPC clusters for Bachelor track; Nbr of TPC clusters (Bach); Track counts", 165, 0.0, 165.0);
+ fListHistCascade->Add(fHistBachTPCClusters);
+ }
+ // - Cut's variables distributions (typical histos for cascades): as example only for the Xi (both particle and anti-particle)
+ if(! fHistEffMassXi) {
+ fHistEffMassXi = new TH1F("fHistEffMassXi", "Xi candidates; Invariant Mass (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistEffMassXi);
+ }
+ if(! fHistDcaXiDaughters ){
+ fHistDcaXiDaughters = new TH1F("fHistDcaXiDaughters", "DCA between Xi daughters; DCA (cm); Counts", 210, 0., 2.1);
+ fListHistCascade->Add(fHistDcaXiDaughters);
+ }
+ if(! fHistDcaBachToPrimVertex) {
+ fHistDcaBachToPrimVertex = new TH1F("fHistDcaBachToPrimVertex", "Impact parameter of Bach. to Prim. Vertex; DCA (cm); Counts", 250, 0., 0.25);
+ fListHistCascade->Add(fHistDcaBachToPrimVertex);
+ }
+ if(! fHistXiCosineOfPointingAngle) {
+ fHistXiCosineOfPointingAngle = new TH1F("fHistXiCosineOfPointingAngle", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Counts", 601, 0.94, 1.0001);
+ fListHistCascade->Add(fHistXiCosineOfPointingAngle);
+ }
+ if(! fHistXiRadius ){
+ fHistXiRadius = new TH1F("fHistXiRadius", "Cascade decay transv. radius; r (cm); Counts" , 2050, 0., 205.0);
+ fListHistCascade->Add(fHistXiRadius);
+ }
+ if(! fHistMassLambdaAsCascDghter) {
+ fHistMassLambdaAsCascDghter = new TH1F("fHistMassLambdaAsCascDghter", "#Lambda associated to cascade candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.0, 1.3);
+ fListHistCascade->Add(fHistMassLambdaAsCascDghter);
+ }
+ if(! fHistDcaV0DaughtersXi) {
+ fHistDcaV0DaughtersXi = new TH1F("fHistDcaV0DaughtersXi", "DCA between V0 daughters, in cascade; DCA (cm); Counts", 320, 0., 1.6);
+ fListHistCascade->Add(fHistDcaV0DaughtersXi);
+ }
+ if(! fHistDcaV0ToPrimVertexXi) {
+ fHistDcaV0ToPrimVertexXi = new TH1F("fHistDcaV0ToPrimVertexXi", "Impact parameter of V0 to Prim. Vertex, in cascade; DCA (cm); Counts", 200, 0., 1.);
+ fListHistCascade->Add(fHistDcaV0ToPrimVertexXi);
+ }
+ if(! fHistV0CosineOfPointingAngleXi) {
+ fHistV0CosineOfPointingAngleXi = new TH1F("fHistV0CosineOfPointingAngleXi", "Cosine of V0 Pointing Angle, in cascade; Cos(V0 Point. Angl); Counts", 201, 0.8, 1.001);
+ fListHistCascade->Add(fHistV0CosineOfPointingAngleXi);
+ }
+ if(! fHistV0RadiusXi) {
+ fHistV0RadiusXi = new TH1F("fHistV0RadiusXi", "V0 decay radius, in cascade; radius (cm); Counts", 2050, 0., 205.0);
+ fListHistCascade->Add(fHistV0RadiusXi);
+ }
+ if(! fHistDcaPosToPrimVertexXi) {
+ fHistDcaPosToPrimVertexXi = new TH1F("fHistDcaPosToPrimVertexXi", "Impact parameter of V0 pos daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);
+ fListHistCascade->Add(fHistDcaPosToPrimVertexXi);
+ }
+ if(! fHistDcaNegToPrimVertexXi) {
+ fHistDcaNegToPrimVertexXi = new TH1F("fHistDcaNegToPrimVertexXi", "Impact parameter of V0 neg daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);
+ fListHistCascade->Add(fHistDcaNegToPrimVertexXi);
+ }
+ // - Effective mass histos for cascades.
+ //By cascade hyp
+ if(! fHistMassXiMinus) {
+ fHistMassXiMinus = new TH1F("fHistMassXiMinus", "#Xi^{-} candidates; M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassXiMinus);
+ }
+ if(! fHistMassXiPlus) {
+ fHistMassXiPlus = new TH1F("fHistMassXiPlus", "#Xi^{+} candidates; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassXiPlus);
+ }
+ if(! fHistMassOmegaMinus) {
+ fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus", "#Omega^{-} candidates; M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassOmegaMinus);
+ }
+ if(! fHistMassOmegaPlus) {
+ fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus", "#Omega^{+} candidates;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassOmegaPlus);
+ }
+ // - Transverse and total momentum distributions
+ if(! fHistXiTransvMom ){
+ fHistXiTransvMom = new TH1F("fHistXiTransvMom", "#Xi transverse momentum (cand. around the mass peak); p_{t}(#Xi) (GeV/c); Counts", 100, 0.0, 10.0);
+ fListHistCascade->Add(fHistXiTransvMom);
+ }
+ if(! fHistXiTotMom ){
+ fHistXiTotMom = new TH1F("fHistXiTotMom", "#Xi momentum norm (cand. around the mass peak); p_{tot}(#Xi) (GeV/c); Counts", 150, 0.0, 15.0);
+ fListHistCascade->Add(fHistXiTotMom);
+ }
+ if(! fHistBachTransvMomXi ){
+ fHistBachTransvMomXi = new TH1F("fHistBachTransvMomXi", "#Xi Bach. transverse momentum (cand. around the mass peak); p_{t}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);
+ fListHistCascade->Add(fHistBachTransvMomXi);
+ }
+ if(! fHistBachTotMomXi ){
+ fHistBachTotMomXi = new TH1F("fHistBachTotMomXi", "#Xi Bach. momentum norm (cand. around the mass peak); p_{tot}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);
+ fListHistCascade->Add(fHistBachTotMomXi);
+ }
+ // - Others QA plots
+ //TH1
+ if(! fHistChargeXi ){
+ fHistChargeXi = new TH1F("fHistChargeXi", "Charge of Xi candidates; Sign; Counts", 5, -2.0, 3.0);
+ fListHistCascade->Add(fHistChargeXi);
+ }
+ if(! fHistV0toXiCosineOfPointingAngle) {
+ fHistV0toXiCosineOfPointingAngle = new TH1F("fHistV0toXiCosineOfPointingAngle", "Cos. of V0 Ptng Angl / Xi vtx ; Cos(V0 Point. Angl / Xi vtx); Counts", 1101, 0.89, 1.0001);
+ fListHistCascade->Add(fHistV0toXiCosineOfPointingAngle);
+ }
+ if(! fHistRapXi ){
+ fHistRapXi = new TH1F("fHistRapXi", "Rapidity of #Xi candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);
+ fListHistCascade->Add(fHistRapXi);
+ }
+ if(! fHistRapOmega ){
+ fHistRapOmega = new TH1F("fHistRapOmega", "Rapidity of #Omega candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);
+ fListHistCascade->Add(fHistRapOmega);
+ }
+ if(! fHistEtaXi ){
+ fHistEtaXi = new TH1F("fHistEtaXi", "Pseudo-rap. of #Xi candidates (around the mass peak); #eta; Counts", 20, -1.0, 1.0);
+ fListHistCascade->Add(fHistEtaXi);
+ }
+ if(! fHistEtaBachXi){
+ fHistEtaBachXi = new TH1F("fHistEtaBachXi", "Pseudo-rap. of #Xi bachelor; #eta; Counts", 40, -2.0, 2.0);
+ fListHistCascade->Add(fHistEtaBachXi);
+ }
+ if(! fHistEtaPosXi){
+ fHistEtaPosXi = new TH1F("fHistEtaPosXi", "Pseudo-rap. of #Xi positive meson daughter; #eta; Counts", 40, -2.0, 2.0);
+ fListHistCascade->Add(fHistEtaPosXi);
+ }
+ if(! fHistEtaNegXi){
+ fHistEtaNegXi = new TH1F("fHistEtaNegXi", "Pseudo-rap. of #Xi negative meson daughter; #eta; Counts", 40, -2.0, 2.0);
+ fListHistCascade->Add(fHistEtaNegXi);
+ }
+ if(! fHistThetaXi ){
+ fHistThetaXi = new TH1F("fHistThetaXi", "#theta of #Xi candidates (around the mass peak); #theta (deg); Counts", 180, 0., 180.0);
+ fListHistCascade->Add(fHistThetaXi);
+ }
+ if(! fHistPhiXi ){
+ fHistPhiXi = new TH1F("fHistPhiXi", "#phi of #Xi candidates (around the mass peak); #phi (deg); Counts", 360, 0., 360.);
+ fListHistCascade->Add(fHistPhiXi);
+ }
+ if(! f2dHistArmenteros) {
+ f2dHistArmenteros = new TH2F("f2dHistArmenteros", "#alpha_{Arm}(casc. cand.) Vs Pt_{Arm}(casc. cand.); #alpha_{Arm}; Pt_{Arm} (GeV/c)", 140, -1.2, 1.2, 300, 0., 0.3);
+ fListHistCascade->Add(f2dHistArmenteros);
+ }
+ //TH2
+ if(! f2dHistEffMassLambdaVsEffMassXiMinus) {
+ f2dHistEffMassLambdaVsEffMassXiMinus = new TH2F("f2dHistEffMassLambdaVsEffMassXiMinus", "M_{#Lambda} Vs M_{#Xi^{-} candidates}; Inv. M_{#Lambda^{0}} (GeV/c^{2}); M( #Lambda , #pi^{-} ) (GeV/c^{2})", 300, 1.1, 1.13, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiMinus);
+ }
+ if(! f2dHistEffMassXiVsEffMassOmegaMinus) {
+ f2dHistEffMassXiVsEffMassOmegaMinus = new TH2F("f2dHistEffMassXiVsEffMassOmegaMinus", "M_{#Xi^{-} candidates} Vs M_{#Omega^{-} candidates}; M( #Lambda , #pi^{-} ) (GeV/c^{2}); M( #Lambda , K^{-} ) (GeV/c^{2})", 400, 1.2, 2.0, 500, 1.5, 2.5);
+ fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaMinus);
+ }
+ if(! f2dHistEffMassLambdaVsEffMassXiPlus) {
+ f2dHistEffMassLambdaVsEffMassXiPlus = new TH2F("f2dHistEffMassLambdaVsEffMassXiPlus", "M_{#Lambda} Vs M_{#Xi^{+} candidates}; Inv. M_{#Lambda^{0}} (GeV/c^{2}); M( #Lambda , #pi^{+} ) (GeV/c^{2})", 300, 1.1, 1.13, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiPlus);
+ }
+ if(! f2dHistEffMassXiVsEffMassOmegaPlus) {
+ f2dHistEffMassXiVsEffMassOmegaPlus = new TH2F("f2dHistEffMassXiVsEffMassOmegaPlus", "M_{#Xi^{+} candidates} Vs M_{#Omega^{+} candidates}; M( #Lambda , #pi^{+} ) (GeV/c^{2}); M( #Lambda , K^{+} ) (GeV/c^{2})", 400, 1.2, 2.0, 500, 1.5, 2.5);
+ fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaPlus);
+ }
+ if(! f2dHistXiRadiusVsEffMassXiMinus) {
+ f2dHistXiRadiusVsEffMassXiMinus = new TH2F("f2dHistXiRadiusVsEffMassXiMinus", "Transv. R_{Xi Decay} Vs M_{#Xi^{-} candidates}; r_{cascade} (cm); M( #Lambda , #pi^{-} ) (GeV/c^{2})", 450, 0., 45.0, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiMinus);
+ }
+ if(! f2dHistXiRadiusVsEffMassXiPlus) {
+ f2dHistXiRadiusVsEffMassXiPlus = new TH2F("f2dHistXiRadiusVsEffMassXiPlus", "Transv. R_{Xi Decay} Vs M_{#Xi^{+} candidates}; r_{cascade} (cm); M( #Lambda , #pi^{+} ) (GeV/c^{2})", 450, 0., 45.0, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiPlus);
+ }
+ if(! f2dHistXiRadiusVsEffMassOmegaMinus) {
+ f2dHistXiRadiusVsEffMassOmegaMinus = new TH2F("f2dHistXiRadiusVsEffMassOmegaMinus", "Transv. R_{Xi Decay} Vs M_{#Omega^{-} candidates}; r_{cascade} (cm); M( #Lambda , K^{-} ) (GeV/c^{2}) ", 450, 0., 45.0, 500, 1.5, 2.5);
+ fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaMinus);
+ }
+ if(! f2dHistXiRadiusVsEffMassOmegaPlus) {
+ f2dHistXiRadiusVsEffMassOmegaPlus = new TH2F("f2dHistXiRadiusVsEffMassOmegaPlus", "Transv. R_{Xi Decay} Vs M_{#Omega^{+} candidates}; r_{cascade} (cm); M( #Lambda , K^{+} ) (GeV/c^{2}) ", 450, 0., 45.0, 500, 1.5, 2.5);
+ fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaPlus);
+ }
+ if(! f2dHistTPCdEdxOfCascDghters){
+ f2dHistTPCdEdxOfCascDghters = new TH2F("f2dHistTPCdEdxOfCascDghters", "TPC dE/dx of the cascade daughters; charge x || #vec{p}_{TPC inner wall}(Casc. daughter) || (GeV/c); TPC signal (ADC)", 2000, -10.0, 10.0, 450, 0., 900.);
+ fListHistCascade->Add(f2dHistTPCdEdxOfCascDghters);
+ }
+ if(! f2dHistDcaXiDaughtersvsInvMass){
+ f2dHistDcaXiDaughtersvsInvMass = new TH2F("f2dHistDcaXiDaughtersvsInvMass", "DCA between Xi Daughters; DCA (cm); Number of Cascades", 100, 0., 0.5, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistDcaXiDaughtersvsInvMass);
+ }
+ if(! f2dHistDcaBachToPrimVertexvsInvMass) {
+ f2dHistDcaBachToPrimVertexvsInvMass = new TH2F("f2dHistDcaBachToPrimVertexvsInvMass", "DCA of Bach. to Prim. Vertex; DCA (cm); Number of Cascades", 250, 0., 0.25, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistDcaBachToPrimVertexvsInvMass);
+ }
+ if(! f2dHistXiCosineOfPointingAnglevsInvMass){
+ f2dHistXiCosineOfPointingAnglevsInvMass = new TH2F("f2dHistXiCosineOfPointingAnglevsInvMass", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Number of Xis", 200, 0.99, 1.0, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistXiCosineOfPointingAnglevsInvMass);
+ }
+ if(! f2dHistMassLambdaAsCascDghtervsInvMass){
+ f2dHistMassLambdaAsCascDghtervsInvMass = new TH2F("f2dHistMassLambdaAsCascDghtervsInvMass","#Lambda associated to Casc. candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.00, 1.3, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistMassLambdaAsCascDghtervsInvMass);
+ }
+ if(! f2dHistDcaV0DaughtersXivsInvMass){
+ f2dHistDcaV0DaughtersXivsInvMass = new TH2F("f2dHistDcaV0DaughtersXivsInvMass", "DCA between V0 daughters, in cascade; DCA (cm); Number of V0s", 120, 0., 0.6, 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistDcaV0DaughtersXivsInvMass);
+ }
+ if(! f2dHistDcaV0ToPrimVertexXivsInvMass){
+ f2dHistDcaV0ToPrimVertexXivsInvMass = new TH2F("f2dHistDcaV0ToPrimVertexXivsInvMass", "DCA of V0 to Prim. Vertex, in cascade; DCA (cm); Number of Cascades", 200, 0., 1., 400, 1.2, 2.0);
+ fListHistCascade->Add(f2dHistDcaV0ToPrimVertexXivsInvMass);
+ }
+ // - CFContainer PID study Xi minus
+ if(!fCFContCascadePIDXiMinus) {
+ const Int_t lNbSteps = 7 ;
+ const Int_t lNbVariables = 3 ;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 800;
+ lNbBinsPerVar[2] = 22;
+ if (fkSDDSelectionOn) {
+ if (fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ else if (!fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ } else if (!fkSDDSelectionOn) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDXiMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDXiMinus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass
+ fCFContCascadePIDXiMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDXiMinus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");
+ fCFContCascadePIDXiMinus->SetVarTitle(2, "Y_{#Xi}");
+ fListHistCascade->Add(fCFContCascadePIDXiMinus);
+ }
+ // - CFContainer PID study Xi plus
+ if (!fCFContCascadePIDXiPlus) {
+ const Int_t lNbSteps = 7 ;
+ const Int_t lNbVariables = 3 ;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 800;
+ lNbBinsPerVar[2] = 22;
+ if (fkSDDSelectionOn) {
+ if (fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ else if (!fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ } else if (!fkSDDSelectionOn) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDXiPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDXiPlus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass
+ fCFContCascadePIDXiPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDXiPlus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");
+ fCFContCascadePIDXiPlus->SetVarTitle(2, "Y_{#Xi}");
+ fListHistCascade->Add(fCFContCascadePIDXiPlus);
+ }
+ // - CFContainer PID study Omega minus
+ if(!fCFContCascadePIDOmegaMinus) {
+ const Int_t lNbSteps = 7 ;
+ const Int_t lNbVariables = 3 ;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 1000;
+ lNbBinsPerVar[2] = 22;
+ if (fkSDDSelectionOn) {
+ if (fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ else if (!fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ } else if (!fkSDDSelectionOn) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDOmegaMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDOmegaMinus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass
+ fCFContCascadePIDOmegaMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDOmegaMinus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");
+ fCFContCascadePIDOmegaMinus->SetVarTitle(2, "Y_{#Omega}");
+ fListHistCascade->Add(fCFContCascadePIDOmegaMinus);
+ }
+ // - CFContainer PID study Omega plus
+ if(!fCFContCascadePIDOmegaPlus) {
+ const Int_t lNbSteps = 7 ;
+ const Int_t lNbVariables = 3 ;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 1000;
+ lNbBinsPerVar[2] = 22;
+ if (fkSDDSelectionOn) {
+ if (fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ else if (!fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ } else if (!fkSDDSelectionOn) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDOmegaPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDOmegaPlus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass
+ fCFContCascadePIDOmegaPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDOmegaPlus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");
+ fCFContCascadePIDOmegaPlus->SetVarTitle(2, "Y_{#Omega}");
+ fListHistCascade->Add(fCFContCascadePIDOmegaPlus);
+ }
+ // - CFContainer: towards the optimisation of topological selections
+ if(! fCFContCascadeCuts) {
+ // Container meant to store all the relevant distributions corresponding to the cut variables.
+ // NB: overflow/underflow of variables on which we want to cut later should be 0!!!
+ const Int_t lNbSteps = 4 ;
+ const Int_t lNbVariables = 19 ;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[lNbVariables] = {0};
+ lNbBinsPerVar[0] = 25; //DcaCascDaughters : [0.0,2.4,3.0] -> Rec.Cut = 2.0;
+ lNbBinsPerVar[1] = 25; //DcaBachToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.01;
+ lNbBinsPerVar[2] = 60; //CascCosineOfPointingAngle : [0.94,1.0] -> Rec.Cut = 0.95;
+ lNbBinsPerVar[3] = 40; //CascRadius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;
+ lNbBinsPerVar[4] = 30; //InvMassLambdaAsCascDghter : [1.1,1.3] -> Rec.Cut = 0.008;
+ lNbBinsPerVar[5] = 20; //DcaV0Daughters : [0.0,2.0] -> Rec.Cut = 1.5;
+ lNbBinsPerVar[6] = 201; //V0CosineOfPointingAngleToXi : [0.89,1.0] -> No Rec.Cut;
+ lNbBinsPerVar[7] = 40; //V0Radius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;
+ lNbBinsPerVar[8] = 40; //DcaV0ToPrimVertex : [0.0,0.39,110.0] -> Rec.Cut = 0.01;
+ lNbBinsPerVar[9] = 25; //DcaPosToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.01;
+ lNbBinsPerVar[10] = 25; //DcaNegToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.01;
+ lNbBinsPerVar[11] = 150; //InvMassXi : 2-MeV/c2 bins
+ lNbBinsPerVar[12] = 120; //InvMassOmega : 2-MeV/c2 bins
+ lNbBinsPerVar[13] = 100; //XiTransvMom : [0.0,10.0]
+ lNbBinsPerVar[14] = 110; //Y(Xi) : 0.02 in rapidity units
+ lNbBinsPerVar[15] = 110; //Y(Omega) : 0.02 in rapidity units
+ lNbBinsPerVar[16] = 112; //Proper lenght of cascade
+ lNbBinsPerVar[17] = 112; //Proper lenght of V0
+ lNbBinsPerVar[18] = 112; //Distance V0-Xi in transverse plane
+ if (fkSDDSelectionOn) {
+ if (fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
+ else if (!fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
+ } else if (!fkSDDSelectionOn) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
+ //Setting the bin limits
+ //0 - DcaXiDaughters
+ Double_t *lBinLim0 = new Double_t[ lNbBinsPerVar[0] + 1 ];
+ for(Int_t i=0; i< lNbBinsPerVar[0]; i++) lBinLim0[i] = (Double_t)0.0 + (2.4 - 0.0)/(lNbBinsPerVar[0] - 1) * (Double_t)i;
+ lBinLim0[ lNbBinsPerVar[0] ] = 3.0;
+ fCFContCascadeCuts -> SetBinLimits(0, lBinLim0);
+ delete [] lBinLim0;
+ //1 - DcaToPrimVertexXi
+ Double_t *lBinLim1 = new Double_t[ lNbBinsPerVar[1] + 1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[1]; i++) lBinLim1[i] = (Double_t)0.0 + (0.24 - 0.0)/(lNbBinsPerVar[1] - 1) * (Double_t)i;
+ lBinLim1[ lNbBinsPerVar[1] ] = 100.0;
+ fCFContCascadeCuts -> SetBinLimits(1, lBinLim1);
+ delete [] lBinLim1;
+ //2 - CascCosineOfPointingAngle
+ fCFContCascadeCuts->SetBinLimits(2, 0.94, 1.);
+ //3 - CascRadius
+ Double_t *lBinLim3 = new Double_t[ lNbBinsPerVar[3]+1 ];
+ for(Int_t i=0; i< lNbBinsPerVar[3]; i++) lBinLim3[i] = (Double_t)0.0 + (3.9 - 0.0 )/(lNbBinsPerVar[3] - 1) * (Double_t)i ;
+ lBinLim3[ lNbBinsPerVar[3] ] = 1000.0;
+ fCFContCascadeCuts -> SetBinLimits(3, lBinLim3 );
+ delete [] lBinLim3;
+ //4 - InvMassLambdaAsCascDghter
+ fCFContCascadeCuts->SetBinLimits(4, 1.1, 1.13);
+ //5 - DcaV0Daughters
+ fCFContCascadeCuts -> SetBinLimits(5, 0., 2.);
+ //6 - V0CosineOfPointingAngle
+ fCFContCascadeCuts -> SetBinLimits(6, 0.8, 1.001);
+ //7 - V0Radius
+ Double_t *lBinLim7 = new Double_t[ lNbBinsPerVar[7] + 1];
+ for(Int_t i=0; i< lNbBinsPerVar[7];i++) lBinLim7[i] = (Double_t)0.0 + (3.9 - 0.0)/(lNbBinsPerVar[7] - 1) * (Double_t)i;
+ lBinLim7[ lNbBinsPerVar[7] ] = 1000.0;
+ fCFContCascadeCuts -> SetBinLimits(7, lBinLim7);
+ delete [] lBinLim7;
+ //8 - DcaV0ToPrimVertex
+ Double_t *lBinLim8 = new Double_t[ lNbBinsPerVar[8]+1 ];
+ for(Int_t i=0; i< lNbBinsPerVar[8];i++) lBinLim8[i] = (Double_t)0.0 + (0.39 - 0.0 )/(lNbBinsPerVar[8]-1) * (Double_t)i ;
+ lBinLim8[ lNbBinsPerVar[8] ] = 100.0;
+ fCFContCascadeCuts -> SetBinLimits(8, lBinLim8 );
+ delete [] lBinLim8;
+ //9 - DcaPosToPrimVertex
+ Double_t *lBinLim9 = new Double_t[ lNbBinsPerVar[9]+1 ];
+ for(Int_t i=0; i< lNbBinsPerVar[9];i++) lBinLim9[i] = (Double_t)0.0 + (0.24 - 0.0 )/(lNbBinsPerVar[9]-1) * (Double_t)i ;
+ lBinLim9[ lNbBinsPerVar[9] ] = 100.0;
+ fCFContCascadeCuts -> SetBinLimits(9, lBinLim9 );
+ delete [] lBinLim9;
+ //10 - DcaNegToPrimVertex
+ Double_t *lBinLim10 = new Double_t[ lNbBinsPerVar[10]+1 ];
+ for(Int_t i=0; i< lNbBinsPerVar[10];i++) lBinLim10[i] = (Double_t)0.0 + (0.24 - 0.0 )/(lNbBinsPerVar[10]-1) * (Double_t)i ;
+ lBinLim10[ lNbBinsPerVar[10] ] = 100.0;
+ fCFContCascadeCuts -> SetBinLimits(10, lBinLim10 ); // DcaPosToPrimVertexXi : 0.0 to 0.25
+ delete [] lBinLim10;
+ //11 - InvMassXi
+ fCFContCascadeCuts->SetBinLimits(11, 1.25, 1.40);
+ //12 - InvMassOmega
+ fCFContCascadeCuts->SetBinLimits(12, 1.62, 1.74);
+ //13 - XiTransvMom
+ fCFContCascadeCuts->SetBinLimits(13, 0.0, 10.0);
+ //14 - Y(Xi)
+ fCFContCascadeCuts->SetBinLimits(14, -1.1, 1.1);
+ //15 - Y(Omega)
+ fCFContCascadeCuts->SetBinLimits(15, -1.1, 1.1);
+ //16 - Proper time of cascade
+ Double_t *lBinLim16 = new Double_t[ lNbBinsPerVar[16]+1 ];
+ for(Int_t i=0; i< lNbBinsPerVar[16];i++) lBinLim16[i] = (Double_t) -1. + (110. + 1.0 ) / (lNbBinsPerVar[16] - 1) * (Double_t) i;
+ lBinLim16[ lNbBinsPerVar[16] ] = 2000.0;
+ fCFContCascadeCuts->SetBinLimits(16, lBinLim16);
+ //17 - Proper time of V0
+ fCFContCascadeCuts->SetBinLimits(17, lBinLim16);
+ //18 - Distance V0-Xi in transverse plane
+ fCFContCascadeCuts->SetBinLimits(18, lBinLim16);
+ // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)
+ fCFContCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates");
+ fCFContCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates");
+ fCFContCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates");
+ fCFContCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates");
+ // Setting the variable title, per axis
+ fCFContCascadeCuts->SetVarTitle(0, "Dca(cascade daughters) (cm)");
+ fCFContCascadeCuts->SetVarTitle(1, "ImpactParamToPV(bachelor) (cm)");
+ fCFContCascadeCuts->SetVarTitle(2, "cos(cascade PA)");
+ fCFContCascadeCuts->SetVarTitle(3, "R_{2d}(cascade decay) (cm)");
+ fCFContCascadeCuts->SetVarTitle(4, "M_{#Lambda}(as casc dghter) (GeV/c^{2})");
+ fCFContCascadeCuts->SetVarTitle(5, "Dca(V0 daughters) in Xi (cm)");
+ fCFContCascadeCuts->SetVarTitle(6, "cos(V0 PA) to cascade vtx");
+ fCFContCascadeCuts->SetVarTitle(7, "R_{2d}(V0 decay) (cm)");
+ fCFContCascadeCuts->SetVarTitle(8, "ImpactParamToPV(V0) (cm)");
+ fCFContCascadeCuts->SetVarTitle(9, "ImpactParamToPV(Pos) (cm)");
+ fCFContCascadeCuts->SetVarTitle(10, "ImpactParamToPV(Neg) (cm)");
+ fCFContCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");
+ fCFContCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");
+ fCFContCascadeCuts->SetVarTitle(13, "pt(cascade) (GeV/c)");
+ fCFContCascadeCuts->SetVarTitle(14, "Y(Xi)");
+ fCFContCascadeCuts->SetVarTitle(15, "Y(Omega)");
+ fCFContCascadeCuts->SetVarTitle(16, "mL/p (cascade) (cm)");
+ fCFContCascadeCuts->SetVarTitle(17, "mL/p (V0) (cm)");
+ fCFContCascadeCuts->SetVarTitle(18, "Distance V0-Cascade in transverse plane (cm)");
+ fListHistCascade->Add(fCFContCascadeCuts);
+ }
+
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+} // end UserCreateOutputObjects
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCheckCascadepp276::UserExec(Option_t *) {
+
+ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ // Main loop (called for each event)
+ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ //----------------
+ //Define variables
+ AliESDEvent *lESDevent = 0x0;
+ AliAODEvent *lAODevent = 0x0;
+
+ //---------------------
+ //Check the PIDresponse
+ if(!fPIDResponse) {
+ AliError("Cannot get pid response");
+ return;
+ }
+
+ ///////////////////
+ // EVENT SELECTIONS
+ ///////////////////
+ // In order:
+ // 1) SDD selection
+ // 2) Physics selection
+ // 3) Select only looking at events with well-established PV
+ // 4) Pileup selection
+ // 5) |Z| < 10 cm
+
+ //----------------------
+ // Before any selections
+ //----------------------
+ //- Define the variables
+ Int_t ncascadesBeforeAnySel = 0;
+ Int_t nTrackMultiplicityBeforeAnySel = 0;
+ if (fAnalysisType == "ESD") {
+ // - Load the InputEvent and check
+ lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
+ if (!lESDevent) {
+ AliWarning("ERROR: lESDevent not available \n");
+ return;
+ }
+ // - Take the number of cascades and tracks before any events selection
+ ncascadesBeforeAnySel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityBeforeAnySel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ // - Load the InputEvent and check
+ lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() );
+ if (!lAODevent) {
+ AliWarning("ERROR: lAODevent not available \n");
+ return;
+ }
+ // - Take the number of cascades and tracks before any events selection
+ ncascadesBeforeAnySel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityBeforeAnySel = -100; //FIXME: I can't find the equivalent method for the AOD
+ } else {
+ Printf("Analysis type (ESD or AOD) not specified \n");
+ return;
+ }
+ // - Fill the plots
+ fHistCascadeMultiplicityBeforeAnySel->Fill(ncascadesBeforeAnySel);
+ fHistTrackMultiplicityBeforeAnySel->Fill(nTrackMultiplicityBeforeAnySel);
+
+ //--------------
+ // SDD selection
+ //--------------
+ // - Define the variables
+ Int_t ncascadesAfterSDDSel = 0;
+ Int_t nTrackMultiplicityAfterSDDSel = 0;
+ // - Selection for ESD and AOD
+ if (fAnalysisType == "ESD") {
+ if (fkSDDSelectionOn) {
+ TString trcl = lESDevent->GetFiredTriggerClasses();
+ //cout<<"Fired Trigger Classes: "<<trcl<<endl;
+ if (fwithSDD){
+ if(!(trcl.Contains("ALLNOTRD"))) {
+ cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. => RETURN!! (Exclude it)..."<<endl;
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ } else if (!fwithSDD){
+ if((trcl.Contains("ALLNOTRD"))) {
+ cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. => RETURN!! (Exclude it)..."<<endl;
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ }
+ // - Take the number of cascades and tracks after the SDD selection
+ ncascadesAfterSDDSel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterSDDSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ if (fkSDDSelectionOn) {
+ TString trcl = lAODevent->GetFiredTriggerClasses();
+ if (fwithSDD){
+ if(!(trcl.Contains("ALLNOTRD"))) {
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. => RETURN!! (Exclude it)..."<<endl;
+ return;
+ }
+ } else if (!fwithSDD) {
+ if((trcl.Contains("ALLNOTRD"))) {
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. => RETURN!! (Exclude it)..."<<endl;
+ return;
+ }
+ }
+ }
+ // - Take the number of cascades and tracks after the SDD selection
+ ncascadesAfterSDDSel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterSDDSel = -100; //FIXME: I can't find the equivalent method for the AOD
+ }
+ // - Fill the plots
+ fHistCascadeMultiplicityAfterSDDSel->Fill(ncascadesAfterSDDSel);
+ fHistTrackMultiplicityAfterSDDSel->Fill(nTrackMultiplicityAfterSDDSel);
+
+ //----------------------------------------------
+ // Physics selection (+ re-vertexer for the ESD)
+ //----------------------------------------------
+ // - Define the variables
+ Int_t ncascadesAfterPhysicsSel = 0;
+ Int_t nTrackMultiplicityAfterPhysicsSel = 0;
+ // - Selection for ESD and AOD
+ if (fAnalysisType == "ESD") {
+ UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+ Bool_t isSelected = 0;
+ isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
+ if(! isSelected){
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. => RETURN!! (Exclude it)..."<<endl;
+ return;
+ }
+ // - Take the number of cascades and tracks after physics selection
+ ncascadesAfterPhysicsSel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterPhysicsSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ // - Cascade vertexer (ESD)
+ // Relaunch V0 and Cascade vertexers
+ if (fkRerunV0CascVertexers) {
+ lESDevent->ResetCascades();
+ lESDevent->ResetV0s();
+ AliV0vertexer *lV0vtxer = new AliV0vertexer();
+ AliCascadeVertexer *lCascVtxer = new AliCascadeVertexer();
+ //lV0vtxer->GetCuts(fV0Sels);
+ //lCascVtxer->GetCuts(fCascSels);
+ lV0vtxer->SetCuts(fV0Sels); // NB don't use SetDefaultCuts!! because it acts on static variables
+ lCascVtxer->SetCuts(fCascSels);
+ lV0vtxer->Tracks2V0vertices(lESDevent);
+ lCascVtxer->V0sTracks2CascadeVertices(lESDevent);
+ //delete lV0vtxer;
+ //delete lCascVtxer;
+ }
+ } else if (fAnalysisType == "AOD") {
+ UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+ Bool_t isSelected = 0;
+ isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
+ if(! isSelected){
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. => RETURN!! (Exclude it)..."<<endl;
+ return;
+ }
+ // - Take the number of cascades and tracks after the physics selection
+ ncascadesAfterPhysicsSel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterPhysicsSel = -100; //FIXME: I can't find the equivalent method for the AOD
+ }
+ // - Fill the plots
+ fHistCascadeMultiplicityAfterPhysicsSel->Fill(ncascadesAfterPhysicsSel);
+ fHistTrackMultiplicityAfterPhysicsSel->Fill(nTrackMultiplicityAfterPhysicsSel);
+
+ //------------------------------
+ // Well-established PV selection
+ //------------------------------
+ // - Define variables
+ Int_t ncascadesForSelEvtNoTPCOnly = 0;
+ Int_t nTrackMultiplicityForSelEvtNoTPCOnly = 0;
+ // - Selection for ESD and AOD
+ if (fAnalysisType == "ESD") {
+ // - Vertex coordinates: get the PVs stored in the ESD found with tracks and SPD
+ const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
+ const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
+ // - Select only looking at events with well-established PV
+ if (fkQualityCutNoTPConlyPrimVtx) {
+ if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() ){
+ AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after TPConly selection
+ ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ // - Vertex coordinates: get the PVs stored in the AOD found with tracks and SPD
+ const AliAODVertex *lPrimarySPDVtx = lAODevent->GetPrimaryVertexSPD();
+ const AliAODVertex *lPrimaryTrackingAODVtx = lAODevent->GetPrimaryVertex();
+ // - Select only looking at events with well-established PV
+ if (fkQualityCutNoTPConlyPrimVtx) {
+ if (!lPrimarySPDVtx && !lPrimaryTrackingAODVtx) {
+ AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after TPConly selection
+ ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnly = -100; //FIXME: I can't find the equivalent method for the AOD
+ }
+ // - Fill the plots
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly->Fill(ncascadesForSelEvtNoTPCOnly);
+ fHistTrackMultiplicityForSelEvtNoTPCOnly->Fill(nTrackMultiplicityForSelEvtNoTPCOnly);
+
+ //----------------
+ // Pilup selection
+ //----------------
+ // - Define variables
+ Int_t ncascadesForSelEvtNoTPCOnlyNoPileup = 0;
+ Int_t nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = 0;
+ // - Selection for ESD and AOD
+ if (fAnalysisType == "ESD") {
+ if (fkQualityCutPileup) {
+ if(lESDevent->IsPileupFromSPD()){
+ AliWarning("Pb / Pile-up event ... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after Pileup selection
+ ncascadesForSelEvtNoTPCOnlyNoPileup = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ if (fkQualityCutPileup) {
+ if(lAODevent->IsPileupFromSPD()){
+ AliWarning("Pb / Pile-up event ... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after Pileup selection
+ ncascadesForSelEvtNoTPCOnlyNoPileup = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -100; //FIXME: I can't find the equivalent method for the AOD
+ }
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(ncascadesForSelEvtNoTPCOnlyNoPileup);
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
+
+ //----------------------------------------------------
+ // Vertex Z position selection (+ magnetic field info)
+ //----------------------------------------------------
+ // - Define variables
+ Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};
+ Double_t lMagneticField = -10.;
+ Double_t tPrimaryVtxPosition[3] = {-100.0, -100.0, -100.0};
+ Int_t ncascadesAfterVertexSel = 0;
+ Int_t nTrackMultiplicityAfterVertexSel = 0;
+ // - Selection for ESD and AOD
+ if (fAnalysisType == "ESD") {
+ // - Vertex coordinates: get the best primary vertex available for the event
+ const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex();
+ if (!lPrimaryBestESDVtx){
+ AliWarning("No prim. vertex in ESD... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
+ // - Fill the vertex plots before any event selection on vertex position
+ const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ fHistPVx->Fill( tPrimaryVtxPosition[0] );
+ fHistPVy->Fill( tPrimaryVtxPosition[1] );
+ fHistPVz->Fill( tPrimaryVtxPosition[2] );
+ // - Get magnetic filed info
+ lMagneticField = lESDevent->GetMagneticField();
+ //if(TMath::Abs(lMagneticField ) < 10e-6) continue;
+ // - Selection on the primary vertex Z position
+ if (fkQualityCutZprimVtxPos) {
+ if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
+ AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after vertex Z position selection
+ ncascadesAfterVertexSel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterVertexSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ // - Vertex coordinates: get the best primary vertex available for the event
+ const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex();
+ if (!lPrimaryBestAODVtx){
+ AliWarning("No prim. vertex in AOD... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );
+ // - Fill the vertex plots before any event selection on vertex position
+ const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ fHistPVx->Fill( tPrimaryVtxPosition[0] );
+ fHistPVy->Fill( tPrimaryVtxPosition[1] );
+ fHistPVz->Fill( tPrimaryVtxPosition[2] );
+ // - Get magnetic filed info
+ lMagneticField = lAODevent->GetMagneticField();
+ //if(TMath::Abs(lMagneticField ) < 10e-6) continue;
+ // - Selection on the primary vertex Z position
+ if (fkQualityCutZprimVtxPos) {
+ if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
+ AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after vertex Z position selection
+ ncascadesAfterVertexSel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterVertexSel = -100; //FIXME: I can't find the equivalent method for the AOD
+ }
+ // - Fill the plots
+ fHistCascadeMultiplicityAfterVertexCutSel->Fill(ncascadesAfterVertexSel);
+ fHistTrackMultiplicityAfterVertexCutSel->Fill(nTrackMultiplicityAfterVertexSel);
+
+ // - Vertex position plots: after any event selections
+ tPrimaryVtxPosition[0] = -100.0;
+ tPrimaryVtxPosition[1] = -100.0;
+ tPrimaryVtxPosition[2] = -100.0;
+ if (fAnalysisType == "ESD") {
+ const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ } else if (fAnalysisType == "AOD") {
+ const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ }
+ fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] );
+ fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] );
+ fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] );
+
+
+
+ //////////////////////////////
+ // CASCADE RECONSTRUCTION PART
+ //////////////////////////////
+
+ //%%%%%%%%%%%%%
+ // Cascade loop
+ Int_t ncascades = 0;
+ if (fAnalysisType == "ESD") ncascades = lESDevent->GetNumberOfCascades();
+ else if (fAnalysisType == "AOD") ncascades = lAODevent->GetNumberOfCascades();
+
+ for (Int_t iXi = 0; iXi < ncascades; iXi++) {// This is the begining of the Cascade loop (ESD or AOD)
+
+ // -----------------------------------------------------------------------
+ // - Initialisation of the local variables that will be needed for ESD/AOD
+
+ // - 0th part of initialisation : around primary vertex ...
+ //Double_t lBestPrimaryVtxRadius3D = -500.0;
+ // - 1st part of initialisation : variables needed to store AliESDCascade data members
+ Double_t lEffMassXi = 0.;
+ Double_t lDcaXiDaughters = -1.;
+ Double_t lXiCosineOfPointingAngle = -1.;
+ Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
+ Double_t lXiRadius = -1000. ;
+ // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
+ UShort_t lPosTPCClusters = -1; // For ESD only ...
+ UShort_t lNegTPCClusters = -1; // For ESD only ...
+ UShort_t lBachTPCClusters = -1; // For ESD only ...
+ Double_t lInnerWallMomCascDghters[3] = {-100., -100., -100.};
+ Double_t lTPCSignalCascDghters [3] = {-100., -100., -100.};
+ // - 3rd part of initialisation : about V0 part in cascades
+ Double_t lInvMassLambdaAsCascDghter = 0.;
+ Double_t lDcaV0DaughtersXi = -1.;
+ Double_t lDcaBachToPrimVertexXi = -1.;
+ Double_t lDcaV0ToPrimVertexXi = -1.;
+ Double_t lDcaPosToPrimVertexXi = -1.;
+ Double_t lDcaNegToPrimVertexXi = -1.;
+ Double_t lV0CosineOfPointingAngleXi = -1. ;
+ Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
+ Double_t lV0RadiusXi = -1000.0;
+ Double_t lV0quality = 0.;
+ // - 4th part of initialisation : Effective masses
+ Double_t lInvMassXiMinus = 0.;
+ Double_t lInvMassXiPlus = 0.;
+ Double_t lInvMassOmegaMinus = 0.;
+ Double_t lInvMassOmegaPlus = 0.;
+ // - 5th part of initialisation : PID treatment
+ Bool_t lIsPosInXiProton = kFALSE;
+ Bool_t lIsPosInXiPion = kFALSE;
+ Bool_t lIsPosInOmegaProton = kFALSE;
+ Bool_t lIsPosInOmegaPion = kFALSE;
+ Bool_t lIsNegInXiProton = kFALSE;
+ Bool_t lIsNegInXiPion = kFALSE;
+ Bool_t lIsNegInOmegaProton = kFALSE;
+ Bool_t lIsNegInOmegaPion = kFALSE;
+ Bool_t lIsBachelorKaon = kFALSE;
+ Bool_t lIsBachelorPion = kFALSE;
+ Bool_t lIsBachelorKaonForTPC = kFALSE;
+ Bool_t lIsBachelorPionForTPC = kFALSE;
+ Bool_t lIsNegPionForTPC = kFALSE;
+ Bool_t lIsPosPionForTPC = kFALSE;
+ Bool_t lIsNegProtonForTPC = kFALSE;
+ Bool_t lIsPosProtonForTPC = kFALSE;
+ // - 6th part of initialisation : extra info for QA
+ Double_t lXiMomX = 0.;
+ Double_t lXiMomY = 0.;
+ Double_t lXiMomZ = 0.;
+ Double_t lXiTransvMom = 0.;
+ Double_t lXiTotMom = 0.;
+ Double_t lV0PMomX = 0.;
+ Double_t lV0PMomY = 0.;
+ Double_t lV0PMomZ = 0.;
+ Double_t lV0NMomX = 0.;
+ Double_t lV0NMomY = 0.;
+ Double_t lV0NMomZ = 0.;
+ Double_t lV0TotMom = 0.;
+ Double_t lBachMomX = 0.;
+ Double_t lBachMomY = 0.;
+ Double_t lBachMomZ = 0.;
+ Double_t lBachTransvMom = 0.;
+ Double_t lBachTotMom = 0.;
+ Double_t lpTrackTransvMom = 0.;
+ Double_t lnTrackTransvMom = 0.;
+ Short_t lChargeXi = -2;
+ Double_t lV0toXiCosineOfPointingAngle = 0.;
+ Double_t lRapXi = -20.0, lRapOmega = -20.0, lEta = -20.0, lTheta = 360., lPhi = 720.;
+ Double_t lAlphaXi = -200., lPtArmXi = -200.0;
+ Double_t etaPos = 0., etaNeg = 0., etaBach = 0.;
+
+ if (fAnalysisType == "ESD") {
+
+ // -------------------------------------
+ // - Load the cascades from the handler
+ AliESDcascade *xi = lESDevent->GetCascade(iXi);
+ if (!xi) continue;
+
+ //----------------------------------------------------------------------------
+ // - Assigning the necessary variables for specific AliESDcascade data members
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis: cascade = Xi-decay
+ lEffMassXi = xi->GetEffMassXi();
+ lDcaXiDaughters = xi->GetDcaXiDaughters();
+ lXiCosineOfPointingAngle = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
+ //Take care : the best available vertex should be used (like in AliCascadeVertexer)
+ xi->GetXYZcascade( lPosXi[0], lPosXi[1], lPosXi[2] );
+ lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
+
+ //-------------------------------------------------------------------------------------------------------------------------------
+ // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
+ UInt_t lIdxPosXi = (UInt_t) TMath::Abs( xi->GetPindex() );
+ UInt_t lIdxNegXi = (UInt_t) TMath::Abs( xi->GetNindex() );
+ UInt_t lBachIdx = (UInt_t) TMath::Abs( xi->GetBindex() );
+ //Care track label can be negative in MC production (linked with the track quality)
+ //However = normally, not the case for track index ...
+ // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
+ if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }
+ if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }
+ // - Get the track for the daughters
+ AliESDtrack *pTrackXi = lESDevent->GetTrack( lIdxPosXi );
+ AliESDtrack *nTrackXi = lESDevent->GetTrack( lIdxNegXi );
+ AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );
+ if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
+ AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
+ continue;
+ }
+ // - Get the TPCnumber of cluster for the daughters
+ lPosTPCClusters = pTrackXi->GetTPCNcls();
+ lNegTPCClusters = nTrackXi->GetTPCNcls();
+ lBachTPCClusters = bachTrackXi->GetTPCNcls();
+
+ //-------------------------------------
+ // - Rejection of a poor quality tracks
+ if (fkQualityCutTPCrefit) {
+ // - Poor quality related to TPCrefit
+ ULong_t pStatus = pTrackXi->GetStatus();
+ ULong_t nStatus = nTrackXi->GetStatus();
+ ULong_t bachStatus = bachTrackXi->GetStatus();
+ if ((pStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
+ if ((nStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
+ if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }
+ }
+ if (fkQualityCutnTPCcls) {
+ // - Poor quality related to TPC clusters
+ if (lPosTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }
+ if (lNegTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }
+ if (lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!"); continue; }
+ }
+
+ //-----------------------------------
+ const AliExternalTrackParam *pExtTrack = pTrackXi->GetInnerParam();
+ const AliExternalTrackParam *nExtTrack = nTrackXi->GetInnerParam();
+ const AliExternalTrackParam *bachExtTrack = bachTrackXi->GetInnerParam();
+ if (pExtTrack) {
+ lInnerWallMomCascDghters[0] = pExtTrack->GetP() * pExtTrack->Charge();
+ lTPCSignalCascDghters [0] = pTrackXi->GetTPCsignal();
+ }
+ if (nExtTrack) {
+ lInnerWallMomCascDghters[1] = nExtTrack->GetP() * nExtTrack->Charge();
+ lTPCSignalCascDghters [1] = nTrackXi->GetTPCsignal();
+ }
+ if (bachExtTrack) {
+ lInnerWallMomCascDghters[2] = bachExtTrack->GetP() * bachExtTrack->Charge();
+ lTPCSignalCascDghters [2] = bachTrackXi->GetTPCsignal();
+ }
+ etaPos = pTrackXi->Eta();
+ etaNeg = nTrackXi->Eta();
+ etaBach = bachTrackXi->Eta();
+ lInvMassLambdaAsCascDghter = xi->GetEffMass(); //This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
+ lDcaV0DaughtersXi = xi->GetDcaV0Daughters();
+ lV0CosineOfPointingAngleXi = xi->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],
+ lBestPrimaryVtxPos[1],
+ lBestPrimaryVtxPos[2] );
+ lDcaV0ToPrimVertexXi = xi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
+ lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); //Note: AliExternalTrackParam::GetD returns an algebraic value ...
+ xi->GetXYZ( lPosV0Xi[0], lPosV0Xi[1], lPosV0Xi[2] );
+ lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
+ lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) );
+ lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) );
+
+ //-----------------------------------------
+ // - Extra-selection for cascade candidates
+ if (fkExtraSelections) { //in AliCascadeVertexer
+ if (lDcaXiDaughters > 0.3) continue;
+ if (lXiCosineOfPointingAngle < 0.999 ) continue;
+ if (lDcaV0ToPrimVertexXi < 0.05) continue;
+ if (lDcaBachToPrimVertexXi < 0.03) continue;
+ //if (TMath::Abs(lInvMassLambdaAsCascDghter-1.11568) > 0.006 ) continue;
+ if (lDcaV0DaughtersXi > 1.) continue;
+ if (lV0CosineOfPointingAngleXi < 0.998) continue;
+ if (lDcaPosToPrimVertexXi < 0.1) continue;
+ if (lDcaNegToPrimVertexXi < 0.1) continue;
+ if (lXiRadius < .9) continue;
+ //if (lXiRadius > 100) continue;
+ if (lV0RadiusXi < 0.9) continue;
+ //if (lV0RadiusXi > 100) continue;
+ }
+
+ //----------------------------------------------------------------------------------------------------
+ // - Around effective masses. Change mass hypotheses to cover all the possibilities: Xi-/+, Omega -/+
+ if ( bachTrackXi->Charge() < 0 ) {
+ //Calculate the effective mass of the Xi- candidate: Xi- hyp. (pdg code 3312)
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , 3312);
+ lInvMassXiMinus = xi->GetEffMassXi();
+ //Calculate the effective mass of the Xi- candidate: Omega- hyp. (pdg code 3334)
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , 3334);
+ lInvMassOmegaMinus = xi->GetEffMassXi();
+ //Back to "default" hyp. (Xi-)
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , 3312);
+ } // end if negative bachelor
+ if ( bachTrackXi->Charge() > 0 ) {
+ //Calculate the effective mass of the Xi- candidate: Xi+ hyp. (pdg code -3312)
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , -3312);
+ lInvMassXiPlus = xi->GetEffMassXi();
+ //Calculate the effective mass of the Xi- candidate: Omega+ hyp. (pdg code -3334)
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , -3334);
+ lInvMassOmegaPlus = xi->GetEffMassXi();
+ //Back to "default" hyp. (Xi-)
+ lV0quality = 0.;
+ xi->ChangeMassHypothesis(lV0quality , -3312);
+ } // end if positive bachelor
+
+ //--------------------------------
+ // - PID on the daughter tracks
+ // - Combined PID -> removed, add when will be used
+
+ // - TPC PID : 3-sigma bands on Bethe-Bloch curve
+ //Bachelor
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
+ //Negative V0 daughter
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
+ //Positive V0 daughter
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
+ /*
+ const AliExternalTrackParam *pInnerWallTrackXi = pTrackXi ->GetInnerParam();
+ const AliExternalTrackParam *nInnerWallTrackXi = nTrackXi ->GetInnerParam();
+ const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
+ if (pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ) {
+ Double_t pMomInnerWall = pInnerWallTrackXi ->GetP();
+ Double_t nMomInnerWall = nInnerWallTrackXi ->GetP();
+ Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
+ //Bachelor
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3) lIsBachelorPionForTPC = kTRUE;
+ if (bachMomInnerWall < 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
+ if (bachMomInnerWall > 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;
+ //Negative V0 daughter
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 3 ) lIsNegPionForTPC = kTRUE;
+ if (nMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 ) lIsNegProtonForTPC = kTRUE;
+ if (nMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 ) lIsNegProtonForTPC = kTRUE;
+ //Positive V0 daughter
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 3 ) lIsPosPionForTPC = kTRUE;
+ if (pMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5) lIsPosProtonForTPC = kTRUE;
+ if (pMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3) lIsPosProtonForTPC = kTRUE;
+ }*/
+
+ //---------------------------------
+ // - Extra info for QA (ESD)
+ // Miscellaneous pieces of info that may help regarding data quality assessment.
+ // Cascade transverse and total momentum
+ xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
+ lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
+ lXiTotMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
+ // V0 total momentum
+ xi->GetNPxPyPz(lV0NMomX,lV0NMomY,lV0NMomZ);
+ xi->GetPPxPyPz(lV0PMomX,lV0PMomY,lV0PMomZ);
+ lV0TotMom = TMath::Sqrt(TMath::Power(lV0NMomX+lV0PMomX,2) + TMath::Power(lV0NMomY+lV0PMomY,2) + TMath::Power(lV0NMomZ+lV0PMomZ,2));
+ // Bachelor total momentum
+ xi->GetBPxPyPz( lBachMomX, lBachMomY, lBachMomZ );
+ lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
+ lBachTotMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
+ lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX + lV0NMomY*lV0NMomY );
+ lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX + lV0PMomY*lV0PMomY );
+ lChargeXi = xi->Charge();
+ lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
+ lRapXi = xi->RapXi();
+ lRapOmega = xi->RapOmega();
+ lEta = xi->Eta();
+ lTheta = xi->Theta()*180.0/TMath::Pi();
+ lPhi = xi->Phi()*180.0/TMath::Pi();
+ lAlphaXi = xi->AlphaXi();
+ lPtArmXi = xi->PtArmXi();
+ // Extra-cut = Anti-splitting cut for lambda daughters
+ Bool_t kAntiSplittingLambda = kFALSE;
+ if (kAntiSplittingLambda) { // not used
+ Double_t lNMomX = 0., lNMomY = 0., lNMomZ = 0.;
+ Double_t lPMomX = 0., lPMomY = 0., lPMomZ = 0.;
+ xi->GetPPxPyPz(lPMomX, lPMomY, lPMomZ);
+ xi->GetNPxPyPz(lNMomX, lNMomY, lNMomZ);
+ if ( xi->Charge() < 0) {// Xi- or Omega-
+ if (TMath::Abs(lBachTransvMom - TMath::Sqrt( lNMomX*lNMomX + lNMomY*lNMomY ) ) < 0.075) continue;
+ } else { //Xi+ or Omega+
+ if(TMath::Abs(lBachTransvMom - TMath::Sqrt( lPMomX*lPMomX + lPMomY*lPMomY ) ) < 0.075) continue;
+ }
+ }
+
+ } // end of ESD treatment
+
+ else if (fAnalysisType == "AOD") {
+
+ // -------------------------------------
+ // - Load the cascades from the handler
+ const AliAODcascade *xi = lAODevent->GetCascade(iXi);
+ if (!xi) continue;
+
+ //----------------------------------------------------------------------------
+ // - Assigning the necessary variables for specific AliESDcascade data members
+ lEffMassXi = xi->MassXi(); // default working hypothesis : cascade = Xi- decay
+ lDcaXiDaughters = xi->DcaXiDaughters();
+ lXiCosineOfPointingAngle = xi->CosPointingAngleXi( lBestPrimaryVtxPos[0],
+ lBestPrimaryVtxPos[1],
+ lBestPrimaryVtxPos[2] );
+ lPosXi[0] = xi->DecayVertexXiX();
+ lPosXi[1] = xi->DecayVertexXiY();
+ lPosXi[2] = xi->DecayVertexXiZ();
+ lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
+
+ //-------------------------------------------------------------------------------------------------------------------------------
+ // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
+ AliAODTrack *pTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );
+ AliAODTrack *nTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );
+ AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );
+ if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
+ AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");
+ continue;
+ }
+ UInt_t lIdxPosXi = (UInt_t) TMath::Abs( pTrackXi->GetID() );
+ UInt_t lIdxNegXi = (UInt_t) TMath::Abs( nTrackXi->GetID() );
+ UInt_t lBachIdx = (UInt_t) TMath::Abs( bachTrackXi->GetID() );
+ // Care track label can be negative in MC production (linked with the track quality)
+ // However = normally, not the case for track index ...
+ // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
+ if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }
+ if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }
+ // - Get the TPCnumber of cluster for the daughters
+ lPosTPCClusters = pTrackXi->GetTPCNcls(); // FIXME: Is this ok? or something like in LambdaK0PbPb task AOD?
+ lNegTPCClusters = nTrackXi->GetTPCNcls();
+ lBachTPCClusters = bachTrackXi->GetTPCNcls();
+
+ //-------------------------------------
+ // - Rejection of a poor quality tracks
+ if (fkQualityCutTPCrefit) {
+ // - Poor quality related to TPCrefit
+ if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
+ if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
+ if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }
+ }
+ if (fkQualityCutnTPCcls) {
+ // - Poor quality related to TPC clusters
+ if (lPosTPCClusters < fMinnTPCcls) { //AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!");
+ continue; }
+ if (lNegTPCClusters < fMinnTPCcls) { //AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!");
+ continue; }
+ if (lBachTPCClusters < fMinnTPCcls) { //AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!");
+ continue; }
+ }
+
+ //---------------------------------------
+ // - Around the tracks: Bach + V0 (AOD). Necessary variables for AODcascade data members coming from the AODv0 part (inheritance)
+ etaPos = pTrackXi->Eta();
+ etaNeg = nTrackXi->Eta();
+ etaBach = bachTrackXi->Eta();
+ lChargeXi = xi->ChargeXi();
+ if ( lChargeXi < 0) lInvMassLambdaAsCascDghter = xi->MassLambda();
+ else lInvMassLambdaAsCascDghter = xi->MassAntiLambda();
+ lDcaV0DaughtersXi = xi->DcaV0Daughters();
+ lDcaV0ToPrimVertexXi = xi->DcaV0ToPrimVertex();
+ lDcaBachToPrimVertexXi = xi->DcaBachToPrimVertex();
+ lPosV0Xi[0] = xi->DecayVertexV0X();
+ lPosV0Xi[1] = xi->DecayVertexV0Y();
+ lPosV0Xi[2] = xi->DecayVertexV0Z();
+ lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
+ lV0CosineOfPointingAngleXi = xi->CosPointingAngle( lBestPrimaryVtxPos );
+ lDcaPosToPrimVertexXi = xi->DcaPosToPrimVertex();
+ lDcaNegToPrimVertexXi = xi->DcaNegToPrimVertex();
+
+ //----------------------------------------------------------------------------------------------------
+ // - Around effective masses. Change mass hypotheses to cover all the possibilities: Xi-/+, Omega -/+
+ if ( lChargeXi < 0 ) lInvMassXiMinus = xi->MassXi();
+ if ( lChargeXi > 0 ) lInvMassXiPlus = xi->MassXi();
+ if ( lChargeXi < 0 ) lInvMassOmegaMinus = xi->MassOmega();
+ if ( lChargeXi > 0 ) lInvMassOmegaPlus = xi->MassOmega();
+
+ //--------------------------------
+ // - PID on the daughter tracks
+ // - Combined PID -> removed, add when will be used
+
+ // - TPC PID : 3-sigma bands on Bethe-Bloch curve
+ //Bachelor
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
+ //Negative V0 daughter
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
+ //Positive V0 daughter
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;
+ if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
+
+ //---------------------------------
+ // - Extra info for QA (AOD)
+ // Miscellaneous pieces of info that may help regarding data quality assessment.
+ // Cascade transverse and total momentum
+ lXiMomX = xi->MomXiX();
+ lXiMomY = xi->MomXiY();
+ lXiMomZ = xi->MomXiZ();
+ lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
+ lXiTotMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
+ Double_t lV0MomX = xi->MomV0X();
+ Double_t lV0MomY = xi->MomV0Y();
+ Double_t lV0MomZ = xi->MomV0Z();
+ lV0TotMom = TMath::Sqrt(TMath::Power(lV0MomX,2)+TMath::Power(lV0MomY,2)+TMath::Power(lV0MomZ,2));
+ lBachMomX = xi->MomBachX();
+ lBachMomY = xi->MomBachY();
+ lBachMomZ = xi->MomBachZ();
+ lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
+ lBachTotMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
+ lV0NMomX = xi->MomNegX();
+ lV0NMomY = xi->MomNegY();
+ lV0PMomX = xi->MomPosX();
+ lV0PMomY = xi->MomPosY();
+ lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX + lV0NMomY*lV0NMomY );
+ lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX + lV0PMomY*lV0PMomY );
+ lV0toXiCosineOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );
+ lRapXi = xi->RapXi();
+ lRapOmega = xi->RapOmega();
+ lEta = xi->Eta(); // Will not work ! need a method Pz(), Py() Px()
+ lTheta = xi->Theta() *180.0/TMath::Pi(); // in AODcascade.
+ lPhi = xi->Phi() *180.0/TMath::Pi(); // Here, we will get eta, theta, phi for the V0 ...
+ lAlphaXi = xi->AlphaXi();
+ lPtArmXi = xi->PtArmXi();
+
+ } // end of AOD treatment
+
+ // Cut on pt of the three daughter tracks
+ if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;
+ if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
+ if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
+
+ // Cut on pseudorapidity of the three daughter tracks
+ if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;
+ if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;
+ if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;
+
+
+ //----------------------------------
+ // Calculate proper lenght for cascade
+ Double_t cascadeMass = 0.;
+ if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
+ ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) ) cascadeMass = 1.321;
+ if ( ( (lChargeXi<0) && lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
+ ( (lChargeXi>0) && lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) ) cascadeMass = 1.672;
+ Double_t lctau = TMath::Sqrt(TMath::Power((lPosXi[0]-lBestPrimaryVtxPos[0]),2)+TMath::Power((lPosXi[1]-lBestPrimaryVtxPos[1]),2)+TMath::Power(( lPosXi[2]-lBestPrimaryVtxPos[2]),2));
+ if (lXiTotMom!=0) lctau = lctau*cascadeMass/lXiTotMom;
+ else lctau = -1.;
+
+ //-------------------------------------------------
+ // Calculate proper lenght for Lambda (reconstructed)
+ Float_t lambdaMass = 1.115683; // PDG mass
+ Float_t distV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2)+TMath::Power((lPosV0Xi[2]-lPosXi[2]),2));
+ Float_t lctauV0 = -1.;
+ if (lV0TotMom!=0) lctauV0 = distV0Xi*lambdaMass/lV0TotMom;
+ Float_t distTV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));
+
+ //--------------
+ /*// For AliEVE
+ if(lChargeXi < 0&& lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
+ if (lXiTransvMom>2.&&lXiTransvMom<4.&&(lInvMassXiMinus<1.322&&lInvMassXiMinus>1.320)&&(lXiRadius<8.&&lXiRadius>3.)) {
+ // FIXME : Just to know which file is currently open : locate the file containing Xi
+ cout << "Name of the file containing Xi candidate(s) :"
+ << CurrentFileName()
+ << " / entry: " << Entry()
+ << " / in file: " << lESDevent->GetEventNumberInFile() // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
+ << " AliESDcascade number " << iXi
+ << " : mass(Xi-) = " << lInvMassXiMinus
+ << " / charge = " << lChargeXi
+ << " / pt(Casc) = " << lXiTransvMom
+ << " / Decay 2d R(Xi) = " << lXiRadius
+ << endl;
+ }
+ }
+ if(lChargeXi < 0&& lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
+ if (lXiTransvMom>2&&lXiTransvMom<4&&(lInvMassOmegaMinus<1.674&&lInvMassOmegaMinus>1.670)&&(lXiRadius<8.&&lXiRadius>3.)) {
+ cout << "Name of the file containing Omega candidate(s) :"
+ << CurrentFileName()
+ << " / entry: " << Entry()
+ << " / in file: " << lESDevent->GetEventNumberInFile() // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
+ << " AliESDcascade number " << iXi
+ << " : mass(Omega-) = " << lInvMassOmegaMinus
+ << " / charge = " << lChargeXi
+ << " / pt(Casc) = " << lXiTransvMom
+ << " / Decay 2d R(Xi) = " << lXiRadius
+ << endl;
+
+ }
+ }*/
+
+
+ // -
+ fHistPosV0TPCClusters->Fill( lPosTPCClusters );
+ fHistNegV0TPCClusters->Fill( lNegTPCClusters );
+ fHistBachTPCClusters->Fill( lBachTPCClusters );
+ f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[0] , lTPCSignalCascDghters[0] );
+ f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[1] , lTPCSignalCascDghters[1] );
+ f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[2] , lTPCSignalCascDghters[2] );
+
+ //----------------
+ //Plot with PID on
+ if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
+ ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) ) {
+ // NOTE :
+ // with this condition, it could happen that a cascade candidate satisfies the wrong requirement,
+ // e.g. one looks at a Xi- candidate for which lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC = kFALSE
+ // Expectation: it should be excluded, but lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC = kTRUE
+ // then this bad Xi-candidate will contribute anyway (OR condition).
+ // Hence: the extra condition on the sign of the Cascade
+ //if (TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.010 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.010)
+ fHistEffMassXi->Fill( lEffMassXi );
+ fHistDcaXiDaughters->Fill( lDcaXiDaughters ); // Flag CascadeVtxer: Cut Variable e
+ fHistDcaBachToPrimVertex->Fill( lDcaBachToPrimVertexXi ); // Flag CascadeVtxer: Cut Variable d
+ fHistXiCosineOfPointingAngle->Fill( lXiCosineOfPointingAngle ); // Flag CascadeVtxer: Cut Variable f
+ fHistXiRadius->Fill( lXiRadius ); // Flag CascadeVtxer: Cut Variable g+h
+ fHistMassLambdaAsCascDghter->Fill( lInvMassLambdaAsCascDghter ); // Flag CascadeVtxer: Cut Variable c
+ fHistDcaV0DaughtersXi->Fill( lDcaV0DaughtersXi );
+ fHistV0CosineOfPointingAngleXi->Fill( lV0CosineOfPointingAngleXi );
+ fHistV0RadiusXi->Fill( lV0RadiusXi );
+ fHistDcaV0ToPrimVertexXi->Fill( lDcaV0ToPrimVertexXi ); // Flag CascadeVtxer: Cut Variable b
+ fHistDcaPosToPrimVertexXi->Fill( lDcaPosToPrimVertexXi );
+ fHistDcaNegToPrimVertexXi->Fill( lDcaNegToPrimVertexXi );
+ fHistChargeXi->Fill( lChargeXi );
+ fHistV0toXiCosineOfPointingAngle->Fill( lV0toXiCosineOfPointingAngle );
+ if ( TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.012 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.012) { // One InvMass should be different from 0
+ fHistXiTransvMom->Fill( lXiTransvMom );
+ fHistXiTotMom->Fill( lXiTotMom );
+ fHistBachTransvMomXi->Fill( lBachTransvMom );
+ fHistBachTotMomXi->Fill( lBachTotMom );
+ fHistRapXi->Fill( lRapXi );
+ fHistEtaXi->Fill( lEta );
+ if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) {
+ fHistEtaBachXi->Fill( etaBach );
+ fHistEtaPosXi->Fill( etaPos );
+ fHistEtaNegXi->Fill( etaNeg );
+ }
+ fHistThetaXi->Fill( lTheta );
+ fHistPhiXi->Fill( lPhi );
+ }
+ if ( TMath::Abs( lInvMassOmegaMinus-1.672 ) < 0.012 || TMath::Abs( lInvMassOmegaPlus-1.672 ) < 0.012 ) { // One InvMass should be different from 0
+ fHistRapOmega->Fill( lRapOmega );
+ }
+ f2dHistArmenteros->Fill( lAlphaXi, lPtArmXi );
+ } // end with PID ...
+
+ //-----------------------
+ // - Invariant mass plots
+ //Plots 1D
+ if ( lChargeXi < 0 ) {
+ fHistMassXiMinus->Fill( lInvMassXiMinus );
+ fHistMassOmegaMinus->Fill( lInvMassOmegaMinus );
+ f2dHistDcaXiDaughtersvsInvMass->Fill(lDcaXiDaughters,lInvMassXiMinus);
+ f2dHistDcaBachToPrimVertexvsInvMass->Fill(lDcaBachToPrimVertexXi,lInvMassXiMinus);
+ f2dHistXiCosineOfPointingAnglevsInvMass->Fill(lXiCosineOfPointingAngle,lInvMassXiMinus);
+ f2dHistMassLambdaAsCascDghtervsInvMass->Fill(lInvMassLambdaAsCascDghter,lInvMassXiMinus);
+ f2dHistDcaV0DaughtersXivsInvMass->Fill(lDcaV0DaughtersXi,lInvMassXiMinus);
+ f2dHistDcaV0ToPrimVertexXivsInvMass->Fill(lDcaV0ToPrimVertexXi,lInvMassXiMinus);
+ }
+ if ( lChargeXi > 0 ) {
+ fHistMassXiPlus->Fill( lInvMassXiPlus );
+ fHistMassOmegaPlus->Fill( lInvMassOmegaPlus );
+ }
+ //Plots 2D, 3D
+ if ( lChargeXi < 0 ) {
+ f2dHistEffMassLambdaVsEffMassXiMinus->Fill( lInvMassLambdaAsCascDghter, lInvMassXiMinus );
+ f2dHistEffMassXiVsEffMassOmegaMinus ->Fill( lInvMassXiMinus, lInvMassOmegaMinus );
+ f2dHistXiRadiusVsEffMassXiMinus ->Fill( lXiRadius, lInvMassXiMinus );
+ f2dHistXiRadiusVsEffMassOmegaMinus ->Fill( lXiRadius, lInvMassOmegaMinus );
+ } else {
+ f2dHistEffMassLambdaVsEffMassXiPlus ->Fill( lInvMassLambdaAsCascDghter, lInvMassXiPlus );
+ f2dHistEffMassXiVsEffMassOmegaPlus ->Fill( lInvMassXiPlus, lInvMassOmegaPlus );
+ f2dHistXiRadiusVsEffMassXiPlus ->Fill( lXiRadius, lInvMassXiPlus);
+ f2dHistXiRadiusVsEffMassOmegaPlus ->Fill( lXiRadius, lInvMassOmegaPlus );
+ }
+
+ //---------------------------------------------
+ // - Filling the AliCFContainers related to PID
+ Double_t lContainerPIDVars[3] = {0.0};
+ // Xi Minus
+ if ( lChargeXi < 0 ) {
+ lContainerPIDVars[0] = lXiTransvMom;
+ lContainerPIDVars[1] = lInvMassXiMinus;
+ lContainerPIDVars[2] = lRapXi;
+ //No PID
+ fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 0); // No PID
+ //TPC PID
+ if ( lIsBachelorPionForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if ( lIsBachelorPionForTPC && lIsPosProtonForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if ( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ //Combined PID
+ if ( lIsBachelorPion ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if ( lIsBachelorPion && lIsPosInXiProton ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if (lIsBachelorPion && lIsPosInXiProton && lIsNegInXiPion ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+ lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
+ // Xi Plus
+ if ( lChargeXi > 0 ) {
+ lContainerPIDVars[0] = lXiTransvMom;
+ lContainerPIDVars[1] = lInvMassXiPlus;
+ lContainerPIDVars[2] = lRapXi;
+ //No PID
+ fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 0); // No PID
+ //TPC PID
+ if ( lIsBachelorPionForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if ( lIsBachelorPionForTPC && lIsNegProtonForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if ( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ //Combined PID
+ if ( lIsBachelorPion ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if ( lIsBachelorPion && lIsNegInXiProton ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if (lIsBachelorPion && lIsNegInXiProton && lIsPosInXiPion ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+ lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
+ // Omega Minus
+ if ( lChargeXi < 0 ) {
+ lContainerPIDVars[0] = lXiTransvMom;
+ lContainerPIDVars[1] = lInvMassOmegaMinus;
+ lContainerPIDVars[2] = lRapOmega;
+ //No PID
+ fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 0); // No PID
+ //TPC PID
+ if ( lIsBachelorKaonForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ //Combined PID
+ if ( lIsBachelorKaon ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if ( lIsBachelorKaon && lIsPosInOmegaProton ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if (lIsBachelorKaon && lIsPosInOmegaProton && lIsNegInOmegaPion ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+ lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
+ // Omega Plus
+ if ( lChargeXi > 0 ) {
+ lContainerPIDVars[0] = lXiTransvMom;
+ lContainerPIDVars[1] = lInvMassOmegaPlus;
+ lContainerPIDVars[2] = lRapOmega;
+ // No PID
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 0); // No PID
+ // TPC PID
+ if ( lIsBachelorKaonForTPC )
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if( lIsBachelorKaonForTPC &&
+ lIsNegProtonForTPC )
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if ( lIsBachelorKaonForTPC &&
+ lIsNegProtonForTPC &&
+ lIsPosPionForTPC )
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ // Combined PID
+ if ( lIsBachelorKaon )
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if ( lIsBachelorKaon &&
+ lIsNegInOmegaProton )
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if (lIsBachelorKaon &&
+ lIsNegInOmegaProton &&
+ lIsPosInOmegaPion )
+ fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+
+ //--------------------------------------------------------------------
+ // Filling the AliCFContainer (optimisation of topological selections)
+ Double_t lContainerCutVars[19] = {0.0};
+
+ lContainerCutVars[0] = lDcaXiDaughters;
+ lContainerCutVars[1] = lDcaBachToPrimVertexXi;
+ lContainerCutVars[2] = lXiCosineOfPointingAngle;
+ lContainerCutVars[3] = lXiRadius;
+ lContainerCutVars[4] = lInvMassLambdaAsCascDghter;
+ lContainerCutVars[5] = lDcaV0DaughtersXi;
+ lContainerCutVars[6] = lV0toXiCosineOfPointingAngle;
+ lContainerCutVars[7] = lV0RadiusXi;
+ lContainerCutVars[8] = lDcaV0ToPrimVertexXi;
+ lContainerCutVars[9] = lDcaPosToPrimVertexXi;
+ lContainerCutVars[10] = lDcaNegToPrimVertexXi;
+ lContainerCutVars[13] = lXiTransvMom;
+ lContainerCutVars[16] = lctau;
+ lContainerCutVars[17] = lctauV0;
+ lContainerCutVars[18] = distTV0Xi;
+
+ if ( lChargeXi < 0 ) {
+ lContainerCutVars[11] = lInvMassXiMinus;
+ lContainerCutVars[12] = lInvMassOmegaMinus;
+ lContainerCutVars[14] = lRapXi;
+ lContainerCutVars[15] = -1.;
+ if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,0); // for Xi-
+ lContainerCutVars[11] = lInvMassXiMinus;
+ lContainerCutVars[12] = lInvMassOmegaMinus;
+ lContainerCutVars[14] = -1.;
+ lContainerCutVars[15] = lRapOmega;
+ if (lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,2); // for Omega-
+ } else {
+ lContainerCutVars[11] = lInvMassXiPlus;
+ lContainerCutVars[12] = lInvMassOmegaPlus;
+ lContainerCutVars[14] = lRapXi;
+ lContainerCutVars[15] = -1.;
+ if (lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,1); // for Xi+
+ lContainerCutVars[11] = lInvMassXiPlus;
+ lContainerCutVars[12] = lInvMassOmegaPlus;
+ lContainerCutVars[14] = -1.;
+ lContainerCutVars[15] = lRapOmega;
+ if (lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,3); // for Omega+
+ }
+ } //end of the Cascade loop (ESD or AOD)
+
+ // Post output data.
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDXiMinus);
+ PostData(3, fCFContCascadePIDXiPlus);
+ PostData(4, fCFContCascadePIDOmegaMinus);
+ PostData(5, fCFContCascadePIDOmegaPlus);
+ PostData(6, fCFContCascadeCuts);
+}
+
+//________________________________________________________________________
+Int_t AliAnalysisTaskCheckCascadepp276::DoESDTrackWithTPCrefitMultiplicity(const AliESDEvent *lESDevent) {
+ // Checking the number of tracks with TPCrefit for each event
+ // Needed for a rough assessment of the event multiplicity
+
+ Int_t nTrackWithTPCrefitMultiplicity = 0;
+ for (Int_t iTrackIdx = 0; iTrackIdx < (InputEvent())->GetNumberOfTracks(); iTrackIdx++) {
+ AliESDtrack *esdTrack = 0x0;
+ esdTrack = lESDevent->GetTrack( iTrackIdx );
+ if (!esdTrack) { AliWarning("Pb / Could not retrieve one track within the track loop for TPCrefit check ..."); continue; }
+
+ ULong_t lTrackStatus = esdTrack->GetStatus();
+ if ((lTrackStatus&AliESDtrack::kTPCrefit) == 0) continue;
+ else nTrackWithTPCrefitMultiplicity++;
+ // FIXME :
+ // The goal here is to get a better assessment of the event multiplicity.
+ // (InputEvent())->GetNumberOfTracks() takes into account ITS std alone tracks + global tracks
+ // This may introduce a bias. Hence the number of TPC refit tracks.
+ // Note : the event multiplicity = analysis on its own... See Jacek's or Jan Fiete's analysis on dN/d(eta)
+
+ } // end loop over all event tracks
+ return nTrackWithTPCrefitMultiplicity;
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCheckCascadepp276::Terminate(Option_t *)
+{
+ // Draw result to the screen
+ // Called once at the end of the query
+
+/* TList *cRetrievedList = 0x0;
+ cRetrievedList = (TList*)GetOutputData(1);
+ if(!cRetrievedList){
+ AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: ouput data container list not available\n"); return;
+ }
+ fHistTrackMultiplicity = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistTrackMultiplicity") );
+ if (!fHistTrackMultiplicity) {
+ AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistTrackMultiplicity not available\n"); return;
+ }
+ fHistMassXiMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiMinus") );
+ if (!fHistMassXiMinus) {
+ AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiMinus not available\n"); return;
+ }
+ fHistMassXiPlus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiPlus") );
+ if (!fHistMassXiPlus) {
+ AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiPlus not available\n"); return;
+ }
+ fHistMassOmegaMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaMinus") );
+ if (!fHistMassOmegaMinus) {
+ AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaMinus not available\n"); return;
+ }
+ fHistMassOmegaPlus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaPlus") );
+ if (!fHistMassOmegaPlus) {
+ AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaPlus not available\n"); return;
+ }
+
+ TCanvas *canCheckCascade = new TCanvas("AliAnalysisTaskCheckCascadep276","CheckCascade overview",10,10,1010,660);
+ canCheckCascade->Divide(2,2);
+
+ canCheckCascade->cd(1);
+ canCheckCascade->cd(1)->SetLogy();
+ fHistTrackMultiplicity->SetMarkerStyle(kFullStar);
+ fHistTrackMultiplicity->GetXaxis()->SetLabelFont(42);
+ fHistTrackMultiplicity->GetYaxis()->SetLabelFont(42);
+ fHistTrackMultiplicity->SetTitleFont(42, "xy");
+ fHistTrackMultiplicity->GetXaxis()->SetTitleOffset(1.1);
+ fHistTrackMultiplicity->DrawCopy("H");
+
+ canCheckCascade->cd(2);
+ fHistMassXiMinus ->SetMarkerStyle(kFullCircle);
+ fHistMassXiMinus ->SetMarkerSize(0.5);
+ fHistMassXiMinus ->GetXaxis()->SetLabelFont(42);
+ fHistMassXiMinus ->GetYaxis()->SetLabelFont(42);
+ fHistMassXiMinus ->SetTitleFont(42, "xy");
+ fHistMassXiMinus ->GetXaxis()->SetTitleOffset(1.1);
+ fHistMassXiMinus ->GetYaxis()->SetTitleOffset(1.3);
+ //fHistMassXiMinus->Rebin(2);
+ fHistMassXiMinus ->GetXaxis()->SetRangeUser(1.24, 1.42);
+ fHistMassXiMinus ->DrawCopy("E");
+
+ fHistMassXiPlus ->SetMarkerStyle(kOpenCircle);
+ fHistMassXiPlus ->SetMarkerColor(kRed+2);
+ fHistMassXiPlus ->SetLineColor(kRed+2);
+ fHistMassXiPlus ->SetMarkerSize(0.5);
+ //fHistMassXiPlus ->Rebin(2);
+ fHistMassXiPlus ->DrawCopy("ESAME");
+
+
+ TLegend *legendXi =new TLegend(0.67,0.34,0.97,0.54);
+ legendXi->SetTextFont(42);
+ legendXi->SetTextSize(0.05);
+ legendXi->SetFillColor(kWhite);
+ legendXi->AddEntry( fHistMassXiMinus,"#Xi^{-} candidates","lp");
+ legendXi->AddEntry( fHistMassXiPlus,"#Xi^{+} candidates","lp");
+ legendXi->Draw();
+
+
+ canCheckCascade->cd(3);
+ fHistMassOmegaPlus ->SetMarkerStyle(kOpenCircle);
+ fHistMassOmegaPlus ->SetMarkerColor(kRed+2);
+ fHistMassOmegaPlus ->SetLineColor(kRed+2);
+ fHistMassOmegaPlus ->SetMarkerSize(0.5);
+ fHistMassOmegaPlus ->GetXaxis()->SetLabelFont(42);
+ fHistMassOmegaPlus ->GetYaxis()->SetLabelFont(42);
+ fHistMassOmegaPlus ->SetTitleFont(42, "xy");
+ fHistMassOmegaPlus ->GetXaxis()->SetTitleOffset(1.1);
+ fHistMassOmegaPlus ->GetYaxis()->SetTitleOffset(1.25);
+ //fHistMassOmegaPlus ->Rebin(2);
+ fHistMassOmegaPlus ->GetXaxis()->SetRangeUser(1.6, 1.84);
+ fHistMassOmegaPlus ->DrawCopy("E");
+
+ fHistMassOmegaMinus->SetMarkerStyle(kFullCircle);
+ fHistMassOmegaMinus->SetMarkerSize(0.5);
+ //fHistMassOmegaMinus->Rebin(2);
+ fHistMassOmegaMinus->DrawCopy("ESAME");
+
+
+ TLegend *legendOmega = new TLegend(0.67,0.34,0.97,0.54);
+ legendOmega->SetTextFont(42);
+ legendOmega->SetTextSize(0.05);
+ legendOmega->SetFillColor(kWhite);
+ legendOmega->AddEntry( fHistMassOmegaMinus,"#Omega^{-} candidates","lp");
+ legendOmega->AddEntry( fHistMassOmegaPlus,"#Omega^{+} candidates","lp");
+ legendOmega->Draw();
+ */
+}
-/*************************************************************** *\r
- * Authors : Antonin Maire, Boris Hippolyte \r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskCheckPerformanceCascadePbPb class\r
-// This task is for a performance study of cascade identification in PbPb.\r
-// It works with MC info and ESD/AOD.\r
-// Origin : AliAnalysisTaskCheckPerformanceCascade class by A. Maire Nov2010, antonin.maire@ires.in2p3.fr\r
-// Modified for PbPb analysis: M. Nicassio Feb2011, maria.nicassio@ba.infn.it:\r
-// - physics selection moved to the run.C macro\r
-// - added centrality selection and possibility to select events in nTracks ranges \r
-// - added new histograms \r
-// - modified binning of some histograms and containers \r
-// - flag to enable CF container usage \r
-// - check in the destructor for CAF usage\r
-// - flag for acceptance cut in the MC part\r
-// - in the MC particle selection IsPhysicalPrimary added and number of particles taken as appropriate for HIJING \r
-// (however for cascades one gets the same if runs on Nprimaries in the stack and does not check IsPhysicalPrimary)\r
-// - automatic settings for PID \r
-// - selection of injected cascades and HIJING cascades (kind of "bug" in method IsFromBGEvent())\r
-// - added proper time histograms for cascades and lambdas\r
-// - cos of PA V0 wrt Xi vertex and not primary vertex \r
-// - distance xi-V0 added in the container\r
-// - AOD analysis developed (January 2012)\r
-//\r
-//\r
-//\r
-// Adapted to pp 2.76 analysis: D. Colella, domenico.colella@ba.infn.it (Nov. 2012):\r
-// - added new and removed other histograms \r
-// - Physics selection moved here (mainly for normalization in the efficiency calcuation)\r
-// - Centrality selection deleted\r
-// - 3DHisto denominator moved before any event selection for Normalization\r
-// - injected and natural part of MC selection removed\r
-// \r
-//\r
-//\r
-//-----------------------------------------------------------------\r
-\r
-\r
-#include <Riostream.h>\r
-\r
-#include "TList.h"\r
-#include "TFile.h"\r
-#include "TH1F.h"\r
-#include "TH2F.h"\r
-#include "TH3F.h"\r
-#include "TVector3.h"\r
-#include "TCanvas.h"\r
-#include "TParticle.h"\r
-#include "TMath.h"\r
-\r
-#include "AliLog.h"\r
-#include "AliHeader.h"\r
-#include "AliMCEvent.h"\r
-#include "AliStack.h"\r
-#include "AliMultiplicity.h"\r
-#include "AliInputEventHandler.h"\r
-#include "AliAnalysisManager.h"\r
-\r
-#include "AliCFContainer.h"\r
-\r
-#include "AliESDVZERO.h"\r
-\r
-#include "AliGenEventHeader.h"\r
-#include "AliGenCocktailEventHeader.h"\r
-#include "AliGenHijingEventHeader.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliPIDResponse.h"\r
-#include "AliV0vertexer.h"\r
-#include "AliCascadeVertexer.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDcascade.h"\r
-#include "AliAODEvent.h"\r
-#include "AliAODMCParticle.h" \r
-#include "AliAnalysisTaskCheckPerformanceCascadepp276.h"\r
-\r
-using std::cout;\r
-using std::endl;\r
-\r
-ClassImp(AliAnalysisTaskCheckPerformanceCascadepp276)\r
-\r
-\r
-\r
-//________________________________________________________________________________________\r
-AliAnalysisTaskCheckPerformanceCascadepp276::AliAnalysisTaskCheckPerformanceCascadepp276() \r
-: AliAnalysisTaskSE(), // <- take care to AliAnalysisTask( empty )\r
- fAnalysisType ("ESD"), \r
- fESDtrackCuts (0), \r
- fPIDResponse (0),\r
- fkRerunV0CascVertexers (0),\r
- fkSDDselectionOn (kTRUE),\r
- fkQualityCutZprimVtxPos (kTRUE),\r
- fkRejectEventPileUp (kTRUE),\r
- fkQualityCutNoTPConlyPrimVtx (kTRUE),\r
- fkQualityCutTPCrefit (kTRUE),\r
- fkQualityCutnTPCcls (kTRUE),\r
- fwithSDD (kTRUE),\r
- fMinnTPCcls (0),\r
- fkExtraSelections (0),\r
- fVtxRange (0),\r
- fVtxRangeMin (0),\r
- fApplyAccCut (0),\r
- fMinPtCutOnDaughterTracks (0),\r
- fEtaCutOnDaughterTracks (0),\r
- \r
- // - Plots initialisation\r
- fListHistCascade(0),\r
-\r
- // - General Plots\r
- // Cascade multiplicity plots\r
- fHistCascadeMultiplicityBeforeAnySel(0),\r
- fHistCascadeMultiplicityAfterSDDSel(0),\r
- fHistCascadeMultiplicityAfterPhysicsSel(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistCascadeMultiplicityAfterVertexCutSel(0),\r
- fHistnXiPlusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnXiMinusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnOmegaPlusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnOmegaMinusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnXiPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnXiMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnOmegaPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnOmegaMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnAssoXiMinus(0), // For the Reconstructed-Associated cascades \r
- fHistnAssoXiPlus(0), // For the Reconstructed-Associated cascades \r
- fHistnAssoOmegaMinus(0), // For the Reconstructed-Associated cascades \r
- fHistnAssoOmegaPlus(0), // For the Reconstructed-Associated cascades \r
- // Tracks multiplicity plots\r
- fHistTrackMultiplicityBeforeAnySel(0),\r
- fHistTrackMultiplicityAfterSDDSel(0),\r
- fHistTrackMultiplicityAfterPhysicsSel(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistTrackMultiplicityAfterVertexCutSel(0),\r
- // Vertex position plots (BestVertex)\r
- fHistPVx(0), // After any selections but before |Z| < 10 cm\r
- fHistPVy(0), // After any selections but before |Z| < 10 cm\r
- fHistPVz(0), // After any selections but before |Z| < 10 cm\r
- fHistPVxAnalysis(0), // After any event selections\r
- fHistPVyAnalysis(0), // After any event selections\r
- fHistPVzAnalysis(0), // After any event selections\r
- // - Plots before Physics Selection\r
- f3dHistGenPtVsGenYvsNtracksXiMinus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenctauvsYXiMinus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenYvsNtracksXiPlus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenctauvsYXiPlus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenctauvsYOmegaMinus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlus(0), // After the SDD event selection (For efficinecy calculation)\r
- f3dHistGenPtVsGenctauvsYOmegaPlus(0), // After the SDD event selection (For efficinecy calculation)\r
- // - Generated cascade plots\r
- // After all the event selections \r
- //Xi-\r
- fHistEtaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYXiMinusPhysEff(0), // \r
- f2dHistGenPtVsGenYFdblXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- //Xi+\r
- fHistEtaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYXiPlusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- //Omega-\r
- fHistEtaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- //Omega+ \r
- fHistEtaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
-\r
- // - Associated to MC cascade plots\r
- fHistMassXiMinus(0), // For the Reconstructed-Associated cascades\r
- fHistMassXiPlus(0), // For the Reconstructed-Associated cascades\r
- fHistMassOmegaMinus(0), // For the Reconstructed-Associated cascades\r
- fHistMassOmegaPlus(0), // For the Reconstructed-Associated cascades\r
- // Effective mass histos with combined PID\r
- fHistMassWithCombPIDXiMinus(0), \r
- fHistMassWithCombPIDXiPlus(0),\r
- fHistMassWithCombPIDOmegaMinus(0), \r
- fHistMassWithCombPIDOmegaPlus(0), \r
- // PID Probability versus MC Pt(bachelor track)\r
- f2dHistPIDprobaKaonVsMCPtBach(0), f2dHistPIDprobaPionVsMCPtBach(0),\r
- // Effective mass histos with perfect MC PID on the bachelor\r
- fHistMassWithMcPIDXiMinus(0), fHistMassWithMcPIDXiPlus(0),\r
- fHistMassWithMcPIDOmegaMinus(0), fHistMassWithMcPIDOmegaPlus(0),\r
- // Effective mass histos for the cascade candidates associated with MC\r
- fHistAsMCMassXiMinus(0), \r
- fHistAsMCMassXiPlus(0), \r
- fHistAsMCMassOmegaMinus(0),\r
- fHistAsMCMassOmegaPlus(0),\r
- // Generated Pt Vs generated y, for the cascade candidates associated with MC + Info Comb. PID\r
- f2dHistAsMCandCombPIDGenPtVsGenYXiMinus(0),\r
- f2dHistAsMCandCombPIDGenPtVsGenYXiPlus(0),\r
- f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus(0),\r
- f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus(0),\r
- // Generated Pt Vs generated y, for the cascade candidates associated with MC\r
- f2dHistAsMCGenPtVsGenYXiMinus(0),\r
- f2dHistAsMCGenPtVsGenYXiPlus(0),\r
- f2dHistAsMCGenPtVsGenYOmegaMinus(0),\r
- f2dHistAsMCGenPtVsGenYOmegaPlus(0),\r
- // Generated Eta of the the cascade candidates associated with MC\r
- fHistAsMCGenEtaXiMinus(0),\r
- fHistAsMCGenEtaXiPlus(0),\r
- fHistAsMCGenEtaOmegaMinus(0),\r
- fHistAsMCGenEtaOmegaPlus(0),\r
- // Resolution in Pt as function of generated Pt\r
- f2dHistAsMCResPtXiMinus(0), \r
- f2dHistAsMCResPtXiPlus(0), \r
- f2dHistAsMCResPtOmegaMinus(0),\r
- f2dHistAsMCResPtOmegaPlus(0), \r
- // Resolution in R(2D) as function of generated R\r
- f2dHistAsMCResRXiMinus(0), \r
- f2dHistAsMCResRXiPlus(0), \r
- f2dHistAsMCResROmegaMinus(0),\r
- f2dHistAsMCResROmegaPlus(0),\r
- // Resolution in phi as function of generated Pt\r
- f2dHistAsMCResPhiXiMinus(0),\r
- f2dHistAsMCResPhiXiPlus(0),\r
- f2dHistAsMCResPhiOmegaMinus(0),\r
- f2dHistAsMCResPhiOmegaPlus(0),\r
- // Correlation between proton (antiproton) daughter MC pt and Xi/Omega MC pt (to apply Geat/Fluka correction)\r
- f2dHistAsMCptProtonMCptXiMinus(0),\r
- f2dHistAsMCptAntiprotonMCptXiPlus(0),\r
- f2dHistAsMCptProtonMCptOmegaMinus(0),\r
- f2dHistAsMCptAntiprotonMCptOmegaPlus(0),\r
- // QA plots\r
- fHistV0toXiCosineOfPointingAngle(0),\r
- fHistV0CosineOfPointingAnglevsPtXi(0),\r
- fHistV0CosineOfPointingAnglevsPtOmega(0), \r
- \r
- // Containers \r
- fCFContCascadePIDAsXiMinus(0),\r
- fCFContCascadePIDAsXiPlus(0),\r
- fCFContCascadePIDAsOmegaMinus(0),\r
- fCFContCascadePIDAsOmegaPlus(0),\r
- fCFContAsCascadeCuts(0)\r
-\r
- //____Dummy costructor____\r
- {\r
- for(Int_t iV0selIdx = 0; iV0selIdx < 7; iV0selIdx++ ) { fV0Sels [iV0selIdx ] = -1.; }\r
- for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels [iCascSelIdx ] = -1.; }\r
- }\r
- \r
- \r
- \r
-//_____Non-default Constructor________________________________________________________________\r
-AliAnalysisTaskCheckPerformanceCascadepp276::AliAnalysisTaskCheckPerformanceCascadepp276(const char *name) \r
- : AliAnalysisTaskSE(name),\r
- fAnalysisType ("ESD"), \r
- fESDtrackCuts (0),\r
- fPIDResponse (0),\r
- fkRerunV0CascVertexers (0),\r
- fkSDDselectionOn (kTRUE),\r
- fkQualityCutZprimVtxPos (kTRUE),\r
- fkRejectEventPileUp (kTRUE),\r
- fkQualityCutNoTPConlyPrimVtx (kTRUE),\r
- fkQualityCutTPCrefit (kTRUE),\r
- fkQualityCutnTPCcls (kTRUE),\r
- fwithSDD (kTRUE),\r
- fMinnTPCcls (0),\r
- fkExtraSelections (0),\r
- fVtxRange (0),\r
- fVtxRangeMin (0),\r
- fApplyAccCut (0),\r
- fMinPtCutOnDaughterTracks (0),\r
- fEtaCutOnDaughterTracks (0),\r
-\r
- // - Plots initialisation\r
- fListHistCascade(0),\r
-\r
- // - General Plots\r
- // Cascade multiplicity plots\r
- fHistCascadeMultiplicityBeforeAnySel(0),\r
- fHistCascadeMultiplicityAfterSDDSel(0),\r
- fHistCascadeMultiplicityAfterPhysicsSel(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistCascadeMultiplicityAfterVertexCutSel(0),\r
- fHistnXiPlusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnXiMinusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnOmegaPlusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnOmegaMinusPerEvTot(0), // After any event selections, in all the eta and pt range\r
- fHistnXiPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnXiMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnOmegaPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnOmegaMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum\r
- fHistnAssoXiMinus(0), // For the Reconstructed-Associated cascades \r
- fHistnAssoXiPlus(0), // For the Reconstructed-Associated cascades \r
- fHistnAssoOmegaMinus(0), // For the Reconstructed-Associated cascades \r
- fHistnAssoOmegaPlus(0), // For the Reconstructed-Associated cascades \r
- // Tracks multiplicity plots\r
- fHistTrackMultiplicityBeforeAnySel(0),\r
- fHistTrackMultiplicityAfterSDDSel(0),\r
- fHistTrackMultiplicityAfterPhysicsSel(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly(0),\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),\r
- fHistTrackMultiplicityAfterVertexCutSel(0),\r
- // Vertex position plots (BestVertex)\r
- fHistPVx(0), // After any selections but before |Z| < 10 cm\r
- fHistPVy(0), // After any selections but before |Z| < 10 cm\r
- fHistPVz(0), // After any selections but before |Z| < 10 cm\r
- fHistPVxAnalysis(0), // After any event selections\r
- fHistPVyAnalysis(0), // After any event selections\r
- fHistPVzAnalysis(0), // After any event selections\r
- // - Plots before Physics Selection\r
- f3dHistGenPtVsGenYvsNtracksXiMinus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenctauvsYXiMinus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenYvsNtracksXiPlus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenctauvsYXiPlus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenctauvsYOmegaMinus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlus(0), // After the SDD event selection (For efficiency calculation)\r
- f3dHistGenPtVsGenctauvsYOmegaPlus(0), // After the SDD event selection (For efficiency calculation)\r
- // - Generated cascade plots\r
- // After all the event selections \r
- //Xi-\r
- fHistEtaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYXiMinusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- //Xi+\r
- fHistEtaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYXiPlusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- //Omega-\r
- fHistEtaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- //Omega+ \r
- fHistEtaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)\r
- fHistThetaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff(0), // \r
- f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff(0), //\r
- f2dHistGenPtVsGenYFdblOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaLambdaOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistThetaBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
- fHistPtBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)\r
-\r
- // - Associated to MC cascade plots\r
- fHistMassXiMinus(0), // For the Reconstructed-Associated cascades\r
- fHistMassXiPlus(0), // For the Reconstructed-Associated cascades\r
- fHistMassOmegaMinus(0), // For the Reconstructed-Associated cascades\r
- fHistMassOmegaPlus(0), // For the Reconstructed-Associated cascades\r
- // Effective mass histos with combined PID\r
- fHistMassWithCombPIDXiMinus(0),\r
- fHistMassWithCombPIDXiPlus(0),\r
- fHistMassWithCombPIDOmegaMinus(0),\r
- fHistMassWithCombPIDOmegaPlus(0),\r
- // PID Probability versus MC Pt(bachelor track)\r
- f2dHistPIDprobaKaonVsMCPtBach(0), f2dHistPIDprobaPionVsMCPtBach(0),\r
- // Effective mass histos with perfect MC PID on the bachelor\r
- fHistMassWithMcPIDXiMinus(0), fHistMassWithMcPIDXiPlus(0),\r
- fHistMassWithMcPIDOmegaMinus(0), fHistMassWithMcPIDOmegaPlus(0),\r
- // Effective mass histos for the cascade candidates associated with MC\r
- fHistAsMCMassXiMinus(0),\r
- fHistAsMCMassXiPlus(0),\r
- fHistAsMCMassOmegaMinus(0),\r
- fHistAsMCMassOmegaPlus(0),\r
- // Generated Pt Vs generated y, for the cascade candidates associated with MC + Info Comb. PID\r
- f2dHistAsMCandCombPIDGenPtVsGenYXiMinus(0),\r
- f2dHistAsMCandCombPIDGenPtVsGenYXiPlus(0),\r
- f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus(0),\r
- f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus(0),\r
- // Generated Pt Vs generated y, for the cascade candidates associated with MC\r
- f2dHistAsMCGenPtVsGenYXiMinus(0),\r
- f2dHistAsMCGenPtVsGenYXiPlus(0),\r
- f2dHistAsMCGenPtVsGenYOmegaMinus(0),\r
- f2dHistAsMCGenPtVsGenYOmegaPlus(0),\r
- // Generated Eta of the the cascade candidates associated with MC\r
- fHistAsMCGenEtaXiMinus(0),\r
- fHistAsMCGenEtaXiPlus(0),\r
- fHistAsMCGenEtaOmegaMinus(0),\r
- fHistAsMCGenEtaOmegaPlus(0),\r
- // Resolution in Pt as function of generated Pt\r
- f2dHistAsMCResPtXiMinus(0),\r
- f2dHistAsMCResPtXiPlus(0),\r
- f2dHistAsMCResPtOmegaMinus(0),\r
- f2dHistAsMCResPtOmegaPlus(0),\r
- // Resolution in R(2D) as function of generated R\r
- f2dHistAsMCResRXiMinus(0),\r
- f2dHistAsMCResRXiPlus(0),\r
- f2dHistAsMCResROmegaMinus(0),\r
- f2dHistAsMCResROmegaPlus(0),\r
- // Resolution in phi as function of generated Pt\r
- f2dHistAsMCResPhiXiMinus(0),\r
- f2dHistAsMCResPhiXiPlus(0),\r
- f2dHistAsMCResPhiOmegaMinus(0),\r
- f2dHistAsMCResPhiOmegaPlus(0),\r
- // Correlation between proton (antiproton) daughter MC pt and Xi/Omega MC pt (to apply Geat/Fluka correction)\r
- f2dHistAsMCptProtonMCptXiMinus(0),\r
- f2dHistAsMCptAntiprotonMCptXiPlus(0),\r
- f2dHistAsMCptProtonMCptOmegaMinus(0),\r
- f2dHistAsMCptAntiprotonMCptOmegaPlus(0),\r
- // QA plots\r
- fHistV0toXiCosineOfPointingAngle(0),\r
- fHistV0CosineOfPointingAnglevsPtXi(0),\r
- fHistV0CosineOfPointingAnglevsPtOmega(0),\r
-\r
- // Containers \r
- fCFContCascadePIDAsXiMinus(0),\r
- fCFContCascadePIDAsXiPlus(0),\r
- fCFContCascadePIDAsOmegaMinus(0),\r
- fCFContCascadePIDAsOmegaPlus(0),\r
- fCFContAsCascadeCuts(0)\r
-\r
- //____Costructor____\r
- {\r
- // Define input and output slots here\r
- // Input slot #0 works with a TChain\r
- // Output slot #1 writes into a TList container (cascade)\r
- \r
- // PbPb default cuts \r
- fV0Sels[0] = 33.; // max allowed chi2\r
- fV0Sels[1] = 0.1; // min allowed impact parameter for the 1st daughter \r
- fV0Sels[2] = 0.1; // min allowed impact parameter for the 2nd daughter \r
- fV0Sels[3] = 1.5 ; // max allowed DCA between the daughter tracks \r
- fV0Sels[4] = 0.9 ; // min allowed cosine of V0's pointing angle \r
- fV0Sels[5] = 0.2; // min radius of the fiducial volume \r
- fV0Sels[6] = 200. ; // max radius of the fiducial volume \r
- fCascSels[0] = 33.; // max allowed chi2 \r
- fCascSels[1] = 0.01; // min allowed V0 impact parameter \r
- fCascSels[2] = 0.008; // "window" around the Lambda mass \r
- fCascSels[3] = 0.01; // min allowed bachelor's impact parameter \r
- fCascSels[4] = 2.0 ; // max allowed DCA between the V0 and the bachelor \r
- fCascSels[5] = 0.95; // min allowed cosine of the cascade pointing angle \r
- fCascSels[6] = 0.2 ; // min radius of the fiducial volume \r
- fCascSels[7] = 100. ; // max radius of the fiducial volume \r
- \r
- DefineOutput(1, TList::Class());\r
- DefineOutput(2, AliCFContainer::Class());\r
- DefineOutput(3, AliCFContainer::Class());\r
- DefineOutput(4, AliCFContainer::Class());\r
- DefineOutput(5, AliCFContainer::Class());\r
- DefineOutput(6, AliCFContainer::Class());\r
- }\r
-\r
- //____Destructor____\r
- AliAnalysisTaskCheckPerformanceCascadepp276::~AliAnalysisTaskCheckPerformanceCascadepp276()\r
- {\r
- // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.\r
- // They will be deleted when fListCascade is deleted by the TSelector dtor\r
- // Because of TList::SetOwner()\r
- if (fListHistCascade && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fListHistCascade; fListHistCascade = 0x0;} \r
- if (fCFContCascadePIDAsXiMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsXiMinus; fCFContCascadePIDAsXiMinus = 0x0;}\r
- if (fCFContCascadePIDAsXiPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsXiPlus; fCFContCascadePIDAsXiPlus = 0x0;}\r
- if (fCFContCascadePIDAsOmegaMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsOmegaMinus; fCFContCascadePIDAsOmegaMinus = 0x0;}\r
- if (fCFContCascadePIDAsOmegaPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsOmegaPlus; fCFContCascadePIDAsOmegaPlus = 0x0;}\r
- if (fCFContAsCascadeCuts && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContAsCascadeCuts; fCFContAsCascadeCuts = 0x0;}\r
- if (fESDtrackCuts) {delete fESDtrackCuts; fESDtrackCuts = 0x0;}\r
- }\r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskCheckPerformanceCascadepp276::UserCreateOutputObjects() {\r
- // Create histograms\r
- // Called once\r
-\r
- // - Option for AliLog: to suppress the extensive info prompted by a run with MC\r
- AliLog::SetGlobalLogLevel(AliLog::kError); \r
-\r
- // - Definition of the output datamembers \r
- fListHistCascade = new TList();\r
- fListHistCascade->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner\r
-\r
- //-----------------------------------------------\r
- // Particle Identification Setup (new PID object)\r
- //-----------------------------------------------\r
- AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());\r
- fPIDResponse = inputHandler->GetPIDResponse();\r
- \r
- // - Only used to get the number of primary reconstructed tracks\r
- if (! fESDtrackCuts ){\r
- fESDtrackCuts = new AliESDtrackCuts();\r
- }\r
- \r
- //----------------------\r
- // Initialize the histos\r
- //----------------------\r
-\r
- //----------------------------------\r
- // - Same general binning definition\r
- Double_t ptBinLimits[101];\r
- for (Int_t iptbin = 0; iptbin<101; ++iptbin) ptBinLimits[iptbin]=iptbin*0.1;\r
- Double_t yBinLimits[111];\r
- for (Int_t iybin = 0; iybin<111; ++iybin) yBinLimits[iybin]=-1.1+iybin*0.02;\r
- Double_t ctauBinLimits[112];\r
- for (Int_t ict = 0; ict<112; ++ict) ctauBinLimits[ict] = (Double_t) (ict-1.); \r
- \r
- //------------------\r
- // - General plots\r
- // - Cascades multiplicity plots \r
- if(! fHistCascadeMultiplicityBeforeAnySel) {\r
- fHistCascadeMultiplicityBeforeAnySel = new TH1F("fHistCascadeMultiplicityBeforeAnySel",\r
- "Cascades per event (before any selections);Nbr of Cascades/Evt;Events", 50, 0, 50);\r
- fListHistCascade->Add(fHistCascadeMultiplicityBeforeAnySel);\r
- }\r
- if(! fHistCascadeMultiplicityAfterSDDSel) {\r
- fHistCascadeMultiplicityAfterSDDSel = new TH1F("fHistCascadeMultiplicityAfterSDDSel",\r
- "Cascades per event (after only the SDD selection);Nbr of Cascades/Evt;Events", 50, 0, 50);\r
- fListHistCascade->Add(fHistCascadeMultiplicityAfterSDDSel);\r
- }\r
- if(! fHistCascadeMultiplicityAfterPhysicsSel) {\r
- fHistCascadeMultiplicityAfterPhysicsSel = new TH1F("fHistCascadeMultiplicityAfterPhysicsSel",\r
- "Cascades per event (after physics selection);Nbr of Cascades/Evt;Events", 50, 0, 50);\r
- fListHistCascade->Add(fHistCascadeMultiplicityAfterPhysicsSel);\r
- }\r
- if(! fHistCascadeMultiplicityForSelEvtNoTPCOnly) {\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnly",\r
- "Cascades per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events", 50, 0, 50);\r
- fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnly);\r
- }\r
- if(! fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup) {\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup",\r
- "Cascades per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events", 50, 0, 50);\r
- fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup);\r
- }\r
- if(! fHistCascadeMultiplicityAfterVertexCutSel) {\r
- fHistCascadeMultiplicityAfterVertexCutSel = new TH1F("fHistCascadeMultiplicityAfterVertexCutSel",\r
- "Cascades per event (after vertex cut selection);Nbr of Cascades/Evt;Events", 50, 0, 50);\r
- fListHistCascade->Add(fHistCascadeMultiplicityAfterVertexCutSel);\r
- }\r
- // - Tracks multiplicity plots \r
- if(! fHistTrackMultiplicityBeforeAnySel) {\r
- fHistTrackMultiplicityBeforeAnySel = new TH1F("fHistTrackMultiplicityBeforeAnySel",\r
- "Tracks per event (before any selections);Nbr of Tracks/Evt;Events", 200, 0, 200);\r
- fListHistCascade->Add(fHistTrackMultiplicityBeforeAnySel);\r
- }\r
- if(! fHistTrackMultiplicityAfterSDDSel) {\r
- fHistTrackMultiplicityAfterSDDSel = new TH1F("fHistTrackMultiplicityAfterSDDSel",\r
- "Tracks per event (after only the SDD selection);Nbr of Tracks/Evt;Events", 200, 0, 200);\r
- fListHistCascade->Add(fHistTrackMultiplicityAfterSDDSel);\r
- }\r
- if(! fHistTrackMultiplicityAfterPhysicsSel) {\r
- fHistTrackMultiplicityAfterPhysicsSel = new TH1F("fHistTrackMultiplicityAfterPhysicsSel",\r
- "Tracks per event (after physics selection);Nbr of Tracks/Evt;Events", 200, 0, 200);\r
- fListHistCascade->Add(fHistTrackMultiplicityAfterPhysicsSel);\r
- }\r
- if(! fHistTrackMultiplicityForSelEvtNoTPCOnly) {\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnly",\r
- "Tracks per event (for selected events with well-established PV);Nbr of Tracks/Evt;Events", 200, 0, 200);\r
- fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnly);\r
- }\r
- if(! fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup) {\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup",\r
- "Tracks per event (for selected events with well-establisched PV and no pile-up);Nbr of Tracks/Evt;Events", 200, 0, 200);\r
- fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);\r
- }\r
- if(! fHistTrackMultiplicityAfterVertexCutSel) {\r
- fHistTrackMultiplicityAfterVertexCutSel = new TH1F("fHistTrackMultiplicityAfterVertexCutSel",\r
- "Tracks per event (after vertex cut selection);Nbr of Tracks/Evt;Events", 200, 0, 200);\r
- fListHistCascade->Add(fHistTrackMultiplicityAfterVertexCutSel);\r
- }\r
- // - Vertex position plots\r
- if(! fHistPVx ){\r
- fHistPVx = new TH1F("fHistPVx", "Best PV position in x; x (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVx);\r
- }\r
- if(! fHistPVy ){\r
- fHistPVy = new TH1F("fHistPVy", "Best PV position in y; y (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVy);\r
- }\r
- if(! fHistPVz ){\r
- fHistPVz = new TH1F("fHistPVz", "Best PV position in z; z (cm); Events", 400, -20, 20);\r
- fListHistCascade->Add(fHistPVz);\r
- }\r
- if(! fHistPVxAnalysis ){\r
- fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", "Best PV position in x (after events selections); x (cm); Events", 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVxAnalysis);\r
- }\r
- if(! fHistPVyAnalysis ){\r
- fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", "Best PV position in y (after events selections); y (cm); Events" , 2000, -0.5, 0.5);\r
- fListHistCascade->Add(fHistPVyAnalysis);\r
- }\r
- if(! fHistPVzAnalysis ){\r
- fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", "Best PV position in z (after events selections); z (cm); Events", 400, -20, 20);\r
- fListHistCascade->Add(fHistPVzAnalysis);\r
- }\r
-\r
- //--------------------------\r
- // - Generated cascade plots\r
- // - Generated Cascade multiplicity distributions (for singol cascade)\r
- fHistnXiPlusPerEvTot = new TH1F("fHistnXiPlusPerEvTot", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnXiPlusPerEvTot);\r
- fHistnXiMinusPerEvTot = new TH1F("fHistnXiMinusPerEvTot", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnXiMinusPerEvTot);\r
- fHistnOmegaPlusPerEvTot = new TH1F("fHistnOmegaPlusPerEvTot", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnOmegaPlusPerEvTot);\r
- fHistnOmegaMinusPerEvTot = new TH1F("fHistnOmegaMinusPerEvTot", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnOmegaMinusPerEvTot); \r
- fHistnXiPlusPerEv = new TH1F("fHistnXiPlusPerEv", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnXiPlusPerEv);\r
- fHistnXiMinusPerEv = new TH1F("fHistnXiMinusPerEv", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnXiMinusPerEv);\r
- fHistnOmegaPlusPerEv = new TH1F("fHistnOmegaPlusPerEv", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnOmegaPlusPerEv);\r
- fHistnOmegaMinusPerEv = new TH1F("fHistnOmegaMinusPerEv", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnOmegaMinusPerEv);\r
- // - Xi- \r
- // - Pseudo-Rapidity distribution\r
- if (!fHistEtaGenCascXiMinus) {\r
- fHistEtaGenCascXiMinus = new TH1F("fHistEtaGenCascXiMinus", "#eta of any gen. #Xi^{-}; #eta; Number of Casc", 200, -10, 10);\r
- fListHistCascade->Add(fHistEtaGenCascXiMinus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksXiMinus) {\r
- f3dHistGenPtVsGenYvsNtracksXiMinus = new TH3D("f3dHistGenPtVsGenYvsNtracksXiMinus", "MC P_{t} Vs MC Y of Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiMinus);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYXiMinus) {\r
- f3dHistGenPtVsGenctauvsYXiMinus = new TH3D("f3dHistGenPtVsGenctauvsYXiMinus", "MC P_{t} Vs MC ctau Vs Y of Gen #Xi^{-}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiMinus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff) {\r
- f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff", "MC P_{t} Vs MC Y of Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYXiMinusPhysEff) {\r
- f3dHistGenPtVsGenctauvsYXiMinusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYXiMinusPhysEff", "MC P_{t} Vs MC ctau Vs Y of Gen #Xi^{-}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiMinusPhysEff);\r
- }\r
- // - Info at the generation level of multi-strange particle\r
- if (!fHistThetaGenCascXiMinus) {\r
- fHistThetaGenCascXiMinus = new TH1F("fHistThetaGenCascXiMinus", "#theta of gen. #Xi^{-}; #theta; Number of Casc.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaGenCascXiMinus);\r
- }\r
- if (!f2dHistGenPtVsGenYFdblXiMinus) {\r
- f2dHistGenPtVsGenYFdblXiMinus = new TH2D("f2dHistGenPtVsGenYFdblXiMinus", "MC P_{t} Vs MC Y of findable Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistGenPtVsGenYFdblXiMinus);\r
- }\r
- // - Theta distribution the daughters (control plots)\r
- if (!fHistThetaLambdaXiMinus) {\r
- fHistThetaLambdaXiMinus = new TH1F("fHistThetaLambdaXiMinus", "#theta of gen. #Lambda (Xi dghter); #theta_{#Lambda}; Number of #Lambda^0", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaLambdaXiMinus);\r
- }\r
- if (!fHistThetaBachXiMinus) {\r
- fHistThetaBachXiMinus = new TH1F("fHistThetaBachXiMinus", "#theta of gen. Bach.; #theta_{Bach}; Number of Bach.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBachXiMinus);\r
- }\r
- if (!fHistThetaMesDghterXiMinus) {\r
- fHistThetaMesDghterXiMinus = new TH1F("fHistThetaMesDghterXiMinus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaMesDghterXiMinus);\r
- }\r
- if (!fHistThetaBarDghterXiMinus) {\r
- fHistThetaBarDghterXiMinus = new TH1F("fHistThetaBarDghterXiMinus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBarDghterXiMinus);\r
- }\r
- // - Pt distribution (control plots)\r
- if (!fHistPtBachXiMinus) {\r
- fHistPtBachXiMinus = new TH1F("fHistPtBachXiMinus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBachXiMinus);\r
- }\r
- if (!fHistPtMesDghterXiMinus) {\r
- fHistPtMesDghterXiMinus = new TH1F("fHistPtMesDghterXiMinus", "p_{t} of gen. Meson #Lambda dghter; pt_{MesDght}; Number of Mes.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtMesDghterXiMinus);\r
- }\r
- if (!fHistPtBarDghterXiMinus) {\r
- fHistPtBarDghterXiMinus = new TH1F("fHistPtBarDghterXiMinus", "p_{t} of gen. Baryon #Lambda dghter; pt_{BarDght}; Number of Bar.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBarDghterXiMinus);\r
- }\r
- // - Xi+ \r
- // - Pseudo-Rapidity distribution\r
- if (!fHistEtaGenCascXiPlus) {\r
- fHistEtaGenCascXiPlus = new TH1F("fHistEtaGenCascXiPlus", "#eta of any gen. #Xi^{+}; #eta; Number of Casc", 200, -10, 10);\r
- fListHistCascade->Add(fHistEtaGenCascXiPlus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksXiPlus) {\r
- f3dHistGenPtVsGenYvsNtracksXiPlus = new TH3D("f3dHistGenPtVsGenYvsNtracksXiPlus", "MC P_{t} Vs MC Y of Gen #Xi^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiPlus);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYXiPlus) {\r
- f3dHistGenPtVsGenctauvsYXiPlus = new TH3D("f3dHistGenPtVsGenctauvsYXiPlus", "MC P_{t} Vs MC ctau Vs Yof Gen #Xi^{+}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiPlus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff) {\r
- f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff", "MC P_{t} Vs MC Y of Gen #Xi^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYXiPlusPhysEff) {\r
- f3dHistGenPtVsGenctauvsYXiPlusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYXiPlusPhysEff", "MC P_{t} Vs MC ctau Vs Yof Gen #Xi^{+}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiPlusPhysEff);\r
- }\r
- // - Info at the generation level of multi-strange particle\r
- if (!fHistThetaGenCascXiPlus) {\r
- fHistThetaGenCascXiPlus = new TH1F("fHistThetaGenCascXiPlus", "#theta of gen. #Xi^{+}; #theta; Number of Casc.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaGenCascXiPlus);\r
- }\r
- if (!f2dHistGenPtVsGenYFdblXiPlus) {\r
- f2dHistGenPtVsGenYFdblXiPlus = new TH2D("f2dHistGenPtVsGenYFdblXiPlus", "MC P_{t} Vs MC Y of findable Gen #Xi^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistGenPtVsGenYFdblXiPlus);\r
- }\r
- // - Theta distribution the daughters (control plots)\r
- if (!fHistThetaLambdaXiPlus) {\r
- fHistThetaLambdaXiPlus = new TH1F("fHistThetaLambdaXiPlus", "#theta of gen. #Lambda (Xi dghter); #theta_{#Lambda}; Number of #Lambda", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaLambdaXiPlus);\r
- }\r
- if (!fHistThetaBachXiPlus) {\r
- fHistThetaBachXiPlus = new TH1F("fHistThetaBachXiPlus", "#theta of gen. Bach.; #theta_{Bach}; Number of Bach.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBachXiPlus);\r
- }\r
- if (!fHistThetaMesDghterXiPlus) {\r
- fHistThetaMesDghterXiPlus = new TH1F("fHistThetaMesDghterXiPlus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaMesDghterXiPlus);\r
- }\r
- if (!fHistThetaBarDghterXiPlus) {\r
- fHistThetaBarDghterXiPlus = new TH1F("fHistThetaBarDghterXiPlus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBarDghterXiPlus);\r
- }\r
- // - Pt distribution (control plots)\r
- if (!fHistPtBachXiPlus) {\r
- fHistPtBachXiPlus = new TH1F("fHistPtBachXiPlus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBachXiPlus);\r
- }\r
- if (!fHistPtMesDghterXiPlus) {\r
- fHistPtMesDghterXiPlus = new TH1F("fHistPtMesDghterXiPlus", "p_{t} of gen. Meson #Lambda dghter; pt_{MesDght}; Number of Mes.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtMesDghterXiPlus);\r
- }\r
- if (!fHistPtBarDghterXiPlus) {\r
- fHistPtBarDghterXiPlus = new TH1F("fHistPtBarDghterXiPlus", "p_{t} of gen. Baryon #Lambda dghter); pt_{BarDght}; Number of Bar.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBarDghterXiPlus);\r
- }\r
- // - Omega- \r
- // - Pseudo-Rapidity distribution\r
- if (!fHistEtaGenCascOmegaMinus) {\r
- fHistEtaGenCascOmegaMinus = new TH1F("fHistEtaGenCascOmegaMinus", "#eta of any gen. #Omega^{-}; #eta; Number of Casc", 200, -10, 10);\r
- fListHistCascade->Add(fHistEtaGenCascOmegaMinus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksOmegaMinus) {\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinus = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaMinus", "MC P_{t} Vs MC Y of Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaMinus);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYOmegaMinus) {\r
- f3dHistGenPtVsGenctauvsYOmegaMinus = new TH3D("f3dHistGenPtVsGenctauvsYOmegaMinus", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{-} ", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaMinus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff) {\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff", "MC P_{t} Vs MC Y of Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff) {\r
- f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{-}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff);\r
- }\r
- // - Info at the generation level of multi-strange particle\r
- if (!fHistThetaGenCascOmegaMinus) {\r
- fHistThetaGenCascOmegaMinus = new TH1F("fHistThetaGenCascOmegaMinus", "#theta of gen. #Omega^{-}; #theta; Number of Casc.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaGenCascOmegaMinus);\r
- }\r
- if (!f2dHistGenPtVsGenYFdblOmegaMinus) {\r
- f2dHistGenPtVsGenYFdblOmegaMinus = new TH2D("f2dHistGenPtVsGenYFdblOmegaMinus", "MC P_{t} Vs MC Y of findable Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaMinus);\r
- }\r
- // - Theta distribution the daughters (control plots)\r
- if (!fHistThetaLambdaOmegaMinus) {\r
- fHistThetaLambdaOmegaMinus = new TH1F("fHistThetaLambdaOmegaMinus", "#theta of gen. #Lambda (Omega dghter); #theta_{#Lambda}; Number of #Lambda", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaLambdaOmegaMinus);\r
- }\r
- if (!fHistThetaBachOmegaMinus) {\r
- fHistThetaBachOmegaMinus = new TH1F("fHistThetaBachOmegaMinus", "#theta of gen. Bach.;#theta_{Bach};Number of Bach.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBachOmegaMinus);\r
- }\r
- if (!fHistThetaMesDghterOmegaMinus) {\r
- fHistThetaMesDghterOmegaMinus = new TH1F("fHistThetaMesDghterOmegaMinus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaMesDghterOmegaMinus);\r
- }\r
- if (!fHistThetaBarDghterOmegaMinus) {\r
- fHistThetaBarDghterOmegaMinus = new TH1F("fHistThetaBarDghterOmegaMinus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBarDghterOmegaMinus);\r
- }\r
- // - Pt distribution (control plots)\r
- if (!fHistPtBachOmegaMinus) {\r
- fHistPtBachOmegaMinus = new TH1F("fHistPtBachOmegaMinus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBachOmegaMinus);\r
- }\r
- if (!fHistPtMesDghterOmegaMinus) {\r
- fHistPtMesDghterOmegaMinus = new TH1F("fHistPtMesDghterOmegaMinus", "p_{t} of gen. Meson #Lambda dghter); pt_{MesDght}; Number of Mes.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtMesDghterOmegaMinus);\r
- }\r
- if (!fHistPtBarDghterOmegaMinus) {\r
- fHistPtBarDghterOmegaMinus = new TH1F("fHistPtBarDghterOmegaMinus", "p_{t} of gen. Baryon #Lambda dghter); pt_{BarDght}; Number of Bar.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBarDghterOmegaMinus);\r
- }\r
- // - Omega+ \r
- // - Pseudo-Rapidity distribution\r
- if (!fHistEtaGenCascOmegaPlus) {\r
- fHistEtaGenCascOmegaPlus = new TH1F("fHistEtaGenCascOmegaPlus", "#eta of any gen. #Omega^{+}; #eta; Number of Casc", 200, -10, 10);\r
- fListHistCascade->Add(fHistEtaGenCascOmegaPlus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksOmegaPlus) {\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlus = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaPlus", "MC P_{t} Vs MC Y of Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaPlus);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYOmegaPlus) {\r
- f3dHistGenPtVsGenctauvsYOmegaPlus = new TH3D("f3dHistGenPtVsGenctauvsYOmegaPlus", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{+} ", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaPlus);\r
- }\r
- if (!f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff) {\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff", "MC P_{t} Vs MC Y of Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);\r
- fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff);\r
- }\r
- if (!f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff) {\r
- f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{+}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);\r
- fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff);\r
- }\r
- // - Info at the generation level of multi-strange particle\r
- if (!fHistThetaGenCascOmegaPlus) {\r
- fHistThetaGenCascOmegaPlus = new TH1F("fHistThetaGenCascOmegaPlus", "#theta of gen. #Omega^{+}; #theta; Number of Casc.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaGenCascOmegaPlus);\r
- }\r
- if (!f2dHistGenPtVsGenYFdblOmegaPlus) {\r
- f2dHistGenPtVsGenYFdblOmegaPlus = new TH2D("f2dHistGenPtVsGenYFdblOmegaPlus", "MC P_{t} Vs MC Y of findable Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaPlus);\r
- }\r
- // - Info at the generation level of multi-strange particle\r
- if (!fHistThetaGenCascOmegaPlus) {\r
- fHistThetaGenCascOmegaPlus = new TH1F("fHistThetaGenCascOmegaPlus", "#theta of gen. #Omega^{+}; #theta; Number of Casc.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaGenCascOmegaPlus);\r
- }\r
- if (!f2dHistGenPtVsGenYFdblOmegaPlus) {\r
- f2dHistGenPtVsGenYFdblOmegaPlus = new TH2D("f2dHistGenPtVsGenYFdblOmegaPlus", "MC P_{t} Vs MC Y of findable Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaPlus);\r
- }\r
- // - Theta distribution the daughters (control plots)\r
- if (!fHistThetaLambdaOmegaPlus) {\r
- fHistThetaLambdaOmegaPlus = new TH1F("fHistThetaLambdaOmegaPlus", "#theta of gen. #Lambda (Omega dghter); #theta_{#Lambda}; Number of #Lambda", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaLambdaOmegaPlus);\r
- }\r
- if (!fHistThetaBachOmegaPlus) {\r
- fHistThetaBachOmegaPlus = new TH1F("fHistThetaBachOmegaPlus", "#theta of gen. Bach.; #theta_{Bach}; Number of Bach.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBachOmegaPlus);\r
- }\r
- if (!fHistThetaMesDghterOmegaPlus) {\r
- fHistThetaMesDghterOmegaPlus = new TH1F("fHistThetaMesDghterOmegaPlus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaMesDghterOmegaPlus);\r
- }\r
- if (!fHistThetaBarDghterOmegaPlus) {\r
- fHistThetaBarDghterOmegaPlus = new TH1F("fHistThetaBarDghterOmegaPlus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);\r
- fListHistCascade->Add(fHistThetaBarDghterOmegaPlus);\r
- }\r
- // - Pt distribution (control plots)\r
- if (!fHistPtBachOmegaPlus) {\r
- fHistPtBachOmegaPlus = new TH1F("fHistPtBachOmegaPlus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBachOmegaPlus);\r
- }\r
- if (!fHistPtMesDghterOmegaPlus) {\r
- fHistPtMesDghterOmegaPlus = new TH1F("fHistPtMesDghterOmegaPlus", "p_{t} of gen. Meson #Lambda dghter; pt_{MesDght}; Number of Mes.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtMesDghterOmegaPlus);\r
- }\r
- if (!fHistPtBarDghterOmegaPlus) {\r
- fHistPtBarDghterOmegaPlus = new TH1F("fHistPtBarDghterOmegaPlus", "p_{t} of gen. Baryon #Lambda dghter); pt_{BarDght}; Number of Bar.", 200, 0, 10);\r
- fListHistCascade->Add(fHistPtBarDghterOmegaPlus);\r
- }\r
- \r
- //-------------------------------------------------------------------------\r
- // - Any reconstructed cascades + reconstructed cascades associated with MC\r
- \r
- // - Multiplicity cascde plots\r
- fHistnAssoXiMinus= new TH1F("fHistnAssoXiMinus", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnAssoXiMinus);\r
- fHistnAssoXiPlus= new TH1F("fHistnAssoXiPlus", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnAssoXiPlus);\r
- fHistnAssoOmegaMinus= new TH1F("fHistnAssoOmegaMinus", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnAssoOmegaMinus);\r
- fHistnAssoOmegaPlus= new TH1F("fHistnAssoOmegaPlus", "", 25, 0, 25);\r
- fListHistCascade->Add(fHistnAssoOmegaPlus);\r
- // - Effective mass histos for cascades candidates. \r
- if (! fHistMassXiMinus) {\r
- fHistMassXiMinus = new TH1F("fHistMassXiMinus","#Xi^{-} candidates; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassXiMinus);\r
- }\r
- if (! fHistMassXiPlus) {\r
- fHistMassXiPlus = new TH1F("fHistMassXiPlus","#Xi^{+} candidates; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassXiPlus);\r
- }\r
- if (! fHistMassOmegaMinus) {\r
- fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus","#Omega^{-} candidates; M( #Lambda , K^{-} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassOmegaMinus);\r
- } \r
- if (! fHistMassOmegaPlus) {\r
- fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus","#Omega^{+} candidates; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassOmegaPlus);\r
- }\r
- // - Effective mass histos with combined PID\r
- if (! fHistMassWithCombPIDXiMinus) {\r
- fHistMassWithCombPIDXiMinus = new TH1F("fHistMassWithCombPIDXiMinus","#Xi^{-} candidates, with Bach. comb. PID; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassWithCombPIDXiMinus);\r
- }\r
- if (! fHistMassWithCombPIDXiPlus) {\r
- fHistMassWithCombPIDXiPlus = new TH1F("fHistMassWithCombPIDXiPlus","#Xi^{+} candidates, with Bach. comb. PID; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassWithCombPIDXiPlus);\r
- }\r
- if (! fHistMassWithCombPIDOmegaMinus) {\r
- fHistMassWithCombPIDOmegaMinus = new TH1F("fHistMassWithCombPIDOmegaMinus","#Omega^{-} candidates, with Bach. comb. PID; M( #Lambda , K^{-} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassWithCombPIDOmegaMinus);\r
- }\r
- if (! fHistMassWithCombPIDOmegaPlus) {\r
- fHistMassWithCombPIDOmegaPlus = new TH1F("fHistMassWithCombPIDOmegaPlus","#Omega^{+} candidates, with Bach. comb. PID; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassWithCombPIDOmegaPlus);\r
- }\r
- // - PID Probability versus MC Pt(bachelor track)\r
- if (! f2dHistPIDprobaKaonVsMCPtBach ){\r
- f2dHistPIDprobaKaonVsMCPtBach = new TH2F("f2dHistPIDprobaKaonVsMCPtBach", "Comb. PID proba to be K^{#pm} Vs MC Bach. Pt; Pt_{MC}(Bach.) (GeV/c); Comb. PID Proba (Bach. = K^{#pm})", 100, 0.0, 5.0, 110, 0.0, 1.10);\r
- fListHistCascade->Add(f2dHistPIDprobaKaonVsMCPtBach);\r
- }\r
- if(! f2dHistPIDprobaPionVsMCPtBach ){\r
- f2dHistPIDprobaPionVsMCPtBach = new TH2F("f2dHistPIDprobaPionVsMCPtBach", "Comb. PID proba to be #pi^{#pm} Vs MC Bach. Pt; Pt_{MC}(Bach.) (GeV/c); Comb. PID Proba (Bach. = #pi^{#pm})", 100, 0.0, 5.0, 110, 0.0, 1.10);\r
- fListHistCascade->Add(f2dHistPIDprobaPionVsMCPtBach);\r
- }\r
- // - Effective mass histos with perfect MC PID on the bachelor\r
- if (! fHistMassWithMcPIDXiMinus) {\r
- fHistMassWithMcPIDXiMinus = new TH1F("fHistMassWithMcPIDXiMinus", "#Xi^{-} candidates, with Bach. MC PID; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassWithMcPIDXiMinus);\r
- }\r
- if (! fHistMassWithMcPIDXiPlus) {\r
- fHistMassWithMcPIDXiPlus = new TH1F("fHistMassWithMcPIDXiPlus", "#Xi^{+} candidates, with Bach. MC PID; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistMassWithMcPIDXiPlus);\r
- }\r
- if (! fHistMassWithMcPIDOmegaMinus) {\r
- fHistMassWithMcPIDOmegaMinus = new TH1F("fHistMassWithMcPIDOmegaMinus", "#Omega^{-} candidates, with Bach. MC PID; M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassWithMcPIDOmegaMinus);\r
- }\r
- if (! fHistMassWithMcPIDOmegaPlus) {\r
- fHistMassWithMcPIDOmegaPlus = new TH1F("fHistMassWithMcPIDOmegaPlus", "#Omega^{+} candidates, with Bach. MC PID; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistMassWithMcPIDOmegaPlus);\r
- }\r
- // - Effective mass histos for cascades candidates ASSOCIATED with MC.\r
- if (! fHistAsMCMassXiMinus) {\r
- fHistAsMCMassXiMinus = new TH1F("fHistAsMCMassXiMinus", "#Xi^{-} candidates associated to MC; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistAsMCMassXiMinus);\r
- }\r
- if (! fHistAsMCMassXiPlus) {\r
- fHistAsMCMassXiPlus = new TH1F("fHistAsMCMassXiPlus", "#Xi^{+} candidates associated to MC; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);\r
- fListHistCascade->Add(fHistAsMCMassXiPlus);\r
- }\r
- if (! fHistAsMCMassOmegaMinus) {\r
- fHistAsMCMassOmegaMinus = new TH1F("fHistAsMCMassOmegaMinus", "#Omega^{-} candidates associated to MC; M( #Lambda , K^{-} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistAsMCMassOmegaMinus);\r
- }\r
- if (! fHistAsMCMassOmegaPlus) {\r
- fHistAsMCMassOmegaPlus = new TH1F("fHistAsMCMassOmegaPlus", "#Omega^{+} candidates associated to MC; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);\r
- fListHistCascade->Add(fHistAsMCMassOmegaPlus);\r
- }\r
- // - Generated Pt Vs generated Y of the cascade candidates associated with MC + having the proper maximum proba of combined PID for the bachelor\r
- if (!f2dHistAsMCandCombPIDGenPtVsGenYXiMinus) {\r
- f2dHistAsMCandCombPIDGenPtVsGenYXiMinus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYXiMinus", "MC P_{t} Vs MC Y of #Xi^{-} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYXiMinus);\r
- }\r
- if (!f2dHistAsMCandCombPIDGenPtVsGenYXiPlus) {\r
- f2dHistAsMCandCombPIDGenPtVsGenYXiPlus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYXiPlus", "MC P_{t} Vs MC Y of #Xi^{+} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYXiPlus);\r
- } \r
- if (!f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus) {\r
- f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus", "MC P_{t} Vs MC Y of #Omega^{-} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus);\r
- }\r
- if (!f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus) {\r
- f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus", "MC P_{t} Vs MC Y of #Omega^{+} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus);\r
- }\r
- // - Generated Pt Vs Generated Y, for the cascade candidates associated with MC\r
- if (!f2dHistAsMCGenPtVsGenYXiMinus) {\r
- f2dHistAsMCGenPtVsGenYXiMinus = new TH2F("f2dHistAsMCGenPtVsGenYXiMinus", "MC P_{t} Vs MC Y of gen. #Xi^{-} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCGenPtVsGenYXiMinus );\r
- }\r
- if (!f2dHistAsMCGenPtVsGenYXiPlus) {\r
- f2dHistAsMCGenPtVsGenYXiPlus = new TH2F("f2dHistAsMCGenPtVsGenYXiPlus", "MC P_{t} Vs MC Y of gen. #Xi^{+} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCGenPtVsGenYXiPlus );\r
- }\r
- if (!f2dHistAsMCGenPtVsGenYOmegaMinus) {\r
- f2dHistAsMCGenPtVsGenYOmegaMinus = new TH2F("f2dHistAsMCGenPtVsGenYOmegaMinus", "MC P_{t} Vs MC Y of gen. #Omega^{-} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCGenPtVsGenYOmegaMinus );\r
- }\r
- if (!f2dHistAsMCGenPtVsGenYOmegaPlus) {\r
- f2dHistAsMCGenPtVsGenYOmegaPlus = new TH2F("f2dHistAsMCGenPtVsGenYOmegaPlus", "MC P_{t} Vs MC Y of gen. #Omega^{+} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);\r
- fListHistCascade->Add(f2dHistAsMCGenPtVsGenYOmegaPlus );\r
- } \r
- // - Generated Eta of the the cascade candidates associated with MC\r
- if (!fHistAsMCGenEtaXiMinus) {\r
- fHistAsMCGenEtaXiMinus = new TH1F("fHistAsMCGenEtaXiMinus", "#eta of gen. #Xi^{-} (associated); #eta; Count", 100, -5, 5);\r
- fListHistCascade->Add( fHistAsMCGenEtaXiMinus );\r
- }\r
- if (!fHistAsMCGenEtaXiPlus) {\r
- fHistAsMCGenEtaXiPlus = new TH1F("fHistAsMCGenEtaXiPlus", "#eta of gen. #Xi^{+} (associated); #eta; Count", 100, -5, 5);\r
- fListHistCascade->Add( fHistAsMCGenEtaXiPlus );\r
- }\r
- if (!fHistAsMCGenEtaOmegaMinus) {\r
- fHistAsMCGenEtaOmegaMinus = new TH1F("fHistAsMCGenEtaOmegaMinus", "#eta of gen. #Omega^{-} (associated);#eta;Number of Casc", 100, -5, 5);\r
- fListHistCascade->Add( fHistAsMCGenEtaOmegaMinus );\r
- }\r
- if (!fHistAsMCGenEtaOmegaPlus) {\r
- fHistAsMCGenEtaOmegaPlus = new TH1F("fHistAsMCGenEtaOmegaPlus", "#eta of gen. #Omega^{+} (associated); #eta; Count", 100, -5, 5);\r
- fListHistCascade->Add( fHistAsMCGenEtaOmegaPlus );\r
- }\r
- // - Resolution in Pt as function of generated Pt\r
- if (! f2dHistAsMCResPtXiMinus) {\r
- f2dHistAsMCResPtXiMinus = new TH2F("f2dHistAsMCResPtXiMinus", "Resolution in Pt reconstruction for #Xi^{-}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);\r
- fListHistCascade->Add(f2dHistAsMCResPtXiMinus);\r
- }\r
- if (! f2dHistAsMCResPtXiPlus) {\r
- f2dHistAsMCResPtXiPlus = new TH2F("f2dHistAsMCResPtXiPlus", "Resolution in Pt reconstruction for #Xi^{+}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);\r
- fListHistCascade->Add(f2dHistAsMCResPtXiPlus);\r
- }\r
- if (! f2dHistAsMCResPtOmegaMinus) {\r
- f2dHistAsMCResPtOmegaMinus = new TH2F("f2dHistAsMCResPtOmegaMinus", "Resolution in Pt reconstruction for #Omega^{-}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);\r
- fListHistCascade->Add(f2dHistAsMCResPtOmegaMinus);\r
- }\r
- if (! f2dHistAsMCResPtOmegaPlus) {\r
- f2dHistAsMCResPtOmegaPlus = new TH2F("f2dHistAsMCResPtOmegaPlus", "Resolution in Pt reconstruction for #Omega^{+}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);\r
- fListHistCascade->Add(f2dHistAsMCResPtOmegaPlus);\r
- }\r
- // - Resolution in R(2D) as function of generated R\r
- if (! f2dHistAsMCResRXiMinus) {\r
- f2dHistAsMCResRXiMinus = new TH2F("f2dHistAsMCResRXiMinus", "Resolution in transv. position for #Xi^{-}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);\r
- fListHistCascade->Add(f2dHistAsMCResRXiMinus);\r
- }\r
- if (! f2dHistAsMCResRXiPlus) {\r
- f2dHistAsMCResRXiPlus = new TH2F("f2dHistAsMCResRXiPlus", "Resolution in transv. position for #Xi^{+}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);\r
- fListHistCascade->Add(f2dHistAsMCResRXiPlus);\r
- } \r
- if (! f2dHistAsMCResROmegaMinus) {\r
- f2dHistAsMCResROmegaMinus = new TH2F("f2dHistAsMCResROmegaMinus", "Resolution in transv. position for #Omega^{-}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);\r
- fListHistCascade->Add(f2dHistAsMCResROmegaMinus);\r
- }\r
- if (! f2dHistAsMCResROmegaPlus) {\r
- f2dHistAsMCResROmegaPlus = new TH2F("f2dHistAsMCResROmegaPlus", "Resolution in transv. position for #Omega^{+}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);\r
- fListHistCascade->Add(f2dHistAsMCResROmegaPlus);\r
- }\r
- // - Resolution in phi as function of generated Pt \r
- if (! f2dHistAsMCResPhiXiMinus) {\r
- f2dHistAsMCResPhiXiMinus = new TH2F("f2dHistAsMCResPhiXiMinus", "Resolution in #phi for #Xi^{-}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);\r
- fListHistCascade->Add(f2dHistAsMCResPhiXiMinus);\r
- }\r
- if (! f2dHistAsMCResPhiXiPlus) {\r
- f2dHistAsMCResPhiXiPlus = new TH2F("f2dHistAsMCResPhiXiPlus", "Resolution in #phi for #Xi^{+}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);\r
- fListHistCascade->Add(f2dHistAsMCResPhiXiPlus);\r
- }\r
- if (! f2dHistAsMCResPhiOmegaMinus) {\r
- f2dHistAsMCResPhiOmegaMinus = new TH2F("f2dHistAsMCResPhiOmegaMinus", "Resolution in #phi for #Omega^{-}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.); \r
- fListHistCascade->Add(f2dHistAsMCResPhiOmegaMinus);\r
- }\r
- if (! f2dHistAsMCResPhiOmegaPlus) {\r
- f2dHistAsMCResPhiOmegaPlus = new TH2F("f2dHistAsMCResPhiOmegaPlus", "Resolution in #phi for #Omega^{+}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);\r
- fListHistCascade->Add(f2dHistAsMCResPhiOmegaPlus);\r
- }\r
- // - Correlation between proton (antiproton) daughter MC pt and Xi/Omega MC pt (to apply Geant/Fluka correction)\r
- if (!f2dHistAsMCptProtonMCptXiMinus) {\r
- f2dHistAsMCptProtonMCptXiMinus = new TH2F("f2dHistAsMCptProtonMCptXiMinus", "Proton MC pt vs Xi- MC pt", 100, 0., 10., 100, 0., 10.); \r
- fListHistCascade->Add(f2dHistAsMCptProtonMCptXiMinus);\r
- }\r
- if (!f2dHistAsMCptAntiprotonMCptXiPlus) {\r
- f2dHistAsMCptAntiprotonMCptXiPlus = new TH2F("f2dHistAsMCptAntiprotonMCptXiPlus", "Antiproton MC pt vs Xi+ MC pt", 100, 0., 10., 100, 0., 10.);\r
- fListHistCascade->Add(f2dHistAsMCptAntiprotonMCptXiPlus);\r
- }\r
- if (!f2dHistAsMCptProtonMCptOmegaMinus) {\r
- f2dHistAsMCptProtonMCptOmegaMinus = new TH2F("f2dHistAsMCptProtonMCptOmegaMinus", "Proton MC pt vs Omega- MC pt", 100, 0., 10., 100, 0., 10.);\r
- fListHistCascade->Add(f2dHistAsMCptProtonMCptOmegaMinus);\r
- }\r
- if (!f2dHistAsMCptAntiprotonMCptOmegaPlus) {\r
- f2dHistAsMCptAntiprotonMCptOmegaPlus = new TH2F("f2dHistAsMCptAntiprotonMCptOmegaPlus", "Antiproton MC pt vs Omega+ MC pt", 100, 0., 10., 100, 0., 10.);\r
- fListHistCascade->Add(f2dHistAsMCptAntiprotonMCptOmegaPlus);\r
- }\r
- // - Cosine of Pointing angle\r
- if (! fHistV0toXiCosineOfPointingAngle) {\r
- fHistV0toXiCosineOfPointingAngle = new TH1F("fHistV0toXiCosineOfPointingAngle", "Cos. of V0 Ptng Angl / Xi vtx ; Cos(V0 Point. Angl / Xi vtx); Counts", 200, 0.95, 1.0001);\r
- fListHistCascade->Add(fHistV0toXiCosineOfPointingAngle);\r
- }\r
- if (! fHistV0CosineOfPointingAnglevsPtXi) {\r
- fHistV0CosineOfPointingAnglevsPtXi = new TH2F("fHistV0CosineOfPointingAnglevsPtXi", "Cos. of V0 Ptng Angl vs cascade Pt; Cos(V0 Point. Angl); Counts", 100, 0., 10., 200, 0.95, 1.0001);\r
- fListHistCascade->Add(fHistV0CosineOfPointingAnglevsPtXi);\r
- }\r
- if (! fHistV0CosineOfPointingAnglevsPtOmega) {\r
- fHistV0CosineOfPointingAnglevsPtOmega = new TH2F("fHistV0CosineOfPointingAnglevsPtOmega", "Cos. of V0 Ptng Angl vs cascade Pt; Cos(V0 Point. Angl); Counts", 100, 0., 10., 200, 0.95, 1.0001);\r
- fListHistCascade->Add(fHistV0CosineOfPointingAnglevsPtOmega);\r
- }\r
-\r
- //--------------\r
- // - CFContainer\r
- // PID container Xi-\r
- if(! fCFContCascadePIDAsXiMinus) {\r
- const Int_t lNbSteps = 7;\r
- const Int_t lNbVariables = 3;\r
- //Array for the number of bins in each dimension:\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 800;\r
- lNbBinsPerVar[2] = 22;\r
- fCFContCascadePIDAsXiMinus = new AliCFContainer(Form("fCFContCascadePIDAsXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDAsXiMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDAsXiMinus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass\r
- fCFContCascadePIDAsXiMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity\r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDAsXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");\r
- //Setting the variable title, per axis\r
- fCFContCascadePIDAsXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDAsXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");\r
- fCFContCascadePIDAsXiMinus->SetVarTitle(2, "Y_{#Xi}");\r
- fListHistCascade->Add(fCFContCascadePIDAsXiMinus); \r
- }\r
- // PID container Xi+\r
- if(! fCFContCascadePIDAsXiPlus) {\r
- const Int_t lNbSteps = 7;\r
- const Int_t lNbVariables = 3;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 800;\r
- lNbBinsPerVar[2] = 22;\r
- fCFContCascadePIDAsXiPlus = new AliCFContainer(Form("fCFContCascadePIDAsXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits (valid for v4-18-10-AN)\r
- fCFContCascadePIDAsXiPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDAsXiPlus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass\r
- fCFContCascadePIDAsXiPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity \r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDAsXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson"); \r
- //Setting the variable title, per axis\r
- fCFContCascadePIDAsXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDAsXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");\r
- fCFContCascadePIDAsXiPlus->SetVarTitle(2, "Y_{#Xi}");\r
- fListHistCascade->Add(fCFContCascadePIDAsXiPlus);\r
- }\r
- // PID container Omega-\r
- if(! fCFContCascadePIDAsOmegaMinus) {\r
- const Int_t lNbSteps = 7;\r
- const Int_t lNbVariables = 3;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3] = {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 1000;\r
- lNbBinsPerVar[2] = 22;\r
- fCFContCascadePIDAsOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDAsOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDAsOmegaMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDAsOmegaMinus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass\r
- fCFContCascadePIDAsOmegaMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity\r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDAsOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");\r
- //Setting the variable title, per axis\r
- fCFContCascadePIDAsOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDAsOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");\r
- fCFContCascadePIDAsOmegaMinus->SetVarTitle(2, "Y_{#Omega}");\r
- fListHistCascade->Add(fCFContCascadePIDAsOmegaMinus);\r
- }\r
- // PID container Omega+\r
- if(! fCFContCascadePIDAsOmegaPlus) {\r
- const Int_t lNbSteps = 7;\r
- const Int_t lNbVariables = 3;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[3]= {0};\r
- lNbBinsPerVar[0] = 100;\r
- lNbBinsPerVar[1] = 1000;\r
- lNbBinsPerVar[2] = 22; \r
- fCFContCascadePIDAsOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDAsOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- fCFContCascadePIDAsOmegaPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)\r
- fCFContCascadePIDAsOmegaPlus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass\r
- fCFContCascadePIDAsOmegaPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity\r
- //Setting the step title : one per PID case\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(0, "No PID");\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");\r
- fCFContCascadePIDAsOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");\r
- //Setting the variable title, per axis\r
- fCFContCascadePIDAsOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");\r
- fCFContCascadePIDAsOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");\r
- fCFContCascadePIDAsOmegaPlus->SetVarTitle(2, "Y_{#Omega}");\r
- fListHistCascade->Add(fCFContCascadePIDAsOmegaPlus);\r
- }\r
- // Container for optimisation of topological selections \r
- if(! fCFContAsCascadeCuts){\r
- // Container meant to store all the relevant distributions corresponding to the cut variables.\r
- // - NB overflow/underflow of variables on which we want to cut later should be 0!!!\r
- const Int_t lNbSteps = 4;\r
- const Int_t lNbVariables = 19;\r
- //Array for the number of bins in each dimension :\r
- Int_t lNbBinsPerVar[lNbVariables] = {0};\r
- lNbBinsPerVar[0] = 25; //DcaCascDaughters : [0.0,2.,3.0] -> Rec.Cut = 2.0; \r
- lNbBinsPerVar[1] = 25; //DcaBachToPrimVertex : [0.0,0.24,100.0] -> Rec.Cur = 0.01;\r
- lNbBinsPerVar[2] = 60; //CascCosineOfPointingAngle : [0.94,1.0] -> Rec.Cut = 0.95;\r
- //lNbBinsPerVar[2] = 30; //CascCosineOfPointingAngle : [0.97,1.] -> Rec.Cut = 0.98;\r
- lNbBinsPerVar[3] = 40; //CascRadius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;\r
- lNbBinsPerVar[4] = 30; //InvMassLambdaAsCascDghter : [1.1,1.3] -> Rec.Cut = 0.008;\r
- lNbBinsPerVar[5] = 20; //DcaV0Daughters : [0.0,2.0] -> Rec.Cut = 1.5;\r
- lNbBinsPerVar[6] = 201; //V0CosineOfPointingAngle : [0.89,1.0] -> Rec.Cut = 0.9;\r
- lNbBinsPerVar[7] = 40; //V0Radius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;\r
- lNbBinsPerVar[8] = 40; //DcaV0ToPrimVertex : [0.0,0.39,110.0] -> Rec.Cut = 0.01;\r
- lNbBinsPerVar[9] = 25; //DcaPosToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.05;\r
- lNbBinsPerVar[10] = 25; //DcaNegToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.05;\r
- lNbBinsPerVar[11] = 150; //InvMassXi : 2-MeV/c2 bins\r
- lNbBinsPerVar[12] = 120; //InvMassOmega : 2-MeV/c2 bins\r
- lNbBinsPerVar[13] = 100; //CascTransvMom : [0.0,10.0]\r
- lNbBinsPerVar[14] = 110; //Y(Xi) : 0.02 unit of y per bin \r
- lNbBinsPerVar[15] = 110; //Y(Omega) : 0.02 unit of y per bin\r
- lNbBinsPerVar[16] = 112; //Proper lenght of cascade\r
- lNbBinsPerVar[17] = 112; //Proper lenght of V0 \r
- lNbBinsPerVar[18] = 112; //Distance V0-Xi in the transverse plane \r
- fCFContAsCascadeCuts = new AliCFContainer(Form("fCFContAsCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Cut Container for Asso. Cascades", lNbSteps, lNbVariables, lNbBinsPerVar );\r
- //Setting the bin limits \r
- //0 - DcaCascDaughters\r
- Double_t *lBinLim0 = new Double_t[ lNbBinsPerVar[0]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[0]; i++) lBinLim0[i] = (Double_t)0.0 + (2.4 -0.0)/(lNbBinsPerVar[0] - 1) * (Double_t)i;\r
- lBinLim0[ lNbBinsPerVar[0] ] = 3.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(0, lBinLim0);\r
- delete[] lBinLim0;\r
- //1 - DcaBachToPrimVertex\r
- Double_t *lBinLim1 = new Double_t[ lNbBinsPerVar[1]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[1]; i++) lBinLim1[i] = (Double_t)0.0 + (0.24 - 0.0)/(lNbBinsPerVar[1] - 1) * (Double_t)i;\r
- lBinLim1[ lNbBinsPerVar[1] ] = 100.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(1, lBinLim1);\r
- delete [] lBinLim1;\r
- //2 - CascCosineOfPointingAngle\r
- fCFContAsCascadeCuts -> SetBinLimits(2, .94, 1.); \r
- //3 - CascRadius\r
- Double_t *lBinLim3 = new Double_t[ lNbBinsPerVar[3]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[3]; i++) lBinLim3[i] = (Double_t)0.0 + (3.9 -0.0)/(lNbBinsPerVar[3] - 1) * (Double_t)i;\r
- lBinLim3[ lNbBinsPerVar[3] ] = 1000.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(3, lBinLim3);\r
- delete[] lBinLim3;\r
- //4 - InvMassLambdaAsCascDghter\r
- fCFContAsCascadeCuts->SetBinLimits(4, 1.1, 1.13); \r
- //5 - DcaV0Daughters\r
- fCFContAsCascadeCuts->SetBinLimits(5, 0., 2.); \r
- //6 - V0CosineOfPointingAngle\r
- fCFContAsCascadeCuts->SetBinLimits(6, 0.8, 1.001);\r
- //7 - V0Radius\r
- Double_t *lBinLim7 = new Double_t[ lNbBinsPerVar[7]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[7]; i++) lBinLim7[i] = (Double_t)0.0 + (3.9 - 0.0)/(lNbBinsPerVar[7] - 1) * (Double_t)i ;\r
- lBinLim7[ lNbBinsPerVar[7] ] = 1000.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(7, lBinLim7);\r
- delete [] lBinLim7; \r
- //8 - DcaV0ToPrimVertexXi : 0. to 0.4 \r
- Double_t *lBinLim8 = new Double_t[ lNbBinsPerVar[8]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[8]; i++) lBinLim8[i] = (Double_t)0.0 + (0.39 - 0.0)/(lNbBinsPerVar[8] - 1) * (Double_t)i ;\r
- lBinLim8[ lNbBinsPerVar[8] ] = 100.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(8, lBinLim8);\r
- delete [] lBinLim8; \r
- //9 - DcaPosToPrimVertexXi\r
- Double_t *lBinLim9 = new Double_t[ lNbBinsPerVar[9]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[9]; i++) lBinLim9[i] = (Double_t)0.0 + (0.24 - 0.0)/(lNbBinsPerVar[9] - 1) * (Double_t)i;\r
- lBinLim9[ lNbBinsPerVar[9] ] = 100.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(9, lBinLim9);\r
- delete [] lBinLim9; \r
- //10 - DcaNegToPrimVertexXi\r
- Double_t *lBinLim10 = new Double_t[ lNbBinsPerVar[10]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[10]; i++) lBinLim10[i] = (Double_t)0.0 + (0.24 - 0.0 )/(lNbBinsPerVar[10] - 1) * (Double_t)i;\r
- lBinLim10[ lNbBinsPerVar[10] ] = 100.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(10, lBinLim10);\r
- delete [] lBinLim10; \r
- //11 - InvMassXi\r
- fCFContAsCascadeCuts -> SetBinLimits(11, 1.25, 1.40);\r
- //12 - InvMassOmega\r
- fCFContAsCascadeCuts -> SetBinLimits(12, 1.62, 1.74);\r
- //13 - XiTransvMom \r
- fCFContAsCascadeCuts -> SetBinLimits(13, 0.0, 10.0);\r
- //14 - Y(Xi) \r
- fCFContAsCascadeCuts -> SetBinLimits(14, -1.1, 1.1);\r
- //15 - Y(Omega)\r
- fCFContAsCascadeCuts -> SetBinLimits(15, -1.1, 1.1); \r
- //16 - Proper time cascade \r
- Double_t *lBinLim16 = new Double_t[ lNbBinsPerVar[16]+1 ];\r
- for(Int_t i=0; i<lNbBinsPerVar[16]; i++) lBinLim16[i] = (Double_t)-1. + (110. + 1.0 )/(lNbBinsPerVar[16] - 1) * (Double_t)i;\r
- lBinLim16[ lNbBinsPerVar[16] ] = 2000.0;\r
- fCFContAsCascadeCuts -> SetBinLimits(16, lBinLim16);\r
- //17 - Proper time V0 \r
- fCFContAsCascadeCuts -> SetBinLimits(17, lBinLim16);\r
- //18 - Distance V0-Xi in the transverse plane\r
- fCFContAsCascadeCuts -> SetBinLimits(18, lBinLim16);\r
- delete [] lBinLim16;\r
- // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)\r
- fCFContAsCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates associated to MC");\r
- fCFContAsCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates associated to MC");\r
- fCFContAsCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates associated to MC");\r
- fCFContAsCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates associated to MC");\r
- // Setting the variable title, per axis\r
- fCFContAsCascadeCuts->SetVarTitle(0, "DCA(cascade daughters) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(1, "ImpactParamToPV(bachelor) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(2, "cos(cascade PA)");\r
- fCFContAsCascadeCuts->SetVarTitle(3, "R_{2d}(cascade decay) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(4, "M_{#Lambda}(as casc dghter) (GeV/c^{2})");\r
- fCFContAsCascadeCuts->SetVarTitle(5, "DCA(V0 daughters) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(6, "cos(V0 PA) in cascade");\r
- fCFContAsCascadeCuts->SetVarTitle(7, "R_{2d}(V0 decay) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(8, "ImpactParamToPV(V0) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(9, "ImpactParamToPV(Pos) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(10, "ImpactParamToPV(Neg) (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");\r
- fCFContAsCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");\r
- fCFContAsCascadeCuts->SetVarTitle(13, "Pt_{MC}(cascade) (GeV/c)");\r
- fCFContAsCascadeCuts->SetVarTitle(14, "Y_{MC}(Xi)");\r
- fCFContAsCascadeCuts->SetVarTitle(15, "Y_{MC}(Omega)");\r
- fCFContAsCascadeCuts->SetVarTitle(16, "mL/p cascade (cm)");\r
- fCFContAsCascadeCuts->SetVarTitle(17, "mL/p V0 (cm)"); \r
- fCFContAsCascadeCuts->SetVarTitle(18, "Distance V0-Cascade in the transverse plane (cm)");\r
- fListHistCascade->Add(fCFContAsCascadeCuts);\r
- }\r
-\r
- PostData(1, fListHistCascade); \r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
-\r
-}// end CreateOutputObjects\r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskCheckPerformanceCascadepp276::UserExec(Option_t *) {\r
- \r
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
- // Main loop (called for each event)\r
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
- \r
- //------------------\r
- // - Define variables\r
- AliESDEvent *lESDevent = 0x0;\r
- AliAODEvent *lAODevent = 0x0;\r
- AliMCEvent *lMCevent = 0x0; \r
- AliStack *lMCstack = 0x0; \r
- TClonesArray *arrayMC = 0;\r
-\r
- //-------------------------\r
- // - Check the PID response\r
- if (!fPIDResponse) {\r
- AliError("Cannot get pid response");\r
- return;\r
- }\r
-\r
-\r
- ////////////////// \r
- // Event selection \r
- //////////////////\r
- // In order:\r
- // 1) SDD selection\r
- // 2) Physics selection\r
- // 3) Select only looking at events with well-established PV\r
- // 4) Pileup selection\r
- // 5) |Z| < 10 cm\r
- \r
- //---------------------------------------------------------\r
- // Load the InputEvent and check it (for the ESD and AOD)\r
- if (fAnalysisType == "ESD") {\r
- lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );\r
- if (!lESDevent) {\r
- Printf("ERROR: lESDevent not available \n");\r
- cout << "Name of the file with pb :" << CurrentFileName() << endl; \r
- return;\r
- }\r
- lMCevent = MCEvent();\r
- if (!lMCevent) {\r
- Printf("ERROR: Could not retrieve MC event \n");\r
- cout << "Name of the file with pb :" << CurrentFileName() << endl;\r
- return;\r
- }\r
- lMCstack = lMCevent->Stack();\r
- if (!lMCstack) {\r
- Printf("ERROR: Could not retrieve MC stack \n");\r
- cout << "Name of the file with pb :" << CurrentFileName() << endl;\r
- return;\r
- }\r
- // - Cascade vertexer (ESD)\r
- // Relaunch V0 and Cascade vertexer\r
- if (fkRerunV0CascVertexers) { \r
- lESDevent->ResetCascades();\r
- lESDevent->ResetV0s();\r
- AliV0vertexer *lV0vtxer = new AliV0vertexer();\r
- AliCascadeVertexer *lCascVtxer = new AliCascadeVertexer();\r
- //lV0vtxer->GetCuts(fV0Sels);\r
- //lCascVtxer->GetCuts(fCascSels);\r
- lV0vtxer->SetCuts(fV0Sels); // NB don't use SetDefaultCuts!! because it acts on static variables \r
- lCascVtxer->SetCuts(fCascSels);\r
- lV0vtxer->Tracks2V0vertices(lESDevent);\r
- lCascVtxer->V0sTracks2CascadeVertices(lESDevent);\r
- //delete lV0vtxer;\r
- //delete lCascVtxer; \r
- //---\r
- //lESDevent->ResetCascades();\r
- //lESDevent->ResetV0s();\r
- //AliV0vertexer lV0vtxer;\r
- //AliCascadeVertexer lCascVtxer;\r
- //lV0vtxer.SetCuts(fV0Sels);\r
- //lCascVtxer.SetCuts(fCascSels);\r
- //lV0vtxer.Tracks2V0vertices(lESDevent);\r
- //lCascVtxer.V0sTracks2CascadeVertices(lESDevent);\r
- }\r
- } else if (fAnalysisType == "AOD") { \r
- lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() ); \r
- if (!lAODevent) {\r
- Printf("ERROR: lAODevent not available \n");\r
- cout << "Name of the file with pb :" << CurrentFileName() << endl;\r
- return;\r
- }\r
- arrayMC = (TClonesArray*) lAODevent->GetList()->FindObject(AliAODMCParticle::StdBranchName());\r
- if (!arrayMC) AliFatal("Error: MC particles branch not found!\n");\r
- } else {\r
- Printf("Analysis type (ESD or AOD) not specified \n");\r
- return;\r
- }\r
-\r
- //------------------------------\r
- // - Plots Before any selections\r
- //------------------------------\r
- // - Define variables\r
- Int_t ncascadesBeforeAnySel = -1; //number of cascades before any selections\r
- Int_t nTrackMultiplicityBeforeAnySel = -1; //number of tracks before any selections\r
- if (fAnalysisType == "ESD") {\r
- //Multiplicity\r
- Int_t lMultiplicity = -100;\r
- lMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC, 0.5);\r
- nTrackMultiplicityBeforeAnySel = lMultiplicity;\r
- ncascadesBeforeAnySel = lESDevent->GetNumberOfCascades();\r
- } else if (fAnalysisType == "AOD") {\r
- //Multiplicity\r
- Int_t lMultiplicity = -100;\r
- nTrackMultiplicityBeforeAnySel = lMultiplicity;\r
- ncascadesBeforeAnySel = lAODevent->GetNumberOfCascades();\r
- }\r
- fHistTrackMultiplicityBeforeAnySel->Fill(nTrackMultiplicityBeforeAnySel);\r
- fHistCascadeMultiplicityBeforeAnySel->Fill(ncascadesBeforeAnySel);\r
-\r
- //----------------\r
- // - SDD selection\r
- //----------------\r
- // - Define variables\r
- Int_t ncascadesAfterSDDSel = -1; //number of cascades after SDD selection\r
- Int_t nTrackMultiplicityAfterSDDSel = -1; //number of tracks after SDD selection\r
- if (fkSDDselectionOn) {\r
- TString trcl = " ";\r
- trcl = lESDevent->GetFiredTriggerClasses();\r
- if (fAnalysisType == "ESD") trcl = lESDevent->GetFiredTriggerClasses();\r
- else if (fAnalysisType == "AOD") trcl = lAODevent->GetFiredTriggerClasses();\r
- if (fwithSDD){ // ---> Select event with SDD ON\r
- if(!(trcl.Contains("ALLNOTRD"))) {\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- cout<<"Bad event: SDD turn OFF => RETURN!! (Exclude it)..."<<endl;\r
- return;\r
- } else {\r
- cout<<"Good event: SDD turn ON."<<endl;\r
- }\r
- } else if (!fwithSDD){ // ---> Select event with SDD OFF\r
- if((trcl.Contains("ALLNOTRD"))) {\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- cout<<"Bad event: SDD turn ON => RETURN!! (Exclude it)..."<<endl;\r
- return;\r
- } else {\r
- cout<<"Good event: SDD turn OFF."<<endl;\r
- }\r
- }\r
- }\r
- // - Take the number of cascades and tracks after the SDD selection\r
- if (fAnalysisType == "ESD") {\r
- Int_t lMultiplicity = -100;\r
- lMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC, 0.5);\r
- ncascadesAfterSDDSel = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterSDDSel = lMultiplicity;\r
- } else if (fAnalysisType == "AOD") {\r
- Int_t lMultiplicity = -100;\r
- ncascadesAfterSDDSel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterSDDSel = lMultiplicity;\r
- }\r
- // - Fill the plots\r
- fHistTrackMultiplicityAfterSDDSel->Fill(nTrackMultiplicityAfterSDDSel);\r
- fHistCascadeMultiplicityAfterSDDSel->Fill(ncascadesAfterSDDSel);\r
-\r
- //------------------------------\r
- // - Plots pre-physics selection\r
- //------------------------------\r
- // - Produce the 3Dhisto for the efficiency denominator\r
- Int_t lNbMCPrimary = 0;\r
- lNbMCPrimary = lMCstack->GetNprimary();\r
-\r
- for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) {\r
-\r
- Double_t partEnergy = 0.;\r
- Double_t partPz = 0.;\r
- Double_t partP = 0.;\r
- Double_t partPt = 0.;\r
- Double_t partVx = 0.;\r
- Double_t partVy = 0.;\r
- Double_t partVz = 0.;\r
- Double_t bacVx = 0.;\r
- Double_t bacVy = 0.;\r
- Double_t bacVz = 0.;\r
- Double_t partMass = 0.;\r
- Int_t PDGcode = 0;\r
- Int_t lPrimaryTrackMultiplicity = nTrackMultiplicityAfterSDDSel;\r
-\r
- if ( fAnalysisType == "ESD" ) {\r
- TParticle* lCurrentParticlePrimary = 0x0;\r
- lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack ); \r
- if (!lCurrentParticlePrimary) {\r
- Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );\r
- continue;\r
- }\r
- if (!lMCstack->IsPhysicalPrimary(iCurrentLabelStack)) continue;\r
- TParticle* xiMC = 0x0;\r
- xiMC = lCurrentParticlePrimary;\r
- if (!xiMC) {\r
- Printf("MC TParticle pointer to Cascade = 0x0 ! Skip ...");\r
- continue;\r
- }\r
- partEnergy = xiMC->Energy();\r
- partPz = xiMC->Pz();\r
- partPt = xiMC->Pt();\r
- partP = xiMC->P();\r
- partMass = xiMC->GetMass();\r
- partVx = xiMC->Vx();\r
- partVy = xiMC->Vy();\r
- partVz = xiMC->Vz();\r
- if (xiMC->GetDaughter(0)>=0) { \r
- TParticle *mcBach = lMCstack->Particle(xiMC->GetDaughter(0));\r
- if (mcBach) {\r
- bacVx = mcBach->Vx();\r
- bacVy = mcBach->Vy();\r
- bacVz = mcBach->Vz();\r
- }\r
- }\r
- PDGcode = lCurrentParticlePrimary->GetPdgCode();\r
- } else if ( fAnalysisType == "AOD" ) {\r
- AliAODMCParticle *lCurrentParticleaod = (AliAODMCParticle*) arrayMC->At(iCurrentLabelStack);\r
- if (!lCurrentParticleaod) {\r
- Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );\r
- continue;\r
- }\r
- if (!lCurrentParticleaod->IsPhysicalPrimary()) continue;\r
- partEnergy = lCurrentParticleaod->E();\r
- partPz = lCurrentParticleaod->Pz();\r
- partP = lCurrentParticleaod->P();\r
- partPt = lCurrentParticleaod->Pt();\r
- partMass = lCurrentParticleaod->M(); \r
- partVx = lCurrentParticleaod->Xv();\r
- partVy = lCurrentParticleaod->Yv();\r
- partVz = lCurrentParticleaod->Zv();\r
- if (lCurrentParticleaod->GetDaughter(0)>=0) {\r
- AliAODMCParticle *mcBach = (AliAODMCParticle*) arrayMC->At(lCurrentParticleaod->GetDaughter(0));\r
- if (mcBach) {\r
- bacVx = mcBach->Xv();\r
- bacVy = mcBach->Yv();\r
- bacVz = mcBach->Zv();\r
- }\r
- } \r
- PDGcode = lCurrentParticleaod->GetPdgCode();\r
- }\r
-\r
- // - Calculate rapidity\r
- Double_t lRapXiMC = 0.5*TMath::Log((partEnergy + partPz) / (partEnergy - partPz + 1.e-13));\r
- // - Calculate proper lenght\r
- Double_t lctau = TMath::Sqrt((partVx-bacVx)*(partVx-bacVx)+(partVy-bacVy)*(partVy-bacVy)+(partVz-bacVz)*(partVz-bacVz));\r
- if (partP != 0.) lctau = lctau*partMass/partP;\r
- else lctau = -1.;\r
- // - Fill Histograms\r
- if (PDGcode == 3312) {\r
- f3dHistGenPtVsGenYvsNtracksXiMinus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);\r
- f3dHistGenPtVsGenctauvsYXiMinus->Fill(partPt, lctau, lRapXiMC);\r
- }\r
- if (PDGcode == -3312) {\r
- f3dHistGenPtVsGenYvsNtracksXiPlus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);\r
- f3dHistGenPtVsGenctauvsYXiPlus->Fill(partPt, lctau, lRapXiMC);\r
- }\r
- if (PDGcode == 3334) {\r
- f3dHistGenPtVsGenYvsNtracksOmegaMinus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);\r
- f3dHistGenPtVsGenctauvsYOmegaMinus->Fill(partPt, lctau, lRapXiMC);\r
- }\r
- if (PDGcode == -3334) {\r
- f3dHistGenPtVsGenYvsNtracksOmegaPlus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);\r
- f3dHistGenPtVsGenctauvsYOmegaPlus->Fill(partPt, lctau, lRapXiMC);\r
- }\r
- }\r
-\r
- \r
- //--------------------\r
- // - Physics selection\r
- //--------------------\r
- // - Define new variables\r
- Int_t ncascadesAfterPhysicsSel = -1; //number of cascades after physics selection\r
- Int_t nTrackMultiplicityAfterPhysicsSel = -1; //number of tracks after physics selection\r
- // - Selection for ESD and AOD\r
- if (fAnalysisType == "ESD") {\r
- UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
- Bool_t isSelected = 0;\r
- isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;\r
- if(!isSelected){\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- // - Take the number of cascades and tracks after physics selection\r
- ncascadesAfterPhysicsSel = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterPhysicsSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC, 0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
- Bool_t isSelected = 0;\r
- isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;\r
- if(!isSelected){\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- // - Take the number of cascades and tracks after physics selection\r
- ncascadesAfterPhysicsSel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterPhysicsSel = -100;\r
- }\r
- fHistCascadeMultiplicityAfterPhysicsSel->Fill(ncascadesAfterPhysicsSel);\r
- fHistTrackMultiplicityAfterPhysicsSel->Fill(nTrackMultiplicityAfterPhysicsSel);\r
-\r
- //-------------------------------------------------------\r
- // Select only looking at events with well-established PV\r
- //-------------------------------------------------------\r
- Int_t ncascadesForSelEvtNoTPCOnly = -1; //number of cascades after the TPConly selection\r
- Int_t nTrackMultiplicityForSelEvtNoTPCOnly = -1; //number of tracks after the TPConly selection\r
- if (fAnalysisType == "ESD" ) {\r
- // - Select only looking at events with well-established PV\r
- if (fkQualityCutNoTPConlyPrimVtx) {\r
- const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();\r
- const AliESDVertex *lPrimaryTrackingVtx = lESDevent->GetPrimaryVertexTracks();\r
- if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingVtx->GetStatus() ){\r
- AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after TPConly selection\r
- ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- // - Select only looking at events with well-established PV\r
- if (fkQualityCutNoTPConlyPrimVtx) {\r
- const AliAODVertex *lPrimarySPDVtx = lAODevent->GetPrimaryVertexSPD();\r
- const AliAODVertex *lPrimaryTrackingAODVtx = lAODevent->GetPrimaryVertex();\r
- if (!lPrimarySPDVtx && !lPrimaryTrackingAODVtx) {\r
- AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after TPConly selection\r
- ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnly = -100; //FIXME\r
- }\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnly->Fill(ncascadesForSelEvtNoTPCOnly);\r
- fHistTrackMultiplicityForSelEvtNoTPCOnly->Fill(nTrackMultiplicityForSelEvtNoTPCOnly);\r
- \r
- //-----------------\r
- // Pileup selection\r
- //-----------------\r
- Int_t ncascadesForSelEvtNoTPCOnlyNoPileup = -1; //number of cascades after the NoPileup selection\r
- Int_t nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -1; //number of tracks after the Pileup selection\r
- if (fAnalysisType == "ESD" ) {\r
- // - Selection for pile up\r
- if (fkRejectEventPileUp) {\r
- if(lESDevent->IsPileupFromSPD()){\r
- AliWarning("Pb / Pile-up event ... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after Pileup selection\r
- ncascadesForSelEvtNoTPCOnlyNoPileup = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- // - Selection for pile up\r
- if (fkRejectEventPileUp) {\r
- if(lAODevent->IsPileupFromSPD()){\r
- AliWarning("Pb / Pile-up event ... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after Pileup selection\r
- ncascadesForSelEvtNoTPCOnlyNoPileup = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -100;\r
- }\r
- fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(ncascadesForSelEvtNoTPCOnlyNoPileup);\r
- fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);\r
- \r
- //-------------------\r
- // - Vertex selection \r
- //-------------------\r
- Int_t ncascadesAfterVertexSel = -1; //number of cascades after vertex selection\r
- Int_t nTrackMultiplicityAfterVertexSel = -1; //number of tracks after vertex selection\r
- Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};\r
- Double_t tPrimaryVtxPosition[3] = {-100.0, -100.0, -100.0}; \r
- Double_t lMagneticField = -10.;\r
- if (fAnalysisType == "ESD" ) {\r
- // - Primary vertex definition\r
- const AliESDVertex *lPrimaryBestVtx = lESDevent->GetPrimaryVertex();\r
- if (!lPrimaryBestVtx) {\r
- AliWarning("No prim. vertex in AOD... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- lPrimaryBestVtx->GetXYZ( lBestPrimaryVtxPos );\r
- // - Vertex position before any event selection on vertex position\r
- const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- fHistPVx->Fill( tPrimaryVtxPosition[0] );\r
- fHistPVy->Fill( tPrimaryVtxPosition[1] );\r
- fHistPVz->Fill( tPrimaryVtxPosition[2] );\r
- // - Get magnetic filed info\r
- lMagneticField = lESDevent->GetMagneticField();\r
- // - Selection on the primary vertex Z position \r
- if (fkQualityCutZprimVtxPos) {\r
- if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {\r
- AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after vertex Z position selection\r
- ncascadesAfterVertexSel = lESDevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterVertexSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);\r
- } else if (fAnalysisType == "AOD") {\r
- // - Primary vertex definition\r
- const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex(); // get the best primary vertex available for the event GetVertex(0)\r
- if (!lPrimaryBestAODVtx) {\r
- AliWarning("No prim. vertex in AOD... return!");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );\r
- // - Vertex position before any event selection on vertex position\r
- const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- fHistPVx->Fill( tPrimaryVtxPosition[0] );\r
- fHistPVy->Fill( tPrimaryVtxPosition[1] );\r
- fHistPVz->Fill( tPrimaryVtxPosition[2] );\r
- // - Get magnetic filed info\r
- lMagneticField = lAODevent->GetMagneticField();\r
- // - Selection on the primary vertex Z position \r
- if (fkQualityCutZprimVtxPos) {\r
- if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange && TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {\r
- AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
- return;\r
- }\r
- }\r
- // - Take the number of cascades and tracks after vertex Z position selection\r
- ncascadesAfterVertexSel = lAODevent->GetNumberOfCascades();\r
- nTrackMultiplicityAfterVertexSel = -100;\r
- }\r
- // - Fill the plots\r
- fHistCascadeMultiplicityAfterVertexCutSel->Fill(ncascadesAfterVertexSel);\r
- fHistTrackMultiplicityAfterVertexCutSel->Fill(nTrackMultiplicityAfterVertexSel);\r
-\r
- // - Vertex position plots: after any event selections\r
- tPrimaryVtxPosition[0] = 0;\r
- tPrimaryVtxPosition[1] = 0;\r
- tPrimaryVtxPosition[2] = 0;\r
- if (fAnalysisType == "ESD" ) {\r
- const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- } else if (fAnalysisType == "AOD") {\r
- const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();\r
- tPrimaryVtxPosition[0] = primaryVtx->GetX();\r
- tPrimaryVtxPosition[1] = primaryVtx->GetY();\r
- tPrimaryVtxPosition[2] = primaryVtx->GetZ();\r
- }\r
- fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] );\r
- fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] );\r
- fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] );\r
- \r
-\r
- //---------------------------------------------------------------------- \r
- // - Loop over the different types of GENERATED cascades (Xi-+, Omega-+) \r
- //----------------------------------------------------------------------\r
- // - Initialisation of useful local variables \r
- Int_t lPdgCodeCasc = 0;\r
- Int_t lPdgCodeBach = 0;\r
- Int_t lPdgCodeLambda = 0;\r
- Int_t lPdgCodeDghtMesV0 = 0;\r
- Int_t lPdgCodeDghtBarV0 = 0; \r
- TH1F *lHistEtaGenCasc = 0; \r
- TH3D *l3dHistGenPtVsGenYvsNtracksPhysEff = 0;\r
- TH3D *l3dHistGenPtVsGenctauvsYPhysEff = 0;\r
- TH1F *lHistThetaGenCasc = 0;\r
- TH2D *l2dHistGenPtVsGenYFdbl = 0;\r
- TH1F *lHistThetaLambda = 0;\r
- TH1F *lHistThetaBach = 0;\r
- TH1F *lHistThetaBarDghter = 0;\r
- TH1F *lHistThetaMesDghter = 0;\r
- TH1F *lHistPtBach = 0;\r
- TH1F *lHistPtBarDghter = 0;\r
- TH1F *lHistPtMesDghter = 0;\r
- Int_t ncascperev = 0; \r
- Int_t ncascperevtot = 0;\r
-\r
- for (Int_t iCascType = 1; iCascType < 5; iCascType++) { \r
- ncascperev = 0;\r
- ncascperevtot = 0;\r
- Int_t lPrimaryTrackMultiplicity = nTrackMultiplicityAfterSDDSel;\r
-\r
- switch (iCascType) {\r
- case 1: // Xi-\r
- lPdgCodeCasc = 3312; //Xi-\r
- lPdgCodeBach = -211; //Pi-\r
- lPdgCodeLambda = 3122; //Lambda0\r
- lPdgCodeDghtMesV0 = -211; //Pi-\r
- lPdgCodeDghtBarV0 = 2212; //Proton \r
- lHistEtaGenCasc = fHistEtaGenCascXiMinus; // this plot for any Xi- \r
- lHistThetaGenCasc = fHistThetaGenCascXiMinus; // cascades generated within acceptance (cut in pt + theta)\r
- l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff;\r
- l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYXiMinusPhysEff;\r
- l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblXiMinus;\r
- lHistThetaLambda = fHistThetaLambdaXiMinus;\r
- lHistThetaBach = fHistThetaBachXiMinus;\r
- lHistThetaBarDghter = fHistThetaBarDghterXiMinus;\r
- lHistThetaMesDghter = fHistThetaMesDghterXiMinus;\r
- lHistPtBach = fHistPtBachXiMinus;\r
- lHistPtBarDghter = fHistPtBarDghterXiMinus;\r
- lHistPtMesDghter = fHistPtMesDghterXiMinus;\r
- break; \r
- case 2: // Xi+\r
- lPdgCodeCasc = -3312; //Xi+\r
- lPdgCodeBach = 211; //Pi+\r
- lPdgCodeLambda = -3122; //AntiLambda0\r
- lPdgCodeDghtMesV0 = 211; //Pi+\r
- lPdgCodeDghtBarV0 = -2212; //AntiProton \r
- lHistEtaGenCasc = fHistEtaGenCascXiPlus; // this plot for any Xi+\r
- lHistThetaGenCasc = fHistThetaGenCascXiPlus; // cascades generated within acceptance (cut in pt + theta)\r
- l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff;\r
- l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYXiPlusPhysEff;\r
- l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblXiPlus;\r
- lHistThetaLambda = fHistThetaLambdaXiPlus;\r
- lHistThetaBach = fHistThetaBachXiPlus;\r
- lHistThetaBarDghter = fHistThetaBarDghterXiPlus;\r
- lHistThetaMesDghter = fHistThetaMesDghterXiPlus;\r
- lHistPtBach = fHistPtBachXiPlus;\r
- lHistPtBarDghter = fHistPtBarDghterXiPlus;\r
- lHistPtMesDghter = fHistPtMesDghterXiPlus; \r
- break;\r
- case 3: // Omega-\r
- lPdgCodeCasc = 3334; //Omega-\r
- lPdgCodeBach = -321; //K-\r
- lPdgCodeLambda = 3122; //Lambda0\r
- lPdgCodeDghtMesV0 = -211; //Pi-\r
- lPdgCodeDghtBarV0 = 2212; //Proton\r
- lHistEtaGenCasc = fHistEtaGenCascOmegaMinus; // this plot for any Omega+ \r
- lHistThetaGenCasc = fHistThetaGenCascOmegaMinus; // cascades generated within acceptance (cut in pt + theta)\r
- l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblOmegaMinus;\r
- l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff;\r
- l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff;\r
- lHistThetaLambda = fHistThetaLambdaOmegaMinus;\r
- lHistThetaBach = fHistThetaBachOmegaMinus;\r
- lHistThetaBarDghter = fHistThetaBarDghterOmegaMinus;\r
- lHistThetaMesDghter = fHistThetaMesDghterOmegaMinus;\r
- lHistPtBach = fHistPtBachOmegaMinus;\r
- lHistPtBarDghter = fHistPtBarDghterOmegaMinus;\r
- lHistPtMesDghter = fHistPtMesDghterOmegaMinus; \r
- break;\r
- case 4: // Omega+\r
- lPdgCodeCasc = -3334; //Omega+\r
- lPdgCodeBach = 321; //K+\r
- lPdgCodeLambda = -3122; //AntiLambda0\r
- lPdgCodeDghtMesV0 = 211; //Pi+\r
- lPdgCodeDghtBarV0 = -2212; //AntiProton \r
- lHistEtaGenCasc = fHistEtaGenCascOmegaPlus; // this plot for any Omega-\r
- lHistThetaGenCasc = fHistThetaGenCascOmegaPlus; // cascades generated within acceptance (cut in pt + theta)\r
- l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblOmegaPlus;\r
- l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff;\r
- l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff;\r
- lHistThetaLambda = fHistThetaLambdaOmegaPlus;\r
- lHistThetaBach = fHistThetaBachOmegaPlus;\r
- lHistThetaBarDghter = fHistThetaBarDghterOmegaPlus;\r
- lHistThetaMesDghter = fHistThetaMesDghterOmegaPlus;\r
- lHistPtBach = fHistPtBachOmegaPlus;\r
- lHistPtBarDghter = fHistPtBarDghterOmegaPlus;\r
- lHistPtMesDghter = fHistPtMesDghterOmegaPlus; \r
- break;\r
- }\r
-\r
- for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) {\r
-\r
- Double_t partEnergy = 0.;\r
- Double_t partPz = 0.;\r
- Double_t partEta = 0.;\r
- Double_t partTheta = 0.;\r
- Double_t partP = 0.;\r
- Double_t partPt = 0.;\r
- Double_t partVx = 0.;\r
- Double_t partVy = 0.; \r
- Double_t partVz = 0.;\r
- Double_t bacVx = 0.;\r
- Double_t bacVy = 0.;\r
- Double_t bacVz = 0.; \r
- Double_t partMass = 0.;\r
-\r
- if ( fAnalysisType == "ESD" ) { \r
- TParticle* lCurrentParticle = 0x0; \r
- lCurrentParticle = lMCstack->Particle( iCurrentLabelStack );\r
- if (!lCurrentParticle) {\r
- Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );\r
- continue;\r
- }\r
- if (!lMCstack->IsPhysicalPrimary(iCurrentLabelStack)) continue; \r
- if (lCurrentParticle->GetPdgCode() == lPdgCodeCasc) { // Here ! \r
- TParticle* xiMC = 0x0;\r
- xiMC = lCurrentParticle;\r
- if (!xiMC) {\r
- Printf("MC TParticle pointer to Cascade = 0x0 ! Skip ...");\r
- continue;\r
- }\r
- partEnergy = xiMC->Energy();\r
- partPz = xiMC->Pz();\r
- partEta = xiMC->Eta();\r
- partPt = xiMC->Pt();\r
- partP = xiMC->P();\r
- partTheta = xiMC->Theta();\r
- partMass = xiMC->GetMass();\r
- partVx = xiMC->Vx();\r
- partVy = xiMC->Vy();\r
- partVz = xiMC->Vz();\r
- if (xiMC->GetDaughter(0)>=0) {\r
- TParticle *mcBach = lMCstack->Particle(xiMC->GetDaughter(0));\r
- if (mcBach) {\r
- bacVx = mcBach->Vx();\r
- bacVy = mcBach->Vy();\r
- bacVz = mcBach->Vz();\r
- }\r
- }\r
- } else continue;\r
- } else if ( fAnalysisType == "AOD" ) {\r
- AliAODMCParticle *lCurrentParticleaod = (AliAODMCParticle*) arrayMC->At(iCurrentLabelStack);\r
- if (!lCurrentParticleaod) {\r
- Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );\r
- continue;\r
- }\r
- if (!lCurrentParticleaod->IsPhysicalPrimary()) continue; \r
- if (!(lCurrentParticleaod->PdgCode() == lPdgCodeCasc)) continue;\r
- partEnergy = lCurrentParticleaod->E();\r
- partPz = lCurrentParticleaod->Pz();\r
- partEta = lCurrentParticleaod->Eta();\r
- partP = lCurrentParticleaod->P();\r
- partPt = lCurrentParticleaod->Pt();\r
- partTheta = lCurrentParticleaod->Theta();\r
- partMass = lCurrentParticleaod->M(); //FIXME: not sure this works, seems not implemented\r
- partVx = lCurrentParticleaod->Xv();\r
- partVy = lCurrentParticleaod->Yv();\r
- partVz = lCurrentParticleaod->Zv();\r
- if (lCurrentParticleaod->GetDaughter(0)>=0) {\r
- AliAODMCParticle *mcBach = (AliAODMCParticle*) arrayMC->At(lCurrentParticleaod->GetDaughter(0));\r
- if (mcBach) {\r
- bacVx = mcBach->Xv();\r
- bacVy = mcBach->Yv();\r
- bacVz = mcBach->Zv();\r
- } \r
- }\r
- }\r
- ncascperevtot++; \r
- // - Fill the first histos : = any generated Xi, not necessarily within the acceptance\r
- Double_t lRapXiMC = 0.5*TMath::Log((partEnergy + partPz) / (partEnergy - partPz +1.e-13));\r
- // - Calculate proper time\r
- Double_t lctau = TMath::Sqrt((partVx-bacVx)*(partVx-bacVx)+(partVy-bacVy)*(partVy-bacVy)+(partVz-bacVz)*(partVz-bacVz));\r
- if (partP!=0.) lctau = lctau*partMass/partP;\r
- else lctau = -1.;\r
- Double_t lRadToDeg = 180.0/TMath::Pi();\r
- // - Fill the first histos : = any generated Xi, not necessarily within the acceptance \r
- lHistEtaGenCasc->Fill( partEta ); \r
- l3dHistGenPtVsGenYvsNtracksPhysEff->Fill( partPt, lRapXiMC, lPrimaryTrackMultiplicity );\r
- l3dHistGenPtVsGenctauvsYPhysEff->Fill( partPt, lctau, lRapXiMC );\r
- lHistThetaGenCasc->Fill( lRadToDeg * partTheta );\r
-\r
- //--------------------------------------------------------------------------------------------\r
- // - Check the emission of particle stays within the acceptance of the detector (cut in theta)\r
- if (fApplyAccCut) { if( partTheta < TMath::Pi()/4.0 || partTheta > 3.0*TMath::Pi()/4.0 ) continue;} \r
-\r
- Float_t lambdaTheta = 0.;\r
- Float_t bacTheta = 0.;\r
- Float_t dghtBarV0Theta = 0.;\r
- Float_t dghtMesV0Theta = 0.;\r
- Float_t bacPt = 0.;\r
- Float_t dghtBarV0Pt = 0.;\r
- Float_t dghtMesV0Pt = 0.;\r
-\r
- if ( fAnalysisType == "ESD" ) { \r
- TParticle* xiMC = lMCstack->Particle( iCurrentLabelStack ); \r
- if ( xiMC->GetNDaughters() != 2) continue;\r
- if ( xiMC->GetDaughter(0) < 0 ) continue;\r
- if ( xiMC->GetDaughter(1) < 0 ) continue; \r
- TParticle* lDght0ofXi = lMCstack->Particle( xiMC->GetDaughter(0) );\r
- TParticle* lDght1ofXi = lMCstack->Particle( xiMC->GetDaughter(1) );\r
- TParticle* lLambda = 0;\r
- TParticle* lBach = 0;\r
-\r
- // Xi - Case 1\r
- if ( lDght0ofXi->GetPdgCode() == lPdgCodeLambda && lDght1ofXi->GetPdgCode() == lPdgCodeBach ){ \r
- lLambda = lDght0ofXi; // dghter0 = Lambda\r
- lBach = lDght1ofXi; // dghter1 = Pi-\r
- } \r
- // Xi - Case 2\r
- else if ( lDght0ofXi->GetPdgCode() == lPdgCodeBach && lDght1ofXi->GetPdgCode() == lPdgCodeLambda ){ \r
- lBach = lDght0ofXi; // dghter0 = Pi-\r
- lLambda = lDght1ofXi; // dghter1 = Lambda\r
- }\r
- // Otherwise - Case 3 \r
- else continue;\r
-\r
- // - Check the emission of particle stays within the acceptance of the detector (cut in pt + theta)\r
- if (fApplyAccCut) { \r
- if( lLambda->Theta() < TMath::Pi()/4.0 || lLambda->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lBach->Theta() < TMath::Pi()/4.0 || lBach->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lBach->Pt() < 0.150 ) continue; //FIXME: maybe tuned for Xi but not for K- from Omega ...\r
- } \r
- \r
- //---------\r
- // - V0 level\r
- TParticle* lDghtBarV0 = 0;\r
- TParticle* lDghtMesV0 = 0;\r
- if( lLambda->GetNDaughters() != 2 ) continue;\r
- if( lLambda->GetDaughter(0) < 0 ) continue;\r
- if( lLambda->GetDaughter(1) < 0 ) continue;\r
- TParticle* lDght0ofLambda = lMCstack->Particle( lLambda->GetDaughter(0) );\r
- TParticle* lDght1ofLambda = lMCstack->Particle( lLambda->GetDaughter(1) );\r
-\r
- // V0 - Case 1\r
- if ( lDght0ofLambda->GetPdgCode() == lPdgCodeDghtBarV0 && lDght1ofLambda->GetPdgCode() == lPdgCodeDghtMesV0 ) { // Here ! \r
- lDghtBarV0 = lDght0ofLambda; // dghter0 = Proton\r
- lDghtMesV0 = lDght1ofLambda; // dghter1 = Pi-\r
- } \r
- // V0 - Case 2\r
- else if ( lDght0ofLambda->GetPdgCode() == lPdgCodeDghtMesV0 && lDght1ofLambda->GetPdgCode() == lPdgCodeDghtBarV0 ) { // Here !\r
- lDghtMesV0 = lDght0ofLambda; // dghter0 = Pi-\r
- lDghtBarV0 = lDght1ofLambda; // dghter1 = Proton\r
- } \r
- // Otherwise - Case 3\r
- else continue;\r
- \r
- // - Check the emission of particle stays within the acceptance of the detector\r
- if (fApplyAccCut) { \r
- if( lDghtBarV0->Theta() < TMath::Pi()/4.0 || lDghtBarV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lDghtMesV0->Theta() < TMath::Pi()/4.0 || lDghtMesV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lDghtBarV0->Pt() < 0.250 ) continue;\r
- if( lDghtMesV0->Pt() < 0.150 ) continue;\r
- }\r
- \r
- lambdaTheta = lLambda->Theta();\r
- bacTheta = lBach->Theta();\r
- dghtBarV0Theta = lDghtBarV0->Theta(); \r
- dghtMesV0Theta = lDghtMesV0->Theta();\r
- bacPt = lBach->Pt();\r
- dghtBarV0Pt = lDghtBarV0->Pt();\r
- dghtMesV0Pt = lDghtMesV0->Pt();\r
- \r
- } else if ( fAnalysisType == "AOD") {\r
-\r
- AliAODMCParticle *xiMC = (AliAODMCParticle*) arrayMC->At(iCurrentLabelStack);\r
- if (xiMC->GetNDaughters() != 2) continue;\r
- if (xiMC->GetDaughter(0) < 0 ) continue;\r
- if (xiMC->GetDaughter(1) < 0 ) continue;\r
-\r
- AliAODMCParticle* lDght0ofXi = (AliAODMCParticle*) arrayMC->At( xiMC->GetDaughter(0) );\r
- AliAODMCParticle* lDght1ofXi = (AliAODMCParticle*) arrayMC->At( xiMC->GetDaughter(1) );\r
-\r
- AliAODMCParticle* lLambda = 0;\r
- AliAODMCParticle* lBach = 0;\r
-\r
- // Xi - Case 1\r
- if ( lDght0ofXi->PdgCode() == lPdgCodeLambda && lDght1ofXi->PdgCode() == lPdgCodeBach ){ \r
- lLambda = lDght0ofXi; // dghter0 = Lambda\r
- lBach = lDght1ofXi; // dghter1 = Pi-\r
- }\r
- // Xi - Case 2\r
- else if ( lDght0ofXi->PdgCode() == lPdgCodeBach && lDght1ofXi->PdgCode() == lPdgCodeLambda ){\r
- lBach = lDght0ofXi; // dghter0 = Pi\r
- lLambda = lDght1ofXi; //dghter1 = Lambda\r
- }\r
- // Otherwise - Case 3\r
- else continue;\r
-\r
- // - Check the emission of particle stays within the acceptance of the detector (cut in pt + theta)\r
- if (fApplyAccCut) {\r
- if ( lLambda->Theta() < TMath::Pi()/4.0 || lLambda->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lBach->Theta() < TMath::Pi()/4.0 || lBach->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lBach->Pt() < 0.150 ) continue; //FIXME : maybe tuned for Xi but not for K- from Omega ...\r
- }\r
-\r
- //-----------\r
- // - V0 level \r
- AliAODMCParticle* lDghtBarV0 = 0;\r
- AliAODMCParticle* lDghtMesV0 = 0;\r
-\r
- if( lLambda->GetNDaughters() != 2 ) continue;\r
- if( lLambda->GetDaughter(0) < 0 ) continue;\r
- if( lLambda->GetDaughter(1) < 0 ) continue;\r
-\r
- AliAODMCParticle* lDght0ofLambda = (AliAODMCParticle*) arrayMC->At( lLambda->GetDaughter(0) );\r
- AliAODMCParticle* lDght1ofLambda = (AliAODMCParticle*) arrayMC->At( lLambda->GetDaughter(1) );\r
-\r
- // V0 - Case 1\r
- if ( lDght0ofLambda->PdgCode() == lPdgCodeDghtBarV0 && lDght1ofLambda->PdgCode() == lPdgCodeDghtMesV0 ) { \r
- lDghtBarV0 = lDght0ofLambda; // dghter0 = Proton\r
- lDghtMesV0 = lDght1ofLambda; // dghter1 = Pi-\r
- } \r
- // V0 - Case 2\r
- else if ( lDght0ofLambda->PdgCode() == lPdgCodeDghtMesV0 && lDght1ofLambda->PdgCode() == lPdgCodeDghtBarV0 ) { \r
- lDghtMesV0 = lDght0ofLambda; // dghter0 = Pi-\r
- lDghtBarV0 = lDght1ofLambda; // dghter1 = proton\r
- } \r
- // V0 otherwise - Case 3\r
- else continue;\r
-\r
- // - Check the emission of particle stays within the acceptance of the detector\r
- if (fApplyAccCut) {\r
- if( lDghtBarV0->Theta() < TMath::Pi()/4.0 || lDghtBarV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lDghtMesV0->Theta() < TMath::Pi()/4.0 || lDghtMesV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;\r
- if( lDghtBarV0->Pt() < 0.250 ) continue;\r
- if( lDghtMesV0->Pt() < 0.150 ) continue;\r
- }\r
-\r
- lambdaTheta = lLambda->Theta();\r
- bacTheta = lBach->Theta();\r
- dghtBarV0Theta = lDghtBarV0->Theta();\r
- dghtMesV0Theta = lDghtMesV0->Theta();\r
- bacPt = lBach->Pt();\r
- dghtBarV0Pt = lDghtBarV0->Pt();\r
- dghtMesV0Pt = lDghtMesV0->Pt();\r
- }\r
-\r
- //---------------------------------------\r
- // - Filling histos for findable cascades\r
- // - Fill theta histos \r
- lHistThetaLambda->Fill( lRadToDeg * lambdaTheta );\r
- lHistThetaBach->Fill( lRadToDeg * bacTheta );\r
- lHistThetaBarDghter->Fill( lRadToDeg * dghtBarV0Theta );\r
- lHistThetaMesDghter->Fill( lRadToDeg * dghtMesV0Theta );\r
- // - Fill pt histos\r
- lHistPtBach ->Fill( bacPt );\r
- lHistPtBarDghter ->Fill( dghtBarV0Pt );\r
- lHistPtMesDghter ->Fill( dghtMesV0Pt );\r
- l2dHistGenPtVsGenYFdbl ->Fill( partPt, lRapXiMC );\r
-\r
- ncascperev++; \r
- \r
- }// This is the end of the loop on primaries\r
- \r
- if (iCascType == 1) {\r
- fHistnXiMinusPerEv->Fill(ncascperev);\r
- fHistnXiMinusPerEvTot->Fill(ncascperevtot);\r
- }\r
- if (iCascType == 2) {\r
- fHistnXiPlusPerEv->Fill(ncascperev);\r
- fHistnXiPlusPerEvTot->Fill(ncascperevtot);\r
- }\r
- if (iCascType == 3) {\r
- fHistnOmegaMinusPerEv->Fill(ncascperev);\r
- fHistnOmegaMinusPerEvTot->Fill(ncascperevtot);\r
- }\r
- if (iCascType == 4) {\r
- fHistnOmegaPlusPerEv->Fill(ncascperev);\r
- fHistnOmegaPlusPerEvTot->Fill(ncascperevtot);\r
- }\r
-\r
- // - Re-initialisation of the local THF pointers\r
- lHistEtaGenCasc = 0x0;\r
- lHistThetaGenCasc = 0x0;\r
- l2dHistGenPtVsGenYFdbl = 0x0;\r
- lHistThetaLambda = 0x0;\r
- lHistThetaBach = 0x0;\r
- lHistThetaBarDghter = 0x0;\r
- lHistThetaMesDghter = 0x0;\r
- lHistPtBach = 0x0;\r
- lHistPtBarDghter = 0x0;\r
- lHistPtMesDghter = 0x0; \r
-\r
- } // end of loop over the different types of cascades (Xi-+, Omega-+)\r
- \r
- \r
- \r
- //----------------------------------------- \r
- // - Loop over the reconstructed candidates\r
- //-----------------------------------------\r
- Int_t nAssoXiMinus = 0;\r
- Int_t nAssoXiPlus = 0;\r
- Int_t nAssoOmegaMinus = 0;\r
- Int_t nAssoOmegaPlus = 0;\r
- Int_t lPosTPCClusters = 0;\r
- Int_t lNegTPCClusters = 0;\r
- Int_t lBachTPCClusters = 0;\r
- Double_t lDcaXiDaughters = -1. ;\r
- Double_t lDcaBachToPrimVertexXi = -1. ;\r
- Double_t lXiCosineOfPointingAngle = -1. ;\r
- Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };\r
- Double_t lXiRadius = -1000. ;\r
- Double_t lInvMassLambdaAsCascDghter = 0.;\r
- Double_t lDcaV0DaughtersXi = -1.;\r
- Double_t lV0CosineOfPointingAngleXi = -1.;\r
- Double_t lV0CosineOfPointingAngle = -1.;\r
- Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade\r
- Double_t lV0RadiusXi = -1000.;\r
- Double_t lDcaV0ToPrimVertexXi = -1.;\r
- Double_t lDcaPosToPrimVertexXi = -1.;\r
- Double_t lDcaNegToPrimVertexXi = -1.;\r
- Double_t lChargeXi = -1.;\r
- Double_t lV0mom = -1000.;\r
- Double_t lmcPt = -1.; \r
- Double_t lmcRapCasc = -1.; \r
- Double_t lmcEta = -1000.; \r
- Double_t lmcTransvRadius = -1000.; \r
- Double_t lrecoPt = -100.; \r
- Double_t lrecoTransvRadius = -1000.; \r
- Double_t lDeltaPhiMcReco = -1.;\r
- Double_t lBachTransvMom = 0.;\r
- Double_t lpTrackTransvMom = 0.;\r
- Double_t lnTrackTransvMom = 0.;\r
- Double_t lmcPtPosV0Dghter = -100.;\r
- Double_t lmcPtNegV0Dghter = -100.;\r
- Double_t lrecoP = -100.;\r
- Double_t lmcPtBach = -100.;\r
- Double_t cascadeMass = 0.;\r
-\r
- // - Get the number of cascades\r
- Int_t ncascades = 0;\r
- if ( fAnalysisType == "ESD" ) { ncascades = lESDevent->GetNumberOfCascades(); }\r
- else if ( fAnalysisType == "AOD" ) { ncascades = lAODevent->GetNumberOfCascades(); }\r
-\r
- //-------------------------------\r
- // - Begining of the Cascade Loop\r
- for (Int_t iXi = 0; iXi < ncascades; iXi++) {\r
-\r
- Bool_t lIsPosInXiProton = kFALSE;\r
- Bool_t lIsPosInXiPion = kFALSE;\r
- Bool_t lIsPosInOmegaProton = kFALSE;\r
- Bool_t lIsPosInOmegaPion = kFALSE;\r
- Bool_t lIsNegInXiProton = kFALSE;\r
- Bool_t lIsNegInXiPion = kFALSE;\r
- Bool_t lIsNegInOmegaProton = kFALSE;\r
- Bool_t lIsNegInOmegaPion = kFALSE;\r
- Bool_t lIsBachelorKaon = kFALSE;\r
- Bool_t lIsBachelorPion = kFALSE;\r
- Bool_t lIsBachelorKaonForTPC = kFALSE;\r
- Bool_t lIsBachelorPionForTPC = kFALSE;\r
- Bool_t lIsNegPionForTPC = kFALSE;\r
- Bool_t lIsPosPionForTPC = kFALSE;\r
- Bool_t lIsNegProtonForTPC = kFALSE;\r
- Bool_t lIsPosProtonForTPC = kFALSE;\r
-\r
- // - Combined PID\r
- // Reasonable guess for the priors for the cascade track sample (e-, mu, pi, K, p)\r
- Double_t lPriorsGuessXi[14] = {0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};\r
- Double_t lPriorsGuessOmega[14] = {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};\r
- Double_t ppionBach = 0.0, pkaonBach = 0.0;\r
- Bool_t lIsBachelorMCPiMinus = kFALSE;\r
- Bool_t lIsBachelorMCPiPlus = kFALSE;\r
- Bool_t lIsBachelorMCKMinus = kFALSE;\r
- Bool_t lIsBachelorMCKPlus = kFALSE;\r
- Double_t lInvMassXiMinus = 0.;\r
- Double_t lInvMassXiPlus = 0.;\r
- Double_t lInvMassOmegaMinus = 0.;\r
- Double_t lInvMassOmegaPlus = 0.;\r
- Bool_t lAssoXiMinus = kFALSE;\r
- Bool_t lAssoXiPlus = kFALSE;\r
- Bool_t lAssoOmegaMinus = kFALSE;\r
- Bool_t lAssoOmegaPlus = kFALSE;\r
- \r
- Float_t etaBach = 0.;\r
- Float_t etaPos = 0.;\r
- Float_t etaNeg = 0.;\r
-\r
- if ( fAnalysisType == "ESD" ) { \r
-\r
- // - Load the cascade\r
- AliESDcascade *xiESD = lESDevent->GetCascade(iXi);\r
- if (!xiESD) continue;\r
- \r
- // - Connection to daughter tracks of the current cascade \r
- UInt_t lIdxPosXi = (UInt_t) TMath::Abs( xiESD->GetPindex() );\r
- UInt_t lIdxNegXi = (UInt_t) TMath::Abs( xiESD->GetNindex() );\r
- UInt_t lBachIdx = (UInt_t) TMath::Abs( xiESD->GetBindex() );\r
- \r
- // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)\r
- if(lBachIdx == lIdxNegXi) {\r
- AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;\r
- }\r
- if(lBachIdx == lIdxPosXi) {\r
- AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;\r
- }\r
- \r
- // - Get the daughter tracks\r
- AliESDtrack *pTrackXi = lESDevent->GetTrack( lIdxPosXi );\r
- AliESDtrack *nTrackXi = lESDevent->GetTrack( lIdxNegXi );\r
- AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );\r
- if (!pTrackXi || !nTrackXi || !bachTrackXi ) {\r
- Printf("ERROR: Could not retrieve one of the 3 daughter tracks of the cascade ...");\r
- continue;\r
- }\r
- \r
- // Get the number of TPC clusters\r
- lPosTPCClusters = pTrackXi->GetTPCNcls();\r
- lNegTPCClusters = nTrackXi->GetTPCNcls();\r
- lBachTPCClusters = bachTrackXi->GetTPCNcls(); \r
- // - Rejection of a poor quality tracks\r
- if(fkQualityCutTPCrefit){\r
- // - Poor quality related to TPCrefit\r
- ULong_t pStatus = pTrackXi->GetStatus();\r
- ULong_t nStatus = nTrackXi->GetStatus();\r
- ULong_t bachStatus = bachTrackXi->GetStatus();\r
- if ((pStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }\r
- if ((nStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }\r
- if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }\r
- } \r
- if(fkQualityCutnTPCcls){\r
- // - Poor quality related to TPC clusters\r
- if(lPosTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }\r
- if(lNegTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }\r
- if(lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!"); continue; }\r
- }\r
-\r
- etaPos = pTrackXi->Eta();\r
- etaNeg = nTrackXi->Eta();\r
- etaBach = bachTrackXi->Eta();\r
- \r
- // - Info over reconstructed cascades\r
- Double_t lV0quality = 0.;\r
- if( bachTrackXi->Charge() < 0 ) {\r
- //Calculate the effective mass of the Xi- candidate: Xi- hyp. (pdg code 3312\r
- lV0quality = 0.;\r
- xiESD->ChangeMassHypothesis(lV0quality , 3312); \r
- lInvMassXiMinus = xiESD->GetEffMassXi();\r
- //Calculate the effective mass of the Xi- candidate: Omega- hyp. (pdg code 3334)\r
- lV0quality = 0.;\r
- xiESD->ChangeMassHypothesis(lV0quality , 3334); \r
- lInvMassOmegaMinus = xiESD->GetEffMassXi();\r
- //Back to "default" hyp. (Xi-) \r
- lV0quality = 0.;\r
- xiESD->ChangeMassHypothesis(lV0quality , 3312);\r
- }\r
- if( bachTrackXi->Charge() > 0 ){\r
- //Calculate the effective mass of the Xi- candidate: Xi+ hyp. (pdg code -3312)\r
- lV0quality = 0.;\r
- xiESD->ChangeMassHypothesis(lV0quality , -3312); \r
- lInvMassXiPlus = xiESD->GetEffMassXi();\r
- //Calculate the effective mass of the Xi- candidate: Omega+ hyp. (pdg code -3334)\r
- lV0quality = 0.;\r
- xiESD->ChangeMassHypothesis(lV0quality , -3334); \r
- lInvMassOmegaPlus = xiESD->GetEffMassXi();\r
- //Back to "default" hyp. (Xi-)\r
- lV0quality = 0.;\r
- xiESD->ChangeMassHypothesis(lV0quality , -3312);\r
- }\r
- lDcaXiDaughters = xiESD->GetDcaXiDaughters();\r
- lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lMagneticField) );\r
- lXiCosineOfPointingAngle = xiESD->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );\r
- xiESD->GetXYZcascade( lPosXi[0], lPosXi[1], lPosXi[2] ); \r
- lInvMassLambdaAsCascDghter = xiESD->GetEffMass();\r
- lDcaV0DaughtersXi = xiESD->GetDcaV0Daughters();\r
- lV0CosineOfPointingAngleXi = xiESD->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );\r
- lV0CosineOfPointingAngle = xiESD->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2]); \r
- xiESD->GetXYZ( lPosV0Xi[0], lPosV0Xi[1], lPosV0Xi[2] );\r
- lDcaV0ToPrimVertexXi = xiESD->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );\r
- lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lMagneticField) );\r
- lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lMagneticField) );\r
- lChargeXi = xiESD->Charge();\r
- \r
- //------------------\r
- // - PID Information\r
-\r
- // - Combined VO-positive-daughter PID\r
- AliPID pPidXi; pPidXi.SetPriors( lPriorsGuessXi );\r
- AliPID pPidOmega; pPidOmega.SetPriors( lPriorsGuessOmega ); \r
- if( pTrackXi->IsOn(AliESDtrack::kESDpid) ){ \r
- Double_t r[10] = {0.}; pTrackXi->GetESDpid(r);\r
- pPidXi.SetProbabilities(r);\r
- pPidOmega.SetProbabilities(r); \r
- // Check if the V0 positive track is a proton (case for Xi-)\r
- Double_t pproton = pPidXi.GetProbability(AliPID::kProton);\r
- if (pproton > pPidXi.GetProbability(AliPID::kElectron) &&\r
- pproton > pPidXi.GetProbability(AliPID::kMuon) &&\r
- pproton > pPidXi.GetProbability(AliPID::kPion) &&\r
- pproton > pPidXi.GetProbability(AliPID::kKaon) ) lIsPosInXiProton = kTRUE;\r
- // Check if the V0 positive track is a pi+ (case for Xi+)\r
- Double_t ppion = pPidXi.GetProbability(AliPID::kPion);\r
- if (ppion > pPidXi.GetProbability(AliPID::kElectron) &&\r
- ppion > pPidXi.GetProbability(AliPID::kMuon) &&\r
- ppion > pPidXi.GetProbability(AliPID::kKaon) &&\r
- ppion > pPidXi.GetProbability(AliPID::kProton) ) lIsPosInXiPion = kTRUE;\r
- // Check if the V0 positive track is a proton (case for Omega-)\r
- pproton = 0.;\r
- pproton = pPidOmega.GetProbability(AliPID::kProton);\r
- if (pproton > pPidOmega.GetProbability(AliPID::kElectron) &&\r
- pproton > pPidOmega.GetProbability(AliPID::kMuon) &&\r
- pproton > pPidOmega.GetProbability(AliPID::kPion) &&\r
- pproton > pPidOmega.GetProbability(AliPID::kKaon) ) lIsPosInOmegaProton = kTRUE;\r
- // Check if the V0 positive track is a pi+ (case for Omega+)\r
- ppion = 0.;\r
- ppion = pPidOmega.GetProbability(AliPID::kPion);\r
- if (ppion > pPidOmega.GetProbability(AliPID::kElectron) &&\r
- ppion > pPidOmega.GetProbability(AliPID::kMuon) &&\r
- ppion > pPidOmega.GetProbability(AliPID::kKaon) &&\r
- ppion > pPidOmega.GetProbability(AliPID::kProton) ) lIsPosInOmegaPion = kTRUE;\r
- } \r
- // - Combined VO-negative-daughter PID\r
- AliPID nPidXi; nPidXi.SetPriors( lPriorsGuessXi );\r
- AliPID nPidOmega; nPidOmega.SetPriors( lPriorsGuessOmega ); \r
- if( nTrackXi->IsOn(AliESDtrack::kESDpid) ) { \r
- Double_t r[10] = {0.}; nTrackXi->GetESDpid(r);\r
- nPidXi.SetProbabilities(r);\r
- nPidOmega.SetProbabilities(r);\r
- // Check if the V0 negative track is a pi- (case for Xi-)\r
- Double_t ppion = nPidXi.GetProbability(AliPID::kPion);\r
- if (ppion > nPidXi.GetProbability(AliPID::kElectron) &&\r
- ppion > nPidXi.GetProbability(AliPID::kMuon) &&\r
- ppion > nPidXi.GetProbability(AliPID::kKaon) &&\r
- ppion > nPidXi.GetProbability(AliPID::kProton) ) lIsNegInXiPion = kTRUE;\r
- // Check if the V0 negative track is an anti-proton (case for Xi+)\r
- Double_t pproton = nPidXi.GetProbability(AliPID::kProton);\r
- if (pproton > nPidXi.GetProbability(AliPID::kElectron) &&\r
- pproton > nPidXi.GetProbability(AliPID::kMuon) &&\r
- pproton > nPidXi.GetProbability(AliPID::kPion) &&\r
- pproton > nPidXi.GetProbability(AliPID::kKaon) ) lIsNegInXiProton = kTRUE;\r
- // Check if the V0 negative track is a pi- (case for Omega-)\r
- ppion = 0.;\r
- ppion = nPidOmega.GetProbability(AliPID::kPion);\r
- if (ppion > nPidOmega.GetProbability(AliPID::kElectron) &&\r
- ppion > nPidOmega.GetProbability(AliPID::kMuon) &&\r
- ppion > nPidOmega.GetProbability(AliPID::kKaon) &&\r
- ppion > nPidOmega.GetProbability(AliPID::kProton) ) lIsNegInOmegaPion = kTRUE;\r
- // Check if the V0 negative track is an anti-proton (case for Omega+)\r
- pproton = 0.;\r
- pproton = nPidOmega.GetProbability(AliPID::kProton);\r
- if (pproton > nPidOmega.GetProbability(AliPID::kElectron) &&\r
- pproton > nPidOmega.GetProbability(AliPID::kMuon) &&\r
- pproton > nPidOmega.GetProbability(AliPID::kPion) &&\r
- pproton > nPidOmega.GetProbability(AliPID::kKaon) ) lIsNegInOmegaProton = kTRUE;\r
- }\r
- // - Combined bachelor PID\r
- AliPID bachPidXi; bachPidXi.SetPriors( lPriorsGuessXi );\r
- AliPID bachPidOmega; bachPidOmega.SetPriors( lPriorsGuessOmega );\r
- if ( bachTrackXi->IsOn(AliESDtrack::kESDpid) ) { \r
- Double_t r[10] = {0.}; bachTrackXi->GetESDpid(r);\r
- bachPidXi.SetProbabilities(r);\r
- bachPidOmega.SetProbabilities(r);\r
- // Check if the bachelor track is a pion\r
- ppionBach = bachPidXi.GetProbability(AliPID::kPion);\r
- if (ppionBach > bachPidXi.GetProbability(AliPID::kElectron) &&\r
- ppionBach > bachPidXi.GetProbability(AliPID::kMuon) &&\r
- ppionBach > bachPidXi.GetProbability(AliPID::kKaon) &&\r
- ppionBach > bachPidXi.GetProbability(AliPID::kProton) ) lIsBachelorPion = kTRUE;\r
- // Check if the bachelor track is a kaon\r
- pkaonBach = bachPidOmega.GetProbability(AliPID::kKaon);\r
- if (pkaonBach > bachPidOmega.GetProbability(AliPID::kElectron) &&\r
- pkaonBach > bachPidOmega.GetProbability(AliPID::kMuon) &&\r
- pkaonBach > bachPidOmega.GetProbability(AliPID::kPion) &&\r
- pkaonBach > bachPidOmega.GetProbability(AliPID::kProton) ) lIsBachelorKaon = kTRUE; \r
- }\r
- // - 4-sigma bands on Bethe-Bloch curve\r
- // Bachelor\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;\r
- // Negative V0 daughter\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;\r
- // Positive V0 daughter\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;\r
- /* \r
- const AliExternalTrackParam *pInnerWallTrackXi = pTrackXi ->GetInnerParam(); // Do not use GetTPCInnerWall\r
- const AliExternalTrackParam *nInnerWallTrackXi = nTrackXi ->GetInnerParam();\r
- const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();\r
- if(pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ){ \r
- Double_t pMomInnerWall = pInnerWallTrackXi ->GetP();\r
- Double_t nMomInnerWall = nInnerWallTrackXi ->GetP();\r
- Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();\r
- // Bachelor\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3) lIsBachelorPionForTPC = kTRUE;\r
- if (bachMomInnerWall < 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;\r
- if (bachMomInnerWall > 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;\r
- // Negative V0 daughter\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 3 ) lIsNegPionForTPC = kTRUE;\r
- if (nMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 ) lIsNegProtonForTPC = kTRUE;\r
- if (nMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 ) lIsNegProtonForTPC = kTRUE;\r
- // Positive V0 daughter\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 3 ) lIsPosPionForTPC = kTRUE;\r
- if (pMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5) lIsPosProtonForTPC = kTRUE;\r
- if (pMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3) lIsPosProtonForTPC = kTRUE;\r
- }*/\r
- // - PID proba Vs Pt(Bach)\r
- Int_t lblBachForPID = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );\r
- TParticle* mcBachForPID = lMCstack->Particle( lblBachForPID );\r
- lmcPtBach = mcBachForPID->Pt();\r
- // - MC perfect PID\r
- if( mcBachForPID->GetPdgCode() == -211) lIsBachelorMCPiMinus = kTRUE;\r
- if( mcBachForPID->GetPdgCode() == 211) lIsBachelorMCPiPlus = kTRUE;\r
- if( mcBachForPID->GetPdgCode() == -321) lIsBachelorMCKMinus = kTRUE;\r
- if( mcBachForPID->GetPdgCode() == 321) lIsBachelorMCKPlus = kTRUE;\r
- \r
- \r
- //---------------------------------------------------------------\r
- // - MC association (care : lots of "continue;" below this line)\r
- if(fDebug > 5) cout<< "MC EventNumber: "<<lMCevent->Header()->GetEvent()<<" / MC event Number in Run : "<<lMCevent->Header()->GetEventNrInRun()<<endl;\r
- // - Level of the V0 daughters\r
- Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() ); \r
- Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() ); \r
- TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );\r
- TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );\r
- // - Level of the Xi daughters \r
- Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ; \r
- Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();\r
- if( lblMotherPosV0Dghter != lblMotherNegV0Dghter) continue; // same mother\r
- if( lblMotherPosV0Dghter < 0 ) continue; // this particle is primary, no mother \r
- if( lblMotherNegV0Dghter < 0 ) continue; // this particle is primary, no mother\r
- // mothers = Lambda candidate ... a priori\r
- TParticle* mcMotherPosV0Dghter = lMCstack->Particle( lblMotherPosV0Dghter );\r
- TParticle* mcMotherNegV0Dghter = lMCstack->Particle( lblMotherNegV0Dghter ); // MN: redundant?? already checked that labels are the same...-->same part from stack\r
- Int_t lblBach = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );\r
- TParticle* mcBach = lMCstack->Particle( lblBach ); \r
- // - Level of Xi candidate\r
- Int_t lblGdMotherPosV0Dghter = mcMotherPosV0Dghter->GetFirstMother() ;\r
- Int_t lblGdMotherNegV0Dghter = mcMotherNegV0Dghter->GetFirstMother() ;\r
- if( lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter ) continue;\r
- if( lblGdMotherPosV0Dghter < 0 ) continue; // primary lambda ... \r
- if( lblGdMotherNegV0Dghter < 0 ) continue; // primary lambda ... \r
- // Gd mothers = Xi candidate ... a priori\r
- TParticle* mcGdMotherPosV0Dghter = lMCstack->Particle( lblGdMotherPosV0Dghter );\r
- TParticle* mcGdMotherNegV0Dghter = lMCstack->Particle( lblGdMotherNegV0Dghter ); \r
- Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetFirstMother() ); \r
- if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters\r
- TParticle* mcMotherBach = lMCstack->Particle( lblMotherBach );\r
- \r
- // - Check if cascade is primary\r
- if (!(lMCstack->IsPhysicalPrimary(lblMotherBach))) continue; \r
-\r
- // - Manage boolean for association\r
- if ( mcMotherBach ->GetPdgCode() == 3312 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == 3312 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == 3312 ) {lAssoXiMinus = kTRUE;\r
- cascadeMass = 1.321;\r
- nAssoXiMinus++; }\r
- else if( mcMotherBach ->GetPdgCode() == -3312 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == -3312 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == -3312 ) {lAssoXiPlus = kTRUE;\r
- cascadeMass = 1.321;\r
- nAssoXiPlus++; }\r
- else if( mcMotherBach ->GetPdgCode() == 3334 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == 3334 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == 3334 ) {lAssoOmegaMinus = kTRUE;\r
- cascadeMass = 1.672;\r
- nAssoOmegaMinus++; }\r
- else if( mcMotherBach ->GetPdgCode() == -3334 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == -3334 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == -3334 ) {lAssoOmegaPlus = kTRUE;\r
- cascadeMass = 1.672;\r
- nAssoOmegaPlus++; }\r
- // If a proper association exists ... \r
- if(fDebug > 4){\r
- cout<<"XiMinus = "<<lAssoXiMinus <<endl;\r
- cout<<"XiPlus = "<<lAssoXiPlus <<endl;\r
- cout<<"OmegaMinus = "<<lAssoOmegaMinus<<endl;\r
- cout<<"OmegaPlus = "<<lAssoOmegaPlus <<endl \r
- <<"----" <<endl; \r
- }\r
- if(fDebug > 5){\r
- cout<<endl;\r
- cout<<"- V0 daughters - "<<endl;\r
- cout<<" + V0 Pos. / Label : "<<lblPosV0Dghter<<" - Pdg Code : "<<mcPosV0Dghter->GetTitle()<<endl;\r
- cout<<" - V0 Neg. / Label : "<<lblNegV0Dghter<<" - Pdg Code : "<<mcNegV0Dghter->GetTitle()<<endl;\r
-\r
- cout<<"- Xi daughters - "<<endl;\r
- cout<<" + V0 Pos. mother / Label : "<<lblMotherPosV0Dghter<<" - Pdg Code : "<<mcMotherPosV0Dghter->GetTitle()<<endl;\r
- cout<<" - V0 Neg. mother / Label : "<<lblMotherNegV0Dghter<<" - Pdg Code : "<<mcMotherNegV0Dghter->GetTitle()<<endl;\r
- \r
- cout<<" -- Bach. / Label :"<<lblBach<<" - Pdg Code : "<<mcBach->GetTitle()<<endl;\r
- \r
- cout<<"- Xi candidate -"<<endl;\r
- cout<<" + V0 Pos. Gd Mother / Label : "<<lblGdMotherPosV0Dghter<<" - Pdg Code : "<< mcGdMotherPosV0Dghter->GetTitle()<<endl;\r
- cout<<" - V0 Neg. Gd Mother / Label : "<<lblGdMotherNegV0Dghter<<" - Pdg Code : "<< mcGdMotherNegV0Dghter->GetTitle()<<endl;\r
- \r
- cout<<" -- Mother Bach. / Label : "<<lblMotherBach<<" - Pdg Code : "<<mcMotherBach->GetTitle()<<endl;\r
- cout<<endl;\r
- }\r
- \r
- lmcPt = mcMotherBach->Pt();\r
- lmcRapCasc = 0.5*TMath::Log( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) );\r
- lmcEta = mcMotherBach->Eta();\r
- lmcTransvRadius = mcBach->R(); // to get the decay point of Xi, = the production vertex of Bachelor ...\r
- TVector3 lmcTVect3Mom( mcMotherBach->Px(), mcMotherBach->Py(), mcMotherBach->Pz() );\r
- lrecoPt = xiESD->Pt();\r
- lrecoTransvRadius = TMath::Sqrt( xiESD->Xv() * xiESD->Xv() + xiESD->Yv() * xiESD->Yv() );\r
- TVector3 lrecoTVect3Mom( xiESD->Px(), xiESD->Py(), xiESD->Pz() );\r
- lDeltaPhiMcReco = lmcTVect3Mom.DeltaPhi( lrecoTVect3Mom ) * 180.0/TMath::Pi();\r
- lmcPtPosV0Dghter = mcPosV0Dghter->Pt() ;\r
- lmcPtNegV0Dghter = mcNegV0Dghter->Pt();\r
- lrecoP = xiESD->P();\r
- Double_t nV0mom[3] = {0. ,0. ,0. };\r
- Double_t pV0mom[3] = {0. ,0. ,0. };\r
- xiESD->GetNPxPyPz(nV0mom[0],nV0mom[1],nV0mom[2]); \r
- xiESD->GetPPxPyPz(pV0mom[0],pV0mom[1],pV0mom[2]);\r
- lV0mom = TMath::Sqrt(TMath::Power(nV0mom[0]+pV0mom[0],2)+TMath::Power(nV0mom[1]+pV0mom[1],2)+TMath::Power(nV0mom[2]+pV0mom[2],2));\r
- Double_t lBachMomX = 0.; Double_t lBachMomY = 0.; Double_t lBachMomZ = 0.;\r
- xiESD->GetBPxPyPz( lBachMomX, lBachMomY, lBachMomZ );\r
- lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );\r
- lnTrackTransvMom = TMath::Sqrt( nV0mom[0]*nV0mom[0] + nV0mom[1]*nV0mom[1] );\r
- lpTrackTransvMom = TMath::Sqrt( pV0mom[0]*pV0mom[0] + pV0mom[1]*pV0mom[1] );\r
- \r
- } else if ( fAnalysisType == "AOD" ) {\r
-\r
- // - Load the cascade\r
- const AliAODcascade *xiAOD = lAODevent->GetCascade(iXi);\r
- if (!xiAOD) continue;\r
-\r
- // - Connection to daughter tracks of the current cascade\r
- AliAODTrack *pTrackXi = dynamic_cast<AliAODTrack*>( xiAOD->GetDaughter(0) );\r
- AliAODTrack *nTrackXi = dynamic_cast<AliAODTrack*>( xiAOD->GetDaughter(1) );\r
- AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xiAOD->GetDecayVertexXi()->GetDaughter(0) );\r
- if (!pTrackXi || !nTrackXi || !bachTrackXi ) {\r
- AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");\r
- continue;\r
- }\r
- UInt_t lIdxPosXi = (UInt_t) TMath::Abs( pTrackXi->GetID() );\r
- UInt_t lIdxNegXi = (UInt_t) TMath::Abs( nTrackXi->GetID() );\r
- UInt_t lBachIdx = (UInt_t) TMath::Abs( bachTrackXi->GetID() );\r
-\r
- // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)\r
- if(lBachIdx == lIdxNegXi) {\r
- AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;\r
- }\r
- if(lBachIdx == lIdxPosXi) {\r
- AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;\r
- }\r
- lPosTPCClusters = pTrackXi->GetTPCNcls();\r
- lNegTPCClusters = nTrackXi->GetTPCNcls();\r
- lBachTPCClusters = bachTrackXi->GetTPCNcls();\r
-\r
- // - Rejection of a poor quality tracks\r
- if (fkQualityCutTPCrefit) {\r
- // - Poor quality related to TPCrefit\r
- if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }\r
- if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }\r
- if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }\r
- }\r
- if (fkQualityCutnTPCcls) {\r
- // - Poor quality related to TPC clusters\r
- if(lPosTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }\r
- if(lNegTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }\r
- if(lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!"); continue; }\r
- }\r
-\r
- etaPos = pTrackXi->Eta();\r
- etaNeg = nTrackXi->Eta();\r
- etaBach = bachTrackXi->Eta();\r
-\r
- // - Info over reconstructed cascades\r
- if( bachTrackXi->Charge() < 0 ) {\r
- lInvMassXiMinus = xiAOD->MassXi();\r
- lInvMassOmegaMinus = xiAOD->MassOmega();\r
- }\r
- if( bachTrackXi->Charge() > 0 ){\r
- lInvMassXiPlus = xiAOD->MassXi();\r
- lInvMassOmegaPlus = xiAOD->MassOmega();\r
- }\r
- lDcaXiDaughters = xiAOD->DcaXiDaughters();\r
- lDcaBachToPrimVertexXi = xiAOD->DcaBachToPrimVertex();\r
- lXiCosineOfPointingAngle = xiAOD->CosPointingAngleXi( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );\r
- lPosXi[0] = xiAOD->DecayVertexXiX();\r
- lPosXi[1] = xiAOD->DecayVertexXiY();\r
- lPosXi[2] = xiAOD->DecayVertexXiZ();\r
- lInvMassLambdaAsCascDghter = xiAOD->MassLambda();\r
- lDcaV0DaughtersXi = xiAOD->DcaV0Daughters();\r
- lV0CosineOfPointingAngleXi = xiAOD->CosPointingAngle( lPosXi );\r
- lV0CosineOfPointingAngle = xiAOD->CosPointingAngle( lBestPrimaryVtxPos );\r
- lPosV0Xi[0] = xiAOD->DecayVertexV0X();\r
- lPosV0Xi[1] = xiAOD->DecayVertexV0Y();\r
- lPosV0Xi[2] = xiAOD->DecayVertexV0Z();\r
- lDcaV0ToPrimVertexXi = xiAOD->DcaV0ToPrimVertex();\r
- lDcaPosToPrimVertexXi = xiAOD->DcaPosToPrimVertex();\r
- lDcaNegToPrimVertexXi = xiAOD->DcaNegToPrimVertex();\r
- lChargeXi = xiAOD->ChargeXi();\r
-\r
- //------------------\r
- // - PID Information\r
- // Combined VO-positive-daughter PID\r
- // Combined bachelor PID\r
- /* \r
- AliPID bachPidXi; bachPidXi.SetPriors( lPriorsGuessXi );\r
- AliPID bachPidOmega; bachPidOmega.SetPriors( lPriorsGuessOmega );\r
-\r
- if ( bachTrackXi->IsOn(AliESDtrack::kESDpid) ) { // Combined PID exists\r
- Double_t r[10] = {0.}; bachTrackXi->GetESDpid(r);\r
- bachPidXi.SetProbabilities(r);\r
- bachPidOmega.SetProbabilities(r);\r
- // Check if the bachelor track is a pion\r
- ppionBach = bachPidXi.GetProbability(AliPID::kPion);\r
- if (ppionBach > bachPidXi.GetProbability(AliPID::kElectron) &&\r
- ppionBach > bachPidXi.GetProbability(AliPID::kMuon) &&\r
- ppionBach > bachPidXi.GetProbability(AliPID::kKaon) &&\r
- ppionBach > bachPidXi.GetProbability(AliPID::kProton) ) lIsBachelorPion = kTRUE;\r
- // Check if the bachelor track is a kaon\r
- pkaonBach = bachPidOmega.GetProbability(AliPID::kKaon);\r
- if (pkaonBach > bachPidOmega.GetProbability(AliPID::kElectron) &&\r
- pkaonBach > bachPidOmega.GetProbability(AliPID::kMuon) &&\r
- pkaonBach > bachPidOmega.GetProbability(AliPID::kPion) &&\r
- pkaonBach > bachPidOmega.GetProbability(AliPID::kProton) ) lIsBachelorKaon = kTRUE;\r
- }// end if bachelor track with existing combined PID\r
- */\r
-\r
- // - TPC PID: 4-sigma bands on Bethe-Bloch curve\r
- // Bachelor\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;\r
- // Negative V0 daughter\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;\r
- // Positive V0 daughter\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;\r
- if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;\r
- /*\r
- const AliExternalTrackParam *pInnerWallTrackXi = pTrackXi ->GetInnerParam(); // Do not use GetTPCInnerWall\r
- const AliExternalTrackParam *nInnerWallTrackXi = nTrackXi ->GetInnerParam();\r
- const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();\r
- if(pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ){\r
- Double_t pMomInnerWall = pInnerWallTrackXi ->GetP();\r
- Double_t nMomInnerWall = nInnerWallTrackXi ->GetP();\r
- Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();\r
- // Bachelor\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3) lIsBachelorPionForTPC = kTRUE;\r
- if (bachMomInnerWall < 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;\r
- if (bachMomInnerWall > 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;\r
- // Negative V0 daughter\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 3 ) lIsNegPionForTPC = kTRUE;\r
- if (nMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 ) lIsNegProtonForTPC = kTRUE;\r
- if (nMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 ) lIsNegProtonForTPC = kTRUE;\r
- // Positive V0 daughter\r
- if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 3 ) lIsPosPionForTPC = kTRUE;\r
- if (pMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5) lIsPosProtonForTPC = kTRUE;\r
- if (pMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3) lIsPosProtonForTPC = kTRUE;\r
- }*/\r
-\r
- // - PID proba Vs Pt(Bach)\r
- Int_t lblBachForPID = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );\r
- AliAODMCParticle* mcBachForPID = (AliAODMCParticle*) arrayMC->At( lblBachForPID );\r
- lmcPtBach = mcBachForPID->Pt();\r
-\r
- // - MC perfect PID\r
- if( mcBachForPID->PdgCode() == -211) lIsBachelorMCPiMinus = kTRUE;\r
- if( mcBachForPID->PdgCode() == 211) lIsBachelorMCPiPlus = kTRUE;\r
- if( mcBachForPID->PdgCode() == -321) lIsBachelorMCKMinus = kTRUE;\r
- if( mcBachForPID->PdgCode() == 321) lIsBachelorMCKPlus = kTRUE;\r
-\r
- //--------------------------------------------------------------\r
- // - MC association (care : lots of "continue;" below this line)\r
- if(fDebug > 5) cout<<"MC EventNumber : "<<lMCevent->Header()->GetEvent()<<" / MC event Number in Run : "<<lMCevent->Header()->GetEventNrInRun()<<endl;\r
- // - Level of the V0 daughters\r
- Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );\r
- Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );\r
- AliAODMCParticle* mcPosV0Dghter = (AliAODMCParticle*) arrayMC->At( lblPosV0Dghter );\r
- AliAODMCParticle* mcNegV0Dghter = (AliAODMCParticle*) arrayMC->At( lblNegV0Dghter );\r
- // - Level of the Xi daughters\r
- Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetMother(); \r
- Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetMother();\r
- if( lblMotherPosV0Dghter != lblMotherNegV0Dghter) continue; // same mother\r
- if( lblMotherPosV0Dghter < 0 ) continue; // this particle is primary, no mother\r
- if( lblMotherNegV0Dghter < 0 ) continue; // this particle is primary, no mother\r
- // mothers = Lambda candidate ... a priori\r
- AliAODMCParticle* mcMotherPosV0Dghter = (AliAODMCParticle*) arrayMC->At( lblMotherPosV0Dghter );\r
- AliAODMCParticle* mcMotherNegV0Dghter = (AliAODMCParticle*) arrayMC->At( lblMotherNegV0Dghter ); \r
- Int_t lblBach = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );\r
- AliAODMCParticle* mcBach = (AliAODMCParticle*) arrayMC->At( lblBach );\r
- // - Level of Xi candidate\r
- Int_t lblGdMotherPosV0Dghter = mcMotherPosV0Dghter->GetMother() ;\r
- Int_t lblGdMotherNegV0Dghter = mcMotherNegV0Dghter->GetMother() ;\r
- if( lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter ) continue;\r
- if( lblGdMotherPosV0Dghter < 0 ) continue; // primary lambda ...\r
- if( lblGdMotherNegV0Dghter < 0 ) continue; // primary lambda ...\r
- // Gd mothers = Xi candidate ... a priori\r
- AliAODMCParticle* mcGdMotherPosV0Dghter = (AliAODMCParticle*) arrayMC->At( lblGdMotherPosV0Dghter );\r
- AliAODMCParticle* mcGdMotherNegV0Dghter = (AliAODMCParticle*) arrayMC->At( lblGdMotherNegV0Dghter );\r
- Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetMother() );\r
- if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters\r
- AliAODMCParticle* mcMotherBach = (AliAODMCParticle*) arrayMC->At( lblMotherBach );\r
-\r
- // - Check if cascade is primary\r
- if (!(mcMotherBach->IsPhysicalPrimary())) continue;\r
-\r
- // - Manage boolean for association\r
- if ( mcMotherBach ->GetPdgCode() == 3312 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == 3312 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == 3312 ) {lAssoXiMinus = kTRUE;\r
- cascadeMass = 1.321;\r
- nAssoXiMinus++; }\r
- else if( mcMotherBach ->GetPdgCode() == -3312 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == -3312 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == -3312 ) {lAssoXiPlus = kTRUE;\r
- cascadeMass = 1.321;\r
- nAssoXiPlus++; }\r
- else if( mcMotherBach ->GetPdgCode() == 3334 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == 3334 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == 3334 ) {lAssoOmegaMinus = kTRUE;\r
- cascadeMass = 1.672;\r
- nAssoOmegaMinus++; }\r
- else if( mcMotherBach ->GetPdgCode() == -3334 &&\r
- mcGdMotherPosV0Dghter ->GetPdgCode() == -3334 &&\r
- mcGdMotherNegV0Dghter ->GetPdgCode() == -3334 ) {lAssoOmegaPlus = kTRUE;\r
- cascadeMass = 1.672;\r
- nAssoOmegaPlus++; }\r
-\r
- lmcPt = mcMotherBach->Pt();\r
- lmcRapCasc = 0.5*TMath::Log( (mcMotherBach->E() + mcMotherBach->Pz()) / (mcMotherBach->E() - mcMotherBach->Pz() +1.e-13) );\r
- lmcEta = mcMotherBach->Eta();\r
- Float_t decayCascX = mcBach->Xv();\r
- Float_t decayCascY = mcBach->Yv();\r
- lmcTransvRadius = TMath::Sqrt(decayCascX*decayCascX+decayCascY*decayCascY); // decay point of Xi, = the production vertex of Bachelor ...\r
- TVector3 lmcTVect3Mom( mcMotherBach->Px(), mcMotherBach->Py(), mcMotherBach->Pz() );\r
- Double_t xiMomX = xiAOD->MomXiX();\r
- Double_t xiMomY = xiAOD->MomXiY();\r
- Double_t xiMomZ = xiAOD->MomXiZ();\r
- lrecoPt = TMath::Sqrt( xiMomX*xiMomX + xiMomY*xiMomY ); \r
- lrecoTransvRadius = TMath::Sqrt( xiAOD->DecayVertexXiX() * xiAOD->DecayVertexXiX() + xiAOD->DecayVertexXiY() * xiAOD->DecayVertexXiY() );\r
- TVector3 lrecoTVect3Mom( xiMomX, xiMomY, xiMomZ );\r
- lDeltaPhiMcReco = lmcTVect3Mom.DeltaPhi( lrecoTVect3Mom ) * 180.0/TMath::Pi();\r
- lmcPtPosV0Dghter = mcPosV0Dghter->Pt() ;\r
- lmcPtNegV0Dghter = mcNegV0Dghter->Pt();\r
- lrecoP = TMath::Sqrt( xiMomX*xiMomX + xiMomY*xiMomY + xiMomZ*xiMomZ );;\r
- Double_t lV0momX = xiAOD->MomV0X();\r
- Double_t lV0momY = xiAOD->MomV0Y();\r
- Double_t lV0momZ = xiAOD->MomV0Z();\r
- lV0mom = TMath::Sqrt(TMath::Power(lV0momX,2)+TMath::Power(lV0momY,2)+TMath::Power(lV0momZ,2));\r
- Double_t lBachMomX = xiAOD->MomBachX();\r
- Double_t lBachMomY = xiAOD->MomBachY();\r
- lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );\r
- Double_t lV0NMomX = xiAOD->MomNegX();\r
- Double_t lV0NMomY = xiAOD->MomNegY();\r
- Double_t lV0PMomX = xiAOD->MomPosX();\r
- Double_t lV0PMomY = xiAOD->MomPosY();\r
- lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX + lV0NMomY*lV0NMomY );\r
- lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX + lV0PMomY*lV0PMomY );\r
- \r
- }\r
-\r
- lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );\r
- lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] ); \r
-\r
- // - Cut on pt of the three daughter tracks\r
- if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;\r
- if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;\r
- if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;\r
- \r
- // - Cut on pseudorapidity of the three daughter tracks\r
- if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;\r
- if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;\r
- if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;\r
- \r
- // - Extra-selection for cascade candidates\r
- if (fkExtraSelections) {\r
- if (lDcaXiDaughters > 0.3) continue; // in AliCascadeVertexer\r
- if (lXiCosineOfPointingAngle < 0.999 ) continue; // in AliCascadeVertexer\r
- if (lDcaV0ToPrimVertexXi < 0.05) continue; // in AliCascadeVertexer\r
- if (lDcaBachToPrimVertexXi < 0.03) continue; // in AliCascadeVertexer\r
- if (lDcaV0DaughtersXi > 1.) continue; // in AliV0vertexer\r
- if (lV0CosineOfPointingAngleXi < 0.998) continue; // in AliV0vertexer\r
- if (lDcaPosToPrimVertexXi < 0.1) continue; // in AliV0vertexer\r
- if (lDcaNegToPrimVertexXi < 0.1) continue; // in AliV0vertexer\r
- if(lXiRadius < .9) continue; // in AliCascadeVertexer\r
- if(lV0RadiusXi < 0.9) continue; // in AliV0vertexer\r
- }\r
-\r
- //-------------------------\r
- // - Fill combined PID TH1s\r
- if( lChargeXi < 0 && lIsBachelorPion ) fHistMassWithCombPIDXiMinus ->Fill( lInvMassXiMinus );\r
- if( lChargeXi > 0 && lIsBachelorPion ) fHistMassWithCombPIDXiPlus ->Fill( lInvMassXiPlus );\r
- if( lChargeXi < 0 && lIsBachelorKaon ) fHistMassWithCombPIDOmegaMinus ->Fill( lInvMassOmegaMinus );\r
- if( lChargeXi > 0 && lIsBachelorKaon ) fHistMassWithCombPIDOmegaPlus ->Fill( lInvMassOmegaPlus );\r
- if( lChargeXi < 0 ) fHistMassXiMinus ->Fill( lInvMassXiMinus );\r
- if( lChargeXi > 0 ) fHistMassXiPlus ->Fill( lInvMassXiPlus );\r
- if( lChargeXi < 0 ) fHistMassOmegaMinus ->Fill( lInvMassOmegaMinus );\r
- if( lChargeXi > 0 ) fHistMassOmegaPlus ->Fill( lInvMassOmegaPlus );\r
- if(lIsBachelorPion) f2dHistPIDprobaPionVsMCPtBach->Fill( lmcPtBach, ppionBach );\r
- if(lIsBachelorKaon) f2dHistPIDprobaKaonVsMCPtBach->Fill( lmcPtBach, pkaonBach );\r
- if( lChargeXi < 0 && lIsBachelorMCPiMinus ) fHistMassWithMcPIDXiMinus ->Fill( lInvMassXiMinus );\r
- if( lChargeXi > 0 && lIsBachelorMCPiPlus ) fHistMassWithMcPIDXiPlus ->Fill( lInvMassXiPlus );\r
- if( lChargeXi < 0 && lIsBachelorMCKMinus ) fHistMassWithMcPIDOmegaMinus ->Fill( lInvMassOmegaMinus );\r
- if( lChargeXi > 0 && lIsBachelorMCKPlus ) fHistMassWithMcPIDOmegaPlus ->Fill( lInvMassOmegaPlus );\r
-\r
-\r
- // - No association, skip the rest of the code\r
- if(!lAssoXiMinus && !lAssoXiPlus && !lAssoOmegaMinus && !lAssoOmegaPlus) continue; \r
-\r
- //--------------\r
- // - Proper time \r
- // For cascade (reconstructed) \r
- Double_t lctau = TMath::Sqrt(TMath::Power((lPosXi[0]-lBestPrimaryVtxPos[0]),2)+TMath::Power((lPosXi[1]-lBestPrimaryVtxPos[1]),2)+TMath::Power((lPosXi[2]-lBestPrimaryVtxPos[2]),2));\r
- if (lrecoP!=0) lctau = lctau*cascadeMass/lrecoP; \r
- else lctau = -1.;\r
- // For Lambda (reconstructed)\r
- Float_t lambdaMass = 1.115683; // PDG mass \r
- Float_t distV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2)+TMath::Power((lPosV0Xi[2]-lPosXi[2]),2)); \r
- Float_t lctauV0 = -1.;\r
- if (lV0mom!=0) lctauV0 = distV0Xi*lambdaMass/lV0mom; \r
- // Distance\r
- Float_t distTV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));\r
- \r
- //------------------------------------------------------------\r
- // - Fill histos for the cascade candidates associated with MC\r
- if( lChargeXi < 0 && lAssoXiMinus){ \r
- fHistAsMCMassXiMinus ->Fill( lInvMassXiMinus );\r
- if(lIsBachelorPion) f2dHistAsMCandCombPIDGenPtVsGenYXiMinus->Fill( lmcPt, lmcRapCasc );\r
- f2dHistAsMCGenPtVsGenYXiMinus ->Fill( lmcPt, lmcRapCasc);\r
- fHistAsMCGenEtaXiMinus ->Fill( lmcEta );\r
- f2dHistAsMCResPtXiMinus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );\r
- f2dHistAsMCResRXiMinus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );\r
- f2dHistAsMCResPhiXiMinus ->Fill( lmcPt, lDeltaPhiMcReco );\r
- f2dHistAsMCptProtonMCptXiMinus->Fill(lmcPt,lmcPtPosV0Dghter);\r
- fHistV0CosineOfPointingAnglevsPtXi->Fill(lmcPt,lV0CosineOfPointingAngle);\r
- } \r
- else if( lChargeXi > 0 && lAssoXiPlus){ \r
- fHistAsMCMassXiPlus ->Fill( lInvMassXiPlus );\r
- if(lIsBachelorPion) f2dHistAsMCandCombPIDGenPtVsGenYXiPlus->Fill( lmcPt, lmcRapCasc );\r
- f2dHistAsMCGenPtVsGenYXiPlus ->Fill( lmcPt, lmcRapCasc);\r
- fHistAsMCGenEtaXiPlus ->Fill( lmcEta );\r
- f2dHistAsMCResPtXiPlus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );\r
- f2dHistAsMCResRXiPlus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );\r
- f2dHistAsMCResPhiXiPlus ->Fill( lmcPt, lDeltaPhiMcReco );\r
- f2dHistAsMCptAntiprotonMCptXiPlus->Fill(lmcPt,lmcPtNegV0Dghter);\r
- fHistV0CosineOfPointingAnglevsPtXi->Fill(lmcPt,lV0CosineOfPointingAngle);\r
- }\r
- else if( lChargeXi < 0 && lAssoOmegaMinus){ \r
- fHistAsMCMassOmegaMinus ->Fill( lInvMassOmegaMinus );\r
- if(lIsBachelorKaon) f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus->Fill( lmcPt, lmcRapCasc );\r
- f2dHistAsMCGenPtVsGenYOmegaMinus ->Fill( lmcPt, lmcRapCasc );\r
- fHistAsMCGenEtaOmegaMinus ->Fill( lmcEta );\r
- f2dHistAsMCResPtOmegaMinus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );\r
- f2dHistAsMCResROmegaMinus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );\r
- f2dHistAsMCResPhiOmegaMinus ->Fill( lmcPt, lDeltaPhiMcReco );\r
- f2dHistAsMCptProtonMCptOmegaMinus->Fill(lmcPt,lmcPtPosV0Dghter);\r
- fHistV0CosineOfPointingAnglevsPtOmega->Fill(lmcPt,lV0CosineOfPointingAngle);\r
- } \r
- else if( lChargeXi > 0 && lAssoOmegaPlus){ \r
- fHistAsMCMassOmegaPlus ->Fill( lInvMassOmegaPlus );\r
- if(lIsBachelorKaon) f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus->Fill( lmcPt, lmcRapCasc );\r
- f2dHistAsMCGenPtVsGenYOmegaPlus ->Fill( lmcPt, lmcRapCasc );\r
- fHistAsMCGenEtaOmegaPlus ->Fill( lmcEta );\r
- f2dHistAsMCResPtOmegaPlus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );\r
- f2dHistAsMCResROmegaPlus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );\r
- f2dHistAsMCResPhiOmegaPlus ->Fill( lmcPt, lDeltaPhiMcReco );\r
- f2dHistAsMCptAntiprotonMCptOmegaPlus->Fill(lmcPt,lmcPtNegV0Dghter);\r
- fHistV0CosineOfPointingAnglevsPtOmega->Fill(lmcPt,lV0CosineOfPointingAngle);\r
- }\r
- fHistV0toXiCosineOfPointingAngle->Fill(lV0CosineOfPointingAngleXi);\r
-\r
- //------------------ \r
- // - Fill containers\r
- \r
- // - Filling the AliCFContainer (optimisation of topological selections + systematics)\r
- Double_t lContainerCutVars[19] = {0.0};\r
- lContainerCutVars[0] = lDcaXiDaughters;\r
- lContainerCutVars[1] = lDcaBachToPrimVertexXi;\r
- lContainerCutVars[2] = lXiCosineOfPointingAngle;\r
- lContainerCutVars[3] = lXiRadius;\r
- lContainerCutVars[4] = lInvMassLambdaAsCascDghter;\r
- lContainerCutVars[5] = lDcaV0DaughtersXi;\r
- lContainerCutVars[6] = lV0CosineOfPointingAngleXi;\r
- lContainerCutVars[7] = lV0RadiusXi;\r
- lContainerCutVars[8] = lDcaV0ToPrimVertexXi; \r
- lContainerCutVars[9] = lDcaPosToPrimVertexXi;\r
- lContainerCutVars[10] = lDcaNegToPrimVertexXi;\r
- lContainerCutVars[13] = lmcPt;\r
- lContainerCutVars[16] = lctau;\r
- lContainerCutVars[17] = lctauV0;\r
- lContainerCutVars[18] = distTV0Xi;\r
- // All cases should be covered below\r
- if( lChargeXi < 0 && lAssoXiMinus ) {\r
- lContainerCutVars[11] = lInvMassXiMinus;\r
- lContainerCutVars[12] = lInvMassOmegaMinus;//1.63;\r
- lContainerCutVars[14] = lmcRapCasc;\r
- lContainerCutVars[15] = -1.;\r
- if ( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) \r
- fCFContAsCascadeCuts->Fill(lContainerCutVars,0); // for Xi-\r
- }\r
- if( lChargeXi > 0 && lAssoXiPlus ) {\r
- lContainerCutVars[11] = lInvMassXiPlus;\r
- lContainerCutVars[12] = lInvMassOmegaPlus;//1.26;\r
- lContainerCutVars[14] = lmcRapCasc;\r
- lContainerCutVars[15] = -1.; \r
- if ( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) \r
- fCFContAsCascadeCuts->Fill(lContainerCutVars,1); // for Xi+\r
- }\r
- if( lChargeXi < 0 && lAssoOmegaMinus ) {\r
- lContainerCutVars[11] = lInvMassXiMinus;//1.63;\r
- lContainerCutVars[12] = lInvMassOmegaMinus;\r
- lContainerCutVars[14] = -1.;\r
- lContainerCutVars[15] = lmcRapCasc;\r
- if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) \r
- fCFContAsCascadeCuts->Fill(lContainerCutVars,2); // for Omega-\r
- }\r
- if( lChargeXi > 0 && lAssoOmegaPlus ) {\r
- lContainerCutVars[11] = lInvMassXiPlus;//1.26;\r
- lContainerCutVars[12] = lInvMassOmegaPlus;\r
- lContainerCutVars[14] = -1.;\r
- lContainerCutVars[15] = lmcRapCasc;\r
- if ( lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) \r
- fCFContAsCascadeCuts->Fill(lContainerCutVars,3); // for Omega+\r
- }\r
- \r
- // - Filling the AliCFContainers related to PID\r
- Double_t lContainerPIDVars[3] = {0.0};\r
- \r
- // Xi Minus \r
- if( lChargeXi < 0 && lAssoXiMinus ) {\r
- lContainerPIDVars[0] = lmcPt;\r
- lContainerPIDVars[1] = lInvMassXiMinus;\r
- lContainerPIDVars[2] = lmcRapCasc;\r
- // No PID\r
- fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 0); // No PID\r
- // TPC PID\r
- if( lIsBachelorPionForTPC ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if( lIsBachelorPionForTPC && lIsPosProtonForTPC ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks \r
- if( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- // Combined PID\r
- if( lIsBachelorPion ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if( lIsBachelorPion && lIsPosInXiProton ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if( lIsBachelorPion && lIsPosInXiProton && lIsNegInXiPion ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- } \r
- lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; \r
- \r
- // Xi Plus \r
- if( lChargeXi > 0 && lAssoXiPlus ) {\r
- lContainerPIDVars[0] = lmcPt;\r
- lContainerPIDVars[1] = lInvMassXiPlus;\r
- lContainerPIDVars[2] = lmcRapCasc;\r
- // No PID\r
- fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 0); // No PID\r
- // TPC PID\r
- if( lIsBachelorPionForTPC ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if( lIsBachelorPionForTPC && lIsNegProtonForTPC ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- // Combined PID\r
- if( lIsBachelorPion ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if( lIsBachelorPion && lIsNegInXiProton ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if( lIsBachelorPion && lIsNegInXiProton && lIsPosInXiPion ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- } \r
- lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; \r
- \r
- // Omega Minus \r
- if( lChargeXi < 0 && lAssoOmegaMinus ) {\r
- lContainerPIDVars[0] = lmcPt;\r
- lContainerPIDVars[1] = lInvMassOmegaMinus;\r
- lContainerPIDVars[2] = lmcRapCasc; \r
- // No PID\r
- fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 0); // No PID\r
- // TPC PID\r
- if( lIsBachelorKaonForTPC ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if( lIsBachelorKaonForTPC && lIsPosProtonForTPC ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- // Combined PID\r
- if( lIsBachelorKaon ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if( lIsBachelorKaon && lIsPosInOmegaProton ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if( lIsBachelorKaon && lIsPosInOmegaProton && lIsNegInOmegaPion ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- } \r
- lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; \r
- \r
- // Omega Plus \r
- if( lChargeXi > 0 && lAssoOmegaPlus) {\r
- lContainerPIDVars[0] = lmcPt;\r
- lContainerPIDVars[1] = lInvMassOmegaPlus;\r
- lContainerPIDVars[2] = lmcRapCasc; \r
- // No PID\r
- fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 0); // No PID\r
- // TPC PID\r
- if( lIsBachelorKaonForTPC ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track\r
- if( lIsBachelorKaonForTPC && lIsNegProtonForTPC ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks\r
- if( lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks\r
- // Combined PID\r
- if( lIsBachelorKaon ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor\r
- if( lIsBachelorKaon && lIsNegInOmegaProton ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon\r
- if( lIsBachelorKaon && lIsNegInOmegaProton && lIsPosInOmegaPion ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson\r
- } \r
- \r
- }// End of loop over reconstructed cascades\r
- \r
- fHistnAssoXiMinus->Fill(nAssoXiMinus);\r
- fHistnAssoXiPlus->Fill(nAssoXiPlus);\r
- fHistnAssoOmegaMinus->Fill(nAssoOmegaMinus);\r
- fHistnAssoOmegaPlus->Fill(nAssoOmegaPlus); \r
- \r
- // Post output data.\r
- PostData(1, fListHistCascade);\r
- PostData(2, fCFContCascadePIDAsXiMinus);\r
- PostData(3, fCFContCascadePIDAsXiPlus);\r
- PostData(4, fCFContCascadePIDAsOmegaMinus);\r
- PostData(5, fCFContCascadePIDAsOmegaPlus);\r
- PostData(6, fCFContAsCascadeCuts);\r
-\r
-} \r
-\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskCheckPerformanceCascadepp276::Terminate(Option_t *) {\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
- \r
- /* TList *cRetrievedList = 0x0;\r
- cRetrievedList = (TList*)GetOutputData(1);\r
- if(!cRetrievedList) {\r
- Printf("ERROR - AliAnalysisTaskCheckPerformanceCascadepp276 : ouput data container list not available\n");\r
- return;\r
- } \r
- \r
- fHistTrackMultiplicityBeforeAnySel = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistTrackMultiplicityBeforeAnySel") );\r
- if (!fHistTrackMultiplicityBeforeAnySel) {\r
- Printf("ERROR - AliAnalysisTaskCheckPerformanceCascadepp276 : fHistTrackMultiplicityBeforeAnySel not available");\r
- return;\r
- }\r
- \r
- \r
- TCanvas *canCheckPerformanceCascade = new TCanvas("AliAnalysisTaskCheckPerformanceCascadepp276","Multiplicity",10,10,510,510);\r
- canCheckPerformanceCascade->cd(1)->SetLogy();\r
-\r
- fHistTrackMultiplicityBeforeAnySel->SetMarkerStyle(22);\r
- fHistTrackMultiplicityBeforeAnySel->DrawCopy("E");\r
- */\r
-}\r
+/*************************************************************** *
+ * Authors : Antonin Maire, Boris Hippolyte
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskCheckPerformanceCascadePbPb class
+// This task is for a performance study of cascade identification in PbPb.
+// It works with MC info and ESD/AOD.
+// Origin : AliAnalysisTaskCheckPerformanceCascade class by A. Maire Nov2010, antonin.maire@ires.in2p3.fr
+// Modified for PbPb analysis: M. Nicassio Feb2011, maria.nicassio@ba.infn.it:
+// - physics selection moved to the run.C macro
+// - added centrality selection and possibility to select events in nTracks ranges
+// - added new histograms
+// - modified binning of some histograms and containers
+// - flag to enable CF container usage
+// - check in the destructor for CAF usage
+// - flag for acceptance cut in the MC part
+// - in the MC particle selection IsPhysicalPrimary added and number of particles taken as appropriate for HIJING
+// (however for cascades one gets the same if runs on Nprimaries in the stack and does not check IsPhysicalPrimary)
+// - automatic settings for PID
+// - selection of injected cascades and HIJING cascades (kind of "bug" in method IsFromBGEvent())
+// - added proper time histograms for cascades and lambdas
+// - cos of PA V0 wrt Xi vertex and not primary vertex
+// - distance xi-V0 added in the container
+// - AOD analysis developed (January 2012)
+//
+//
+//
+// Adapted to pp 2.76 analysis: D. Colella, domenico.colella@ba.infn.it (Nov. 2012):
+// - added new and removed other histograms
+// - Physics selection moved here (mainly for normalization in the efficiency calcuation)
+// - Centrality selection deleted
+// - 3DHisto denominator moved before any event selection for Normalization
+// - injected and natural part of MC selection removed
+//
+//
+//
+//-----------------------------------------------------------------
+
+
+#include <Riostream.h>
+
+#include "TList.h"
+#include "TFile.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TH3F.h"
+#include "TVector3.h"
+#include "TCanvas.h"
+#include "TParticle.h"
+#include "TMath.h"
+
+#include "AliLog.h"
+#include "AliHeader.h"
+#include "AliMCEvent.h"
+#include "AliStack.h"
+#include "AliMultiplicity.h"
+#include "AliInputEventHandler.h"
+#include "AliAnalysisManager.h"
+
+#include "AliCFContainer.h"
+
+#include "AliESDVZERO.h"
+
+#include "AliGenEventHeader.h"
+#include "AliGenCocktailEventHeader.h"
+#include "AliGenHijingEventHeader.h"
+#include "AliESDtrackCuts.h"
+#include "AliPIDResponse.h"
+#include "AliV0vertexer.h"
+#include "AliCascadeVertexer.h"
+#include "AliESDEvent.h"
+#include "AliESDcascade.h"
+#include "AliAODEvent.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisTaskCheckPerformanceCascadepp276.h"
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliAnalysisTaskCheckPerformanceCascadepp276)
+
+
+
+//________________________________________________________________________________________
+AliAnalysisTaskCheckPerformanceCascadepp276::AliAnalysisTaskCheckPerformanceCascadepp276()
+: AliAnalysisTaskSE(), // <- take care to AliAnalysisTask( empty )
+ fAnalysisType ("ESD"),
+ fESDtrackCuts (0),
+ fPIDResponse (0),
+ fkRerunV0CascVertexers (0),
+ fkSDDselectionOn (kTRUE),
+ fkQualityCutZprimVtxPos (kTRUE),
+ fkRejectEventPileUp (kTRUE),
+ fkQualityCutNoTPConlyPrimVtx (kTRUE),
+ fkQualityCutTPCrefit (kTRUE),
+ fkQualityCutnTPCcls (kTRUE),
+ fwithSDD (kTRUE),
+ fMinnTPCcls (0),
+ fkExtraSelections (0),
+ fVtxRange (0),
+ fVtxRangeMin (0),
+ fApplyAccCut (0),
+ fMinPtCutOnDaughterTracks (0),
+ fEtaCutOnDaughterTracks (0),
+
+ // - Plots initialisation
+ fListHistCascade(0),
+
+ // - General Plots
+ // Cascade multiplicity plots
+ fHistCascadeMultiplicityBeforeAnySel(0),
+ fHistCascadeMultiplicityAfterSDDSel(0),
+ fHistCascadeMultiplicityAfterPhysicsSel(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistCascadeMultiplicityAfterVertexCutSel(0),
+ fHistnXiPlusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnXiMinusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnOmegaPlusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnOmegaMinusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnXiPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnXiMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnOmegaPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnOmegaMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnAssoXiMinus(0), // For the Reconstructed-Associated cascades
+ fHistnAssoXiPlus(0), // For the Reconstructed-Associated cascades
+ fHistnAssoOmegaMinus(0), // For the Reconstructed-Associated cascades
+ fHistnAssoOmegaPlus(0), // For the Reconstructed-Associated cascades
+ // Tracks multiplicity plots
+ fHistTrackMultiplicityBeforeAnySel(0),
+ fHistTrackMultiplicityAfterSDDSel(0),
+ fHistTrackMultiplicityAfterPhysicsSel(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistTrackMultiplicityAfterVertexCutSel(0),
+ // Vertex position plots (BestVertex)
+ fHistPVx(0), // After any selections but before |Z| < 10 cm
+ fHistPVy(0), // After any selections but before |Z| < 10 cm
+ fHistPVz(0), // After any selections but before |Z| < 10 cm
+ fHistPVxAnalysis(0), // After any event selections
+ fHistPVyAnalysis(0), // After any event selections
+ fHistPVzAnalysis(0), // After any event selections
+ // - Plots before Physics Selection
+ f3dHistGenPtVsGenYvsNtracksXiMinus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenctauvsYXiMinus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenYvsNtracksXiPlus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenctauvsYXiPlus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenYvsNtracksOmegaMinus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenctauvsYOmegaMinus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenYvsNtracksOmegaPlus(0), // After the SDD event selection (For efficinecy calculation)
+ f3dHistGenPtVsGenctauvsYOmegaPlus(0), // After the SDD event selection (For efficinecy calculation)
+ // - Generated cascade plots
+ // After all the event selections
+ //Xi-
+ fHistEtaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYXiMinusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ //Xi+
+ fHistEtaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYXiPlusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ //Omega-
+ fHistEtaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ //Omega+
+ fHistEtaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+
+ // - Associated to MC cascade plots
+ fHistMassXiMinus(0), // For the Reconstructed-Associated cascades
+ fHistMassXiPlus(0), // For the Reconstructed-Associated cascades
+ fHistMassOmegaMinus(0), // For the Reconstructed-Associated cascades
+ fHistMassOmegaPlus(0), // For the Reconstructed-Associated cascades
+ // Effective mass histos with combined PID
+ fHistMassWithCombPIDXiMinus(0),
+ fHistMassWithCombPIDXiPlus(0),
+ fHistMassWithCombPIDOmegaMinus(0),
+ fHistMassWithCombPIDOmegaPlus(0),
+ // PID Probability versus MC Pt(bachelor track)
+ f2dHistPIDprobaKaonVsMCPtBach(0), f2dHistPIDprobaPionVsMCPtBach(0),
+ // Effective mass histos with perfect MC PID on the bachelor
+ fHistMassWithMcPIDXiMinus(0), fHistMassWithMcPIDXiPlus(0),
+ fHistMassWithMcPIDOmegaMinus(0), fHistMassWithMcPIDOmegaPlus(0),
+ // Effective mass histos for the cascade candidates associated with MC
+ fHistAsMCMassXiMinus(0),
+ fHistAsMCMassXiPlus(0),
+ fHistAsMCMassOmegaMinus(0),
+ fHistAsMCMassOmegaPlus(0),
+ // Generated Pt Vs generated y, for the cascade candidates associated with MC + Info Comb. PID
+ f2dHistAsMCandCombPIDGenPtVsGenYXiMinus(0),
+ f2dHistAsMCandCombPIDGenPtVsGenYXiPlus(0),
+ f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus(0),
+ f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus(0),
+ // Generated Pt Vs generated y, for the cascade candidates associated with MC
+ f2dHistAsMCGenPtVsGenYXiMinus(0),
+ f2dHistAsMCGenPtVsGenYXiPlus(0),
+ f2dHistAsMCGenPtVsGenYOmegaMinus(0),
+ f2dHistAsMCGenPtVsGenYOmegaPlus(0),
+ // Generated Eta of the the cascade candidates associated with MC
+ fHistAsMCGenEtaXiMinus(0),
+ fHistAsMCGenEtaXiPlus(0),
+ fHistAsMCGenEtaOmegaMinus(0),
+ fHistAsMCGenEtaOmegaPlus(0),
+ // Resolution in Pt as function of generated Pt
+ f2dHistAsMCResPtXiMinus(0),
+ f2dHistAsMCResPtXiPlus(0),
+ f2dHistAsMCResPtOmegaMinus(0),
+ f2dHistAsMCResPtOmegaPlus(0),
+ // Resolution in R(2D) as function of generated R
+ f2dHistAsMCResRXiMinus(0),
+ f2dHistAsMCResRXiPlus(0),
+ f2dHistAsMCResROmegaMinus(0),
+ f2dHistAsMCResROmegaPlus(0),
+ // Resolution in phi as function of generated Pt
+ f2dHistAsMCResPhiXiMinus(0),
+ f2dHistAsMCResPhiXiPlus(0),
+ f2dHistAsMCResPhiOmegaMinus(0),
+ f2dHistAsMCResPhiOmegaPlus(0),
+ // Correlation between proton (antiproton) daughter MC pt and Xi/Omega MC pt (to apply Geat/Fluka correction)
+ f2dHistAsMCptProtonMCptXiMinus(0),
+ f2dHistAsMCptAntiprotonMCptXiPlus(0),
+ f2dHistAsMCptProtonMCptOmegaMinus(0),
+ f2dHistAsMCptAntiprotonMCptOmegaPlus(0),
+ // QA plots
+ fHistV0toXiCosineOfPointingAngle(0),
+ fHistV0CosineOfPointingAnglevsPtXi(0),
+ fHistV0CosineOfPointingAnglevsPtOmega(0),
+
+ // Containers
+ fCFContCascadePIDAsXiMinus(0),
+ fCFContCascadePIDAsXiPlus(0),
+ fCFContCascadePIDAsOmegaMinus(0),
+ fCFContCascadePIDAsOmegaPlus(0),
+ fCFContAsCascadeCuts(0)
+
+ //____Dummy costructor____
+ {
+ for(Int_t iV0selIdx = 0; iV0selIdx < 7; iV0selIdx++ ) { fV0Sels [iV0selIdx ] = -1.; }
+ for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels [iCascSelIdx ] = -1.; }
+ }
+
+
+
+//_____Non-default Constructor________________________________________________________________
+AliAnalysisTaskCheckPerformanceCascadepp276::AliAnalysisTaskCheckPerformanceCascadepp276(const char *name)
+ : AliAnalysisTaskSE(name),
+ fAnalysisType ("ESD"),
+ fESDtrackCuts (0),
+ fPIDResponse (0),
+ fkRerunV0CascVertexers (0),
+ fkSDDselectionOn (kTRUE),
+ fkQualityCutZprimVtxPos (kTRUE),
+ fkRejectEventPileUp (kTRUE),
+ fkQualityCutNoTPConlyPrimVtx (kTRUE),
+ fkQualityCutTPCrefit (kTRUE),
+ fkQualityCutnTPCcls (kTRUE),
+ fwithSDD (kTRUE),
+ fMinnTPCcls (0),
+ fkExtraSelections (0),
+ fVtxRange (0),
+ fVtxRangeMin (0),
+ fApplyAccCut (0),
+ fMinPtCutOnDaughterTracks (0),
+ fEtaCutOnDaughterTracks (0),
+
+ // - Plots initialisation
+ fListHistCascade(0),
+
+ // - General Plots
+ // Cascade multiplicity plots
+ fHistCascadeMultiplicityBeforeAnySel(0),
+ fHistCascadeMultiplicityAfterSDDSel(0),
+ fHistCascadeMultiplicityAfterPhysicsSel(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistCascadeMultiplicityAfterVertexCutSel(0),
+ fHistnXiPlusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnXiMinusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnOmegaPlusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnOmegaMinusPerEvTot(0), // After any event selections, in all the eta and pt range
+ fHistnXiPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnXiMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnOmegaPlusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnOmegaMinusPerEv(0), // After any event selections, in the detector acceptance and over a pt minimum
+ fHistnAssoXiMinus(0), // For the Reconstructed-Associated cascades
+ fHistnAssoXiPlus(0), // For the Reconstructed-Associated cascades
+ fHistnAssoOmegaMinus(0), // For the Reconstructed-Associated cascades
+ fHistnAssoOmegaPlus(0), // For the Reconstructed-Associated cascades
+ // Tracks multiplicity plots
+ fHistTrackMultiplicityBeforeAnySel(0),
+ fHistTrackMultiplicityAfterSDDSel(0),
+ fHistTrackMultiplicityAfterPhysicsSel(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
+ fHistTrackMultiplicityAfterVertexCutSel(0),
+ // Vertex position plots (BestVertex)
+ fHistPVx(0), // After any selections but before |Z| < 10 cm
+ fHistPVy(0), // After any selections but before |Z| < 10 cm
+ fHistPVz(0), // After any selections but before |Z| < 10 cm
+ fHistPVxAnalysis(0), // After any event selections
+ fHistPVyAnalysis(0), // After any event selections
+ fHistPVzAnalysis(0), // After any event selections
+ // - Plots before Physics Selection
+ f3dHistGenPtVsGenYvsNtracksXiMinus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenctauvsYXiMinus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenYvsNtracksXiPlus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenctauvsYXiPlus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenYvsNtracksOmegaMinus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenctauvsYOmegaMinus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenYvsNtracksOmegaPlus(0), // After the SDD event selection (For efficiency calculation)
+ f3dHistGenPtVsGenctauvsYOmegaPlus(0), // After the SDD event selection (For efficiency calculation)
+ // - Generated cascade plots
+ // After all the event selections
+ //Xi-
+ fHistEtaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascXiMinus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYXiMinusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterXiMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ //Xi+
+ fHistEtaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascXiPlus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYXiPlusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterXiPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ //Omega-
+ fHistEtaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascOmegaMinus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterOmegaMinus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ //Omega+
+ fHistEtaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)
+ fHistThetaGenCascOmegaPlus(0), // In all the eta and pt range (as they are generated)
+ f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff(0), //
+ f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff(0), //
+ f2dHistGenPtVsGenYFdblOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaLambdaOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistThetaBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBachOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtMesDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+ fHistPtBarDghterOmegaPlus(0), // In the detector acceptance and over a pt minimum (Findable particle)
+
+ // - Associated to MC cascade plots
+ fHistMassXiMinus(0), // For the Reconstructed-Associated cascades
+ fHistMassXiPlus(0), // For the Reconstructed-Associated cascades
+ fHistMassOmegaMinus(0), // For the Reconstructed-Associated cascades
+ fHistMassOmegaPlus(0), // For the Reconstructed-Associated cascades
+ // Effective mass histos with combined PID
+ fHistMassWithCombPIDXiMinus(0),
+ fHistMassWithCombPIDXiPlus(0),
+ fHistMassWithCombPIDOmegaMinus(0),
+ fHistMassWithCombPIDOmegaPlus(0),
+ // PID Probability versus MC Pt(bachelor track)
+ f2dHistPIDprobaKaonVsMCPtBach(0), f2dHistPIDprobaPionVsMCPtBach(0),
+ // Effective mass histos with perfect MC PID on the bachelor
+ fHistMassWithMcPIDXiMinus(0), fHistMassWithMcPIDXiPlus(0),
+ fHistMassWithMcPIDOmegaMinus(0), fHistMassWithMcPIDOmegaPlus(0),
+ // Effective mass histos for the cascade candidates associated with MC
+ fHistAsMCMassXiMinus(0),
+ fHistAsMCMassXiPlus(0),
+ fHistAsMCMassOmegaMinus(0),
+ fHistAsMCMassOmegaPlus(0),
+ // Generated Pt Vs generated y, for the cascade candidates associated with MC + Info Comb. PID
+ f2dHistAsMCandCombPIDGenPtVsGenYXiMinus(0),
+ f2dHistAsMCandCombPIDGenPtVsGenYXiPlus(0),
+ f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus(0),
+ f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus(0),
+ // Generated Pt Vs generated y, for the cascade candidates associated with MC
+ f2dHistAsMCGenPtVsGenYXiMinus(0),
+ f2dHistAsMCGenPtVsGenYXiPlus(0),
+ f2dHistAsMCGenPtVsGenYOmegaMinus(0),
+ f2dHistAsMCGenPtVsGenYOmegaPlus(0),
+ // Generated Eta of the the cascade candidates associated with MC
+ fHistAsMCGenEtaXiMinus(0),
+ fHistAsMCGenEtaXiPlus(0),
+ fHistAsMCGenEtaOmegaMinus(0),
+ fHistAsMCGenEtaOmegaPlus(0),
+ // Resolution in Pt as function of generated Pt
+ f2dHistAsMCResPtXiMinus(0),
+ f2dHistAsMCResPtXiPlus(0),
+ f2dHistAsMCResPtOmegaMinus(0),
+ f2dHistAsMCResPtOmegaPlus(0),
+ // Resolution in R(2D) as function of generated R
+ f2dHistAsMCResRXiMinus(0),
+ f2dHistAsMCResRXiPlus(0),
+ f2dHistAsMCResROmegaMinus(0),
+ f2dHistAsMCResROmegaPlus(0),
+ // Resolution in phi as function of generated Pt
+ f2dHistAsMCResPhiXiMinus(0),
+ f2dHistAsMCResPhiXiPlus(0),
+ f2dHistAsMCResPhiOmegaMinus(0),
+ f2dHistAsMCResPhiOmegaPlus(0),
+ // Correlation between proton (antiproton) daughter MC pt and Xi/Omega MC pt (to apply Geat/Fluka correction)
+ f2dHistAsMCptProtonMCptXiMinus(0),
+ f2dHistAsMCptAntiprotonMCptXiPlus(0),
+ f2dHistAsMCptProtonMCptOmegaMinus(0),
+ f2dHistAsMCptAntiprotonMCptOmegaPlus(0),
+ // QA plots
+ fHistV0toXiCosineOfPointingAngle(0),
+ fHistV0CosineOfPointingAnglevsPtXi(0),
+ fHistV0CosineOfPointingAnglevsPtOmega(0),
+
+ // Containers
+ fCFContCascadePIDAsXiMinus(0),
+ fCFContCascadePIDAsXiPlus(0),
+ fCFContCascadePIDAsOmegaMinus(0),
+ fCFContCascadePIDAsOmegaPlus(0),
+ fCFContAsCascadeCuts(0)
+
+ //____Costructor____
+ {
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ // Output slot #1 writes into a TList container (cascade)
+
+ // PbPb default cuts
+ fV0Sels[0] = 33.; // max allowed chi2
+ fV0Sels[1] = 0.1; // min allowed impact parameter for the 1st daughter
+ fV0Sels[2] = 0.1; // min allowed impact parameter for the 2nd daughter
+ fV0Sels[3] = 1.5 ; // max allowed DCA between the daughter tracks
+ fV0Sels[4] = 0.9 ; // min allowed cosine of V0's pointing angle
+ fV0Sels[5] = 0.2; // min radius of the fiducial volume
+ fV0Sels[6] = 200. ; // max radius of the fiducial volume
+ fCascSels[0] = 33.; // max allowed chi2
+ fCascSels[1] = 0.01; // min allowed V0 impact parameter
+ fCascSels[2] = 0.008; // "window" around the Lambda mass
+ fCascSels[3] = 0.01; // min allowed bachelor's impact parameter
+ fCascSels[4] = 2.0 ; // max allowed DCA between the V0 and the bachelor
+ fCascSels[5] = 0.95; // min allowed cosine of the cascade pointing angle
+ fCascSels[6] = 0.2 ; // min radius of the fiducial volume
+ fCascSels[7] = 100. ; // max radius of the fiducial volume
+
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, AliCFContainer::Class());
+ DefineOutput(3, AliCFContainer::Class());
+ DefineOutput(4, AliCFContainer::Class());
+ DefineOutput(5, AliCFContainer::Class());
+ DefineOutput(6, AliCFContainer::Class());
+ }
+
+ //____Destructor____
+ AliAnalysisTaskCheckPerformanceCascadepp276::~AliAnalysisTaskCheckPerformanceCascadepp276()
+ {
+ // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.
+ // They will be deleted when fListCascade is deleted by the TSelector dtor
+ // Because of TList::SetOwner()
+ if (fListHistCascade && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fListHistCascade; fListHistCascade = 0x0;}
+ if (fCFContCascadePIDAsXiMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsXiMinus; fCFContCascadePIDAsXiMinus = 0x0;}
+ if (fCFContCascadePIDAsXiPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsXiPlus; fCFContCascadePIDAsXiPlus = 0x0;}
+ if (fCFContCascadePIDAsOmegaMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsOmegaMinus; fCFContCascadePIDAsOmegaMinus = 0x0;}
+ if (fCFContCascadePIDAsOmegaPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContCascadePIDAsOmegaPlus; fCFContCascadePIDAsOmegaPlus = 0x0;}
+ if (fCFContAsCascadeCuts && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {delete fCFContAsCascadeCuts; fCFContAsCascadeCuts = 0x0;}
+ if (fESDtrackCuts) {delete fESDtrackCuts; fESDtrackCuts = 0x0;}
+ }
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCheckPerformanceCascadepp276::UserCreateOutputObjects() {
+ // Create histograms
+ // Called once
+
+ // - Option for AliLog: to suppress the extensive info prompted by a run with MC
+ AliLog::SetGlobalLogLevel(AliLog::kError);
+
+ // - Definition of the output datamembers
+ fListHistCascade = new TList();
+ fListHistCascade->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
+
+ //-----------------------------------------------
+ // Particle Identification Setup (new PID object)
+ //-----------------------------------------------
+ AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+ fPIDResponse = inputHandler->GetPIDResponse();
+
+ // - Only used to get the number of primary reconstructed tracks
+ if (! fESDtrackCuts ){
+ fESDtrackCuts = new AliESDtrackCuts();
+ }
+
+ //----------------------
+ // Initialize the histos
+ //----------------------
+
+ //----------------------------------
+ // - Same general binning definition
+ Double_t ptBinLimits[101];
+ for (Int_t iptbin = 0; iptbin<101; ++iptbin) ptBinLimits[iptbin]=iptbin*0.1;
+ Double_t yBinLimits[111];
+ for (Int_t iybin = 0; iybin<111; ++iybin) yBinLimits[iybin]=-1.1+iybin*0.02;
+ Double_t ctauBinLimits[112];
+ for (Int_t ict = 0; ict<112; ++ict) ctauBinLimits[ict] = (Double_t) (ict-1.);
+
+ //------------------
+ // - General plots
+ // - Cascades multiplicity plots
+ if(! fHistCascadeMultiplicityBeforeAnySel) {
+ fHistCascadeMultiplicityBeforeAnySel = new TH1F("fHistCascadeMultiplicityBeforeAnySel",
+ "Cascades per event (before any selections);Nbr of Cascades/Evt;Events", 50, 0, 50);
+ fListHistCascade->Add(fHistCascadeMultiplicityBeforeAnySel);
+ }
+ if(! fHistCascadeMultiplicityAfterSDDSel) {
+ fHistCascadeMultiplicityAfterSDDSel = new TH1F("fHistCascadeMultiplicityAfterSDDSel",
+ "Cascades per event (after only the SDD selection);Nbr of Cascades/Evt;Events", 50, 0, 50);
+ fListHistCascade->Add(fHistCascadeMultiplicityAfterSDDSel);
+ }
+ if(! fHistCascadeMultiplicityAfterPhysicsSel) {
+ fHistCascadeMultiplicityAfterPhysicsSel = new TH1F("fHistCascadeMultiplicityAfterPhysicsSel",
+ "Cascades per event (after physics selection);Nbr of Cascades/Evt;Events", 50, 0, 50);
+ fListHistCascade->Add(fHistCascadeMultiplicityAfterPhysicsSel);
+ }
+ if(! fHistCascadeMultiplicityForSelEvtNoTPCOnly) {
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnly",
+ "Cascades per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events", 50, 0, 50);
+ fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnly);
+ }
+ if(! fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup) {
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup",
+ "Cascades per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events", 50, 0, 50);
+ fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup);
+ }
+ if(! fHistCascadeMultiplicityAfterVertexCutSel) {
+ fHistCascadeMultiplicityAfterVertexCutSel = new TH1F("fHistCascadeMultiplicityAfterVertexCutSel",
+ "Cascades per event (after vertex cut selection);Nbr of Cascades/Evt;Events", 50, 0, 50);
+ fListHistCascade->Add(fHistCascadeMultiplicityAfterVertexCutSel);
+ }
+ // - Tracks multiplicity plots
+ if(! fHistTrackMultiplicityBeforeAnySel) {
+ fHistTrackMultiplicityBeforeAnySel = new TH1F("fHistTrackMultiplicityBeforeAnySel",
+ "Tracks per event (before any selections);Nbr of Tracks/Evt;Events", 200, 0, 200);
+ fListHistCascade->Add(fHistTrackMultiplicityBeforeAnySel);
+ }
+ if(! fHistTrackMultiplicityAfterSDDSel) {
+ fHistTrackMultiplicityAfterSDDSel = new TH1F("fHistTrackMultiplicityAfterSDDSel",
+ "Tracks per event (after only the SDD selection);Nbr of Tracks/Evt;Events", 200, 0, 200);
+ fListHistCascade->Add(fHistTrackMultiplicityAfterSDDSel);
+ }
+ if(! fHistTrackMultiplicityAfterPhysicsSel) {
+ fHistTrackMultiplicityAfterPhysicsSel = new TH1F("fHistTrackMultiplicityAfterPhysicsSel",
+ "Tracks per event (after physics selection);Nbr of Tracks/Evt;Events", 200, 0, 200);
+ fListHistCascade->Add(fHistTrackMultiplicityAfterPhysicsSel);
+ }
+ if(! fHistTrackMultiplicityForSelEvtNoTPCOnly) {
+ fHistTrackMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnly",
+ "Tracks per event (for selected events with well-established PV);Nbr of Tracks/Evt;Events", 200, 0, 200);
+ fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnly);
+ }
+ if(! fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup) {
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup",
+ "Tracks per event (for selected events with well-establisched PV and no pile-up);Nbr of Tracks/Evt;Events", 200, 0, 200);
+ fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
+ }
+ if(! fHistTrackMultiplicityAfterVertexCutSel) {
+ fHistTrackMultiplicityAfterVertexCutSel = new TH1F("fHistTrackMultiplicityAfterVertexCutSel",
+ "Tracks per event (after vertex cut selection);Nbr of Tracks/Evt;Events", 200, 0, 200);
+ fListHistCascade->Add(fHistTrackMultiplicityAfterVertexCutSel);
+ }
+ // - Vertex position plots
+ if(! fHistPVx ){
+ fHistPVx = new TH1F("fHistPVx", "Best PV position in x; x (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVx);
+ }
+ if(! fHistPVy ){
+ fHistPVy = new TH1F("fHistPVy", "Best PV position in y; y (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVy);
+ }
+ if(! fHistPVz ){
+ fHistPVz = new TH1F("fHistPVz", "Best PV position in z; z (cm); Events", 400, -20, 20);
+ fListHistCascade->Add(fHistPVz);
+ }
+ if(! fHistPVxAnalysis ){
+ fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", "Best PV position in x (after events selections); x (cm); Events", 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVxAnalysis);
+ }
+ if(! fHistPVyAnalysis ){
+ fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", "Best PV position in y (after events selections); y (cm); Events" , 2000, -0.5, 0.5);
+ fListHistCascade->Add(fHistPVyAnalysis);
+ }
+ if(! fHistPVzAnalysis ){
+ fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", "Best PV position in z (after events selections); z (cm); Events", 400, -20, 20);
+ fListHistCascade->Add(fHistPVzAnalysis);
+ }
+
+ //--------------------------
+ // - Generated cascade plots
+ // - Generated Cascade multiplicity distributions (for singol cascade)
+ fHistnXiPlusPerEvTot = new TH1F("fHistnXiPlusPerEvTot", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnXiPlusPerEvTot);
+ fHistnXiMinusPerEvTot = new TH1F("fHistnXiMinusPerEvTot", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnXiMinusPerEvTot);
+ fHistnOmegaPlusPerEvTot = new TH1F("fHistnOmegaPlusPerEvTot", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnOmegaPlusPerEvTot);
+ fHistnOmegaMinusPerEvTot = new TH1F("fHistnOmegaMinusPerEvTot", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnOmegaMinusPerEvTot);
+ fHistnXiPlusPerEv = new TH1F("fHistnXiPlusPerEv", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnXiPlusPerEv);
+ fHistnXiMinusPerEv = new TH1F("fHistnXiMinusPerEv", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnXiMinusPerEv);
+ fHistnOmegaPlusPerEv = new TH1F("fHistnOmegaPlusPerEv", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnOmegaPlusPerEv);
+ fHistnOmegaMinusPerEv = new TH1F("fHistnOmegaMinusPerEv", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnOmegaMinusPerEv);
+ // - Xi-
+ // - Pseudo-Rapidity distribution
+ if (!fHistEtaGenCascXiMinus) {
+ fHistEtaGenCascXiMinus = new TH1F("fHistEtaGenCascXiMinus", "#eta of any gen. #Xi^{-}; #eta; Number of Casc", 200, -10, 10);
+ fListHistCascade->Add(fHistEtaGenCascXiMinus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksXiMinus) {
+ f3dHistGenPtVsGenYvsNtracksXiMinus = new TH3D("f3dHistGenPtVsGenYvsNtracksXiMinus", "MC P_{t} Vs MC Y of Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiMinus);
+ }
+ if (!f3dHistGenPtVsGenctauvsYXiMinus) {
+ f3dHistGenPtVsGenctauvsYXiMinus = new TH3D("f3dHistGenPtVsGenctauvsYXiMinus", "MC P_{t} Vs MC ctau Vs Y of Gen #Xi^{-}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiMinus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff) {
+ f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff", "MC P_{t} Vs MC Y of Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff);
+ }
+ if (!f3dHistGenPtVsGenctauvsYXiMinusPhysEff) {
+ f3dHistGenPtVsGenctauvsYXiMinusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYXiMinusPhysEff", "MC P_{t} Vs MC ctau Vs Y of Gen #Xi^{-}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiMinusPhysEff);
+ }
+ // - Info at the generation level of multi-strange particle
+ if (!fHistThetaGenCascXiMinus) {
+ fHistThetaGenCascXiMinus = new TH1F("fHistThetaGenCascXiMinus", "#theta of gen. #Xi^{-}; #theta; Number of Casc.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaGenCascXiMinus);
+ }
+ if (!f2dHistGenPtVsGenYFdblXiMinus) {
+ f2dHistGenPtVsGenYFdblXiMinus = new TH2D("f2dHistGenPtVsGenYFdblXiMinus", "MC P_{t} Vs MC Y of findable Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistGenPtVsGenYFdblXiMinus);
+ }
+ // - Theta distribution the daughters (control plots)
+ if (!fHistThetaLambdaXiMinus) {
+ fHistThetaLambdaXiMinus = new TH1F("fHistThetaLambdaXiMinus", "#theta of gen. #Lambda (Xi dghter); #theta_{#Lambda}; Number of #Lambda^0", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaLambdaXiMinus);
+ }
+ if (!fHistThetaBachXiMinus) {
+ fHistThetaBachXiMinus = new TH1F("fHistThetaBachXiMinus", "#theta of gen. Bach.; #theta_{Bach}; Number of Bach.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBachXiMinus);
+ }
+ if (!fHistThetaMesDghterXiMinus) {
+ fHistThetaMesDghterXiMinus = new TH1F("fHistThetaMesDghterXiMinus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaMesDghterXiMinus);
+ }
+ if (!fHistThetaBarDghterXiMinus) {
+ fHistThetaBarDghterXiMinus = new TH1F("fHistThetaBarDghterXiMinus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBarDghterXiMinus);
+ }
+ // - Pt distribution (control plots)
+ if (!fHistPtBachXiMinus) {
+ fHistPtBachXiMinus = new TH1F("fHistPtBachXiMinus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBachXiMinus);
+ }
+ if (!fHistPtMesDghterXiMinus) {
+ fHistPtMesDghterXiMinus = new TH1F("fHistPtMesDghterXiMinus", "p_{t} of gen. Meson #Lambda dghter; pt_{MesDght}; Number of Mes.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtMesDghterXiMinus);
+ }
+ if (!fHistPtBarDghterXiMinus) {
+ fHistPtBarDghterXiMinus = new TH1F("fHistPtBarDghterXiMinus", "p_{t} of gen. Baryon #Lambda dghter; pt_{BarDght}; Number of Bar.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBarDghterXiMinus);
+ }
+ // - Xi+
+ // - Pseudo-Rapidity distribution
+ if (!fHistEtaGenCascXiPlus) {
+ fHistEtaGenCascXiPlus = new TH1F("fHistEtaGenCascXiPlus", "#eta of any gen. #Xi^{+}; #eta; Number of Casc", 200, -10, 10);
+ fListHistCascade->Add(fHistEtaGenCascXiPlus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksXiPlus) {
+ f3dHistGenPtVsGenYvsNtracksXiPlus = new TH3D("f3dHistGenPtVsGenYvsNtracksXiPlus", "MC P_{t} Vs MC Y of Gen #Xi^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiPlus);
+ }
+ if (!f3dHistGenPtVsGenctauvsYXiPlus) {
+ f3dHistGenPtVsGenctauvsYXiPlus = new TH3D("f3dHistGenPtVsGenctauvsYXiPlus", "MC P_{t} Vs MC ctau Vs Yof Gen #Xi^{+}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiPlus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff) {
+ f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff", "MC P_{t} Vs MC Y of Gen #Xi^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff);
+ }
+ if (!f3dHistGenPtVsGenctauvsYXiPlusPhysEff) {
+ f3dHistGenPtVsGenctauvsYXiPlusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYXiPlusPhysEff", "MC P_{t} Vs MC ctau Vs Yof Gen #Xi^{+}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYXiPlusPhysEff);
+ }
+ // - Info at the generation level of multi-strange particle
+ if (!fHistThetaGenCascXiPlus) {
+ fHistThetaGenCascXiPlus = new TH1F("fHistThetaGenCascXiPlus", "#theta of gen. #Xi^{+}; #theta; Number of Casc.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaGenCascXiPlus);
+ }
+ if (!f2dHistGenPtVsGenYFdblXiPlus) {
+ f2dHistGenPtVsGenYFdblXiPlus = new TH2D("f2dHistGenPtVsGenYFdblXiPlus", "MC P_{t} Vs MC Y of findable Gen #Xi^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistGenPtVsGenYFdblXiPlus);
+ }
+ // - Theta distribution the daughters (control plots)
+ if (!fHistThetaLambdaXiPlus) {
+ fHistThetaLambdaXiPlus = new TH1F("fHistThetaLambdaXiPlus", "#theta of gen. #Lambda (Xi dghter); #theta_{#Lambda}; Number of #Lambda", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaLambdaXiPlus);
+ }
+ if (!fHistThetaBachXiPlus) {
+ fHistThetaBachXiPlus = new TH1F("fHistThetaBachXiPlus", "#theta of gen. Bach.; #theta_{Bach}; Number of Bach.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBachXiPlus);
+ }
+ if (!fHistThetaMesDghterXiPlus) {
+ fHistThetaMesDghterXiPlus = new TH1F("fHistThetaMesDghterXiPlus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaMesDghterXiPlus);
+ }
+ if (!fHistThetaBarDghterXiPlus) {
+ fHistThetaBarDghterXiPlus = new TH1F("fHistThetaBarDghterXiPlus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBarDghterXiPlus);
+ }
+ // - Pt distribution (control plots)
+ if (!fHistPtBachXiPlus) {
+ fHistPtBachXiPlus = new TH1F("fHistPtBachXiPlus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBachXiPlus);
+ }
+ if (!fHistPtMesDghterXiPlus) {
+ fHistPtMesDghterXiPlus = new TH1F("fHistPtMesDghterXiPlus", "p_{t} of gen. Meson #Lambda dghter; pt_{MesDght}; Number of Mes.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtMesDghterXiPlus);
+ }
+ if (!fHistPtBarDghterXiPlus) {
+ fHistPtBarDghterXiPlus = new TH1F("fHistPtBarDghterXiPlus", "p_{t} of gen. Baryon #Lambda dghter); pt_{BarDght}; Number of Bar.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBarDghterXiPlus);
+ }
+ // - Omega-
+ // - Pseudo-Rapidity distribution
+ if (!fHistEtaGenCascOmegaMinus) {
+ fHistEtaGenCascOmegaMinus = new TH1F("fHistEtaGenCascOmegaMinus", "#eta of any gen. #Omega^{-}; #eta; Number of Casc", 200, -10, 10);
+ fListHistCascade->Add(fHistEtaGenCascOmegaMinus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksOmegaMinus) {
+ f3dHistGenPtVsGenYvsNtracksOmegaMinus = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaMinus", "MC P_{t} Vs MC Y of Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaMinus);
+ }
+ if (!f3dHistGenPtVsGenctauvsYOmegaMinus) {
+ f3dHistGenPtVsGenctauvsYOmegaMinus = new TH3D("f3dHistGenPtVsGenctauvsYOmegaMinus", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{-} ", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaMinus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff) {
+ f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff", "MC P_{t} Vs MC Y of Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff);
+ }
+ if (!f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff) {
+ f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{-}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff);
+ }
+ // - Info at the generation level of multi-strange particle
+ if (!fHistThetaGenCascOmegaMinus) {
+ fHistThetaGenCascOmegaMinus = new TH1F("fHistThetaGenCascOmegaMinus", "#theta of gen. #Omega^{-}; #theta; Number of Casc.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaGenCascOmegaMinus);
+ }
+ if (!f2dHistGenPtVsGenYFdblOmegaMinus) {
+ f2dHistGenPtVsGenYFdblOmegaMinus = new TH2D("f2dHistGenPtVsGenYFdblOmegaMinus", "MC P_{t} Vs MC Y of findable Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaMinus);
+ }
+ // - Theta distribution the daughters (control plots)
+ if (!fHistThetaLambdaOmegaMinus) {
+ fHistThetaLambdaOmegaMinus = new TH1F("fHistThetaLambdaOmegaMinus", "#theta of gen. #Lambda (Omega dghter); #theta_{#Lambda}; Number of #Lambda", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaLambdaOmegaMinus);
+ }
+ if (!fHistThetaBachOmegaMinus) {
+ fHistThetaBachOmegaMinus = new TH1F("fHistThetaBachOmegaMinus", "#theta of gen. Bach.;#theta_{Bach};Number of Bach.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBachOmegaMinus);
+ }
+ if (!fHistThetaMesDghterOmegaMinus) {
+ fHistThetaMesDghterOmegaMinus = new TH1F("fHistThetaMesDghterOmegaMinus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaMesDghterOmegaMinus);
+ }
+ if (!fHistThetaBarDghterOmegaMinus) {
+ fHistThetaBarDghterOmegaMinus = new TH1F("fHistThetaBarDghterOmegaMinus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBarDghterOmegaMinus);
+ }
+ // - Pt distribution (control plots)
+ if (!fHistPtBachOmegaMinus) {
+ fHistPtBachOmegaMinus = new TH1F("fHistPtBachOmegaMinus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBachOmegaMinus);
+ }
+ if (!fHistPtMesDghterOmegaMinus) {
+ fHistPtMesDghterOmegaMinus = new TH1F("fHistPtMesDghterOmegaMinus", "p_{t} of gen. Meson #Lambda dghter); pt_{MesDght}; Number of Mes.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtMesDghterOmegaMinus);
+ }
+ if (!fHistPtBarDghterOmegaMinus) {
+ fHistPtBarDghterOmegaMinus = new TH1F("fHistPtBarDghterOmegaMinus", "p_{t} of gen. Baryon #Lambda dghter); pt_{BarDght}; Number of Bar.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBarDghterOmegaMinus);
+ }
+ // - Omega+
+ // - Pseudo-Rapidity distribution
+ if (!fHistEtaGenCascOmegaPlus) {
+ fHistEtaGenCascOmegaPlus = new TH1F("fHistEtaGenCascOmegaPlus", "#eta of any gen. #Omega^{+}; #eta; Number of Casc", 200, -10, 10);
+ fListHistCascade->Add(fHistEtaGenCascOmegaPlus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksOmegaPlus) {
+ f3dHistGenPtVsGenYvsNtracksOmegaPlus = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaPlus", "MC P_{t} Vs MC Y of Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaPlus);
+ }
+ if (!f3dHistGenPtVsGenctauvsYOmegaPlus) {
+ f3dHistGenPtVsGenctauvsYOmegaPlus = new TH3D("f3dHistGenPtVsGenctauvsYOmegaPlus", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{+} ", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaPlus);
+ }
+ if (!f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff) {
+ f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff = new TH3D("f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff", "MC P_{t} Vs MC Y of Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 110, -1.1, 1.1, 200, 0., 200.);
+ fListHistCascade->Add(f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff);
+ }
+ if (!f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff) {
+ f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff = new TH3D("f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff", "MC P_{t} Vs MC ctau Vs Y of Gen #Omega^{+}", 100, ptBinLimits, 111, ctauBinLimits, 110, yBinLimits);
+ fListHistCascade->Add(f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff);
+ }
+ // - Info at the generation level of multi-strange particle
+ if (!fHistThetaGenCascOmegaPlus) {
+ fHistThetaGenCascOmegaPlus = new TH1F("fHistThetaGenCascOmegaPlus", "#theta of gen. #Omega^{+}; #theta; Number of Casc.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaGenCascOmegaPlus);
+ }
+ if (!f2dHistGenPtVsGenYFdblOmegaPlus) {
+ f2dHistGenPtVsGenYFdblOmegaPlus = new TH2D("f2dHistGenPtVsGenYFdblOmegaPlus", "MC P_{t} Vs MC Y of findable Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaPlus);
+ }
+ // - Info at the generation level of multi-strange particle
+ if (!fHistThetaGenCascOmegaPlus) {
+ fHistThetaGenCascOmegaPlus = new TH1F("fHistThetaGenCascOmegaPlus", "#theta of gen. #Omega^{+}; #theta; Number of Casc.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaGenCascOmegaPlus);
+ }
+ if (!f2dHistGenPtVsGenYFdblOmegaPlus) {
+ f2dHistGenPtVsGenYFdblOmegaPlus = new TH2D("f2dHistGenPtVsGenYFdblOmegaPlus", "MC P_{t} Vs MC Y of findable Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaPlus);
+ }
+ // - Theta distribution the daughters (control plots)
+ if (!fHistThetaLambdaOmegaPlus) {
+ fHistThetaLambdaOmegaPlus = new TH1F("fHistThetaLambdaOmegaPlus", "#theta of gen. #Lambda (Omega dghter); #theta_{#Lambda}; Number of #Lambda", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaLambdaOmegaPlus);
+ }
+ if (!fHistThetaBachOmegaPlus) {
+ fHistThetaBachOmegaPlus = new TH1F("fHistThetaBachOmegaPlus", "#theta of gen. Bach.; #theta_{Bach}; Number of Bach.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBachOmegaPlus);
+ }
+ if (!fHistThetaMesDghterOmegaPlus) {
+ fHistThetaMesDghterOmegaPlus = new TH1F("fHistThetaMesDghterOmegaPlus", "#theta of gen. Meson #Lambda dghter; #theta_{MesDght}; Number of Mes.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaMesDghterOmegaPlus);
+ }
+ if (!fHistThetaBarDghterOmegaPlus) {
+ fHistThetaBarDghterOmegaPlus = new TH1F("fHistThetaBarDghterOmegaPlus", "#theta of gen. Baryon #Lambda dghter; #theta_{BarDght}; Number of Bar.", 200, -10, 190);
+ fListHistCascade->Add(fHistThetaBarDghterOmegaPlus);
+ }
+ // - Pt distribution (control plots)
+ if (!fHistPtBachOmegaPlus) {
+ fHistPtBachOmegaPlus = new TH1F("fHistPtBachOmegaPlus", "p_{t} of gen. Bach.; pt_{Bach}; Number of Bach.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBachOmegaPlus);
+ }
+ if (!fHistPtMesDghterOmegaPlus) {
+ fHistPtMesDghterOmegaPlus = new TH1F("fHistPtMesDghterOmegaPlus", "p_{t} of gen. Meson #Lambda dghter; pt_{MesDght}; Number of Mes.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtMesDghterOmegaPlus);
+ }
+ if (!fHistPtBarDghterOmegaPlus) {
+ fHistPtBarDghterOmegaPlus = new TH1F("fHistPtBarDghterOmegaPlus", "p_{t} of gen. Baryon #Lambda dghter); pt_{BarDght}; Number of Bar.", 200, 0, 10);
+ fListHistCascade->Add(fHistPtBarDghterOmegaPlus);
+ }
+
+ //-------------------------------------------------------------------------
+ // - Any reconstructed cascades + reconstructed cascades associated with MC
+
+ // - Multiplicity cascde plots
+ fHistnAssoXiMinus= new TH1F("fHistnAssoXiMinus", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnAssoXiMinus);
+ fHistnAssoXiPlus= new TH1F("fHistnAssoXiPlus", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnAssoXiPlus);
+ fHistnAssoOmegaMinus= new TH1F("fHistnAssoOmegaMinus", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnAssoOmegaMinus);
+ fHistnAssoOmegaPlus= new TH1F("fHistnAssoOmegaPlus", "", 25, 0, 25);
+ fListHistCascade->Add(fHistnAssoOmegaPlus);
+ // - Effective mass histos for cascades candidates.
+ if (! fHistMassXiMinus) {
+ fHistMassXiMinus = new TH1F("fHistMassXiMinus","#Xi^{-} candidates; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassXiMinus);
+ }
+ if (! fHistMassXiPlus) {
+ fHistMassXiPlus = new TH1F("fHistMassXiPlus","#Xi^{+} candidates; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassXiPlus);
+ }
+ if (! fHistMassOmegaMinus) {
+ fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus","#Omega^{-} candidates; M( #Lambda , K^{-} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassOmegaMinus);
+ }
+ if (! fHistMassOmegaPlus) {
+ fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus","#Omega^{+} candidates; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassOmegaPlus);
+ }
+ // - Effective mass histos with combined PID
+ if (! fHistMassWithCombPIDXiMinus) {
+ fHistMassWithCombPIDXiMinus = new TH1F("fHistMassWithCombPIDXiMinus","#Xi^{-} candidates, with Bach. comb. PID; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassWithCombPIDXiMinus);
+ }
+ if (! fHistMassWithCombPIDXiPlus) {
+ fHistMassWithCombPIDXiPlus = new TH1F("fHistMassWithCombPIDXiPlus","#Xi^{+} candidates, with Bach. comb. PID; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassWithCombPIDXiPlus);
+ }
+ if (! fHistMassWithCombPIDOmegaMinus) {
+ fHistMassWithCombPIDOmegaMinus = new TH1F("fHistMassWithCombPIDOmegaMinus","#Omega^{-} candidates, with Bach. comb. PID; M( #Lambda , K^{-} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassWithCombPIDOmegaMinus);
+ }
+ if (! fHistMassWithCombPIDOmegaPlus) {
+ fHistMassWithCombPIDOmegaPlus = new TH1F("fHistMassWithCombPIDOmegaPlus","#Omega^{+} candidates, with Bach. comb. PID; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassWithCombPIDOmegaPlus);
+ }
+ // - PID Probability versus MC Pt(bachelor track)
+ if (! f2dHistPIDprobaKaonVsMCPtBach ){
+ f2dHistPIDprobaKaonVsMCPtBach = new TH2F("f2dHistPIDprobaKaonVsMCPtBach", "Comb. PID proba to be K^{#pm} Vs MC Bach. Pt; Pt_{MC}(Bach.) (GeV/c); Comb. PID Proba (Bach. = K^{#pm})", 100, 0.0, 5.0, 110, 0.0, 1.10);
+ fListHistCascade->Add(f2dHistPIDprobaKaonVsMCPtBach);
+ }
+ if(! f2dHistPIDprobaPionVsMCPtBach ){
+ f2dHistPIDprobaPionVsMCPtBach = new TH2F("f2dHistPIDprobaPionVsMCPtBach", "Comb. PID proba to be #pi^{#pm} Vs MC Bach. Pt; Pt_{MC}(Bach.) (GeV/c); Comb. PID Proba (Bach. = #pi^{#pm})", 100, 0.0, 5.0, 110, 0.0, 1.10);
+ fListHistCascade->Add(f2dHistPIDprobaPionVsMCPtBach);
+ }
+ // - Effective mass histos with perfect MC PID on the bachelor
+ if (! fHistMassWithMcPIDXiMinus) {
+ fHistMassWithMcPIDXiMinus = new TH1F("fHistMassWithMcPIDXiMinus", "#Xi^{-} candidates, with Bach. MC PID; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassWithMcPIDXiMinus);
+ }
+ if (! fHistMassWithMcPIDXiPlus) {
+ fHistMassWithMcPIDXiPlus = new TH1F("fHistMassWithMcPIDXiPlus", "#Xi^{+} candidates, with Bach. MC PID; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistMassWithMcPIDXiPlus);
+ }
+ if (! fHistMassWithMcPIDOmegaMinus) {
+ fHistMassWithMcPIDOmegaMinus = new TH1F("fHistMassWithMcPIDOmegaMinus", "#Omega^{-} candidates, with Bach. MC PID; M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassWithMcPIDOmegaMinus);
+ }
+ if (! fHistMassWithMcPIDOmegaPlus) {
+ fHistMassWithMcPIDOmegaPlus = new TH1F("fHistMassWithMcPIDOmegaPlus", "#Omega^{+} candidates, with Bach. MC PID; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistMassWithMcPIDOmegaPlus);
+ }
+ // - Effective mass histos for cascades candidates ASSOCIATED with MC.
+ if (! fHistAsMCMassXiMinus) {
+ fHistAsMCMassXiMinus = new TH1F("fHistAsMCMassXiMinus", "#Xi^{-} candidates associated to MC; M( #Lambda , #pi^{-} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistAsMCMassXiMinus);
+ }
+ if (! fHistAsMCMassXiPlus) {
+ fHistAsMCMassXiPlus = new TH1F("fHistAsMCMassXiPlus", "#Xi^{+} candidates associated to MC; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2}); Counts", 400, 1.2, 2.0);
+ fListHistCascade->Add(fHistAsMCMassXiPlus);
+ }
+ if (! fHistAsMCMassOmegaMinus) {
+ fHistAsMCMassOmegaMinus = new TH1F("fHistAsMCMassOmegaMinus", "#Omega^{-} candidates associated to MC; M( #Lambda , K^{-} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistAsMCMassOmegaMinus);
+ }
+ if (! fHistAsMCMassOmegaPlus) {
+ fHistAsMCMassOmegaPlus = new TH1F("fHistAsMCMassOmegaPlus", "#Omega^{+} candidates associated to MC; M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
+ fListHistCascade->Add(fHistAsMCMassOmegaPlus);
+ }
+ // - Generated Pt Vs generated Y of the cascade candidates associated with MC + having the proper maximum proba of combined PID for the bachelor
+ if (!f2dHistAsMCandCombPIDGenPtVsGenYXiMinus) {
+ f2dHistAsMCandCombPIDGenPtVsGenYXiMinus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYXiMinus", "MC P_{t} Vs MC Y of #Xi^{-} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYXiMinus);
+ }
+ if (!f2dHistAsMCandCombPIDGenPtVsGenYXiPlus) {
+ f2dHistAsMCandCombPIDGenPtVsGenYXiPlus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYXiPlus", "MC P_{t} Vs MC Y of #Xi^{+} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 100, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYXiPlus);
+ }
+ if (!f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus) {
+ f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus", "MC P_{t} Vs MC Y of #Omega^{-} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus);
+ }
+ if (!f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus) {
+ f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus", "MC P_{t} Vs MC Y of #Omega^{+} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus);
+ }
+ // - Generated Pt Vs Generated Y, for the cascade candidates associated with MC
+ if (!f2dHistAsMCGenPtVsGenYXiMinus) {
+ f2dHistAsMCGenPtVsGenYXiMinus = new TH2F("f2dHistAsMCGenPtVsGenYXiMinus", "MC P_{t} Vs MC Y of gen. #Xi^{-} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCGenPtVsGenYXiMinus );
+ }
+ if (!f2dHistAsMCGenPtVsGenYXiPlus) {
+ f2dHistAsMCGenPtVsGenYXiPlus = new TH2F("f2dHistAsMCGenPtVsGenYXiPlus", "MC P_{t} Vs MC Y of gen. #Xi^{+} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCGenPtVsGenYXiPlus );
+ }
+ if (!f2dHistAsMCGenPtVsGenYOmegaMinus) {
+ f2dHistAsMCGenPtVsGenYOmegaMinus = new TH2F("f2dHistAsMCGenPtVsGenYOmegaMinus", "MC P_{t} Vs MC Y of gen. #Omega^{-} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCGenPtVsGenYOmegaMinus );
+ }
+ if (!f2dHistAsMCGenPtVsGenYOmegaPlus) {
+ f2dHistAsMCGenPtVsGenYOmegaPlus = new TH2F("f2dHistAsMCGenPtVsGenYOmegaPlus", "MC P_{t} Vs MC Y of gen. #Omega^{+} (associated); Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
+ fListHistCascade->Add(f2dHistAsMCGenPtVsGenYOmegaPlus );
+ }
+ // - Generated Eta of the the cascade candidates associated with MC
+ if (!fHistAsMCGenEtaXiMinus) {
+ fHistAsMCGenEtaXiMinus = new TH1F("fHistAsMCGenEtaXiMinus", "#eta of gen. #Xi^{-} (associated); #eta; Count", 100, -5, 5);
+ fListHistCascade->Add( fHistAsMCGenEtaXiMinus );
+ }
+ if (!fHistAsMCGenEtaXiPlus) {
+ fHistAsMCGenEtaXiPlus = new TH1F("fHistAsMCGenEtaXiPlus", "#eta of gen. #Xi^{+} (associated); #eta; Count", 100, -5, 5);
+ fListHistCascade->Add( fHistAsMCGenEtaXiPlus );
+ }
+ if (!fHistAsMCGenEtaOmegaMinus) {
+ fHistAsMCGenEtaOmegaMinus = new TH1F("fHistAsMCGenEtaOmegaMinus", "#eta of gen. #Omega^{-} (associated);#eta;Number of Casc", 100, -5, 5);
+ fListHistCascade->Add( fHistAsMCGenEtaOmegaMinus );
+ }
+ if (!fHistAsMCGenEtaOmegaPlus) {
+ fHistAsMCGenEtaOmegaPlus = new TH1F("fHistAsMCGenEtaOmegaPlus", "#eta of gen. #Omega^{+} (associated); #eta; Count", 100, -5, 5);
+ fListHistCascade->Add( fHistAsMCGenEtaOmegaPlus );
+ }
+ // - Resolution in Pt as function of generated Pt
+ if (! f2dHistAsMCResPtXiMinus) {
+ f2dHistAsMCResPtXiMinus = new TH2F("f2dHistAsMCResPtXiMinus", "Resolution in Pt reconstruction for #Xi^{-}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
+ fListHistCascade->Add(f2dHistAsMCResPtXiMinus);
+ }
+ if (! f2dHistAsMCResPtXiPlus) {
+ f2dHistAsMCResPtXiPlus = new TH2F("f2dHistAsMCResPtXiPlus", "Resolution in Pt reconstruction for #Xi^{+}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
+ fListHistCascade->Add(f2dHistAsMCResPtXiPlus);
+ }
+ if (! f2dHistAsMCResPtOmegaMinus) {
+ f2dHistAsMCResPtOmegaMinus = new TH2F("f2dHistAsMCResPtOmegaMinus", "Resolution in Pt reconstruction for #Omega^{-}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
+ fListHistCascade->Add(f2dHistAsMCResPtOmegaMinus);
+ }
+ if (! f2dHistAsMCResPtOmegaPlus) {
+ f2dHistAsMCResPtOmegaPlus = new TH2F("f2dHistAsMCResPtOmegaPlus", "Resolution in Pt reconstruction for #Omega^{+}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
+ fListHistCascade->Add(f2dHistAsMCResPtOmegaPlus);
+ }
+ // - Resolution in R(2D) as function of generated R
+ if (! f2dHistAsMCResRXiMinus) {
+ f2dHistAsMCResRXiMinus = new TH2F("f2dHistAsMCResRXiMinus", "Resolution in transv. position for #Xi^{-}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
+ fListHistCascade->Add(f2dHistAsMCResRXiMinus);
+ }
+ if (! f2dHistAsMCResRXiPlus) {
+ f2dHistAsMCResRXiPlus = new TH2F("f2dHistAsMCResRXiPlus", "Resolution in transv. position for #Xi^{+}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
+ fListHistCascade->Add(f2dHistAsMCResRXiPlus);
+ }
+ if (! f2dHistAsMCResROmegaMinus) {
+ f2dHistAsMCResROmegaMinus = new TH2F("f2dHistAsMCResROmegaMinus", "Resolution in transv. position for #Omega^{-}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
+ fListHistCascade->Add(f2dHistAsMCResROmegaMinus);
+ }
+ if (! f2dHistAsMCResROmegaPlus) {
+ f2dHistAsMCResROmegaPlus = new TH2F("f2dHistAsMCResROmegaPlus", "Resolution in transv. position for #Omega^{+}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
+ fListHistCascade->Add(f2dHistAsMCResROmegaPlus);
+ }
+ // - Resolution in phi as function of generated Pt
+ if (! f2dHistAsMCResPhiXiMinus) {
+ f2dHistAsMCResPhiXiMinus = new TH2F("f2dHistAsMCResPhiXiMinus", "Resolution in #phi for #Xi^{-}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);
+ fListHistCascade->Add(f2dHistAsMCResPhiXiMinus);
+ }
+ if (! f2dHistAsMCResPhiXiPlus) {
+ f2dHistAsMCResPhiXiPlus = new TH2F("f2dHistAsMCResPhiXiPlus", "Resolution in #phi for #Xi^{+}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);
+ fListHistCascade->Add(f2dHistAsMCResPhiXiPlus);
+ }
+ if (! f2dHistAsMCResPhiOmegaMinus) {
+ f2dHistAsMCResPhiOmegaMinus = new TH2F("f2dHistAsMCResPhiOmegaMinus", "Resolution in #phi for #Omega^{-}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);
+ fListHistCascade->Add(f2dHistAsMCResPhiOmegaMinus);
+ }
+ if (! f2dHistAsMCResPhiOmegaPlus) {
+ f2dHistAsMCResPhiOmegaPlus = new TH2F("f2dHistAsMCResPhiOmegaPlus", "Resolution in #phi for #Omega^{+}; Pt_{MC} (GeV/c); #phi(MC) - #phi(reco) (deg)", 200, 0., 10., 60, -30., 30.);
+ fListHistCascade->Add(f2dHistAsMCResPhiOmegaPlus);
+ }
+ // - Correlation between proton (antiproton) daughter MC pt and Xi/Omega MC pt (to apply Geant/Fluka correction)
+ if (!f2dHistAsMCptProtonMCptXiMinus) {
+ f2dHistAsMCptProtonMCptXiMinus = new TH2F("f2dHistAsMCptProtonMCptXiMinus", "Proton MC pt vs Xi- MC pt", 100, 0., 10., 100, 0., 10.);
+ fListHistCascade->Add(f2dHistAsMCptProtonMCptXiMinus);
+ }
+ if (!f2dHistAsMCptAntiprotonMCptXiPlus) {
+ f2dHistAsMCptAntiprotonMCptXiPlus = new TH2F("f2dHistAsMCptAntiprotonMCptXiPlus", "Antiproton MC pt vs Xi+ MC pt", 100, 0., 10., 100, 0., 10.);
+ fListHistCascade->Add(f2dHistAsMCptAntiprotonMCptXiPlus);
+ }
+ if (!f2dHistAsMCptProtonMCptOmegaMinus) {
+ f2dHistAsMCptProtonMCptOmegaMinus = new TH2F("f2dHistAsMCptProtonMCptOmegaMinus", "Proton MC pt vs Omega- MC pt", 100, 0., 10., 100, 0., 10.);
+ fListHistCascade->Add(f2dHistAsMCptProtonMCptOmegaMinus);
+ }
+ if (!f2dHistAsMCptAntiprotonMCptOmegaPlus) {
+ f2dHistAsMCptAntiprotonMCptOmegaPlus = new TH2F("f2dHistAsMCptAntiprotonMCptOmegaPlus", "Antiproton MC pt vs Omega+ MC pt", 100, 0., 10., 100, 0., 10.);
+ fListHistCascade->Add(f2dHistAsMCptAntiprotonMCptOmegaPlus);
+ }
+ // - Cosine of Pointing angle
+ if (! fHistV0toXiCosineOfPointingAngle) {
+ fHistV0toXiCosineOfPointingAngle = new TH1F("fHistV0toXiCosineOfPointingAngle", "Cos. of V0 Ptng Angl / Xi vtx ; Cos(V0 Point. Angl / Xi vtx); Counts", 200, 0.95, 1.0001);
+ fListHistCascade->Add(fHistV0toXiCosineOfPointingAngle);
+ }
+ if (! fHistV0CosineOfPointingAnglevsPtXi) {
+ fHistV0CosineOfPointingAnglevsPtXi = new TH2F("fHistV0CosineOfPointingAnglevsPtXi", "Cos. of V0 Ptng Angl vs cascade Pt; Cos(V0 Point. Angl); Counts", 100, 0., 10., 200, 0.95, 1.0001);
+ fListHistCascade->Add(fHistV0CosineOfPointingAnglevsPtXi);
+ }
+ if (! fHistV0CosineOfPointingAnglevsPtOmega) {
+ fHistV0CosineOfPointingAnglevsPtOmega = new TH2F("fHistV0CosineOfPointingAnglevsPtOmega", "Cos. of V0 Ptng Angl vs cascade Pt; Cos(V0 Point. Angl); Counts", 100, 0., 10., 200, 0.95, 1.0001);
+ fListHistCascade->Add(fHistV0CosineOfPointingAnglevsPtOmega);
+ }
+
+ //--------------
+ // - CFContainer
+ // PID container Xi-
+ if(! fCFContCascadePIDAsXiMinus) {
+ const Int_t lNbSteps = 7;
+ const Int_t lNbVariables = 3;
+ //Array for the number of bins in each dimension:
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 800;
+ lNbBinsPerVar[2] = 22;
+ fCFContCascadePIDAsXiMinus = new AliCFContainer(Form("fCFContCascadePIDAsXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDAsXiMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDAsXiMinus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass
+ fCFContCascadePIDAsXiMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDAsXiMinus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDAsXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDAsXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDAsXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDAsXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDAsXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDAsXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDAsXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDAsXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");
+ fCFContCascadePIDAsXiMinus->SetVarTitle(2, "Y_{#Xi}");
+ fListHistCascade->Add(fCFContCascadePIDAsXiMinus);
+ }
+ // PID container Xi+
+ if(! fCFContCascadePIDAsXiPlus) {
+ const Int_t lNbSteps = 7;
+ const Int_t lNbVariables = 3;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 800;
+ lNbBinsPerVar[2] = 22;
+ fCFContCascadePIDAsXiPlus = new AliCFContainer(Form("fCFContCascadePIDAsXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits (valid for v4-18-10-AN)
+ fCFContCascadePIDAsXiPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDAsXiPlus->SetBinLimits(1, 1.2 , 2.0 ); // Xi Effective mass
+ fCFContCascadePIDAsXiPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDAsXiPlus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDAsXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDAsXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDAsXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDAsXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDAsXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDAsXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDAsXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDAsXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");
+ fCFContCascadePIDAsXiPlus->SetVarTitle(2, "Y_{#Xi}");
+ fListHistCascade->Add(fCFContCascadePIDAsXiPlus);
+ }
+ // PID container Omega-
+ if(! fCFContCascadePIDAsOmegaMinus) {
+ const Int_t lNbSteps = 7;
+ const Int_t lNbVariables = 3;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3] = {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 1000;
+ lNbBinsPerVar[2] = 22;
+ fCFContCascadePIDAsOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDAsOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDAsOmegaMinus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDAsOmegaMinus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass
+ fCFContCascadePIDAsOmegaMinus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDAsOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDAsOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDAsOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");
+ fCFContCascadePIDAsOmegaMinus->SetVarTitle(2, "Y_{#Omega}");
+ fListHistCascade->Add(fCFContCascadePIDAsOmegaMinus);
+ }
+ // PID container Omega+
+ if(! fCFContCascadePIDAsOmegaPlus) {
+ const Int_t lNbSteps = 7;
+ const Int_t lNbVariables = 3;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[3]= {0};
+ lNbBinsPerVar[0] = 100;
+ lNbBinsPerVar[1] = 1000;
+ lNbBinsPerVar[2] = 22;
+ fCFContCascadePIDAsOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDAsOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ fCFContCascadePIDAsOmegaPlus->SetBinLimits(0, 0.0 , 10.0 ); // Pt(Cascade)
+ fCFContCascadePIDAsOmegaPlus->SetBinLimits(1, 1.5 , 2.5 ); // Omega Effective mass
+ fCFContCascadePIDAsOmegaPlus->SetBinLimits(2, -1.1 , 1.1 ); // Rapidity
+ //Setting the step title : one per PID case
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(0, "No PID");
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
+ fCFContCascadePIDAsOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
+ //Setting the variable title, per axis
+ fCFContCascadePIDAsOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
+ fCFContCascadePIDAsOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");
+ fCFContCascadePIDAsOmegaPlus->SetVarTitle(2, "Y_{#Omega}");
+ fListHistCascade->Add(fCFContCascadePIDAsOmegaPlus);
+ }
+ // Container for optimisation of topological selections
+ if(! fCFContAsCascadeCuts){
+ // Container meant to store all the relevant distributions corresponding to the cut variables.
+ // - NB overflow/underflow of variables on which we want to cut later should be 0!!!
+ const Int_t lNbSteps = 4;
+ const Int_t lNbVariables = 19;
+ //Array for the number of bins in each dimension :
+ Int_t lNbBinsPerVar[lNbVariables] = {0};
+ lNbBinsPerVar[0] = 25; //DcaCascDaughters : [0.0,2.,3.0] -> Rec.Cut = 2.0;
+ lNbBinsPerVar[1] = 25; //DcaBachToPrimVertex : [0.0,0.24,100.0] -> Rec.Cur = 0.01;
+ lNbBinsPerVar[2] = 60; //CascCosineOfPointingAngle : [0.94,1.0] -> Rec.Cut = 0.95;
+ //lNbBinsPerVar[2] = 30; //CascCosineOfPointingAngle : [0.97,1.] -> Rec.Cut = 0.98;
+ lNbBinsPerVar[3] = 40; //CascRadius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;
+ lNbBinsPerVar[4] = 30; //InvMassLambdaAsCascDghter : [1.1,1.3] -> Rec.Cut = 0.008;
+ lNbBinsPerVar[5] = 20; //DcaV0Daughters : [0.0,2.0] -> Rec.Cut = 1.5;
+ lNbBinsPerVar[6] = 201; //V0CosineOfPointingAngle : [0.89,1.0] -> Rec.Cut = 0.9;
+ lNbBinsPerVar[7] = 40; //V0Radius : [0.0,3.9,1000.0] -> Rec.Cut = 0.2;
+ lNbBinsPerVar[8] = 40; //DcaV0ToPrimVertex : [0.0,0.39,110.0] -> Rec.Cut = 0.01;
+ lNbBinsPerVar[9] = 25; //DcaPosToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.05;
+ lNbBinsPerVar[10] = 25; //DcaNegToPrimVertex : [0.0,0.24,100.0] -> Rec.Cut = 0.05;
+ lNbBinsPerVar[11] = 150; //InvMassXi : 2-MeV/c2 bins
+ lNbBinsPerVar[12] = 120; //InvMassOmega : 2-MeV/c2 bins
+ lNbBinsPerVar[13] = 100; //CascTransvMom : [0.0,10.0]
+ lNbBinsPerVar[14] = 110; //Y(Xi) : 0.02 unit of y per bin
+ lNbBinsPerVar[15] = 110; //Y(Omega) : 0.02 unit of y per bin
+ lNbBinsPerVar[16] = 112; //Proper lenght of cascade
+ lNbBinsPerVar[17] = 112; //Proper lenght of V0
+ lNbBinsPerVar[18] = 112; //Distance V0-Xi in the transverse plane
+ fCFContAsCascadeCuts = new AliCFContainer(Form("fCFContAsCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Cut Container for Asso. Cascades", lNbSteps, lNbVariables, lNbBinsPerVar );
+ //Setting the bin limits
+ //0 - DcaCascDaughters
+ Double_t *lBinLim0 = new Double_t[ lNbBinsPerVar[0]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[0]; i++) lBinLim0[i] = (Double_t)0.0 + (2.4 -0.0)/(lNbBinsPerVar[0] - 1) * (Double_t)i;
+ lBinLim0[ lNbBinsPerVar[0] ] = 3.0;
+ fCFContAsCascadeCuts -> SetBinLimits(0, lBinLim0);
+ delete[] lBinLim0;
+ //1 - DcaBachToPrimVertex
+ Double_t *lBinLim1 = new Double_t[ lNbBinsPerVar[1]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[1]; i++) lBinLim1[i] = (Double_t)0.0 + (0.24 - 0.0)/(lNbBinsPerVar[1] - 1) * (Double_t)i;
+ lBinLim1[ lNbBinsPerVar[1] ] = 100.0;
+ fCFContAsCascadeCuts -> SetBinLimits(1, lBinLim1);
+ delete [] lBinLim1;
+ //2 - CascCosineOfPointingAngle
+ fCFContAsCascadeCuts -> SetBinLimits(2, .94, 1.);
+ //3 - CascRadius
+ Double_t *lBinLim3 = new Double_t[ lNbBinsPerVar[3]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[3]; i++) lBinLim3[i] = (Double_t)0.0 + (3.9 -0.0)/(lNbBinsPerVar[3] - 1) * (Double_t)i;
+ lBinLim3[ lNbBinsPerVar[3] ] = 1000.0;
+ fCFContAsCascadeCuts -> SetBinLimits(3, lBinLim3);
+ delete[] lBinLim3;
+ //4 - InvMassLambdaAsCascDghter
+ fCFContAsCascadeCuts->SetBinLimits(4, 1.1, 1.13);
+ //5 - DcaV0Daughters
+ fCFContAsCascadeCuts->SetBinLimits(5, 0., 2.);
+ //6 - V0CosineOfPointingAngle
+ fCFContAsCascadeCuts->SetBinLimits(6, 0.8, 1.001);
+ //7 - V0Radius
+ Double_t *lBinLim7 = new Double_t[ lNbBinsPerVar[7]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[7]; i++) lBinLim7[i] = (Double_t)0.0 + (3.9 - 0.0)/(lNbBinsPerVar[7] - 1) * (Double_t)i ;
+ lBinLim7[ lNbBinsPerVar[7] ] = 1000.0;
+ fCFContAsCascadeCuts -> SetBinLimits(7, lBinLim7);
+ delete [] lBinLim7;
+ //8 - DcaV0ToPrimVertexXi : 0. to 0.4
+ Double_t *lBinLim8 = new Double_t[ lNbBinsPerVar[8]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[8]; i++) lBinLim8[i] = (Double_t)0.0 + (0.39 - 0.0)/(lNbBinsPerVar[8] - 1) * (Double_t)i ;
+ lBinLim8[ lNbBinsPerVar[8] ] = 100.0;
+ fCFContAsCascadeCuts -> SetBinLimits(8, lBinLim8);
+ delete [] lBinLim8;
+ //9 - DcaPosToPrimVertexXi
+ Double_t *lBinLim9 = new Double_t[ lNbBinsPerVar[9]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[9]; i++) lBinLim9[i] = (Double_t)0.0 + (0.24 - 0.0)/(lNbBinsPerVar[9] - 1) * (Double_t)i;
+ lBinLim9[ lNbBinsPerVar[9] ] = 100.0;
+ fCFContAsCascadeCuts -> SetBinLimits(9, lBinLim9);
+ delete [] lBinLim9;
+ //10 - DcaNegToPrimVertexXi
+ Double_t *lBinLim10 = new Double_t[ lNbBinsPerVar[10]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[10]; i++) lBinLim10[i] = (Double_t)0.0 + (0.24 - 0.0 )/(lNbBinsPerVar[10] - 1) * (Double_t)i;
+ lBinLim10[ lNbBinsPerVar[10] ] = 100.0;
+ fCFContAsCascadeCuts -> SetBinLimits(10, lBinLim10);
+ delete [] lBinLim10;
+ //11 - InvMassXi
+ fCFContAsCascadeCuts -> SetBinLimits(11, 1.25, 1.40);
+ //12 - InvMassOmega
+ fCFContAsCascadeCuts -> SetBinLimits(12, 1.62, 1.74);
+ //13 - XiTransvMom
+ fCFContAsCascadeCuts -> SetBinLimits(13, 0.0, 10.0);
+ //14 - Y(Xi)
+ fCFContAsCascadeCuts -> SetBinLimits(14, -1.1, 1.1);
+ //15 - Y(Omega)
+ fCFContAsCascadeCuts -> SetBinLimits(15, -1.1, 1.1);
+ //16 - Proper time cascade
+ Double_t *lBinLim16 = new Double_t[ lNbBinsPerVar[16]+1 ];
+ for(Int_t i=0; i<lNbBinsPerVar[16]; i++) lBinLim16[i] = (Double_t)-1. + (110. + 1.0 )/(lNbBinsPerVar[16] - 1) * (Double_t)i;
+ lBinLim16[ lNbBinsPerVar[16] ] = 2000.0;
+ fCFContAsCascadeCuts -> SetBinLimits(16, lBinLim16);
+ //17 - Proper time V0
+ fCFContAsCascadeCuts -> SetBinLimits(17, lBinLim16);
+ //18 - Distance V0-Xi in the transverse plane
+ fCFContAsCascadeCuts -> SetBinLimits(18, lBinLim16);
+ delete [] lBinLim16;
+ // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)
+ fCFContAsCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates associated to MC");
+ fCFContAsCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates associated to MC");
+ fCFContAsCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates associated to MC");
+ fCFContAsCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates associated to MC");
+ // Setting the variable title, per axis
+ fCFContAsCascadeCuts->SetVarTitle(0, "DCA(cascade daughters) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(1, "ImpactParamToPV(bachelor) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(2, "cos(cascade PA)");
+ fCFContAsCascadeCuts->SetVarTitle(3, "R_{2d}(cascade decay) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(4, "M_{#Lambda}(as casc dghter) (GeV/c^{2})");
+ fCFContAsCascadeCuts->SetVarTitle(5, "DCA(V0 daughters) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(6, "cos(V0 PA) in cascade");
+ fCFContAsCascadeCuts->SetVarTitle(7, "R_{2d}(V0 decay) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(8, "ImpactParamToPV(V0) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(9, "ImpactParamToPV(Pos) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(10, "ImpactParamToPV(Neg) (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");
+ fCFContAsCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");
+ fCFContAsCascadeCuts->SetVarTitle(13, "Pt_{MC}(cascade) (GeV/c)");
+ fCFContAsCascadeCuts->SetVarTitle(14, "Y_{MC}(Xi)");
+ fCFContAsCascadeCuts->SetVarTitle(15, "Y_{MC}(Omega)");
+ fCFContAsCascadeCuts->SetVarTitle(16, "mL/p cascade (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(17, "mL/p V0 (cm)");
+ fCFContAsCascadeCuts->SetVarTitle(18, "Distance V0-Cascade in the transverse plane (cm)");
+ fListHistCascade->Add(fCFContAsCascadeCuts);
+ }
+
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+
+}// end CreateOutputObjects
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCheckPerformanceCascadepp276::UserExec(Option_t *) {
+
+ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ // Main loop (called for each event)
+ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ //------------------
+ // - Define variables
+ AliESDEvent *lESDevent = 0x0;
+ AliAODEvent *lAODevent = 0x0;
+ AliMCEvent *lMCevent = 0x0;
+ AliStack *lMCstack = 0x0;
+ TClonesArray *arrayMC = 0;
+
+ //-------------------------
+ // - Check the PID response
+ if (!fPIDResponse) {
+ AliError("Cannot get pid response");
+ return;
+ }
+
+
+ //////////////////
+ // Event selection
+ //////////////////
+ // In order:
+ // 1) SDD selection
+ // 2) Physics selection
+ // 3) Select only looking at events with well-established PV
+ // 4) Pileup selection
+ // 5) |Z| < 10 cm
+
+ //---------------------------------------------------------
+ // Load the InputEvent and check it (for the ESD and AOD)
+ if (fAnalysisType == "ESD") {
+ lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
+ if (!lESDevent) {
+ Printf("ERROR: lESDevent not available \n");
+ cout << "Name of the file with pb :" << CurrentFileName() << endl;
+ return;
+ }
+ lMCevent = MCEvent();
+ if (!lMCevent) {
+ Printf("ERROR: Could not retrieve MC event \n");
+ cout << "Name of the file with pb :" << CurrentFileName() << endl;
+ return;
+ }
+ lMCstack = lMCevent->Stack();
+ if (!lMCstack) {
+ Printf("ERROR: Could not retrieve MC stack \n");
+ cout << "Name of the file with pb :" << CurrentFileName() << endl;
+ return;
+ }
+ // - Cascade vertexer (ESD)
+ // Relaunch V0 and Cascade vertexer
+ if (fkRerunV0CascVertexers) {
+ lESDevent->ResetCascades();
+ lESDevent->ResetV0s();
+ AliV0vertexer *lV0vtxer = new AliV0vertexer();
+ AliCascadeVertexer *lCascVtxer = new AliCascadeVertexer();
+ //lV0vtxer->GetCuts(fV0Sels);
+ //lCascVtxer->GetCuts(fCascSels);
+ lV0vtxer->SetCuts(fV0Sels); // NB don't use SetDefaultCuts!! because it acts on static variables
+ lCascVtxer->SetCuts(fCascSels);
+ lV0vtxer->Tracks2V0vertices(lESDevent);
+ lCascVtxer->V0sTracks2CascadeVertices(lESDevent);
+ //delete lV0vtxer;
+ //delete lCascVtxer;
+ //---
+ //lESDevent->ResetCascades();
+ //lESDevent->ResetV0s();
+ //AliV0vertexer lV0vtxer;
+ //AliCascadeVertexer lCascVtxer;
+ //lV0vtxer.SetCuts(fV0Sels);
+ //lCascVtxer.SetCuts(fCascSels);
+ //lV0vtxer.Tracks2V0vertices(lESDevent);
+ //lCascVtxer.V0sTracks2CascadeVertices(lESDevent);
+ }
+ } else if (fAnalysisType == "AOD") {
+ lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() );
+ if (!lAODevent) {
+ Printf("ERROR: lAODevent not available \n");
+ cout << "Name of the file with pb :" << CurrentFileName() << endl;
+ return;
+ }
+ arrayMC = (TClonesArray*) lAODevent->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+ if (!arrayMC) AliFatal("Error: MC particles branch not found!\n");
+ } else {
+ Printf("Analysis type (ESD or AOD) not specified \n");
+ return;
+ }
+
+ //------------------------------
+ // - Plots Before any selections
+ //------------------------------
+ // - Define variables
+ Int_t ncascadesBeforeAnySel = -1; //number of cascades before any selections
+ Int_t nTrackMultiplicityBeforeAnySel = -1; //number of tracks before any selections
+ if (fAnalysisType == "ESD") {
+ //Multiplicity
+ Int_t lMultiplicity = -100;
+ lMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC, 0.5);
+ nTrackMultiplicityBeforeAnySel = lMultiplicity;
+ ncascadesBeforeAnySel = lESDevent->GetNumberOfCascades();
+ } else if (fAnalysisType == "AOD") {
+ //Multiplicity
+ Int_t lMultiplicity = -100;
+ nTrackMultiplicityBeforeAnySel = lMultiplicity;
+ ncascadesBeforeAnySel = lAODevent->GetNumberOfCascades();
+ }
+ fHistTrackMultiplicityBeforeAnySel->Fill(nTrackMultiplicityBeforeAnySel);
+ fHistCascadeMultiplicityBeforeAnySel->Fill(ncascadesBeforeAnySel);
+
+ //----------------
+ // - SDD selection
+ //----------------
+ // - Define variables
+ Int_t ncascadesAfterSDDSel = -1; //number of cascades after SDD selection
+ Int_t nTrackMultiplicityAfterSDDSel = -1; //number of tracks after SDD selection
+ if (fkSDDselectionOn) {
+ TString trcl = " ";
+ trcl = lESDevent->GetFiredTriggerClasses();
+ if (fAnalysisType == "ESD") trcl = lESDevent->GetFiredTriggerClasses();
+ else if (fAnalysisType == "AOD") trcl = lAODevent->GetFiredTriggerClasses();
+ if (fwithSDD){ // ---> Select event with SDD ON
+ if(!(trcl.Contains("ALLNOTRD"))) {
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ cout<<"Bad event: SDD turn OFF => RETURN!! (Exclude it)..."<<endl;
+ return;
+ } else {
+ cout<<"Good event: SDD turn ON."<<endl;
+ }
+ } else if (!fwithSDD){ // ---> Select event with SDD OFF
+ if((trcl.Contains("ALLNOTRD"))) {
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ cout<<"Bad event: SDD turn ON => RETURN!! (Exclude it)..."<<endl;
+ return;
+ } else {
+ cout<<"Good event: SDD turn OFF."<<endl;
+ }
+ }
+ }
+ // - Take the number of cascades and tracks after the SDD selection
+ if (fAnalysisType == "ESD") {
+ Int_t lMultiplicity = -100;
+ lMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC, 0.5);
+ ncascadesAfterSDDSel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterSDDSel = lMultiplicity;
+ } else if (fAnalysisType == "AOD") {
+ Int_t lMultiplicity = -100;
+ ncascadesAfterSDDSel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterSDDSel = lMultiplicity;
+ }
+ // - Fill the plots
+ fHistTrackMultiplicityAfterSDDSel->Fill(nTrackMultiplicityAfterSDDSel);
+ fHistCascadeMultiplicityAfterSDDSel->Fill(ncascadesAfterSDDSel);
+
+ //------------------------------
+ // - Plots pre-physics selection
+ //------------------------------
+ // - Produce the 3Dhisto for the efficiency denominator
+ Int_t lNbMCPrimary = 0;
+ lNbMCPrimary = lMCstack->GetNprimary();
+
+ for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) {
+
+ Double_t partEnergy = 0.;
+ Double_t partPz = 0.;
+ Double_t partP = 0.;
+ Double_t partPt = 0.;
+ Double_t partVx = 0.;
+ Double_t partVy = 0.;
+ Double_t partVz = 0.;
+ Double_t bacVx = 0.;
+ Double_t bacVy = 0.;
+ Double_t bacVz = 0.;
+ Double_t partMass = 0.;
+ Int_t PDGcode = 0;
+ Int_t lPrimaryTrackMultiplicity = nTrackMultiplicityAfterSDDSel;
+
+ if ( fAnalysisType == "ESD" ) {
+ TParticle* lCurrentParticlePrimary = 0x0;
+ lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack );
+ if (!lCurrentParticlePrimary) {
+ Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
+ continue;
+ }
+ if (!lMCstack->IsPhysicalPrimary(iCurrentLabelStack)) continue;
+ TParticle* xiMC = 0x0;
+ xiMC = lCurrentParticlePrimary;
+ if (!xiMC) {
+ Printf("MC TParticle pointer to Cascade = 0x0 ! Skip ...");
+ continue;
+ }
+ partEnergy = xiMC->Energy();
+ partPz = xiMC->Pz();
+ partPt = xiMC->Pt();
+ partP = xiMC->P();
+ partMass = xiMC->GetMass();
+ partVx = xiMC->Vx();
+ partVy = xiMC->Vy();
+ partVz = xiMC->Vz();
+ if (xiMC->GetDaughter(0)>=0) {
+ TParticle *mcBach = lMCstack->Particle(xiMC->GetDaughter(0));
+ if (mcBach) {
+ bacVx = mcBach->Vx();
+ bacVy = mcBach->Vy();
+ bacVz = mcBach->Vz();
+ }
+ }
+ PDGcode = lCurrentParticlePrimary->GetPdgCode();
+ } else if ( fAnalysisType == "AOD" ) {
+ AliAODMCParticle *lCurrentParticleaod = (AliAODMCParticle*) arrayMC->At(iCurrentLabelStack);
+ if (!lCurrentParticleaod) {
+ Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
+ continue;
+ }
+ if (!lCurrentParticleaod->IsPhysicalPrimary()) continue;
+ partEnergy = lCurrentParticleaod->E();
+ partPz = lCurrentParticleaod->Pz();
+ partP = lCurrentParticleaod->P();
+ partPt = lCurrentParticleaod->Pt();
+ partMass = lCurrentParticleaod->M();
+ partVx = lCurrentParticleaod->Xv();
+ partVy = lCurrentParticleaod->Yv();
+ partVz = lCurrentParticleaod->Zv();
+ if (lCurrentParticleaod->GetDaughter(0)>=0) {
+ AliAODMCParticle *mcBach = (AliAODMCParticle*) arrayMC->At(lCurrentParticleaod->GetDaughter(0));
+ if (mcBach) {
+ bacVx = mcBach->Xv();
+ bacVy = mcBach->Yv();
+ bacVz = mcBach->Zv();
+ }
+ }
+ PDGcode = lCurrentParticleaod->GetPdgCode();
+ }
+
+ // - Calculate rapidity
+ Double_t lRapXiMC = 0.5*TMath::Log((partEnergy + partPz) / (partEnergy - partPz + 1.e-13));
+ // - Calculate proper lenght
+ Double_t lctau = TMath::Sqrt((partVx-bacVx)*(partVx-bacVx)+(partVy-bacVy)*(partVy-bacVy)+(partVz-bacVz)*(partVz-bacVz));
+ if (partP != 0.) lctau = lctau*partMass/partP;
+ else lctau = -1.;
+ // - Fill Histograms
+ if (PDGcode == 3312) {
+ f3dHistGenPtVsGenYvsNtracksXiMinus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);
+ f3dHistGenPtVsGenctauvsYXiMinus->Fill(partPt, lctau, lRapXiMC);
+ }
+ if (PDGcode == -3312) {
+ f3dHistGenPtVsGenYvsNtracksXiPlus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);
+ f3dHistGenPtVsGenctauvsYXiPlus->Fill(partPt, lctau, lRapXiMC);
+ }
+ if (PDGcode == 3334) {
+ f3dHistGenPtVsGenYvsNtracksOmegaMinus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);
+ f3dHistGenPtVsGenctauvsYOmegaMinus->Fill(partPt, lctau, lRapXiMC);
+ }
+ if (PDGcode == -3334) {
+ f3dHistGenPtVsGenYvsNtracksOmegaPlus->Fill(partPt, lRapXiMC, lPrimaryTrackMultiplicity);
+ f3dHistGenPtVsGenctauvsYOmegaPlus->Fill(partPt, lctau, lRapXiMC);
+ }
+ }
+
+
+ //--------------------
+ // - Physics selection
+ //--------------------
+ // - Define new variables
+ Int_t ncascadesAfterPhysicsSel = -1; //number of cascades after physics selection
+ Int_t nTrackMultiplicityAfterPhysicsSel = -1; //number of tracks after physics selection
+ // - Selection for ESD and AOD
+ if (fAnalysisType == "ESD") {
+ UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+ Bool_t isSelected = 0;
+ isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
+ if(!isSelected){
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ // - Take the number of cascades and tracks after physics selection
+ ncascadesAfterPhysicsSel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterPhysicsSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC, 0.5);
+ } else if (fAnalysisType == "AOD") {
+ UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+ Bool_t isSelected = 0;
+ isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
+ if(!isSelected){
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ // - Take the number of cascades and tracks after physics selection
+ ncascadesAfterPhysicsSel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterPhysicsSel = -100;
+ }
+ fHistCascadeMultiplicityAfterPhysicsSel->Fill(ncascadesAfterPhysicsSel);
+ fHistTrackMultiplicityAfterPhysicsSel->Fill(nTrackMultiplicityAfterPhysicsSel);
+
+ //-------------------------------------------------------
+ // Select only looking at events with well-established PV
+ //-------------------------------------------------------
+ Int_t ncascadesForSelEvtNoTPCOnly = -1; //number of cascades after the TPConly selection
+ Int_t nTrackMultiplicityForSelEvtNoTPCOnly = -1; //number of tracks after the TPConly selection
+ if (fAnalysisType == "ESD" ) {
+ // - Select only looking at events with well-established PV
+ if (fkQualityCutNoTPConlyPrimVtx) {
+ const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
+ const AliESDVertex *lPrimaryTrackingVtx = lESDevent->GetPrimaryVertexTracks();
+ if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingVtx->GetStatus() ){
+ AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after TPConly selection
+ ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ // - Select only looking at events with well-established PV
+ if (fkQualityCutNoTPConlyPrimVtx) {
+ const AliAODVertex *lPrimarySPDVtx = lAODevent->GetPrimaryVertexSPD();
+ const AliAODVertex *lPrimaryTrackingAODVtx = lAODevent->GetPrimaryVertex();
+ if (!lPrimarySPDVtx && !lPrimaryTrackingAODVtx) {
+ AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after TPConly selection
+ ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnly = -100; //FIXME
+ }
+ fHistCascadeMultiplicityForSelEvtNoTPCOnly->Fill(ncascadesForSelEvtNoTPCOnly);
+ fHistTrackMultiplicityForSelEvtNoTPCOnly->Fill(nTrackMultiplicityForSelEvtNoTPCOnly);
+
+ //-----------------
+ // Pileup selection
+ //-----------------
+ Int_t ncascadesForSelEvtNoTPCOnlyNoPileup = -1; //number of cascades after the NoPileup selection
+ Int_t nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -1; //number of tracks after the Pileup selection
+ if (fAnalysisType == "ESD" ) {
+ // - Selection for pile up
+ if (fkRejectEventPileUp) {
+ if(lESDevent->IsPileupFromSPD()){
+ AliWarning("Pb / Pile-up event ... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after Pileup selection
+ ncascadesForSelEvtNoTPCOnlyNoPileup = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ // - Selection for pile up
+ if (fkRejectEventPileUp) {
+ if(lAODevent->IsPileupFromSPD()){
+ AliWarning("Pb / Pile-up event ... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after Pileup selection
+ ncascadesForSelEvtNoTPCOnlyNoPileup = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -100;
+ }
+ fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(ncascadesForSelEvtNoTPCOnlyNoPileup);
+ fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
+
+ //-------------------
+ // - Vertex selection
+ //-------------------
+ Int_t ncascadesAfterVertexSel = -1; //number of cascades after vertex selection
+ Int_t nTrackMultiplicityAfterVertexSel = -1; //number of tracks after vertex selection
+ Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};
+ Double_t tPrimaryVtxPosition[3] = {-100.0, -100.0, -100.0};
+ Double_t lMagneticField = -10.;
+ if (fAnalysisType == "ESD" ) {
+ // - Primary vertex definition
+ const AliESDVertex *lPrimaryBestVtx = lESDevent->GetPrimaryVertex();
+ if (!lPrimaryBestVtx) {
+ AliWarning("No prim. vertex in AOD... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ lPrimaryBestVtx->GetXYZ( lBestPrimaryVtxPos );
+ // - Vertex position before any event selection on vertex position
+ const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ fHistPVx->Fill( tPrimaryVtxPosition[0] );
+ fHistPVy->Fill( tPrimaryVtxPosition[1] );
+ fHistPVz->Fill( tPrimaryVtxPosition[2] );
+ // - Get magnetic filed info
+ lMagneticField = lESDevent->GetMagneticField();
+ // - Selection on the primary vertex Z position
+ if (fkQualityCutZprimVtxPos) {
+ if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
+ AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after vertex Z position selection
+ ncascadesAfterVertexSel = lESDevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterVertexSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
+ } else if (fAnalysisType == "AOD") {
+ // - Primary vertex definition
+ const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex(); // get the best primary vertex available for the event GetVertex(0)
+ if (!lPrimaryBestAODVtx) {
+ AliWarning("No prim. vertex in AOD... return!");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );
+ // - Vertex position before any event selection on vertex position
+ const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ fHistPVx->Fill( tPrimaryVtxPosition[0] );
+ fHistPVy->Fill( tPrimaryVtxPosition[1] );
+ fHistPVz->Fill( tPrimaryVtxPosition[2] );
+ // - Get magnetic filed info
+ lMagneticField = lAODevent->GetMagneticField();
+ // - Selection on the primary vertex Z position
+ if (fkQualityCutZprimVtxPos) {
+ if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange && TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
+ AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+ return;
+ }
+ }
+ // - Take the number of cascades and tracks after vertex Z position selection
+ ncascadesAfterVertexSel = lAODevent->GetNumberOfCascades();
+ nTrackMultiplicityAfterVertexSel = -100;
+ }
+ // - Fill the plots
+ fHistCascadeMultiplicityAfterVertexCutSel->Fill(ncascadesAfterVertexSel);
+ fHistTrackMultiplicityAfterVertexCutSel->Fill(nTrackMultiplicityAfterVertexSel);
+
+ // - Vertex position plots: after any event selections
+ tPrimaryVtxPosition[0] = 0;
+ tPrimaryVtxPosition[1] = 0;
+ tPrimaryVtxPosition[2] = 0;
+ if (fAnalysisType == "ESD" ) {
+ const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ } else if (fAnalysisType == "AOD") {
+ const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
+ tPrimaryVtxPosition[0] = primaryVtx->GetX();
+ tPrimaryVtxPosition[1] = primaryVtx->GetY();
+ tPrimaryVtxPosition[2] = primaryVtx->GetZ();
+ }
+ fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] );
+ fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] );
+ fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] );
+
+
+ //----------------------------------------------------------------------
+ // - Loop over the different types of GENERATED cascades (Xi-+, Omega-+)
+ //----------------------------------------------------------------------
+ // - Initialisation of useful local variables
+ Int_t lPdgCodeCasc = 0;
+ Int_t lPdgCodeBach = 0;
+ Int_t lPdgCodeLambda = 0;
+ Int_t lPdgCodeDghtMesV0 = 0;
+ Int_t lPdgCodeDghtBarV0 = 0;
+ TH1F *lHistEtaGenCasc = 0;
+ TH3D *l3dHistGenPtVsGenYvsNtracksPhysEff = 0;
+ TH3D *l3dHistGenPtVsGenctauvsYPhysEff = 0;
+ TH1F *lHistThetaGenCasc = 0;
+ TH2D *l2dHistGenPtVsGenYFdbl = 0;
+ TH1F *lHistThetaLambda = 0;
+ TH1F *lHistThetaBach = 0;
+ TH1F *lHistThetaBarDghter = 0;
+ TH1F *lHistThetaMesDghter = 0;
+ TH1F *lHistPtBach = 0;
+ TH1F *lHistPtBarDghter = 0;
+ TH1F *lHistPtMesDghter = 0;
+ Int_t ncascperev = 0;
+ Int_t ncascperevtot = 0;
+
+ for (Int_t iCascType = 1; iCascType < 5; iCascType++) {
+ ncascperev = 0;
+ ncascperevtot = 0;
+ Int_t lPrimaryTrackMultiplicity = nTrackMultiplicityAfterSDDSel;
+
+ switch (iCascType) {
+ case 1: // Xi-
+ lPdgCodeCasc = 3312; //Xi-
+ lPdgCodeBach = -211; //Pi-
+ lPdgCodeLambda = 3122; //Lambda0
+ lPdgCodeDghtMesV0 = -211; //Pi-
+ lPdgCodeDghtBarV0 = 2212; //Proton
+ lHistEtaGenCasc = fHistEtaGenCascXiMinus; // this plot for any Xi-
+ lHistThetaGenCasc = fHistThetaGenCascXiMinus; // cascades generated within acceptance (cut in pt + theta)
+ l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksXiMinusPhysEff;
+ l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYXiMinusPhysEff;
+ l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblXiMinus;
+ lHistThetaLambda = fHistThetaLambdaXiMinus;
+ lHistThetaBach = fHistThetaBachXiMinus;
+ lHistThetaBarDghter = fHistThetaBarDghterXiMinus;
+ lHistThetaMesDghter = fHistThetaMesDghterXiMinus;
+ lHistPtBach = fHistPtBachXiMinus;
+ lHistPtBarDghter = fHistPtBarDghterXiMinus;
+ lHistPtMesDghter = fHistPtMesDghterXiMinus;
+ break;
+ case 2: // Xi+
+ lPdgCodeCasc = -3312; //Xi+
+ lPdgCodeBach = 211; //Pi+
+ lPdgCodeLambda = -3122; //AntiLambda0
+ lPdgCodeDghtMesV0 = 211; //Pi+
+ lPdgCodeDghtBarV0 = -2212; //AntiProton
+ lHistEtaGenCasc = fHistEtaGenCascXiPlus; // this plot for any Xi+
+ lHistThetaGenCasc = fHistThetaGenCascXiPlus; // cascades generated within acceptance (cut in pt + theta)
+ l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksXiPlusPhysEff;
+ l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYXiPlusPhysEff;
+ l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblXiPlus;
+ lHistThetaLambda = fHistThetaLambdaXiPlus;
+ lHistThetaBach = fHistThetaBachXiPlus;
+ lHistThetaBarDghter = fHistThetaBarDghterXiPlus;
+ lHistThetaMesDghter = fHistThetaMesDghterXiPlus;
+ lHistPtBach = fHistPtBachXiPlus;
+ lHistPtBarDghter = fHistPtBarDghterXiPlus;
+ lHistPtMesDghter = fHistPtMesDghterXiPlus;
+ break;
+ case 3: // Omega-
+ lPdgCodeCasc = 3334; //Omega-
+ lPdgCodeBach = -321; //K-
+ lPdgCodeLambda = 3122; //Lambda0
+ lPdgCodeDghtMesV0 = -211; //Pi-
+ lPdgCodeDghtBarV0 = 2212; //Proton
+ lHistEtaGenCasc = fHistEtaGenCascOmegaMinus; // this plot for any Omega+
+ lHistThetaGenCasc = fHistThetaGenCascOmegaMinus; // cascades generated within acceptance (cut in pt + theta)
+ l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblOmegaMinus;
+ l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksOmegaMinusPhysEff;
+ l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYOmegaMinusPhysEff;
+ lHistThetaLambda = fHistThetaLambdaOmegaMinus;
+ lHistThetaBach = fHistThetaBachOmegaMinus;
+ lHistThetaBarDghter = fHistThetaBarDghterOmegaMinus;
+ lHistThetaMesDghter = fHistThetaMesDghterOmegaMinus;
+ lHistPtBach = fHistPtBachOmegaMinus;
+ lHistPtBarDghter = fHistPtBarDghterOmegaMinus;
+ lHistPtMesDghter = fHistPtMesDghterOmegaMinus;
+ break;
+ case 4: // Omega+
+ lPdgCodeCasc = -3334; //Omega+
+ lPdgCodeBach = 321; //K+
+ lPdgCodeLambda = -3122; //AntiLambda0
+ lPdgCodeDghtMesV0 = 211; //Pi+
+ lPdgCodeDghtBarV0 = -2212; //AntiProton
+ lHistEtaGenCasc = fHistEtaGenCascOmegaPlus; // this plot for any Omega-
+ lHistThetaGenCasc = fHistThetaGenCascOmegaPlus; // cascades generated within acceptance (cut in pt + theta)
+ l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblOmegaPlus;
+ l3dHistGenPtVsGenYvsNtracksPhysEff = f3dHistGenPtVsGenYvsNtracksOmegaPlusPhysEff;
+ l3dHistGenPtVsGenctauvsYPhysEff = f3dHistGenPtVsGenctauvsYOmegaPlusPhysEff;
+ lHistThetaLambda = fHistThetaLambdaOmegaPlus;
+ lHistThetaBach = fHistThetaBachOmegaPlus;
+ lHistThetaBarDghter = fHistThetaBarDghterOmegaPlus;
+ lHistThetaMesDghter = fHistThetaMesDghterOmegaPlus;
+ lHistPtBach = fHistPtBachOmegaPlus;
+ lHistPtBarDghter = fHistPtBarDghterOmegaPlus;
+ lHistPtMesDghter = fHistPtMesDghterOmegaPlus;
+ break;
+ }
+
+ for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) {
+
+ Double_t partEnergy = 0.;
+ Double_t partPz = 0.;
+ Double_t partEta = 0.;
+ Double_t partTheta = 0.;
+ Double_t partP = 0.;
+ Double_t partPt = 0.;
+ Double_t partVx = 0.;
+ Double_t partVy = 0.;
+ Double_t partVz = 0.;
+ Double_t bacVx = 0.;
+ Double_t bacVy = 0.;
+ Double_t bacVz = 0.;
+ Double_t partMass = 0.;
+
+ if ( fAnalysisType == "ESD" ) {
+ TParticle* lCurrentParticle = 0x0;
+ lCurrentParticle = lMCstack->Particle( iCurrentLabelStack );
+ if (!lCurrentParticle) {
+ Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
+ continue;
+ }
+ if (!lMCstack->IsPhysicalPrimary(iCurrentLabelStack)) continue;
+ if (lCurrentParticle->GetPdgCode() == lPdgCodeCasc) { // Here !
+ TParticle* xiMC = 0x0;
+ xiMC = lCurrentParticle;
+ if (!xiMC) {
+ Printf("MC TParticle pointer to Cascade = 0x0 ! Skip ...");
+ continue;
+ }
+ partEnergy = xiMC->Energy();
+ partPz = xiMC->Pz();
+ partEta = xiMC->Eta();
+ partPt = xiMC->Pt();
+ partP = xiMC->P();
+ partTheta = xiMC->Theta();
+ partMass = xiMC->GetMass();
+ partVx = xiMC->Vx();
+ partVy = xiMC->Vy();
+ partVz = xiMC->Vz();
+ if (xiMC->GetDaughter(0)>=0) {
+ TParticle *mcBach = lMCstack->Particle(xiMC->GetDaughter(0));
+ if (mcBach) {
+ bacVx = mcBach->Vx();
+ bacVy = mcBach->Vy();
+ bacVz = mcBach->Vz();
+ }
+ }
+ } else continue;
+ } else if ( fAnalysisType == "AOD" ) {
+ AliAODMCParticle *lCurrentParticleaod = (AliAODMCParticle*) arrayMC->At(iCurrentLabelStack);
+ if (!lCurrentParticleaod) {
+ Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
+ continue;
+ }
+ if (!lCurrentParticleaod->IsPhysicalPrimary()) continue;
+ if (!(lCurrentParticleaod->PdgCode() == lPdgCodeCasc)) continue;
+ partEnergy = lCurrentParticleaod->E();
+ partPz = lCurrentParticleaod->Pz();
+ partEta = lCurrentParticleaod->Eta();
+ partP = lCurrentParticleaod->P();
+ partPt = lCurrentParticleaod->Pt();
+ partTheta = lCurrentParticleaod->Theta();
+ partMass = lCurrentParticleaod->M(); //FIXME: not sure this works, seems not implemented
+ partVx = lCurrentParticleaod->Xv();
+ partVy = lCurrentParticleaod->Yv();
+ partVz = lCurrentParticleaod->Zv();
+ if (lCurrentParticleaod->GetDaughter(0)>=0) {
+ AliAODMCParticle *mcBach = (AliAODMCParticle*) arrayMC->At(lCurrentParticleaod->GetDaughter(0));
+ if (mcBach) {
+ bacVx = mcBach->Xv();
+ bacVy = mcBach->Yv();
+ bacVz = mcBach->Zv();
+ }
+ }
+ }
+ ncascperevtot++;
+ // - Fill the first histos : = any generated Xi, not necessarily within the acceptance
+ Double_t lRapXiMC = 0.5*TMath::Log((partEnergy + partPz) / (partEnergy - partPz +1.e-13));
+ // - Calculate proper time
+ Double_t lctau = TMath::Sqrt((partVx-bacVx)*(partVx-bacVx)+(partVy-bacVy)*(partVy-bacVy)+(partVz-bacVz)*(partVz-bacVz));
+ if (partP!=0.) lctau = lctau*partMass/partP;
+ else lctau = -1.;
+ Double_t lRadToDeg = 180.0/TMath::Pi();
+ // - Fill the first histos : = any generated Xi, not necessarily within the acceptance
+ lHistEtaGenCasc->Fill( partEta );
+ l3dHistGenPtVsGenYvsNtracksPhysEff->Fill( partPt, lRapXiMC, lPrimaryTrackMultiplicity );
+ l3dHistGenPtVsGenctauvsYPhysEff->Fill( partPt, lctau, lRapXiMC );
+ lHistThetaGenCasc->Fill( lRadToDeg * partTheta );
+
+ //--------------------------------------------------------------------------------------------
+ // - Check the emission of particle stays within the acceptance of the detector (cut in theta)
+ if (fApplyAccCut) { if( partTheta < TMath::Pi()/4.0 || partTheta > 3.0*TMath::Pi()/4.0 ) continue;}
+
+ Float_t lambdaTheta = 0.;
+ Float_t bacTheta = 0.;
+ Float_t dghtBarV0Theta = 0.;
+ Float_t dghtMesV0Theta = 0.;
+ Float_t bacPt = 0.;
+ Float_t dghtBarV0Pt = 0.;
+ Float_t dghtMesV0Pt = 0.;
+
+ if ( fAnalysisType == "ESD" ) {
+ TParticle* xiMC = lMCstack->Particle( iCurrentLabelStack );
+ if ( xiMC->GetNDaughters() != 2) continue;
+ if ( xiMC->GetDaughter(0) < 0 ) continue;
+ if ( xiMC->GetDaughter(1) < 0 ) continue;
+ TParticle* lDght0ofXi = lMCstack->Particle( xiMC->GetDaughter(0) );
+ TParticle* lDght1ofXi = lMCstack->Particle( xiMC->GetDaughter(1) );
+ TParticle* lLambda = 0;
+ TParticle* lBach = 0;
+
+ // Xi - Case 1
+ if ( lDght0ofXi->GetPdgCode() == lPdgCodeLambda && lDght1ofXi->GetPdgCode() == lPdgCodeBach ){
+ lLambda = lDght0ofXi; // dghter0 = Lambda
+ lBach = lDght1ofXi; // dghter1 = Pi-
+ }
+ // Xi - Case 2
+ else if ( lDght0ofXi->GetPdgCode() == lPdgCodeBach && lDght1ofXi->GetPdgCode() == lPdgCodeLambda ){
+ lBach = lDght0ofXi; // dghter0 = Pi-
+ lLambda = lDght1ofXi; // dghter1 = Lambda
+ }
+ // Otherwise - Case 3
+ else continue;
+
+ // - Check the emission of particle stays within the acceptance of the detector (cut in pt + theta)
+ if (fApplyAccCut) {
+ if( lLambda->Theta() < TMath::Pi()/4.0 || lLambda->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lBach->Theta() < TMath::Pi()/4.0 || lBach->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lBach->Pt() < 0.150 ) continue; //FIXME: maybe tuned for Xi but not for K- from Omega ...
+ }
+
+ //---------
+ // - V0 level
+ TParticle* lDghtBarV0 = 0;
+ TParticle* lDghtMesV0 = 0;
+ if( lLambda->GetNDaughters() != 2 ) continue;
+ if( lLambda->GetDaughter(0) < 0 ) continue;
+ if( lLambda->GetDaughter(1) < 0 ) continue;
+ TParticle* lDght0ofLambda = lMCstack->Particle( lLambda->GetDaughter(0) );
+ TParticle* lDght1ofLambda = lMCstack->Particle( lLambda->GetDaughter(1) );
+
+ // V0 - Case 1
+ if ( lDght0ofLambda->GetPdgCode() == lPdgCodeDghtBarV0 && lDght1ofLambda->GetPdgCode() == lPdgCodeDghtMesV0 ) { // Here !
+ lDghtBarV0 = lDght0ofLambda; // dghter0 = Proton
+ lDghtMesV0 = lDght1ofLambda; // dghter1 = Pi-
+ }
+ // V0 - Case 2
+ else if ( lDght0ofLambda->GetPdgCode() == lPdgCodeDghtMesV0 && lDght1ofLambda->GetPdgCode() == lPdgCodeDghtBarV0 ) { // Here !
+ lDghtMesV0 = lDght0ofLambda; // dghter0 = Pi-
+ lDghtBarV0 = lDght1ofLambda; // dghter1 = Proton
+ }
+ // Otherwise - Case 3
+ else continue;
+
+ // - Check the emission of particle stays within the acceptance of the detector
+ if (fApplyAccCut) {
+ if( lDghtBarV0->Theta() < TMath::Pi()/4.0 || lDghtBarV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lDghtMesV0->Theta() < TMath::Pi()/4.0 || lDghtMesV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lDghtBarV0->Pt() < 0.250 ) continue;
+ if( lDghtMesV0->Pt() < 0.150 ) continue;
+ }
+
+ lambdaTheta = lLambda->Theta();
+ bacTheta = lBach->Theta();
+ dghtBarV0Theta = lDghtBarV0->Theta();
+ dghtMesV0Theta = lDghtMesV0->Theta();
+ bacPt = lBach->Pt();
+ dghtBarV0Pt = lDghtBarV0->Pt();
+ dghtMesV0Pt = lDghtMesV0->Pt();
+
+ } else if ( fAnalysisType == "AOD") {
+
+ AliAODMCParticle *xiMC = (AliAODMCParticle*) arrayMC->At(iCurrentLabelStack);
+ if (xiMC->GetNDaughters() != 2) continue;
+ if (xiMC->GetDaughter(0) < 0 ) continue;
+ if (xiMC->GetDaughter(1) < 0 ) continue;
+
+ AliAODMCParticle* lDght0ofXi = (AliAODMCParticle*) arrayMC->At( xiMC->GetDaughter(0) );
+ AliAODMCParticle* lDght1ofXi = (AliAODMCParticle*) arrayMC->At( xiMC->GetDaughter(1) );
+
+ AliAODMCParticle* lLambda = 0;
+ AliAODMCParticle* lBach = 0;
+
+ // Xi - Case 1
+ if ( lDght0ofXi->PdgCode() == lPdgCodeLambda && lDght1ofXi->PdgCode() == lPdgCodeBach ){
+ lLambda = lDght0ofXi; // dghter0 = Lambda
+ lBach = lDght1ofXi; // dghter1 = Pi-
+ }
+ // Xi - Case 2
+ else if ( lDght0ofXi->PdgCode() == lPdgCodeBach && lDght1ofXi->PdgCode() == lPdgCodeLambda ){
+ lBach = lDght0ofXi; // dghter0 = Pi
+ lLambda = lDght1ofXi; //dghter1 = Lambda
+ }
+ // Otherwise - Case 3
+ else continue;
+
+ // - Check the emission of particle stays within the acceptance of the detector (cut in pt + theta)
+ if (fApplyAccCut) {
+ if ( lLambda->Theta() < TMath::Pi()/4.0 || lLambda->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lBach->Theta() < TMath::Pi()/4.0 || lBach->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lBach->Pt() < 0.150 ) continue; //FIXME : maybe tuned for Xi but not for K- from Omega ...
+ }
+
+ //-----------
+ // - V0 level
+ AliAODMCParticle* lDghtBarV0 = 0;
+ AliAODMCParticle* lDghtMesV0 = 0;
+
+ if( lLambda->GetNDaughters() != 2 ) continue;
+ if( lLambda->GetDaughter(0) < 0 ) continue;
+ if( lLambda->GetDaughter(1) < 0 ) continue;
+
+ AliAODMCParticle* lDght0ofLambda = (AliAODMCParticle*) arrayMC->At( lLambda->GetDaughter(0) );
+ AliAODMCParticle* lDght1ofLambda = (AliAODMCParticle*) arrayMC->At( lLambda->GetDaughter(1) );
+
+ // V0 - Case 1
+ if ( lDght0ofLambda->PdgCode() == lPdgCodeDghtBarV0 && lDght1ofLambda->PdgCode() == lPdgCodeDghtMesV0 ) {
+ lDghtBarV0 = lDght0ofLambda; // dghter0 = Proton
+ lDghtMesV0 = lDght1ofLambda; // dghter1 = Pi-
+ }
+ // V0 - Case 2
+ else if ( lDght0ofLambda->PdgCode() == lPdgCodeDghtMesV0 && lDght1ofLambda->PdgCode() == lPdgCodeDghtBarV0 ) {
+ lDghtMesV0 = lDght0ofLambda; // dghter0 = Pi-
+ lDghtBarV0 = lDght1ofLambda; // dghter1 = proton
+ }
+ // V0 otherwise - Case 3
+ else continue;
+
+ // - Check the emission of particle stays within the acceptance of the detector
+ if (fApplyAccCut) {
+ if( lDghtBarV0->Theta() < TMath::Pi()/4.0 || lDghtBarV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lDghtMesV0->Theta() < TMath::Pi()/4.0 || lDghtMesV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
+ if( lDghtBarV0->Pt() < 0.250 ) continue;
+ if( lDghtMesV0->Pt() < 0.150 ) continue;
+ }
+
+ lambdaTheta = lLambda->Theta();
+ bacTheta = lBach->Theta();
+ dghtBarV0Theta = lDghtBarV0->Theta();
+ dghtMesV0Theta = lDghtMesV0->Theta();
+ bacPt = lBach->Pt();
+ dghtBarV0Pt = lDghtBarV0->Pt();
+ dghtMesV0Pt = lDghtMesV0->Pt();
+ }
+
+ //---------------------------------------
+ // - Filling histos for findable cascades
+ // - Fill theta histos
+ lHistThetaLambda->Fill( lRadToDeg * lambdaTheta );
+ lHistThetaBach->Fill( lRadToDeg * bacTheta );
+ lHistThetaBarDghter->Fill( lRadToDeg * dghtBarV0Theta );
+ lHistThetaMesDghter->Fill( lRadToDeg * dghtMesV0Theta );
+ // - Fill pt histos
+ lHistPtBach ->Fill( bacPt );
+ lHistPtBarDghter ->Fill( dghtBarV0Pt );
+ lHistPtMesDghter ->Fill( dghtMesV0Pt );
+ l2dHistGenPtVsGenYFdbl ->Fill( partPt, lRapXiMC );
+
+ ncascperev++;
+
+ }// This is the end of the loop on primaries
+
+ if (iCascType == 1) {
+ fHistnXiMinusPerEv->Fill(ncascperev);
+ fHistnXiMinusPerEvTot->Fill(ncascperevtot);
+ }
+ if (iCascType == 2) {
+ fHistnXiPlusPerEv->Fill(ncascperev);
+ fHistnXiPlusPerEvTot->Fill(ncascperevtot);
+ }
+ if (iCascType == 3) {
+ fHistnOmegaMinusPerEv->Fill(ncascperev);
+ fHistnOmegaMinusPerEvTot->Fill(ncascperevtot);
+ }
+ if (iCascType == 4) {
+ fHistnOmegaPlusPerEv->Fill(ncascperev);
+ fHistnOmegaPlusPerEvTot->Fill(ncascperevtot);
+ }
+
+ // - Re-initialisation of the local THF pointers
+ lHistEtaGenCasc = 0x0;
+ lHistThetaGenCasc = 0x0;
+ l2dHistGenPtVsGenYFdbl = 0x0;
+ lHistThetaLambda = 0x0;
+ lHistThetaBach = 0x0;
+ lHistThetaBarDghter = 0x0;
+ lHistThetaMesDghter = 0x0;
+ lHistPtBach = 0x0;
+ lHistPtBarDghter = 0x0;
+ lHistPtMesDghter = 0x0;
+
+ } // end of loop over the different types of cascades (Xi-+, Omega-+)
+
+
+
+ //-----------------------------------------
+ // - Loop over the reconstructed candidates
+ //-----------------------------------------
+ Int_t nAssoXiMinus = 0;
+ Int_t nAssoXiPlus = 0;
+ Int_t nAssoOmegaMinus = 0;
+ Int_t nAssoOmegaPlus = 0;
+ Int_t lPosTPCClusters = 0;
+ Int_t lNegTPCClusters = 0;
+ Int_t lBachTPCClusters = 0;
+ Double_t lDcaXiDaughters = -1. ;
+ Double_t lDcaBachToPrimVertexXi = -1. ;
+ Double_t lXiCosineOfPointingAngle = -1. ;
+ Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
+ Double_t lXiRadius = -1000. ;
+ Double_t lInvMassLambdaAsCascDghter = 0.;
+ Double_t lDcaV0DaughtersXi = -1.;
+ Double_t lV0CosineOfPointingAngleXi = -1.;
+ Double_t lV0CosineOfPointingAngle = -1.;
+ Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
+ Double_t lV0RadiusXi = -1000.;
+ Double_t lDcaV0ToPrimVertexXi = -1.;
+ Double_t lDcaPosToPrimVertexXi = -1.;
+ Double_t lDcaNegToPrimVertexXi = -1.;
+ Double_t lChargeXi = -1.;
+ Double_t lV0mom = -1000.;
+ Double_t lmcPt = -1.;
+ Double_t lmcRapCasc = -1.;
+ Double_t lmcEta = -1000.;
+ Double_t lmcTransvRadius = -1000.;
+ Double_t lrecoPt = -100.;
+ Double_t lrecoTransvRadius = -1000.;
+ Double_t lDeltaPhiMcReco = -1.;
+ Double_t lBachTransvMom = 0.;
+ Double_t lpTrackTransvMom = 0.;
+ Double_t lnTrackTransvMom = 0.;
+ Double_t lmcPtPosV0Dghter = -100.;
+ Double_t lmcPtNegV0Dghter = -100.;
+ Double_t lrecoP = -100.;
+ Double_t lmcPtBach = -100.;
+ Double_t cascadeMass = 0.;
+
+ // - Get the number of cascades
+ Int_t ncascades = 0;
+ if ( fAnalysisType == "ESD" ) { ncascades = lESDevent->GetNumberOfCascades(); }
+ else if ( fAnalysisType == "AOD" ) { ncascades = lAODevent->GetNumberOfCascades(); }
+
+ //-------------------------------
+ // - Begining of the Cascade Loop
+ for (Int_t iXi = 0; iXi < ncascades; iXi++) {
+
+ Bool_t lIsPosInXiProton = kFALSE;
+ Bool_t lIsPosInXiPion = kFALSE;
+ Bool_t lIsPosInOmegaProton = kFALSE;
+ Bool_t lIsPosInOmegaPion = kFALSE;
+ Bool_t lIsNegInXiProton = kFALSE;
+ Bool_t lIsNegInXiPion = kFALSE;
+ Bool_t lIsNegInOmegaProton = kFALSE;
+ Bool_t lIsNegInOmegaPion = kFALSE;
+ Bool_t lIsBachelorKaon = kFALSE;
+ Bool_t lIsBachelorPion = kFALSE;
+ Bool_t lIsBachelorKaonForTPC = kFALSE;
+ Bool_t lIsBachelorPionForTPC = kFALSE;
+ Bool_t lIsNegPionForTPC = kFALSE;
+ Bool_t lIsPosPionForTPC = kFALSE;
+ Bool_t lIsNegProtonForTPC = kFALSE;
+ Bool_t lIsPosProtonForTPC = kFALSE;
+
+ // - Combined PID
+ // Reasonable guess for the priors for the cascade track sample (e-, mu, pi, K, p)
+ Double_t lPriorsGuessXi[14] = {0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ Double_t lPriorsGuessOmega[14] = {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ Double_t ppionBach = 0.0, pkaonBach = 0.0;
+ Bool_t lIsBachelorMCPiMinus = kFALSE;
+ Bool_t lIsBachelorMCPiPlus = kFALSE;
+ Bool_t lIsBachelorMCKMinus = kFALSE;
+ Bool_t lIsBachelorMCKPlus = kFALSE;
+ Double_t lInvMassXiMinus = 0.;
+ Double_t lInvMassXiPlus = 0.;
+ Double_t lInvMassOmegaMinus = 0.;
+ Double_t lInvMassOmegaPlus = 0.;
+ Bool_t lAssoXiMinus = kFALSE;
+ Bool_t lAssoXiPlus = kFALSE;
+ Bool_t lAssoOmegaMinus = kFALSE;
+ Bool_t lAssoOmegaPlus = kFALSE;
+
+ Float_t etaBach = 0.;
+ Float_t etaPos = 0.;
+ Float_t etaNeg = 0.;
+
+ if ( fAnalysisType == "ESD" ) {
+
+ // - Load the cascade
+ AliESDcascade *xiESD = lESDevent->GetCascade(iXi);
+ if (!xiESD) continue;
+
+ // - Connection to daughter tracks of the current cascade
+ UInt_t lIdxPosXi = (UInt_t) TMath::Abs( xiESD->GetPindex() );
+ UInt_t lIdxNegXi = (UInt_t) TMath::Abs( xiESD->GetNindex() );
+ UInt_t lBachIdx = (UInt_t) TMath::Abs( xiESD->GetBindex() );
+
+ // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
+ if(lBachIdx == lIdxNegXi) {
+ AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
+ }
+ if(lBachIdx == lIdxPosXi) {
+ AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
+ }
+
+ // - Get the daughter tracks
+ AliESDtrack *pTrackXi = lESDevent->GetTrack( lIdxPosXi );
+ AliESDtrack *nTrackXi = lESDevent->GetTrack( lIdxNegXi );
+ AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );
+ if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
+ Printf("ERROR: Could not retrieve one of the 3 daughter tracks of the cascade ...");
+ continue;
+ }
+
+ // Get the number of TPC clusters
+ lPosTPCClusters = pTrackXi->GetTPCNcls();
+ lNegTPCClusters = nTrackXi->GetTPCNcls();
+ lBachTPCClusters = bachTrackXi->GetTPCNcls();
+ // - Rejection of a poor quality tracks
+ if(fkQualityCutTPCrefit){
+ // - Poor quality related to TPCrefit
+ ULong_t pStatus = pTrackXi->GetStatus();
+ ULong_t nStatus = nTrackXi->GetStatus();
+ ULong_t bachStatus = bachTrackXi->GetStatus();
+ if ((pStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
+ if ((nStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
+ if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }
+ }
+ if(fkQualityCutnTPCcls){
+ // - Poor quality related to TPC clusters
+ if(lPosTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }
+ if(lNegTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }
+ if(lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!"); continue; }
+ }
+
+ etaPos = pTrackXi->Eta();
+ etaNeg = nTrackXi->Eta();
+ etaBach = bachTrackXi->Eta();
+
+ // - Info over reconstructed cascades
+ Double_t lV0quality = 0.;
+ if( bachTrackXi->Charge() < 0 ) {
+ //Calculate the effective mass of the Xi- candidate: Xi- hyp. (pdg code 3312
+ lV0quality = 0.;
+ xiESD->ChangeMassHypothesis(lV0quality , 3312);
+ lInvMassXiMinus = xiESD->GetEffMassXi();
+ //Calculate the effective mass of the Xi- candidate: Omega- hyp. (pdg code 3334)
+ lV0quality = 0.;
+ xiESD->ChangeMassHypothesis(lV0quality , 3334);
+ lInvMassOmegaMinus = xiESD->GetEffMassXi();
+ //Back to "default" hyp. (Xi-)
+ lV0quality = 0.;
+ xiESD->ChangeMassHypothesis(lV0quality , 3312);
+ }
+ if( bachTrackXi->Charge() > 0 ){
+ //Calculate the effective mass of the Xi- candidate: Xi+ hyp. (pdg code -3312)
+ lV0quality = 0.;
+ xiESD->ChangeMassHypothesis(lV0quality , -3312);
+ lInvMassXiPlus = xiESD->GetEffMassXi();
+ //Calculate the effective mass of the Xi- candidate: Omega+ hyp. (pdg code -3334)
+ lV0quality = 0.;
+ xiESD->ChangeMassHypothesis(lV0quality , -3334);
+ lInvMassOmegaPlus = xiESD->GetEffMassXi();
+ //Back to "default" hyp. (Xi-)
+ lV0quality = 0.;
+ xiESD->ChangeMassHypothesis(lV0quality , -3312);
+ }
+ lDcaXiDaughters = xiESD->GetDcaXiDaughters();
+ lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lMagneticField) );
+ lXiCosineOfPointingAngle = xiESD->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
+ xiESD->GetXYZcascade( lPosXi[0], lPosXi[1], lPosXi[2] );
+ lInvMassLambdaAsCascDghter = xiESD->GetEffMass();
+ lDcaV0DaughtersXi = xiESD->GetDcaV0Daughters();
+ lV0CosineOfPointingAngleXi = xiESD->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
+ lV0CosineOfPointingAngle = xiESD->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2]);
+ xiESD->GetXYZ( lPosV0Xi[0], lPosV0Xi[1], lPosV0Xi[2] );
+ lDcaV0ToPrimVertexXi = xiESD->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
+ lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lMagneticField) );
+ lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lMagneticField) );
+ lChargeXi = xiESD->Charge();
+
+ //------------------
+ // - PID Information
+
+ // - Combined VO-positive-daughter PID
+ AliPID pPidXi; pPidXi.SetPriors( lPriorsGuessXi );
+ AliPID pPidOmega; pPidOmega.SetPriors( lPriorsGuessOmega );
+ if( pTrackXi->IsOn(AliESDtrack::kESDpid) ){
+ Double_t r[10] = {0.}; pTrackXi->GetESDpid(r);
+ pPidXi.SetProbabilities(r);
+ pPidOmega.SetProbabilities(r);
+ // Check if the V0 positive track is a proton (case for Xi-)
+ Double_t pproton = pPidXi.GetProbability(AliPID::kProton);
+ if (pproton > pPidXi.GetProbability(AliPID::kElectron) &&
+ pproton > pPidXi.GetProbability(AliPID::kMuon) &&
+ pproton > pPidXi.GetProbability(AliPID::kPion) &&
+ pproton > pPidXi.GetProbability(AliPID::kKaon) ) lIsPosInXiProton = kTRUE;
+ // Check if the V0 positive track is a pi+ (case for Xi+)
+ Double_t ppion = pPidXi.GetProbability(AliPID::kPion);
+ if (ppion > pPidXi.GetProbability(AliPID::kElectron) &&
+ ppion > pPidXi.GetProbability(AliPID::kMuon) &&
+ ppion > pPidXi.GetProbability(AliPID::kKaon) &&
+ ppion > pPidXi.GetProbability(AliPID::kProton) ) lIsPosInXiPion = kTRUE;
+ // Check if the V0 positive track is a proton (case for Omega-)
+ pproton = 0.;
+ pproton = pPidOmega.GetProbability(AliPID::kProton);
+ if (pproton > pPidOmega.GetProbability(AliPID::kElectron) &&
+ pproton > pPidOmega.GetProbability(AliPID::kMuon) &&
+ pproton > pPidOmega.GetProbability(AliPID::kPion) &&
+ pproton > pPidOmega.GetProbability(AliPID::kKaon) ) lIsPosInOmegaProton = kTRUE;
+ // Check if the V0 positive track is a pi+ (case for Omega+)
+ ppion = 0.;
+ ppion = pPidOmega.GetProbability(AliPID::kPion);
+ if (ppion > pPidOmega.GetProbability(AliPID::kElectron) &&
+ ppion > pPidOmega.GetProbability(AliPID::kMuon) &&
+ ppion > pPidOmega.GetProbability(AliPID::kKaon) &&
+ ppion > pPidOmega.GetProbability(AliPID::kProton) ) lIsPosInOmegaPion = kTRUE;
+ }
+ // - Combined VO-negative-daughter PID
+ AliPID nPidXi; nPidXi.SetPriors( lPriorsGuessXi );
+ AliPID nPidOmega; nPidOmega.SetPriors( lPriorsGuessOmega );
+ if( nTrackXi->IsOn(AliESDtrack::kESDpid) ) {
+ Double_t r[10] = {0.}; nTrackXi->GetESDpid(r);
+ nPidXi.SetProbabilities(r);
+ nPidOmega.SetProbabilities(r);
+ // Check if the V0 negative track is a pi- (case for Xi-)
+ Double_t ppion = nPidXi.GetProbability(AliPID::kPion);
+ if (ppion > nPidXi.GetProbability(AliPID::kElectron) &&
+ ppion > nPidXi.GetProbability(AliPID::kMuon) &&
+ ppion > nPidXi.GetProbability(AliPID::kKaon) &&
+ ppion > nPidXi.GetProbability(AliPID::kProton) ) lIsNegInXiPion = kTRUE;
+ // Check if the V0 negative track is an anti-proton (case for Xi+)
+ Double_t pproton = nPidXi.GetProbability(AliPID::kProton);
+ if (pproton > nPidXi.GetProbability(AliPID::kElectron) &&
+ pproton > nPidXi.GetProbability(AliPID::kMuon) &&
+ pproton > nPidXi.GetProbability(AliPID::kPion) &&
+ pproton > nPidXi.GetProbability(AliPID::kKaon) ) lIsNegInXiProton = kTRUE;
+ // Check if the V0 negative track is a pi- (case for Omega-)
+ ppion = 0.;
+ ppion = nPidOmega.GetProbability(AliPID::kPion);
+ if (ppion > nPidOmega.GetProbability(AliPID::kElectron) &&
+ ppion > nPidOmega.GetProbability(AliPID::kMuon) &&
+ ppion > nPidOmega.GetProbability(AliPID::kKaon) &&
+ ppion > nPidOmega.GetProbability(AliPID::kProton) ) lIsNegInOmegaPion = kTRUE;
+ // Check if the V0 negative track is an anti-proton (case for Omega+)
+ pproton = 0.;
+ pproton = nPidOmega.GetProbability(AliPID::kProton);
+ if (pproton > nPidOmega.GetProbability(AliPID::kElectron) &&
+ pproton > nPidOmega.GetProbability(AliPID::kMuon) &&
+ pproton > nPidOmega.GetProbability(AliPID::kPion) &&
+ pproton > nPidOmega.GetProbability(AliPID::kKaon) ) lIsNegInOmegaProton = kTRUE;
+ }
+ // - Combined bachelor PID
+ AliPID bachPidXi; bachPidXi.SetPriors( lPriorsGuessXi );
+ AliPID bachPidOmega; bachPidOmega.SetPriors( lPriorsGuessOmega );
+ if ( bachTrackXi->IsOn(AliESDtrack::kESDpid) ) {
+ Double_t r[10] = {0.}; bachTrackXi->GetESDpid(r);
+ bachPidXi.SetProbabilities(r);
+ bachPidOmega.SetProbabilities(r);
+ // Check if the bachelor track is a pion
+ ppionBach = bachPidXi.GetProbability(AliPID::kPion);
+ if (ppionBach > bachPidXi.GetProbability(AliPID::kElectron) &&
+ ppionBach > bachPidXi.GetProbability(AliPID::kMuon) &&
+ ppionBach > bachPidXi.GetProbability(AliPID::kKaon) &&
+ ppionBach > bachPidXi.GetProbability(AliPID::kProton) ) lIsBachelorPion = kTRUE;
+ // Check if the bachelor track is a kaon
+ pkaonBach = bachPidOmega.GetProbability(AliPID::kKaon);
+ if (pkaonBach > bachPidOmega.GetProbability(AliPID::kElectron) &&
+ pkaonBach > bachPidOmega.GetProbability(AliPID::kMuon) &&
+ pkaonBach > bachPidOmega.GetProbability(AliPID::kPion) &&
+ pkaonBach > bachPidOmega.GetProbability(AliPID::kProton) ) lIsBachelorKaon = kTRUE;
+ }
+ // - 4-sigma bands on Bethe-Bloch curve
+ // Bachelor
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
+ // Negative V0 daughter
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
+ // Positive V0 daughter
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
+ /*
+ const AliExternalTrackParam *pInnerWallTrackXi = pTrackXi ->GetInnerParam(); // Do not use GetTPCInnerWall
+ const AliExternalTrackParam *nInnerWallTrackXi = nTrackXi ->GetInnerParam();
+ const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
+ if(pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ){
+ Double_t pMomInnerWall = pInnerWallTrackXi ->GetP();
+ Double_t nMomInnerWall = nInnerWallTrackXi ->GetP();
+ Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
+ // Bachelor
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3) lIsBachelorPionForTPC = kTRUE;
+ if (bachMomInnerWall < 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
+ if (bachMomInnerWall > 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;
+ // Negative V0 daughter
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 3 ) lIsNegPionForTPC = kTRUE;
+ if (nMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 ) lIsNegProtonForTPC = kTRUE;
+ if (nMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 ) lIsNegProtonForTPC = kTRUE;
+ // Positive V0 daughter
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 3 ) lIsPosPionForTPC = kTRUE;
+ if (pMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5) lIsPosProtonForTPC = kTRUE;
+ if (pMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3) lIsPosProtonForTPC = kTRUE;
+ }*/
+ // - PID proba Vs Pt(Bach)
+ Int_t lblBachForPID = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
+ TParticle* mcBachForPID = lMCstack->Particle( lblBachForPID );
+ lmcPtBach = mcBachForPID->Pt();
+ // - MC perfect PID
+ if( mcBachForPID->GetPdgCode() == -211) lIsBachelorMCPiMinus = kTRUE;
+ if( mcBachForPID->GetPdgCode() == 211) lIsBachelorMCPiPlus = kTRUE;
+ if( mcBachForPID->GetPdgCode() == -321) lIsBachelorMCKMinus = kTRUE;
+ if( mcBachForPID->GetPdgCode() == 321) lIsBachelorMCKPlus = kTRUE;
+
+
+ //---------------------------------------------------------------
+ // - MC association (care : lots of "continue;" below this line)
+ if(fDebug > 5) cout<< "MC EventNumber: "<<lMCevent->Header()->GetEvent()<<" / MC event Number in Run : "<<lMCevent->Header()->GetEventNrInRun()<<endl;
+ // - Level of the V0 daughters
+ Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );
+ Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );
+ TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );
+ TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );
+ // - Level of the Xi daughters
+ Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ;
+ Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();
+ if( lblMotherPosV0Dghter != lblMotherNegV0Dghter) continue; // same mother
+ if( lblMotherPosV0Dghter < 0 ) continue; // this particle is primary, no mother
+ if( lblMotherNegV0Dghter < 0 ) continue; // this particle is primary, no mother
+ // mothers = Lambda candidate ... a priori
+ TParticle* mcMotherPosV0Dghter = lMCstack->Particle( lblMotherPosV0Dghter );
+ TParticle* mcMotherNegV0Dghter = lMCstack->Particle( lblMotherNegV0Dghter ); // MN: redundant?? already checked that labels are the same...-->same part from stack
+ Int_t lblBach = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
+ TParticle* mcBach = lMCstack->Particle( lblBach );
+ // - Level of Xi candidate
+ Int_t lblGdMotherPosV0Dghter = mcMotherPosV0Dghter->GetFirstMother() ;
+ Int_t lblGdMotherNegV0Dghter = mcMotherNegV0Dghter->GetFirstMother() ;
+ if( lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter ) continue;
+ if( lblGdMotherPosV0Dghter < 0 ) continue; // primary lambda ...
+ if( lblGdMotherNegV0Dghter < 0 ) continue; // primary lambda ...
+ // Gd mothers = Xi candidate ... a priori
+ TParticle* mcGdMotherPosV0Dghter = lMCstack->Particle( lblGdMotherPosV0Dghter );
+ TParticle* mcGdMotherNegV0Dghter = lMCstack->Particle( lblGdMotherNegV0Dghter );
+ Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetFirstMother() );
+ if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters
+ TParticle* mcMotherBach = lMCstack->Particle( lblMotherBach );
+
+ // - Check if cascade is primary
+ if (!(lMCstack->IsPhysicalPrimary(lblMotherBach))) continue;
+
+ // - Manage boolean for association
+ if ( mcMotherBach ->GetPdgCode() == 3312 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == 3312 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == 3312 ) {lAssoXiMinus = kTRUE;
+ cascadeMass = 1.321;
+ nAssoXiMinus++; }
+ else if( mcMotherBach ->GetPdgCode() == -3312 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == -3312 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == -3312 ) {lAssoXiPlus = kTRUE;
+ cascadeMass = 1.321;
+ nAssoXiPlus++; }
+ else if( mcMotherBach ->GetPdgCode() == 3334 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == 3334 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == 3334 ) {lAssoOmegaMinus = kTRUE;
+ cascadeMass = 1.672;
+ nAssoOmegaMinus++; }
+ else if( mcMotherBach ->GetPdgCode() == -3334 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == -3334 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == -3334 ) {lAssoOmegaPlus = kTRUE;
+ cascadeMass = 1.672;
+ nAssoOmegaPlus++; }
+ // If a proper association exists ...
+ if(fDebug > 4){
+ cout<<"XiMinus = "<<lAssoXiMinus <<endl;
+ cout<<"XiPlus = "<<lAssoXiPlus <<endl;
+ cout<<"OmegaMinus = "<<lAssoOmegaMinus<<endl;
+ cout<<"OmegaPlus = "<<lAssoOmegaPlus <<endl
+ <<"----" <<endl;
+ }
+ if(fDebug > 5){
+ cout<<endl;
+ cout<<"- V0 daughters - "<<endl;
+ cout<<" + V0 Pos. / Label : "<<lblPosV0Dghter<<" - Pdg Code : "<<mcPosV0Dghter->GetTitle()<<endl;
+ cout<<" - V0 Neg. / Label : "<<lblNegV0Dghter<<" - Pdg Code : "<<mcNegV0Dghter->GetTitle()<<endl;
+
+ cout<<"- Xi daughters - "<<endl;
+ cout<<" + V0 Pos. mother / Label : "<<lblMotherPosV0Dghter<<" - Pdg Code : "<<mcMotherPosV0Dghter->GetTitle()<<endl;
+ cout<<" - V0 Neg. mother / Label : "<<lblMotherNegV0Dghter<<" - Pdg Code : "<<mcMotherNegV0Dghter->GetTitle()<<endl;
+
+ cout<<" -- Bach. / Label :"<<lblBach<<" - Pdg Code : "<<mcBach->GetTitle()<<endl;
+
+ cout<<"- Xi candidate -"<<endl;
+ cout<<" + V0 Pos. Gd Mother / Label : "<<lblGdMotherPosV0Dghter<<" - Pdg Code : "<< mcGdMotherPosV0Dghter->GetTitle()<<endl;
+ cout<<" - V0 Neg. Gd Mother / Label : "<<lblGdMotherNegV0Dghter<<" - Pdg Code : "<< mcGdMotherNegV0Dghter->GetTitle()<<endl;
+
+ cout<<" -- Mother Bach. / Label : "<<lblMotherBach<<" - Pdg Code : "<<mcMotherBach->GetTitle()<<endl;
+ cout<<endl;
+ }
+
+ lmcPt = mcMotherBach->Pt();
+ lmcRapCasc = 0.5*TMath::Log( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) );
+ lmcEta = mcMotherBach->Eta();
+ lmcTransvRadius = mcBach->R(); // to get the decay point of Xi, = the production vertex of Bachelor ...
+ TVector3 lmcTVect3Mom( mcMotherBach->Px(), mcMotherBach->Py(), mcMotherBach->Pz() );
+ lrecoPt = xiESD->Pt();
+ lrecoTransvRadius = TMath::Sqrt( xiESD->Xv() * xiESD->Xv() + xiESD->Yv() * xiESD->Yv() );
+ TVector3 lrecoTVect3Mom( xiESD->Px(), xiESD->Py(), xiESD->Pz() );
+ lDeltaPhiMcReco = lmcTVect3Mom.DeltaPhi( lrecoTVect3Mom ) * 180.0/TMath::Pi();
+ lmcPtPosV0Dghter = mcPosV0Dghter->Pt() ;
+ lmcPtNegV0Dghter = mcNegV0Dghter->Pt();
+ lrecoP = xiESD->P();
+ Double_t nV0mom[3] = {0. ,0. ,0. };
+ Double_t pV0mom[3] = {0. ,0. ,0. };
+ xiESD->GetNPxPyPz(nV0mom[0],nV0mom[1],nV0mom[2]);
+ xiESD->GetPPxPyPz(pV0mom[0],pV0mom[1],pV0mom[2]);
+ lV0mom = TMath::Sqrt(TMath::Power(nV0mom[0]+pV0mom[0],2)+TMath::Power(nV0mom[1]+pV0mom[1],2)+TMath::Power(nV0mom[2]+pV0mom[2],2));
+ Double_t lBachMomX = 0.; Double_t lBachMomY = 0.; Double_t lBachMomZ = 0.;
+ xiESD->GetBPxPyPz( lBachMomX, lBachMomY, lBachMomZ );
+ lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
+ lnTrackTransvMom = TMath::Sqrt( nV0mom[0]*nV0mom[0] + nV0mom[1]*nV0mom[1] );
+ lpTrackTransvMom = TMath::Sqrt( pV0mom[0]*pV0mom[0] + pV0mom[1]*pV0mom[1] );
+
+ } else if ( fAnalysisType == "AOD" ) {
+
+ // - Load the cascade
+ const AliAODcascade *xiAOD = lAODevent->GetCascade(iXi);
+ if (!xiAOD) continue;
+
+ // - Connection to daughter tracks of the current cascade
+ AliAODTrack *pTrackXi = dynamic_cast<AliAODTrack*>( xiAOD->GetDaughter(0) );
+ AliAODTrack *nTrackXi = dynamic_cast<AliAODTrack*>( xiAOD->GetDaughter(1) );
+ AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xiAOD->GetDecayVertexXi()->GetDaughter(0) );
+ if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
+ AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");
+ continue;
+ }
+ UInt_t lIdxPosXi = (UInt_t) TMath::Abs( pTrackXi->GetID() );
+ UInt_t lIdxNegXi = (UInt_t) TMath::Abs( nTrackXi->GetID() );
+ UInt_t lBachIdx = (UInt_t) TMath::Abs( bachTrackXi->GetID() );
+
+ // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
+ if(lBachIdx == lIdxNegXi) {
+ AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
+ }
+ if(lBachIdx == lIdxPosXi) {
+ AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
+ }
+ lPosTPCClusters = pTrackXi->GetTPCNcls();
+ lNegTPCClusters = nTrackXi->GetTPCNcls();
+ lBachTPCClusters = bachTrackXi->GetTPCNcls();
+
+ // - Rejection of a poor quality tracks
+ if (fkQualityCutTPCrefit) {
+ // - Poor quality related to TPCrefit
+ if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
+ if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
+ if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }
+ }
+ if (fkQualityCutnTPCcls) {
+ // - Poor quality related to TPC clusters
+ if(lPosTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }
+ if(lNegTPCClusters < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }
+ if(lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach. track has less than 80 TPC clusters ... continue!"); continue; }
+ }
+
+ etaPos = pTrackXi->Eta();
+ etaNeg = nTrackXi->Eta();
+ etaBach = bachTrackXi->Eta();
+
+ // - Info over reconstructed cascades
+ if( bachTrackXi->Charge() < 0 ) {
+ lInvMassXiMinus = xiAOD->MassXi();
+ lInvMassOmegaMinus = xiAOD->MassOmega();
+ }
+ if( bachTrackXi->Charge() > 0 ){
+ lInvMassXiPlus = xiAOD->MassXi();
+ lInvMassOmegaPlus = xiAOD->MassOmega();
+ }
+ lDcaXiDaughters = xiAOD->DcaXiDaughters();
+ lDcaBachToPrimVertexXi = xiAOD->DcaBachToPrimVertex();
+ lXiCosineOfPointingAngle = xiAOD->CosPointingAngleXi( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
+ lPosXi[0] = xiAOD->DecayVertexXiX();
+ lPosXi[1] = xiAOD->DecayVertexXiY();
+ lPosXi[2] = xiAOD->DecayVertexXiZ();
+ lInvMassLambdaAsCascDghter = xiAOD->MassLambda();
+ lDcaV0DaughtersXi = xiAOD->DcaV0Daughters();
+ lV0CosineOfPointingAngleXi = xiAOD->CosPointingAngle( lPosXi );
+ lV0CosineOfPointingAngle = xiAOD->CosPointingAngle( lBestPrimaryVtxPos );
+ lPosV0Xi[0] = xiAOD->DecayVertexV0X();
+ lPosV0Xi[1] = xiAOD->DecayVertexV0Y();
+ lPosV0Xi[2] = xiAOD->DecayVertexV0Z();
+ lDcaV0ToPrimVertexXi = xiAOD->DcaV0ToPrimVertex();
+ lDcaPosToPrimVertexXi = xiAOD->DcaPosToPrimVertex();
+ lDcaNegToPrimVertexXi = xiAOD->DcaNegToPrimVertex();
+ lChargeXi = xiAOD->ChargeXi();
+
+ //------------------
+ // - PID Information
+ // Combined VO-positive-daughter PID
+ // Combined bachelor PID
+ /*
+ AliPID bachPidXi; bachPidXi.SetPriors( lPriorsGuessXi );
+ AliPID bachPidOmega; bachPidOmega.SetPriors( lPriorsGuessOmega );
+
+ if ( bachTrackXi->IsOn(AliESDtrack::kESDpid) ) { // Combined PID exists
+ Double_t r[10] = {0.}; bachTrackXi->GetESDpid(r);
+ bachPidXi.SetProbabilities(r);
+ bachPidOmega.SetProbabilities(r);
+ // Check if the bachelor track is a pion
+ ppionBach = bachPidXi.GetProbability(AliPID::kPion);
+ if (ppionBach > bachPidXi.GetProbability(AliPID::kElectron) &&
+ ppionBach > bachPidXi.GetProbability(AliPID::kMuon) &&
+ ppionBach > bachPidXi.GetProbability(AliPID::kKaon) &&
+ ppionBach > bachPidXi.GetProbability(AliPID::kProton) ) lIsBachelorPion = kTRUE;
+ // Check if the bachelor track is a kaon
+ pkaonBach = bachPidOmega.GetProbability(AliPID::kKaon);
+ if (pkaonBach > bachPidOmega.GetProbability(AliPID::kElectron) &&
+ pkaonBach > bachPidOmega.GetProbability(AliPID::kMuon) &&
+ pkaonBach > bachPidOmega.GetProbability(AliPID::kPion) &&
+ pkaonBach > bachPidOmega.GetProbability(AliPID::kProton) ) lIsBachelorKaon = kTRUE;
+ }// end if bachelor track with existing combined PID
+ */
+
+ // - TPC PID: 4-sigma bands on Bethe-Bloch curve
+ // Bachelor
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
+ // Negative V0 daughter
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 4) lIsNegPionForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
+ // Positive V0 daughter
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 4) lIsPosPionForTPC = kTRUE;
+ if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
+ /*
+ const AliExternalTrackParam *pInnerWallTrackXi = pTrackXi ->GetInnerParam(); // Do not use GetTPCInnerWall
+ const AliExternalTrackParam *nInnerWallTrackXi = nTrackXi ->GetInnerParam();
+ const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
+ if(pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ){
+ Double_t pMomInnerWall = pInnerWallTrackXi ->GetP();
+ Double_t nMomInnerWall = nInnerWallTrackXi ->GetP();
+ Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
+ // Bachelor
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3) lIsBachelorPionForTPC = kTRUE;
+ if (bachMomInnerWall < 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
+ if (bachMomInnerWall > 0.350 && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;
+ // Negative V0 daughter
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion )) < 3 ) lIsNegPionForTPC = kTRUE;
+ if (nMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 ) lIsNegProtonForTPC = kTRUE;
+ if (nMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 ) lIsNegProtonForTPC = kTRUE;
+ // Positive V0 daughter
+ if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion )) < 3 ) lIsPosPionForTPC = kTRUE;
+ if (pMomInnerWall < 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5) lIsPosProtonForTPC = kTRUE;
+ if (pMomInnerWall > 0.6 && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3) lIsPosProtonForTPC = kTRUE;
+ }*/
+
+ // - PID proba Vs Pt(Bach)
+ Int_t lblBachForPID = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
+ AliAODMCParticle* mcBachForPID = (AliAODMCParticle*) arrayMC->At( lblBachForPID );
+ lmcPtBach = mcBachForPID->Pt();
+
+ // - MC perfect PID
+ if( mcBachForPID->PdgCode() == -211) lIsBachelorMCPiMinus = kTRUE;
+ if( mcBachForPID->PdgCode() == 211) lIsBachelorMCPiPlus = kTRUE;
+ if( mcBachForPID->PdgCode() == -321) lIsBachelorMCKMinus = kTRUE;
+ if( mcBachForPID->PdgCode() == 321) lIsBachelorMCKPlus = kTRUE;
+
+ //--------------------------------------------------------------
+ // - MC association (care : lots of "continue;" below this line)
+ if(fDebug > 5) cout<<"MC EventNumber : "<<lMCevent->Header()->GetEvent()<<" / MC event Number in Run : "<<lMCevent->Header()->GetEventNrInRun()<<endl;
+ // - Level of the V0 daughters
+ Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );
+ Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );
+ AliAODMCParticle* mcPosV0Dghter = (AliAODMCParticle*) arrayMC->At( lblPosV0Dghter );
+ AliAODMCParticle* mcNegV0Dghter = (AliAODMCParticle*) arrayMC->At( lblNegV0Dghter );
+ // - Level of the Xi daughters
+ Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetMother();
+ Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetMother();
+ if( lblMotherPosV0Dghter != lblMotherNegV0Dghter) continue; // same mother
+ if( lblMotherPosV0Dghter < 0 ) continue; // this particle is primary, no mother
+ if( lblMotherNegV0Dghter < 0 ) continue; // this particle is primary, no mother
+ // mothers = Lambda candidate ... a priori
+ AliAODMCParticle* mcMotherPosV0Dghter = (AliAODMCParticle*) arrayMC->At( lblMotherPosV0Dghter );
+ AliAODMCParticle* mcMotherNegV0Dghter = (AliAODMCParticle*) arrayMC->At( lblMotherNegV0Dghter );
+ Int_t lblBach = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
+ AliAODMCParticle* mcBach = (AliAODMCParticle*) arrayMC->At( lblBach );
+ // - Level of Xi candidate
+ Int_t lblGdMotherPosV0Dghter = mcMotherPosV0Dghter->GetMother() ;
+ Int_t lblGdMotherNegV0Dghter = mcMotherNegV0Dghter->GetMother() ;
+ if( lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter ) continue;
+ if( lblGdMotherPosV0Dghter < 0 ) continue; // primary lambda ...
+ if( lblGdMotherNegV0Dghter < 0 ) continue; // primary lambda ...
+ // Gd mothers = Xi candidate ... a priori
+ AliAODMCParticle* mcGdMotherPosV0Dghter = (AliAODMCParticle*) arrayMC->At( lblGdMotherPosV0Dghter );
+ AliAODMCParticle* mcGdMotherNegV0Dghter = (AliAODMCParticle*) arrayMC->At( lblGdMotherNegV0Dghter );
+ Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetMother() );
+ if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters
+ AliAODMCParticle* mcMotherBach = (AliAODMCParticle*) arrayMC->At( lblMotherBach );
+
+ // - Check if cascade is primary
+ if (!(mcMotherBach->IsPhysicalPrimary())) continue;
+
+ // - Manage boolean for association
+ if ( mcMotherBach ->GetPdgCode() == 3312 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == 3312 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == 3312 ) {lAssoXiMinus = kTRUE;
+ cascadeMass = 1.321;
+ nAssoXiMinus++; }
+ else if( mcMotherBach ->GetPdgCode() == -3312 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == -3312 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == -3312 ) {lAssoXiPlus = kTRUE;
+ cascadeMass = 1.321;
+ nAssoXiPlus++; }
+ else if( mcMotherBach ->GetPdgCode() == 3334 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == 3334 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == 3334 ) {lAssoOmegaMinus = kTRUE;
+ cascadeMass = 1.672;
+ nAssoOmegaMinus++; }
+ else if( mcMotherBach ->GetPdgCode() == -3334 &&
+ mcGdMotherPosV0Dghter ->GetPdgCode() == -3334 &&
+ mcGdMotherNegV0Dghter ->GetPdgCode() == -3334 ) {lAssoOmegaPlus = kTRUE;
+ cascadeMass = 1.672;
+ nAssoOmegaPlus++; }
+
+ lmcPt = mcMotherBach->Pt();
+ lmcRapCasc = 0.5*TMath::Log( (mcMotherBach->E() + mcMotherBach->Pz()) / (mcMotherBach->E() - mcMotherBach->Pz() +1.e-13) );
+ lmcEta = mcMotherBach->Eta();
+ Float_t decayCascX = mcBach->Xv();
+ Float_t decayCascY = mcBach->Yv();
+ lmcTransvRadius = TMath::Sqrt(decayCascX*decayCascX+decayCascY*decayCascY); // decay point of Xi, = the production vertex of Bachelor ...
+ TVector3 lmcTVect3Mom( mcMotherBach->Px(), mcMotherBach->Py(), mcMotherBach->Pz() );
+ Double_t xiMomX = xiAOD->MomXiX();
+ Double_t xiMomY = xiAOD->MomXiY();
+ Double_t xiMomZ = xiAOD->MomXiZ();
+ lrecoPt = TMath::Sqrt( xiMomX*xiMomX + xiMomY*xiMomY );
+ lrecoTransvRadius = TMath::Sqrt( xiAOD->DecayVertexXiX() * xiAOD->DecayVertexXiX() + xiAOD->DecayVertexXiY() * xiAOD->DecayVertexXiY() );
+ TVector3 lrecoTVect3Mom( xiMomX, xiMomY, xiMomZ );
+ lDeltaPhiMcReco = lmcTVect3Mom.DeltaPhi( lrecoTVect3Mom ) * 180.0/TMath::Pi();
+ lmcPtPosV0Dghter = mcPosV0Dghter->Pt() ;
+ lmcPtNegV0Dghter = mcNegV0Dghter->Pt();
+ lrecoP = TMath::Sqrt( xiMomX*xiMomX + xiMomY*xiMomY + xiMomZ*xiMomZ );;
+ Double_t lV0momX = xiAOD->MomV0X();
+ Double_t lV0momY = xiAOD->MomV0Y();
+ Double_t lV0momZ = xiAOD->MomV0Z();
+ lV0mom = TMath::Sqrt(TMath::Power(lV0momX,2)+TMath::Power(lV0momY,2)+TMath::Power(lV0momZ,2));
+ Double_t lBachMomX = xiAOD->MomBachX();
+ Double_t lBachMomY = xiAOD->MomBachY();
+ lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
+ Double_t lV0NMomX = xiAOD->MomNegX();
+ Double_t lV0NMomY = xiAOD->MomNegY();
+ Double_t lV0PMomX = xiAOD->MomPosX();
+ Double_t lV0PMomY = xiAOD->MomPosY();
+ lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX + lV0NMomY*lV0NMomY );
+ lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX + lV0PMomY*lV0PMomY );
+
+ }
+
+ lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
+ lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
+
+ // - Cut on pt of the three daughter tracks
+ if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;
+ if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
+ if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
+
+ // - Cut on pseudorapidity of the three daughter tracks
+ if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;
+ if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;
+ if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;
+
+ // - Extra-selection for cascade candidates
+ if (fkExtraSelections) {
+ if (lDcaXiDaughters > 0.3) continue; // in AliCascadeVertexer
+ if (lXiCosineOfPointingAngle < 0.999 ) continue; // in AliCascadeVertexer
+ if (lDcaV0ToPrimVertexXi < 0.05) continue; // in AliCascadeVertexer
+ if (lDcaBachToPrimVertexXi < 0.03) continue; // in AliCascadeVertexer
+ if (lDcaV0DaughtersXi > 1.) continue; // in AliV0vertexer
+ if (lV0CosineOfPointingAngleXi < 0.998) continue; // in AliV0vertexer
+ if (lDcaPosToPrimVertexXi < 0.1) continue; // in AliV0vertexer
+ if (lDcaNegToPrimVertexXi < 0.1) continue; // in AliV0vertexer
+ if(lXiRadius < .9) continue; // in AliCascadeVertexer
+ if(lV0RadiusXi < 0.9) continue; // in AliV0vertexer
+ }
+
+ //-------------------------
+ // - Fill combined PID TH1s
+ if( lChargeXi < 0 && lIsBachelorPion ) fHistMassWithCombPIDXiMinus ->Fill( lInvMassXiMinus );
+ if( lChargeXi > 0 && lIsBachelorPion ) fHistMassWithCombPIDXiPlus ->Fill( lInvMassXiPlus );
+ if( lChargeXi < 0 && lIsBachelorKaon ) fHistMassWithCombPIDOmegaMinus ->Fill( lInvMassOmegaMinus );
+ if( lChargeXi > 0 && lIsBachelorKaon ) fHistMassWithCombPIDOmegaPlus ->Fill( lInvMassOmegaPlus );
+ if( lChargeXi < 0 ) fHistMassXiMinus ->Fill( lInvMassXiMinus );
+ if( lChargeXi > 0 ) fHistMassXiPlus ->Fill( lInvMassXiPlus );
+ if( lChargeXi < 0 ) fHistMassOmegaMinus ->Fill( lInvMassOmegaMinus );
+ if( lChargeXi > 0 ) fHistMassOmegaPlus ->Fill( lInvMassOmegaPlus );
+ if(lIsBachelorPion) f2dHistPIDprobaPionVsMCPtBach->Fill( lmcPtBach, ppionBach );
+ if(lIsBachelorKaon) f2dHistPIDprobaKaonVsMCPtBach->Fill( lmcPtBach, pkaonBach );
+ if( lChargeXi < 0 && lIsBachelorMCPiMinus ) fHistMassWithMcPIDXiMinus ->Fill( lInvMassXiMinus );
+ if( lChargeXi > 0 && lIsBachelorMCPiPlus ) fHistMassWithMcPIDXiPlus ->Fill( lInvMassXiPlus );
+ if( lChargeXi < 0 && lIsBachelorMCKMinus ) fHistMassWithMcPIDOmegaMinus ->Fill( lInvMassOmegaMinus );
+ if( lChargeXi > 0 && lIsBachelorMCKPlus ) fHistMassWithMcPIDOmegaPlus ->Fill( lInvMassOmegaPlus );
+
+
+ // - No association, skip the rest of the code
+ if(!lAssoXiMinus && !lAssoXiPlus && !lAssoOmegaMinus && !lAssoOmegaPlus) continue;
+
+ //--------------
+ // - Proper time
+ // For cascade (reconstructed)
+ Double_t lctau = TMath::Sqrt(TMath::Power((lPosXi[0]-lBestPrimaryVtxPos[0]),2)+TMath::Power((lPosXi[1]-lBestPrimaryVtxPos[1]),2)+TMath::Power((lPosXi[2]-lBestPrimaryVtxPos[2]),2));
+ if (lrecoP!=0) lctau = lctau*cascadeMass/lrecoP;
+ else lctau = -1.;
+ // For Lambda (reconstructed)
+ Float_t lambdaMass = 1.115683; // PDG mass
+ Float_t distV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2)+TMath::Power((lPosV0Xi[2]-lPosXi[2]),2));
+ Float_t lctauV0 = -1.;
+ if (lV0mom!=0) lctauV0 = distV0Xi*lambdaMass/lV0mom;
+ // Distance
+ Float_t distTV0Xi = TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));
+
+ //------------------------------------------------------------
+ // - Fill histos for the cascade candidates associated with MC
+ if( lChargeXi < 0 && lAssoXiMinus){
+ fHistAsMCMassXiMinus ->Fill( lInvMassXiMinus );
+ if(lIsBachelorPion) f2dHistAsMCandCombPIDGenPtVsGenYXiMinus->Fill( lmcPt, lmcRapCasc );
+ f2dHistAsMCGenPtVsGenYXiMinus ->Fill( lmcPt, lmcRapCasc);
+ fHistAsMCGenEtaXiMinus ->Fill( lmcEta );
+ f2dHistAsMCResPtXiMinus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );
+ f2dHistAsMCResRXiMinus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );
+ f2dHistAsMCResPhiXiMinus ->Fill( lmcPt, lDeltaPhiMcReco );
+ f2dHistAsMCptProtonMCptXiMinus->Fill(lmcPt,lmcPtPosV0Dghter);
+ fHistV0CosineOfPointingAnglevsPtXi->Fill(lmcPt,lV0CosineOfPointingAngle);
+ }
+ else if( lChargeXi > 0 && lAssoXiPlus){
+ fHistAsMCMassXiPlus ->Fill( lInvMassXiPlus );
+ if(lIsBachelorPion) f2dHistAsMCandCombPIDGenPtVsGenYXiPlus->Fill( lmcPt, lmcRapCasc );
+ f2dHistAsMCGenPtVsGenYXiPlus ->Fill( lmcPt, lmcRapCasc);
+ fHistAsMCGenEtaXiPlus ->Fill( lmcEta );
+ f2dHistAsMCResPtXiPlus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );
+ f2dHistAsMCResRXiPlus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );
+ f2dHistAsMCResPhiXiPlus ->Fill( lmcPt, lDeltaPhiMcReco );
+ f2dHistAsMCptAntiprotonMCptXiPlus->Fill(lmcPt,lmcPtNegV0Dghter);
+ fHistV0CosineOfPointingAnglevsPtXi->Fill(lmcPt,lV0CosineOfPointingAngle);
+ }
+ else if( lChargeXi < 0 && lAssoOmegaMinus){
+ fHistAsMCMassOmegaMinus ->Fill( lInvMassOmegaMinus );
+ if(lIsBachelorKaon) f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus->Fill( lmcPt, lmcRapCasc );
+ f2dHistAsMCGenPtVsGenYOmegaMinus ->Fill( lmcPt, lmcRapCasc );
+ fHistAsMCGenEtaOmegaMinus ->Fill( lmcEta );
+ f2dHistAsMCResPtOmegaMinus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );
+ f2dHistAsMCResROmegaMinus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );
+ f2dHistAsMCResPhiOmegaMinus ->Fill( lmcPt, lDeltaPhiMcReco );
+ f2dHistAsMCptProtonMCptOmegaMinus->Fill(lmcPt,lmcPtPosV0Dghter);
+ fHistV0CosineOfPointingAnglevsPtOmega->Fill(lmcPt,lV0CosineOfPointingAngle);
+ }
+ else if( lChargeXi > 0 && lAssoOmegaPlus){
+ fHistAsMCMassOmegaPlus ->Fill( lInvMassOmegaPlus );
+ if(lIsBachelorKaon) f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus->Fill( lmcPt, lmcRapCasc );
+ f2dHistAsMCGenPtVsGenYOmegaPlus ->Fill( lmcPt, lmcRapCasc );
+ fHistAsMCGenEtaOmegaPlus ->Fill( lmcEta );
+ f2dHistAsMCResPtOmegaPlus ->Fill( lmcPt, (lrecoPt - lmcPt)/ lmcPt );
+ f2dHistAsMCResROmegaPlus ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius );
+ f2dHistAsMCResPhiOmegaPlus ->Fill( lmcPt, lDeltaPhiMcReco );
+ f2dHistAsMCptAntiprotonMCptOmegaPlus->Fill(lmcPt,lmcPtNegV0Dghter);
+ fHistV0CosineOfPointingAnglevsPtOmega->Fill(lmcPt,lV0CosineOfPointingAngle);
+ }
+ fHistV0toXiCosineOfPointingAngle->Fill(lV0CosineOfPointingAngleXi);
+
+ //------------------
+ // - Fill containers
+
+ // - Filling the AliCFContainer (optimisation of topological selections + systematics)
+ Double_t lContainerCutVars[19] = {0.0};
+ lContainerCutVars[0] = lDcaXiDaughters;
+ lContainerCutVars[1] = lDcaBachToPrimVertexXi;
+ lContainerCutVars[2] = lXiCosineOfPointingAngle;
+ lContainerCutVars[3] = lXiRadius;
+ lContainerCutVars[4] = lInvMassLambdaAsCascDghter;
+ lContainerCutVars[5] = lDcaV0DaughtersXi;
+ lContainerCutVars[6] = lV0CosineOfPointingAngleXi;
+ lContainerCutVars[7] = lV0RadiusXi;
+ lContainerCutVars[8] = lDcaV0ToPrimVertexXi;
+ lContainerCutVars[9] = lDcaPosToPrimVertexXi;
+ lContainerCutVars[10] = lDcaNegToPrimVertexXi;
+ lContainerCutVars[13] = lmcPt;
+ lContainerCutVars[16] = lctau;
+ lContainerCutVars[17] = lctauV0;
+ lContainerCutVars[18] = distTV0Xi;
+ // All cases should be covered below
+ if( lChargeXi < 0 && lAssoXiMinus ) {
+ lContainerCutVars[11] = lInvMassXiMinus;
+ lContainerCutVars[12] = lInvMassOmegaMinus;//1.63;
+ lContainerCutVars[14] = lmcRapCasc;
+ lContainerCutVars[15] = -1.;
+ if ( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC )
+ fCFContAsCascadeCuts->Fill(lContainerCutVars,0); // for Xi-
+ }
+ if( lChargeXi > 0 && lAssoXiPlus ) {
+ lContainerCutVars[11] = lInvMassXiPlus;
+ lContainerCutVars[12] = lInvMassOmegaPlus;//1.26;
+ lContainerCutVars[14] = lmcRapCasc;
+ lContainerCutVars[15] = -1.;
+ if ( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )
+ fCFContAsCascadeCuts->Fill(lContainerCutVars,1); // for Xi+
+ }
+ if( lChargeXi < 0 && lAssoOmegaMinus ) {
+ lContainerCutVars[11] = lInvMassXiMinus;//1.63;
+ lContainerCutVars[12] = lInvMassOmegaMinus;
+ lContainerCutVars[14] = -1.;
+ lContainerCutVars[15] = lmcRapCasc;
+ if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC )
+ fCFContAsCascadeCuts->Fill(lContainerCutVars,2); // for Omega-
+ }
+ if( lChargeXi > 0 && lAssoOmegaPlus ) {
+ lContainerCutVars[11] = lInvMassXiPlus;//1.26;
+ lContainerCutVars[12] = lInvMassOmegaPlus;
+ lContainerCutVars[14] = -1.;
+ lContainerCutVars[15] = lmcRapCasc;
+ if ( lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )
+ fCFContAsCascadeCuts->Fill(lContainerCutVars,3); // for Omega+
+ }
+
+ // - Filling the AliCFContainers related to PID
+ Double_t lContainerPIDVars[3] = {0.0};
+
+ // Xi Minus
+ if( lChargeXi < 0 && lAssoXiMinus ) {
+ lContainerPIDVars[0] = lmcPt;
+ lContainerPIDVars[1] = lInvMassXiMinus;
+ lContainerPIDVars[2] = lmcRapCasc;
+ // No PID
+ fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 0); // No PID
+ // TPC PID
+ if( lIsBachelorPionForTPC ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if( lIsBachelorPionForTPC && lIsPosProtonForTPC ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ // Combined PID
+ if( lIsBachelorPion ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if( lIsBachelorPion && lIsPosInXiProton ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if( lIsBachelorPion && lIsPosInXiProton && lIsNegInXiPion ) fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+ lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
+
+ // Xi Plus
+ if( lChargeXi > 0 && lAssoXiPlus ) {
+ lContainerPIDVars[0] = lmcPt;
+ lContainerPIDVars[1] = lInvMassXiPlus;
+ lContainerPIDVars[2] = lmcRapCasc;
+ // No PID
+ fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 0); // No PID
+ // TPC PID
+ if( lIsBachelorPionForTPC ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if( lIsBachelorPionForTPC && lIsNegProtonForTPC ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ // Combined PID
+ if( lIsBachelorPion ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if( lIsBachelorPion && lIsNegInXiProton ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if( lIsBachelorPion && lIsNegInXiProton && lIsPosInXiPion ) fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+ lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
+
+ // Omega Minus
+ if( lChargeXi < 0 && lAssoOmegaMinus ) {
+ lContainerPIDVars[0] = lmcPt;
+ lContainerPIDVars[1] = lInvMassOmegaMinus;
+ lContainerPIDVars[2] = lmcRapCasc;
+ // No PID
+ fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 0); // No PID
+ // TPC PID
+ if( lIsBachelorKaonForTPC ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if( lIsBachelorKaonForTPC && lIsPosProtonForTPC ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ // Combined PID
+ if( lIsBachelorKaon ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if( lIsBachelorKaon && lIsPosInOmegaProton ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if( lIsBachelorKaon && lIsPosInOmegaProton && lIsNegInOmegaPion ) fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+ lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
+
+ // Omega Plus
+ if( lChargeXi > 0 && lAssoOmegaPlus) {
+ lContainerPIDVars[0] = lmcPt;
+ lContainerPIDVars[1] = lInvMassOmegaPlus;
+ lContainerPIDVars[2] = lmcRapCasc;
+ // No PID
+ fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 0); // No PID
+ // TPC PID
+ if( lIsBachelorKaonForTPC ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
+ if( lIsBachelorKaonForTPC && lIsNegProtonForTPC ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
+ if( lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
+ // Combined PID
+ if( lIsBachelorKaon ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
+ if( lIsBachelorKaon && lIsNegInOmegaProton ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
+ if( lIsBachelorKaon && lIsNegInOmegaProton && lIsPosInOmegaPion ) fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
+ }
+
+ }// End of loop over reconstructed cascades
+
+ fHistnAssoXiMinus->Fill(nAssoXiMinus);
+ fHistnAssoXiPlus->Fill(nAssoXiPlus);
+ fHistnAssoOmegaMinus->Fill(nAssoOmegaMinus);
+ fHistnAssoOmegaPlus->Fill(nAssoOmegaPlus);
+
+ // Post output data.
+ PostData(1, fListHistCascade);
+ PostData(2, fCFContCascadePIDAsXiMinus);
+ PostData(3, fCFContCascadePIDAsXiPlus);
+ PostData(4, fCFContCascadePIDAsOmegaMinus);
+ PostData(5, fCFContCascadePIDAsOmegaPlus);
+ PostData(6, fCFContAsCascadeCuts);
+
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskCheckPerformanceCascadepp276::Terminate(Option_t *) {
+ // Draw result to the screen
+ // Called once at the end of the query
+
+ /* TList *cRetrievedList = 0x0;
+ cRetrievedList = (TList*)GetOutputData(1);
+ if(!cRetrievedList) {
+ Printf("ERROR - AliAnalysisTaskCheckPerformanceCascadepp276 : ouput data container list not available\n");
+ return;
+ }
+
+ fHistTrackMultiplicityBeforeAnySel = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistTrackMultiplicityBeforeAnySel") );
+ if (!fHistTrackMultiplicityBeforeAnySel) {
+ Printf("ERROR - AliAnalysisTaskCheckPerformanceCascadepp276 : fHistTrackMultiplicityBeforeAnySel not available");
+ return;
+ }
+
+
+ TCanvas *canCheckPerformanceCascade = new TCanvas("AliAnalysisTaskCheckPerformanceCascadepp276","Multiplicity",10,10,510,510);
+ canCheckPerformanceCascade->cd(1)->SetLogy();
+
+ fHistTrackMultiplicityBeforeAnySel->SetMarkerStyle(22);
+ fHistTrackMultiplicityBeforeAnySel->DrawCopy("E");
+ */
+}
-\r
-// "ESDs/pass2/AOD086/*/AliAOD.root"\r
-// "/alice/data/2010/LHC10h"\r
-\r
-class AliAnalysisAlien;\r
-\r
-void runGridLambdaOverK0sJets(TString runMode = "full", \r
- TString alirootVer = "v5-05-38-AN",\r
- TString rootVer = "v5-34-11",\r
- TString dataPath = "ESDs/pass2/AOD115/*/AliAOD.root",\r
- TString dataDir = "/alice/data/2011/LHC11h_2", \r
- TString workDir = "test",\r
- TString name = "LambdaOverK0sRatio", \r
- TString data = "PbPb2011",\r
- Float_t minCen = 0.,\r
- Float_t maxCen = 40.,\r
- Float_t dcaDaug = 0.5,\r
- Bool_t sepInjec = kTRUE,\r
- Bool_t isMC = kFALSE,\r
- Bool_t usePID = kFALSE,\r
- Bool_t doQA = kTRUE,\r
- Int_t run = 169838/*137530*//*138624*/){\r
-\r
-\r
- \r
- Printf(" \nThe parameters of the programm are : \n ");\r
- Printf(" \t Analysis mode:\t %s\n \t Centrality:\t %.1lf - %.1lf\n \t Use MC Data?:\t %s\n \t Use PID?:\t %s\n",\r
- "Grid",minCen,maxCen,\r
- (isMC) ? "Yes" : "No",\r
- (usePID) ? "Yes" : "No");\r
- \r
- // _____________________________________________________ //\r
- \r
- InitAndLoadLibs();\r
- \r
- AliAnalysisManager *mgr = new AliAnalysisManager("Manager");\r
- \r
- AliAnalysisGrid *alienHandler = CreateAlienHandler(runMode,alirootVer,rootVer,dataPath,dataDir,workDir,isMC,run); \r
- if (!alienHandler) return;\r
- mgr->SetGridHandler(alienHandler);\r
- \r
- AliAODInputHandler* aodH = new AliAODInputHandler;\r
- mgr->SetInputEventHandler(aodH);\r
- \r
- //PID\r
- gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");\r
- AliAnalysisTask *pidTask = AddTaskPIDResponse(isMC);\r
- //AliAnalysisTask *pidTask = AddTaskPIDResponse(isMC,kTRUE);\r
- if(!pidTask) { printf("no PIDtask\n"); return; }\r
- \r
- //Float_t checkIDTrig= kTRUE;\r
-\r
- // My task\r
- gROOT->LoadMacro("AliAnalysisTaskLambdaOverK0sJets.cxx++g"); \r
- //gSystem->Load("libPWGLFSTRANGENESS");\r
- gROOT->LoadMacro("AddTaskLambdaOverK0sJets.C");\r
- AliAnalysisTaskLambdaOverK0sJets *task = AddTaskLambdaOverK0sJets(name,data,minCen,maxCen,dcaDaug,sepInjec,isMC,usePID,doQA);\r
- // _____________________________________________________ //\r
- \r
- if (!mgr->InitAnalysis()) return;\r
- mgr->PrintStatus();\r
- \r
- mgr->StartAnalysis("grid");\r
-}\r
-\r
-// ______________________________________________________________\r
-\r
-void InitAndLoadLibs() {\r
- \r
- gSystem->Load("libCore.so"); \r
- gSystem->Load("libTree.so"); \r
- gSystem->Load("libGeom.so");\r
- gSystem->Load("libVMC.so");\r
- gSystem->Load("libPhysics");\r
- gSystem->Load("libMinuit.so"); \r
- gSystem->Load("libProof.so");\r
- gSystem->Load("libGui.so");\r
- gSystem->Load("libXMLParser.so");\r
- gSystem->Load("libProofPlayer.so");\r
- gSystem->Load("libXMLIO.so");\r
-\r
- gSystem->Load("libSTEERBase.so");\r
- gSystem->Load("libESD.so");\r
- gSystem->Load("libAOD.so");\r
- gSystem->Load("libCDB.so");\r
- gSystem->Load("libANALYSIS.so");\r
- gSystem->Load("libANALYSISalice.so");\r
- gSystem->Load("libCORRFW.so");\r
- gSystem->Load("libJETAN.so");\r
- gSystem->Load("libRAWDatabase.so");\r
- gSystem->Load("libSTEER.so");\r
- gSystem->Load("libCORRFW.so");\r
-\r
- \r
- gSystem->AddIncludePath("-I$ALICE_ROOT/include");\r
-}\r
-\r
-// ___________________________________________________________________ //\r
-\r
-// **** It is change 'AliAnalysisGrid' by 'AliAnalysisAlien'\r
-AliAnalysisAlien* CreateAlienHandler(TString runMode,TString alirootVer,\r
- TString rootVer,TString dataPath,\r
- TString dataDir,TString workDir,\r
- Bool_t isMC,Int_t kRun) {\r
- \r
- AliAnalysisAlien *plugin = new AliAnalysisAlien();\r
- plugin->SetCheckCopy(kFALSE);\r
-\r
- plugin->SetRunMode(runMode);\r
- // Set versions of used packages\r
- plugin->SetAPIVersion("V1.1x");\r
- plugin->SetROOTVersion(rootVer);\r
- plugin->SetAliROOTVersion(alirootVer);\r
- \r
- /////////////////////////////////////////////////////////////////\r
-\r
- // Declare input data to be processed.\r
- // Method 1: Create automatically XML collections using alien 'find' command.\r
- plugin->SetGridDataDir(dataDir);\r
- \r
- if (!isMC) \r
- plugin->SetRunPrefix("000");\r
- plugin->SetDataPattern(dataPath);\r
- \r
- plugin->AddRunNumber(kRun);\r
-\r
- // Method 2: Declare existing data files (raw collections, xml collections, root file)\r
- const char working_dir[250];\r
-\r
- sprintf(working_dir, "%s/%d",workDir.Data(),kRun);\r
- TString path = TString(working_dir);\r
- plugin->SetGridWorkingDir(path);\r
-\r
- //plugin->SetGridWorkingDir(workDir);\r
- // Declare alien output directory. Relative to working directory.\r
- plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output\r
- // Declare the analysis source files names separated by blancs. To be compiled runtime\r
- plugin->SetAnalysisSource("AliAnalysisTaskLambdaOverK0sJets.cxx");\r
- //plugin->SetAdditionalLibs("AliAnalysisTaskMultiplicity.h AliAnalysisTaskMultiplicity.cxx");\r
- plugin->SetAdditionalLibs("AliAnalysisTaskLambdaOverK0sJets.cxx AliAnalysisTaskLambdaOverK0sJets.h");\r
- // Optionally set a name for the generated analysis macro (default MyAnalysis.C)\r
- plugin->SetAnalysisMacro("AnalysisProduction.C");\r
- //plugin->SetAnalysisMacro("mytask.C");\r
- // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)\r
- plugin->SetSplitMaxInputFileNumber(50);\r
- // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.\r
- plugin->SetMaxInitFailed(12);\r
- // Optionally resubmit threshold.\r
- plugin->SetMasterResubmitThreshold(90);\r
- // Optionally set time to live (default 30000 sec)\r
- plugin->SetTTL(30000);\r
- // Optionally set input format (default xml-single)\r
- plugin->SetInputFormat("xml-single");\r
- // Optionally modify the name of the generated JDL (default analysis.jdl)\r
- plugin->SetJDLName("TaskProduction.jdl");\r
- //plugin->SetJDLName("mytask.jdl");\r
- plugin->SetMergeViaJDL(kTRUE);\r
- // Optionally modify job price (default 1)\r
- plugin->SetPrice(1); \r
- // Optionally modify split mode (default 'se') \r
- plugin->SetSplitMode("se");\r
- return plugin;\r
-\r
-}\r
+
+// "ESDs/pass2/AOD086/*/AliAOD.root"
+// "/alice/data/2010/LHC10h"
+
+class AliAnalysisAlien;
+
+void runGridLambdaOverK0sJets(TString runMode = "full",
+ TString alirootVer = "v5-05-38-AN",
+ TString rootVer = "v5-34-11",
+ TString dataPath = "ESDs/pass2/AOD115/*/AliAOD.root",
+ TString dataDir = "/alice/data/2011/LHC11h_2",
+ TString workDir = "test",
+ TString name = "LambdaOverK0sRatio",
+ TString data = "PbPb2011",
+ Float_t minCen = 0.,
+ Float_t maxCen = 40.,
+ Float_t dcaDaug = 0.5,
+ Bool_t sepInjec = kTRUE,
+ Bool_t isMC = kFALSE,
+ Bool_t usePID = kFALSE,
+ Bool_t doQA = kTRUE,
+ Int_t run = 169838/*137530*//*138624*/){
+
+
+
+ Printf(" \nThe parameters of the programm are : \n ");
+ Printf(" \t Analysis mode:\t %s\n \t Centrality:\t %.1lf - %.1lf\n \t Use MC Data?:\t %s\n \t Use PID?:\t %s\n",
+ "Grid",minCen,maxCen,
+ (isMC) ? "Yes" : "No",
+ (usePID) ? "Yes" : "No");
+
+ // _____________________________________________________ //
+
+ InitAndLoadLibs();
+
+ AliAnalysisManager *mgr = new AliAnalysisManager("Manager");
+
+ AliAnalysisGrid *alienHandler = CreateAlienHandler(runMode,alirootVer,rootVer,dataPath,dataDir,workDir,isMC,run);
+ if (!alienHandler) return;
+ mgr->SetGridHandler(alienHandler);
+
+ AliAODInputHandler* aodH = new AliAODInputHandler;
+ mgr->SetInputEventHandler(aodH);
+
+ //PID
+ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+ AliAnalysisTask *pidTask = AddTaskPIDResponse(isMC);
+ //AliAnalysisTask *pidTask = AddTaskPIDResponse(isMC,kTRUE);
+ if(!pidTask) { printf("no PIDtask\n"); return; }
+
+ //Float_t checkIDTrig= kTRUE;
+
+ // My task
+ gROOT->LoadMacro("AliAnalysisTaskLambdaOverK0sJets.cxx++g");
+ //gSystem->Load("libPWGLFSTRANGENESS");
+ gROOT->LoadMacro("AddTaskLambdaOverK0sJets.C");
+ AliAnalysisTaskLambdaOverK0sJets *task = AddTaskLambdaOverK0sJets(name,data,minCen,maxCen,dcaDaug,sepInjec,isMC,usePID,doQA);
+ // _____________________________________________________ //
+
+ if (!mgr->InitAnalysis()) return;
+ mgr->PrintStatus();
+
+ mgr->StartAnalysis("grid");
+}
+
+// ______________________________________________________________
+
+void InitAndLoadLibs() {
+
+ gSystem->Load("libCore.so");
+ gSystem->Load("libTree.so");
+ gSystem->Load("libGeom.so");
+ gSystem->Load("libVMC.so");
+ gSystem->Load("libPhysics");
+ gSystem->Load("libMinuit.so");
+ gSystem->Load("libProof.so");
+ gSystem->Load("libGui.so");
+ gSystem->Load("libXMLParser.so");
+ gSystem->Load("libProofPlayer.so");
+ gSystem->Load("libXMLIO.so");
+
+ gSystem->Load("libSTEERBase.so");
+ gSystem->Load("libESD.so");
+ gSystem->Load("libAOD.so");
+ gSystem->Load("libCDB.so");
+ gSystem->Load("libANALYSIS.so");
+ gSystem->Load("libANALYSISalice.so");
+ gSystem->Load("libCORRFW.so");
+ gSystem->Load("libJETAN.so");
+ gSystem->Load("libRAWDatabase.so");
+ gSystem->Load("libSTEER.so");
+ gSystem->Load("libCORRFW.so");
+
+
+ gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+}
+
+// ___________________________________________________________________ //
+
+// **** It is change 'AliAnalysisGrid' by 'AliAnalysisAlien'
+AliAnalysisAlien* CreateAlienHandler(TString runMode,TString alirootVer,
+ TString rootVer,TString dataPath,
+ TString dataDir,TString workDir,
+ Bool_t isMC,Int_t kRun) {
+
+ AliAnalysisAlien *plugin = new AliAnalysisAlien();
+ plugin->SetCheckCopy(kFALSE);
+
+ plugin->SetRunMode(runMode);
+ // Set versions of used packages
+ plugin->SetAPIVersion("V1.1x");
+ plugin->SetROOTVersion(rootVer);
+ plugin->SetAliROOTVersion(alirootVer);
+
+ /////////////////////////////////////////////////////////////////
+
+ // Declare input data to be processed.
+ // Method 1: Create automatically XML collections using alien 'find' command.
+ plugin->SetGridDataDir(dataDir);
+
+ if (!isMC)
+ plugin->SetRunPrefix("000");
+ plugin->SetDataPattern(dataPath);
+
+ plugin->AddRunNumber(kRun);
+
+ // Method 2: Declare existing data files (raw collections, xml collections, root file)
+ const char working_dir[250];
+
+ sprintf(working_dir, "%s/%d",workDir.Data(),kRun);
+ TString path = TString(working_dir);
+ plugin->SetGridWorkingDir(path);
+
+ //plugin->SetGridWorkingDir(workDir);
+ // Declare alien output directory. Relative to working directory.
+ plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
+ // Declare the analysis source files names separated by blancs. To be compiled runtime
+ plugin->SetAnalysisSource("AliAnalysisTaskLambdaOverK0sJets.cxx");
+ //plugin->SetAdditionalLibs("AliAnalysisTaskMultiplicity.h AliAnalysisTaskMultiplicity.cxx");
+ plugin->SetAdditionalLibs("AliAnalysisTaskLambdaOverK0sJets.cxx AliAnalysisTaskLambdaOverK0sJets.h");
+ // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
+ plugin->SetAnalysisMacro("AnalysisProduction.C");
+ //plugin->SetAnalysisMacro("mytask.C");
+ // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
+ plugin->SetSplitMaxInputFileNumber(50);
+ // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
+ plugin->SetMaxInitFailed(12);
+ // Optionally resubmit threshold.
+ plugin->SetMasterResubmitThreshold(90);
+ // Optionally set time to live (default 30000 sec)
+ plugin->SetTTL(30000);
+ // Optionally set input format (default xml-single)
+ plugin->SetInputFormat("xml-single");
+ // Optionally modify the name of the generated JDL (default analysis.jdl)
+ plugin->SetJDLName("TaskProduction.jdl");
+ //plugin->SetJDLName("mytask.jdl");
+ plugin->SetMergeViaJDL(kTRUE);
+ // Optionally modify job price (default 1)
+ plugin->SetPrice(1);
+ // Optionally modify split mode (default 'se')
+ plugin->SetSplitMode("se");
+ return plugin;
+
+}
-/**************************************************************************\r
- * Author : Benjamin Dönigus (benjamin.doenigus@cern.ch) *\r
- * *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskHdibaryonLPpi class\r
-// used to search for the H-Dibaryon in weak \r
-// (Lambda Proton Pion) and strong (Lambda Lambda) decays\r
-//-----------------------------------------------------------------\r
-\r
-#include "Riostream.h"\r
-#include "TROOT.h"\r
-#include "TChain.h"\r
-#include "TStyle.h"\r
-#include "TSystem.h"\r
-#include "TTree.h"\r
-#include "TH1F.h"\r
-#include "TH1.h"\r
-#include "TH2D.h"\r
-#include "TH3F.h"\r
-#include "TCanvas.h"\r
-#include "TParticle.h"\r
-#include "TNtuple.h"\r
-#include "TObjString.h"\r
-#include "TLorentzVector.h"\r
-#include "TDatabasePDG.h"\r
-\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliMCEvent.h"\r
-\r
-#include "AliESD.h"\r
-#include "AliESDpid.h"\r
-#include "AliESDEvent.h"\r
-#include "AliGenEventHeader.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliLog.h"\r
-#include "AliStack.h"\r
-#include "AliHeader.h"\r
-\r
-#include "AliKFParticle.h"\r
-#include "AliKFVertex.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliESDv0Cuts.h"\r
-#include "AliAnalysisTaskHdibaryonLPpi.h"\r
-\r
-#include "TFile.h"\r
-#include "TH2F.h"\r
-#include "TF1.h"\r
-#include "TCanvas.h"\r
-#include "TList.h"\r
-#include "TParallelCoord.h"\r
-\r
-#include "AliMCParticle.h"\r
-#include "AliGenPythiaEventHeader.h"\r
-\r
-#include "AliPID.h"\r
-#include "AliESDtrack.h"\r
-#include "AliCentrality.h"\r
-\r
-#include "THnSparse.h"\r
-\r
-#include "AliVertexerTracks.h"\r
-\r
-using namespace std;\r
-ClassImp(AliAnalysisTaskHdibaryonLPpi)\r
-//________________________________________________________________________\r
-AliAnalysisTaskHdibaryonLPpi::AliAnalysisTaskHdibaryonLPpi() : AliAnalysisTaskSE()/*AliAnalysisTask(name, ""), fMCEvent(0)*/, fESD(0), fESDtrackCutsV0(0),\r
- fESDCutsV0(0),\r
- fEsdTrackCuts(0),\r
- fBin(0),\r
- fEvent(0x0),\r
- fHistList(0), \r
- fHistMassDPi(0), \r
- fHistMassLPi(0),\r
- fHistMassLambdaPi(0),\r
- fHistMassLambda(0),\r
- fHistMassLambdaPPi(0),\r
- fHistMassLambdaP(0),\r
- fHistMassLambdaK(0),\r
- fHistMassK0onl(0),\r
- fHistMassK0offl(0),\r
- fHistMassK0onlC(0),\r
- fHistMassK0offlC(0),\r
- fHistMassPQonl(0), \r
- fHistMassPQoffl(0),\r
- fHistDC(0),\r
- fHistArmenterosPodolanski(0),\r
- fHistArmenterosPodolanskiCut(0), \r
- fHistHDibaryonInvaMassGen(0),\r
- fHistHDibaryonInvaMassGenRes(0),\r
- fHistAntiHDibaryonInvaMassGen(0),\r
- fHistHDibaryonInvaMassAso(0),\r
- fHistHDibaryonInvaMassAsoReso(0),\r
- fHistAntiHDibaryonInvaMassAso(0),\r
- fHistCheck(0),\r
- fHistHPointingAngle(0),\r
- fHistMassH(0),\r
- fHistMassLambdaFromH(0),\r
- fHistMassLambdaFromHtLorentz(0),\r
- fHistMassPpi(0),\r
- fHistMassPpiReso(0),\r
- fHistMassLpi(0),\r
- fHistMassLP(0),\r
- fHistProtonPIDBb(0),\r
- fHistPionPIDBb(0),\r
- fHistProtonPIDLambda(0),\r
- fHistPionPIDLambda(0),\r
- fHistMCdcaPvtxDvtx(0),\r
- fHistMCdcaPvtxLvtx(0),\r
- fHistMCdcaDvtxLvtx(0),\r
- fHistMCangleLH(0),\r
- fHistMCdecayAngle(0),\r
- fHistMCpointingAngle(0),\r
- fHistMCap(0),\r
- fHistMCdcaPvtxDvtxReso(0),\r
- fHistMCdcaPvtxLvtxReso(0),\r
- fHistMCdcaDvtxLvtxReso(0),\r
- fHistMCangleLHReso(0),\r
- fHistMCdecayAngleReso(0),\r
- fHistMCpointingAngleReso(0),\r
- fHistMCapReso(0),\r
- fHistCentrality(0),\r
- fHistCentralityAC(0), \r
- fHistMultiplicity(0),\r
- fHistHilf1(0),\r
- fHistHilf2(0), \r
- fHistHilf3(0),\r
- fHistHilf4(0),\r
- fHistHilf5(0), \r
- fHistHilf6(0),\r
- fHistPtvsEtaGen(0),\r
- fHistPtvsEtaAso(0),\r
- fHistPtvsYGen(0),\r
- fHistPtvsYAso(0), \r
- fHistRap(0),\r
- fHistCount(0),\r
- fPIDtpcESD(0),\r
- fHistTriggerStat(0),\r
- fHistTriggerStatAfterEventSelection(0), \r
- fHistMassHcentMult(0),\r
- fHistNdim(0)\r
-{\r
- // DefaultConstructor\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskHdibaryonLPpi::AliAnalysisTaskHdibaryonLPpi(const char *name) : AliAnalysisTaskSE(name)/*AliAnalysisTask(name, ""), fMCEvent(0)*/, fESD(0), fESDtrackCutsV0(0),\r
- fESDCutsV0(0),\r
- fEsdTrackCuts(0),\r
- fBin(0),\r
- fEvent(0x0),\r
- fHistList(0), \r
- fHistMassDPi(0), \r
- fHistMassLPi(0),\r
- fHistMassLambdaPi(0),\r
- fHistMassLambda(0),\r
- fHistMassLambdaPPi(0),\r
- fHistMassLambdaP(0),\r
- fHistMassLambdaK(0),\r
- fHistMassK0onl(0),\r
- fHistMassK0offl(0),\r
- fHistMassK0onlC(0),\r
- fHistMassK0offlC(0),\r
- fHistMassPQonl(0), \r
- fHistMassPQoffl(0),\r
- fHistDC(0),\r
- fHistArmenterosPodolanski(0),\r
- fHistArmenterosPodolanskiCut(0), \r
- fHistHDibaryonInvaMassGen(0),\r
- fHistHDibaryonInvaMassGenRes(0),\r
- fHistAntiHDibaryonInvaMassGen(0),\r
- fHistHDibaryonInvaMassAso(0),\r
- fHistHDibaryonInvaMassAsoReso(0),\r
- fHistAntiHDibaryonInvaMassAso(0),\r
- fHistCheck(0),\r
- fHistHPointingAngle(0),\r
- fHistMassH(0),\r
- fHistMassLambdaFromH(0),\r
- fHistMassLambdaFromHtLorentz(0),\r
- fHistMassPpi(0),\r
- fHistMassPpiReso(0),\r
- fHistMassLpi(0),\r
- fHistMassLP(0),\r
- fHistProtonPIDBb(0),\r
- fHistPionPIDBb(0),\r
- fHistProtonPIDLambda(0),\r
- fHistPionPIDLambda(0),\r
- fHistMCdcaPvtxDvtx(0),\r
- fHistMCdcaPvtxLvtx(0),\r
- fHistMCdcaDvtxLvtx(0),\r
- fHistMCangleLH(0),\r
- fHistMCdecayAngle(0),\r
- fHistMCpointingAngle(0),\r
- fHistMCap(0),\r
- fHistMCdcaPvtxDvtxReso(0),\r
- fHistMCdcaPvtxLvtxReso(0),\r
- fHistMCdcaDvtxLvtxReso(0),\r
- fHistMCangleLHReso(0),\r
- fHistMCdecayAngleReso(0),\r
- fHistMCpointingAngleReso(0),\r
- fHistMCapReso(0),\r
- fHistCentrality(0),\r
- fHistCentralityAC(0), \r
- fHistMultiplicity(0), \r
- fHistHilf1(0),\r
- fHistHilf2(0), \r
- fHistHilf3(0),\r
- fHistHilf4(0),\r
- fHistHilf5(0), \r
- fHistHilf6(0),\r
- fHistPtvsEtaGen(0),\r
- fHistPtvsEtaAso(0),\r
- fHistPtvsYGen(0),\r
- fHistPtvsYAso(0), \r
- fHistRap(0),\r
- fHistCount(0),\r
- fPIDtpcESD(0),\r
- fHistTriggerStat(0),\r
- fHistTriggerStatAfterEventSelection(0),\r
- fHistMassHcentMult(0),\r
- fHistNdim(0)\r
-\r
-{\r
- // Constructor\r
-\r
- // Define input and output slots here\r
- // Input from a TChain\r
- DefineInput(0, TChain::Class());\r
- // Output to TList container\r
- DefineOutput(1, TList::Class()); //full\r
-\r
- //MC info contol\r
- if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())SetHasMC();\r
-\r
- //V0 cuts\r
-\r
- fESDtrackCutsV0 = new AliESDtrackCuts("AliESDtrackCutsV0","AliESDtrackCutsV0");\r
- fESDtrackCutsV0->SetAcceptKinkDaughters(kFALSE);\r
- fESDtrackCutsV0->SetMinNClustersTPC(80);\r
- fESDtrackCutsV0->SetMaxChi2PerClusterTPC(5);\r
- fESDtrackCutsV0->SetRequireTPCRefit(kTRUE);\r
- fESDtrackCutsV0->SetEtaRange(-0.9,0.9);\r
- fESDtrackCutsV0->SetPtRange(0.2,1.5);\r
- fESDtrackCutsV0->SetMinDCAToVertexXY(3);\r
- fESDtrackCutsV0->SetMinDCAToVertexZ(3);\r
-\r
- fESDCutsV0 = new AliESDv0Cuts("AliESDCutsV0","AliESDCutsV0");\r
- fESDCutsV0->SetMaxDcaV0Daughters(1.0);\r
- fESDCutsV0->SetMinDcaNegToVertex(2.0);\r
- fESDCutsV0->SetMinDcaPosToVertex(2.0);\r
-\r
- //ESD Track cuts\r
- fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts"); \r
- fEsdTrackCuts->SetMinNClustersTPC(80);\r
- fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);\r
- fEsdTrackCuts->SetMaxChi2PerClusterTPC(5);\r
- fEsdTrackCuts->SetRequireTPCRefit(kTRUE);\r
- fEsdTrackCuts->SetEtaRange(-0.9,0.9);\r
-}\r
-\r
-//____________________________________________________________\r
-AliAnalysisTaskHdibaryonLPpi::~AliAnalysisTaskHdibaryonLPpi(){\r
- //\r
- // Destructor\r
- //\r
- if(fHistList){ \r
- fHistList->Clear();\r
- delete fHistList;\r
- }\r
- if(fEsdTrackCuts) delete fEsdTrackCuts;\r
- if(fESDtrackCutsV0) delete fESDtrackCutsV0;\r
- if(fESDCutsV0) delete fESDCutsV0;\r
-\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskHdibaryonLPpi::UserCreateOutputObjects()\r
-{\r
- // Create histograms\r
- // Called once\r
-\r
- fHistList = new TList();\r
- \r
- fHistMassDPi = new TH1F("fHistMassDPi", "Invariant mass distribution p+#pi^{-} ", 500, 1.0, 1.25);\r
- fHistMassDPi->GetXaxis()->SetTitle("Invariant mass p+#pi^{-} (GeV/c^{2})");\r
- fHistMassDPi->GetYaxis()->SetTitle("Entries");\r
- fHistMassDPi->SetMarkerStyle(kFullCircle); \r
-\r
- fHistMassLPi = new TH1F("fHistMassLPi", "Offline Invariant mass distribution p+#pi^{-} ", 500, 1.0, 1.25);\r
- fHistMassLPi->GetXaxis()->SetTitle("Invariant mass p+#pi^{-} (GeV/c^{2})");\r
- fHistMassLPi->GetYaxis()->SetTitle("Entries");\r
- fHistMassLPi->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassLambdaPi = new TH1F("fHistMassLambdaPi", "Invariant mass distribution #Lambda+#pi^{-} ", 500, 1.2, 1.5);\r
- fHistMassLambdaPi->GetXaxis()->SetTitle("Invariant mass #Lambda+#pi^{-} (GeV/c^{2})");\r
- fHistMassLambdaPi->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambdaPi->SetMarkerStyle(kFullCircle);\r
- \r
- fHistMassLambda = new TH1F("fHistMassLambda", "Invariant mass distribution of #Lambda for further analyis", 500, 1.0, 1.2);\r
- fHistMassLambda->GetXaxis()->SetTitle("Invariant mass p+#pi^{+} (GeV/c^{2})");\r
- fHistMassLambda->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambda->SetMarkerStyle(kFullCircle);\r
- \r
- fHistMassLambdaPPi = new TH1F("fHistMassLambdaPPi", "Invariant mass distribution #Lambdap#pi^{-} ", 300, 2.2, 2.5);\r
- fHistMassLambdaPPi->GetXaxis()->SetTitle("Invariant mass #Lambdap#pi^{-} (GeV/c^{2})");\r
- fHistMassLambdaPPi->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambdaPPi->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassLambdaP = new TH1F("fHistMassLambdaP", "Invariant mass distribution #Lambdap ", 300, 2.2, 2.5);\r
- fHistMassLambdaP->GetXaxis()->SetTitle("Invariant mass #Lambdap (GeV/c^{2})");\r
- fHistMassLambdaP->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambdaP->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassLambdaK = new TH1F("fHistMassLambdaK", "Invariant mass distribution #LambdaK^{-} ", 300, 1.6, 1.9);\r
- fHistMassLambdaK->GetXaxis()->SetTitle("Invariant mass #LambdaK^{-} (GeV/c^{2})");\r
- fHistMassLambdaK->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambdaK->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassK0onl = new TH1F("fHistMassK0onl", "Invariant mass distribution K_{s}^{0} online V0 finder ", 400, 0.2, 1.0);\r
- fHistMassK0onl->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");\r
- fHistMassK0onl->GetYaxis()->SetTitle("Entries");\r
- fHistMassK0onl->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassK0offl = new TH1F("fHistMassK0offl", "Invariant mass distribution K_{s}^{0} offline V0 finder ", 400, 0.2, 1.0);\r
- fHistMassK0offl->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");\r
- fHistMassK0offl->GetYaxis()->SetTitle("Entries");\r
- fHistMassK0offl->SetMarkerStyle(kFullCircle);\r
- \r
- fHistMassK0onlC = new TH1F("fHistMassK0onlC", "Invariant mass distribution K_{s}^{0} online V0 finder ", 400, 0.2, 1.0);\r
- fHistMassK0onlC->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");\r
- fHistMassK0onlC->GetYaxis()->SetTitle("Entries");\r
- fHistMassK0onlC->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassK0offlC = new TH1F("fHistMassK0offlC", "Invariant mass distribution K_{s}^{0} offline V0 finder ", 400, 0.2, 1.0);\r
- fHistMassK0offlC->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");\r
- fHistMassK0offlC->GetYaxis()->SetTitle("Entries");\r
- fHistMassK0offlC->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassPQonl = new TH1F("fHistMassPQonl", "Invariant mass distribution K_{s}^{0}p using online V0 finder ", 500, 1.3, 2.3);\r
- fHistMassPQonl->GetXaxis()->SetTitle("Invariant mass K_{s}^{0}p (GeV/c^{2})");\r
- fHistMassPQonl->GetYaxis()->SetTitle("Entries");\r
- fHistMassPQonl->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassPQoffl = new TH1F("fHistMassPQoffl", "Invariant mass distribution K_{s}^{0}p using offline V0 finder ", 500, 1.3, 2.3);\r
- fHistMassPQoffl->GetXaxis()->SetTitle("Invariant mass K_{s}^{0}p (GeV/c^{2})");\r
- fHistMassPQoffl->GetYaxis()->SetTitle("Entries");\r
- fHistMassPQoffl->SetMarkerStyle(kFullCircle);\r
-\r
- fHistDC = new TH1F("fHistDC", "Proper decay length", 500, 0.0, 25);\r
- fHistDC->GetXaxis()->SetTitle("c#tau (cm)");\r
- fHistDC->GetYaxis()->SetTitle("Entries");\r
- fHistDC->SetMarkerStyle(kFullCircle);\r
- \r
- fHistArmenterosPodolanski = new TH2F("fHistArmenterosPodolanski", "Armenteros-Podolanski plot", 200,-1.0,1.0, 500,0,1);\r
- fHistArmenterosPodolanski->GetXaxis()->SetTitle("#alpha");\r
- fHistArmenterosPodolanski->GetYaxis()->SetTitle("q_{t}");\r
- fHistArmenterosPodolanski->SetMarkerStyle(kFullCircle);\r
-\r
- fHistArmenterosPodolanskiCut = new TH2F("fHistArmenterosPodolanskiCut", "Armenteros-Podolanski plot after cut", 200,-1.0,1.0, 500,0,1);\r
- fHistArmenterosPodolanskiCut->GetXaxis()->SetTitle("#alpha");\r
- fHistArmenterosPodolanskiCut->GetYaxis()->SetTitle("q_{t}");\r
- fHistArmenterosPodolanskiCut->SetMarkerStyle(kFullCircle);\r
-\r
- fHistHDibaryonInvaMassGen = new TH1F("fHistHDibaryonInvaMassGen", "Generated #Lambda p #pi^{-}", 200, 2.1, 2.3);\r
- fHistHDibaryonInvaMassGen->GetYaxis()->SetTitle("Counts");\r
- fHistHDibaryonInvaMassGen->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");\r
-\r
- fHistHDibaryonInvaMassGenRes = new TH1F("fHistHDibaryonInvaMassGenRes", "Generated #Lambda p #pi^{-} with particles in rapidity!!!", 200, 2.1, 2.3);\r
- fHistHDibaryonInvaMassGenRes->GetYaxis()->SetTitle("Counts");\r
- fHistHDibaryonInvaMassGenRes->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");\r
-\r
- fHistAntiHDibaryonInvaMassGen = new TH1F("fHistAntiHDibaryonInvaMassGen", "Generated #bar{#Lambda} #bar{p} #pi^{+}", 200, 2.1, 2.3);\r
- fHistAntiHDibaryonInvaMassGen->GetYaxis()->SetTitle("Counts");\r
- fHistAntiHDibaryonInvaMassGen->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");\r
-\r
- fHistHDibaryonInvaMassAso = new TH1F("fHistHDibaryonInvaMassAso", "Associated #Lambda p #pi^{-}", 200, 2.1, 2.3);\r
- fHistHDibaryonInvaMassAso->GetYaxis()->SetTitle("Counts");\r
- fHistHDibaryonInvaMassAso->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");\r
-\r
- fHistHDibaryonInvaMassAsoReso = new TH1F("fHistHDibaryonInvaMassAsoReso", "Associated #Lambda p #pi^{-}", 200, 2.1, 2.3);\r
- fHistHDibaryonInvaMassAsoReso->GetYaxis()->SetTitle("Counts");\r
- fHistHDibaryonInvaMassAsoReso->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");\r
-\r
- fHistAntiHDibaryonInvaMassAso = new TH1F("fHistAntiHDibaryonInvaMassAso", "Associated #bar{#Lambda} #bar{p} #pi^{+}", 200, 2.1, 2.3);\r
- fHistAntiHDibaryonInvaMassAso->GetYaxis()->SetTitle("Counts");\r
- fHistAntiHDibaryonInvaMassAso->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");\r
-\r
- fHistCheck = new TH2F("fHistCheck", "Check online/offline", 200, -0.5, 1.5, 200, -0.5, 1.5);\r
- fHistCheck->GetXaxis()->SetTitle("offline");\r
- fHistCheck->GetYaxis()->SetTitle("online");\r
- fHistCheck->SetMarkerStyle(kFullCircle);\r
-\r
- fHistHPointingAngle= new TH1F("fHistHPointingAngle", "Pointing angle distribution for #Lambdap#pi^{-}", 200, 0., 2*TMath::Pi());\r
- fHistHPointingAngle->GetXaxis()->SetTitle("Pointing angle distribution for #Lambdap#pi^{-}");\r
- fHistHPointingAngle->GetYaxis()->SetTitle("Entries");\r
- fHistHPointingAngle->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassH= new TH1F("fHistMassH", "Invariant mass distribution #Lambdap#pi^{-} (GeV/c^{2}) after pointing angle cut", 3000, 2.2, 2.5);\r
- fHistMassH->GetXaxis()->SetTitle("Invariant mass #Lambdap#pi^{-} (GeV/c^{2})");\r
- fHistMassH->GetYaxis()->SetTitle("Entries");\r
- fHistMassH->SetMarkerStyle(kFullCircle);\r
- \r
- fHistMassLambdaFromH= new TH1F("fHistMassLambdaFromH", "Invariant mass distribution #Lambda (GeV/c^{2}) asking for Mother to be H", 300, 1.0, 1.3);\r
- fHistMassLambdaFromH->GetXaxis()->SetTitle("Invariant mass #Lambda (GeV/c^{2})");\r
- fHistMassLambdaFromH->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambdaFromH->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassLambdaFromHtLorentz= new TH1F("fHistMassLambdaFromHtLorentz", "Invariant mass distribution #Lambda (GeV/c^{2}) asking for Mother to be H", 300, 1.0, 1.3);\r
- fHistMassLambdaFromHtLorentz->GetXaxis()->SetTitle("Invariant mass #Lambda (GeV/c^{2})");\r
- fHistMassLambdaFromHtLorentz->GetYaxis()->SetTitle("Entries");\r
- fHistMassLambdaFromHtLorentz->SetMarkerStyle(kFullCircle);\r
- \r
- fHistMassPpi= new TH1F("fHistMassPpi", "Invariant mass distribution of the p#pi^{-} used for combing with Lambda", 300, 1.0, 1.6);\r
- fHistMassPpi->GetXaxis()->SetTitle("Invariant mass p#pi^{-} (GeV/c^{2})");\r
- fHistMassPpi->GetYaxis()->SetTitle("Entries");\r
- fHistMassPpi->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassPpiReso= new TH1F("fHistMassPpiReso", "Invariant mass distribution of the p#pi^{-} used for combing with Lambda", 300, 1.0, 1.6);\r
- fHistMassPpiReso->GetXaxis()->SetTitle("Invariant mass p#pi^{-} (GeV/c^{2})");\r
- fHistMassPpiReso->GetYaxis()->SetTitle("Entries");\r
- fHistMassPpiReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassLpi= new TH1F("fHistMassLpi", "Invariant mass distribution of the #Lambda#pi^{-} used for combing with p", 300, 1.1, 1.7);\r
- fHistMassLpi->GetXaxis()->SetTitle("Invariant mass #Lambda#pi^{-} (GeV/c^{2})");\r
- fHistMassLpi->GetYaxis()->SetTitle("Entries");\r
- fHistMassLpi->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMassLP= new TH1F("fHistMassLP", "Invariant mass distribution of the #Lambda p used for combing with #pi^{-}", 300, 2.0, 2.3);\r
- fHistMassLP->GetXaxis()->SetTitle("Invariant mass #Lambda p (GeV/c^{2})");\r
- fHistMassLP->GetYaxis()->SetTitle("Entries");\r
- fHistMassLP->SetMarkerStyle(kFullCircle);\r
-\r
- fHistProtonPIDBb = new TH2F("fHistProtonPIDBb", "dE/dx after p PID", 100, 0., 10, 100, 0, 100);\r
- fHistProtonPIDBb->GetYaxis()->SetTitle("TPC Signal");\r
- fHistProtonPIDBb->GetXaxis()->SetTitle("P (GeV/c)");\r
- fHistProtonPIDBb->SetOption("scat");\r
- fHistProtonPIDBb->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPionPIDBb = new TH2F("fHistPionPIDBb", "dE/dx after K PID", 100, 0., 10, 100, 0, 100);\r
- fHistPionPIDBb->GetYaxis()->SetTitle("TPC Signal");\r
- fHistPionPIDBb->GetXaxis()->SetTitle("P (GeV/c)");\r
- fHistPionPIDBb->SetOption("scat");\r
- fHistPionPIDBb->SetMarkerStyle(kFullCircle);\r
-\r
- fHistProtonPIDLambda = new TH2F("fHistProtonPIDLambda", "dE/dx after p PID from V0", 100, 0., 10, 100, 0, 100);\r
- fHistProtonPIDLambda->GetYaxis()->SetTitle("TPC Signal");\r
- fHistProtonPIDLambda->GetXaxis()->SetTitle("P (GeV/c)");\r
- fHistProtonPIDLambda->SetOption("scat");\r
- fHistProtonPIDLambda->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPionPIDLambda = new TH2F("fHistPionPIDLambda", "dE/dx after #pi PID from V0", 100, 0, 10, 100, 0, 100);\r
- fHistPionPIDLambda->GetYaxis()->SetTitle("TPC Signal");\r
- fHistPionPIDLambda->GetXaxis()->SetTitle("P (GeV/c)");\r
- fHistPionPIDLambda->SetOption("scat");\r
- fHistPionPIDLambda->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdcaPvtxDvtx= new TH1F("fHistMCdcaPvtxDvtx", "MC True DCA Primary Vertex - H Decay Vertex", 300, -0.1, 11.9);\r
- fHistMCdcaPvtxDvtx->GetXaxis()->SetTitle("dca prim. vtx- decay vtx (cm)");\r
- fHistMCdcaPvtxDvtx->GetYaxis()->SetTitle("Entries");\r
- fHistMCdcaPvtxDvtx->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdcaPvtxLvtx= new TH1F("fHistMCdcaPvtxLvtx", "MC True DCA Primary Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);\r
- fHistMCdcaPvtxLvtx->GetXaxis()->SetTitle("dca prim. vtx-#Lambda decay vtx (cm)");\r
- fHistMCdcaPvtxLvtx->GetYaxis()->SetTitle("Entries");\r
- fHistMCdcaPvtxLvtx->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdcaDvtxLvtx= new TH1F("fHistMCdcaDvtxLvtx", "MC True DCA H Decay Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);\r
- fHistMCdcaDvtxLvtx->GetXaxis()->SetTitle("dca H deacy vtx-#Lambda decay vtx (cm)");\r
- fHistMCdcaDvtxLvtx->GetYaxis()->SetTitle("Entries");\r
- fHistMCdcaDvtxLvtx->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCangleLH= new TH1F("fHistMCangleLH", "MC True Angle between #Lambda and H", 300, 0., 2*TMath::Pi());\r
- fHistMCangleLH->GetXaxis()->SetTitle("Angle (#Lambda-H)");\r
- fHistMCangleLH->GetYaxis()->SetTitle("Entries");\r
- fHistMCangleLH->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdecayAngle= new TH1F("fHistMCdecayAngle", "MC True Angle between decay products", 300, 0., 2*TMath::Pi());\r
- fHistMCdecayAngle->GetXaxis()->SetTitle("Angle (#Lambda-p#pi)");\r
- fHistMCdecayAngle->GetYaxis()->SetTitle("Entries");\r
- fHistMCdecayAngle->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCpointingAngle= new TH1F("fHistMCpointingAngle", "MC True Pointing Angle", 3000, 0., 2*TMath::Pi());\r
- fHistMCpointingAngle->GetXaxis()->SetTitle("Pointing Angle");\r
- fHistMCpointingAngle->GetYaxis()->SetTitle("Entries");\r
- fHistMCpointingAngle->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCap = new TH2F("fHistMCap", "True MC Armenteros-Podolanski", 200,-1.0,1.0, 500,0,1);\r
- fHistMCap->GetYaxis()->SetTitle("#alpha");\r
- fHistMCap->GetXaxis()->SetTitle("q_{t}");\r
- fHistMCap->SetOption("scat");\r
- fHistMCap->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdcaPvtxDvtxReso= new TH1F("fHistMCdcaPvtxDvtxReso", "MC True DCA Primary Vertex - H Decay Vertex", 300, -0.1, 11.9);\r
- fHistMCdcaPvtxDvtxReso->GetXaxis()->SetTitle("dca prim. vtx- decay vtx (cm)");\r
- fHistMCdcaPvtxDvtxReso->GetYaxis()->SetTitle("Entries");\r
- fHistMCdcaPvtxDvtxReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdcaPvtxLvtxReso= new TH1F("fHistMCdcaPvtxLvtxReso", "MC True DCA Primary Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);\r
- fHistMCdcaPvtxLvtxReso->GetXaxis()->SetTitle("dca prim. vtx-#Lambda decay vtx (cm)");\r
- fHistMCdcaPvtxLvtxReso->GetYaxis()->SetTitle("Entries");\r
- fHistMCdcaPvtxLvtxReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdcaDvtxLvtxReso= new TH1F("fHistMCdcaDvtxLvtxReso", "MC True DCA H Decay Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);\r
- fHistMCdcaDvtxLvtxReso->GetXaxis()->SetTitle("dca H deacy vtx-#Lambda decay vtx (cm)");\r
- fHistMCdcaDvtxLvtxReso->GetYaxis()->SetTitle("Entries");\r
- fHistMCdcaDvtxLvtxReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCangleLHReso= new TH1F("fHistMCangleLHReso", "MC True Angle between #Lambda and H", 300, 0., 2*TMath::Pi());\r
- fHistMCangleLHReso->GetXaxis()->SetTitle("Angle (#Lambda-H)");\r
- fHistMCangleLHReso->GetYaxis()->SetTitle("Entries");\r
- fHistMCangleLHReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCdecayAngleReso= new TH1F("fHistMCdecayAngleReso", "MC True Angle between decay products", 300, 0., 2*TMath::Pi());\r
- fHistMCdecayAngleReso->GetXaxis()->SetTitle("Angle (#Lambda-p#pi)");\r
- fHistMCdecayAngleReso->GetYaxis()->SetTitle("Entries");\r
- fHistMCdecayAngleReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCpointingAngleReso= new TH1F("fHistMCpointingAngleReso", "MC True Pointing Angle", 300, 0., 2*TMath::Pi());\r
- fHistMCpointingAngleReso->GetXaxis()->SetTitle("Pointing Angle");\r
- fHistMCpointingAngleReso->GetYaxis()->SetTitle("Entries");\r
- fHistMCpointingAngleReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistMCapReso = new TH2F("fHistMCapReso", "True MC Armenteros-Podolanski", 200,-1.0,1.0, 500,0,1);\r
- fHistMCapReso->GetYaxis()->SetTitle("#alpha");\r
- fHistMCapReso->GetXaxis()->SetTitle("q_{t}");\r
- fHistMCapReso->SetOption("scat");\r
- fHistMCapReso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistCentrality = new TH1F("Centrality ", "Centrality", 11, -0.5, 10.5);\r
- fHistCentrality ->GetXaxis()->SetTitle("Centrality");\r
- fHistCentrality ->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistCentralityAC = new TH1F("CentralityAC ", "CentralityAC", 11, -0.5, 10.5);\r
- fHistCentralityAC ->GetXaxis()->SetTitle("Centrality");\r
- fHistCentralityAC ->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistMultiplicity = new TH1F("Multiplicity ", "Multiplicity", 100, 0, 20000);\r
- fHistMultiplicity ->GetXaxis()->SetTitle("Centrality");\r
- fHistMultiplicity ->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistList->Add(fHistMassDPi);\r
- fHistList->Add(fHistMassLPi);\r
- fHistList->Add(fHistMassLambdaPi);\r
- fHistList->Add(fHistMassLambda);\r
- fHistList->Add(fHistMassLambdaPPi);\r
- fHistList->Add(fHistMassLambdaP);\r
- fHistList->Add(fHistMassLambdaK);\r
- fHistList->Add(fHistMassK0onl);\r
- fHistList->Add(fHistMassK0offl);\r
- fHistList->Add(fHistMassK0onlC);\r
- fHistList->Add(fHistMassK0offlC);\r
- fHistList->Add(fHistMassPQonl); \r
- fHistList->Add(fHistMassPQoffl);\r
- fHistList->Add(fHistDC); \r
- fHistList->Add(fHistArmenterosPodolanski);\r
- fHistList->Add(fHistArmenterosPodolanskiCut);\r
- fHistList->Add(fHistHDibaryonInvaMassGen);\r
- fHistList->Add(fHistHDibaryonInvaMassGenRes);\r
- fHistList->Add(fHistAntiHDibaryonInvaMassGen);\r
- fHistList->Add(fHistHDibaryonInvaMassAso);\r
- fHistList->Add(fHistHDibaryonInvaMassAsoReso);\r
- fHistList->Add(fHistAntiHDibaryonInvaMassAso);\r
- fHistList->Add(fHistCheck);\r
- fHistList->Add(fHistHPointingAngle);\r
- fHistList->Add(fHistMassH);\r
- fHistList->Add(fHistMassPpi);\r
- fHistList->Add(fHistMassPpiReso);\r
- fHistList->Add(fHistMassLpi);\r
- fHistList->Add(fHistMassLP);\r
- fHistList->Add(fHistMassLambdaFromH);\r
- fHistList->Add(fHistMassLambdaFromHtLorentz);\r
- fHistList->Add(fHistProtonPIDBb);\r
- fHistList->Add(fHistPionPIDBb);\r
- fHistList->Add(fHistProtonPIDLambda);\r
- fHistList->Add(fHistPionPIDLambda);\r
- fHistList->Add(fHistMCdcaPvtxDvtx);\r
- fHistList->Add(fHistMCdcaPvtxLvtx);\r
- fHistList->Add(fHistMCdcaDvtxLvtx);\r
- fHistList->Add(fHistMCangleLH);\r
- fHistList->Add(fHistMCdecayAngle);\r
- fHistList->Add(fHistMCpointingAngle);\r
- fHistList->Add(fHistMCap);\r
- fHistList->Add(fHistMCdcaPvtxDvtxReso);\r
- fHistList->Add(fHistMCdcaPvtxLvtxReso);\r
- fHistList->Add(fHistMCdcaDvtxLvtxReso);\r
- fHistList->Add(fHistMCangleLHReso);\r
- fHistList->Add(fHistMCdecayAngleReso);\r
- fHistList->Add(fHistMCpointingAngleReso);\r
- fHistList->Add(fHistMCapReso);\r
- fHistList->Add(fHistCentrality);\r
- fHistList->Add(fHistCentralityAC);\r
- fHistList->Add(fHistMultiplicity);\r
- \r
- fHistHilf1= new TH1F("fHistHilf1", "HD", 300, 0., 10);\r
- fHistHilf1->GetXaxis()->SetTitle("");\r
- fHistHilf1->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistHilf2= new TH1F("fHistHilf2", "HD", 300, 0., 10);\r
- fHistHilf2->GetXaxis()->SetTitle("");\r
- fHistHilf2->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistHilf3= new TH1F("fHistHilf3", "HD", 300, 0., 10);\r
- fHistHilf3->GetXaxis()->SetTitle("");\r
- fHistHilf3->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistHilf4= new TH1F("fHistHilf4", "HD", 300, 0., 10);\r
- fHistHilf4->GetXaxis()->SetTitle("");\r
- fHistHilf4->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistHilf5= new TH1F("fHistHilf5", "HD", 300, 0., 10);\r
- fHistHilf5->GetXaxis()->SetTitle("");\r
- fHistHilf5->GetYaxis()->SetTitle("Entries");\r
-\r
- fHistHilf6= new TH1F("fHistHilf6", "HD", 300, 0., 10);\r
- fHistHilf6->GetXaxis()->SetTitle("");\r
- fHistHilf6->GetYaxis()->SetTitle("Entries");\r
- \r
- fHistPtvsEtaGen = new TH2F("fHistPtvsEtaGen", "p_{t} vs #eta from generated H", 200,0.0,10.0, 200,-1,1);\r
- fHistPtvsEtaGen->GetXaxis()->SetTitle("p_{t} (GeV/c)");\r
- fHistPtvsEtaGen->GetYaxis()->SetTitle("#eta");\r
- fHistPtvsEtaGen->SetOption("scat");\r
- fHistPtvsEtaGen->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPtvsEtaAso = new TH2F("fHistPtvsEtaAso", "p_{t} vs #eta from associated H", 200,0.0,10.0, 200,-1,1);\r
- fHistPtvsEtaAso->GetYaxis()->SetTitle("p_{t} (GeV/c)");\r
- fHistPtvsEtaAso->GetXaxis()->SetTitle("#eta");\r
- fHistPtvsEtaAso->SetOption("scat");\r
- fHistPtvsEtaAso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPtvsYGen = new TH2F("fHistPtvsYGen", "p_{t} vs rapidity from generated H", 200,0.0,10.0, 200,-1,1);\r
- fHistPtvsYGen->GetXaxis()->SetTitle("p_{t} (GeV/c)");\r
- fHistPtvsYGen->GetYaxis()->SetTitle("y");\r
- fHistPtvsYGen->SetOption("scat");\r
- fHistPtvsYGen->SetMarkerStyle(kFullCircle);\r
-\r
- fHistPtvsYAso = new TH2F("fHistPtvsYAso", "p_{t} vs rapidity from associated H", 200,0.0,10.0, 200,-1,1);\r
- fHistPtvsYAso->GetXaxis()->SetTitle("p_{t} (GeV/c)");\r
- fHistPtvsYAso->GetYaxis()->SetTitle("y");\r
- fHistPtvsYAso->SetOption("scat");\r
- fHistPtvsYAso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistRap= new TH1F("fHistRap", "Rapidity", 400, -2., 2);\r
- fHistRap->GetXaxis()->SetTitle("Y");\r
- fHistRap->GetYaxis()->SetTitle("Entries");\r
- fHistPtvsEtaAso->SetMarkerStyle(kFullCircle);\r
-\r
- fHistList->Add(fHistHilf1);\r
- fHistList->Add(fHistHilf2); \r
- fHistList->Add(fHistHilf3);\r
- fHistList->Add(fHistHilf4);\r
- fHistList->Add(fHistHilf5); \r
- fHistList->Add(fHistHilf6);\r
- fHistList->Add(fHistPtvsEtaGen);\r
- fHistList->Add(fHistPtvsEtaAso);\r
- fHistList->Add(fHistPtvsYGen);\r
- fHistList->Add(fHistPtvsYAso);\r
- fHistList->Add(fHistRap);\r
-\r
- fHistCount = new TH1F("fHistCount","test",17,0,17);\r
- fHistCount->GetXaxis()->SetBinLabel(1,"Events");\r
- fHistCount->GetXaxis()->SetBinLabel(2,"MC All");\r
- fHistCount->GetXaxis()->SetBinLabel(3,"MC from Primary Vtx");\r
- fHistCount->GetXaxis()->SetBinLabel(4,"Horst");\r
- fHistCount->GetXaxis()->SetBinLabel(5,"Lambda Candidates");\r
- fHistCount->GetXaxis()->SetBinLabel(6,"Sigma Candidates");\r
- fHistCount->GetXaxis()->SetBinLabel(7,"Horst");\r
- fHistCount->GetXaxis()->SetBinLabel(8,"Horst");\r
- fHistCount->GetXaxis()->SetBinLabel(9,"Horst");\r
- fHistCount->GetXaxis()->SetBinLabel(10,"MC All #bar{Lambda}(1520)s");\r
- fHistCount->GetXaxis()->SetBinLabel(11,"");\r
- fHistCount->GetXaxis()->SetBinLabel(12,"H-Dibaryon");\r
- fHistCount->GetXaxis()->SetBinLabel(13,"Hypertriton 2-Body");\r
- fHistCount->GetXaxis()->SetBinLabel(14,"Hypertriton 3-Body");\r
- fHistCount->GetXaxis()->SetBinLabel(15,"");\r
- fHistCount->GetXaxis()->SetBinLabel(16,"");\r
- fHistCount->GetXaxis()->SetBinLabel(17,"Lambdas!!!");\r
- fHistCount->SetStats(0);\r
- fHistCount->SetFillColor(38);\r
- fHistList->Add(fHistCount);\r
-\r
- //trigger statistics histogram\r
- fHistTriggerStat = new TH1F("fHistTriggerStat","Trigger statistics", 4,-0.5, 3.5);\r
- const Char_t* aTriggerNames[] = { "kMB", "kCentral", "kSemiCentral" };\r
- for ( Int_t ii=0; ii < 3; ii++ )\r
- fHistTriggerStat->GetXaxis()->SetBinLabel(ii+1, aTriggerNames[ii]);\r
-\r
- fHistTriggerStatAfterEventSelection = new TH1F("fHistTriggerStatAfterEventSelection","Trigger statistics after event selection", 4,-0.5, 3.5);\r
- for ( Int_t ii=0; ii < 3; ii++ )\r
- fHistTriggerStatAfterEventSelection->GetXaxis()->SetBinLabel(ii+1, aTriggerNames[ii]);\r
- fHistList->Add(fHistTriggerStat);\r
- fHistList->Add(fHistTriggerStatAfterEventSelection);\r
-\r
- fHistMassHcentMult = new TH3F("fHistMassHcentMult", "Inv. Mass vs. centrality vs. multiplicity", 100, 2.2, 2.3, 5, 0, 4, 300, 0, 6000);\r
- fHistMassHcentMult->GetXaxis()->SetTitle("Invariant mass #Lambdap#pi^{-} (GeV/c^{2})"); // inv. mass\r
- fHistMassHcentMult->GetYaxis()->SetTitle("Centrality"); // triggertype\r
- fHistMassHcentMult->GetZaxis()->SetTitle("Multiplicity"); // refTPC\r
- fHistList->Add(fHistMassHcentMult);\r
-\r
- \r
- const Double_t kz = 2*TMath::Pi();\r
- Int_t binsD01[16]={ 300, 200, 100, 100, 100, 100, 100, 100, 200, 200, 200, 200, 400, 200, 200, 3};\r
- Double_t xminD01[16]={2.0, 1.0, 0., -1, 0., 0., 0., 0., 0., 0., 0., 0., -1, 0., 0., 0};\r
- Double_t xmaxD01[16]={2.3, 1.2, kz, 1, 1, 10, 10, 5, 5, 5, 5, 100, 1, 100, 4000, 1};\r
- \r
-\r
- fHistNdim = new THnSparseF("fHistNdim","THnS;InvMass, InvMassLambda, pointingAngle, armPoAlpha, armPoQt, pTL, pTH, d0p, d0n, dcaHd, dca, decayL, cosPA, centr, multi, mcinf;InvMassH", 16,binsD01,xminD01,xmaxD01);\r
- fHistList->Add(fHistNdim);\r
-}\r
-\r
- //________________________________________________________________________\r
-void AliAnalysisTaskHdibaryonLPpi::UserExec(Option_t *) \r
-{ \r
- // Main loop\r
- // Called for each event\r
-\r
- //define improtant masses\r
- Double_t pionMass = 0.13957;\r
- Double_t protonMass = 0.93827;\r
-\r
- //define PDGCodes\r
- Long_t pdgPionPlus = 211;\r
- Long_t pdgPionMinus = -211;\r
- Long_t pdgProton = 2212;\r
- Long_t pdgAntiProton = -2212;\r
- Long_t pdgLambda = 3122;\r
- Long_t pdgAntiLambda = -3122;\r
- Long_t pdgHDibaryon = 1020000020;\r
- Long_t pdgAntiHDibaryon = -1020000020;\r
-\r
- AliStack* stack(NULL);\r
- if(HasMC()){\r
-\r
- if(!fMCEvent)return;\r
-\r
- AliHeader *head = fMCEvent->Header();\r
- if(!head)return;\r
- AliGenPythiaEventHeader *pyheader = (AliGenPythiaEventHeader*)head->GenEventHeader();\r
- if(!pyheader)return;\r
- \r
- if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()){\r
- if(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()){\r
- if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->TreeK()))return;\r
- if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->TreeTR()))return;\r
- if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->Init("local")))return;\r
- stack = static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack();\r
- if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack()->TreeK()))return;\r
- }\r
- }\r
- \r
- if(!stack)return;\r
- }\r
-\r
- // -------------------------------------------------------\r
- // Loop for Inv. Mass via ESD tracks\r
- // -------------------------------------------------------\r
-\r
- fHistCount->Fill(0);\r
- \r
- fESD = dynamic_cast<AliESDEvent *>(fInputEvent);\r
-\r
- const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks();\r
- if (vertex->GetNContributors()<1) \r
- {\r
- // SPD vertex\r
- vertex = fESD->GetPrimaryVertexSPD();\r
- if(vertex->GetNContributors()<1) {\r
- return;\r
- } \r
- }\r
- if (TMath::Abs(vertex->GetZv()) > 10) return;\r
- \r
- Int_t centrality = -5;\r
- Double_t centrPerc = -5;\r
-\r
- if (fESD->GetEventSpecie() == 4) \r
- { // PbPb\r
- AliCentrality *esdCentrality = fESD->GetCentrality();\r
- centrality = esdCentrality->GetCentralityClass10("V0M"); // centrality percentile determined with V0\r
- centrPerc = esdCentrality->GetCentralityPercentile("V0M");\r
- if (centrality < 0. || centrality > 8.) return; //0 bis 80 %\r
- // cout<<"Centrality: "<< centrality << endl;\r
- }\r
-\r
- fHistCentrality->Fill(centrality); \r
-\r
- //*****************// \r
- //* Centrality *//\r
- //*****************//\r
- \r
- // Float_t percentile=centrality->GetCentralityPercentile("V0M");\r
-\r
- Bool_t isSelectedCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral);\r
- Bool_t isSelectedSemiCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral);\r
- Bool_t isSelectedMB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);\r
- \r
- Int_t triggertype = 17;\r
-\r
- if(isSelectedCentral){\r
- fHistTriggerStat->Fill(1);\r
- triggertype=1;\r
- }\r
-\r
- if(isSelectedSemiCentral){\r
- fHistTriggerStat->Fill(2);\r
- triggertype=2;\r
- }\r
-\r
- if(isSelectedMB){\r
- fHistTriggerStat->Fill(0);\r
- triggertype=3;\r
- }\r
-\r
- // if(isSelectedCentral || isSelectedSemiCentral || isSelectedMB){\r
-\r
- //*******************************\r
-\r
- Int_t runNumber = 0;\r
- // itrk = 0;\r
- runNumber = fESD->GetRunNumber();\r
- \r
- if (!fPIDtpcESD) fPIDtpcESD = ((AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetESDpid();\r
- if (!fPIDtpcESD) {\r
- fPIDtpcESD = new AliESDpid(); // HACK FOR MC PBPB --> PLEASE REMOVE AS SOON AS POSSIBLE\r
- fPIDtpcESD->GetTPCResponse().SetBetheBlochParameters(1.28778e+00/50., 3.13539e+01, TMath::Exp(-3.16327e+01), 1.87901e+00, 6.41583e+00);\r
- }\r
-\r
- Double_t pionK=1;\r
- Double_t pK=1;\r
- \r
- TObjArray* listCrossV0 = fESDCutsV0->GetAcceptedV0s(fESD); \r
- Int_t nGoodV0s = listCrossV0->GetEntries();\r
-\r
- const AliESDVertex *esdVer = fESD->GetPrimaryVertex();\r
- AliESDVertex *esdVer1 = new AliESDVertex(*esdVer);\r
- \r
- AliVertexerTracks *vertexer = new AliVertexerTracks(fESD->GetMagneticField());\r
- TObjArray *trkArray = new TObjArray(2);\r
- AliVertexerTracks *vertexer1 = new AliVertexerTracks(fESD->GetMagneticField());\r
- TObjArray *trkArray1 = new TObjArray(2);\r
-\r
- AliKFParticle::SetField(fESD->GetMagneticField());\r
- \r
- AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));\r
-\r
- Int_t refMultTpc = AliESDtrackCuts::GetReferenceMultiplicity(fESD, kTRUE);\r
- //cout<<"Multiplicity: "<< refMultTpc << endl;\r
- fHistMultiplicity->Fill(refMultTpc);\r
- \r
- Double_t mn[3] = {0,0,0};\r
- Double_t mp[3] = {0,0,0}; \r
- Double_t mm[3] = {0,0,0};\r
- Double_t dd[3] = {0,0,0};\r
- Double_t dd1[3] = {0,0,0};\r
- const Double_t cProtonMass=TDatabasePDG::Instance()->GetParticle(2212)->Mass();\r
- const Double_t cPionMass=TDatabasePDG::Instance()->GetParticle(211)->Mass();\r
- const Double_t cElectronMass=TDatabasePDG::Instance()->GetParticle(11)->Mass();\r
- const Double_t cLambdaMass=TDatabasePDG::Instance()->GetParticle(3122)->Mass();\r
- Double_t decayLength=0;\r
- Double_t decayLengthH=0;\r
-\r
- //V0 Loop for Lambda and Anti-Lambda\r
- for(Int_t iV0MI = 0; iV0MI < nGoodV0s ; iV0MI++) {\r
- AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);\r
- Int_t lOnFlyStatus = 0;\r
-\r
- lOnFlyStatus = fV0MIs->GetOnFlyStatus();\r
- Double_t lInvMassLambda=0;\r
- Double_t lInvMassLambdaPi=0;\r
- Double_t lPtLambda=0;\r
- Double_t lPzLambda=0;\r
- Double_t lPLambda=0;\r
- Int_t onl=0;\r
- Int_t offl=0;\r
-\r
- TLorentzVector posE;\r
- TLorentzVector negE;\r
- TLorentzVector photon;\r
-\r
- if (lOnFlyStatus){\r
- onl=1; \r
- // return;\r
- }\r
- if (!lOnFlyStatus){\r
- offl=1;\r
- //return;\r
- }\r
-\r
- // fHistMultiplicity->Fill(refMultTpc); \r
- fHistCentralityAC->Fill(centrality);\r
- fHistCheck->Fill(offl,onl);\r
-\r
- AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());\r
- AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());\r
-\r
- // if (!\r
- if (!fEsdTrackCuts->AcceptTrack(trackPosTest)) continue;\r
- if (!fESDtrackCutsV0->AcceptTrack(trackNegTest)) continue;\r
-\r
-\r
- //PID via specific energy loss in the TPC\r
- //define the arrays for the Bethe-Bloch-Parameters\r
- Double_t parProton[5] = {0,0,0,0,0};\r
-\r
- if(runNumber < 166500) //LHC10h\r
- {\r
- parProton[0] = 1.45802; // ALEPH parameters for protons (pass2)\r
- parProton[1] = 27.4992;\r
- parProton[2] = 4.00313e-15;\r
- parProton[3] = 2.48485;\r
- parProton[4] = 8.31768; \r
- }\r
- \r
- if(runNumber > 166500) //LHC11h\r
- { \r
- parProton[0] = 1.11243; // ALEPH parameters for protons (pass2)\r
- parProton[1] = 26.1144;\r
- parProton[2] = 4.00313e-15;\r
- parProton[3] = 2.72969;\r
- parProton[4] = 9.15038; \r
- }\r
- \r
- //Get the total momentum for each track at the inner readout of the TPC\r
- Double_t ptotN = trackNegTest->GetInnerParam()->GetP();\r
- Double_t ptotP = trackPosTest->GetInnerParam()->GetP();\r
-\r
- //define expected signals for the various species\r
- Double_t expSignalPionP = 0;\r
- Double_t expSignalPionN = 0;\r
- Double_t expSignalProtonN = 0;\r
- Double_t expSignalProtonP = 0;\r
-\r
- //for data\r
- if(!HasMC())\r
- {\r
- expSignalProtonN = AliExternalTrackParam::BetheBlochAleph(ptotN/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);\r
- expSignalProtonP = AliExternalTrackParam::BetheBlochAleph(ptotP/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);\r
- }\r
- \r
- //for MC\r
- if(HasMC())\r
- {\r
- expSignalPionP = 0.7*AliExternalTrackParam::BetheBlochAleph(ptotP/(pionMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]); \r
- expSignalPionN = 0.7*AliExternalTrackParam::BetheBlochAleph(ptotN/(pionMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]); \r
-\r
- expSignalProtonN = 0.65*AliExternalTrackParam::BetheBlochAleph(ptotN/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);\r
- expSignalProtonP = 0.65*AliExternalTrackParam::BetheBlochAleph(ptotP/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]); \r
- }\r
-\r
- // PID cut on the nuclei (proton, deuteron, triton, helium3)\r
- Bool_t corrParticle = kFALSE;\r
-\r
- Bool_t posProton = kFALSE;\r
- //data\r
- if(!HasMC())\r
- {\r
- if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackPosTest, AliPID::kProton)) < 3)\r
- {\r
- posProton = kTRUE;\r
- corrParticle = kTRUE;\r
- }\r
- }\r
- //MC\r
- if(HasMC())\r
- {\r
- if(//trackPosTest->GetTPCsignal() < 1200 && \r
- TMath::Abs(trackPosTest->GetTPCsignal() - expSignalProtonP)/expSignalProtonP < 0.4)\r
- {\r
- posProton = kTRUE;\r
- corrParticle = kTRUE;\r
- }\r
- }\r
-\r
- Bool_t negProton = kFALSE;\r
- //data\r
- if(!HasMC())\r
- {\r
- if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackNegTest, AliPID::kProton)) < 3)\r
- {\r
- negProton = kTRUE;\r
- corrParticle = kTRUE;\r
- }\r
- }\r
- //MC\r
- if(HasMC())\r
- {\r
- if(//trackNegTest->GetTPCsignal() < 1200 && \r
- TMath::Abs(trackNegTest->GetTPCsignal() - expSignalProtonN)/expSignalProtonN < 0.4)\r
- {\r
- negProton = kTRUE;\r
- corrParticle = kTRUE;\r
- }\r
- }\r
-\r
- //PID cut for pions\r
- //data: 3sigma cut on the pions\r
-\r
- Bool_t negPion = kFALSE; \r
- Bool_t posPion = kFALSE;\r
-\r
- if (!HasMC())\r
- {\r
- if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackPosTest, AliPID::kPion)) < 4) posPion=kTRUE; //pos daughter has to be a pion\r
- if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackNegTest, AliPID::kPion)) < 4) negPion=kTRUE; // negative daughter has to be a pion\r
- }\r
- \r
- //MC: like the nuclei via the specific energyloss in the TPC\r
- if (HasMC())\r
- {\r
- if (TMath::Abs(trackPosTest->GetTPCsignal() - expSignalPionP)/expSignalPionP < 0.4) posPion=kTRUE;\r
- if (TMath::Abs(trackNegTest->GetTPCsignal() - expSignalPionN)/expSignalPionN < 0.4) negPion=kTRUE;\r
- }\r
-\r
- if (!(posProton==kTRUE)) continue;\r
- if (!(negPion==kTRUE)) continue;\r
-\r
- //To avoid ghosts\r
-\r
- if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){\r
- continue;\r
- }\r
-\r
- if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){\r
- continue;\r
- }\r
-\r
- if( trackPosTest->GetSign() >0 && trackNegTest->GetSign() <0){\r
- fV0MIs->GetNPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter\r
- fV0MIs->GetPPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter \r
- }\r
-\r
- if( trackPosTest->GetSign() <0 && trackNegTest->GetSign() >0){\r
- fV0MIs->GetPPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter\r
- fV0MIs->GetNPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter\r
- }\r
-\r
- fV0MIs->GetPxPyPz(mm[0],mm[1],mm[2]); //reconstructed cartesian momentum components of mother\r
-\r
- TVector3 vecN(mn[0],mn[1],mn[2]);\r
- TVector3 vecP(mp[0],mp[1],mp[2]);\r
- TVector3 vecM(mm[0],mm[1],mm[2]);\r
- \r
- Double_t thetaP = acos((vecP * vecM)/(vecP.Mag() * vecM.Mag()));\r
- Double_t thetaN = acos((vecN * vecM)/(vecN.Mag() * vecM.Mag()));\r
- \r
- Double_t alfa = ((vecP.Mag())*cos(thetaP)-(vecN.Mag())*cos(thetaN))/\r
- ((vecP.Mag())*cos(thetaP)+(vecN.Mag())*cos(thetaN)) ;\r
- Double_t qt = vecP.Mag()*sin(thetaP);\r
-\r
- fHistArmenterosPodolanski->Fill(alfa,qt); //Armenteros-Podolanski calculation\r
-\r
- TLorentzVector k0;\r
- TLorentzVector k0daugh1;\r
- TLorentzVector k0daugh2;\r
- TLorentzVector proton;\r
- TLorentzVector pq;\r
-\r
- k0daugh1.SetXYZM(mn[0],mn[1],mn[2],cPionMass);\r
- k0daugh2.SetXYZM(mp[0],mp[1],mp[2],cPionMass);\r
- k0=k0daugh1+k0daugh2;\r
-\r
- fV0MIs->ChangeMassHypothesis(3122);\r
- lInvMassLambda = fV0MIs->GetEffMass();\r
- lPtLambda = fV0MIs->Pt();\r
- lPzLambda = fV0MIs->Pz();\r
- lPLambda = fV0MIs->P();\r
-\r
- trkArray->AddAt(trackPosTest,0);\r
- trkArray->AddAt(trackNegTest,1);\r
-\r
- vertexer->SetVtxStart(esdVer1);\r
- AliESDVertex *decayVertex = (AliESDVertex*)vertexer->VertexForSelectedESDTracks(trkArray);\r
-\r
- dd[0]=fESD->GetPrimaryVertexSPD()->GetX()-decayVertex->GetX();\r
- dd[1]=fESD->GetPrimaryVertexSPD()->GetY()-decayVertex->GetY();\r
- dd[2]=fESD->GetPrimaryVertexSPD()->GetZ()-decayVertex->GetZ();\r
- \r
- decayLength=sqrt(dd[0]*dd[0]+dd[1]*dd[1]+dd[2]*dd[2]);\r
-\r
- if (decayVertex) delete decayVertex;\r
-\r
- TLorentzVector negPio1;\r
- TLorentzVector posProt1; \r
- TLorentzVector posP;\r
- TLorentzVector posProt;\r
- TLorentzVector negK;\r
- TLorentzVector negPio;\r
- TLorentzVector negPi;\r
- TLorentzVector omega;\r
- TLorentzVector threeSum;\r
- TLorentzVector fourSum;\r
- TLorentzVector ppK;\r
- TLorentzVector posPiK;\r
- TLorentzVector negPiK;\r
- TLorentzVector kaon;\r
- TLorentzVector lambda;\r
- TLorentzVector lambdaH;\r
- TLorentzVector hDibaryon;\r
- TVector3 h;\r
- TVector3 h1;\r
-\r
- Int_t mcStatus=0;\r
-\r
- h.SetXYZ(-dd[0],-dd[1],-dd[2]);\r
-\r
- if (onl==1)fHistMassDPi->Fill(lInvMassLambda);\r
-\r
- if (offl==1||onl==1){\r
- fHistMassLPi->Fill(lInvMassLambda);\r
- \r
- negE.SetXYZM(mn[0],mn[1],mn[2],cElectronMass);\r
- posE.SetXYZM(mp[0],mp[1],mp[2],cElectronMass);\r
- photon=posE+negE;\r
- \r
- negPiK.SetXYZM(mn[0],mn[1],mn[2],cPionMass);\r
- posPiK.SetXYZM(mp[0],mp[1],mp[2],cPionMass);\r
- kaon=posPiK+negPiK;\r
- \r
- negPi.SetXYZM(mn[0],mn[1],mn[2],cPionMass);\r
- posP.SetXYZM(mp[0],mp[1],mp[2],cProtonMass);\r
- lambda=negPi+posP;\r
- lambdaH.SetXYZM(mm[0],mm[1],mm[2],cLambdaMass);\r
-\r
- if (lInvMassLambda>1.1113&&lInvMassLambda<1.1202){\r
- \r
- if (!HasMC()){\r
- if (qt<-2.21*alfa*alfa+2.945*alfa-0.887) continue;\r
- if (qt>-2.21*alfa*alfa+2.945*alfa-0.873) continue;\r
- if (photon.M()<0.005) continue;\r
- if (kaon.M()>0.495 && kaon.M()<0.500 ) continue;\r
- }\r
- \r
-\r
- fHistMassLambda->Fill(lInvMassLambda);\r
- //\r
- Bool_t isCorrectlyAssociatedLambda = kFALSE;\r
- Bool_t isPartialCorrectlyAssociatedLambda = kFALSE;\r
- Int_t labelAssociatedH=-1; \r
- Int_t labelLambda=-1;\r
- //\r
- if (HasMC()) {\r
- Int_t labelPosTest = trackPosTest->GetLabel();\r
- TParticle *tparticleDaughter = stack->Particle(TMath::Abs(labelPosTest));\r
- Int_t labelMother = tparticleDaughter->GetFirstMother();\r
- TParticle *tparticleMother = stack->Particle(TMath::Abs(labelMother));\r
- \r
- Int_t labelOma = tparticleMother->GetFirstMother();\r
- TParticle *tparticleOma = stack->Particle(TMath::Abs(labelOma));\r
-\r
- if ((tparticleOma->GetPdgCode() < 0) && TMath::Abs(tparticleMother->GetPdgCode())==pdgLambda){// check mother to be Lambda \r
- Int_t labelFirstDaughter = tparticleMother->GetDaughter(1);// Proton\r
- Int_t labelThirdDaughter = tparticleMother->GetDaughter(0);// Pion\r
- \r
- TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));\r
- TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));\r
- \r
- if((tparticleFirstDaughter->GetPdgCode() == pdgProton && tparticleThirdDaughter->GetPdgCode()== pdgPionMinus) || \r
- (tparticleFirstDaughter->GetPdgCode() == pdgPionMinus && tparticleThirdDaughter->GetPdgCode()== pdgProton)){ //daughter PDGs\r
- isPartialCorrectlyAssociatedLambda = kTRUE;\r
- labelLambda=labelMother;\r
- }\r
- }\r
- \r
- //H-Dibaryon\r
- if(tparticleOma->GetPdgCode() == pdgHDibaryon){ //check grandmother to be H PDG\r
- if (TMath::Abs(tparticleMother->GetPdgCode())==pdgLambda){// check mother to be Lambda \r
- Int_t labelFirstDaughter = tparticleMother->GetDaughter(1);// Proton\r
- Int_t labelThirdDaughter = tparticleMother->GetDaughter(0);// Pion\r
- \r
- TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));\r
- TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));\r
- \r
- if((tparticleFirstDaughter->GetPdgCode() == pdgProton && tparticleThirdDaughter->GetPdgCode()== pdgPionMinus) || \r
- (tparticleFirstDaughter->GetPdgCode() == pdgPionMinus && tparticleThirdDaughter->GetPdgCode()== pdgProton)){ //daughter PDGs\r
- isCorrectlyAssociatedLambda = kTRUE;\r
- labelAssociatedH=labelOma;\r
- fHistMassLambdaFromH->Fill(lInvMassLambda);\r
- fHistMassLambdaFromHtLorentz->Fill(lambda.M());\r
- }\r
- }\r
- }\r
- }\r
-\r
- fHistProtonPIDLambda->Fill(trackPosTest->GetInnerParam()->GetP(), trackPosTest->GetTPCsignal());\r
- fHistPionPIDLambda->Fill(trackNegTest->GetInnerParam()->GetP(), trackNegTest->GetTPCsignal());\r
-\r
- //---------------------------------------------------------\r
- // Proton track loop\r
- //---------------------------------------------------------\r
- fHistArmenterosPodolanskiCut->Fill(alfa,qt);\r
-\r
- for (Int_t iTracksP = 0; iTracksP < fESD->GetNumberOfTracks(); iTracksP++) {\r
- AliESDtrack* trackP = dynamic_cast<AliESDtrack*> (fESD->GetTrack(iTracksP));\r
- if (trackP->GetSign()<0) continue;\r
- \r
- if (iTracksP==fV0MIs->GetPindex())continue;\r
- if (iTracksP==fV0MIs->GetNindex())continue;\r
- \r
- if (!fEsdTrackCuts->AcceptTrack(trackP)) continue;\r
- \r
- AliKFParticle protonKF( *(trackP), 2212);\r
-\r
- if (!trackP->GetInnerParam()) continue;\r
- \r
- if (HasMC()) {\r
- pK=0.65;\r
- }\r
-\r
- if (!HasMC()){\r
- if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackP, AliPID::kProton)) > 3) continue;\r
- } \r
- \r
- fHistProtonPIDBb->Fill(trackP->GetInnerParam()->GetP(), trackP->GetTPCsignal());\r
- \r
- posProt.SetXYZM(trackP->Px(),trackP->Py(),trackP->Pz(),cProtonMass);\r
-\r
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
- //Pion Track loop!!!!!!!!!!!!!!!!!!!!!\r
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
- for (Int_t iTracksN = iTracksP+1; iTracksN < fESD->GetNumberOfTracks(); iTracksN++) {\r
- AliESDtrack* trackN = dynamic_cast<AliESDtrack*> (fESD->GetTrack(iTracksN));\r
-\r
- if (iTracksN==fV0MIs->GetPindex())continue;\r
- if (iTracksN==fV0MIs->GetNindex())continue;\r
- if (trackN->GetSign()>0) continue;\r
- \r
- if (!fEsdTrackCuts->AcceptTrack(trackN)) continue;\r
- if (!fESDtrackCutsV0->AcceptTrack(trackN)) continue;\r
- \r
- negPi.SetXYZM(mn[0],mn[1],mn[2],cPionMass);\r
- posP.SetXYZM(mp[0],mp[1],mp[2],cProtonMass);\r
- negPio.SetXYZM(trackN->Px(),trackN->Py(),trackN->Pz(),cPionMass);\r
- \r
- threeSum=negPi+posP+negPio;\r
- lInvMassLambdaPi=threeSum.M(); \r
- \r
- fHistDC->Fill(decayLength*lInvMassLambda/lPLambda);\r
- \r
- AliKFParticle posPionKF( *(trackN) ,-211);\r
- \r
- if (!trackN->GetInnerParam()) continue;\r
- if (HasMC()) {\r
- pionK=0.7;\r
- }\r
- \r
- if (!HasMC()){\r
- if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackN, AliPID::kPion)) > 3) continue;\r
- }\r
- fHistPionPIDBb->Fill(trackN->GetInnerParam()->GetP(), trackN->GetTPCsignal());\r
-\r
- trkArray1->AddAt(trackP,0);\r
- trkArray1->AddAt(trackN,1);\r
- \r
- vertexer1->SetVtxStart(esdVer1);\r
- AliESDVertex *decayVertex1 = (AliESDVertex*)vertexer1->VertexForSelectedESDTracks(trkArray1);\r
- \r
- dd1[0]=fESD->GetPrimaryVertexSPD()->GetX()-decayVertex1->GetX();\r
- dd1[1]=fESD->GetPrimaryVertexSPD()->GetY()-decayVertex1->GetY();\r
- dd1[2]=fESD->GetPrimaryVertexSPD()->GetZ()-decayVertex1->GetZ();\r
- \r
- decayLengthH=sqrt(dd1[0]*dd1[0]+dd1[1]*dd1[1]+dd1[2]*dd1[2]);\r
-\r
- Double_t bz = fESD->GetMagneticField();\r
- \r
- trackP->PropagateToDCA(decayVertex1, bz, 10);\r
- trackN->PropagateToDCA(decayVertex1, bz, 10);\r
-\r
- Double_t xthiss(0.0);\r
- Double_t xpp(0.0);\r
- Double_t dca = trackN->GetDCA(trackP,bz,xthiss,xpp);\r
-\r
- if (decayVertex1) delete decayVertex1;\r
- h1.SetXYZ(-dd1[0],-dd1[1],-dd1[2]);\r
-\r
- // if (dca>1) continue;\r
- if (dca>0.1) continue;\r
-\r
- fourSum=threeSum+posProt;\r
-\r
- posProt1.SetXYZM(trackP->Px(),trackP->Py(),trackP->Pz(),cProtonMass);\r
- negPio1.SetXYZM(trackN->Px(),trackN->Py(),trackN->Pz(),cPionMass);\r
- hDibaryon=lambdaH+posProt1+negPio1;\r
- Double_t hPointingAngle = hDibaryon.Angle(h);\r
- Double_t pointingAngleH = hDibaryon.Angle(h1);\r
- Double_t decayAngleH = h.Angle(h1);\r
- TVector3 vecDist(dd[0]-dd1[0],dd[1]-dd1[1],dd[2]-dd1[2]);\r
- fHistMassLambdaPPi->Fill(hDibaryon.M());\r
- fHistHPointingAngle->Fill(pointingAngleH);\r
-\r
- fHistMassHcentMult->Fill(hDibaryon.M(),triggertype,refMultTpc);\r
-\r
- Double_t rapidity = hDibaryon.Rapidity();\r
- if(rapidity > 1.0 || rapidity < -1.0) continue;\r
-\r
- Double_t vec[16]={hDibaryon.M(), lInvMassLambda, pointingAngleH, alfa, qt, lPtLambda, hDibaryon.Pt(), posPionKF.GetDistanceFromVertex(primVtx), protonKF.GetDistanceFromVertex(primVtx), dca, protonKF.GetDistanceFromVertex(posPionKF), TMath::Cos(pointingAngleH), centrPerc, refMultTpc, mcStatus};\r
- fHistNdim->Fill(vec);\r
-\r
- fHistRap->Fill(rapidity);\r
- //if (pointingAngleH > 0.1) continue;\r
- if (pointingAngleH > 0.05) continue;\r
-\r
- ///////////////////////////\r
- //MC part for Associated H\r
- ///////////////////////////\r
-\r
- if (HasMC() && isCorrectlyAssociatedLambda) {\r
- Int_t labelP = trackP->GetLabel();\r
- TParticle *tparticleDaughter = stack->Particle(TMath::Abs(labelP));\r
- Int_t labelMother = tparticleDaughter->GetFirstMother();\r
- TParticle *tparticleMother = stack->Particle(TMath::Abs(labelMother));\r
- \r
- Int_t labelProton = trackP->GetLabel();\r
- Int_t labelPion = trackN->GetLabel();\r
- \r
- //H-Dibaryon\r
- if(tparticleMother->GetPdgCode() == pdgHDibaryon && labelAssociatedH==labelMother){ //check mother PDG\r
- Int_t labelFirstDaughter = tparticleMother->GetDaughter(0);\r
- Int_t labelThirdDaughter = tparticleMother->GetDaughter(1);\r
- Int_t labelSecondDaughter = labelFirstDaughter +1;\r
-\r
- TParticle *tparticleSecondDaughter = stack->Particle(TMath::Abs(labelSecondDaughter));\r
- TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));\r
- \r
- TLorentzVector ppi;\r
- TLorentzVector lpi;\r
- TLorentzVector lP;\r
- \r
- ppi=posProt+negPio;\r
- lpi=lambdaH+negPio;\r
- lP=lambdaH+posProt;\r
-\r
- if((tparticleThirdDaughter->GetPdgCode() == pdgPionMinus && labelPion==labelThirdDaughter)&&(tparticleSecondDaughter->GetPdgCode() == pdgProton||tparticleSecondDaughter->GetPdgCode() == pdgPionMinus) && labelProton==labelSecondDaughter) fHistMassPpi->Fill(ppi.M());\r
- \r
- if(tparticleThirdDaughter->GetPdgCode() == pdgPionMinus && labelPion==labelThirdDaughter) fHistMassLpi->Fill(lpi.M());\r
- \r
- if(tparticleSecondDaughter->GetPdgCode() == pdgProton && labelProton==labelSecondDaughter) fHistMassLP->Fill(lP.M());\r
- \r
- if(tparticleSecondDaughter->GetPdgCode() == pdgProton && labelProton==labelSecondDaughter){//check second daughter PDG\r
- if(tparticleThirdDaughter->GetPdgCode() == pdgPionMinus && labelPion==labelThirdDaughter){//check second daughter PDG\r
-\r
- fHistHDibaryonInvaMassAso->Fill(hDibaryon.M()); \r
- \r
- Double_t distance01=vecDist.Mag();\r
- fHistMCdcaPvtxDvtx->Fill(decayLengthH);\r
- fHistMCdcaPvtxLvtx->Fill(decayLength);\r
- fHistMCdcaDvtxLvtx->Fill(distance01);\r
- fHistMCangleLH->Fill(hPointingAngle);\r
- fHistMCdecayAngle->Fill(decayAngleH);\r
- fHistMCpointingAngle->Fill(pointingAngleH);\r
- fHistMCap->Fill(alfa,qt);\r
-\r
- fHistHilf1->Fill(posPionKF.GetDistanceFromVertex(primVtx));\r
- fHistHilf2->Fill(protonKF.GetDistanceFromVertex(primVtx));\r
- fHistHilf3->Fill(protonKF.GetDistanceFromVertex(posPionKF));\r
- fHistHilf6->Fill(dca);\r
- fHistPtvsYAso->Fill(hDibaryon.Pt(),hDibaryon.Rapidity());\r
- fHistPtvsEtaAso->Fill(hDibaryon.Pt(),hDibaryon.Eta());\r
- mcStatus=1;\r
- }//end check for third daughter PDG\r
- }//end check second daughter PDG\r
- }//end H-Dibaryon\r
- }//end MC\r
- \r
- // cout<<"Trigger: "<<triggertype<<endl;\r
- fHistMassH->Fill(hDibaryon.M());\r
- fHistMassHcentMult->Fill(hDibaryon.M(),triggertype,refMultTpc);\r
- ppK=lambdaH+posProt;\r
- fHistMassLambdaP->Fill(ppK.M());\r
-\r
- // fHistNdim = new THnSparseF("fHistNdim","THnS;InvMass, InvMassLambda, pointingAngle, armPoAlpha, armPoQt, pTL, pTH, d0p, d0n, dcaHd, dca, decayL, cosPA, centr, multi, mcinf;InvMassH", 16,binsD01,xminD01,xmaxD01);\r
-\r
- // Double_t vec[16]={hDibaryon.M(), lInvMassLambda, pointingAngleH, alfa, qt, lPtLambda, hDibaryon.Pt(), posPionKF.GetDistanceFromVertex(primVtx), protonKF.GetDistanceFromVertex(primVtx), dca, protonKF.GetDistanceFromVertex(posPionKF), TMath::Cos(pointingAngleH), centrPerc, refMultTpc, mcStatus};\r
- // fHistNdim->Fill(vec);\r
-\r
- }\r
- }\r
- }\r
- } \r
- }\r
- \r
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
- //Pure MC Part!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r
-\r
- // Monte Carlo for genenerated particles\r
- if (HasMC()) //MC loop \r
- {\r
-\r
- Int_t stackN = 0;\r
-\r
- Double_t momentumPionGen[3]={0,0,0};\r
- Double_t momentumNucleonGen[3]={0,0,0};\r
- Double_t momentumLambdaGen[3]={0,0,0};\r
-\r
- Double_t energyPionGen = 0;\r
- Double_t energyNucleonGen = 0;\r
- Double_t energyLambdaGen = 0;\r
-\r
- Double_t transversMomentumMotherGen = 0;\r
- Double_t longitudinalMomentumMotherGen = 0;\r
- Double_t totalEnergyMotherGen = 0;\r
- \r
- Double_t rapidityGen = 2;\r
-\r
- for(stackN = 0; stackN < stack->GetNtrack(); stackN++) //loop over stack\r
- {\r
-\r
- TParticle *tparticleMother = stack->Particle(stackN);\r
-\r
- if(tparticleMother->GetPdgCode() == pdgLambda) fHistCount->Fill(16); \r
-\r
- //H-Dibaryon\r
- if(tparticleMother->GetPdgCode() == pdgHDibaryon) //check mother PDG\r
- {\r
- Int_t labelFirstDaughter = tparticleMother->GetDaughter(0);\r
- Int_t labelThirdDaughter = tparticleMother->GetDaughter(1);\r
- Int_t labelSecondDaughter = labelFirstDaughter +1;\r
-\r
- TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));\r
- TParticle *tparticleSecondDaughter = stack->Particle(TMath::Abs(labelSecondDaughter));\r
- TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));\r
- \r
- if(tparticleFirstDaughter->GetPdgCode() == pdgLambda) //check first daughter PDG\r
- {\r
- if(tparticleSecondDaughter->GetPdgCode() == pdgProton)//check second daughter PDG\r
- {\r
- if(tparticleThirdDaughter->GetPdgCode() == pdgPionMinus)//check second daughter PDG\r
- { \r
- momentumLambdaGen[0] = tparticleFirstDaughter->Px();\r
- momentumLambdaGen[1] = tparticleFirstDaughter->Py();\r
- momentumLambdaGen[2] = tparticleFirstDaughter->Pz();\r
- \r
- momentumNucleonGen[0] = tparticleSecondDaughter->Px();\r
- momentumNucleonGen[1] = tparticleSecondDaughter->Py();\r
- momentumNucleonGen[2] = tparticleSecondDaughter->Pz();\r
-\r
- momentumPionGen[0] = tparticleThirdDaughter->Px();\r
- momentumPionGen[1] = tparticleThirdDaughter->Py();\r
- momentumPionGen[2] = tparticleThirdDaughter->Pz();\r
-\r
- TLorentzVector lorentzVectorLambda;\r
- TLorentzVector lorentzVectorProton;\r
- TLorentzVector lorentzVectorPion;\r
- TLorentzVector lorentzVectorHDibaryon;\r
- \r
- lorentzVectorLambda.SetXYZM(momentumLambdaGen[0],momentumLambdaGen[1],momentumLambdaGen[2],1.115);\r
- lorentzVectorProton.SetXYZM(momentumNucleonGen[0],momentumNucleonGen[1],momentumNucleonGen[2],protonMass);\r
- lorentzVectorPion.SetXYZM(momentumPionGen[0],momentumPionGen[1],momentumPionGen[2],pionMass);\r
- \r
- lorentzVectorHDibaryon = lorentzVectorLambda + lorentzVectorProton + lorentzVectorPion;\r
- rapidityGen=lorentzVectorHDibaryon.Rapidity();\r
- transversMomentumMotherGen = lorentzVectorHDibaryon.Pt();\r
- longitudinalMomentumMotherGen = lorentzVectorHDibaryon.Pz();\r
- totalEnergyMotherGen = lorentzVectorHDibaryon.Energy();\r
-\r
- if(rapidityGen > 1.0 || rapidityGen < -1 ) continue;\r
- //lorentzVectorLambda\r
- fHistHDibaryonInvaMassGen->Fill(lorentzVectorHDibaryon.M()); \r
- if (lorentzVectorLambda.Rapidity() > 1.0 || lorentzVectorLambda.Rapidity() < -1) continue;\r
- if (lorentzVectorProton.Rapidity() > 1.0 || lorentzVectorProton.Rapidity() < -1) continue;\r
-\r
- if (lorentzVectorPion.Rapidity() > 1.0 || lorentzVectorPion.Rapidity() < -1) continue;\r
- fHistHDibaryonInvaMassGenRes->Fill(lorentzVectorHDibaryon.M());\r
- fHistPtvsEtaGen->Fill(lorentzVectorHDibaryon.Pt(),lorentzVectorHDibaryon.Eta());\r
- fHistPtvsYGen->Fill(lorentzVectorHDibaryon.Pt(),lorentzVectorHDibaryon.Rapidity());\r
- fHistPtvsEtaGen->Fill(lorentzVectorHDibaryon.Pt(),lorentzVectorHDibaryon.Eta());\r
- fHistCount->Fill(11);\r
- }//end of check third daughter PDG\r
- }//end of check second daughter PDG\r
- }//end of check first daughter PDG\r
- }//end of H-Dibaryon\r
-\r
- //Anti-H-Dibaryon\r
- if(tparticleMother->GetPdgCode() == pdgAntiHDibaryon) //check mother PDG\r
- {\r
- Int_t labelFirstDaughter = tparticleMother->GetDaughter(0);\r
- Int_t labelThirdDaughter = tparticleMother->GetDaughter(1);\r
- Int_t labelSecondDaughter = labelFirstDaughter +1;\r
-\r
- TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));\r
- TParticle *tparticleSecondDaughter = stack->Particle(TMath::Abs(labelSecondDaughter));\r
- TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));\r
-\r
- if(tparticleFirstDaughter->GetPdgCode() == pdgAntiLambda) //check first daughter PDG\r
- {\r
- if(tparticleSecondDaughter->GetPdgCode() == pdgAntiProton)//check second daughter PDG\r
- {\r
- if(tparticleThirdDaughter->GetPdgCode() == pdgPionPlus)//check second daughter PDG\r
- { \r
- momentumLambdaGen[0] = tparticleFirstDaughter->Px();\r
- momentumLambdaGen[1] = tparticleFirstDaughter->Py();\r
- momentumLambdaGen[2] = tparticleFirstDaughter->Pz();\r
- \r
- momentumNucleonGen[0] = tparticleSecondDaughter->Px();\r
- momentumNucleonGen[1] = tparticleSecondDaughter->Py();\r
- momentumNucleonGen[2] = tparticleSecondDaughter->Pz();\r
-\r
- momentumPionGen[0] = tparticleThirdDaughter->Px();\r
- momentumPionGen[1] = tparticleThirdDaughter->Py();\r
- momentumPionGen[2] = tparticleThirdDaughter->Pz();\r
- \r
- energyLambdaGen = tparticleFirstDaughter->Energy();\r
- energyNucleonGen = tparticleSecondDaughter->Energy();\r
- energyPionGen = tparticleThirdDaughter->Energy();\r
- \r
- TLorentzVector lorentzVectorLambda;\r
- TLorentzVector lorentzVectorProton;\r
- TLorentzVector lorentzVectorPion;\r
- TLorentzVector lorentzVectorHDibaryon;\r
- \r
- lorentzVectorLambda.SetXYZM(momentumLambdaGen[0],momentumLambdaGen[1],momentumLambdaGen[2],1.115);\r
- lorentzVectorProton.SetXYZM(momentumNucleonGen[0],momentumNucleonGen[1],momentumNucleonGen[2],protonMass);\r
- lorentzVectorPion.SetXYZM(momentumPionGen[0],momentumPionGen[1],momentumPionGen[2],pionMass);\r
- \r
- lorentzVectorHDibaryon = lorentzVectorLambda + lorentzVectorProton + lorentzVectorPion;\r
-\r
- rapidityGen=lorentzVectorHDibaryon.Rapidity();\r
- if(rapidityGen > 1.0 || rapidityGen < -1 ) continue;\r
- fHistAntiHDibaryonInvaMassGen->Fill(lorentzVectorHDibaryon.M()); \r
- }//end of check third daughter PDG\r
- }//end of check second daughter PDG\r
- }//end of check first daughter PDG\r
- }//end of Anti-H-Dibaryon\r
- } \r
- }//end MC\r
-\r
- // Post output data.\r
- PostData(1,fHistList);\r
- //PostData(0,fHistList);\r
-\r
- if (listCrossV0) delete listCrossV0;\r
- if (esdVer1) delete esdVer1;\r
- if (vertexer) delete vertexer;\r
- if (vertexer1) delete vertexer1;\r
- if (trkArray) delete trkArray;\r
- if (trkArray1) delete trkArray1;\r
-}\r
-\r
-//________________________________________________________________________\r
-void AliAnalysisTaskHdibaryonLPpi::Terminate(Option_t *) \r
-{\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
-\r
-}\r
-\r
+/**************************************************************************
+ * Author : Benjamin Dönigus (benjamin.doenigus@cern.ch) *
+ * *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskHdibaryonLPpi class
+// used to search for the H-Dibaryon in weak
+// (Lambda Proton Pion) and strong (Lambda Lambda) decays
+//-----------------------------------------------------------------
+
+#include "Riostream.h"
+#include "TROOT.h"
+#include "TChain.h"
+#include "TStyle.h"
+#include "TSystem.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TH1.h"
+#include "TH2D.h"
+#include "TH3F.h"
+#include "TCanvas.h"
+#include "TParticle.h"
+#include "TNtuple.h"
+#include "TObjString.h"
+#include "TLorentzVector.h"
+#include "TDatabasePDG.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+
+#include "AliESD.h"
+#include "AliESDpid.h"
+#include "AliESDEvent.h"
+#include "AliGenEventHeader.h"
+#include "AliESDInputHandler.h"
+#include "AliLog.h"
+#include "AliStack.h"
+#include "AliHeader.h"
+
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+#include "AliESDtrackCuts.h"
+#include "AliESDv0Cuts.h"
+#include "AliAnalysisTaskHdibaryonLPpi.h"
+
+#include "TFile.h"
+#include "TH2F.h"
+#include "TF1.h"
+#include "TCanvas.h"
+#include "TList.h"
+#include "TParallelCoord.h"
+
+#include "AliMCParticle.h"
+#include "AliGenPythiaEventHeader.h"
+
+#include "AliPID.h"
+#include "AliESDtrack.h"
+#include "AliCentrality.h"
+
+#include "THnSparse.h"
+
+#include "AliVertexerTracks.h"
+
+using namespace std;
+ClassImp(AliAnalysisTaskHdibaryonLPpi)
+//________________________________________________________________________
+AliAnalysisTaskHdibaryonLPpi::AliAnalysisTaskHdibaryonLPpi() : AliAnalysisTaskSE()/*AliAnalysisTask(name, ""), fMCEvent(0)*/, fESD(0), fESDtrackCutsV0(0),
+ fESDCutsV0(0),
+ fEsdTrackCuts(0),
+ fBin(0),
+ fEvent(0x0),
+ fHistList(0),
+ fHistMassDPi(0),
+ fHistMassLPi(0),
+ fHistMassLambdaPi(0),
+ fHistMassLambda(0),
+ fHistMassLambdaPPi(0),
+ fHistMassLambdaP(0),
+ fHistMassLambdaK(0),
+ fHistMassK0onl(0),
+ fHistMassK0offl(0),
+ fHistMassK0onlC(0),
+ fHistMassK0offlC(0),
+ fHistMassPQonl(0),
+ fHistMassPQoffl(0),
+ fHistDC(0),
+ fHistArmenterosPodolanski(0),
+ fHistArmenterosPodolanskiCut(0),
+ fHistHDibaryonInvaMassGen(0),
+ fHistHDibaryonInvaMassGenRes(0),
+ fHistAntiHDibaryonInvaMassGen(0),
+ fHistHDibaryonInvaMassAso(0),
+ fHistHDibaryonInvaMassAsoReso(0),
+ fHistAntiHDibaryonInvaMassAso(0),
+ fHistCheck(0),
+ fHistHPointingAngle(0),
+ fHistMassH(0),
+ fHistMassLambdaFromH(0),
+ fHistMassLambdaFromHtLorentz(0),
+ fHistMassPpi(0),
+ fHistMassPpiReso(0),
+ fHistMassLpi(0),
+ fHistMassLP(0),
+ fHistProtonPIDBb(0),
+ fHistPionPIDBb(0),
+ fHistProtonPIDLambda(0),
+ fHistPionPIDLambda(0),
+ fHistMCdcaPvtxDvtx(0),
+ fHistMCdcaPvtxLvtx(0),
+ fHistMCdcaDvtxLvtx(0),
+ fHistMCangleLH(0),
+ fHistMCdecayAngle(0),
+ fHistMCpointingAngle(0),
+ fHistMCap(0),
+ fHistMCdcaPvtxDvtxReso(0),
+ fHistMCdcaPvtxLvtxReso(0),
+ fHistMCdcaDvtxLvtxReso(0),
+ fHistMCangleLHReso(0),
+ fHistMCdecayAngleReso(0),
+ fHistMCpointingAngleReso(0),
+ fHistMCapReso(0),
+ fHistCentrality(0),
+ fHistCentralityAC(0),
+ fHistMultiplicity(0),
+ fHistHilf1(0),
+ fHistHilf2(0),
+ fHistHilf3(0),
+ fHistHilf4(0),
+ fHistHilf5(0),
+ fHistHilf6(0),
+ fHistPtvsEtaGen(0),
+ fHistPtvsEtaAso(0),
+ fHistPtvsYGen(0),
+ fHistPtvsYAso(0),
+ fHistRap(0),
+ fHistCount(0),
+ fPIDtpcESD(0),
+ fHistTriggerStat(0),
+ fHistTriggerStatAfterEventSelection(0),
+ fHistMassHcentMult(0),
+ fHistNdim(0)
+{
+ // DefaultConstructor
+
+}
+
+//________________________________________________________________________
+AliAnalysisTaskHdibaryonLPpi::AliAnalysisTaskHdibaryonLPpi(const char *name) : AliAnalysisTaskSE(name)/*AliAnalysisTask(name, ""), fMCEvent(0)*/, fESD(0), fESDtrackCutsV0(0),
+ fESDCutsV0(0),
+ fEsdTrackCuts(0),
+ fBin(0),
+ fEvent(0x0),
+ fHistList(0),
+ fHistMassDPi(0),
+ fHistMassLPi(0),
+ fHistMassLambdaPi(0),
+ fHistMassLambda(0),
+ fHistMassLambdaPPi(0),
+ fHistMassLambdaP(0),
+ fHistMassLambdaK(0),
+ fHistMassK0onl(0),
+ fHistMassK0offl(0),
+ fHistMassK0onlC(0),
+ fHistMassK0offlC(0),
+ fHistMassPQonl(0),
+ fHistMassPQoffl(0),
+ fHistDC(0),
+ fHistArmenterosPodolanski(0),
+ fHistArmenterosPodolanskiCut(0),
+ fHistHDibaryonInvaMassGen(0),
+ fHistHDibaryonInvaMassGenRes(0),
+ fHistAntiHDibaryonInvaMassGen(0),
+ fHistHDibaryonInvaMassAso(0),
+ fHistHDibaryonInvaMassAsoReso(0),
+ fHistAntiHDibaryonInvaMassAso(0),
+ fHistCheck(0),
+ fHistHPointingAngle(0),
+ fHistMassH(0),
+ fHistMassLambdaFromH(0),
+ fHistMassLambdaFromHtLorentz(0),
+ fHistMassPpi(0),
+ fHistMassPpiReso(0),
+ fHistMassLpi(0),
+ fHistMassLP(0),
+ fHistProtonPIDBb(0),
+ fHistPionPIDBb(0),
+ fHistProtonPIDLambda(0),
+ fHistPionPIDLambda(0),
+ fHistMCdcaPvtxDvtx(0),
+ fHistMCdcaPvtxLvtx(0),
+ fHistMCdcaDvtxLvtx(0),
+ fHistMCangleLH(0),
+ fHistMCdecayAngle(0),
+ fHistMCpointingAngle(0),
+ fHistMCap(0),
+ fHistMCdcaPvtxDvtxReso(0),
+ fHistMCdcaPvtxLvtxReso(0),
+ fHistMCdcaDvtxLvtxReso(0),
+ fHistMCangleLHReso(0),
+ fHistMCdecayAngleReso(0),
+ fHistMCpointingAngleReso(0),
+ fHistMCapReso(0),
+ fHistCentrality(0),
+ fHistCentralityAC(0),
+ fHistMultiplicity(0),
+ fHistHilf1(0),
+ fHistHilf2(0),
+ fHistHilf3(0),
+ fHistHilf4(0),
+ fHistHilf5(0),
+ fHistHilf6(0),
+ fHistPtvsEtaGen(0),
+ fHistPtvsEtaAso(0),
+ fHistPtvsYGen(0),
+ fHistPtvsYAso(0),
+ fHistRap(0),
+ fHistCount(0),
+ fPIDtpcESD(0),
+ fHistTriggerStat(0),
+ fHistTriggerStatAfterEventSelection(0),
+ fHistMassHcentMult(0),
+ fHistNdim(0)
+
+{
+ // Constructor
+
+ // Define input and output slots here
+ // Input from a TChain
+ DefineInput(0, TChain::Class());
+ // Output to TList container
+ DefineOutput(1, TList::Class()); //full
+
+ //MC info contol
+ if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())SetHasMC();
+
+ //V0 cuts
+
+ fESDtrackCutsV0 = new AliESDtrackCuts("AliESDtrackCutsV0","AliESDtrackCutsV0");
+ fESDtrackCutsV0->SetAcceptKinkDaughters(kFALSE);
+ fESDtrackCutsV0->SetMinNClustersTPC(80);
+ fESDtrackCutsV0->SetMaxChi2PerClusterTPC(5);
+ fESDtrackCutsV0->SetRequireTPCRefit(kTRUE);
+ fESDtrackCutsV0->SetEtaRange(-0.9,0.9);
+ fESDtrackCutsV0->SetPtRange(0.2,1.5);
+ fESDtrackCutsV0->SetMinDCAToVertexXY(3);
+ fESDtrackCutsV0->SetMinDCAToVertexZ(3);
+
+ fESDCutsV0 = new AliESDv0Cuts("AliESDCutsV0","AliESDCutsV0");
+ fESDCutsV0->SetMaxDcaV0Daughters(1.0);
+ fESDCutsV0->SetMinDcaNegToVertex(2.0);
+ fESDCutsV0->SetMinDcaPosToVertex(2.0);
+
+ //ESD Track cuts
+ fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
+ fEsdTrackCuts->SetMinNClustersTPC(80);
+ fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
+ fEsdTrackCuts->SetMaxChi2PerClusterTPC(5);
+ fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
+ fEsdTrackCuts->SetEtaRange(-0.9,0.9);
+}
+
+//____________________________________________________________
+AliAnalysisTaskHdibaryonLPpi::~AliAnalysisTaskHdibaryonLPpi(){
+ //
+ // Destructor
+ //
+ if(fHistList){
+ fHistList->Clear();
+ delete fHistList;
+ }
+ if(fEsdTrackCuts) delete fEsdTrackCuts;
+ if(fESDtrackCutsV0) delete fESDtrackCutsV0;
+ if(fESDCutsV0) delete fESDCutsV0;
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHdibaryonLPpi::UserCreateOutputObjects()
+{
+ // Create histograms
+ // Called once
+
+ fHistList = new TList();
+
+ fHistMassDPi = new TH1F("fHistMassDPi", "Invariant mass distribution p+#pi^{-} ", 500, 1.0, 1.25);
+ fHistMassDPi->GetXaxis()->SetTitle("Invariant mass p+#pi^{-} (GeV/c^{2})");
+ fHistMassDPi->GetYaxis()->SetTitle("Entries");
+ fHistMassDPi->SetMarkerStyle(kFullCircle);
+
+ fHistMassLPi = new TH1F("fHistMassLPi", "Offline Invariant mass distribution p+#pi^{-} ", 500, 1.0, 1.25);
+ fHistMassLPi->GetXaxis()->SetTitle("Invariant mass p+#pi^{-} (GeV/c^{2})");
+ fHistMassLPi->GetYaxis()->SetTitle("Entries");
+ fHistMassLPi->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambdaPi = new TH1F("fHistMassLambdaPi", "Invariant mass distribution #Lambda+#pi^{-} ", 500, 1.2, 1.5);
+ fHistMassLambdaPi->GetXaxis()->SetTitle("Invariant mass #Lambda+#pi^{-} (GeV/c^{2})");
+ fHistMassLambdaPi->GetYaxis()->SetTitle("Entries");
+ fHistMassLambdaPi->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambda = new TH1F("fHistMassLambda", "Invariant mass distribution of #Lambda for further analyis", 500, 1.0, 1.2);
+ fHistMassLambda->GetXaxis()->SetTitle("Invariant mass p+#pi^{+} (GeV/c^{2})");
+ fHistMassLambda->GetYaxis()->SetTitle("Entries");
+ fHistMassLambda->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambdaPPi = new TH1F("fHistMassLambdaPPi", "Invariant mass distribution #Lambdap#pi^{-} ", 300, 2.2, 2.5);
+ fHistMassLambdaPPi->GetXaxis()->SetTitle("Invariant mass #Lambdap#pi^{-} (GeV/c^{2})");
+ fHistMassLambdaPPi->GetYaxis()->SetTitle("Entries");
+ fHistMassLambdaPPi->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambdaP = new TH1F("fHistMassLambdaP", "Invariant mass distribution #Lambdap ", 300, 2.2, 2.5);
+ fHistMassLambdaP->GetXaxis()->SetTitle("Invariant mass #Lambdap (GeV/c^{2})");
+ fHistMassLambdaP->GetYaxis()->SetTitle("Entries");
+ fHistMassLambdaP->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambdaK = new TH1F("fHistMassLambdaK", "Invariant mass distribution #LambdaK^{-} ", 300, 1.6, 1.9);
+ fHistMassLambdaK->GetXaxis()->SetTitle("Invariant mass #LambdaK^{-} (GeV/c^{2})");
+ fHistMassLambdaK->GetYaxis()->SetTitle("Entries");
+ fHistMassLambdaK->SetMarkerStyle(kFullCircle);
+
+ fHistMassK0onl = new TH1F("fHistMassK0onl", "Invariant mass distribution K_{s}^{0} online V0 finder ", 400, 0.2, 1.0);
+ fHistMassK0onl->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");
+ fHistMassK0onl->GetYaxis()->SetTitle("Entries");
+ fHistMassK0onl->SetMarkerStyle(kFullCircle);
+
+ fHistMassK0offl = new TH1F("fHistMassK0offl", "Invariant mass distribution K_{s}^{0} offline V0 finder ", 400, 0.2, 1.0);
+ fHistMassK0offl->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");
+ fHistMassK0offl->GetYaxis()->SetTitle("Entries");
+ fHistMassK0offl->SetMarkerStyle(kFullCircle);
+
+ fHistMassK0onlC = new TH1F("fHistMassK0onlC", "Invariant mass distribution K_{s}^{0} online V0 finder ", 400, 0.2, 1.0);
+ fHistMassK0onlC->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");
+ fHistMassK0onlC->GetYaxis()->SetTitle("Entries");
+ fHistMassK0onlC->SetMarkerStyle(kFullCircle);
+
+ fHistMassK0offlC = new TH1F("fHistMassK0offlC", "Invariant mass distribution K_{s}^{0} offline V0 finder ", 400, 0.2, 1.0);
+ fHistMassK0offlC->GetXaxis()->SetTitle("Invariant mass #pi^{+}#pi^{-} (GeV/c^{2})");
+ fHistMassK0offlC->GetYaxis()->SetTitle("Entries");
+ fHistMassK0offlC->SetMarkerStyle(kFullCircle);
+
+ fHistMassPQonl = new TH1F("fHistMassPQonl", "Invariant mass distribution K_{s}^{0}p using online V0 finder ", 500, 1.3, 2.3);
+ fHistMassPQonl->GetXaxis()->SetTitle("Invariant mass K_{s}^{0}p (GeV/c^{2})");
+ fHistMassPQonl->GetYaxis()->SetTitle("Entries");
+ fHistMassPQonl->SetMarkerStyle(kFullCircle);
+
+ fHistMassPQoffl = new TH1F("fHistMassPQoffl", "Invariant mass distribution K_{s}^{0}p using offline V0 finder ", 500, 1.3, 2.3);
+ fHistMassPQoffl->GetXaxis()->SetTitle("Invariant mass K_{s}^{0}p (GeV/c^{2})");
+ fHistMassPQoffl->GetYaxis()->SetTitle("Entries");
+ fHistMassPQoffl->SetMarkerStyle(kFullCircle);
+
+ fHistDC = new TH1F("fHistDC", "Proper decay length", 500, 0.0, 25);
+ fHistDC->GetXaxis()->SetTitle("c#tau (cm)");
+ fHistDC->GetYaxis()->SetTitle("Entries");
+ fHistDC->SetMarkerStyle(kFullCircle);
+
+ fHistArmenterosPodolanski = new TH2F("fHistArmenterosPodolanski", "Armenteros-Podolanski plot", 200,-1.0,1.0, 500,0,1);
+ fHistArmenterosPodolanski->GetXaxis()->SetTitle("#alpha");
+ fHistArmenterosPodolanski->GetYaxis()->SetTitle("q_{t}");
+ fHistArmenterosPodolanski->SetMarkerStyle(kFullCircle);
+
+ fHistArmenterosPodolanskiCut = new TH2F("fHistArmenterosPodolanskiCut", "Armenteros-Podolanski plot after cut", 200,-1.0,1.0, 500,0,1);
+ fHistArmenterosPodolanskiCut->GetXaxis()->SetTitle("#alpha");
+ fHistArmenterosPodolanskiCut->GetYaxis()->SetTitle("q_{t}");
+ fHistArmenterosPodolanskiCut->SetMarkerStyle(kFullCircle);
+
+ fHistHDibaryonInvaMassGen = new TH1F("fHistHDibaryonInvaMassGen", "Generated #Lambda p #pi^{-}", 200, 2.1, 2.3);
+ fHistHDibaryonInvaMassGen->GetYaxis()->SetTitle("Counts");
+ fHistHDibaryonInvaMassGen->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");
+
+ fHistHDibaryonInvaMassGenRes = new TH1F("fHistHDibaryonInvaMassGenRes", "Generated #Lambda p #pi^{-} with particles in rapidity!!!", 200, 2.1, 2.3);
+ fHistHDibaryonInvaMassGenRes->GetYaxis()->SetTitle("Counts");
+ fHistHDibaryonInvaMassGenRes->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");
+
+ fHistAntiHDibaryonInvaMassGen = new TH1F("fHistAntiHDibaryonInvaMassGen", "Generated #bar{#Lambda} #bar{p} #pi^{+}", 200, 2.1, 2.3);
+ fHistAntiHDibaryonInvaMassGen->GetYaxis()->SetTitle("Counts");
+ fHistAntiHDibaryonInvaMassGen->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");
+
+ fHistHDibaryonInvaMassAso = new TH1F("fHistHDibaryonInvaMassAso", "Associated #Lambda p #pi^{-}", 200, 2.1, 2.3);
+ fHistHDibaryonInvaMassAso->GetYaxis()->SetTitle("Counts");
+ fHistHDibaryonInvaMassAso->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");
+
+ fHistHDibaryonInvaMassAsoReso = new TH1F("fHistHDibaryonInvaMassAsoReso", "Associated #Lambda p #pi^{-}", 200, 2.1, 2.3);
+ fHistHDibaryonInvaMassAsoReso->GetYaxis()->SetTitle("Counts");
+ fHistHDibaryonInvaMassAsoReso->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");
+
+ fHistAntiHDibaryonInvaMassAso = new TH1F("fHistAntiHDibaryonInvaMassAso", "Associated #bar{#Lambda} #bar{p} #pi^{+}", 200, 2.1, 2.3);
+ fHistAntiHDibaryonInvaMassAso->GetYaxis()->SetTitle("Counts");
+ fHistAntiHDibaryonInvaMassAso->GetXaxis()->SetTitle("Invariant mass (GeV/c^{2})");
+
+ fHistCheck = new TH2F("fHistCheck", "Check online/offline", 200, -0.5, 1.5, 200, -0.5, 1.5);
+ fHistCheck->GetXaxis()->SetTitle("offline");
+ fHistCheck->GetYaxis()->SetTitle("online");
+ fHistCheck->SetMarkerStyle(kFullCircle);
+
+ fHistHPointingAngle= new TH1F("fHistHPointingAngle", "Pointing angle distribution for #Lambdap#pi^{-}", 200, 0., 2*TMath::Pi());
+ fHistHPointingAngle->GetXaxis()->SetTitle("Pointing angle distribution for #Lambdap#pi^{-}");
+ fHistHPointingAngle->GetYaxis()->SetTitle("Entries");
+ fHistHPointingAngle->SetMarkerStyle(kFullCircle);
+
+ fHistMassH= new TH1F("fHistMassH", "Invariant mass distribution #Lambdap#pi^{-} (GeV/c^{2}) after pointing angle cut", 3000, 2.2, 2.5);
+ fHistMassH->GetXaxis()->SetTitle("Invariant mass #Lambdap#pi^{-} (GeV/c^{2})");
+ fHistMassH->GetYaxis()->SetTitle("Entries");
+ fHistMassH->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambdaFromH= new TH1F("fHistMassLambdaFromH", "Invariant mass distribution #Lambda (GeV/c^{2}) asking for Mother to be H", 300, 1.0, 1.3);
+ fHistMassLambdaFromH->GetXaxis()->SetTitle("Invariant mass #Lambda (GeV/c^{2})");
+ fHistMassLambdaFromH->GetYaxis()->SetTitle("Entries");
+ fHistMassLambdaFromH->SetMarkerStyle(kFullCircle);
+
+ fHistMassLambdaFromHtLorentz= new TH1F("fHistMassLambdaFromHtLorentz", "Invariant mass distribution #Lambda (GeV/c^{2}) asking for Mother to be H", 300, 1.0, 1.3);
+ fHistMassLambdaFromHtLorentz->GetXaxis()->SetTitle("Invariant mass #Lambda (GeV/c^{2})");
+ fHistMassLambdaFromHtLorentz->GetYaxis()->SetTitle("Entries");
+ fHistMassLambdaFromHtLorentz->SetMarkerStyle(kFullCircle);
+
+ fHistMassPpi= new TH1F("fHistMassPpi", "Invariant mass distribution of the p#pi^{-} used for combing with Lambda", 300, 1.0, 1.6);
+ fHistMassPpi->GetXaxis()->SetTitle("Invariant mass p#pi^{-} (GeV/c^{2})");
+ fHistMassPpi->GetYaxis()->SetTitle("Entries");
+ fHistMassPpi->SetMarkerStyle(kFullCircle);
+
+ fHistMassPpiReso= new TH1F("fHistMassPpiReso", "Invariant mass distribution of the p#pi^{-} used for combing with Lambda", 300, 1.0, 1.6);
+ fHistMassPpiReso->GetXaxis()->SetTitle("Invariant mass p#pi^{-} (GeV/c^{2})");
+ fHistMassPpiReso->GetYaxis()->SetTitle("Entries");
+ fHistMassPpiReso->SetMarkerStyle(kFullCircle);
+
+ fHistMassLpi= new TH1F("fHistMassLpi", "Invariant mass distribution of the #Lambda#pi^{-} used for combing with p", 300, 1.1, 1.7);
+ fHistMassLpi->GetXaxis()->SetTitle("Invariant mass #Lambda#pi^{-} (GeV/c^{2})");
+ fHistMassLpi->GetYaxis()->SetTitle("Entries");
+ fHistMassLpi->SetMarkerStyle(kFullCircle);
+
+ fHistMassLP= new TH1F("fHistMassLP", "Invariant mass distribution of the #Lambda p used for combing with #pi^{-}", 300, 2.0, 2.3);
+ fHistMassLP->GetXaxis()->SetTitle("Invariant mass #Lambda p (GeV/c^{2})");
+ fHistMassLP->GetYaxis()->SetTitle("Entries");
+ fHistMassLP->SetMarkerStyle(kFullCircle);
+
+ fHistProtonPIDBb = new TH2F("fHistProtonPIDBb", "dE/dx after p PID", 100, 0., 10, 100, 0, 100);
+ fHistProtonPIDBb->GetYaxis()->SetTitle("TPC Signal");
+ fHistProtonPIDBb->GetXaxis()->SetTitle("P (GeV/c)");
+ fHistProtonPIDBb->SetOption("scat");
+ fHistProtonPIDBb->SetMarkerStyle(kFullCircle);
+
+ fHistPionPIDBb = new TH2F("fHistPionPIDBb", "dE/dx after K PID", 100, 0., 10, 100, 0, 100);
+ fHistPionPIDBb->GetYaxis()->SetTitle("TPC Signal");
+ fHistPionPIDBb->GetXaxis()->SetTitle("P (GeV/c)");
+ fHistPionPIDBb->SetOption("scat");
+ fHistPionPIDBb->SetMarkerStyle(kFullCircle);
+
+ fHistProtonPIDLambda = new TH2F("fHistProtonPIDLambda", "dE/dx after p PID from V0", 100, 0., 10, 100, 0, 100);
+ fHistProtonPIDLambda->GetYaxis()->SetTitle("TPC Signal");
+ fHistProtonPIDLambda->GetXaxis()->SetTitle("P (GeV/c)");
+ fHistProtonPIDLambda->SetOption("scat");
+ fHistProtonPIDLambda->SetMarkerStyle(kFullCircle);
+
+ fHistPionPIDLambda = new TH2F("fHistPionPIDLambda", "dE/dx after #pi PID from V0", 100, 0, 10, 100, 0, 100);
+ fHistPionPIDLambda->GetYaxis()->SetTitle("TPC Signal");
+ fHistPionPIDLambda->GetXaxis()->SetTitle("P (GeV/c)");
+ fHistPionPIDLambda->SetOption("scat");
+ fHistPionPIDLambda->SetMarkerStyle(kFullCircle);
+
+ fHistMCdcaPvtxDvtx= new TH1F("fHistMCdcaPvtxDvtx", "MC True DCA Primary Vertex - H Decay Vertex", 300, -0.1, 11.9);
+ fHistMCdcaPvtxDvtx->GetXaxis()->SetTitle("dca prim. vtx- decay vtx (cm)");
+ fHistMCdcaPvtxDvtx->GetYaxis()->SetTitle("Entries");
+ fHistMCdcaPvtxDvtx->SetMarkerStyle(kFullCircle);
+
+ fHistMCdcaPvtxLvtx= new TH1F("fHistMCdcaPvtxLvtx", "MC True DCA Primary Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);
+ fHistMCdcaPvtxLvtx->GetXaxis()->SetTitle("dca prim. vtx-#Lambda decay vtx (cm)");
+ fHistMCdcaPvtxLvtx->GetYaxis()->SetTitle("Entries");
+ fHistMCdcaPvtxLvtx->SetMarkerStyle(kFullCircle);
+
+ fHistMCdcaDvtxLvtx= new TH1F("fHistMCdcaDvtxLvtx", "MC True DCA H Decay Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);
+ fHistMCdcaDvtxLvtx->GetXaxis()->SetTitle("dca H deacy vtx-#Lambda decay vtx (cm)");
+ fHistMCdcaDvtxLvtx->GetYaxis()->SetTitle("Entries");
+ fHistMCdcaDvtxLvtx->SetMarkerStyle(kFullCircle);
+
+ fHistMCangleLH= new TH1F("fHistMCangleLH", "MC True Angle between #Lambda and H", 300, 0., 2*TMath::Pi());
+ fHistMCangleLH->GetXaxis()->SetTitle("Angle (#Lambda-H)");
+ fHistMCangleLH->GetYaxis()->SetTitle("Entries");
+ fHistMCangleLH->SetMarkerStyle(kFullCircle);
+
+ fHistMCdecayAngle= new TH1F("fHistMCdecayAngle", "MC True Angle between decay products", 300, 0., 2*TMath::Pi());
+ fHistMCdecayAngle->GetXaxis()->SetTitle("Angle (#Lambda-p#pi)");
+ fHistMCdecayAngle->GetYaxis()->SetTitle("Entries");
+ fHistMCdecayAngle->SetMarkerStyle(kFullCircle);
+
+ fHistMCpointingAngle= new TH1F("fHistMCpointingAngle", "MC True Pointing Angle", 3000, 0., 2*TMath::Pi());
+ fHistMCpointingAngle->GetXaxis()->SetTitle("Pointing Angle");
+ fHistMCpointingAngle->GetYaxis()->SetTitle("Entries");
+ fHistMCpointingAngle->SetMarkerStyle(kFullCircle);
+
+ fHistMCap = new TH2F("fHistMCap", "True MC Armenteros-Podolanski", 200,-1.0,1.0, 500,0,1);
+ fHistMCap->GetYaxis()->SetTitle("#alpha");
+ fHistMCap->GetXaxis()->SetTitle("q_{t}");
+ fHistMCap->SetOption("scat");
+ fHistMCap->SetMarkerStyle(kFullCircle);
+
+ fHistMCdcaPvtxDvtxReso= new TH1F("fHistMCdcaPvtxDvtxReso", "MC True DCA Primary Vertex - H Decay Vertex", 300, -0.1, 11.9);
+ fHistMCdcaPvtxDvtxReso->GetXaxis()->SetTitle("dca prim. vtx- decay vtx (cm)");
+ fHistMCdcaPvtxDvtxReso->GetYaxis()->SetTitle("Entries");
+ fHistMCdcaPvtxDvtxReso->SetMarkerStyle(kFullCircle);
+
+ fHistMCdcaPvtxLvtxReso= new TH1F("fHistMCdcaPvtxLvtxReso", "MC True DCA Primary Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);
+ fHistMCdcaPvtxLvtxReso->GetXaxis()->SetTitle("dca prim. vtx-#Lambda decay vtx (cm)");
+ fHistMCdcaPvtxLvtxReso->GetYaxis()->SetTitle("Entries");
+ fHistMCdcaPvtxLvtxReso->SetMarkerStyle(kFullCircle);
+
+ fHistMCdcaDvtxLvtxReso= new TH1F("fHistMCdcaDvtxLvtxReso", "MC True DCA H Decay Vertex - Lambda Decay Vertex", 300, -0.1, 11.9);
+ fHistMCdcaDvtxLvtxReso->GetXaxis()->SetTitle("dca H deacy vtx-#Lambda decay vtx (cm)");
+ fHistMCdcaDvtxLvtxReso->GetYaxis()->SetTitle("Entries");
+ fHistMCdcaDvtxLvtxReso->SetMarkerStyle(kFullCircle);
+
+ fHistMCangleLHReso= new TH1F("fHistMCangleLHReso", "MC True Angle between #Lambda and H", 300, 0., 2*TMath::Pi());
+ fHistMCangleLHReso->GetXaxis()->SetTitle("Angle (#Lambda-H)");
+ fHistMCangleLHReso->GetYaxis()->SetTitle("Entries");
+ fHistMCangleLHReso->SetMarkerStyle(kFullCircle);
+
+ fHistMCdecayAngleReso= new TH1F("fHistMCdecayAngleReso", "MC True Angle between decay products", 300, 0., 2*TMath::Pi());
+ fHistMCdecayAngleReso->GetXaxis()->SetTitle("Angle (#Lambda-p#pi)");
+ fHistMCdecayAngleReso->GetYaxis()->SetTitle("Entries");
+ fHistMCdecayAngleReso->SetMarkerStyle(kFullCircle);
+
+ fHistMCpointingAngleReso= new TH1F("fHistMCpointingAngleReso", "MC True Pointing Angle", 300, 0., 2*TMath::Pi());
+ fHistMCpointingAngleReso->GetXaxis()->SetTitle("Pointing Angle");
+ fHistMCpointingAngleReso->GetYaxis()->SetTitle("Entries");
+ fHistMCpointingAngleReso->SetMarkerStyle(kFullCircle);
+
+ fHistMCapReso = new TH2F("fHistMCapReso", "True MC Armenteros-Podolanski", 200,-1.0,1.0, 500,0,1);
+ fHistMCapReso->GetYaxis()->SetTitle("#alpha");
+ fHistMCapReso->GetXaxis()->SetTitle("q_{t}");
+ fHistMCapReso->SetOption("scat");
+ fHistMCapReso->SetMarkerStyle(kFullCircle);
+
+ fHistCentrality = new TH1F("Centrality ", "Centrality", 11, -0.5, 10.5);
+ fHistCentrality ->GetXaxis()->SetTitle("Centrality");
+ fHistCentrality ->GetYaxis()->SetTitle("Entries");
+
+ fHistCentralityAC = new TH1F("CentralityAC ", "CentralityAC", 11, -0.5, 10.5);
+ fHistCentralityAC ->GetXaxis()->SetTitle("Centrality");
+ fHistCentralityAC ->GetYaxis()->SetTitle("Entries");
+
+ fHistMultiplicity = new TH1F("Multiplicity ", "Multiplicity", 100, 0, 20000);
+ fHistMultiplicity ->GetXaxis()->SetTitle("Centrality");
+ fHistMultiplicity ->GetYaxis()->SetTitle("Entries");
+
+ fHistList->Add(fHistMassDPi);
+ fHistList->Add(fHistMassLPi);
+ fHistList->Add(fHistMassLambdaPi);
+ fHistList->Add(fHistMassLambda);
+ fHistList->Add(fHistMassLambdaPPi);
+ fHistList->Add(fHistMassLambdaP);
+ fHistList->Add(fHistMassLambdaK);
+ fHistList->Add(fHistMassK0onl);
+ fHistList->Add(fHistMassK0offl);
+ fHistList->Add(fHistMassK0onlC);
+ fHistList->Add(fHistMassK0offlC);
+ fHistList->Add(fHistMassPQonl);
+ fHistList->Add(fHistMassPQoffl);
+ fHistList->Add(fHistDC);
+ fHistList->Add(fHistArmenterosPodolanski);
+ fHistList->Add(fHistArmenterosPodolanskiCut);
+ fHistList->Add(fHistHDibaryonInvaMassGen);
+ fHistList->Add(fHistHDibaryonInvaMassGenRes);
+ fHistList->Add(fHistAntiHDibaryonInvaMassGen);
+ fHistList->Add(fHistHDibaryonInvaMassAso);
+ fHistList->Add(fHistHDibaryonInvaMassAsoReso);
+ fHistList->Add(fHistAntiHDibaryonInvaMassAso);
+ fHistList->Add(fHistCheck);
+ fHistList->Add(fHistHPointingAngle);
+ fHistList->Add(fHistMassH);
+ fHistList->Add(fHistMassPpi);
+ fHistList->Add(fHistMassPpiReso);
+ fHistList->Add(fHistMassLpi);
+ fHistList->Add(fHistMassLP);
+ fHistList->Add(fHistMassLambdaFromH);
+ fHistList->Add(fHistMassLambdaFromHtLorentz);
+ fHistList->Add(fHistProtonPIDBb);
+ fHistList->Add(fHistPionPIDBb);
+ fHistList->Add(fHistProtonPIDLambda);
+ fHistList->Add(fHistPionPIDLambda);
+ fHistList->Add(fHistMCdcaPvtxDvtx);
+ fHistList->Add(fHistMCdcaPvtxLvtx);
+ fHistList->Add(fHistMCdcaDvtxLvtx);
+ fHistList->Add(fHistMCangleLH);
+ fHistList->Add(fHistMCdecayAngle);
+ fHistList->Add(fHistMCpointingAngle);
+ fHistList->Add(fHistMCap);
+ fHistList->Add(fHistMCdcaPvtxDvtxReso);
+ fHistList->Add(fHistMCdcaPvtxLvtxReso);
+ fHistList->Add(fHistMCdcaDvtxLvtxReso);
+ fHistList->Add(fHistMCangleLHReso);
+ fHistList->Add(fHistMCdecayAngleReso);
+ fHistList->Add(fHistMCpointingAngleReso);
+ fHistList->Add(fHistMCapReso);
+ fHistList->Add(fHistCentrality);
+ fHistList->Add(fHistCentralityAC);
+ fHistList->Add(fHistMultiplicity);
+
+ fHistHilf1= new TH1F("fHistHilf1", "HD", 300, 0., 10);
+ fHistHilf1->GetXaxis()->SetTitle("");
+ fHistHilf1->GetYaxis()->SetTitle("Entries");
+
+ fHistHilf2= new TH1F("fHistHilf2", "HD", 300, 0., 10);
+ fHistHilf2->GetXaxis()->SetTitle("");
+ fHistHilf2->GetYaxis()->SetTitle("Entries");
+
+ fHistHilf3= new TH1F("fHistHilf3", "HD", 300, 0., 10);
+ fHistHilf3->GetXaxis()->SetTitle("");
+ fHistHilf3->GetYaxis()->SetTitle("Entries");
+
+ fHistHilf4= new TH1F("fHistHilf4", "HD", 300, 0., 10);
+ fHistHilf4->GetXaxis()->SetTitle("");
+ fHistHilf4->GetYaxis()->SetTitle("Entries");
+
+ fHistHilf5= new TH1F("fHistHilf5", "HD", 300, 0., 10);
+ fHistHilf5->GetXaxis()->SetTitle("");
+ fHistHilf5->GetYaxis()->SetTitle("Entries");
+
+ fHistHilf6= new TH1F("fHistHilf6", "HD", 300, 0., 10);
+ fHistHilf6->GetXaxis()->SetTitle("");
+ fHistHilf6->GetYaxis()->SetTitle("Entries");
+
+ fHistPtvsEtaGen = new TH2F("fHistPtvsEtaGen", "p_{t} vs #eta from generated H", 200,0.0,10.0, 200,-1,1);
+ fHistPtvsEtaGen->GetXaxis()->SetTitle("p_{t} (GeV/c)");
+ fHistPtvsEtaGen->GetYaxis()->SetTitle("#eta");
+ fHistPtvsEtaGen->SetOption("scat");
+ fHistPtvsEtaGen->SetMarkerStyle(kFullCircle);
+
+ fHistPtvsEtaAso = new TH2F("fHistPtvsEtaAso", "p_{t} vs #eta from associated H", 200,0.0,10.0, 200,-1,1);
+ fHistPtvsEtaAso->GetYaxis()->SetTitle("p_{t} (GeV/c)");
+ fHistPtvsEtaAso->GetXaxis()->SetTitle("#eta");
+ fHistPtvsEtaAso->SetOption("scat");
+ fHistPtvsEtaAso->SetMarkerStyle(kFullCircle);
+
+ fHistPtvsYGen = new TH2F("fHistPtvsYGen", "p_{t} vs rapidity from generated H", 200,0.0,10.0, 200,-1,1);
+ fHistPtvsYGen->GetXaxis()->SetTitle("p_{t} (GeV/c)");
+ fHistPtvsYGen->GetYaxis()->SetTitle("y");
+ fHistPtvsYGen->SetOption("scat");
+ fHistPtvsYGen->SetMarkerStyle(kFullCircle);
+
+ fHistPtvsYAso = new TH2F("fHistPtvsYAso", "p_{t} vs rapidity from associated H", 200,0.0,10.0, 200,-1,1);
+ fHistPtvsYAso->GetXaxis()->SetTitle("p_{t} (GeV/c)");
+ fHistPtvsYAso->GetYaxis()->SetTitle("y");
+ fHistPtvsYAso->SetOption("scat");
+ fHistPtvsYAso->SetMarkerStyle(kFullCircle);
+
+ fHistRap= new TH1F("fHistRap", "Rapidity", 400, -2., 2);
+ fHistRap->GetXaxis()->SetTitle("Y");
+ fHistRap->GetYaxis()->SetTitle("Entries");
+ fHistPtvsEtaAso->SetMarkerStyle(kFullCircle);
+
+ fHistList->Add(fHistHilf1);
+ fHistList->Add(fHistHilf2);
+ fHistList->Add(fHistHilf3);
+ fHistList->Add(fHistHilf4);
+ fHistList->Add(fHistHilf5);
+ fHistList->Add(fHistHilf6);
+ fHistList->Add(fHistPtvsEtaGen);
+ fHistList->Add(fHistPtvsEtaAso);
+ fHistList->Add(fHistPtvsYGen);
+ fHistList->Add(fHistPtvsYAso);
+ fHistList->Add(fHistRap);
+
+ fHistCount = new TH1F("fHistCount","test",17,0,17);
+ fHistCount->GetXaxis()->SetBinLabel(1,"Events");
+ fHistCount->GetXaxis()->SetBinLabel(2,"MC All");
+ fHistCount->GetXaxis()->SetBinLabel(3,"MC from Primary Vtx");
+ fHistCount->GetXaxis()->SetBinLabel(4,"Horst");
+ fHistCount->GetXaxis()->SetBinLabel(5,"Lambda Candidates");
+ fHistCount->GetXaxis()->SetBinLabel(6,"Sigma Candidates");
+ fHistCount->GetXaxis()->SetBinLabel(7,"Horst");
+ fHistCount->GetXaxis()->SetBinLabel(8,"Horst");
+ fHistCount->GetXaxis()->SetBinLabel(9,"Horst");
+ fHistCount->GetXaxis()->SetBinLabel(10,"MC All #bar{Lambda}(1520)s");
+ fHistCount->GetXaxis()->SetBinLabel(11,"");
+ fHistCount->GetXaxis()->SetBinLabel(12,"H-Dibaryon");
+ fHistCount->GetXaxis()->SetBinLabel(13,"Hypertriton 2-Body");
+ fHistCount->GetXaxis()->SetBinLabel(14,"Hypertriton 3-Body");
+ fHistCount->GetXaxis()->SetBinLabel(15,"");
+ fHistCount->GetXaxis()->SetBinLabel(16,"");
+ fHistCount->GetXaxis()->SetBinLabel(17,"Lambdas!!!");
+ fHistCount->SetStats(0);
+ fHistCount->SetFillColor(38);
+ fHistList->Add(fHistCount);
+
+ //trigger statistics histogram
+ fHistTriggerStat = new TH1F("fHistTriggerStat","Trigger statistics", 4,-0.5, 3.5);
+ const Char_t* aTriggerNames[] = { "kMB", "kCentral", "kSemiCentral" };
+ for ( Int_t ii=0; ii < 3; ii++ )
+ fHistTriggerStat->GetXaxis()->SetBinLabel(ii+1, aTriggerNames[ii]);
+
+ fHistTriggerStatAfterEventSelection = new TH1F("fHistTriggerStatAfterEventSelection","Trigger statistics after event selection", 4,-0.5, 3.5);
+ for ( Int_t ii=0; ii < 3; ii++ )
+ fHistTriggerStatAfterEventSelection->GetXaxis()->SetBinLabel(ii+1, aTriggerNames[ii]);
+ fHistList->Add(fHistTriggerStat);
+ fHistList->Add(fHistTriggerStatAfterEventSelection);
+
+ fHistMassHcentMult = new TH3F("fHistMassHcentMult", "Inv. Mass vs. centrality vs. multiplicity", 100, 2.2, 2.3, 5, 0, 4, 300, 0, 6000);
+ fHistMassHcentMult->GetXaxis()->SetTitle("Invariant mass #Lambdap#pi^{-} (GeV/c^{2})"); // inv. mass
+ fHistMassHcentMult->GetYaxis()->SetTitle("Centrality"); // triggertype
+ fHistMassHcentMult->GetZaxis()->SetTitle("Multiplicity"); // refTPC
+ fHistList->Add(fHistMassHcentMult);
+
+
+ const Double_t kz = 2*TMath::Pi();
+ Int_t binsD01[16]={ 300, 200, 100, 100, 100, 100, 100, 100, 200, 200, 200, 200, 400, 200, 200, 3};
+ Double_t xminD01[16]={2.0, 1.0, 0., -1, 0., 0., 0., 0., 0., 0., 0., 0., -1, 0., 0., 0};
+ Double_t xmaxD01[16]={2.3, 1.2, kz, 1, 1, 10, 10, 5, 5, 5, 5, 100, 1, 100, 4000, 1};
+
+
+ fHistNdim = new THnSparseF("fHistNdim","THnS;InvMass, InvMassLambda, pointingAngle, armPoAlpha, armPoQt, pTL, pTH, d0p, d0n, dcaHd, dca, decayL, cosPA, centr, multi, mcinf;InvMassH", 16,binsD01,xminD01,xmaxD01);
+ fHistList->Add(fHistNdim);
+}
+
+ //________________________________________________________________________
+void AliAnalysisTaskHdibaryonLPpi::UserExec(Option_t *)
+{
+ // Main loop
+ // Called for each event
+
+ //define improtant masses
+ Double_t pionMass = 0.13957;
+ Double_t protonMass = 0.93827;
+
+ //define PDGCodes
+ Long_t pdgPionPlus = 211;
+ Long_t pdgPionMinus = -211;
+ Long_t pdgProton = 2212;
+ Long_t pdgAntiProton = -2212;
+ Long_t pdgLambda = 3122;
+ Long_t pdgAntiLambda = -3122;
+ Long_t pdgHDibaryon = 1020000020;
+ Long_t pdgAntiHDibaryon = -1020000020;
+
+ AliStack* stack(NULL);
+ if(HasMC()){
+
+ if(!fMCEvent)return;
+
+ AliHeader *head = fMCEvent->Header();
+ if(!head)return;
+ AliGenPythiaEventHeader *pyheader = (AliGenPythiaEventHeader*)head->GenEventHeader();
+ if(!pyheader)return;
+
+ if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()){
+ if(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()){
+ if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->TreeK()))return;
+ if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->TreeTR()))return;
+ if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->Init("local")))return;
+ stack = static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack();
+ if(!(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack()->TreeK()))return;
+ }
+ }
+
+ if(!stack)return;
+ }
+
+ // -------------------------------------------------------
+ // Loop for Inv. Mass via ESD tracks
+ // -------------------------------------------------------
+
+ fHistCount->Fill(0);
+
+ fESD = dynamic_cast<AliESDEvent *>(fInputEvent);
+
+ const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks();
+ if (vertex->GetNContributors()<1)
+ {
+ // SPD vertex
+ vertex = fESD->GetPrimaryVertexSPD();
+ if(vertex->GetNContributors()<1) {
+ return;
+ }
+ }
+ if (TMath::Abs(vertex->GetZv()) > 10) return;
+
+ Int_t centrality = -5;
+ Double_t centrPerc = -5;
+
+ if (fESD->GetEventSpecie() == 4)
+ { // PbPb
+ AliCentrality *esdCentrality = fESD->GetCentrality();
+ centrality = esdCentrality->GetCentralityClass10("V0M"); // centrality percentile determined with V0
+ centrPerc = esdCentrality->GetCentralityPercentile("V0M");
+ if (centrality < 0. || centrality > 8.) return; //0 bis 80 %
+ // cout<<"Centrality: "<< centrality << endl;
+ }
+
+ fHistCentrality->Fill(centrality);
+
+ //*****************//
+ //* Centrality *//
+ //*****************//
+
+ // Float_t percentile=centrality->GetCentralityPercentile("V0M");
+
+ Bool_t isSelectedCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral);
+ Bool_t isSelectedSemiCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral);
+ Bool_t isSelectedMB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
+
+ Int_t triggertype = 17;
+
+ if(isSelectedCentral){
+ fHistTriggerStat->Fill(1);
+ triggertype=1;
+ }
+
+ if(isSelectedSemiCentral){
+ fHistTriggerStat->Fill(2);
+ triggertype=2;
+ }
+
+ if(isSelectedMB){
+ fHistTriggerStat->Fill(0);
+ triggertype=3;
+ }
+
+ // if(isSelectedCentral || isSelectedSemiCentral || isSelectedMB){
+
+ //*******************************
+
+ Int_t runNumber = 0;
+ // itrk = 0;
+ runNumber = fESD->GetRunNumber();
+
+ if (!fPIDtpcESD) fPIDtpcESD = ((AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetESDpid();
+ if (!fPIDtpcESD) {
+ fPIDtpcESD = new AliESDpid(); // HACK FOR MC PBPB --> PLEASE REMOVE AS SOON AS POSSIBLE
+ fPIDtpcESD->GetTPCResponse().SetBetheBlochParameters(1.28778e+00/50., 3.13539e+01, TMath::Exp(-3.16327e+01), 1.87901e+00, 6.41583e+00);
+ }
+
+ Double_t pionK=1;
+ Double_t pK=1;
+
+ TObjArray* listCrossV0 = fESDCutsV0->GetAcceptedV0s(fESD);
+ Int_t nGoodV0s = listCrossV0->GetEntries();
+
+ const AliESDVertex *esdVer = fESD->GetPrimaryVertex();
+ AliESDVertex *esdVer1 = new AliESDVertex(*esdVer);
+
+ AliVertexerTracks *vertexer = new AliVertexerTracks(fESD->GetMagneticField());
+ TObjArray *trkArray = new TObjArray(2);
+ AliVertexerTracks *vertexer1 = new AliVertexerTracks(fESD->GetMagneticField());
+ TObjArray *trkArray1 = new TObjArray(2);
+
+ AliKFParticle::SetField(fESD->GetMagneticField());
+
+ AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
+
+ Int_t refMultTpc = AliESDtrackCuts::GetReferenceMultiplicity(fESD, kTRUE);
+ //cout<<"Multiplicity: "<< refMultTpc << endl;
+ fHistMultiplicity->Fill(refMultTpc);
+
+ Double_t mn[3] = {0,0,0};
+ Double_t mp[3] = {0,0,0};
+ Double_t mm[3] = {0,0,0};
+ Double_t dd[3] = {0,0,0};
+ Double_t dd1[3] = {0,0,0};
+ const Double_t cProtonMass=TDatabasePDG::Instance()->GetParticle(2212)->Mass();
+ const Double_t cPionMass=TDatabasePDG::Instance()->GetParticle(211)->Mass();
+ const Double_t cElectronMass=TDatabasePDG::Instance()->GetParticle(11)->Mass();
+ const Double_t cLambdaMass=TDatabasePDG::Instance()->GetParticle(3122)->Mass();
+ Double_t decayLength=0;
+ Double_t decayLengthH=0;
+
+ //V0 Loop for Lambda and Anti-Lambda
+ for(Int_t iV0MI = 0; iV0MI < nGoodV0s ; iV0MI++) {
+ AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);
+ Int_t lOnFlyStatus = 0;
+
+ lOnFlyStatus = fV0MIs->GetOnFlyStatus();
+ Double_t lInvMassLambda=0;
+ Double_t lInvMassLambdaPi=0;
+ Double_t lPtLambda=0;
+ Double_t lPzLambda=0;
+ Double_t lPLambda=0;
+ Int_t onl=0;
+ Int_t offl=0;
+
+ TLorentzVector posE;
+ TLorentzVector negE;
+ TLorentzVector photon;
+
+ if (lOnFlyStatus){
+ onl=1;
+ // return;
+ }
+ if (!lOnFlyStatus){
+ offl=1;
+ //return;
+ }
+
+ // fHistMultiplicity->Fill(refMultTpc);
+ fHistCentralityAC->Fill(centrality);
+ fHistCheck->Fill(offl,onl);
+
+ AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
+ AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
+
+ // if (!
+ if (!fEsdTrackCuts->AcceptTrack(trackPosTest)) continue;
+ if (!fESDtrackCutsV0->AcceptTrack(trackNegTest)) continue;
+
+
+ //PID via specific energy loss in the TPC
+ //define the arrays for the Bethe-Bloch-Parameters
+ Double_t parProton[5] = {0,0,0,0,0};
+
+ if(runNumber < 166500) //LHC10h
+ {
+ parProton[0] = 1.45802; // ALEPH parameters for protons (pass2)
+ parProton[1] = 27.4992;
+ parProton[2] = 4.00313e-15;
+ parProton[3] = 2.48485;
+ parProton[4] = 8.31768;
+ }
+
+ if(runNumber > 166500) //LHC11h
+ {
+ parProton[0] = 1.11243; // ALEPH parameters for protons (pass2)
+ parProton[1] = 26.1144;
+ parProton[2] = 4.00313e-15;
+ parProton[3] = 2.72969;
+ parProton[4] = 9.15038;
+ }
+
+ //Get the total momentum for each track at the inner readout of the TPC
+ Double_t ptotN = trackNegTest->GetInnerParam()->GetP();
+ Double_t ptotP = trackPosTest->GetInnerParam()->GetP();
+
+ //define expected signals for the various species
+ Double_t expSignalPionP = 0;
+ Double_t expSignalPionN = 0;
+ Double_t expSignalProtonN = 0;
+ Double_t expSignalProtonP = 0;
+
+ //for data
+ if(!HasMC())
+ {
+ expSignalProtonN = AliExternalTrackParam::BetheBlochAleph(ptotN/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);
+ expSignalProtonP = AliExternalTrackParam::BetheBlochAleph(ptotP/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);
+ }
+
+ //for MC
+ if(HasMC())
+ {
+ expSignalPionP = 0.7*AliExternalTrackParam::BetheBlochAleph(ptotP/(pionMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);
+ expSignalPionN = 0.7*AliExternalTrackParam::BetheBlochAleph(ptotN/(pionMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);
+
+ expSignalProtonN = 0.65*AliExternalTrackParam::BetheBlochAleph(ptotN/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);
+ expSignalProtonP = 0.65*AliExternalTrackParam::BetheBlochAleph(ptotP/(protonMass),parProton[0],parProton[1],parProton[2],parProton[3],parProton[4]);
+ }
+
+ // PID cut on the nuclei (proton, deuteron, triton, helium3)
+ Bool_t corrParticle = kFALSE;
+
+ Bool_t posProton = kFALSE;
+ //data
+ if(!HasMC())
+ {
+ if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackPosTest, AliPID::kProton)) < 3)
+ {
+ posProton = kTRUE;
+ corrParticle = kTRUE;
+ }
+ }
+ //MC
+ if(HasMC())
+ {
+ if(//trackPosTest->GetTPCsignal() < 1200 &&
+ TMath::Abs(trackPosTest->GetTPCsignal() - expSignalProtonP)/expSignalProtonP < 0.4)
+ {
+ posProton = kTRUE;
+ corrParticle = kTRUE;
+ }
+ }
+
+ Bool_t negProton = kFALSE;
+ //data
+ if(!HasMC())
+ {
+ if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackNegTest, AliPID::kProton)) < 3)
+ {
+ negProton = kTRUE;
+ corrParticle = kTRUE;
+ }
+ }
+ //MC
+ if(HasMC())
+ {
+ if(//trackNegTest->GetTPCsignal() < 1200 &&
+ TMath::Abs(trackNegTest->GetTPCsignal() - expSignalProtonN)/expSignalProtonN < 0.4)
+ {
+ negProton = kTRUE;
+ corrParticle = kTRUE;
+ }
+ }
+
+ //PID cut for pions
+ //data: 3sigma cut on the pions
+
+ Bool_t negPion = kFALSE;
+ Bool_t posPion = kFALSE;
+
+ if (!HasMC())
+ {
+ if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackPosTest, AliPID::kPion)) < 4) posPion=kTRUE; //pos daughter has to be a pion
+ if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackNegTest, AliPID::kPion)) < 4) negPion=kTRUE; // negative daughter has to be a pion
+ }
+
+ //MC: like the nuclei via the specific energyloss in the TPC
+ if (HasMC())
+ {
+ if (TMath::Abs(trackPosTest->GetTPCsignal() - expSignalPionP)/expSignalPionP < 0.4) posPion=kTRUE;
+ if (TMath::Abs(trackNegTest->GetTPCsignal() - expSignalPionN)/expSignalPionN < 0.4) negPion=kTRUE;
+ }
+
+ if (!(posProton==kTRUE)) continue;
+ if (!(negPion==kTRUE)) continue;
+
+ //To avoid ghosts
+
+ if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){
+ continue;
+ }
+
+ if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){
+ continue;
+ }
+
+ if( trackPosTest->GetSign() >0 && trackNegTest->GetSign() <0){
+ fV0MIs->GetNPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
+ fV0MIs->GetPPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
+ }
+
+ if( trackPosTest->GetSign() <0 && trackNegTest->GetSign() >0){
+ fV0MIs->GetPPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
+ fV0MIs->GetNPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
+ }
+
+ fV0MIs->GetPxPyPz(mm[0],mm[1],mm[2]); //reconstructed cartesian momentum components of mother
+
+ TVector3 vecN(mn[0],mn[1],mn[2]);
+ TVector3 vecP(mp[0],mp[1],mp[2]);
+ TVector3 vecM(mm[0],mm[1],mm[2]);
+
+ Double_t thetaP = acos((vecP * vecM)/(vecP.Mag() * vecM.Mag()));
+ Double_t thetaN = acos((vecN * vecM)/(vecN.Mag() * vecM.Mag()));
+
+ Double_t alfa = ((vecP.Mag())*cos(thetaP)-(vecN.Mag())*cos(thetaN))/
+ ((vecP.Mag())*cos(thetaP)+(vecN.Mag())*cos(thetaN)) ;
+ Double_t qt = vecP.Mag()*sin(thetaP);
+
+ fHistArmenterosPodolanski->Fill(alfa,qt); //Armenteros-Podolanski calculation
+
+ TLorentzVector k0;
+ TLorentzVector k0daugh1;
+ TLorentzVector k0daugh2;
+ TLorentzVector proton;
+ TLorentzVector pq;
+
+ k0daugh1.SetXYZM(mn[0],mn[1],mn[2],cPionMass);
+ k0daugh2.SetXYZM(mp[0],mp[1],mp[2],cPionMass);
+ k0=k0daugh1+k0daugh2;
+
+ fV0MIs->ChangeMassHypothesis(3122);
+ lInvMassLambda = fV0MIs->GetEffMass();
+ lPtLambda = fV0MIs->Pt();
+ lPzLambda = fV0MIs->Pz();
+ lPLambda = fV0MIs->P();
+
+ trkArray->AddAt(trackPosTest,0);
+ trkArray->AddAt(trackNegTest,1);
+
+ vertexer->SetVtxStart(esdVer1);
+ AliESDVertex *decayVertex = (AliESDVertex*)vertexer->VertexForSelectedESDTracks(trkArray);
+
+ dd[0]=fESD->GetPrimaryVertexSPD()->GetX()-decayVertex->GetX();
+ dd[1]=fESD->GetPrimaryVertexSPD()->GetY()-decayVertex->GetY();
+ dd[2]=fESD->GetPrimaryVertexSPD()->GetZ()-decayVertex->GetZ();
+
+ decayLength=sqrt(dd[0]*dd[0]+dd[1]*dd[1]+dd[2]*dd[2]);
+
+ if (decayVertex) delete decayVertex;
+
+ TLorentzVector negPio1;
+ TLorentzVector posProt1;
+ TLorentzVector posP;
+ TLorentzVector posProt;
+ TLorentzVector negK;
+ TLorentzVector negPio;
+ TLorentzVector negPi;
+ TLorentzVector omega;
+ TLorentzVector threeSum;
+ TLorentzVector fourSum;
+ TLorentzVector ppK;
+ TLorentzVector posPiK;
+ TLorentzVector negPiK;
+ TLorentzVector kaon;
+ TLorentzVector lambda;
+ TLorentzVector lambdaH;
+ TLorentzVector hDibaryon;
+ TVector3 h;
+ TVector3 h1;
+
+ Int_t mcStatus=0;
+
+ h.SetXYZ(-dd[0],-dd[1],-dd[2]);
+
+ if (onl==1)fHistMassDPi->Fill(lInvMassLambda);
+
+ if (offl==1||onl==1){
+ fHistMassLPi->Fill(lInvMassLambda);
+
+ negE.SetXYZM(mn[0],mn[1],mn[2],cElectronMass);
+ posE.SetXYZM(mp[0],mp[1],mp[2],cElectronMass);
+ photon=posE+negE;
+
+ negPiK.SetXYZM(mn[0],mn[1],mn[2],cPionMass);
+ posPiK.SetXYZM(mp[0],mp[1],mp[2],cPionMass);
+ kaon=posPiK+negPiK;
+
+ negPi.SetXYZM(mn[0],mn[1],mn[2],cPionMass);
+ posP.SetXYZM(mp[0],mp[1],mp[2],cProtonMass);
+ lambda=negPi+posP;
+ lambdaH.SetXYZM(mm[0],mm[1],mm[2],cLambdaMass);
+
+ if (lInvMassLambda>1.1113&&lInvMassLambda<1.1202){
+
+ if (!HasMC()){
+ if (qt<-2.21*alfa*alfa+2.945*alfa-0.887) continue;
+ if (qt>-2.21*alfa*alfa+2.945*alfa-0.873) continue;
+ if (photon.M()<0.005) continue;
+ if (kaon.M()>0.495 && kaon.M()<0.500 ) continue;
+ }
+
+
+ fHistMassLambda->Fill(lInvMassLambda);
+ //
+ Bool_t isCorrectlyAssociatedLambda = kFALSE;
+ Bool_t isPartialCorrectlyAssociatedLambda = kFALSE;
+ Int_t labelAssociatedH=-1;
+ Int_t labelLambda=-1;
+ //
+ if (HasMC()) {
+ Int_t labelPosTest = trackPosTest->GetLabel();
+ TParticle *tparticleDaughter = stack->Particle(TMath::Abs(labelPosTest));
+ Int_t labelMother = tparticleDaughter->GetFirstMother();
+ TParticle *tparticleMother = stack->Particle(TMath::Abs(labelMother));
+
+ Int_t labelOma = tparticleMother->GetFirstMother();
+ TParticle *tparticleOma = stack->Particle(TMath::Abs(labelOma));
+
+ if ((tparticleOma->GetPdgCode() < 0) && TMath::Abs(tparticleMother->GetPdgCode())==pdgLambda){// check mother to be Lambda
+ Int_t labelFirstDaughter = tparticleMother->GetDaughter(1);// Proton
+ Int_t labelThirdDaughter = tparticleMother->GetDaughter(0);// Pion
+
+ TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));
+ TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));
+
+ if((tparticleFirstDaughter->GetPdgCode() == pdgProton && tparticleThirdDaughter->GetPdgCode()== pdgPionMinus) ||
+ (tparticleFirstDaughter->GetPdgCode() == pdgPionMinus && tparticleThirdDaughter->GetPdgCode()== pdgProton)){ //daughter PDGs
+ isPartialCorrectlyAssociatedLambda = kTRUE;
+ labelLambda=labelMother;
+ }
+ }
+
+ //H-Dibaryon
+ if(tparticleOma->GetPdgCode() == pdgHDibaryon){ //check grandmother to be H PDG
+ if (TMath::Abs(tparticleMother->GetPdgCode())==pdgLambda){// check mother to be Lambda
+ Int_t labelFirstDaughter = tparticleMother->GetDaughter(1);// Proton
+ Int_t labelThirdDaughter = tparticleMother->GetDaughter(0);// Pion
+
+ TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));
+ TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));
+
+ if((tparticleFirstDaughter->GetPdgCode() == pdgProton && tparticleThirdDaughter->GetPdgCode()== pdgPionMinus) ||
+ (tparticleFirstDaughter->GetPdgCode() == pdgPionMinus && tparticleThirdDaughter->GetPdgCode()== pdgProton)){ //daughter PDGs
+ isCorrectlyAssociatedLambda = kTRUE;
+ labelAssociatedH=labelOma;
+ fHistMassLambdaFromH->Fill(lInvMassLambda);
+ fHistMassLambdaFromHtLorentz->Fill(lambda.M());
+ }
+ }
+ }
+ }
+
+ fHistProtonPIDLambda->Fill(trackPosTest->GetInnerParam()->GetP(), trackPosTest->GetTPCsignal());
+ fHistPionPIDLambda->Fill(trackNegTest->GetInnerParam()->GetP(), trackNegTest->GetTPCsignal());
+
+ //---------------------------------------------------------
+ // Proton track loop
+ //---------------------------------------------------------
+ fHistArmenterosPodolanskiCut->Fill(alfa,qt);
+
+ for (Int_t iTracksP = 0; iTracksP < fESD->GetNumberOfTracks(); iTracksP++) {
+ AliESDtrack* trackP = dynamic_cast<AliESDtrack*> (fESD->GetTrack(iTracksP));
+ if (trackP->GetSign()<0) continue;
+
+ if (iTracksP==fV0MIs->GetPindex())continue;
+ if (iTracksP==fV0MIs->GetNindex())continue;
+
+ if (!fEsdTrackCuts->AcceptTrack(trackP)) continue;
+
+ AliKFParticle protonKF( *(trackP), 2212);
+
+ if (!trackP->GetInnerParam()) continue;
+
+ if (HasMC()) {
+ pK=0.65;
+ }
+
+ if (!HasMC()){
+ if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackP, AliPID::kProton)) > 3) continue;
+ }
+
+ fHistProtonPIDBb->Fill(trackP->GetInnerParam()->GetP(), trackP->GetTPCsignal());
+
+ posProt.SetXYZM(trackP->Px(),trackP->Py(),trackP->Pz(),cProtonMass);
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //Pion Track loop!!!!!!!!!!!!!!!!!!!!!
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ for (Int_t iTracksN = iTracksP+1; iTracksN < fESD->GetNumberOfTracks(); iTracksN++) {
+ AliESDtrack* trackN = dynamic_cast<AliESDtrack*> (fESD->GetTrack(iTracksN));
+
+ if (iTracksN==fV0MIs->GetPindex())continue;
+ if (iTracksN==fV0MIs->GetNindex())continue;
+ if (trackN->GetSign()>0) continue;
+
+ if (!fEsdTrackCuts->AcceptTrack(trackN)) continue;
+ if (!fESDtrackCutsV0->AcceptTrack(trackN)) continue;
+
+ negPi.SetXYZM(mn[0],mn[1],mn[2],cPionMass);
+ posP.SetXYZM(mp[0],mp[1],mp[2],cProtonMass);
+ negPio.SetXYZM(trackN->Px(),trackN->Py(),trackN->Pz(),cPionMass);
+
+ threeSum=negPi+posP+negPio;
+ lInvMassLambdaPi=threeSum.M();
+
+ fHistDC->Fill(decayLength*lInvMassLambda/lPLambda);
+
+ AliKFParticle posPionKF( *(trackN) ,-211);
+
+ if (!trackN->GetInnerParam()) continue;
+ if (HasMC()) {
+ pionK=0.7;
+ }
+
+ if (!HasMC()){
+ if (TMath::Abs(fPIDtpcESD->NumberOfSigmasTPC(trackN, AliPID::kPion)) > 3) continue;
+ }
+ fHistPionPIDBb->Fill(trackN->GetInnerParam()->GetP(), trackN->GetTPCsignal());
+
+ trkArray1->AddAt(trackP,0);
+ trkArray1->AddAt(trackN,1);
+
+ vertexer1->SetVtxStart(esdVer1);
+ AliESDVertex *decayVertex1 = (AliESDVertex*)vertexer1->VertexForSelectedESDTracks(trkArray1);
+
+ dd1[0]=fESD->GetPrimaryVertexSPD()->GetX()-decayVertex1->GetX();
+ dd1[1]=fESD->GetPrimaryVertexSPD()->GetY()-decayVertex1->GetY();
+ dd1[2]=fESD->GetPrimaryVertexSPD()->GetZ()-decayVertex1->GetZ();
+
+ decayLengthH=sqrt(dd1[0]*dd1[0]+dd1[1]*dd1[1]+dd1[2]*dd1[2]);
+
+ Double_t bz = fESD->GetMagneticField();
+
+ trackP->PropagateToDCA(decayVertex1, bz, 10);
+ trackN->PropagateToDCA(decayVertex1, bz, 10);
+
+ Double_t xthiss(0.0);
+ Double_t xpp(0.0);
+ Double_t dca = trackN->GetDCA(trackP,bz,xthiss,xpp);
+
+ if (decayVertex1) delete decayVertex1;
+ h1.SetXYZ(-dd1[0],-dd1[1],-dd1[2]);
+
+ // if (dca>1) continue;
+ if (dca>0.1) continue;
+
+ fourSum=threeSum+posProt;
+
+ posProt1.SetXYZM(trackP->Px(),trackP->Py(),trackP->Pz(),cProtonMass);
+ negPio1.SetXYZM(trackN->Px(),trackN->Py(),trackN->Pz(),cPionMass);
+ hDibaryon=lambdaH+posProt1+negPio1;
+ Double_t hPointingAngle = hDibaryon.Angle(h);
+ Double_t pointingAngleH = hDibaryon.Angle(h1);
+ Double_t decayAngleH = h.Angle(h1);
+ TVector3 vecDist(dd[0]-dd1[0],dd[1]-dd1[1],dd[2]-dd1[2]);
+ fHistMassLambdaPPi->Fill(hDibaryon.M());
+ fHistHPointingAngle->Fill(pointingAngleH);
+
+ fHistMassHcentMult->Fill(hDibaryon.M(),triggertype,refMultTpc);
+
+ Double_t rapidity = hDibaryon.Rapidity();
+ if(rapidity > 1.0 || rapidity < -1.0) continue;
+
+ Double_t vec[16]={hDibaryon.M(), lInvMassLambda, pointingAngleH, alfa, qt, lPtLambda, hDibaryon.Pt(), posPionKF.GetDistanceFromVertex(primVtx), protonKF.GetDistanceFromVertex(primVtx), dca, protonKF.GetDistanceFromVertex(posPionKF), TMath::Cos(pointingAngleH), centrPerc, refMultTpc, mcStatus};
+ fHistNdim->Fill(vec);
+
+ fHistRap->Fill(rapidity);
+ //if (pointingAngleH > 0.1) continue;
+ if (pointingAngleH > 0.05) continue;
+
+ ///////////////////////////
+ //MC part for Associated H
+ ///////////////////////////
+
+ if (HasMC() && isCorrectlyAssociatedLambda) {
+ Int_t labelP = trackP->GetLabel();
+ TParticle *tparticleDaughter = stack->Particle(TMath::Abs(labelP));
+ Int_t labelMother = tparticleDaughter->GetFirstMother();
+ TParticle *tparticleMother = stack->Particle(TMath::Abs(labelMother));
+
+ Int_t labelProton = trackP->GetLabel();
+ Int_t labelPion = trackN->GetLabel();
+
+ //H-Dibaryon
+ if(tparticleMother->GetPdgCode() == pdgHDibaryon && labelAssociatedH==labelMother){ //check mother PDG
+ Int_t labelFirstDaughter = tparticleMother->GetDaughter(0);
+ Int_t labelThirdDaughter = tparticleMother->GetDaughter(1);
+ Int_t labelSecondDaughter = labelFirstDaughter +1;
+
+ TParticle *tparticleSecondDaughter = stack->Particle(TMath::Abs(labelSecondDaughter));
+ TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));
+
+ TLorentzVector ppi;
+ TLorentzVector lpi;
+ TLorentzVector lP;
+
+ ppi=posProt+negPio;
+ lpi=lambdaH+negPio;
+ lP=lambdaH+posProt;
+
+ if((tparticleThirdDaughter->GetPdgCode() == pdgPionMinus && labelPion==labelThirdDaughter)&&(tparticleSecondDaughter->GetPdgCode() == pdgProton||tparticleSecondDaughter->GetPdgCode() == pdgPionMinus) && labelProton==labelSecondDaughter) fHistMassPpi->Fill(ppi.M());
+
+ if(tparticleThirdDaughter->GetPdgCode() == pdgPionMinus && labelPion==labelThirdDaughter) fHistMassLpi->Fill(lpi.M());
+
+ if(tparticleSecondDaughter->GetPdgCode() == pdgProton && labelProton==labelSecondDaughter) fHistMassLP->Fill(lP.M());
+
+ if(tparticleSecondDaughter->GetPdgCode() == pdgProton && labelProton==labelSecondDaughter){//check second daughter PDG
+ if(tparticleThirdDaughter->GetPdgCode() == pdgPionMinus && labelPion==labelThirdDaughter){//check second daughter PDG
+
+ fHistHDibaryonInvaMassAso->Fill(hDibaryon.M());
+
+ Double_t distance01=vecDist.Mag();
+ fHistMCdcaPvtxDvtx->Fill(decayLengthH);
+ fHistMCdcaPvtxLvtx->Fill(decayLength);
+ fHistMCdcaDvtxLvtx->Fill(distance01);
+ fHistMCangleLH->Fill(hPointingAngle);
+ fHistMCdecayAngle->Fill(decayAngleH);
+ fHistMCpointingAngle->Fill(pointingAngleH);
+ fHistMCap->Fill(alfa,qt);
+
+ fHistHilf1->Fill(posPionKF.GetDistanceFromVertex(primVtx));
+ fHistHilf2->Fill(protonKF.GetDistanceFromVertex(primVtx));
+ fHistHilf3->Fill(protonKF.GetDistanceFromVertex(posPionKF));
+ fHistHilf6->Fill(dca);
+ fHistPtvsYAso->Fill(hDibaryon.Pt(),hDibaryon.Rapidity());
+ fHistPtvsEtaAso->Fill(hDibaryon.Pt(),hDibaryon.Eta());
+ mcStatus=1;
+ }//end check for third daughter PDG
+ }//end check second daughter PDG
+ }//end H-Dibaryon
+ }//end MC
+
+ // cout<<"Trigger: "<<triggertype<<endl;
+ fHistMassH->Fill(hDibaryon.M());
+ fHistMassHcentMult->Fill(hDibaryon.M(),triggertype,refMultTpc);
+ ppK=lambdaH+posProt;
+ fHistMassLambdaP->Fill(ppK.M());
+
+ // fHistNdim = new THnSparseF("fHistNdim","THnS;InvMass, InvMassLambda, pointingAngle, armPoAlpha, armPoQt, pTL, pTH, d0p, d0n, dcaHd, dca, decayL, cosPA, centr, multi, mcinf;InvMassH", 16,binsD01,xminD01,xmaxD01);
+
+ // Double_t vec[16]={hDibaryon.M(), lInvMassLambda, pointingAngleH, alfa, qt, lPtLambda, hDibaryon.Pt(), posPionKF.GetDistanceFromVertex(primVtx), protonKF.GetDistanceFromVertex(primVtx), dca, protonKF.GetDistanceFromVertex(posPionKF), TMath::Cos(pointingAngleH), centrPerc, refMultTpc, mcStatus};
+ // fHistNdim->Fill(vec);
+
+ }
+ }
+ }
+ }
+ }
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //Pure MC Part!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ // Monte Carlo for genenerated particles
+ if (HasMC()) //MC loop
+ {
+
+ Int_t stackN = 0;
+
+ Double_t momentumPionGen[3]={0,0,0};
+ Double_t momentumNucleonGen[3]={0,0,0};
+ Double_t momentumLambdaGen[3]={0,0,0};
+
+ Double_t energyPionGen = 0;
+ Double_t energyNucleonGen = 0;
+ Double_t energyLambdaGen = 0;
+
+ Double_t transversMomentumMotherGen = 0;
+ Double_t longitudinalMomentumMotherGen = 0;
+ Double_t totalEnergyMotherGen = 0;
+
+ Double_t rapidityGen = 2;
+
+ for(stackN = 0; stackN < stack->GetNtrack(); stackN++) //loop over stack
+ {
+
+ TParticle *tparticleMother = stack->Particle(stackN);
+
+ if(tparticleMother->GetPdgCode() == pdgLambda) fHistCount->Fill(16);
+
+ //H-Dibaryon
+ if(tparticleMother->GetPdgCode() == pdgHDibaryon) //check mother PDG
+ {
+ Int_t labelFirstDaughter = tparticleMother->GetDaughter(0);
+ Int_t labelThirdDaughter = tparticleMother->GetDaughter(1);
+ Int_t labelSecondDaughter = labelFirstDaughter +1;
+
+ TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));
+ TParticle *tparticleSecondDaughter = stack->Particle(TMath::Abs(labelSecondDaughter));
+ TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));
+
+ if(tparticleFirstDaughter->GetPdgCode() == pdgLambda) //check first daughter PDG
+ {
+ if(tparticleSecondDaughter->GetPdgCode() == pdgProton)//check second daughter PDG
+ {
+ if(tparticleThirdDaughter->GetPdgCode() == pdgPionMinus)//check second daughter PDG
+ {
+ momentumLambdaGen[0] = tparticleFirstDaughter->Px();
+ momentumLambdaGen[1] = tparticleFirstDaughter->Py();
+ momentumLambdaGen[2] = tparticleFirstDaughter->Pz();
+
+ momentumNucleonGen[0] = tparticleSecondDaughter->Px();
+ momentumNucleonGen[1] = tparticleSecondDaughter->Py();
+ momentumNucleonGen[2] = tparticleSecondDaughter->Pz();
+
+ momentumPionGen[0] = tparticleThirdDaughter->Px();
+ momentumPionGen[1] = tparticleThirdDaughter->Py();
+ momentumPionGen[2] = tparticleThirdDaughter->Pz();
+
+ TLorentzVector lorentzVectorLambda;
+ TLorentzVector lorentzVectorProton;
+ TLorentzVector lorentzVectorPion;
+ TLorentzVector lorentzVectorHDibaryon;
+
+ lorentzVectorLambda.SetXYZM(momentumLambdaGen[0],momentumLambdaGen[1],momentumLambdaGen[2],1.115);
+ lorentzVectorProton.SetXYZM(momentumNucleonGen[0],momentumNucleonGen[1],momentumNucleonGen[2],protonMass);
+ lorentzVectorPion.SetXYZM(momentumPionGen[0],momentumPionGen[1],momentumPionGen[2],pionMass);
+
+ lorentzVectorHDibaryon = lorentzVectorLambda + lorentzVectorProton + lorentzVectorPion;
+ rapidityGen=lorentzVectorHDibaryon.Rapidity();
+ transversMomentumMotherGen = lorentzVectorHDibaryon.Pt();
+ longitudinalMomentumMotherGen = lorentzVectorHDibaryon.Pz();
+ totalEnergyMotherGen = lorentzVectorHDibaryon.Energy();
+
+ if(rapidityGen > 1.0 || rapidityGen < -1 ) continue;
+ //lorentzVectorLambda
+ fHistHDibaryonInvaMassGen->Fill(lorentzVectorHDibaryon.M());
+ if (lorentzVectorLambda.Rapidity() > 1.0 || lorentzVectorLambda.Rapidity() < -1) continue;
+ if (lorentzVectorProton.Rapidity() > 1.0 || lorentzVectorProton.Rapidity() < -1) continue;
+
+ if (lorentzVectorPion.Rapidity() > 1.0 || lorentzVectorPion.Rapidity() < -1) continue;
+ fHistHDibaryonInvaMassGenRes->Fill(lorentzVectorHDibaryon.M());
+ fHistPtvsEtaGen->Fill(lorentzVectorHDibaryon.Pt(),lorentzVectorHDibaryon.Eta());
+ fHistPtvsYGen->Fill(lorentzVectorHDibaryon.Pt(),lorentzVectorHDibaryon.Rapidity());
+ fHistPtvsEtaGen->Fill(lorentzVectorHDibaryon.Pt(),lorentzVectorHDibaryon.Eta());
+ fHistCount->Fill(11);
+ }//end of check third daughter PDG
+ }//end of check second daughter PDG
+ }//end of check first daughter PDG
+ }//end of H-Dibaryon
+
+ //Anti-H-Dibaryon
+ if(tparticleMother->GetPdgCode() == pdgAntiHDibaryon) //check mother PDG
+ {
+ Int_t labelFirstDaughter = tparticleMother->GetDaughter(0);
+ Int_t labelThirdDaughter = tparticleMother->GetDaughter(1);
+ Int_t labelSecondDaughter = labelFirstDaughter +1;
+
+ TParticle *tparticleFirstDaughter = stack->Particle(TMath::Abs(labelFirstDaughter));
+ TParticle *tparticleSecondDaughter = stack->Particle(TMath::Abs(labelSecondDaughter));
+ TParticle *tparticleThirdDaughter = stack->Particle(TMath::Abs(labelThirdDaughter));
+
+ if(tparticleFirstDaughter->GetPdgCode() == pdgAntiLambda) //check first daughter PDG
+ {
+ if(tparticleSecondDaughter->GetPdgCode() == pdgAntiProton)//check second daughter PDG
+ {
+ if(tparticleThirdDaughter->GetPdgCode() == pdgPionPlus)//check second daughter PDG
+ {
+ momentumLambdaGen[0] = tparticleFirstDaughter->Px();
+ momentumLambdaGen[1] = tparticleFirstDaughter->Py();
+ momentumLambdaGen[2] = tparticleFirstDaughter->Pz();
+
+ momentumNucleonGen[0] = tparticleSecondDaughter->Px();
+ momentumNucleonGen[1] = tparticleSecondDaughter->Py();
+ momentumNucleonGen[2] = tparticleSecondDaughter->Pz();
+
+ momentumPionGen[0] = tparticleThirdDaughter->Px();
+ momentumPionGen[1] = tparticleThirdDaughter->Py();
+ momentumPionGen[2] = tparticleThirdDaughter->Pz();
+
+ energyLambdaGen = tparticleFirstDaughter->Energy();
+ energyNucleonGen = tparticleSecondDaughter->Energy();
+ energyPionGen = tparticleThirdDaughter->Energy();
+
+ TLorentzVector lorentzVectorLambda;
+ TLorentzVector lorentzVectorProton;
+ TLorentzVector lorentzVectorPion;
+ TLorentzVector lorentzVectorHDibaryon;
+
+ lorentzVectorLambda.SetXYZM(momentumLambdaGen[0],momentumLambdaGen[1],momentumLambdaGen[2],1.115);
+ lorentzVectorProton.SetXYZM(momentumNucleonGen[0],momentumNucleonGen[1],momentumNucleonGen[2],protonMass);
+ lorentzVectorPion.SetXYZM(momentumPionGen[0],momentumPionGen[1],momentumPionGen[2],pionMass);
+
+ lorentzVectorHDibaryon = lorentzVectorLambda + lorentzVectorProton + lorentzVectorPion;
+
+ rapidityGen=lorentzVectorHDibaryon.Rapidity();
+ if(rapidityGen > 1.0 || rapidityGen < -1 ) continue;
+ fHistAntiHDibaryonInvaMassGen->Fill(lorentzVectorHDibaryon.M());
+ }//end of check third daughter PDG
+ }//end of check second daughter PDG
+ }//end of check first daughter PDG
+ }//end of Anti-H-Dibaryon
+ }
+ }//end MC
+
+ // Post output data.
+ PostData(1,fHistList);
+ //PostData(0,fHistList);
+
+ if (listCrossV0) delete listCrossV0;
+ if (esdVer1) delete esdVer1;
+ if (vertexer) delete vertexer;
+ if (vertexer1) delete vertexer1;
+ if (trkArray) delete trkArray;
+ if (trkArray1) delete trkArray1;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHdibaryonLPpi::Terminate(Option_t *)
+{
+ // Draw result to the screen
+ // Called once at the end of the query
+
+}
+
-/**************************************************************************\r
- * Author : Benjamin Dönigus (benjamin.doenigus@cern.ch) *\r
- * *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskHdibaryonLPpi class\r
-// used to search for the H-Dibaryon in weak \r
-// (Lambda Proton Pion) and strong (Lambda Lambda) decays\r
-//-----------------------------------------------------------------\r
-\r
-\r
-#ifndef ALIANALYSISTASKHDIBARYONLPPI_H\r
-#define ALIANALYSISTASKHDIBARYONLPPI_H\r
-\r
-// analysis task for the H-Dibaryon analysis\r
-// Author: Benjamin Doenigus\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-//#include "AliESDv0Cuts.h"\r
-\r
-class TH1F;\r
-class AliESDEvent;\r
-class TFile;\r
-class TH2F;\r
-class TH3F;\r
-class THnSparse;\r
-class AliESDtrackCuts;\r
-class AliESDv0Cuts;\r
-class AliMCEvent;\r
-class TList;\r
-class TParticle;\r
-class TLegend;\r
-class AliESDpid;\r
-class AliHFEpid;\r
-class AliHFEtools;\r
-\r
-class AliMCEventHandler;\r
-class TTree;\r
-class TChain;\r
-class TParallelCoord;\r
-\r
-class AliVertexerTracks;\r
-\r
-class AliAnalysisTaskHdibaryonLPpi : public AliAnalysisTaskSE {\r
- \r
-public:\r
- AliAnalysisTaskHdibaryonLPpi();\r
- AliAnalysisTaskHdibaryonLPpi(const char *name);\r
- // AliAnalysisTaskHdibaryonLPpi();\r
- virtual ~AliAnalysisTaskHdibaryonLPpi();\r
- \r
- void SetHasMC(Bool_t hasMC=kTRUE){SetBit(kHasMC,hasMC);}\r
- Bool_t HasMC(){return TestBit(kHasMC);}\r
-\r
- // virtual void ConnectInputData(Option_t *);\r
- virtual void UserCreateOutputObjects();\r
- //virtual void Exec(Option_t *option);\r
- virtual void UserExec(Option_t* /*option*/);\r
-\r
- virtual void Terminate(Option_t *);\r
-\r
- /*\r
- *Get the MC stack \r
- */\r
- AliMCEvent* GetMCEvent() const{return fMCEvent;} // for CF\r
-\r
-private:\r
- AliESDEvent *fESD; //AliESD event \r
- // AliESDtrackCuts* fEsdTrackCuts; // track cuts\r
- AliESDtrackCuts *fESDtrackCutsV0; // basic cut variables for v0's\r
- AliESDv0Cuts *fESDCutsV0; // V0 track cuts\r
- AliESDtrackCuts* fEsdTrackCuts; // track cuts\r
- \r
- Int_t fBin; //bin for the angular plot\r
-\r
- AliVEvent *fEvent; //! current event\r
-\r
- TList *fHistList; //TList\r
- TH1F *fHistMassDPi; // V0 online finder \r
- TH1F *fHistMassLPi; // V0 offline finder\r
- TH1F *fHistMassLambdaPi; // inv mass lambda pi\r
- TH1F *fHistMassLambda; // inv mass lambda from tlorentz\r
- TH1F *fHistMassLambdaPPi; // inv mass Lambda p pi before cuts\r
- TH1F *fHistMassLambdaP; // inv mass Lambda p \r
- TH1F *fHistMassLambdaK; // inv mass Lambda K\r
-\r
- TH1F *fHistMassK0onl; // K0 mass\r
- TH1F *fHistMassK0offl; // K0 mass\r
- TH1F *fHistMassK0onlC; // K0 mass\r
- TH1F *fHistMassK0offlC;// K0 mass\r
- TH1F *fHistMassPQonl; // K0 mass\r
- TH1F *fHistMassPQoffl; // K0 mass\r
- TH1F *fHistDC; // DC\r
- TH2F *fHistArmenterosPodolanski; // AP distribution\r
- TH2F *fHistArmenterosPodolanskiCut; // AP distributian after cuts\r
- TH1F *fHistHDibaryonInvaMassGen; //! for MC\r
- TH1F *fHistHDibaryonInvaMassGenRes; //! for MC\r
- TH1F *fHistAntiHDibaryonInvaMassGen; //! for MC\r
- TH1F *fHistHDibaryonInvaMassAso; //! for MC\r
- TH1F *fHistHDibaryonInvaMassAsoReso; //! for MC\r
- TH1F *fHistAntiHDibaryonInvaMassAso; //! for MC\r
- TH2F *fHistCheck; // Online vs. Offline V0 finder\r
- TH1F *fHistHPointingAngle; // Poniting angle dist\r
- TH1F *fHistMassH; // Rec. H mass\r
- TH1F *fHistMassLambdaFromH; // True Lambdas from H\r
- TH1F *fHistMassLambdaFromHtLorentz; // via TLorentz\r
- TH1F *fHistMassPpi; //inv mass ppi\r
- TH1F *fHistMassPpiReso; // inv mass ppi reso\r
- TH1F *fHistMassLpi; // inv mass lambda pi\r
- TH1F *fHistMassLP; // inv mass lambda p\r
- TH2F *fHistProtonPIDBb;//TPC BB for Proton PID\r
- TH2F *fHistPionPIDBb;//TPC BB for Pion PID\r
- TH2F *fHistProtonPIDLambda;//TPC BB for Proton PID from Lambda\r
- TH2F *fHistPionPIDLambda;//TPC BB for Pion PID from Lambda\r
- TH1F *fHistMCdcaPvtxDvtx; //mc dca\r
- TH1F *fHistMCdcaPvtxLvtx; //mc dca\r
- TH1F *fHistMCdcaDvtxLvtx; // mc dca\r
- TH1F *fHistMCangleLH; // angle between H and Lambda\r
- TH1F *fHistMCdecayAngle; // decay angle\r
- TH1F *fHistMCpointingAngle; // true PA\r
- TH2F *fHistMCap; // true AP\r
- TH1F *fHistMCdcaPvtxDvtxReso; //mc dca\r
- TH1F *fHistMCdcaPvtxLvtxReso; // mc dca\r
- TH1F *fHistMCdcaDvtxLvtxReso; // mc dca\r
- TH1F *fHistMCangleLHReso; // mc anle\r
- TH1F *fHistMCdecayAngleReso; // mc decay angle\r
- TH1F *fHistMCpointingAngleReso; // mc PA\r
- TH2F *fHistMCapReso; // MC ap for reso\r
- TH1F *fHistCentrality; // Centrality histogram\r
- TH1F *fHistCentralityAC; // Centrality histogram after selection cuts\r
- TH1F *fHistMultiplicity; // Multiplicity histogram\r
- \r
- TH1F *fHistHilf1; // Support\r
- TH1F *fHistHilf2; // support\r
- TH1F *fHistHilf3; // support\r
- TH1F *fHistHilf4; // support\r
- TH1F *fHistHilf5; // support\r
- TH1F *fHistHilf6; // support\r
- TH2F *fHistPtvsEtaGen; // eta vs pt generated\r
- TH2F *fHistPtvsEtaAso; // eta vs pt associated\r
- TH2F *fHistPtvsYGen; // y vs pt generated\r
- TH2F *fHistPtvsYAso; // y vs pt associated\r
- TH1F *fHistRap; // rapidity\r
- \r
- TH1F *fHistCount; //Counting of events and different decay parameters\r
- \r
- AliESDpid *fPIDtpcESD; //PID\r
- TH1F *fHistTriggerStat; //! Trigger statistics\r
- TH1F *fHistTriggerStatAfterEventSelection; //! Trigger statistics\r
- TH3F *fHistMassHcentMult; // Inv. mass vs. centrality vs. multiplicity\r
- THnSparse *fHistNdim; //THnSparse\r
-\r
- enum{\r
- kHasMC=BIT(18)\r
- };\r
-\r
- AliAnalysisTaskHdibaryonLPpi(const AliAnalysisTaskHdibaryonLPpi&); // not implemented\r
- AliAnalysisTaskHdibaryonLPpi& operator=(const AliAnalysisTaskHdibaryonLPpi&); // not implemented\r
-\r
-\r
- ClassDef(AliAnalysisTaskHdibaryonLPpi, 1); // analysisclass\r
-\r
-\r
-};\r
-\r
-#endif\r
+/**************************************************************************
+ * Author : Benjamin Dönigus (benjamin.doenigus@cern.ch) *
+ * *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// AliAnalysisTaskHdibaryonLPpi class
+// used to search for the H-Dibaryon in weak
+// (Lambda Proton Pion) and strong (Lambda Lambda) decays
+//-----------------------------------------------------------------
+
+
+#ifndef ALIANALYSISTASKHDIBARYONLPPI_H
+#define ALIANALYSISTASKHDIBARYONLPPI_H
+
+// analysis task for the H-Dibaryon analysis
+// Author: Benjamin Doenigus
+
+#include "AliAnalysisTaskSE.h"
+//#include "AliESDv0Cuts.h"
+
+class TH1F;
+class AliESDEvent;
+class TFile;
+class TH2F;
+class TH3F;
+class THnSparse;
+class AliESDtrackCuts;
+class AliESDv0Cuts;
+class AliMCEvent;
+class TList;
+class TParticle;
+class TLegend;
+class AliESDpid;
+class AliHFEpid;
+class AliHFEtools;
+
+class AliMCEventHandler;
+class TTree;
+class TChain;
+class TParallelCoord;
+
+class AliVertexerTracks;
+
+class AliAnalysisTaskHdibaryonLPpi : public AliAnalysisTaskSE {
+
+public:
+ AliAnalysisTaskHdibaryonLPpi();
+ AliAnalysisTaskHdibaryonLPpi(const char *name);
+ // AliAnalysisTaskHdibaryonLPpi();
+ virtual ~AliAnalysisTaskHdibaryonLPpi();
+
+ void SetHasMC(Bool_t hasMC=kTRUE){SetBit(kHasMC,hasMC);}
+ Bool_t HasMC(){return TestBit(kHasMC);}
+
+ // virtual void ConnectInputData(Option_t *);
+ virtual void UserCreateOutputObjects();
+ //virtual void Exec(Option_t *option);
+ virtual void UserExec(Option_t* /*option*/);
+
+ virtual void Terminate(Option_t *);
+
+ /*
+ *Get the MC stack
+ */
+ AliMCEvent* GetMCEvent() const{return fMCEvent;} // for CF
+
+private:
+ AliESDEvent *fESD; //AliESD event
+ // AliESDtrackCuts* fEsdTrackCuts; // track cuts
+ AliESDtrackCuts *fESDtrackCutsV0; // basic cut variables for v0's
+ AliESDv0Cuts *fESDCutsV0; // V0 track cuts
+ AliESDtrackCuts* fEsdTrackCuts; // track cuts
+
+ Int_t fBin; //bin for the angular plot
+
+ AliVEvent *fEvent; //! current event
+
+ TList *fHistList; //TList
+ TH1F *fHistMassDPi; // V0 online finder
+ TH1F *fHistMassLPi; // V0 offline finder
+ TH1F *fHistMassLambdaPi; // inv mass lambda pi
+ TH1F *fHistMassLambda; // inv mass lambda from tlorentz
+ TH1F *fHistMassLambdaPPi; // inv mass Lambda p pi before cuts
+ TH1F *fHistMassLambdaP; // inv mass Lambda p
+ TH1F *fHistMassLambdaK; // inv mass Lambda K
+
+ TH1F *fHistMassK0onl; // K0 mass
+ TH1F *fHistMassK0offl; // K0 mass
+ TH1F *fHistMassK0onlC; // K0 mass
+ TH1F *fHistMassK0offlC;// K0 mass
+ TH1F *fHistMassPQonl; // K0 mass
+ TH1F *fHistMassPQoffl; // K0 mass
+ TH1F *fHistDC; // DC
+ TH2F *fHistArmenterosPodolanski; // AP distribution
+ TH2F *fHistArmenterosPodolanskiCut; // AP distributian after cuts
+ TH1F *fHistHDibaryonInvaMassGen; //! for MC
+ TH1F *fHistHDibaryonInvaMassGenRes; //! for MC
+ TH1F *fHistAntiHDibaryonInvaMassGen; //! for MC
+ TH1F *fHistHDibaryonInvaMassAso; //! for MC
+ TH1F *fHistHDibaryonInvaMassAsoReso; //! for MC
+ TH1F *fHistAntiHDibaryonInvaMassAso; //! for MC
+ TH2F *fHistCheck; // Online vs. Offline V0 finder
+ TH1F *fHistHPointingAngle; // Poniting angle dist
+ TH1F *fHistMassH; // Rec. H mass
+ TH1F *fHistMassLambdaFromH; // True Lambdas from H
+ TH1F *fHistMassLambdaFromHtLorentz; // via TLorentz
+ TH1F *fHistMassPpi; //inv mass ppi
+ TH1F *fHistMassPpiReso; // inv mass ppi reso
+ TH1F *fHistMassLpi; // inv mass lambda pi
+ TH1F *fHistMassLP; // inv mass lambda p
+ TH2F *fHistProtonPIDBb;//TPC BB for Proton PID
+ TH2F *fHistPionPIDBb;//TPC BB for Pion PID
+ TH2F *fHistProtonPIDLambda;//TPC BB for Proton PID from Lambda
+ TH2F *fHistPionPIDLambda;//TPC BB for Pion PID from Lambda
+ TH1F *fHistMCdcaPvtxDvtx; //mc dca
+ TH1F *fHistMCdcaPvtxLvtx; //mc dca
+ TH1F *fHistMCdcaDvtxLvtx; // mc dca
+ TH1F *fHistMCangleLH; // angle between H and Lambda
+ TH1F *fHistMCdecayAngle; // decay angle
+ TH1F *fHistMCpointingAngle; // true PA
+ TH2F *fHistMCap; // true AP
+ TH1F *fHistMCdcaPvtxDvtxReso; //mc dca
+ TH1F *fHistMCdcaPvtxLvtxReso; // mc dca
+ TH1F *fHistMCdcaDvtxLvtxReso; // mc dca
+ TH1F *fHistMCangleLHReso; // mc anle
+ TH1F *fHistMCdecayAngleReso; // mc decay angle
+ TH1F *fHistMCpointingAngleReso; // mc PA
+ TH2F *fHistMCapReso; // MC ap for reso
+ TH1F *fHistCentrality; // Centrality histogram
+ TH1F *fHistCentralityAC; // Centrality histogram after selection cuts
+ TH1F *fHistMultiplicity; // Multiplicity histogram
+
+ TH1F *fHistHilf1; // Support
+ TH1F *fHistHilf2; // support
+ TH1F *fHistHilf3; // support
+ TH1F *fHistHilf4; // support
+ TH1F *fHistHilf5; // support
+ TH1F *fHistHilf6; // support
+ TH2F *fHistPtvsEtaGen; // eta vs pt generated
+ TH2F *fHistPtvsEtaAso; // eta vs pt associated
+ TH2F *fHistPtvsYGen; // y vs pt generated
+ TH2F *fHistPtvsYAso; // y vs pt associated
+ TH1F *fHistRap; // rapidity
+
+ TH1F *fHistCount; //Counting of events and different decay parameters
+
+ AliESDpid *fPIDtpcESD; //PID
+ TH1F *fHistTriggerStat; //! Trigger statistics
+ TH1F *fHistTriggerStatAfterEventSelection; //! Trigger statistics
+ TH3F *fHistMassHcentMult; // Inv. mass vs. centrality vs. multiplicity
+ THnSparse *fHistNdim; //THnSparse
+
+ enum{
+ kHasMC=BIT(18)
+ };
+
+ AliAnalysisTaskHdibaryonLPpi(const AliAnalysisTaskHdibaryonLPpi&); // not implemented
+ AliAnalysisTaskHdibaryonLPpi& operator=(const AliAnalysisTaskHdibaryonLPpi&); // not implemented
+
+
+ ClassDef(AliAnalysisTaskHdibaryonLPpi, 1); // analysisclass
+
+
+};
+
+#endif
-/**************************************************************************\r
- * Contributors are not mentioned at all. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-//\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskHelium3Pi class\r
-//-----------------------------------------------------------------\r
-\r
-\r
-class TTree;\r
-class TParticle;\r
-class TVector3;\r
-\r
-#include "AliAnalysisManager.h"\r
-#include <AliMCEventHandler.h>\r
-#include <AliMCEvent.h>\r
-#include <AliStack.h>\r
-\r
-class AliESDVertex;\r
-class AliAODVertex;\r
-class AliESDv0;\r
-class AliAODv0; \r
-class AliCascadeVertexer;\r
-\r
-#include <iostream>\r
-#include "AliAnalysisTaskSE.h"\r
-#include "TList.h"\r
-#include "TH1.h"\r
-#include "TH2.h"\r
-#include "TH3.h"\r
-#include "TNtuple.h"\r
-#include "TGraph.h"\r
-#include "TCutG.h"\r
-#include "TF1.h"\r
-#include "TCanvas.h"\r
-#include "TMath.h"\r
-#include "TChain.h"\r
-#include "Riostream.h"\r
-#include "AliLog.h"\r
-#include "AliCascadeVertexer.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDtrack.h"\r
-#include "AliExternalTrackParam.h"\r
-#include "AliAODEvent.h"\r
-#include "AliInputEventHandler.h"\r
-#include "AliESDcascade.h"\r
-#include "AliAODcascade.h"\r
-#include "AliAnalysisTaskHelium3Pi.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliCentrality.h"\r
-#include "TString.h"\r
-#include <TDatime.h>\r
-#include <TRandom3.h>\r
-#include <TLorentzVector.h>\r
-\r
-const Int_t AliAnalysisTaskHelium3Pi::fgNrot = 15;\r
-\r
-ClassImp(AliAnalysisTaskHelium3Pi)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskHelium3Pi::AliAnalysisTaskHelium3Pi() \r
-: AliAnalysisTaskSE(),\r
- fAnalysisType("ESD"), \r
- fCollidingSystems(0), \r
- fDataType("REAL"),\r
- fListHistCascade(0), \r
- fHistEventMultiplicity(0), \r
- fHistTrackMultiplicity(0), \r
- fHistTrackMultiplicityCent(0), \r
- fHistTrackMultiplicitySemiCent(0), \r
- fHistTrackMultiplicityMB(0), \r
- fHistTrackMultiplicityPVCent(0), \r
- fHistTrackMultiplicityPVSemiCent(0), \r
- fHistTrackMultiplicityPVMB(0), \r
- fHistMult(0),\r
- fhBB(0), \r
- fhTOF(0), \r
- fhMassTOF(0),\r
- fhBBPions(0),\r
- fhBBHe(0), \r
- fhNaPos(0), \r
- fhNaNeg(0), \r
- fBetavsTPCsignalPos(0), \r
- fBetavsTPCsignalNeg(0), \r
- fHelium3TOF(0), \r
- fNtuple1(0),\r
- fNtuple4(0)\r
-\r
-{\r
- // Dummy Constructor \r
-}\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskHelium3Pi::AliAnalysisTaskHelium3Pi(const char *name) \r
- : AliAnalysisTaskSE(name), \r
- fAnalysisType("ESD"), \r
- fCollidingSystems(0), \r
- fDataType("REAL"),\r
- fListHistCascade(0), \r
- fHistEventMultiplicity(0), \r
- fHistTrackMultiplicity(0), \r
- fHistTrackMultiplicityCent(0), \r
- fHistTrackMultiplicitySemiCent(0), \r
- fHistTrackMultiplicityMB(0), \r
- fHistTrackMultiplicityPVCent(0), \r
- fHistTrackMultiplicityPVSemiCent(0), \r
- fHistTrackMultiplicityPVMB(0), \r
- fHistMult(0),\r
- fhBB(0), \r
- fhTOF(0), \r
- fhMassTOF(0),\r
- fhBBPions(0),\r
- fhBBHe(0), \r
- fhNaPos(0), \r
- fhNaNeg(0), \r
- fBetavsTPCsignalPos(0), \r
- fBetavsTPCsignalNeg(0), \r
- fHelium3TOF(0), \r
- fNtuple1(0),\r
- fNtuple4(0) \r
- \r
-{\r
- // Define input and output slots here\r
- // Input slot #0 works with a TChain\r
- //DefineInput(0, TChain::Class());\r
- // Output slot #0 writes into a TList container (Cascade)\r
-\r
- DefineOutput(1, TList::Class());\r
-}\r
-//_______________________________________________________\r
-AliAnalysisTaskHelium3Pi::~AliAnalysisTaskHelium3Pi() \r
-{ \r
- // Destructor\r
- if (fListHistCascade) {\r
- delete fListHistCascade;\r
- fListHistCascade = 0;\r
- }\r
-\r
-}\r
-//=================DEFINITION BETHE BLOCH==============================\r
-\r
-Double_t AliAnalysisTaskHelium3Pi::BetheBloch(Double_t betaGamma,Double_t charge,Bool_t isPbPb) {\r
-\r
- Double_t kp1, kp2, kp3, kp4, kp5;\r
- \r
- if(isPbPb){\r
-\r
- // pass1 2011\r
- kp1 = 4.7*charge*charge;\r
- kp2 = 8.98482806165147636e+00;\r
- kp3 = 1.54000000000000005e-05;\r
- kp4 = 2.30445734159456084e+00;\r
- kp5 = 2.25624744086878559e+00;\r
-\r
- }\r
- \r
- else{\r
-\r
- // to be defined ...\r
- //pass1 2011\r
- kp1 = 4.7*charge*charge;\r
- kp2 = 8.98482806165147636e+00;\r
- kp3 = 1.54000000000000005e-05;\r
- kp4 = 2.30445734159456084e+00;\r
- kp5 = 2.25624744086878559e+00;\r
-\r
- }\r
-\r
- Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);\r
- \r
- Double_t aa = TMath::Power(beta, kp4);\r
- Double_t bb = TMath::Power(1.0 / betaGamma, kp5);\r
- \r
- bb = TMath::Log(kp3 + bb);\r
- \r
- Double_t out = (kp2 - aa - bb) * kp1 / aa;\r
-\r
- return out;\r
- \r
-}\r
-\r
-//==================DEFINITION OF OUTPUT OBJECTS==============================\r
-\r
-void AliAnalysisTaskHelium3Pi::UserCreateOutputObjects()\r
-{\r
-\r
- fListHistCascade = new TList();\r
- fListHistCascade->SetOwner(); // IMPORTANT!\r
-\r
- if(! fHistEventMultiplicity ){\r
- fHistEventMultiplicity = new TH1F( "fHistEventMultiplicity" , "Nb of Events" , 10 , 0, 10);\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(1,"All Events");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(2,"Events w/PV");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(3,"Events w/|Vz|<10cm");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(4,"Central Events");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(5,"SemiCentral Events");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(6,"MB Events");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(7,"Central Events w/|Vz|<10cm");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(8,"SemiCentral Events w/|Vz|<10cm");\r
- fHistEventMultiplicity->GetXaxis()->SetBinLabel(9,"MB Events w/|Vz|<10cm");\r
-\r
- fListHistCascade->Add(fHistEventMultiplicity);\r
- }\r
-\r
- if(! fHistTrackMultiplicity ){\r
- fHistTrackMultiplicity = new TH2F( "fHistTrackMultiplicity" , "Nb of Tracks", 25000,0, 25000,105,-1,104);\r
- fHistTrackMultiplicity->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicity->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicity);\r
- } \r
-\r
- if(! fHistTrackMultiplicityCent ){\r
- fHistTrackMultiplicityCent = new TH2F( "fHistTrackMultiplicityCent", "Nb of Tracks Central Events", 25000,0, 25000,105,-1,104 );\r
- fHistTrackMultiplicityCent->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicityCent->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicityCent);\r
- } \r
-\r
- if(! fHistTrackMultiplicitySemiCent ){\r
- fHistTrackMultiplicitySemiCent = new TH2F( "fHistTrackMultiplicitySemiCent" , "Nb of Tracks SemiCentral Events", 25000,0, 25000 ,105,-1,104);\r
- fHistTrackMultiplicitySemiCent->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicitySemiCent->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicitySemiCent);\r
- } \r
- \r
- if(! fHistTrackMultiplicityMB ){\r
- fHistTrackMultiplicityMB = new TH2F( "fHistTrackMultiplicityMB" , "Nb of Tracks MBral Events", 25000,0, 25000,105,-1,104 );\r
- fHistTrackMultiplicityMB->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicityMB->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicityMB);\r
- } \r
-\r
- if(! fHistTrackMultiplicityPVCent ){\r
- fHistTrackMultiplicityPVCent = new TH2F( "fHistTrackMultiplicityPVCent" , "Nb of Tracks Central Events", 25000,0, 25000,105,-1,104 );\r
- fHistTrackMultiplicityPVCent->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicityPVCent->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicityPVCent);\r
- } \r
-\r
- if(! fHistTrackMultiplicityPVSemiCent ){\r
- fHistTrackMultiplicityPVSemiCent = new TH2F( "fHistTrackMultiplicityPVSemiCent" , "Nb of Tracks SemiCentral Events", 25000,0, 25000 ,105,-1,104);\r
- fHistTrackMultiplicityPVSemiCent->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicityPVSemiCent->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicityPVSemiCent);\r
- } \r
- \r
- if(! fHistTrackMultiplicityPVMB ){\r
- fHistTrackMultiplicityPVMB = new TH2F( "fHistTrackMultiplicityPVMB" , "Nb of Tracks MBral Events", 25000,0, 25000,105,-1,104 );\r
- fHistTrackMultiplicityPVMB->GetXaxis()->SetTitle("Number of tracks");\r
- fHistTrackMultiplicityPVMB->GetYaxis()->SetTitle("Percentile");\r
- fListHistCascade->Add(fHistTrackMultiplicityPVMB);\r
- } \r
-\r
- if(! fHistMult){\r
- fHistMult=new TH1F ("fHistMult","Number neg-pos", 10, -1,9);\r
- fHistMult->GetXaxis()->SetTitle("Type of tracks");\r
- fListHistCascade->Add(fHistMult);\r
- }\r
- \r
- if(! fhBB ){\r
- fhBB = new TH2F( "fhBB" , "BetheBlochTPC" , 1000,-6,6,1500,0,5000);\r
- fhBB->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fhBB->GetYaxis()->SetTitle("TPC Signal");\r
- fListHistCascade->Add(fhBB);\r
- }\r
-\r
- if(! fhTOF ){\r
- fhTOF = new TH2F( "fhTOF" , "Scatter Plot TOF" , 1000,-6,6,1000,0,1.2);\r
- fhTOF->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fhTOF->GetYaxis()->SetTitle("#beta");\r
- fListHistCascade->Add(fhTOF);\r
- }\r
-\r
- if(! fhMassTOF){\r
- fhMassTOF=new TH1F ("fhMassTOF","Particle Mass - TOF", 300,0 ,5);\r
- fhMassTOF->GetXaxis()->SetTitle("Mass (GeV/#it{c}^{2})");\r
- fListHistCascade->Add(fhMassTOF);\r
- }\r
-\r
- if(! fhBBPions ){\r
- fhBBPions = new TH2F( "fhBBPions" , "Bethe-Bloch TPC Pions" , 1000,-6,6,1500,0,5000);\r
- fhBBPions->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fhBBPions->GetYaxis()->SetTitle("TPC Signal");\r
- fListHistCascade->Add(fhBBPions);\r
- }\r
- \r
- if(! fhBBHe ){\r
- fhBBHe = new TH2F( "fhBBHe" , "Bethe-Bloch TPC He" , 1000,-6,6,1500,0,5000);\r
- fhBBHe->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fhBBHe->GetYaxis()->SetTitle("TPC Signal");\r
- fListHistCascade->Add(fhBBHe);\r
- }\r
- \r
- if(! fhNaPos ){\r
- fhNaPos = new TH2F( "fhNaPos" , "Distribution Pos" , 500,0,5,500,-2,2);\r
- fhNaPos->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fhNaPos->GetYaxis()->SetTitle("(TPCSignal-bbtheo)/bbtheo (He)");\r
- fListHistCascade->Add(fhNaPos);\r
- }\r
- \r
- if(! fhNaNeg ){\r
- fhNaNeg = new TH2F( "fhNaNeg" , "Distribution Neg" , 500,0,5,500,-2,2);\r
- fhNaNeg->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fhNaNeg->GetYaxis()->SetTitle("(TPCSignal-bbtheo)/bbtheo (He)");\r
- fListHistCascade->Add(fhNaNeg);\r
- }\r
-\r
- if(! fBetavsTPCsignalPos ){\r
- fBetavsTPCsignalPos = new TH2F("fBetavsTPCsignalPos","fBetavsTPCsignalPos",1000,0,1.2,1500,0,5000);\r
- fBetavsTPCsignalPos->GetXaxis()->SetTitle("#beta");\r
- fBetavsTPCsignalPos->GetYaxis()->SetTitle("TPC Signal");\r
- fListHistCascade->Add(fBetavsTPCsignalPos);\r
- }\r
- \r
- if(! fBetavsTPCsignalNeg ){\r
- fBetavsTPCsignalNeg = new TH2F("fBetavsTPCsignalNeg","fBetavsTPCsignalNeg",1000,0,1.2,1500,0,5000);\r
- fBetavsTPCsignalNeg->GetXaxis()->SetTitle("#beta");\r
- fBetavsTPCsignalNeg->GetYaxis()->SetTitle("TPC Signal");\r
- fListHistCascade->Add(fBetavsTPCsignalNeg);\r
- }\r
- \r
- if(! fHelium3TOF){\r
- fHelium3TOF = new TH2F("fHelium3massTOF","Helium3 beta vs p/z",1000,0,6,1000,0,1.2);\r
- fHelium3TOF->GetXaxis()->SetTitle("p/z (GeV/#it{c})");\r
- fHelium3TOF->GetYaxis()->SetTitle("#beta");\r
- fListHistCascade->Add(fHelium3TOF);\r
- }\r
- \r
- if(! fNtuple1 ) {\r
- fNtuple1 = new TNtuple("fNtuple1","Ntuple1","runNumber:bunchcross:orbit:period:eventtype:TrackNumber:percentile:xPrimaryVertex:yPrimaryVertex:zPrimaryVertex:xSecondaryVertex:ySecondaryVertex:zSecondaryVertex:dcaTracks:CosPointingAngle:DCAV0toPrimaryVertex:HeSign:HepInTPC:HeTPCsignal:DcaHeToPrimVertex:HeEta:momHex:momHey:momHez:momHeAtSVx:momHeAtSVy:momHeAtSVz:HeTPCNcls:HeimpactXY:HeimpactZ:HeITSClusterMap:IsHeITSRefit:PionSign:PionpInTPC:PionTPCsignal:DcaPionToPrimVertex:PionEta:momPionx:momPiony:momPionz:momNegPionAtSVx:momNegPionAtSVy:momNegPionAtSVz:PionTPCNcls:PionimpactXY:PionimpactZ:PionITSClusterMap:IsPiITSRefit:xn:xp");\r
- \r
- fListHistCascade->Add(fNtuple1);\r
- }\r
- \r
- if(! fNtuple4 ) {\r
- fNtuple4 = new TNtuple("fNtuple4","Ntuple4","runNumber:BCNumber:OrbitNumber:PeriodNumber:eventtype:isHeITSrefit:percentile:Sign:pinTPC:GetTPCsignal:Px:Py:Pz:Eta:isTOF:poutTPC:timeTOF:trackLenghtTOF:impactXY:impactZ:mapITS:TPCNcls:TRDsignal:xPrimaryVertex:yPrimaryVertex:zPrimaryVertex:chi2PerClusterTPC");\r
- fListHistCascade->Add(fNtuple4);\r
- } \r
-\r
- PostData(1, fListHistCascade);\r
-\r
-}// end UserCreateOutputObjects\r
-\r
-\r
-\r
-//====================== USER EXEC ========================\r
-\r
-void AliAnalysisTaskHelium3Pi::UserExec(Option_t *) \r
-{\r
- //_______________________________________________________________________\r
- \r
- //!*********************!//\r
- //! Define variables !//\r
- //!*********************!//\r
- Float_t vett1[50];\r
- for(Int_t i=0;i<50;i++) vett1[i]=0;\r
-\r
- Float_t vett4[40];\r
- for(Int_t i=0;i<40;i++) vett4[i]=0;\r
- \r
- Double_t ITSsample[4];\r
- for(Int_t i=0;i<4;i++)ITSsample[i]=0;\r
-\r
- Double_t pinTPC=0.,poutTPC=0.,TPCSignal=0.;\r
- Double_t xPrimaryVertex=0.,yPrimaryVertex=0.,zPrimaryVertex=0.;\r
- Double_t massTOF=0.,timeTOF=0.,trackLenghtTOF=0.,betaTOF=0.;\r
-\r
- ULong_t status=0;\r
- ULong_t statusT=0;\r
- ULong_t statusPi=0;\r
-\r
- Bool_t isTPC=kFALSE,isTOF=kFALSE,isTOFHe=kFALSE,IsHeITSRefit=kFALSE,isTOFPi=kFALSE,IsPiITSRefit=kFALSE ;\r
-\r
- Float_t nSigmaNegPion=0.;\r
- Float_t nSigmaNegPion1=0.;\r
- Float_t nSigmaNegPion2=0.;\r
-\r
- Double_t cutNSigma = 3;\r
- Double_t bbtheoM=0.,bbtheoP=0.,bbtheo=0.;\r
- Double_t zNathashaNeg=0;\r
- Double_t zNathashaPos=0;\r
- Double_t fPos[3]={0.,0.,0.};\r
- Double_t runNumber=0.;\r
- Double_t evNumber=0.;\r
-\r
- Double_t BCNumber=0.;\r
- Double_t OrbitNumber=0.;\r
- Double_t PeriodNumber=0.;\r
-\r
- Double_t Helium3Mass = 2.80839; \r
- Double_t PionMass = 0.13957; \r
- // TLORENTZ vectors\r
- \r
- TLorentzVector vPion,vHelium,vSum;\r
-\r
- //!----------------------------------------------------------------\r
-\r
- //! A set of very loose parameters for cuts \r
- \r
- Double_t fgChi2max=33.; //! max chi2\r
- Double_t fgDNmin=0.05; //! min imp parameter for the 1st daughter = 500um\r
- Double_t fgDCAmax=1.0; //! max DCA between the daughter tracks in cm\r
- Double_t fgCPAmin=0.99; //! min cosine of V0's pointing angle \r
- // Double_t fgRmin=0.2; //! min radius of the fiducial volume //original\r
- Double_t fgRmin=0.1; //! min radius of the fiducial volume = 1 mm \r
- Double_t fgRmax=200.; //! max radius of the fiducial volume = 2 m\r
-\r
- //------------------------------------------\r
-\r
- // Main loop\r
- // Called for EACH event\r
-\r
- AliVEvent *event = InputEvent();\r
- if (!event) { Printf("ERROR: Could not retrieve event"); return; }\r
- \r
- Info("AliAnalysisTaskHelium3Pi","Starting UserExec"); \r
-\r
- SetDataType("REAL");\r
- \r
- // create pointer to event\r
- AliESDEvent* lESDevent = dynamic_cast<AliESDEvent*>(event);\r
- if (!lESDevent) {\r
- AliError("Cannot get the ESD event");\r
- return;\r
- } \r
-\r
- fHistEventMultiplicity->Fill(0);\r
-\r
- Double_t lMagneticField=lESDevent->GetMagneticField();\r
- Int_t TrackNumber = -1;\r
-\r
- \r
- //*****************// \r
- //* Centrality *//\r
- //*****************//\r
- \r
- AliCentrality *centrality = lESDevent->GetCentrality();\r
- Float_t percentile=centrality->GetCentralityPercentile("V0M");\r
-\r
- TrackNumber = lESDevent->GetNumberOfTracks();\r
- if (TrackNumber<2) return; \r
-\r
- fHistTrackMultiplicity->Fill(TrackNumber,percentile); //tracce per evento\r
-\r
- //****************************************\r
-\r
- Int_t eventtype=-99;\r
- \r
- Bool_t isSelectedCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral);\r
- Bool_t isSelectedSemiCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral);\r
- Bool_t isSelectedMB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);\r
- \r
- if(isSelectedCentral){\r
- fHistEventMultiplicity->Fill(3);\r
- fHistTrackMultiplicityCent->Fill(TrackNumber,percentile); \r
- eventtype=1;\r
- }\r
-\r
- if(isSelectedSemiCentral){\r
- fHistEventMultiplicity->Fill(4);\r
- fHistTrackMultiplicitySemiCent->Fill(TrackNumber,percentile); \r
- eventtype=2;\r
- }\r
-\r
- if(isSelectedMB){\r
- fHistEventMultiplicity->Fill(5);\r
- fHistTrackMultiplicityMB->Fill(TrackNumber,percentile); \r
- eventtype=3;\r
- }\r
- \r
- if(isSelectedCentral || isSelectedSemiCentral || isSelectedMB){\r
- \r
- // ANALISYS\r
- \r
- // Primary vertex cut\r
- \r
- const AliESDVertex *vtx = lESDevent->GetPrimaryVertexTracks();\r
- \r
- if(vtx->GetNContributors()<1) {\r
- \r
- // SPD vertex cut\r
- vtx = lESDevent->GetPrimaryVertexSPD();\r
- \r
- if(vtx->GetNContributors()<1) {\r
- Info("AliAnalysisTaskHelium3Pi","No good vertex, skip event");\r
- return; // NO GOOD VERTEX, SKIP EVENT \r
- }\r
- }\r
- \r
- fHistEventMultiplicity->Fill(1); // analyzed events with PV\r
- \r
- xPrimaryVertex=vtx->GetXv();\r
- yPrimaryVertex=vtx->GetYv();\r
- zPrimaryVertex=vtx->GetZv(); \r
- \r
- if(TMath::Abs(zPrimaryVertex)>10) return;\r
- \r
- if(eventtype==1){\r
- fHistTrackMultiplicityPVCent->Fill(TrackNumber,percentile); \r
- fHistEventMultiplicity->Fill(6); \r
- }\r
- \r
- if(eventtype==2){\r
- fHistTrackMultiplicityPVSemiCent->Fill(TrackNumber,percentile); \r
- fHistEventMultiplicity->Fill(7); \r
- }\r
- \r
- if(eventtype==3){\r
- fHistTrackMultiplicityPVMB->Fill(TrackNumber,percentile); \r
- fHistEventMultiplicity->Fill(8); \r
- }\r
- \r
- \r
- fHistEventMultiplicity->Fill(2);\r
- \r
- //Find Pair candidates\r
- \r
- TArrayI PionsTPC(TrackNumber); //Neg pions\r
- Int_t nPionsTPC=0;\r
- \r
- TArrayI HeTPC(TrackNumber); //helium3\r
- Int_t nHeTPC=0;\r
- \r
- const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps\r
- \r
- Float_t impactXY=-999, impactZ=-999;\r
- Float_t impactXYpi=-999, impactZpi=-999;\r
- \r
- //! SELECTIONS:\r
- //! - No ITSpureSA\r
- //! - ITSrefit\r
- //! - TPCrefit\r
- //! - ITSmap !=0\r
- \r
- // ******************* Track Cuts Definitions ********************//\r
- \r
- //! ITS\r
-\r
- AliESDtrackCuts* esdtrackCutsITS = new AliESDtrackCuts("esdtrackCutsITS");\r
- esdtrackCutsITS->SetRequireITSStandAlone(kFALSE);\r
- esdtrackCutsITS->SetRequireITSPureStandAlone(kFALSE);\r
- \r
- //! TPC\r
- \r
- Int_t minclsTPC=60;\r
- Double_t maxchi2perTPCcl=5.;\r
- \r
- AliESDtrackCuts* esdtrackCutsTPC = new AliESDtrackCuts("esdtrackCutsTPC");\r
- esdtrackCutsTPC->SetRequireTPCRefit(kTRUE);\r
- esdtrackCutsTPC->SetAcceptKinkDaughters(kFALSE);\r
- esdtrackCutsTPC->SetMinNClustersTPC(minclsTPC);\r
- esdtrackCutsTPC->SetMaxChi2PerClusterTPC(maxchi2perTPCcl);\r
- \r
- //*********************************************+\r
- \r
- runNumber = lESDevent->GetRunNumber();\r
- evNumber = lESDevent->GetEventNumberInFile();\r
- \r
- BCNumber = lESDevent->GetBunchCrossNumber();\r
- OrbitNumber = lESDevent->GetOrbitNumber();\r
- PeriodNumber= lESDevent->GetPeriodNumber();\r
- \r
- //*************************************************************\r
- \r
- TF1 *foPion=new TF1("foPion", "[0]*([1]*TMath::Power(TMath::Sqrt(1 + (x/0.13957)*(x/0.13957))/(x/0.13957) , [3]) - 1 - TMath::Power(TMath::Sqrt(1 + (x/0.13957)*(x/0.13957))/(x/0.13957) , [3])*TMath::Log([2] + 1/TMath::Power((x/0.13957), [4])))",0.01,20);\r
- foPion->SetParameters(4.1,8.98482806165147636e+00,1.54000000000000005e-05,2.30445734159456084e+00,2.25624744086878559e+00);\r
- \r
- //--------------------------------------------\r
- \r
- for (Int_t j=0; j<TrackNumber; j++) { //loop on tracks\r
- \r
- AliESDtrack *esdtrack=lESDevent->GetTrack(j);\r
- \r
- if(!esdtrack) { \r
- AliError(Form("ERROR: Could not retrieve esdtrack %d",j)); \r
- continue; \r
- }\r
- \r
- // ************** Track cuts ****************\r
- \r
- status = (ULong_t)esdtrack->GetStatus();\r
- \r
- isTPC = (((status) & AliESDtrack::kTPCin) != 0);\r
- isTOF = ((((status) & AliESDtrack::kTOFout) != 0) && (((status) & AliESDtrack::kTIME) != 0));\r
- \r
- Bool_t IsTrackAcceptedTPC = esdtrackCutsTPC->AcceptTrack(esdtrack);\r
- Bool_t IsTrackAcceptedITS = esdtrackCutsITS->AcceptTrack(esdtrack);\r
- \r
- if (!(IsTrackAcceptedTPC && IsTrackAcceptedITS)) continue;\r
- \r
- UInt_t mapITS=esdtrack->GetITSClusterMap();\r
- // if(mapITS==0) continue;\r
- \r
- //----------------------------------------------\r
- \r
- //****** Cuts from AliV0Vertex.cxx *************\r
- \r
- Double_t d=esdtrack->GetD(xPrimaryVertex,yPrimaryVertex,lMagneticField);\r
- // if (TMath::Abs(d)<fgDPmin) continue;\r
- if (TMath::Abs(d)>fgRmax) continue;\r
- \r
- //---- (Usefull) Stuff\r
- \r
- TPCSignal=esdtrack->GetTPCsignal(); \r
- \r
- if (TPCSignal<10)continue;\r
- \r
- if(!isTPC)continue;\r
- \r
- if(!esdtrack->GetTPCInnerParam())continue;\r
- \r
- AliExternalTrackParam trackIn(*esdtrack->GetInnerParam()); \r
- pinTPC = trackIn.GetP(); \r
- \r
- poutTPC=pinTPC;\r
- \r
- fHistMult->Fill(0);\r
- \r
- if((status) & (AliESDtrack::kITSrefit!=0)){\r
- fHistMult->Fill(1);\r
- fhBB->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);\r
- }\r
- \r
- timeTOF=esdtrack->GetTOFsignal(); // ps\r
- trackLenghtTOF= esdtrack->GetIntegratedLength(); // cm\r
- \r
- if(isTOF){\r
- \r
- if(!esdtrack->GetOuterParam())continue; \r
- \r
- AliExternalTrackParam trackOut(*esdtrack->GetOuterParam()); \r
- \r
- poutTPC = trackOut.GetP(); \r
- \r
- betaTOF= (trackLenghtTOF/timeTOF)/2.99792458e-2;\r
- \r
- fhTOF->Fill(poutTPC*esdtrack->GetSign(),betaTOF);\r
- \r
- Double_t mass2=(poutTPC*poutTPC)*((((speedOfLight*speedOfLight)*(timeTOF*timeTOF))-(trackLenghtTOF*trackLenghtTOF))/(trackLenghtTOF*trackLenghtTOF));\r
- if(mass2>0) massTOF=TMath::Sqrt(mass2);\r
- fhMassTOF->Fill(massTOF);\r
- \r
- if(esdtrack->GetSign() < 0.)fBetavsTPCsignalNeg->Fill(betaTOF,TPCSignal);\r
- if(esdtrack->GetSign() > 0.)fBetavsTPCsignalPos->Fill(betaTOF,TPCSignal);\r
- \r
- }\r
- \r
- //pass2\r
- \r
- bbtheo =BetheBloch((2*pinTPC)/3.,2,kTRUE); //! OK\r
- bbtheoM=(1 - 0.08*5)*bbtheo; //! OK \r
- bbtheoP=(1 + 0.08*5)*bbtheo; //! OK\r
- \r
- fHistMult->Fill(2);\r
- \r
- if(esdtrack->GetSign()<0){\r
- zNathashaNeg=(TPCSignal-bbtheo)/bbtheo;\r
- fhNaNeg->Fill(pinTPC,zNathashaNeg); \r
- }\r
- \r
- if(esdtrack->GetSign() > 0.){\r
- zNathashaPos=(TPCSignal-bbtheo)/bbtheo;\r
- fhNaPos->Fill(pinTPC,zNathashaPos); \r
- }\r
- \r
- nSigmaNegPion1 = TMath::Abs((TPCSignal - foPion->Eval(pinTPC))/foPion->Eval(pinTPC))/0.07; \r
- nSigmaNegPion2 = TMath::Abs((TPCSignal - foPion->Eval(pinTPC))/foPion->Eval(pinTPC))/0.04; \r
- \r
- if(pinTPC<0.6)\r
- nSigmaNegPion=nSigmaNegPion1;\r
- if(pinTPC>=0.6)\r
- nSigmaNegPion=nSigmaNegPion2;\r
- \r
- if ( (nSigmaNegPion < cutNSigma)){ \r
- \r
- fhBBPions->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);\r
- \r
- if(pinTPC<3){\r
- PionsTPC[nPionsTPC++]=j;\r
- }\r
- }\r
- \r
- if( TPCSignal > bbtheoM ) {\r
- \r
- if(pinTPC>0.6){\r
- \r
- fhBBHe->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);\r
- HeTPC[nHeTPC++]=j;\r
- \r
- \r
- Bool_t isHeITSrefit=((status) & (AliESDtrack::kITSrefit));\r
- \r
- esdtrack->GetImpactParameters(impactXY, impactZ);\r
- esdtrack->GetITSdEdxSamples(ITSsample);\r
- \r
- \r
- Int_t fIdxInt[200]; //dummy array\r
- Int_t nClustersTPC = esdtrack->GetTPCclusters(fIdxInt);\r
- \r
- Float_t chi2PerClusterTPC = esdtrack->GetTPCchi2()/(Float_t)(nClustersTPC);\r
- \r
- vett4[0] =(Float_t)runNumber;\r
- vett4[1] =(Float_t)BCNumber;\r
- vett4[2] =(Float_t)OrbitNumber;\r
- vett4[3] =(Float_t)PeriodNumber;\r
- vett4[4] =(Float_t)eventtype;\r
- vett4[5] =(Float_t)isHeITSrefit;\r
- vett4[6] =(Float_t)percentile;\r
- vett4[7] =(Float_t)esdtrack->GetSign();\r
- vett4[8] =(Float_t)pinTPC;\r
- vett4[9] =(Float_t)esdtrack->GetTPCsignal();\r
- vett4[10]=(Float_t)esdtrack->Px();\r
- vett4[11]=(Float_t)esdtrack->Py();\r
- vett4[12]=(Float_t)esdtrack->Pz();\r
- vett4[13]=(Float_t)esdtrack->Eta();\r
- vett4[14]=(Float_t)isTOF;\r
- vett4[15]=(Float_t)poutTPC;\r
- vett4[16]=(Float_t)timeTOF;\r
- vett4[17]=(Float_t)trackLenghtTOF;\r
- vett4[18]=(Float_t)impactXY;\r
- vett4[19]=(Float_t)impactZ;\r
- vett4[20]=(Float_t)mapITS;\r
- vett4[21]=(Float_t)esdtrack->GetTPCNcls();\r
- vett4[22]=(Float_t)esdtrack->GetTRDsignal();\r
- vett4[23]=(Float_t)xPrimaryVertex;\r
- vett4[24]=(Float_t)yPrimaryVertex;\r
- vett4[25]=(Float_t)zPrimaryVertex;\r
- vett4[26]=(Float_t)chi2PerClusterTPC;\r
- \r
- fNtuple4->Fill(vett4);\r
- }\r
- }\r
- } //! track\r
- \r
- \r
- Double_t DcaHeToPrimVertex=0;\r
- Double_t DcaPionToPrimVertex=0;\r
- \r
- impactXY=-999, impactZ=-999;\r
- impactXYpi=-999, impactZpi=-999;\r
- \r
- // Track \r
- \r
- AliESDtrack *PionTrack = 0x0;\r
- AliESDtrack *HeTrack = 0x0;\r
- \r
- // Vettors for il PxPyPz\r
- \r
- Double_t momPionVett[3];\r
- for(Int_t i=0;i<3;i++)momPionVett[i]=0;\r
- \r
- Double_t momHeVett[3];\r
- for(Int_t i=0;i<3;i++)momHeVett[i]=0;\r
- \r
- //At SV\r
- \r
- Double_t momPionVettAt[3];\r
- for(Int_t i=0;i<3;i++)momPionVettAt[i]=0;\r
- \r
- Double_t momHeVettAt[3];\r
- for(Int_t i=0;i<3;i++)momHeVettAt[i]=0;\r
- \r
- //--------------- LOOP PAIRS ----------------\r
- \r
- for (Int_t k=0; k < nPionsTPC; k++) { //! Pions Loop\r
- \r
- DcaPionToPrimVertex=0.;\r
- DcaHeToPrimVertex=0;\r
- \r
- Int_t PionIdx=PionsTPC[k];\r
- \r
- PionTrack=lESDevent->GetTrack(PionIdx);\r
- \r
- statusPi = (ULong_t)PionTrack->GetStatus();\r
- isTOFPi = ((((statusPi) & (AliESDtrack::kTOFout)) != 0) && (((statusPi) & (AliESDtrack::kTIME)) != 0));\r
- IsPiITSRefit = ((statusPi) & (AliESDtrack::kITSrefit)); \r
- \r
- if (PionTrack) \r
- DcaPionToPrimVertex = TMath::Abs(PionTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK\r
- \r
- if(DcaPionToPrimVertex<0.2)continue; //qui\r
- \r
- AliExternalTrackParam trackInPion(*PionTrack); \r
- \r
- for (Int_t i=0; i<nHeTPC; i++){ //! Helium Loop\r
- \r
- Int_t HeIdx=HeTPC[i];\r
- \r
- HeTrack=lESDevent->GetTrack(HeIdx);\r
- \r
- statusT= (ULong_t)HeTrack->GetStatus();\r
- isTOFHe = (((statusT & AliESDtrack::kTOFout) != 0) && ((statusT & AliESDtrack::kTIME) != 0));\r
- IsHeITSRefit = (status & AliESDtrack::kITSrefit); \r
- \r
- if (HeTrack) \r
- DcaHeToPrimVertex = TMath::Abs(HeTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK\r
- \r
- AliExternalTrackParam trackInHe(*HeTrack); \r
- \r
- if ( DcaPionToPrimVertex < fgDNmin) //OK\r
- if ( DcaHeToPrimVertex < fgDNmin) continue; //OK\r
- \r
- Double_t xn, xp;\r
- Double_t dca=0.;\r
- \r
- dca= PionTrack->GetDCA(HeTrack,lMagneticField,xn,xp); //!dca (Neg to Pos)\r
- \r
- if (dca > fgDCAmax) continue;\r
- if ((xn+xp) > 2*fgRmax) continue;\r
- if ((xn+xp) < 2*fgRmin) continue;\r
- \r
- //CORRECTION from AliV0Vertex\r
- \r
- Bool_t corrected=kFALSE;\r
- if ((trackInPion.GetX() > 3.) && (xn < 3.)) {\r
- //correct for the beam pipe material\r
- corrected=kTRUE;\r
- }\r
- if ((trackInHe.GetX() > 3.) && (xp < 3.)) {\r
- //correct for the beam pipe material\r
- corrected=kTRUE;\r
- }\r
- if (corrected) {\r
- dca=trackInPion.GetDCA(&trackInHe,lMagneticField,xn,xp);\r
- if (dca > fgDCAmax) continue;\r
- if ((xn+xp) > 2*fgRmax) continue;\r
- if ((xn+xp) < 2*fgRmin) continue;\r
- }\r
- \r
- //=============================================//\r
- // Make "V0" with found tracks //\r
- //=============================================//\r
- \r
- trackInPion.PropagateTo(xn,lMagneticField); \r
- trackInHe.PropagateTo(xp,lMagneticField);\r
- \r
- AliESDv0 vertex(trackInPion,PionIdx,trackInHe,HeIdx);\r
- if (vertex.GetChi2V0() > fgChi2max) continue;\r
- \r
- Float_t CosPointingAngle=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex); //PointingAngle\r
- if (CosPointingAngle < fgCPAmin) continue;\r
- \r
- vertex.SetDcaV0Daughters(dca);\r
- vertex.SetV0CosineOfPointingAngle(CosPointingAngle);\r
- \r
- fPos[0]=vertex.Xv();\r
- fPos[1]=vertex.Yv(); \r
- fPos[2]=vertex.Zv(); \r
- \r
- HeTrack->PxPyPz(momHeVett);\r
- PionTrack->PxPyPz(momPionVett); \r
- \r
- Double_t raggio=TMath::Sqrt(fPos[0]*fPos[0]+fPos[1]*fPos[1]+fPos[2]*fPos[2]);\r
- HeTrack->GetPxPyPzAt(raggio,lMagneticField,momHeVettAt);\r
- PionTrack->GetPxPyPzAt(raggio,lMagneticField,momPionVettAt); \r
- \r
- //------------------------------------------------------------------------//\r
- \r
- HeTrack->GetImpactParameters(impactXY, impactZ);\r
- \r
- PionTrack->GetImpactParameters(impactXYpi, impactZpi);\r
- \r
- if(vertex.GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex)>3) continue;\r
- \r
- //salvo solo fino a 3.1 GeV/c2\r
- \r
- vHelium.SetXYZM(2*momHeVettAt[0],2*momHeVettAt[1],2*momHeVettAt[2],Helium3Mass); \r
- vPion.SetXYZM(momPionVettAt[0],momPionVettAt[1],momPionVettAt[2],PionMass); \r
- vSum=vHelium+vPion;\r
- \r
- if(vSum.M()>3.1)continue;\r
- \r
- //----------------------------------------------------------------------//\r
- \r
- vett1[0]=(Float_t)runNumber;\r
- vett1[1]=(Float_t)BCNumber;\r
- vett1[2]=(Float_t)OrbitNumber;\r
- vett1[3]=(Float_t)PeriodNumber;\r
- vett1[4]=(Float_t)eventtype;\r
- vett1[5]=(Float_t)TrackNumber;\r
- vett1[6]=(Float_t)percentile;\r
- vett1[7]=(Float_t)xPrimaryVertex; //PRIMARY\r
- vett1[8]=(Float_t)yPrimaryVertex;\r
- vett1[9]=(Float_t)zPrimaryVertex;\r
- vett1[10]=(Float_t)fPos[0]; //SECONDARY\r
- vett1[11]=(Float_t)fPos[1];\r
- vett1[12]=(Float_t)fPos[2];\r
- vett1[13]=(Float_t)dca; //between 2 tracks\r
- vett1[14]=(Float_t)CosPointingAngle; //cosPointingAngle da V0\r
- vett1[15]=(Float_t)vertex.GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);\r
- vett1[16]=(Float_t)HeTrack->GetSign(); //He\r
- vett1[17]=(Float_t)trackInHe.GetP();\r
- vett1[18]=(Float_t)HeTrack->GetTPCsignal();\r
- vett1[19]=(Float_t)DcaHeToPrimVertex;\r
- vett1[20]=(Float_t)HeTrack->Eta();\r
- vett1[21]=(Float_t)momHeVett[0];\r
- vett1[22]=(Float_t)momHeVett[1];\r
- vett1[23]=(Float_t)momHeVett[2];\r
- vett1[24]=(Float_t)momHeVettAt[0];\r
- vett1[25]=(Float_t)momHeVettAt[1];\r
- vett1[26]=(Float_t)momHeVettAt[2];\r
- vett1[27]=(Float_t)HeTrack->GetTPCNcls();\r
- vett1[28]=(Float_t)impactXY;\r
- vett1[29]=(Float_t)impactZ;\r
- vett1[30]=(Float_t)HeTrack->GetITSClusterMap();\r
- vett1[31]=(Float_t)IsHeITSRefit;\r
- vett1[32]=(Float_t)PionTrack->GetSign(); //Pion\r
- vett1[33]=(Float_t)trackInPion.GetP();\r
- vett1[34]=(Float_t)PionTrack->GetTPCsignal();\r
- vett1[35]=(Float_t)DcaPionToPrimVertex;\r
- vett1[36]=(Float_t)PionTrack->Eta();\r
- vett1[37]=(Float_t)momPionVett[0];\r
- vett1[38]=(Float_t)momPionVett[1];\r
- vett1[39]=(Float_t)momPionVett[2];\r
- vett1[40]=(Float_t)momPionVettAt[0];\r
- vett1[41]=(Float_t)momPionVettAt[1];\r
- vett1[42]=(Float_t)momPionVettAt[2];\r
- vett1[43]=(Float_t)PionTrack->GetTPCNcls();\r
- vett1[44]=(Float_t)impactXYpi;\r
- vett1[45]=(Float_t)impactZpi;\r
- vett1[46]=(Float_t)PionTrack->GetITSClusterMap();\r
- vett1[47]=(Float_t)IsPiITSRefit;\r
- vett1[48]=(Float_t)xn;\r
- vett1[49]=(Float_t)xp;\r
- \r
- fNtuple1->Fill(vett1); \r
- \r
- }// positive TPC\r
- \r
- } //negative tpc\r
- \r
- }\r
- \r
- PostData(1,fListHistCascade);\r
- \r
-} //end userexec\r
-\r
-\r
-//________________________________________________________________________\r
-\r
-void AliAnalysisTaskHelium3Pi::Terminate(Option_t *) \r
-{\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
-}\r
-\r
-\r
+/**************************************************************************
+ * Contributors are not mentioned at all. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//
+//-----------------------------------------------------------------
+// AliAnalysisTaskHelium3Pi class
+//-----------------------------------------------------------------
+
+
+class TTree;
+class TParticle;
+class TVector3;
+
+#include "AliAnalysisManager.h"
+#include <AliMCEventHandler.h>
+#include <AliMCEvent.h>
+#include <AliStack.h>
+
+class AliESDVertex;
+class AliAODVertex;
+class AliESDv0;
+class AliAODv0;
+class AliCascadeVertexer;
+
+#include <iostream>
+#include "AliAnalysisTaskSE.h"
+#include "TList.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "TNtuple.h"
+#include "TGraph.h"
+#include "TCutG.h"
+#include "TF1.h"
+#include "TCanvas.h"
+#include "TMath.h"
+#include "TChain.h"
+#include "Riostream.h"
+#include "AliLog.h"
+#include "AliCascadeVertexer.h"
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+#include "AliExternalTrackParam.h"
+#include "AliAODEvent.h"
+#include "AliInputEventHandler.h"
+#include "AliESDcascade.h"
+#include "AliAODcascade.h"
+#include "AliAnalysisTaskHelium3Pi.h"
+#include "AliESDtrackCuts.h"
+#include "AliCentrality.h"
+#include "TString.h"
+#include <TDatime.h>
+#include <TRandom3.h>
+#include <TLorentzVector.h>
+
+const Int_t AliAnalysisTaskHelium3Pi::fgNrot = 15;
+
+ClassImp(AliAnalysisTaskHelium3Pi)
+
+//________________________________________________________________________
+AliAnalysisTaskHelium3Pi::AliAnalysisTaskHelium3Pi()
+: AliAnalysisTaskSE(),
+ fAnalysisType("ESD"),
+ fCollidingSystems(0),
+ fDataType("REAL"),
+ fListHistCascade(0),
+ fHistEventMultiplicity(0),
+ fHistTrackMultiplicity(0),
+ fHistTrackMultiplicityCent(0),
+ fHistTrackMultiplicitySemiCent(0),
+ fHistTrackMultiplicityMB(0),
+ fHistTrackMultiplicityPVCent(0),
+ fHistTrackMultiplicityPVSemiCent(0),
+ fHistTrackMultiplicityPVMB(0),
+ fHistMult(0),
+ fhBB(0),
+ fhTOF(0),
+ fhMassTOF(0),
+ fhBBPions(0),
+ fhBBHe(0),
+ fhNaPos(0),
+ fhNaNeg(0),
+ fBetavsTPCsignalPos(0),
+ fBetavsTPCsignalNeg(0),
+ fHelium3TOF(0),
+ fNtuple1(0),
+ fNtuple4(0)
+
+{
+ // Dummy Constructor
+}
+
+//________________________________________________________________________
+AliAnalysisTaskHelium3Pi::AliAnalysisTaskHelium3Pi(const char *name)
+ : AliAnalysisTaskSE(name),
+ fAnalysisType("ESD"),
+ fCollidingSystems(0),
+ fDataType("REAL"),
+ fListHistCascade(0),
+ fHistEventMultiplicity(0),
+ fHistTrackMultiplicity(0),
+ fHistTrackMultiplicityCent(0),
+ fHistTrackMultiplicitySemiCent(0),
+ fHistTrackMultiplicityMB(0),
+ fHistTrackMultiplicityPVCent(0),
+ fHistTrackMultiplicityPVSemiCent(0),
+ fHistTrackMultiplicityPVMB(0),
+ fHistMult(0),
+ fhBB(0),
+ fhTOF(0),
+ fhMassTOF(0),
+ fhBBPions(0),
+ fhBBHe(0),
+ fhNaPos(0),
+ fhNaNeg(0),
+ fBetavsTPCsignalPos(0),
+ fBetavsTPCsignalNeg(0),
+ fHelium3TOF(0),
+ fNtuple1(0),
+ fNtuple4(0)
+
+{
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ //DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TList container (Cascade)
+
+ DefineOutput(1, TList::Class());
+}
+//_______________________________________________________
+AliAnalysisTaskHelium3Pi::~AliAnalysisTaskHelium3Pi()
+{
+ // Destructor
+ if (fListHistCascade) {
+ delete fListHistCascade;
+ fListHistCascade = 0;
+ }
+
+}
+//=================DEFINITION BETHE BLOCH==============================
+
+Double_t AliAnalysisTaskHelium3Pi::BetheBloch(Double_t betaGamma,Double_t charge,Bool_t isPbPb) {
+
+ Double_t kp1, kp2, kp3, kp4, kp5;
+
+ if(isPbPb){
+
+ // pass1 2011
+ kp1 = 4.7*charge*charge;
+ kp2 = 8.98482806165147636e+00;
+ kp3 = 1.54000000000000005e-05;
+ kp4 = 2.30445734159456084e+00;
+ kp5 = 2.25624744086878559e+00;
+
+ }
+
+ else{
+
+ // to be defined ...
+ //pass1 2011
+ kp1 = 4.7*charge*charge;
+ kp2 = 8.98482806165147636e+00;
+ kp3 = 1.54000000000000005e-05;
+ kp4 = 2.30445734159456084e+00;
+ kp5 = 2.25624744086878559e+00;
+
+ }
+
+ Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);
+
+ Double_t aa = TMath::Power(beta, kp4);
+ Double_t bb = TMath::Power(1.0 / betaGamma, kp5);
+
+ bb = TMath::Log(kp3 + bb);
+
+ Double_t out = (kp2 - aa - bb) * kp1 / aa;
+
+ return out;
+
+}
+
+//==================DEFINITION OF OUTPUT OBJECTS==============================
+
+void AliAnalysisTaskHelium3Pi::UserCreateOutputObjects()
+{
+
+ fListHistCascade = new TList();
+ fListHistCascade->SetOwner(); // IMPORTANT!
+
+ if(! fHistEventMultiplicity ){
+ fHistEventMultiplicity = new TH1F( "fHistEventMultiplicity" , "Nb of Events" , 10 , 0, 10);
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(1,"All Events");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(2,"Events w/PV");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(3,"Events w/|Vz|<10cm");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(4,"Central Events");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(5,"SemiCentral Events");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(6,"MB Events");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(7,"Central Events w/|Vz|<10cm");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(8,"SemiCentral Events w/|Vz|<10cm");
+ fHistEventMultiplicity->GetXaxis()->SetBinLabel(9,"MB Events w/|Vz|<10cm");
+
+ fListHistCascade->Add(fHistEventMultiplicity);
+ }
+
+ if(! fHistTrackMultiplicity ){
+ fHistTrackMultiplicity = new TH2F( "fHistTrackMultiplicity" , "Nb of Tracks", 25000,0, 25000,105,-1,104);
+ fHistTrackMultiplicity->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicity->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicity);
+ }
+
+ if(! fHistTrackMultiplicityCent ){
+ fHistTrackMultiplicityCent = new TH2F( "fHistTrackMultiplicityCent", "Nb of Tracks Central Events", 25000,0, 25000,105,-1,104 );
+ fHistTrackMultiplicityCent->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicityCent->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicityCent);
+ }
+
+ if(! fHistTrackMultiplicitySemiCent ){
+ fHistTrackMultiplicitySemiCent = new TH2F( "fHistTrackMultiplicitySemiCent" , "Nb of Tracks SemiCentral Events", 25000,0, 25000 ,105,-1,104);
+ fHistTrackMultiplicitySemiCent->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicitySemiCent->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicitySemiCent);
+ }
+
+ if(! fHistTrackMultiplicityMB ){
+ fHistTrackMultiplicityMB = new TH2F( "fHistTrackMultiplicityMB" , "Nb of Tracks MBral Events", 25000,0, 25000,105,-1,104 );
+ fHistTrackMultiplicityMB->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicityMB->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicityMB);
+ }
+
+ if(! fHistTrackMultiplicityPVCent ){
+ fHistTrackMultiplicityPVCent = new TH2F( "fHistTrackMultiplicityPVCent" , "Nb of Tracks Central Events", 25000,0, 25000,105,-1,104 );
+ fHistTrackMultiplicityPVCent->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicityPVCent->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicityPVCent);
+ }
+
+ if(! fHistTrackMultiplicityPVSemiCent ){
+ fHistTrackMultiplicityPVSemiCent = new TH2F( "fHistTrackMultiplicityPVSemiCent" , "Nb of Tracks SemiCentral Events", 25000,0, 25000 ,105,-1,104);
+ fHistTrackMultiplicityPVSemiCent->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicityPVSemiCent->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicityPVSemiCent);
+ }
+
+ if(! fHistTrackMultiplicityPVMB ){
+ fHistTrackMultiplicityPVMB = new TH2F( "fHistTrackMultiplicityPVMB" , "Nb of Tracks MBral Events", 25000,0, 25000,105,-1,104 );
+ fHistTrackMultiplicityPVMB->GetXaxis()->SetTitle("Number of tracks");
+ fHistTrackMultiplicityPVMB->GetYaxis()->SetTitle("Percentile");
+ fListHistCascade->Add(fHistTrackMultiplicityPVMB);
+ }
+
+ if(! fHistMult){
+ fHistMult=new TH1F ("fHistMult","Number neg-pos", 10, -1,9);
+ fHistMult->GetXaxis()->SetTitle("Type of tracks");
+ fListHistCascade->Add(fHistMult);
+ }
+
+ if(! fhBB ){
+ fhBB = new TH2F( "fhBB" , "BetheBlochTPC" , 1000,-6,6,1500,0,5000);
+ fhBB->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fhBB->GetYaxis()->SetTitle("TPC Signal");
+ fListHistCascade->Add(fhBB);
+ }
+
+ if(! fhTOF ){
+ fhTOF = new TH2F( "fhTOF" , "Scatter Plot TOF" , 1000,-6,6,1000,0,1.2);
+ fhTOF->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fhTOF->GetYaxis()->SetTitle("#beta");
+ fListHistCascade->Add(fhTOF);
+ }
+
+ if(! fhMassTOF){
+ fhMassTOF=new TH1F ("fhMassTOF","Particle Mass - TOF", 300,0 ,5);
+ fhMassTOF->GetXaxis()->SetTitle("Mass (GeV/#it{c}^{2})");
+ fListHistCascade->Add(fhMassTOF);
+ }
+
+ if(! fhBBPions ){
+ fhBBPions = new TH2F( "fhBBPions" , "Bethe-Bloch TPC Pions" , 1000,-6,6,1500,0,5000);
+ fhBBPions->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fhBBPions->GetYaxis()->SetTitle("TPC Signal");
+ fListHistCascade->Add(fhBBPions);
+ }
+
+ if(! fhBBHe ){
+ fhBBHe = new TH2F( "fhBBHe" , "Bethe-Bloch TPC He" , 1000,-6,6,1500,0,5000);
+ fhBBHe->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fhBBHe->GetYaxis()->SetTitle("TPC Signal");
+ fListHistCascade->Add(fhBBHe);
+ }
+
+ if(! fhNaPos ){
+ fhNaPos = new TH2F( "fhNaPos" , "Distribution Pos" , 500,0,5,500,-2,2);
+ fhNaPos->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fhNaPos->GetYaxis()->SetTitle("(TPCSignal-bbtheo)/bbtheo (He)");
+ fListHistCascade->Add(fhNaPos);
+ }
+
+ if(! fhNaNeg ){
+ fhNaNeg = new TH2F( "fhNaNeg" , "Distribution Neg" , 500,0,5,500,-2,2);
+ fhNaNeg->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fhNaNeg->GetYaxis()->SetTitle("(TPCSignal-bbtheo)/bbtheo (He)");
+ fListHistCascade->Add(fhNaNeg);
+ }
+
+ if(! fBetavsTPCsignalPos ){
+ fBetavsTPCsignalPos = new TH2F("fBetavsTPCsignalPos","fBetavsTPCsignalPos",1000,0,1.2,1500,0,5000);
+ fBetavsTPCsignalPos->GetXaxis()->SetTitle("#beta");
+ fBetavsTPCsignalPos->GetYaxis()->SetTitle("TPC Signal");
+ fListHistCascade->Add(fBetavsTPCsignalPos);
+ }
+
+ if(! fBetavsTPCsignalNeg ){
+ fBetavsTPCsignalNeg = new TH2F("fBetavsTPCsignalNeg","fBetavsTPCsignalNeg",1000,0,1.2,1500,0,5000);
+ fBetavsTPCsignalNeg->GetXaxis()->SetTitle("#beta");
+ fBetavsTPCsignalNeg->GetYaxis()->SetTitle("TPC Signal");
+ fListHistCascade->Add(fBetavsTPCsignalNeg);
+ }
+
+ if(! fHelium3TOF){
+ fHelium3TOF = new TH2F("fHelium3massTOF","Helium3 beta vs p/z",1000,0,6,1000,0,1.2);
+ fHelium3TOF->GetXaxis()->SetTitle("p/z (GeV/#it{c})");
+ fHelium3TOF->GetYaxis()->SetTitle("#beta");
+ fListHistCascade->Add(fHelium3TOF);
+ }
+
+ if(! fNtuple1 ) {
+ fNtuple1 = new TNtuple("fNtuple1","Ntuple1","runNumber:bunchcross:orbit:period:eventtype:TrackNumber:percentile:xPrimaryVertex:yPrimaryVertex:zPrimaryVertex:xSecondaryVertex:ySecondaryVertex:zSecondaryVertex:dcaTracks:CosPointingAngle:DCAV0toPrimaryVertex:HeSign:HepInTPC:HeTPCsignal:DcaHeToPrimVertex:HeEta:momHex:momHey:momHez:momHeAtSVx:momHeAtSVy:momHeAtSVz:HeTPCNcls:HeimpactXY:HeimpactZ:HeITSClusterMap:IsHeITSRefit:PionSign:PionpInTPC:PionTPCsignal:DcaPionToPrimVertex:PionEta:momPionx:momPiony:momPionz:momNegPionAtSVx:momNegPionAtSVy:momNegPionAtSVz:PionTPCNcls:PionimpactXY:PionimpactZ:PionITSClusterMap:IsPiITSRefit:xn:xp");
+
+ fListHistCascade->Add(fNtuple1);
+ }
+
+ if(! fNtuple4 ) {
+ fNtuple4 = new TNtuple("fNtuple4","Ntuple4","runNumber:BCNumber:OrbitNumber:PeriodNumber:eventtype:isHeITSrefit:percentile:Sign:pinTPC:GetTPCsignal:Px:Py:Pz:Eta:isTOF:poutTPC:timeTOF:trackLenghtTOF:impactXY:impactZ:mapITS:TPCNcls:TRDsignal:xPrimaryVertex:yPrimaryVertex:zPrimaryVertex:chi2PerClusterTPC");
+ fListHistCascade->Add(fNtuple4);
+ }
+
+ PostData(1, fListHistCascade);
+
+}// end UserCreateOutputObjects
+
+
+
+//====================== USER EXEC ========================
+
+void AliAnalysisTaskHelium3Pi::UserExec(Option_t *)
+{
+ //_______________________________________________________________________
+
+ //!*********************!//
+ //! Define variables !//
+ //!*********************!//
+ Float_t vett1[50];
+ for(Int_t i=0;i<50;i++) vett1[i]=0;
+
+ Float_t vett4[40];
+ for(Int_t i=0;i<40;i++) vett4[i]=0;
+
+ Double_t ITSsample[4];
+ for(Int_t i=0;i<4;i++)ITSsample[i]=0;
+
+ Double_t pinTPC=0.,poutTPC=0.,TPCSignal=0.;
+ Double_t xPrimaryVertex=0.,yPrimaryVertex=0.,zPrimaryVertex=0.;
+ Double_t massTOF=0.,timeTOF=0.,trackLenghtTOF=0.,betaTOF=0.;
+
+ ULong_t status=0;
+ ULong_t statusT=0;
+ ULong_t statusPi=0;
+
+ Bool_t isTPC=kFALSE,isTOF=kFALSE,isTOFHe=kFALSE,IsHeITSRefit=kFALSE,isTOFPi=kFALSE,IsPiITSRefit=kFALSE ;
+
+ Float_t nSigmaNegPion=0.;
+ Float_t nSigmaNegPion1=0.;
+ Float_t nSigmaNegPion2=0.;
+
+ Double_t cutNSigma = 3;
+ Double_t bbtheoM=0.,bbtheoP=0.,bbtheo=0.;
+ Double_t zNathashaNeg=0;
+ Double_t zNathashaPos=0;
+ Double_t fPos[3]={0.,0.,0.};
+ Double_t runNumber=0.;
+ Double_t evNumber=0.;
+
+ Double_t BCNumber=0.;
+ Double_t OrbitNumber=0.;
+ Double_t PeriodNumber=0.;
+
+ Double_t Helium3Mass = 2.80839;
+ Double_t PionMass = 0.13957;
+ // TLORENTZ vectors
+
+ TLorentzVector vPion,vHelium,vSum;
+
+ //!----------------------------------------------------------------
+
+ //! A set of very loose parameters for cuts
+
+ Double_t fgChi2max=33.; //! max chi2
+ Double_t fgDNmin=0.05; //! min imp parameter for the 1st daughter = 500um
+ Double_t fgDCAmax=1.0; //! max DCA between the daughter tracks in cm
+ Double_t fgCPAmin=0.99; //! min cosine of V0's pointing angle
+ // Double_t fgRmin=0.2; //! min radius of the fiducial volume //original
+ Double_t fgRmin=0.1; //! min radius of the fiducial volume = 1 mm
+ Double_t fgRmax=200.; //! max radius of the fiducial volume = 2 m
+
+ //------------------------------------------
+
+ // Main loop
+ // Called for EACH event
+
+ AliVEvent *event = InputEvent();
+ if (!event) { Printf("ERROR: Could not retrieve event"); return; }
+
+ Info("AliAnalysisTaskHelium3Pi","Starting UserExec");
+
+ SetDataType("REAL");
+
+ // create pointer to event
+ AliESDEvent* lESDevent = dynamic_cast<AliESDEvent*>(event);
+ if (!lESDevent) {
+ AliError("Cannot get the ESD event");
+ return;
+ }
+
+ fHistEventMultiplicity->Fill(0);
+
+ Double_t lMagneticField=lESDevent->GetMagneticField();
+ Int_t TrackNumber = -1;
+
+
+ //*****************//
+ //* Centrality *//
+ //*****************//
+
+ AliCentrality *centrality = lESDevent->GetCentrality();
+ Float_t percentile=centrality->GetCentralityPercentile("V0M");
+
+ TrackNumber = lESDevent->GetNumberOfTracks();
+ if (TrackNumber<2) return;
+
+ fHistTrackMultiplicity->Fill(TrackNumber,percentile); //tracce per evento
+
+ //****************************************
+
+ Int_t eventtype=-99;
+
+ Bool_t isSelectedCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral);
+ Bool_t isSelectedSemiCentral = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral);
+ Bool_t isSelectedMB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
+
+ if(isSelectedCentral){
+ fHistEventMultiplicity->Fill(3);
+ fHistTrackMultiplicityCent->Fill(TrackNumber,percentile);
+ eventtype=1;
+ }
+
+ if(isSelectedSemiCentral){
+ fHistEventMultiplicity->Fill(4);
+ fHistTrackMultiplicitySemiCent->Fill(TrackNumber,percentile);
+ eventtype=2;
+ }
+
+ if(isSelectedMB){
+ fHistEventMultiplicity->Fill(5);
+ fHistTrackMultiplicityMB->Fill(TrackNumber,percentile);
+ eventtype=3;
+ }
+
+ if(isSelectedCentral || isSelectedSemiCentral || isSelectedMB){
+
+ // ANALISYS
+
+ // Primary vertex cut
+
+ const AliESDVertex *vtx = lESDevent->GetPrimaryVertexTracks();
+
+ if(vtx->GetNContributors()<1) {
+
+ // SPD vertex cut
+ vtx = lESDevent->GetPrimaryVertexSPD();
+
+ if(vtx->GetNContributors()<1) {
+ Info("AliAnalysisTaskHelium3Pi","No good vertex, skip event");
+ return; // NO GOOD VERTEX, SKIP EVENT
+ }
+ }
+
+ fHistEventMultiplicity->Fill(1); // analyzed events with PV
+
+ xPrimaryVertex=vtx->GetXv();
+ yPrimaryVertex=vtx->GetYv();
+ zPrimaryVertex=vtx->GetZv();
+
+ if(TMath::Abs(zPrimaryVertex)>10) return;
+
+ if(eventtype==1){
+ fHistTrackMultiplicityPVCent->Fill(TrackNumber,percentile);
+ fHistEventMultiplicity->Fill(6);
+ }
+
+ if(eventtype==2){
+ fHistTrackMultiplicityPVSemiCent->Fill(TrackNumber,percentile);
+ fHistEventMultiplicity->Fill(7);
+ }
+
+ if(eventtype==3){
+ fHistTrackMultiplicityPVMB->Fill(TrackNumber,percentile);
+ fHistEventMultiplicity->Fill(8);
+ }
+
+
+ fHistEventMultiplicity->Fill(2);
+
+ //Find Pair candidates
+
+ TArrayI PionsTPC(TrackNumber); //Neg pions
+ Int_t nPionsTPC=0;
+
+ TArrayI HeTPC(TrackNumber); //helium3
+ Int_t nHeTPC=0;
+
+ const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
+
+ Float_t impactXY=-999, impactZ=-999;
+ Float_t impactXYpi=-999, impactZpi=-999;
+
+ //! SELECTIONS:
+ //! - No ITSpureSA
+ //! - ITSrefit
+ //! - TPCrefit
+ //! - ITSmap !=0
+
+ // ******************* Track Cuts Definitions ********************//
+
+ //! ITS
+
+ AliESDtrackCuts* esdtrackCutsITS = new AliESDtrackCuts("esdtrackCutsITS");
+ esdtrackCutsITS->SetRequireITSStandAlone(kFALSE);
+ esdtrackCutsITS->SetRequireITSPureStandAlone(kFALSE);
+
+ //! TPC
+
+ Int_t minclsTPC=60;
+ Double_t maxchi2perTPCcl=5.;
+
+ AliESDtrackCuts* esdtrackCutsTPC = new AliESDtrackCuts("esdtrackCutsTPC");
+ esdtrackCutsTPC->SetRequireTPCRefit(kTRUE);
+ esdtrackCutsTPC->SetAcceptKinkDaughters(kFALSE);
+ esdtrackCutsTPC->SetMinNClustersTPC(minclsTPC);
+ esdtrackCutsTPC->SetMaxChi2PerClusterTPC(maxchi2perTPCcl);
+
+ //*********************************************+
+
+ runNumber = lESDevent->GetRunNumber();
+ evNumber = lESDevent->GetEventNumberInFile();
+
+ BCNumber = lESDevent->GetBunchCrossNumber();
+ OrbitNumber = lESDevent->GetOrbitNumber();
+ PeriodNumber= lESDevent->GetPeriodNumber();
+
+ //*************************************************************
+
+ TF1 *foPion=new TF1("foPion", "[0]*([1]*TMath::Power(TMath::Sqrt(1 + (x/0.13957)*(x/0.13957))/(x/0.13957) , [3]) - 1 - TMath::Power(TMath::Sqrt(1 + (x/0.13957)*(x/0.13957))/(x/0.13957) , [3])*TMath::Log([2] + 1/TMath::Power((x/0.13957), [4])))",0.01,20);
+ foPion->SetParameters(4.1,8.98482806165147636e+00,1.54000000000000005e-05,2.30445734159456084e+00,2.25624744086878559e+00);
+
+ //--------------------------------------------
+
+ for (Int_t j=0; j<TrackNumber; j++) { //loop on tracks
+
+ AliESDtrack *esdtrack=lESDevent->GetTrack(j);
+
+ if(!esdtrack) {
+ AliError(Form("ERROR: Could not retrieve esdtrack %d",j));
+ continue;
+ }
+
+ // ************** Track cuts ****************
+
+ status = (ULong_t)esdtrack->GetStatus();
+
+ isTPC = (((status) & AliESDtrack::kTPCin) != 0);
+ isTOF = ((((status) & AliESDtrack::kTOFout) != 0) && (((status) & AliESDtrack::kTIME) != 0));
+
+ Bool_t IsTrackAcceptedTPC = esdtrackCutsTPC->AcceptTrack(esdtrack);
+ Bool_t IsTrackAcceptedITS = esdtrackCutsITS->AcceptTrack(esdtrack);
+
+ if (!(IsTrackAcceptedTPC && IsTrackAcceptedITS)) continue;
+
+ UInt_t mapITS=esdtrack->GetITSClusterMap();
+ // if(mapITS==0) continue;
+
+ //----------------------------------------------
+
+ //****** Cuts from AliV0Vertex.cxx *************
+
+ Double_t d=esdtrack->GetD(xPrimaryVertex,yPrimaryVertex,lMagneticField);
+ // if (TMath::Abs(d)<fgDPmin) continue;
+ if (TMath::Abs(d)>fgRmax) continue;
+
+ //---- (Usefull) Stuff
+
+ TPCSignal=esdtrack->GetTPCsignal();
+
+ if (TPCSignal<10)continue;
+
+ if(!isTPC)continue;
+
+ if(!esdtrack->GetTPCInnerParam())continue;
+
+ AliExternalTrackParam trackIn(*esdtrack->GetInnerParam());
+ pinTPC = trackIn.GetP();
+
+ poutTPC=pinTPC;
+
+ fHistMult->Fill(0);
+
+ if((status) & (AliESDtrack::kITSrefit!=0)){
+ fHistMult->Fill(1);
+ fhBB->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);
+ }
+
+ timeTOF=esdtrack->GetTOFsignal(); // ps
+ trackLenghtTOF= esdtrack->GetIntegratedLength(); // cm
+
+ if(isTOF){
+
+ if(!esdtrack->GetOuterParam())continue;
+
+ AliExternalTrackParam trackOut(*esdtrack->GetOuterParam());
+
+ poutTPC = trackOut.GetP();
+
+ betaTOF= (trackLenghtTOF/timeTOF)/2.99792458e-2;
+
+ fhTOF->Fill(poutTPC*esdtrack->GetSign(),betaTOF);
+
+ Double_t mass2=(poutTPC*poutTPC)*((((speedOfLight*speedOfLight)*(timeTOF*timeTOF))-(trackLenghtTOF*trackLenghtTOF))/(trackLenghtTOF*trackLenghtTOF));
+ if(mass2>0) massTOF=TMath::Sqrt(mass2);
+ fhMassTOF->Fill(massTOF);
+
+ if(esdtrack->GetSign() < 0.)fBetavsTPCsignalNeg->Fill(betaTOF,TPCSignal);
+ if(esdtrack->GetSign() > 0.)fBetavsTPCsignalPos->Fill(betaTOF,TPCSignal);
+
+ }
+
+ //pass2
+
+ bbtheo =BetheBloch((2*pinTPC)/3.,2,kTRUE); //! OK
+ bbtheoM=(1 - 0.08*5)*bbtheo; //! OK
+ bbtheoP=(1 + 0.08*5)*bbtheo; //! OK
+
+ fHistMult->Fill(2);
+
+ if(esdtrack->GetSign()<0){
+ zNathashaNeg=(TPCSignal-bbtheo)/bbtheo;
+ fhNaNeg->Fill(pinTPC,zNathashaNeg);
+ }
+
+ if(esdtrack->GetSign() > 0.){
+ zNathashaPos=(TPCSignal-bbtheo)/bbtheo;
+ fhNaPos->Fill(pinTPC,zNathashaPos);
+ }
+
+ nSigmaNegPion1 = TMath::Abs((TPCSignal - foPion->Eval(pinTPC))/foPion->Eval(pinTPC))/0.07;
+ nSigmaNegPion2 = TMath::Abs((TPCSignal - foPion->Eval(pinTPC))/foPion->Eval(pinTPC))/0.04;
+
+ if(pinTPC<0.6)
+ nSigmaNegPion=nSigmaNegPion1;
+ if(pinTPC>=0.6)
+ nSigmaNegPion=nSigmaNegPion2;
+
+ if ( (nSigmaNegPion < cutNSigma)){
+
+ fhBBPions->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);
+
+ if(pinTPC<3){
+ PionsTPC[nPionsTPC++]=j;
+ }
+ }
+
+ if( TPCSignal > bbtheoM ) {
+
+ if(pinTPC>0.6){
+
+ fhBBHe->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);
+ HeTPC[nHeTPC++]=j;
+
+
+ Bool_t isHeITSrefit=((status) & (AliESDtrack::kITSrefit));
+
+ esdtrack->GetImpactParameters(impactXY, impactZ);
+ esdtrack->GetITSdEdxSamples(ITSsample);
+
+
+ Int_t fIdxInt[200]; //dummy array
+ Int_t nClustersTPC = esdtrack->GetTPCclusters(fIdxInt);
+
+ Float_t chi2PerClusterTPC = esdtrack->GetTPCchi2()/(Float_t)(nClustersTPC);
+
+ vett4[0] =(Float_t)runNumber;
+ vett4[1] =(Float_t)BCNumber;
+ vett4[2] =(Float_t)OrbitNumber;
+ vett4[3] =(Float_t)PeriodNumber;
+ vett4[4] =(Float_t)eventtype;
+ vett4[5] =(Float_t)isHeITSrefit;
+ vett4[6] =(Float_t)percentile;
+ vett4[7] =(Float_t)esdtrack->GetSign();
+ vett4[8] =(Float_t)pinTPC;
+ vett4[9] =(Float_t)esdtrack->GetTPCsignal();
+ vett4[10]=(Float_t)esdtrack->Px();
+ vett4[11]=(Float_t)esdtrack->Py();
+ vett4[12]=(Float_t)esdtrack->Pz();
+ vett4[13]=(Float_t)esdtrack->Eta();
+ vett4[14]=(Float_t)isTOF;
+ vett4[15]=(Float_t)poutTPC;
+ vett4[16]=(Float_t)timeTOF;
+ vett4[17]=(Float_t)trackLenghtTOF;
+ vett4[18]=(Float_t)impactXY;
+ vett4[19]=(Float_t)impactZ;
+ vett4[20]=(Float_t)mapITS;
+ vett4[21]=(Float_t)esdtrack->GetTPCNcls();
+ vett4[22]=(Float_t)esdtrack->GetTRDsignal();
+ vett4[23]=(Float_t)xPrimaryVertex;
+ vett4[24]=(Float_t)yPrimaryVertex;
+ vett4[25]=(Float_t)zPrimaryVertex;
+ vett4[26]=(Float_t)chi2PerClusterTPC;
+
+ fNtuple4->Fill(vett4);
+ }
+ }
+ } //! track
+
+
+ Double_t DcaHeToPrimVertex=0;
+ Double_t DcaPionToPrimVertex=0;
+
+ impactXY=-999, impactZ=-999;
+ impactXYpi=-999, impactZpi=-999;
+
+ // Track
+
+ AliESDtrack *PionTrack = 0x0;
+ AliESDtrack *HeTrack = 0x0;
+
+ // Vettors for il PxPyPz
+
+ Double_t momPionVett[3];
+ for(Int_t i=0;i<3;i++)momPionVett[i]=0;
+
+ Double_t momHeVett[3];
+ for(Int_t i=0;i<3;i++)momHeVett[i]=0;
+
+ //At SV
+
+ Double_t momPionVettAt[3];
+ for(Int_t i=0;i<3;i++)momPionVettAt[i]=0;
+
+ Double_t momHeVettAt[3];
+ for(Int_t i=0;i<3;i++)momHeVettAt[i]=0;
+
+ //--------------- LOOP PAIRS ----------------
+
+ for (Int_t k=0; k < nPionsTPC; k++) { //! Pions Loop
+
+ DcaPionToPrimVertex=0.;
+ DcaHeToPrimVertex=0;
+
+ Int_t PionIdx=PionsTPC[k];
+
+ PionTrack=lESDevent->GetTrack(PionIdx);
+
+ statusPi = (ULong_t)PionTrack->GetStatus();
+ isTOFPi = ((((statusPi) & (AliESDtrack::kTOFout)) != 0) && (((statusPi) & (AliESDtrack::kTIME)) != 0));
+ IsPiITSRefit = ((statusPi) & (AliESDtrack::kITSrefit));
+
+ if (PionTrack)
+ DcaPionToPrimVertex = TMath::Abs(PionTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK
+
+ if(DcaPionToPrimVertex<0.2)continue; //qui
+
+ AliExternalTrackParam trackInPion(*PionTrack);
+
+ for (Int_t i=0; i<nHeTPC; i++){ //! Helium Loop
+
+ Int_t HeIdx=HeTPC[i];
+
+ HeTrack=lESDevent->GetTrack(HeIdx);
+
+ statusT= (ULong_t)HeTrack->GetStatus();
+ isTOFHe = (((statusT & AliESDtrack::kTOFout) != 0) && ((statusT & AliESDtrack::kTIME) != 0));
+ IsHeITSRefit = (status & AliESDtrack::kITSrefit);
+
+ if (HeTrack)
+ DcaHeToPrimVertex = TMath::Abs(HeTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK
+
+ AliExternalTrackParam trackInHe(*HeTrack);
+
+ if ( DcaPionToPrimVertex < fgDNmin) //OK
+ if ( DcaHeToPrimVertex < fgDNmin) continue; //OK
+
+ Double_t xn, xp;
+ Double_t dca=0.;
+
+ dca= PionTrack->GetDCA(HeTrack,lMagneticField,xn,xp); //!dca (Neg to Pos)
+
+ if (dca > fgDCAmax) continue;
+ if ((xn+xp) > 2*fgRmax) continue;
+ if ((xn+xp) < 2*fgRmin) continue;
+
+ //CORRECTION from AliV0Vertex
+
+ Bool_t corrected=kFALSE;
+ if ((trackInPion.GetX() > 3.) && (xn < 3.)) {
+ //correct for the beam pipe material
+ corrected=kTRUE;
+ }
+ if ((trackInHe.GetX() > 3.) && (xp < 3.)) {
+ //correct for the beam pipe material
+ corrected=kTRUE;
+ }
+ if (corrected) {
+ dca=trackInPion.GetDCA(&trackInHe,lMagneticField,xn,xp);
+ if (dca > fgDCAmax) continue;
+ if ((xn+xp) > 2*fgRmax) continue;
+ if ((xn+xp) < 2*fgRmin) continue;
+ }
+
+ //=============================================//
+ // Make "V0" with found tracks //
+ //=============================================//
+
+ trackInPion.PropagateTo(xn,lMagneticField);
+ trackInHe.PropagateTo(xp,lMagneticField);
+
+ AliESDv0 vertex(trackInPion,PionIdx,trackInHe,HeIdx);
+ if (vertex.GetChi2V0() > fgChi2max) continue;
+
+ Float_t CosPointingAngle=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex); //PointingAngle
+ if (CosPointingAngle < fgCPAmin) continue;
+
+ vertex.SetDcaV0Daughters(dca);
+ vertex.SetV0CosineOfPointingAngle(CosPointingAngle);
+
+ fPos[0]=vertex.Xv();
+ fPos[1]=vertex.Yv();
+ fPos[2]=vertex.Zv();
+
+ HeTrack->PxPyPz(momHeVett);
+ PionTrack->PxPyPz(momPionVett);
+
+ Double_t raggio=TMath::Sqrt(fPos[0]*fPos[0]+fPos[1]*fPos[1]+fPos[2]*fPos[2]);
+ HeTrack->GetPxPyPzAt(raggio,lMagneticField,momHeVettAt);
+ PionTrack->GetPxPyPzAt(raggio,lMagneticField,momPionVettAt);
+
+ //------------------------------------------------------------------------//
+
+ HeTrack->GetImpactParameters(impactXY, impactZ);
+
+ PionTrack->GetImpactParameters(impactXYpi, impactZpi);
+
+ if(vertex.GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex)>3) continue;
+
+ //salvo solo fino a 3.1 GeV/c2
+
+ vHelium.SetXYZM(2*momHeVettAt[0],2*momHeVettAt[1],2*momHeVettAt[2],Helium3Mass);
+ vPion.SetXYZM(momPionVettAt[0],momPionVettAt[1],momPionVettAt[2],PionMass);
+ vSum=vHelium+vPion;
+
+ if(vSum.M()>3.1)continue;
+
+ //----------------------------------------------------------------------//
+
+ vett1[0]=(Float_t)runNumber;
+ vett1[1]=(Float_t)BCNumber;
+ vett1[2]=(Float_t)OrbitNumber;
+ vett1[3]=(Float_t)PeriodNumber;
+ vett1[4]=(Float_t)eventtype;
+ vett1[5]=(Float_t)TrackNumber;
+ vett1[6]=(Float_t)percentile;
+ vett1[7]=(Float_t)xPrimaryVertex; //PRIMARY
+ vett1[8]=(Float_t)yPrimaryVertex;
+ vett1[9]=(Float_t)zPrimaryVertex;
+ vett1[10]=(Float_t)fPos[0]; //SECONDARY
+ vett1[11]=(Float_t)fPos[1];
+ vett1[12]=(Float_t)fPos[2];
+ vett1[13]=(Float_t)dca; //between 2 tracks
+ vett1[14]=(Float_t)CosPointingAngle; //cosPointingAngle da V0
+ vett1[15]=(Float_t)vertex.GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
+ vett1[16]=(Float_t)HeTrack->GetSign(); //He
+ vett1[17]=(Float_t)trackInHe.GetP();
+ vett1[18]=(Float_t)HeTrack->GetTPCsignal();
+ vett1[19]=(Float_t)DcaHeToPrimVertex;
+ vett1[20]=(Float_t)HeTrack->Eta();
+ vett1[21]=(Float_t)momHeVett[0];
+ vett1[22]=(Float_t)momHeVett[1];
+ vett1[23]=(Float_t)momHeVett[2];
+ vett1[24]=(Float_t)momHeVettAt[0];
+ vett1[25]=(Float_t)momHeVettAt[1];
+ vett1[26]=(Float_t)momHeVettAt[2];
+ vett1[27]=(Float_t)HeTrack->GetTPCNcls();
+ vett1[28]=(Float_t)impactXY;
+ vett1[29]=(Float_t)impactZ;
+ vett1[30]=(Float_t)HeTrack->GetITSClusterMap();
+ vett1[31]=(Float_t)IsHeITSRefit;
+ vett1[32]=(Float_t)PionTrack->GetSign(); //Pion
+ vett1[33]=(Float_t)trackInPion.GetP();
+ vett1[34]=(Float_t)PionTrack->GetTPCsignal();
+ vett1[35]=(Float_t)DcaPionToPrimVertex;
+ vett1[36]=(Float_t)PionTrack->Eta();
+ vett1[37]=(Float_t)momPionVett[0];
+ vett1[38]=(Float_t)momPionVett[1];
+ vett1[39]=(Float_t)momPionVett[2];
+ vett1[40]=(Float_t)momPionVettAt[0];
+ vett1[41]=(Float_t)momPionVettAt[1];
+ vett1[42]=(Float_t)momPionVettAt[2];
+ vett1[43]=(Float_t)PionTrack->GetTPCNcls();
+ vett1[44]=(Float_t)impactXYpi;
+ vett1[45]=(Float_t)impactZpi;
+ vett1[46]=(Float_t)PionTrack->GetITSClusterMap();
+ vett1[47]=(Float_t)IsPiITSRefit;
+ vett1[48]=(Float_t)xn;
+ vett1[49]=(Float_t)xp;
+
+ fNtuple1->Fill(vett1);
+
+ }// positive TPC
+
+ } //negative tpc
+
+ }
+
+ PostData(1,fListHistCascade);
+
+} //end userexec
+
+
+//________________________________________________________________________
+
+void AliAnalysisTaskHelium3Pi::Terminate(Option_t *)
+{
+ // Draw result to the screen
+ // Called once at the end of the query
+}
+
+
-/**************************************************************************\r
- * Contributors are not mentioned at all. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-//\r
-//-----------------------------------------------------------------\r
-// AliAnalysisTaskHelium3Pi class\r
-//-----------------------------------------------------------------\r
-\r
-\r
-class TTree;\r
-class TParticle;\r
-class TVector3;\r
-\r
-#include "AliAnalysisManager.h"\r
-#include <AliMCEventHandler.h>\r
-#include <AliMCEvent.h>\r
-#include <AliStack.h>\r
-\r
-class AliESDVertex;\r
-class AliAODVertex;\r
-class AliESDv0;\r
-class AliAODv0; \r
-class AliCascadeVertexer;\r
-\r
-#include <iostream>\r
-#include "AliAnalysisTaskSE.h"\r
-#include "TList.h"\r
-#include "TH1.h"\r
-#include "TH2.h"\r
-#include "TH3.h"\r
-#include "TNtuple.h"\r
-#include "TGraph.h"\r
-#include "TCutG.h"\r
-#include "TF1.h"\r
-#include "TCanvas.h"\r
-#include "TMath.h"\r
-#include "TChain.h"\r
-#include "Riostream.h"\r
-#include "AliLog.h"\r
-#include "AliCascadeVertexer.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDtrack.h"\r
-#include "AliExternalTrackParam.h"\r
-#include "AliAODEvent.h"\r
-#include "AliInputEventHandler.h"\r
-#include "AliESDcascade.h"\r
-#include "AliAODcascade.h"\r
-#include "AliAnalysisTaskHelium3PiMC.h"\r
-#include "AliESDtrackCuts.h"\r
-#include "AliCentrality.h"\r
-#include "TString.h"\r
-#include <TDatime.h>\r
-#include <TRandom3.h>\r
-using std::endl;\r
-using std::cout;\r
-\r
-const Int_t AliAnalysisTaskHelium3PiMC::fgNrot = 15;\r
-\r
-\r
-ClassImp(AliAnalysisTaskHelium3PiMC)\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskHelium3PiMC::AliAnalysisTaskHelium3PiMC() \r
-: AliAnalysisTaskSE(),\r
- fAnalysisType("ESD"), \r
- fCollidingSystems(0), \r
- fDataType("SIM"),\r
- fListHistCascade(0), \r
- fHistEventMultiplicity(0), \r
- fHistTrackMultiplicity(0),\r
- fHistMCMultiplicityTracks(0),\r
- fHistMCEta(0), \r
- fHistMCPt(0), \r
- fHistMCTheta(0), \r
- fHistMCDecayPosition(0),\r
- fHistMCDecayRho(0), \r
- fhRigidityHevsMomPiMC(0),\r
- fhRigidityHevsMomPiRec(0),\r
- fhInvMassMC(0),\r
- fhInvMassMum(0),\r
- fhInvMassRec(0),\r
- fhInvMassRec1(0),\r
- fhInvMassRec2(0), \r
- fhInvMassRec3(0),\r
- fhInvMassRec4(0),\r
- fhInvMassRec5(0),\r
- fhInvMassRec6(0),\r
- fhInvMassRec7(0),\r
- fhHeMCRigidity(0),\r
- fhPioneMC(0),\r
- hBBTPCnoCuts(0),\r
- fhBBTPC(0),\r
- fhBBTPCNegativePions(0),\r
- fhBBTPCPositivePions(0),\r
- fhBBTPCHe3(0),\r
- fHistProvaDCA(0),\r
- fHistPercentileVsTrackNumber(0),\r
- fhHeDCAXY(0),\r
- fhHeDCAZ(0),\r
- fhPiDCAXY(0),\r
- fhPiDCAZ(0),\r
- hITSClusterMap(0),\r
- fNtuple1(0),\r
- fNtuple2(0)\r
-\r
-{\r
- // Dummy Constructor(0); \r
-}\r
-\r
-//________________________________________________________________________\r
-AliAnalysisTaskHelium3PiMC::AliAnalysisTaskHelium3PiMC(const char *name) \r
- : AliAnalysisTaskSE(name), \r
- fAnalysisType("ESD"), \r
- fCollidingSystems(0), \r
- fDataType("SIM"),\r
- fListHistCascade(0), \r
- fHistEventMultiplicity(0), \r
- fHistTrackMultiplicity(0),\r
- fHistMCMultiplicityTracks(0),\r
- fHistMCEta(0), \r
- fHistMCPt(0), \r
- fHistMCTheta(0), \r
- fHistMCDecayPosition(0),\r
- fHistMCDecayRho(0), \r
- fhRigidityHevsMomPiMC(0),\r
- fhRigidityHevsMomPiRec(0),\r
- fhInvMassMC(0),\r
- fhInvMassMum(0),\r
- fhInvMassRec(0),\r
- fhInvMassRec1(0),\r
- fhInvMassRec2(0), \r
- fhInvMassRec3(0),\r
- fhInvMassRec4(0),\r
- fhInvMassRec5(0),\r
- fhInvMassRec6(0),\r
- fhInvMassRec7(0),\r
- fhHeMCRigidity(0),\r
- fhPioneMC(0),\r
- hBBTPCnoCuts(0),\r
- fhBBTPC(0),\r
- fhBBTPCNegativePions(0),\r
- fhBBTPCPositivePions(0),\r
- fhBBTPCHe3(0),\r
- fHistProvaDCA(0),\r
- fHistPercentileVsTrackNumber(0),\r
- fhHeDCAXY(0),\r
- fhHeDCAZ(0),\r
- fhPiDCAXY(0),\r
- fhPiDCAZ(0),\r
- hITSClusterMap(0),\r
- fNtuple1(0),\r
- fNtuple2(0)\r
- \r
-\r
-{\r
- // Define input and output slots here\r
- // Input slot #0 works with a TChain\r
- //DefineInput(0, TChain::Class());\r
- // Output slot #0 writes into a TList container (Cascade)\r
- DefineOutput(1, TList::Class());\r
-}\r
-//_______________________________________________________\r
-AliAnalysisTaskHelium3PiMC::~AliAnalysisTaskHelium3PiMC() \r
-{ \r
- // Destructor\r
- if (fListHistCascade) {\r
- delete fListHistCascade;\r
- fListHistCascade = 0;\r
- }\r
-\r
-}\r
-//=================DEFINITION BETHE BLOCH==============================\r
-\r
-Double_t AliAnalysisTaskHelium3PiMC::BetheBloch(Double_t betaGamma,Double_t charge,Bool_t isPbPb) {\r
-\r
- Double_t kp1, kp2, kp3, kp4, kp5;\r
- \r
- if(isPbPb){\r
-\r
- //pass2 //to be checked\r
- kp1 = 5.2*charge*charge;\r
- kp2 = 8.98482806165147636e+00;\r
- kp3 = 1.54000000000000005e-05;\r
- kp4 = 2.30445734159456084e+00;\r
- kp5 = 2.25624744086878559e+00;\r
-\r
-\r
- }\r
- \r
- else{\r
- \r
- //pass2 // to be defined\r
- kp1 = 5.2*charge*charge;\r
- kp2 = 8.98482806165147636e+00;\r
- kp3 = 1.54000000000000005e-05;\r
- kp4 = 2.30445734159456084e+00;\r
- kp5 = 2.25624744086878559e+00;\r
-\r
- }\r
-\r
- Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);\r
- \r
- Double_t aa = TMath::Power(beta, kp4);\r
- Double_t bb = TMath::Power(1.0 / betaGamma, kp5);\r
- \r
- bb = TMath::Log(kp3 + bb);\r
- \r
- Double_t out = (kp2 - aa - bb) * kp1 / aa;\r
-\r
- return out;\r
- \r
-}\r
-\r
-//==================DEFINITION OF OUTPUT OBJECTS==============================\r
-\r
-void AliAnalysisTaskHelium3PiMC::UserCreateOutputObjects()\r
-{\r
- fListHistCascade = new TList();\r
- fListHistCascade->SetOwner(); // IMPORTANT!\r
-\r
- if(! fHistEventMultiplicity ){\r
- fHistEventMultiplicity = new TH1F( "fHistEventMultiplicity" , "Nb of Events" , 6 , -1, 5 );\r
- fHistEventMultiplicity->GetXaxis()->SetTitle("Event Type");\r
- fListHistCascade->Add(fHistEventMultiplicity);\r
- }\r
-\r
- if(! fHistTrackMultiplicity ){\r
-\r
- fHistTrackMultiplicity = new TH1F( "fHistTrackMultiplicity" , "Nb of Tracks" , 25000,0, 25000 );\r
- fHistTrackMultiplicity->GetXaxis()->SetTitle("Number of tracks");\r
- fListHistCascade->Add(fHistTrackMultiplicity);\r
- } \r
- \r
- if(! fHistMCMultiplicityTracks){ \r
- fHistMCMultiplicityTracks =new TH1F("fHistMCMultiplicityTracks","MC Multiplicity Tracks",1000,0,1000); \r
- fHistMCMultiplicityTracks->GetXaxis()->SetTitle("MC Number of tracks");\r
- fListHistCascade->Add(fHistMCMultiplicityTracks); \r
- }\r
- if(!fHistMCEta ){ \r
- fHistMCEta=new TH1F("fHistMCEta","MC eta",1000,-3,3); \r
- fHistMCEta->GetXaxis()->SetTitle("Injected Eta");\r
- fListHistCascade->Add(fHistMCEta);\r
- } \r
- if(! fHistMCPt){ \r
- fHistMCPt =new TH1F("fHistMCPt","MC pt",1000,0,20); \r
- fHistMCPt->GetXaxis()->SetTitle("Injected Pt");\r
- fListHistCascade->Add(fHistMCPt); \r
- } \r
- if(!fHistMCTheta ){ \r
- fHistMCTheta=new TH1F("fHistMCTheta","MC theta",1000,-6,6); \r
- fHistMCTheta->GetXaxis()->SetTitle("Injected Theta");\r
- fListHistCascade->Add(fHistMCTheta); \r
- }\r
- if(!fHistMCDecayPosition){ \r
- fHistMCDecayPosition =new TH1F("fHistMCDecayPosition","MC Decay Position",10000,0,1000); \r
- fHistMCDecayPosition->GetXaxis()->SetTitle("Decay Position");\r
- fListHistCascade->Add(fHistMCDecayPosition); \r
- } \r
- if(!fHistMCDecayRho ){ \r
- fHistMCDecayRho =new TH1F("fHistMCDecayRho","MC decay position 3d",10000,0,1000); \r
- fHistMCDecayRho->GetXaxis()->SetTitle("Decay rho");\r
- fListHistCascade->Add(fHistMCDecayRho); \r
- } \r
-\r
- if(!fhRigidityHevsMomPiMC ){ \r
- fhRigidityHevsMomPiMC=new TH2F("fhRigidityHevsMomPiMC","Rigidity He vs Mom Pi MC",20,0,10,300,0,30);\r
- fhRigidityHevsMomPiMC->GetXaxis()->SetTitle("He3 Rigidity");\r
- fhRigidityHevsMomPiMC->GetYaxis()->SetTitle("Pi momentum");\r
- fListHistCascade->Add(fhRigidityHevsMomPiMC); \r
- }\r
-\r
- if(! fhRigidityHevsMomPiRec){ \r
- fhRigidityHevsMomPiRec=new TH2F("fhRigidityHevsMomPiRec","Rigidity He vs Mom Pi Rec",20,0,10,300,0,30);\r
- fhRigidityHevsMomPiRec->GetXaxis()->SetTitle("He3 Rigidity");\r
- fhRigidityHevsMomPiRec->GetYaxis()->SetTitle("Pi momentum");\r
- fListHistCascade->Add(fhRigidityHevsMomPiRec); \r
- }\r
- \r
- if(!fhInvMassMC){\r
- fhInvMassMC=new TH1F("fhInvMassMC","fhInvMassMC",800,2.,6.);\r
- fhInvMassMC->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassMC); \r
- }\r
- \r
- if(!fhInvMassMum){\r
- fhInvMassMum=new TH1F("fhInvMassMum","fhInvMassMum",800,2.,6.);\r
- fhInvMassMum->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassMum); \r
- }\r
- \r
- if(!fhInvMassRec){\r
- fhInvMassRec=new TH1F("fhInvMassRec","fhInvMassRec",800,2.,6.);\r
- fhInvMassRec->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec);\r
- }\r
-\r
- if(!fhInvMassRec1){\r
- fhInvMassRec1=new TH1F("fhInvMassRec1","No Altri tagli",800,2.,6.);\r
- fhInvMassRec1->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec1);\r
- }\r
- if(!fhInvMassRec2){\r
- fhInvMassRec2=new TH1F("fhInvMassRec2","DCA pi > 0.1",800,2.,6.);\r
- fhInvMassRec2->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec2);\r
- }\r
- if(!fhInvMassRec3){\r
- fhInvMassRec3=new TH1F("fhInvMassRec3","DCA He > 0.05",800,2.,6.);\r
- fhInvMassRec3->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec3);\r
- }\r
- if(!fhInvMassRec4){\r
- fhInvMassRec4=new TH1F("fhInvMassRec4","DCA tracks < 1 cm",800,2.,6.);\r
- fhInvMassRec4->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec4);\r
- }\r
- if(!fhInvMassRec5){\r
- fhInvMassRec5=new TH1F("fhInvMassRec5","Condizione xn+xp",800,2.,6.);\r
- fhInvMassRec5->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec5);\r
- }\r
- if(!fhInvMassRec6){\r
- fhInvMassRec6=new TH1F("fhInvMassRec6","Ho fatto V0 ",800,2.,6.);\r
- fhInvMassRec6->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec6);\r
- }\r
- if(!fhInvMassRec7){\r
- fhInvMassRec7=new TH1F("fhInvMassRec7","V0+Taglio CPA",800,2.,6.);\r
- fhInvMassRec7->GetXaxis()->SetTitle("(He3,#pi) InvMass");\r
- fListHistCascade->Add(fhInvMassRec7);\r
- }\r
-\r
- if(!fhHeMCRigidity ){ \r
- fhHeMCRigidity=new TH1F("fhHeMCRigidity","He3 rigidity distribution",200,0,20);\r
- fhHeMCRigidity->GetXaxis()->SetTitle("He3 rigidity");\r
- fListHistCascade->Add(fhHeMCRigidity); \r
- }\r
- if(!fhPioneMC ){ \r
- fhPioneMC=new TH1F("hPioneMC","Pion mom distribution",200,0,50);\r
- fhPioneMC->GetXaxis()->SetTitle("Pion momentum");\r
- fListHistCascade->Add(fhPioneMC); \r
- }\r
- \r
- if(!hBBTPCnoCuts ){ \r
- hBBTPCnoCuts=new TH2F("hBBTPCnoCuts","scatterPlot TPC no cuts",2000,-10,10,1000,0,3000);\r
- hBBTPCnoCuts->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");\r
- hBBTPCnoCuts->GetYaxis()->SetTitle("TPC Signal (a.u)");\r
- fListHistCascade->Add(hBBTPCnoCuts); \r
- }\r
- if(!fhBBTPC ){ \r
- fhBBTPC=new TH2F("fhBBTPC","scatterPlot TPC",2000,-10,10,1000,0,3000);\r
- fhBBTPC->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");\r
- fhBBTPC->GetYaxis()->SetTitle("TPC Signal (a.u)");\r
- fListHistCascade->Add(fhBBTPC); \r
- }\r
- if(!fhBBTPCNegativePions ){ \r
- fhBBTPCNegativePions=new TH2F("fhBBTPCNegativePions","scatterPlot Neg Pions",2000,-10,10,1000,0,3000);\r
- fhBBTPCNegativePions->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");\r
- fhBBTPCNegativePions->GetYaxis()->SetTitle("TPC Signal (a.u)");\r
- fListHistCascade->Add(fhBBTPCNegativePions); \r
- }\r
- if(!fhBBTPCPositivePions ){ \r
- fhBBTPCPositivePions=new TH2F("fhBBTPCPositivePions","scatterPlot Pos Pions",2000,-10,10,1000,0,3000);\r
- fhBBTPCPositivePions->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");\r
- fhBBTPCPositivePions->GetYaxis()->SetTitle("TPC Signal (a.u)");\r
- fListHistCascade->Add(fhBBTPCPositivePions); \r
- }\r
- if(!fhBBTPCHe3 ){ \r
- fhBBTPCHe3=new TH2F("fhBBTPCHe3","scatterPlot TPC - He3",2000,-10,10,1000,0,3000);\r
- fhBBTPCHe3->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");\r
- fhBBTPCHe3->GetYaxis()->SetTitle("TPC Signal (a.u)");\r
- fListHistCascade->Add(fhBBTPCHe3); \r
- }\r
- if(!fHistProvaDCA ){ \r
- fHistProvaDCA=new TH2F("fHistProvaDCA","fHistProvaDCA",1000,-50,50,1000,0,100);\r
- fHistProvaDCA->GetXaxis()->SetTitle("xn+xp");\r
- fHistProvaDCA->GetYaxis()->SetTitle("dca tracks");\r
- fListHistCascade->Add(fHistProvaDCA); \r
- }\r
- \r
- if(!hITSClusterMap ){ \r
- hITSClusterMap=new TH1F("hITSClusterMap","hITSClusterMap",65,-1,64);\r
- fListHistCascade->Add(hITSClusterMap); \r
- }\r
-\r
- if(!fHistPercentileVsTrackNumber){\r
- fHistPercentileVsTrackNumber=new TH2F("fHistPercentileVsTrackNumber","fHistPercentileVsTrackNumber",120,-3,117,2500,0,25000);\r
- fHistPercentileVsTrackNumber->GetXaxis()->SetTitle("Percentile");\r
- fHistPercentileVsTrackNumber->GetYaxis()->SetTitle("Tracks Number");\r
- fListHistCascade->Add(fHistPercentileVsTrackNumber); \r
- }\r
-\r
- if(!fhHeDCAXY){\r
- fhHeDCAXY=new TH1F("fhHeDCAXY","fhHeDCAXY",800,-4,4);\r
- fListHistCascade->Add(fhHeDCAXY); \r
- }\r
- if(!fhHeDCAZ){\r
- fhHeDCAZ=new TH1F("fhHeDCAZ","fhHeDCAZ",800,-30,30);\r
- fListHistCascade->Add(fhHeDCAZ); \r
- }\r
- if(!fhPiDCAXY){\r
- fhPiDCAXY=new TH1F("fhPiDCAXY","fhPiDCAXY",800,-4,4);\r
- fListHistCascade->Add(fhPiDCAXY); \r
- }\r
- if(!fhPiDCAZ){\r
- fhPiDCAZ=new TH1F("fhPiDCAZ","fhPiDCAZ",800,-30,30);\r
- fListHistCascade->Add(fhPiDCAZ); \r
- }\r
-\r
- if(! fNtuple1 ) {\r
- fNtuple1 = new TNtuple("fNtuple1","Ntuple1","runNumber:evNumber:TrackNumber:percentile:xPrimaryVertex:yPrimaryVertex:zPrimaryVertex:xSecondaryVertex:ySecondaryVertex:zSecondaryVertex:dcaTracks:CosPointingAngle:DCAV0toPrimaryVertex:HeSign:HepInTPC:HeTPCsignal:DcaHeToPrimVertex:HeEta:momHex:momHey:momHez:momHeAtSVx:momHeAtSVy:momHeAtSVz:HeTPCNcls:HeimpactXY:HeimpactZ:isTOFHe:HeBeta:HeITSClusterMap:IsHeITSRefit:PionSign:PionpInTPC:PionTPCsignal:DcaPionToPrimVertex:PionEta:momPionx:momPiony:momPionz:momNegPionAtSVx:momNegPionAtSVy:momNegPionAtSVz:PionTPCNcls:PionimpactXY:PionimpactZ:isTOFPion:PionBeta:PionITSClusterMap:IsPiITSRefit:PDGCodeNeg:PDCCodePos:motherPDGNeg:motherPDGPos:labelPi:labelHe:mumidNeg:mumidPos");\r
- \r
- fListHistCascade->Add(fNtuple1);\r
- }\r
- \r
- if(! fNtuple2 ) {\r
- \r
- fNtuple2 = new TNtuple("fNtuple2","Ntuple2","run:event:iMC:Centrality:PVx:PVy:PVz:PDGcodeMum:MotherIndex:SVxD0:SVyD0:SVzD0:SVxD1:SVyD1:SVzD1:SV3d:EtaMum:YMum:ThetaMum:PhiMum:PxMum:PyMum:PzMum:PdgDaughter0:PdgDaughter1:PxD0:PyD0:PzD0:PxD1:PyD1:PzD1");\r
- \r
- fListHistCascade->Add(fNtuple2);\r
- } \r
- \r
- PostData(1,fListHistCascade);\r
-\r
-}// end UserCreateOutputObjects\r
-\r
-\r
-\r
-//====================== USER EXEC ========================\r
-\r
-void AliAnalysisTaskHelium3PiMC::UserExec(Option_t *) \r
-{\r
- //_______________________________________________________________________\r
- \r
- //!*********************!//\r
- //! Define variables !//\r
- //!*********************!//\r
- Float_t vett1[60];\r
- for(Int_t i=0;i<60;i++) vett1[i]=0;\r
-\r
- Float_t vett2[40];\r
- for(Int_t i=0;i<40;i++) vett2[i]=0;\r
-\r
- Double_t ITSsample[4];\r
- for(Int_t i=0;i<4;i++)ITSsample[i]=0;\r
-\r
- Double_t ITSsamplePos[4];\r
- for(Int_t i=0;i<4;i++)ITSsamplePos[i]=0;\r
-\r
- Double_t ITSsampleNeg[4];\r
- for(Int_t i=0;i<4;i++)ITSsampleNeg[i]=0;\r
-\r
- Double_t pinTPC=0.,poutTPC=0.,TPCSignal=0.;\r
- Double_t xPrimaryVertex=0.,yPrimaryVertex=0.,zPrimaryVertex=0.;\r
-\r
- ULong_t status=0;\r
- ULong_t statusT=0;\r
- ULong_t statusPi=0;\r
-\r
- Bool_t isTPC=kFALSE,isTOF=kFALSE,isTOFHe3=kFALSE,isTOFPi=kFALSE;\r
-\r
- Double_t fPos[3]={0.,0.,0.};\r
- Double_t runNumber=0.;\r
- Double_t evNumber=0.;\r
- \r
- Int_t id0 = 0, id1 = 0;\r
- Double_t mcDecayPosXD0 = 0, mcDecayPosYD0 = 0, mcDecayPosR = 0, mcDecayPosZD0 =0, mcDecayPosRho=0.;\r
- Double_t mcDecayPosXD1 = 0, mcDecayPosYD1 = 0, mcDecayPosZD1 =0;\r
-\r
- Double_t lEtaCurrentPart =0., lPtCurrentPart = 0.,lThetaCurrentPart = 0., lPhiCurrentPart = 0.;\r
- Int_t iCurrentMother = 0;\r
- Double_t mcPosX = 0., mcPosY = 0.,mcPosZ = 0., mcPosR = 0.;\r
-\r
- Double_t lPdgCurrentDaughter0 = 0, lPdgCurrentDaughter1= 0., lPdgCurrentMother=0.,lPdgCurrentDaughter =0;\r
-\r
- Double_t PxD0 = 0, PyD0 = 0,PzD0 = 0;\r
- Double_t PxD1 = 0, PyD1 = 0,PzD1 = 0;\r
-\r
- Int_t lNbMCPrimary = 0;\r
- Int_t lNbMCPart = 0;\r
- Int_t lPdgcodeCurrentPart = 0;\r
- //!----------------------------------------------------------------\r
-\r
- //! A set of very loose parameters for cuts \r
- \r
- Double_t fgChi2max=33.; //! max chi2\r
- Double_t fgDNmin=0.05; //! min imp parameter for the 1st daughter = 500um\r
- Double_t fgDCAmax=1.; //! max DCA between the daughter tracks in cm\r
- Double_t fgCPAmin=0.9; //! min cosine of V0's pointing angle\r
- Double_t fgRmin=0.1; //! min radius of the fiducial volume = 1 mm \r
- Double_t fgRmax=200.; //! max radius of the fiducial volume = 2 m\r
-\r
- //------------------------------------------\r
- // create pointer to event\r
-\r
- AliVEvent *event = InputEvent();\r
- if (!event) { Printf("ERROR: Could not retrieve event"); return; }\r
-\r
-\r
-\r
-// AliVEvent *lESDevent = InputEvent();\r
-// if (!lESDevent) { \r
-// Printf("ERROR: Could not retrieve event"); \r
-// return; \r
-// }\r
- \r
- Info("AliAnalysisTaskHelium3PiMC","Starting UserExec"); \r
-\r
- SetDataType("SIM");\r
- AliStack *stack=0;\r
- \r
- if(fDataType == "SIM") {\r
- \r
- // Main loop\r
- // Called for EACH event\r
- AliMCEvent *mcEvent = MCEvent();\r
- if (!mcEvent) { \r
- Printf("ERROR: Could not retrieve MC event"); \r
- return; \r
- }\r
- \r
- Printf("MC particles: %d", mcEvent->GetNumberOfTracks());\r
- \r
- // set up a stack for use in check for primary/stable particles\r
- stack = mcEvent->Stack();\r
- if( !stack ) { Printf( "Stack not available"); return; }\r
- }\r
- \r
-\r
- AliESDEvent *lESDevent = 0x0;\r
-\r
- //********************************** Connect to the InputEvent ******//\r
- \r
- //Int_t TrackNumber = 0;\r
- if(fAnalysisType == "ESD"){\r
- lESDevent = dynamic_cast<AliESDEvent*>(event);\r
- if (!lESDevent) {\r
- Printf("ERROR: lESDevent not available \n");\r
- return;\r
- }\r
- }\r
-\r
- //*****************// \r
- //* Centrality *//\r
- //*****************//\r
-\r
- AliCentrality *centrality = lESDevent->GetCentrality();\r
- \r
- Float_t percentile=centrality->GetCentralityPercentile("V0M");\r
- \r
- //------------------------------\r
-\r
- runNumber = lESDevent->GetRunNumber();\r
- evNumber =lESDevent->GetEventNumberInFile();\r
-\r
- //---------------------\r
-\r
- // Int_t primary = stack->GetNprimary();\r
- Int_t label =-1;\r
-\r
- lNbMCPrimary = stack->GetNprimary();\r
- lNbMCPart = stack->GetNtrack();\r
- \r
- fHistMCMultiplicityTracks->Fill(lNbMCPart); //histo\r
-\r
- TArrayD MomPionsMC(lNbMCPart); //Neg pions\r
- Int_t nPionsMC=0;\r
- TArrayD MomHeMC(lNbMCPart); //helium3\r
- Int_t nHeMC=0;\r
-\r
- //------ Trimomento pion\r
- TArrayD PxPionsMC(lNbMCPart); \r
- Int_t nPxPionsMC=0;\r
- TArrayD PyPionsMC(lNbMCPart); \r
- Int_t nPyPionsMC=0;\r
- TArrayD PzPionsMC(lNbMCPart); \r
- Int_t nPzPionsMC=0;\r
- //------ Trimomento He\r
- TArrayD PxHeMC(lNbMCPart); \r
- Int_t nPxHeMC=0;\r
- TArrayD PyHeMC(lNbMCPart); \r
- Int_t nPyHeMC=0;\r
- TArrayD PzHeMC(lNbMCPart); \r
- Int_t nPzHeMC=0;\r
-\r
- //Mass Definition\r
-\r
- Double_t Helium3Mass = 2.80839; \r
- Double_t PionMass = 0.13957; \r
- \r
- TLorentzVector vPionMC,vHeliumMC,vSumMC;\r
- TLorentzVector vPionMum,vHeliumMum,vSumMum;\r
- TLorentzVector vPionRec,vHeliumRec,vSumRec;\r
- Bool_t isTwoBody=kFALSE;\r
-\r
- for (Int_t iMC=0; iMC<stack->GetNtrack(); iMC++)\r
- {\r
- TParticle *p0 = stack->Particle(iMC);\r
- \r
- if (!p0) {\r
- //Printf("ERROR: particle with label %d not found in stack (mc loop)", iMc);\r
- continue;\r
- }\r
- \r
- lPdgcodeCurrentPart = p0->GetPdgCode(); \r
- \r
- if(lPdgcodeCurrentPart == 1000020030 || lPdgcodeCurrentPart == -1000020030 ){\r
- \r
- MomHeMC[nHeMC++]=p0->P();\r
- \r
- PxHeMC[nPxHeMC++]=p0->Px();\r
- PyHeMC[nPyHeMC++]=p0->Py();\r
- PzHeMC[nPzHeMC++]=p0->Pz();\r
- \r
- fhHeMCRigidity->Fill(p0->P()/2);\r
- }\r
-\r
- if(lPdgcodeCurrentPart == 211 || lPdgcodeCurrentPart == -211 ){\r
-\r
- MomPionsMC[nPionsMC++]=p0->P();\r
- \r
- PxPionsMC[nPxPionsMC++]=p0->Px();\r
- PyPionsMC[nPyPionsMC++]=p0->Py();\r
- PzPionsMC[nPzPionsMC++]=p0->Pz();\r
- \r
- fhPioneMC->Fill(p0->P());\r
- }\r
- \r
- if ( lPdgcodeCurrentPart == 1010010030 || lPdgcodeCurrentPart == -1010010030 ){\r
-\r
- lEtaCurrentPart = p0->Eta();\r
- lPtCurrentPart = p0->Pt();\r
- lThetaCurrentPart = p0->Theta();\r
- lPhiCurrentPart = p0->Phi();\r
- iCurrentMother = p0->GetFirstMother();\r
- \r
- fHistMCEta->Fill(lEtaCurrentPart); \r
- fHistMCPt->Fill(lPtCurrentPart); \r
- fHistMCTheta->Fill(lThetaCurrentPart);\r
- \r
- if (iCurrentMother == -1){lPdgCurrentMother=0; } else {lPdgCurrentMother = stack->Particle(iCurrentMother)->GetPdgCode();}\r
- \r
- mcPosX = p0->Vx();\r
- mcPosY = p0->Vy();\r
- mcPosZ = p0->Vz();\r
- mcPosR = TMath::Sqrt(mcPosX*mcPosX+mcPosY*mcPosY);\r
-\r
- isTwoBody=kFALSE;\r
- \r
- for(Int_t i=p0->GetFirstDaughter(); i<= p0->GetLastDaughter(); i++){\r
- TParticle *pDaughter = stack->Particle(i);\r
- lPdgCurrentDaughter= pDaughter->GetPdgCode();\r
- cout<<lPdgCurrentDaughter<<endl;\r
- if(lPdgCurrentDaughter == 1000020030 || lPdgCurrentDaughter ==-1000020030 ){\r
- isTwoBody=kTRUE;\r
- \r
- }\r
- }\r
- \r
- if(isTwoBody){\r
- \r
- for(Int_t i=p0->GetFirstDaughter(); i<= p0->GetLastDaughter(); i++){\r
- \r
- TParticle *pDaughter = stack->Particle(i);\r
- \r
- lPdgCurrentDaughter= pDaughter->GetPdgCode();\r
- \r
- if(lPdgCurrentDaughter == 211 || lPdgCurrentDaughter == -211 ){\r
- id0 = i;\r
- }\r
- \r
- if(lPdgCurrentDaughter == 1000020030 || lPdgCurrentDaughter == -1000020030 ){\r
- id1 = i;\r
- }\r
- }\r
- \r
- TParticle *pDaughter0 = stack->Particle(id0);\r
- TParticle *pDaughter1 = stack->Particle(id1);\r
- lPdgCurrentDaughter0 = pDaughter0->GetPdgCode();\r
- lPdgCurrentDaughter1 = pDaughter1->GetPdgCode();\r
- \r
- // Decay Radius and Production Radius\r
- \r
- if ( id0 <= lNbMCPart && id0 > 0 && id1 <= lNbMCPart && id1 > 0) {\r
- \r
- lPdgCurrentDaughter0 = pDaughter0->GetPdgCode();\r
- lPdgCurrentDaughter1 = pDaughter1->GetPdgCode();\r
- \r
- PxD0 = pDaughter0->Px();\r
- PyD0 = pDaughter0->Py();\r
- PzD0 = pDaughter0->Pz();\r
- \r
- PxD1 = pDaughter1->Px();\r
- PyD1 = pDaughter1->Py();\r
- PzD1 = pDaughter1->Pz();\r
- \r
- mcDecayPosXD0 = pDaughter0->Vx();\r
- mcDecayPosYD0 = pDaughter0->Vy();\r
- mcDecayPosZD0 = pDaughter0->Vz();\r
- \r
- mcDecayPosXD1 = pDaughter0->Vx();\r
- mcDecayPosYD1 = pDaughter0->Vy();\r
- mcDecayPosZD1 = pDaughter0->Vz();\r
- \r
- mcDecayPosR = TMath::Sqrt(mcDecayPosXD0*mcDecayPosXD0+mcDecayPosYD0*mcDecayPosYD0);\r
- fHistMCDecayPosition->Fill(mcDecayPosR); \r
- \r
- mcDecayPosRho = TMath::Sqrt(mcDecayPosXD0*mcDecayPosXD0+mcDecayPosYD0*mcDecayPosYD0+mcDecayPosZD0*mcDecayPosZD0);\r
- fHistMCDecayRho->Fill(mcDecayPosRho); \r
- \r
- //---- Initial mass Test\r
- \r
- vHeliumMum.SetXYZM(PxD1,PyD1,PzD1,Helium3Mass); \r
- vPionMum.SetXYZM(PxD0,PyD0,PzD0,PionMass); \r
- vSumMum=vHeliumMum+vPionMum;\r
- \r
- fhInvMassMum->Fill(vSumMum.M());\r
- \r
- //Ntupla hyper triton\r
- \r
- vett2[0]=(Float_t)lESDevent->GetRunNumber();\r
- vett2[1]=(Float_t)lESDevent->GetEventNumberInFile();\r
- vett2[2]=(Float_t)iMC;\r
- vett2[3]=(Float_t)percentile;\r
- vett2[4]=(Float_t)mcPosX;\r
- vett2[5]=(Float_t)mcPosY;\r
- vett2[6]=(Float_t)mcPosZ;\r
- vett2[7]=(Float_t)lPdgcodeCurrentPart;\r
- vett2[8]=(Float_t)iCurrentMother;\r
- vett2[9]=(Float_t)mcDecayPosXD0;\r
- vett2[10]=(Float_t)mcDecayPosYD0;\r
- vett2[11]=(Float_t)mcDecayPosZD0;\r
- vett2[12]=(Float_t)mcDecayPosXD1;\r
- vett2[13]=(Float_t)mcDecayPosYD1;\r
- vett2[14]=(Float_t)mcDecayPosZD1;\r
- vett2[15]=(Float_t)mcDecayPosRho;\r
- vett2[16]=(Float_t)lEtaCurrentPart;\r
- vett2[17]=(Float_t)p0->Y();\r
- vett2[18]=(Float_t)lThetaCurrentPart;\r
- vett2[19]=(Float_t)lPhiCurrentPart;\r
- vett2[20]=(Float_t)p0->Px();\r
- vett2[21]=(Float_t)p0->Py();\r
- vett2[22]=(Float_t)p0->Pz();\r
- vett2[23]=(Float_t)lPdgCurrentDaughter0;\r
- vett2[24]=(Float_t)lPdgCurrentDaughter1;\r
- vett2[25]=(Float_t)PxD0; //pion\r
- vett2[26]=(Float_t)PyD0;\r
- vett2[27]=(Float_t)PzD0;\r
- vett2[28]=(Float_t)PxD1; //He3\r
- vett2[29]=(Float_t)PyD1;\r
- vett2[30]=(Float_t)PzD1;\r
- \r
- fNtuple2->Fill(vett2);\r
- \r
- }//if check daughters index\r
- }//is twobody\r
- } // if mother\r
- } // Kinetic Track loop ends here \r
- \r
- // Loop phase - space\r
- \r
- Double_t HeMomMC =0;\r
- Double_t PionMomMC=0;\r
- Double_t PxHeMc=0, PyHeMc=0,PzHeMc=0;\r
- Double_t PxPionMc=0, PyPionMc=0,PzPionMc=0;\r
-\r
- for(Int_t l=0; l < nHeMC; l++){\r
- \r
- HeMomMC=MomHeMC[l];\r
-\r
- PxHeMc=PxHeMC[l];\r
- PyHeMc=PyHeMC[l];\r
- PzHeMc=PzHeMC[l];\r
-\r
- for(Int_t k=0; k < nPionsMC; k++){\r
- \r
- PionMomMC=MomPionsMC[k];\r
- \r
- PxPionMc=PxPionsMC[k];\r
- PyPionMc=PyPionsMC[k];\r
- PzPionMc=PzPionsMC[k];\r
- \r
- fhRigidityHevsMomPiMC->Fill(HeMomMC/2,PionMomMC);\r
-\r
- vHeliumMC.SetXYZM(PxHeMc,PyHeMc,PzHeMc,Helium3Mass); \r
- vPionMC.SetXYZM(PxPionMc,PyPionMc,PzPionMc,PionMass); \r
- vSumMC=vHeliumMC+vPionMC;\r
- \r
- fhInvMassMC->Fill(vSumMC.M());\r
-\r
- }\r
- \r
- } // end loop phase space\r
-\r
- //-------------- RECONSTRUCTION -------------------\r
-\r
- fHistEventMultiplicity->Fill(0);\r
- \r
- Double_t lMagneticField=lESDevent->GetMagneticField();\r
-\r
- Int_t TrackNumber = -1;\r
-\r
- // ANALISYS reconstructed tracks\r
- \r
- // Primary vertex cut\r
- \r
- const AliESDVertex *vtx = lESDevent->GetPrimaryVertexTracks();\r
- \r
- if(vtx->GetNContributors()<1) {\r
- \r
- // SPD vertex cut\r
- vtx = lESDevent->GetPrimaryVertexSPD();\r
- \r
- if(vtx->GetNContributors()<1) {\r
- Info("AliAnalysisTaskHelium3PiMC","No good vertex, skip event");\r
- return; // NO GOOD VERTEX, SKIP EVENT \r
- }\r
- }\r
-\r
- fHistEventMultiplicity->Fill(1); // analyzed events with PV\r
- \r
- xPrimaryVertex=vtx->GetXv();\r
- yPrimaryVertex=vtx->GetYv();\r
- zPrimaryVertex=vtx->GetZv(); \r
-\r
- TrackNumber = lESDevent->GetNumberOfTracks();\r
- fHistTrackMultiplicity->Fill(TrackNumber); //tracce per evento\r
-\r
- fHistPercentileVsTrackNumber->Fill(percentile,TrackNumber);\r
-\r
- if (TrackNumber<2) return; \r
-\r
- fHistEventMultiplicity->Fill(2);\r
- \r
- //Find Pair candidates\r
- \r
- TArrayI PionsTPC(TrackNumber); //Neg pions\r
- Int_t nPionsTPC=0;\r
- \r
- TArrayI HeTPC(TrackNumber); //helium3\r
- Int_t nHeTPC=0;\r
- \r
- // find pairs candidates phase daughter tracks rec\r
-\r
- TArrayD MomPionsRec(TrackNumber); //Neg pions\r
- Int_t nPionsRec=0;\r
- \r
- TArrayD MomHeRec(TrackNumber); //helium3\r
- Int_t nHeRec=0;\r
-\r
- //------ Trimomento pion\r
- TArrayD PxPionsRec(TrackNumber); \r
- Int_t nPxPionsRec=0;\r
- TArrayD PyPionsRec(TrackNumber); \r
- Int_t nPyPionsRec=0;\r
- TArrayD PzPionsRec(TrackNumber); \r
- Int_t nPzPionsRec=0;\r
-\r
- //------ Trimomento He\r
- TArrayD PxHeRec(TrackNumber); \r
- Int_t nPxHeRec=0;\r
- TArrayD PyHeRec(TrackNumber); \r
- Int_t nPyHeRec=0;\r
- TArrayD PzHeRec(TrackNumber); \r
- Int_t nPzHeRec=0;\r
-\r
- Float_t impactXY=-999, impactZ=-999;\r
- Float_t impactXYpi=-999, impactZpi=-999;\r
- \r
- Int_t PDGCodePos=0;\r
- Int_t PDGCodeNeg=0;\r
- Int_t motherPDGNeg=0;\r
- Int_t motherPDGPos=0;\r
-\r
- Int_t mumpdg=-100;\r
- \r
- //! SELECTIONS:\r
- //! - No ITSpureSA\r
- //! - ITSrefit\r
- //! - TPCrefit\r
- //! - ITSmap !=0\r
-\r
- // ******************* Track Cuts Definitions ********************//\r
- \r
- //! ITS\r
-\r
- AliESDtrackCuts* esdtrackCutsITS = new AliESDtrackCuts("esdtrackCutsITS");\r
- esdtrackCutsITS->SetRequireITSStandAlone(kFALSE);\r
- esdtrackCutsITS->SetRequireITSPureStandAlone(kFALSE);\r
-\r
- //! TPC\r
- \r
- Int_t minclsTPC=60;\r
- Double_t maxchi2perTPCcl=5.;\r
- \r
- AliESDtrackCuts* esdtrackCutsTPC = new AliESDtrackCuts("esdtrackCutsTPC");\r
- esdtrackCutsTPC->SetRequireTPCRefit(kTRUE);\r
- esdtrackCutsTPC->SetAcceptKinkDaughters(kFALSE);\r
- esdtrackCutsTPC->SetMinNClustersTPC(minclsTPC);\r
- esdtrackCutsTPC->SetMaxChi2PerClusterTPC(maxchi2perTPCcl);\r
- \r
- //*************************************************************\r
- \r
- for (Int_t j=0; j<TrackNumber; j++) { //loop on tracks\r
- \r
- AliESDtrack *esdtrack=lESDevent->GetTrack(j);\r
- \r
- if(!esdtrack) { \r
- AliError(Form("ERROR: Could not retrieve esdtrack %d",j)); \r
- continue; \r
- }\r
-\r
- hBBTPCnoCuts->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());\r
-\r
- // ************** Track cuts ****************\r
- \r
- status = (ULong_t)esdtrack->GetStatus();\r
- \r
- isTPC = (((status) & (AliESDtrack::kTPCin)) != 0);\r
- isTOF = ((((status) & (AliESDtrack::kTOFout)) != 0) && (((status) & (AliESDtrack::kTIME)) != 0));\r
- \r
- Bool_t IsTrackAcceptedTPC = esdtrackCutsTPC->AcceptTrack(esdtrack);\r
- Bool_t IsTrackAcceptedITS = esdtrackCutsITS->AcceptTrack(esdtrack);\r
- \r
- if (!(IsTrackAcceptedTPC && IsTrackAcceptedITS)) continue;\r
-\r
- //----------------------------------------------\r
- \r
- //****** Cuts from AliV0Vertex.cxx *************\r
- \r
- Double_t d=esdtrack->GetD(xPrimaryVertex,yPrimaryVertex,lMagneticField);\r
- // if (TMath::Abs(d)<fgDPmin) continue;\r
- if (TMath::Abs(d)>fgRmax) continue;\r
- \r
- //---- (Usefull) Stuff\r
- \r
- TPCSignal=esdtrack->GetTPCsignal(); \r
- \r
- if (TPCSignal<10)continue;\r
- \r
- if(!isTPC)continue;\r
-\r
- if(!esdtrack->GetTPCInnerParam())continue;\r
- \r
- AliExternalTrackParam trackIn(*esdtrack->GetInnerParam()); \r
- pinTPC = trackIn.GetP(); \r
- \r
- poutTPC=pinTPC;\r
- \r
- fhBBTPC->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);\r
- \r
- d=esdtrack->GetD(xPrimaryVertex,yPrimaryVertex,lMagneticField);\r
- // if (TMath::Abs(d)<fgDPmin) continue;\r
- if (TMath::Abs(d)>fgRmax) continue;\r
-\r
- label = TMath::Abs(esdtrack->GetLabel());\r
- \r
- if (label>=10000000) {\r
- // Underlying event. 10000000 is the\r
- // value of fkMASKSTEP in AliRunDigitizer\r
- cout <<"Strange, there should be no underlying event"<<endl;\r
- }\r
- \r
- else {\r
- if (label>=lNbMCPart) {\r
- cout <<"Strange, label outside the range"<< endl;\r
- continue;\r
- }\r
- }\r
- \r
- TParticle * part = stack->Particle(label);\r
- \r
- Int_t PDGCode=part->GetPdgCode();\r
- Int_t mumid = part->GetFirstMother();\r
-\r
- if(mumid>-1){\r
- TParticle *mother=(TParticle*)stack->Particle(mumid);\r
- mumpdg = mother->GetPdgCode();\r
- }\r
- \r
- if(PDGCode==-211)\r
- fhBBTPCNegativePions->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());\r
- \r
- if(PDGCode==+211)\r
- fhBBTPCPositivePions->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());\r
-\r
-\r
- // if(PDGCode == 211){\r
- \r
- if(PDGCode==-211 || PDGCode==+211){\r
- \r
- PionsTPC[nPionsTPC++]=j;\r
- \r
- esdtrack->GetImpactParameters(impactXY, impactZ);\r
- fhPiDCAXY->Fill(impactXY);\r
- fhPiDCAZ->Fill(impactZ);\r
- \r
- MomPionsRec[nPionsRec++]=esdtrack->P();\r
-\r
- PxPionsRec[nPxPionsRec++]=esdtrack->Px();\r
- PyPionsRec[nPyPionsRec++]=esdtrack->Py();\r
- PzPionsRec[nPzPionsRec++]=esdtrack->Pz();\r
- \r
- }\r
- \r
- if(PDGCode==1000020030 ||PDGCode==-1000020030 ){\r
-\r
-\r
- HeTPC[nHeTPC++]=j;\r
-\r
- fhBBTPCHe3->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());\r
-\r
- esdtrack->GetImpactParameters(impactXY, impactZ);\r
- fhHeDCAXY->Fill(impactXY);\r
- fhHeDCAZ->Fill(impactZ);\r
- \r
- MomHeRec[nHeRec++]=esdtrack->P();\r
-\r
- PxHeRec[nPxHeRec++]=esdtrack->Px();\r
- PyHeRec[nPyHeRec++]=esdtrack->Py();\r
- PzHeRec[nPzHeRec++]=esdtrack->Pz();\r
- \r
- } \r
- \r
- } // ! track\r
-\r
- //-------------- LOOP pairs 1 -------------\r
- // Fill phase space and inva mass before cuts\r
- \r
- Double_t HeMomRec =0;\r
- Double_t PionMomRec=0;\r
- Double_t PxHeReco=0, PyHeReco=0,PzHeReco=0;\r
- Double_t PxPionReco=0, PyPionReco=0,PzPionReco=0;\r
-\r
- for(Int_t l=0; l < nHeRec; l++){\r
- \r
- HeMomRec=MomHeRec[l];\r
-\r
- PxHeReco=PxHeRec[l];\r
- PyHeReco=PyHeRec[l];\r
- PzHeReco=PzHeRec[l];\r
-\r
- for(Int_t k=0; k < nPionsRec; k++){\r
- \r
- PionMomRec=MomPionsRec[k];\r
- \r
- PxPionReco=PxPionsRec[k];\r
- PyPionReco=PyPionsRec[k];\r
- PzPionReco=PzPionsRec[k];\r
- \r
- fhRigidityHevsMomPiRec->Fill(HeMomRec,PionMomRec);\r
-\r
- vHeliumRec.SetXYZM(2*PxHeReco,2*PyHeReco,2*PzHeReco,Helium3Mass); \r
- vPionRec.SetXYZM(PxPionReco,PyPionReco,PzPionReco,PionMass); \r
- vSumRec=vHeliumRec+vPionRec;\r
- \r
- fhInvMassRec->Fill(vSumRec.M());\r
- }\r
- \r
- } // fine loop phase space\r
-\r
- //--------------- LOOP PAIRS ----------------------//\r
- \r
- Double_t DcaHeToPrimVertex=0;\r
- Double_t DcaPionToPrimVertex=0;\r
- \r
- impactXY=-999, impactZ=-999;\r
- impactXYpi=-999, impactZpi=-999;\r
- \r
- // Track \r
- \r
- AliESDtrack *PionTrack = 0x0;\r
- AliESDtrack *HeTrack = 0x0;\r
- \r
- // Vettori per il PxPyPz\r
- \r
- Double_t momPionVett[3];\r
- for(Int_t i=0;i<3;i++)momPionVett[i]=0;\r
- \r
- Double_t momHeVett[3];\r
- for(Int_t i=0;i<3;i++)momHeVett[i]=0;\r
- \r
- //At SV\r
- \r
- Double_t momPionVettAt[3];\r
- for(Int_t i=0;i<3;i++)momPionVettAt[i]=0;\r
- \r
- Double_t momHeVettAt[3];\r
- for(Int_t i=0;i<3;i++)momHeVettAt[i]=0;\r
- \r
- Bool_t IsHeITSRefit,IsPiITSRefit ;\r
- \r
- //----------- My 2nd Vertex Finder\r
- \r
- for (Int_t k=0; k < nPionsTPC; k++) { //! Pions Loop\r
- \r
- DcaPionToPrimVertex=0.;\r
- DcaHeToPrimVertex=0;\r
- \r
- Int_t PionIdx=PionsTPC[k];\r
- \r
- PionTrack=lESDevent->GetTrack(PionIdx);\r
- \r
- statusPi = (ULong_t)PionTrack->GetStatus();\r
- IsPiITSRefit = ((statusPi) & (AliESDtrack::kITSrefit)); \r
- \r
- Int_t labelPi = TMath::Abs(PionTrack->GetLabel());\r
- TParticle * partNeg = stack->Particle(labelPi);\r
- PDGCodeNeg=partNeg->GetPdgCode();\r
- \r
- Int_t mumidNeg = partNeg->GetFirstMother();\r
- if(mumidNeg>-1){\r
- TParticle *motherNeg=(TParticle*)stack->Particle(mumidNeg);\r
- motherPDGNeg = motherNeg->GetPdgCode();\r
- }\r
- \r
- if (PionTrack) \r
- DcaPionToPrimVertex = TMath::Abs(PionTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK\r
- \r
- if(DcaPionToPrimVertex<0.1)continue; \r
-\r
- AliExternalTrackParam trackInPion(*PionTrack); \r
- \r
- for (Int_t i=0; i<nHeTPC; i++){ //! Helium Loop\r
- \r
- Int_t HeIdx=HeTPC[i];\r
- \r
- HeTrack=lESDevent->GetTrack(HeIdx);\r
- \r
- statusT= (ULong_t)HeTrack->GetStatus();\r
- IsHeITSRefit = ((statusT) & (AliESDtrack::kITSrefit)); \r
- \r
- Int_t labelHe = TMath::Abs(HeTrack->GetLabel());\r
- TParticle * partPos = stack->Particle(labelHe);\r
- PDGCodePos=partPos->GetPdgCode();\r
- \r
- Int_t mumidPos = partPos->GetFirstMother();\r
- if(mumidPos>-1){\r
- TParticle *motherPos=(TParticle*)stack->Particle(mumidPos);\r
- motherPDGPos = motherPos->GetPdgCode();\r
- }\r
- \r
- if (HeTrack) \r
- DcaHeToPrimVertex = TMath::Abs(HeTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK\r
- \r
- AliExternalTrackParam trackInHe(*HeTrack); \r
- \r
- HeTrack->PxPyPz(momHeVett);\r
- PionTrack->PxPyPz(momPionVett); \r
- \r
- vHeliumRec.SetXYZM(2*momHeVett[0],2*momHeVett[1],2*momHeVett[2],Helium3Mass); \r
- vPionRec.SetXYZM(momPionVett[0],momPionVett[1],momPionVett[2],PionMass); \r
- vSumRec=vHeliumRec+vPionRec;\r
- \r
- fhInvMassRec1->Fill(vSumRec.M());\r
-\r
- fhInvMassRec2->Fill(vSumRec.M());\r
- \r
- if ( DcaPionToPrimVertex < fgDNmin) //OK\r
- if ( DcaHeToPrimVertex < fgDNmin) continue; //OK\r
-\r
- fhInvMassRec3->Fill(vSumRec.M());\r
-\r
- Double_t xn, xp;\r
- Double_t dca=0.;\r
- \r
- dca= PionTrack->GetDCA(HeTrack,lMagneticField,xn,xp); //!distance between two tracks (Neg to Pos)\r
- fHistProvaDCA->Fill(xn-xp,dca);\r
- if (dca > fgDCAmax) continue;\r
-\r
- fhInvMassRec4->Fill(vSumRec.M());\r
- \r
- if ((xn+xp) > 2*fgRmax) continue;\r
- if ((xn+xp) < 2*fgRmin) continue;\r
- fhInvMassRec5->Fill(vSumRec.M());\r
- \r
- //CORREZIONE da AliV0Vertex\r
- \r
- Bool_t corrected=kFALSE;\r
- if ((trackInPion.GetX() > 3.) && (xn < 3.)) {\r
- //correct for the beam pipe material\r
- corrected=kTRUE;\r
- }\r
- if ((trackInHe.GetX() > 3.) && (xp < 3.)) {\r
- //correct for the beam pipe material\r
- corrected=kTRUE;\r
- }\r
- if (corrected) {\r
- dca=trackInPion.GetDCA(&trackInHe,lMagneticField,xn,xp);\r
- if (dca > fgDCAmax) continue;\r
- if ((xn+xp) > 2*fgRmax) continue;\r
- if ((xn+xp) < 2*fgRmin) continue;\r
- }\r
- \r
- //=============================================//\r
- // Make a "V0" with Tracks //\r
- //=============================================//\r
- \r
- trackInPion.PropagateTo(xn,lMagneticField); \r
- trackInHe.PropagateTo(xp,lMagneticField);\r
- \r
- AliESDv0 vertex(trackInPion,PionIdx,trackInHe,HeIdx);\r
- if (vertex.GetChi2V0() > fgChi2max) continue;\r
- fhInvMassRec6->Fill(vSumRec.M());\r
-\r
- Float_t CosPointingAngle=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex); //PointingAngle\r
- if (CosPointingAngle < fgCPAmin) continue;\r
- \r
- fhInvMassRec7->Fill(vSumRec.M());\r
-\r
- vertex.SetDcaV0Daughters(dca);\r
- vertex.SetV0CosineOfPointingAngle(CosPointingAngle);\r
-\r
- fPos[0]=vertex.Xv();\r
- fPos[1]=vertex.Yv(); \r
- fPos[2]=vertex.Zv(); \r
- \r
-\r
- \r
- Double_t raggio=TMath::Sqrt(fPos[0]*fPos[0]+fPos[1]*fPos[1]+fPos[2]*fPos[2]);\r
- HeTrack->GetPxPyPzAt(raggio,lMagneticField,momHeVettAt);\r
- PionTrack->GetPxPyPzAt(raggio,lMagneticField,momPionVettAt); \r
- \r
- //------------------------------------------------------------------------//\r
-\r
- HeTrack->GetImpactParameters(impactXY, impactZ);\r
- \r
- PionTrack->GetImpactParameters(impactXYpi, impactZpi);\r
- \r
- Float_t timeTOFHe= HeTrack->GetTOFsignal(); // ps\r
- Float_t trackLenghtTOFHe= HeTrack->GetIntegratedLength(); // cm\r
-\r
- Float_t timeTOFPi= PionTrack->GetTOFsignal(); // ps\r
- Float_t trackLenghtTOFPi= PionTrack->GetIntegratedLength(); // cm\r
-\r
- //----------------------------------------------------------------------//\r
-\r
- vett1[0]=(Float_t)runNumber;\r
- vett1[1]=(Float_t)evNumber;\r
- vett1[2]=(Float_t)lNbMCPart;\r
- vett1[3]=(Float_t)percentile;\r
- vett1[4]=(Float_t)xPrimaryVertex; //PRIMARY\r
- vett1[5]=(Float_t)yPrimaryVertex;\r
- vett1[6]=(Float_t)zPrimaryVertex;\r
- vett1[7]=(Float_t)fPos[0]; //SECONDARY\r
- vett1[8]=(Float_t)fPos[1];\r
- vett1[9]=(Float_t)fPos[2];\r
- vett1[10]=(Float_t)dca; //between 2 tracks\r
- vett1[11]=(Float_t)CosPointingAngle; //cosPointingAngle da V0\r
- vett1[12]=(Float_t)vertex.GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);\r
- vett1[13]=(Float_t)HeTrack->GetSign(); //He\r
- vett1[14]=(Float_t)trackInHe.GetP();\r
- vett1[15]=(Float_t)HeTrack->GetTPCsignal();\r
- vett1[16]=(Float_t)DcaHeToPrimVertex;\r
- vett1[17]=(Float_t)HeTrack->Eta();\r
- vett1[18]=(Float_t)momHeVett[0];\r
- vett1[19]=(Float_t)momHeVett[1];\r
- vett1[20]=(Float_t)momHeVett[2];\r
- vett1[21]=(Float_t)momHeVettAt[0];\r
- vett1[22]=(Float_t)momHeVettAt[1];\r
- vett1[23]=(Float_t)momHeVettAt[2];\r
- vett1[24]=(Float_t)HeTrack->GetTPCNcls();\r
- vett1[25]=(Float_t)impactXY;\r
- vett1[26]=(Float_t)impactZ;\r
- vett1[27]=(Float_t)isTOFHe3;\r
- vett1[28]=(Float_t)(trackLenghtTOFHe/timeTOFHe)/2.99792458e-2;\r
- vett1[29]=(Float_t)HeTrack->GetITSClusterMap();\r
- vett1[30]=(Float_t)IsHeITSRefit;\r
- vett1[31]=(Float_t)PionTrack->GetSign(); //Pion\r
- vett1[32]=(Float_t)trackInPion.GetP();\r
- vett1[33]=(Float_t)PionTrack->GetTPCsignal();\r
- vett1[34]=(Float_t)DcaPionToPrimVertex;\r
- vett1[35]=(Float_t)PionTrack->Eta();\r
- vett1[36]=(Float_t)momPionVett[0];\r
- vett1[37]=(Float_t)momPionVett[1];\r
- vett1[38]=(Float_t)momPionVett[2];\r
- vett1[39]=(Float_t)momPionVettAt[0];\r
- vett1[40]=(Float_t)momPionVettAt[1];\r
- vett1[41]=(Float_t)momPionVettAt[2];\r
- vett1[42]=(Float_t)PionTrack->GetTPCNcls();\r
- vett1[43]=(Float_t)impactXYpi;\r
- vett1[44]=(Float_t)impactZpi;\r
- vett1[45]=(Float_t)isTOFPi;\r
- vett1[46]=(Float_t)(trackLenghtTOFPi/timeTOFPi)/2.99792458e-2;\r
- vett1[47]=(Float_t)PionTrack->GetITSClusterMap();\r
- vett1[48]=(Float_t)IsPiITSRefit;\r
- vett1[49]=(Float_t)PDGCodeNeg;\r
- vett1[50]=(Float_t)PDGCodePos;\r
- vett1[51]=(Float_t)motherPDGNeg;\r
- vett1[52]=(Float_t)motherPDGPos;\r
- vett1[53]=(Float_t)labelPi;\r
- vett1[54]=(Float_t)labelHe;\r
- vett1[55]=(Float_t)mumidNeg;\r
- vett1[56]=(Float_t)mumidPos;\r
-\r
- fNtuple1->Fill(vett1); \r
-\r
- }// positive TPC\r
- \r
- } //negative tpc\r
-\r
- PostData(1,fListHistCascade);\r
- \r
-}// end userexec\r
-\r
-\r
-//________________________________________________________________________\r
-//\r
-void AliAnalysisTaskHelium3PiMC::Terminate(Option_t *) \r
-{\r
- // Draw result to the screen\r
- // Called once at the end of the query\r
-}\r
-\r
+/**************************************************************************
+ * Contributors are not mentioned at all. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+//
+//-----------------------------------------------------------------
+// AliAnalysisTaskHelium3Pi class
+//-----------------------------------------------------------------
+
+
+class TTree;
+class TParticle;
+class TVector3;
+
+#include "AliAnalysisManager.h"
+#include <AliMCEventHandler.h>
+#include <AliMCEvent.h>
+#include <AliStack.h>
+
+class AliESDVertex;
+class AliAODVertex;
+class AliESDv0;
+class AliAODv0;
+class AliCascadeVertexer;
+
+#include <iostream>
+#include "AliAnalysisTaskSE.h"
+#include "TList.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "TNtuple.h"
+#include "TGraph.h"
+#include "TCutG.h"
+#include "TF1.h"
+#include "TCanvas.h"
+#include "TMath.h"
+#include "TChain.h"
+#include "Riostream.h"
+#include "AliLog.h"
+#include "AliCascadeVertexer.h"
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+#include "AliExternalTrackParam.h"
+#include "AliAODEvent.h"
+#include "AliInputEventHandler.h"
+#include "AliESDcascade.h"
+#include "AliAODcascade.h"
+#include "AliAnalysisTaskHelium3PiMC.h"
+#include "AliESDtrackCuts.h"
+#include "AliCentrality.h"
+#include "TString.h"
+#include <TDatime.h>
+#include <TRandom3.h>
+using std::endl;
+using std::cout;
+
+const Int_t AliAnalysisTaskHelium3PiMC::fgNrot = 15;
+
+
+ClassImp(AliAnalysisTaskHelium3PiMC)
+
+//________________________________________________________________________
+AliAnalysisTaskHelium3PiMC::AliAnalysisTaskHelium3PiMC()
+: AliAnalysisTaskSE(),
+ fAnalysisType("ESD"),
+ fCollidingSystems(0),
+ fDataType("SIM"),
+ fListHistCascade(0),
+ fHistEventMultiplicity(0),
+ fHistTrackMultiplicity(0),
+ fHistMCMultiplicityTracks(0),
+ fHistMCEta(0),
+ fHistMCPt(0),
+ fHistMCTheta(0),
+ fHistMCDecayPosition(0),
+ fHistMCDecayRho(0),
+ fhRigidityHevsMomPiMC(0),
+ fhRigidityHevsMomPiRec(0),
+ fhInvMassMC(0),
+ fhInvMassMum(0),
+ fhInvMassRec(0),
+ fhInvMassRec1(0),
+ fhInvMassRec2(0),
+ fhInvMassRec3(0),
+ fhInvMassRec4(0),
+ fhInvMassRec5(0),
+ fhInvMassRec6(0),
+ fhInvMassRec7(0),
+ fhHeMCRigidity(0),
+ fhPioneMC(0),
+ hBBTPCnoCuts(0),
+ fhBBTPC(0),
+ fhBBTPCNegativePions(0),
+ fhBBTPCPositivePions(0),
+ fhBBTPCHe3(0),
+ fHistProvaDCA(0),
+ fHistPercentileVsTrackNumber(0),
+ fhHeDCAXY(0),
+ fhHeDCAZ(0),
+ fhPiDCAXY(0),
+ fhPiDCAZ(0),
+ hITSClusterMap(0),
+ fNtuple1(0),
+ fNtuple2(0)
+
+{
+ // Dummy Constructor(0);
+}
+
+//________________________________________________________________________
+AliAnalysisTaskHelium3PiMC::AliAnalysisTaskHelium3PiMC(const char *name)
+ : AliAnalysisTaskSE(name),
+ fAnalysisType("ESD"),
+ fCollidingSystems(0),
+ fDataType("SIM"),
+ fListHistCascade(0),
+ fHistEventMultiplicity(0),
+ fHistTrackMultiplicity(0),
+ fHistMCMultiplicityTracks(0),
+ fHistMCEta(0),
+ fHistMCPt(0),
+ fHistMCTheta(0),
+ fHistMCDecayPosition(0),
+ fHistMCDecayRho(0),
+ fhRigidityHevsMomPiMC(0),
+ fhRigidityHevsMomPiRec(0),
+ fhInvMassMC(0),
+ fhInvMassMum(0),
+ fhInvMassRec(0),
+ fhInvMassRec1(0),
+ fhInvMassRec2(0),
+ fhInvMassRec3(0),
+ fhInvMassRec4(0),
+ fhInvMassRec5(0),
+ fhInvMassRec6(0),
+ fhInvMassRec7(0),
+ fhHeMCRigidity(0),
+ fhPioneMC(0),
+ hBBTPCnoCuts(0),
+ fhBBTPC(0),
+ fhBBTPCNegativePions(0),
+ fhBBTPCPositivePions(0),
+ fhBBTPCHe3(0),
+ fHistProvaDCA(0),
+ fHistPercentileVsTrackNumber(0),
+ fhHeDCAXY(0),
+ fhHeDCAZ(0),
+ fhPiDCAXY(0),
+ fhPiDCAZ(0),
+ hITSClusterMap(0),
+ fNtuple1(0),
+ fNtuple2(0)
+
+
+{
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ //DefineInput(0, TChain::Class());
+ // Output slot #0 writes into a TList container (Cascade)
+ DefineOutput(1, TList::Class());
+}
+//_______________________________________________________
+AliAnalysisTaskHelium3PiMC::~AliAnalysisTaskHelium3PiMC()
+{
+ // Destructor
+ if (fListHistCascade) {
+ delete fListHistCascade;
+ fListHistCascade = 0;
+ }
+
+}
+//=================DEFINITION BETHE BLOCH==============================
+
+Double_t AliAnalysisTaskHelium3PiMC::BetheBloch(Double_t betaGamma,Double_t charge,Bool_t isPbPb) {
+
+ Double_t kp1, kp2, kp3, kp4, kp5;
+
+ if(isPbPb){
+
+ //pass2 //to be checked
+ kp1 = 5.2*charge*charge;
+ kp2 = 8.98482806165147636e+00;
+ kp3 = 1.54000000000000005e-05;
+ kp4 = 2.30445734159456084e+00;
+ kp5 = 2.25624744086878559e+00;
+
+
+ }
+
+ else{
+
+ //pass2 // to be defined
+ kp1 = 5.2*charge*charge;
+ kp2 = 8.98482806165147636e+00;
+ kp3 = 1.54000000000000005e-05;
+ kp4 = 2.30445734159456084e+00;
+ kp5 = 2.25624744086878559e+00;
+
+ }
+
+ Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);
+
+ Double_t aa = TMath::Power(beta, kp4);
+ Double_t bb = TMath::Power(1.0 / betaGamma, kp5);
+
+ bb = TMath::Log(kp3 + bb);
+
+ Double_t out = (kp2 - aa - bb) * kp1 / aa;
+
+ return out;
+
+}
+
+//==================DEFINITION OF OUTPUT OBJECTS==============================
+
+void AliAnalysisTaskHelium3PiMC::UserCreateOutputObjects()
+{
+ fListHistCascade = new TList();
+ fListHistCascade->SetOwner(); // IMPORTANT!
+
+ if(! fHistEventMultiplicity ){
+ fHistEventMultiplicity = new TH1F( "fHistEventMultiplicity" , "Nb of Events" , 6 , -1, 5 );
+ fHistEventMultiplicity->GetXaxis()->SetTitle("Event Type");
+ fListHistCascade->Add(fHistEventMultiplicity);
+ }
+
+ if(! fHistTrackMultiplicity ){
+
+ fHistTrackMultiplicity = new TH1F( "fHistTrackMultiplicity" , "Nb of Tracks" , 25000,0, 25000 );
+ fHistTrackMultiplicity->GetXaxis()->SetTitle("Number of tracks");
+ fListHistCascade->Add(fHistTrackMultiplicity);
+ }
+
+ if(! fHistMCMultiplicityTracks){
+ fHistMCMultiplicityTracks =new TH1F("fHistMCMultiplicityTracks","MC Multiplicity Tracks",1000,0,1000);
+ fHistMCMultiplicityTracks->GetXaxis()->SetTitle("MC Number of tracks");
+ fListHistCascade->Add(fHistMCMultiplicityTracks);
+ }
+ if(!fHistMCEta ){
+ fHistMCEta=new TH1F("fHistMCEta","MC eta",1000,-3,3);
+ fHistMCEta->GetXaxis()->SetTitle("Injected Eta");
+ fListHistCascade->Add(fHistMCEta);
+ }
+ if(! fHistMCPt){
+ fHistMCPt =new TH1F("fHistMCPt","MC pt",1000,0,20);
+ fHistMCPt->GetXaxis()->SetTitle("Injected Pt");
+ fListHistCascade->Add(fHistMCPt);
+ }
+ if(!fHistMCTheta ){
+ fHistMCTheta=new TH1F("fHistMCTheta","MC theta",1000,-6,6);
+ fHistMCTheta->GetXaxis()->SetTitle("Injected Theta");
+ fListHistCascade->Add(fHistMCTheta);
+ }
+ if(!fHistMCDecayPosition){
+ fHistMCDecayPosition =new TH1F("fHistMCDecayPosition","MC Decay Position",10000,0,1000);
+ fHistMCDecayPosition->GetXaxis()->SetTitle("Decay Position");
+ fListHistCascade->Add(fHistMCDecayPosition);
+ }
+ if(!fHistMCDecayRho ){
+ fHistMCDecayRho =new TH1F("fHistMCDecayRho","MC decay position 3d",10000,0,1000);
+ fHistMCDecayRho->GetXaxis()->SetTitle("Decay rho");
+ fListHistCascade->Add(fHistMCDecayRho);
+ }
+
+ if(!fhRigidityHevsMomPiMC ){
+ fhRigidityHevsMomPiMC=new TH2F("fhRigidityHevsMomPiMC","Rigidity He vs Mom Pi MC",20,0,10,300,0,30);
+ fhRigidityHevsMomPiMC->GetXaxis()->SetTitle("He3 Rigidity");
+ fhRigidityHevsMomPiMC->GetYaxis()->SetTitle("Pi momentum");
+ fListHistCascade->Add(fhRigidityHevsMomPiMC);
+ }
+
+ if(! fhRigidityHevsMomPiRec){
+ fhRigidityHevsMomPiRec=new TH2F("fhRigidityHevsMomPiRec","Rigidity He vs Mom Pi Rec",20,0,10,300,0,30);
+ fhRigidityHevsMomPiRec->GetXaxis()->SetTitle("He3 Rigidity");
+ fhRigidityHevsMomPiRec->GetYaxis()->SetTitle("Pi momentum");
+ fListHistCascade->Add(fhRigidityHevsMomPiRec);
+ }
+
+ if(!fhInvMassMC){
+ fhInvMassMC=new TH1F("fhInvMassMC","fhInvMassMC",800,2.,6.);
+ fhInvMassMC->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassMC);
+ }
+
+ if(!fhInvMassMum){
+ fhInvMassMum=new TH1F("fhInvMassMum","fhInvMassMum",800,2.,6.);
+ fhInvMassMum->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassMum);
+ }
+
+ if(!fhInvMassRec){
+ fhInvMassRec=new TH1F("fhInvMassRec","fhInvMassRec",800,2.,6.);
+ fhInvMassRec->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec);
+ }
+
+ if(!fhInvMassRec1){
+ fhInvMassRec1=new TH1F("fhInvMassRec1","No Altri tagli",800,2.,6.);
+ fhInvMassRec1->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec1);
+ }
+ if(!fhInvMassRec2){
+ fhInvMassRec2=new TH1F("fhInvMassRec2","DCA pi > 0.1",800,2.,6.);
+ fhInvMassRec2->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec2);
+ }
+ if(!fhInvMassRec3){
+ fhInvMassRec3=new TH1F("fhInvMassRec3","DCA He > 0.05",800,2.,6.);
+ fhInvMassRec3->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec3);
+ }
+ if(!fhInvMassRec4){
+ fhInvMassRec4=new TH1F("fhInvMassRec4","DCA tracks < 1 cm",800,2.,6.);
+ fhInvMassRec4->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec4);
+ }
+ if(!fhInvMassRec5){
+ fhInvMassRec5=new TH1F("fhInvMassRec5","Condizione xn+xp",800,2.,6.);
+ fhInvMassRec5->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec5);
+ }
+ if(!fhInvMassRec6){
+ fhInvMassRec6=new TH1F("fhInvMassRec6","Ho fatto V0 ",800,2.,6.);
+ fhInvMassRec6->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec6);
+ }
+ if(!fhInvMassRec7){
+ fhInvMassRec7=new TH1F("fhInvMassRec7","V0+Taglio CPA",800,2.,6.);
+ fhInvMassRec7->GetXaxis()->SetTitle("(He3,#pi) InvMass");
+ fListHistCascade->Add(fhInvMassRec7);
+ }
+
+ if(!fhHeMCRigidity ){
+ fhHeMCRigidity=new TH1F("fhHeMCRigidity","He3 rigidity distribution",200,0,20);
+ fhHeMCRigidity->GetXaxis()->SetTitle("He3 rigidity");
+ fListHistCascade->Add(fhHeMCRigidity);
+ }
+ if(!fhPioneMC ){
+ fhPioneMC=new TH1F("hPioneMC","Pion mom distribution",200,0,50);
+ fhPioneMC->GetXaxis()->SetTitle("Pion momentum");
+ fListHistCascade->Add(fhPioneMC);
+ }
+
+ if(!hBBTPCnoCuts ){
+ hBBTPCnoCuts=new TH2F("hBBTPCnoCuts","scatterPlot TPC no cuts",2000,-10,10,1000,0,3000);
+ hBBTPCnoCuts->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");
+ hBBTPCnoCuts->GetYaxis()->SetTitle("TPC Signal (a.u)");
+ fListHistCascade->Add(hBBTPCnoCuts);
+ }
+ if(!fhBBTPC ){
+ fhBBTPC=new TH2F("fhBBTPC","scatterPlot TPC",2000,-10,10,1000,0,3000);
+ fhBBTPC->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");
+ fhBBTPC->GetYaxis()->SetTitle("TPC Signal (a.u)");
+ fListHistCascade->Add(fhBBTPC);
+ }
+ if(!fhBBTPCNegativePions ){
+ fhBBTPCNegativePions=new TH2F("fhBBTPCNegativePions","scatterPlot Neg Pions",2000,-10,10,1000,0,3000);
+ fhBBTPCNegativePions->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");
+ fhBBTPCNegativePions->GetYaxis()->SetTitle("TPC Signal (a.u)");
+ fListHistCascade->Add(fhBBTPCNegativePions);
+ }
+ if(!fhBBTPCPositivePions ){
+ fhBBTPCPositivePions=new TH2F("fhBBTPCPositivePions","scatterPlot Pos Pions",2000,-10,10,1000,0,3000);
+ fhBBTPCPositivePions->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");
+ fhBBTPCPositivePions->GetYaxis()->SetTitle("TPC Signal (a.u)");
+ fListHistCascade->Add(fhBBTPCPositivePions);
+ }
+ if(!fhBBTPCHe3 ){
+ fhBBTPCHe3=new TH2F("fhBBTPCHe3","scatterPlot TPC - He3",2000,-10,10,1000,0,3000);
+ fhBBTPCHe3->GetXaxis()->SetTitle("p/Z (GeV/#it{c})");
+ fhBBTPCHe3->GetYaxis()->SetTitle("TPC Signal (a.u)");
+ fListHistCascade->Add(fhBBTPCHe3);
+ }
+ if(!fHistProvaDCA ){
+ fHistProvaDCA=new TH2F("fHistProvaDCA","fHistProvaDCA",1000,-50,50,1000,0,100);
+ fHistProvaDCA->GetXaxis()->SetTitle("xn+xp");
+ fHistProvaDCA->GetYaxis()->SetTitle("dca tracks");
+ fListHistCascade->Add(fHistProvaDCA);
+ }
+
+ if(!hITSClusterMap ){
+ hITSClusterMap=new TH1F("hITSClusterMap","hITSClusterMap",65,-1,64);
+ fListHistCascade->Add(hITSClusterMap);
+ }
+
+ if(!fHistPercentileVsTrackNumber){
+ fHistPercentileVsTrackNumber=new TH2F("fHistPercentileVsTrackNumber","fHistPercentileVsTrackNumber",120,-3,117,2500,0,25000);
+ fHistPercentileVsTrackNumber->GetXaxis()->SetTitle("Percentile");
+ fHistPercentileVsTrackNumber->GetYaxis()->SetTitle("Tracks Number");
+ fListHistCascade->Add(fHistPercentileVsTrackNumber);
+ }
+
+ if(!fhHeDCAXY){
+ fhHeDCAXY=new TH1F("fhHeDCAXY","fhHeDCAXY",800,-4,4);
+ fListHistCascade->Add(fhHeDCAXY);
+ }
+ if(!fhHeDCAZ){
+ fhHeDCAZ=new TH1F("fhHeDCAZ","fhHeDCAZ",800,-30,30);
+ fListHistCascade->Add(fhHeDCAZ);
+ }
+ if(!fhPiDCAXY){
+ fhPiDCAXY=new TH1F("fhPiDCAXY","fhPiDCAXY",800,-4,4);
+ fListHistCascade->Add(fhPiDCAXY);
+ }
+ if(!fhPiDCAZ){
+ fhPiDCAZ=new TH1F("fhPiDCAZ","fhPiDCAZ",800,-30,30);
+ fListHistCascade->Add(fhPiDCAZ);
+ }
+
+ if(! fNtuple1 ) {
+ fNtuple1 = new TNtuple("fNtuple1","Ntuple1","runNumber:evNumber:TrackNumber:percentile:xPrimaryVertex:yPrimaryVertex:zPrimaryVertex:xSecondaryVertex:ySecondaryVertex:zSecondaryVertex:dcaTracks:CosPointingAngle:DCAV0toPrimaryVertex:HeSign:HepInTPC:HeTPCsignal:DcaHeToPrimVertex:HeEta:momHex:momHey:momHez:momHeAtSVx:momHeAtSVy:momHeAtSVz:HeTPCNcls:HeimpactXY:HeimpactZ:isTOFHe:HeBeta:HeITSClusterMap:IsHeITSRefit:PionSign:PionpInTPC:PionTPCsignal:DcaPionToPrimVertex:PionEta:momPionx:momPiony:momPionz:momNegPionAtSVx:momNegPionAtSVy:momNegPionAtSVz:PionTPCNcls:PionimpactXY:PionimpactZ:isTOFPion:PionBeta:PionITSClusterMap:IsPiITSRefit:PDGCodeNeg:PDCCodePos:motherPDGNeg:motherPDGPos:labelPi:labelHe:mumidNeg:mumidPos");
+
+ fListHistCascade->Add(fNtuple1);
+ }
+
+ if(! fNtuple2 ) {
+
+ fNtuple2 = new TNtuple("fNtuple2","Ntuple2","run:event:iMC:Centrality:PVx:PVy:PVz:PDGcodeMum:MotherIndex:SVxD0:SVyD0:SVzD0:SVxD1:SVyD1:SVzD1:SV3d:EtaMum:YMum:ThetaMum:PhiMum:PxMum:PyMum:PzMum:PdgDaughter0:PdgDaughter1:PxD0:PyD0:PzD0:PxD1:PyD1:PzD1");
+
+ fListHistCascade->Add(fNtuple2);
+ }
+
+ PostData(1,fListHistCascade);
+
+}// end UserCreateOutputObjects
+
+
+
+//====================== USER EXEC ========================
+
+void AliAnalysisTaskHelium3PiMC::UserExec(Option_t *)
+{
+ //_______________________________________________________________________
+
+ //!*********************!//
+ //! Define variables !//
+ //!*********************!//
+ Float_t vett1[60];
+ for(Int_t i=0;i<60;i++) vett1[i]=0;
+
+ Float_t vett2[40];
+ for(Int_t i=0;i<40;i++) vett2[i]=0;
+
+ Double_t ITSsample[4];
+ for(Int_t i=0;i<4;i++)ITSsample[i]=0;
+
+ Double_t ITSsamplePos[4];
+ for(Int_t i=0;i<4;i++)ITSsamplePos[i]=0;
+
+ Double_t ITSsampleNeg[4];
+ for(Int_t i=0;i<4;i++)ITSsampleNeg[i]=0;
+
+ Double_t pinTPC=0.,poutTPC=0.,TPCSignal=0.;
+ Double_t xPrimaryVertex=0.,yPrimaryVertex=0.,zPrimaryVertex=0.;
+
+ ULong_t status=0;
+ ULong_t statusT=0;
+ ULong_t statusPi=0;
+
+ Bool_t isTPC=kFALSE,isTOF=kFALSE,isTOFHe3=kFALSE,isTOFPi=kFALSE;
+
+ Double_t fPos[3]={0.,0.,0.};
+ Double_t runNumber=0.;
+ Double_t evNumber=0.;
+
+ Int_t id0 = 0, id1 = 0;
+ Double_t mcDecayPosXD0 = 0, mcDecayPosYD0 = 0, mcDecayPosR = 0, mcDecayPosZD0 =0, mcDecayPosRho=0.;
+ Double_t mcDecayPosXD1 = 0, mcDecayPosYD1 = 0, mcDecayPosZD1 =0;
+
+ Double_t lEtaCurrentPart =0., lPtCurrentPart = 0.,lThetaCurrentPart = 0., lPhiCurrentPart = 0.;
+ Int_t iCurrentMother = 0;
+ Double_t mcPosX = 0., mcPosY = 0.,mcPosZ = 0., mcPosR = 0.;
+
+ Double_t lPdgCurrentDaughter0 = 0, lPdgCurrentDaughter1= 0., lPdgCurrentMother=0.,lPdgCurrentDaughter =0;
+
+ Double_t PxD0 = 0, PyD0 = 0,PzD0 = 0;
+ Double_t PxD1 = 0, PyD1 = 0,PzD1 = 0;
+
+ Int_t lNbMCPrimary = 0;
+ Int_t lNbMCPart = 0;
+ Int_t lPdgcodeCurrentPart = 0;
+ //!----------------------------------------------------------------
+
+ //! A set of very loose parameters for cuts
+
+ Double_t fgChi2max=33.; //! max chi2
+ Double_t fgDNmin=0.05; //! min imp parameter for the 1st daughter = 500um
+ Double_t fgDCAmax=1.; //! max DCA between the daughter tracks in cm
+ Double_t fgCPAmin=0.9; //! min cosine of V0's pointing angle
+ Double_t fgRmin=0.1; //! min radius of the fiducial volume = 1 mm
+ Double_t fgRmax=200.; //! max radius of the fiducial volume = 2 m
+
+ //------------------------------------------
+ // create pointer to event
+
+ AliVEvent *event = InputEvent();
+ if (!event) { Printf("ERROR: Could not retrieve event"); return; }
+
+
+
+// AliVEvent *lESDevent = InputEvent();
+// if (!lESDevent) {
+// Printf("ERROR: Could not retrieve event");
+// return;
+// }
+
+ Info("AliAnalysisTaskHelium3PiMC","Starting UserExec");
+
+ SetDataType("SIM");
+ AliStack *stack=0;
+
+ if(fDataType == "SIM") {
+
+ // Main loop
+ // Called for EACH event
+ AliMCEvent *mcEvent = MCEvent();
+ if (!mcEvent) {
+ Printf("ERROR: Could not retrieve MC event");
+ return;
+ }
+
+ Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
+
+ // set up a stack for use in check for primary/stable particles
+ stack = mcEvent->Stack();
+ if( !stack ) { Printf( "Stack not available"); return; }
+ }
+
+
+ AliESDEvent *lESDevent = 0x0;
+
+ //********************************** Connect to the InputEvent ******//
+
+ //Int_t TrackNumber = 0;
+ if(fAnalysisType == "ESD"){
+ lESDevent = dynamic_cast<AliESDEvent*>(event);
+ if (!lESDevent) {
+ Printf("ERROR: lESDevent not available \n");
+ return;
+ }
+ }
+
+ //*****************//
+ //* Centrality *//
+ //*****************//
+
+ AliCentrality *centrality = lESDevent->GetCentrality();
+
+ Float_t percentile=centrality->GetCentralityPercentile("V0M");
+
+ //------------------------------
+
+ runNumber = lESDevent->GetRunNumber();
+ evNumber =lESDevent->GetEventNumberInFile();
+
+ //---------------------
+
+ // Int_t primary = stack->GetNprimary();
+ Int_t label =-1;
+
+ lNbMCPrimary = stack->GetNprimary();
+ lNbMCPart = stack->GetNtrack();
+
+ fHistMCMultiplicityTracks->Fill(lNbMCPart); //histo
+
+ TArrayD MomPionsMC(lNbMCPart); //Neg pions
+ Int_t nPionsMC=0;
+ TArrayD MomHeMC(lNbMCPart); //helium3
+ Int_t nHeMC=0;
+
+ //------ Trimomento pion
+ TArrayD PxPionsMC(lNbMCPart);
+ Int_t nPxPionsMC=0;
+ TArrayD PyPionsMC(lNbMCPart);
+ Int_t nPyPionsMC=0;
+ TArrayD PzPionsMC(lNbMCPart);
+ Int_t nPzPionsMC=0;
+ //------ Trimomento He
+ TArrayD PxHeMC(lNbMCPart);
+ Int_t nPxHeMC=0;
+ TArrayD PyHeMC(lNbMCPart);
+ Int_t nPyHeMC=0;
+ TArrayD PzHeMC(lNbMCPart);
+ Int_t nPzHeMC=0;
+
+ //Mass Definition
+
+ Double_t Helium3Mass = 2.80839;
+ Double_t PionMass = 0.13957;
+
+ TLorentzVector vPionMC,vHeliumMC,vSumMC;
+ TLorentzVector vPionMum,vHeliumMum,vSumMum;
+ TLorentzVector vPionRec,vHeliumRec,vSumRec;
+ Bool_t isTwoBody=kFALSE;
+
+ for (Int_t iMC=0; iMC<stack->GetNtrack(); iMC++)
+ {
+ TParticle *p0 = stack->Particle(iMC);
+
+ if (!p0) {
+ //Printf("ERROR: particle with label %d not found in stack (mc loop)", iMc);
+ continue;
+ }
+
+ lPdgcodeCurrentPart = p0->GetPdgCode();
+
+ if(lPdgcodeCurrentPart == 1000020030 || lPdgcodeCurrentPart == -1000020030 ){
+
+ MomHeMC[nHeMC++]=p0->P();
+
+ PxHeMC[nPxHeMC++]=p0->Px();
+ PyHeMC[nPyHeMC++]=p0->Py();
+ PzHeMC[nPzHeMC++]=p0->Pz();
+
+ fhHeMCRigidity->Fill(p0->P()/2);
+ }
+
+ if(lPdgcodeCurrentPart == 211 || lPdgcodeCurrentPart == -211 ){
+
+ MomPionsMC[nPionsMC++]=p0->P();
+
+ PxPionsMC[nPxPionsMC++]=p0->Px();
+ PyPionsMC[nPyPionsMC++]=p0->Py();
+ PzPionsMC[nPzPionsMC++]=p0->Pz();
+
+ fhPioneMC->Fill(p0->P());
+ }
+
+ if ( lPdgcodeCurrentPart == 1010010030 || lPdgcodeCurrentPart == -1010010030 ){
+
+ lEtaCurrentPart = p0->Eta();
+ lPtCurrentPart = p0->Pt();
+ lThetaCurrentPart = p0->Theta();
+ lPhiCurrentPart = p0->Phi();
+ iCurrentMother = p0->GetFirstMother();
+
+ fHistMCEta->Fill(lEtaCurrentPart);
+ fHistMCPt->Fill(lPtCurrentPart);
+ fHistMCTheta->Fill(lThetaCurrentPart);
+
+ if (iCurrentMother == -1){lPdgCurrentMother=0; } else {lPdgCurrentMother = stack->Particle(iCurrentMother)->GetPdgCode();}
+
+ mcPosX = p0->Vx();
+ mcPosY = p0->Vy();
+ mcPosZ = p0->Vz();
+ mcPosR = TMath::Sqrt(mcPosX*mcPosX+mcPosY*mcPosY);
+
+ isTwoBody=kFALSE;
+
+ for(Int_t i=p0->GetFirstDaughter(); i<= p0->GetLastDaughter(); i++){
+ TParticle *pDaughter = stack->Particle(i);
+ lPdgCurrentDaughter= pDaughter->GetPdgCode();
+ cout<<lPdgCurrentDaughter<<endl;
+ if(lPdgCurrentDaughter == 1000020030 || lPdgCurrentDaughter ==-1000020030 ){
+ isTwoBody=kTRUE;
+
+ }
+ }
+
+ if(isTwoBody){
+
+ for(Int_t i=p0->GetFirstDaughter(); i<= p0->GetLastDaughter(); i++){
+
+ TParticle *pDaughter = stack->Particle(i);
+
+ lPdgCurrentDaughter= pDaughter->GetPdgCode();
+
+ if(lPdgCurrentDaughter == 211 || lPdgCurrentDaughter == -211 ){
+ id0 = i;
+ }
+
+ if(lPdgCurrentDaughter == 1000020030 || lPdgCurrentDaughter == -1000020030 ){
+ id1 = i;
+ }
+ }
+
+ TParticle *pDaughter0 = stack->Particle(id0);
+ TParticle *pDaughter1 = stack->Particle(id1);
+ lPdgCurrentDaughter0 = pDaughter0->GetPdgCode();
+ lPdgCurrentDaughter1 = pDaughter1->GetPdgCode();
+
+ // Decay Radius and Production Radius
+
+ if ( id0 <= lNbMCPart && id0 > 0 && id1 <= lNbMCPart && id1 > 0) {
+
+ lPdgCurrentDaughter0 = pDaughter0->GetPdgCode();
+ lPdgCurrentDaughter1 = pDaughter1->GetPdgCode();
+
+ PxD0 = pDaughter0->Px();
+ PyD0 = pDaughter0->Py();
+ PzD0 = pDaughter0->Pz();
+
+ PxD1 = pDaughter1->Px();
+ PyD1 = pDaughter1->Py();
+ PzD1 = pDaughter1->Pz();
+
+ mcDecayPosXD0 = pDaughter0->Vx();
+ mcDecayPosYD0 = pDaughter0->Vy();
+ mcDecayPosZD0 = pDaughter0->Vz();
+
+ mcDecayPosXD1 = pDaughter0->Vx();
+ mcDecayPosYD1 = pDaughter0->Vy();
+ mcDecayPosZD1 = pDaughter0->Vz();
+
+ mcDecayPosR = TMath::Sqrt(mcDecayPosXD0*mcDecayPosXD0+mcDecayPosYD0*mcDecayPosYD0);
+ fHistMCDecayPosition->Fill(mcDecayPosR);
+
+ mcDecayPosRho = TMath::Sqrt(mcDecayPosXD0*mcDecayPosXD0+mcDecayPosYD0*mcDecayPosYD0+mcDecayPosZD0*mcDecayPosZD0);
+ fHistMCDecayRho->Fill(mcDecayPosRho);
+
+ //---- Initial mass Test
+
+ vHeliumMum.SetXYZM(PxD1,PyD1,PzD1,Helium3Mass);
+ vPionMum.SetXYZM(PxD0,PyD0,PzD0,PionMass);
+ vSumMum=vHeliumMum+vPionMum;
+
+ fhInvMassMum->Fill(vSumMum.M());
+
+ //Ntupla hyper triton
+
+ vett2[0]=(Float_t)lESDevent->GetRunNumber();
+ vett2[1]=(Float_t)lESDevent->GetEventNumberInFile();
+ vett2[2]=(Float_t)iMC;
+ vett2[3]=(Float_t)percentile;
+ vett2[4]=(Float_t)mcPosX;
+ vett2[5]=(Float_t)mcPosY;
+ vett2[6]=(Float_t)mcPosZ;
+ vett2[7]=(Float_t)lPdgcodeCurrentPart;
+ vett2[8]=(Float_t)iCurrentMother;
+ vett2[9]=(Float_t)mcDecayPosXD0;
+ vett2[10]=(Float_t)mcDecayPosYD0;
+ vett2[11]=(Float_t)mcDecayPosZD0;
+ vett2[12]=(Float_t)mcDecayPosXD1;
+ vett2[13]=(Float_t)mcDecayPosYD1;
+ vett2[14]=(Float_t)mcDecayPosZD1;
+ vett2[15]=(Float_t)mcDecayPosRho;
+ vett2[16]=(Float_t)lEtaCurrentPart;
+ vett2[17]=(Float_t)p0->Y();
+ vett2[18]=(Float_t)lThetaCurrentPart;
+ vett2[19]=(Float_t)lPhiCurrentPart;
+ vett2[20]=(Float_t)p0->Px();
+ vett2[21]=(Float_t)p0->Py();
+ vett2[22]=(Float_t)p0->Pz();
+ vett2[23]=(Float_t)lPdgCurrentDaughter0;
+ vett2[24]=(Float_t)lPdgCurrentDaughter1;
+ vett2[25]=(Float_t)PxD0; //pion
+ vett2[26]=(Float_t)PyD0;
+ vett2[27]=(Float_t)PzD0;
+ vett2[28]=(Float_t)PxD1; //He3
+ vett2[29]=(Float_t)PyD1;
+ vett2[30]=(Float_t)PzD1;
+
+ fNtuple2->Fill(vett2);
+
+ }//if check daughters index
+ }//is twobody
+ } // if mother
+ } // Kinetic Track loop ends here
+
+ // Loop phase - space
+
+ Double_t HeMomMC =0;
+ Double_t PionMomMC=0;
+ Double_t PxHeMc=0, PyHeMc=0,PzHeMc=0;
+ Double_t PxPionMc=0, PyPionMc=0,PzPionMc=0;
+
+ for(Int_t l=0; l < nHeMC; l++){
+
+ HeMomMC=MomHeMC[l];
+
+ PxHeMc=PxHeMC[l];
+ PyHeMc=PyHeMC[l];
+ PzHeMc=PzHeMC[l];
+
+ for(Int_t k=0; k < nPionsMC; k++){
+
+ PionMomMC=MomPionsMC[k];
+
+ PxPionMc=PxPionsMC[k];
+ PyPionMc=PyPionsMC[k];
+ PzPionMc=PzPionsMC[k];
+
+ fhRigidityHevsMomPiMC->Fill(HeMomMC/2,PionMomMC);
+
+ vHeliumMC.SetXYZM(PxHeMc,PyHeMc,PzHeMc,Helium3Mass);
+ vPionMC.SetXYZM(PxPionMc,PyPionMc,PzPionMc,PionMass);
+ vSumMC=vHeliumMC+vPionMC;
+
+ fhInvMassMC->Fill(vSumMC.M());
+
+ }
+
+ } // end loop phase space
+
+ //-------------- RECONSTRUCTION -------------------
+
+ fHistEventMultiplicity->Fill(0);
+
+ Double_t lMagneticField=lESDevent->GetMagneticField();
+
+ Int_t TrackNumber = -1;
+
+ // ANALISYS reconstructed tracks
+
+ // Primary vertex cut
+
+ const AliESDVertex *vtx = lESDevent->GetPrimaryVertexTracks();
+
+ if(vtx->GetNContributors()<1) {
+
+ // SPD vertex cut
+ vtx = lESDevent->GetPrimaryVertexSPD();
+
+ if(vtx->GetNContributors()<1) {
+ Info("AliAnalysisTaskHelium3PiMC","No good vertex, skip event");
+ return; // NO GOOD VERTEX, SKIP EVENT
+ }
+ }
+
+ fHistEventMultiplicity->Fill(1); // analyzed events with PV
+
+ xPrimaryVertex=vtx->GetXv();
+ yPrimaryVertex=vtx->GetYv();
+ zPrimaryVertex=vtx->GetZv();
+
+ TrackNumber = lESDevent->GetNumberOfTracks();
+ fHistTrackMultiplicity->Fill(TrackNumber); //tracce per evento
+
+ fHistPercentileVsTrackNumber->Fill(percentile,TrackNumber);
+
+ if (TrackNumber<2) return;
+
+ fHistEventMultiplicity->Fill(2);
+
+ //Find Pair candidates
+
+ TArrayI PionsTPC(TrackNumber); //Neg pions
+ Int_t nPionsTPC=0;
+
+ TArrayI HeTPC(TrackNumber); //helium3
+ Int_t nHeTPC=0;
+
+ // find pairs candidates phase daughter tracks rec
+
+ TArrayD MomPionsRec(TrackNumber); //Neg pions
+ Int_t nPionsRec=0;
+
+ TArrayD MomHeRec(TrackNumber); //helium3
+ Int_t nHeRec=0;
+
+ //------ Trimomento pion
+ TArrayD PxPionsRec(TrackNumber);
+ Int_t nPxPionsRec=0;
+ TArrayD PyPionsRec(TrackNumber);
+ Int_t nPyPionsRec=0;
+ TArrayD PzPionsRec(TrackNumber);
+ Int_t nPzPionsRec=0;
+
+ //------ Trimomento He
+ TArrayD PxHeRec(TrackNumber);
+ Int_t nPxHeRec=0;
+ TArrayD PyHeRec(TrackNumber);
+ Int_t nPyHeRec=0;
+ TArrayD PzHeRec(TrackNumber);
+ Int_t nPzHeRec=0;
+
+ Float_t impactXY=-999, impactZ=-999;
+ Float_t impactXYpi=-999, impactZpi=-999;
+
+ Int_t PDGCodePos=0;
+ Int_t PDGCodeNeg=0;
+ Int_t motherPDGNeg=0;
+ Int_t motherPDGPos=0;
+
+ Int_t mumpdg=-100;
+
+ //! SELECTIONS:
+ //! - No ITSpureSA
+ //! - ITSrefit
+ //! - TPCrefit
+ //! - ITSmap !=0
+
+ // ******************* Track Cuts Definitions ********************//
+
+ //! ITS
+
+ AliESDtrackCuts* esdtrackCutsITS = new AliESDtrackCuts("esdtrackCutsITS");
+ esdtrackCutsITS->SetRequireITSStandAlone(kFALSE);
+ esdtrackCutsITS->SetRequireITSPureStandAlone(kFALSE);
+
+ //! TPC
+
+ Int_t minclsTPC=60;
+ Double_t maxchi2perTPCcl=5.;
+
+ AliESDtrackCuts* esdtrackCutsTPC = new AliESDtrackCuts("esdtrackCutsTPC");
+ esdtrackCutsTPC->SetRequireTPCRefit(kTRUE);
+ esdtrackCutsTPC->SetAcceptKinkDaughters(kFALSE);
+ esdtrackCutsTPC->SetMinNClustersTPC(minclsTPC);
+ esdtrackCutsTPC->SetMaxChi2PerClusterTPC(maxchi2perTPCcl);
+
+ //*************************************************************
+
+ for (Int_t j=0; j<TrackNumber; j++) { //loop on tracks
+
+ AliESDtrack *esdtrack=lESDevent->GetTrack(j);
+
+ if(!esdtrack) {
+ AliError(Form("ERROR: Could not retrieve esdtrack %d",j));
+ continue;
+ }
+
+ hBBTPCnoCuts->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());
+
+ // ************** Track cuts ****************
+
+ status = (ULong_t)esdtrack->GetStatus();
+
+ isTPC = (((status) & (AliESDtrack::kTPCin)) != 0);
+ isTOF = ((((status) & (AliESDtrack::kTOFout)) != 0) && (((status) & (AliESDtrack::kTIME)) != 0));
+
+ Bool_t IsTrackAcceptedTPC = esdtrackCutsTPC->AcceptTrack(esdtrack);
+ Bool_t IsTrackAcceptedITS = esdtrackCutsITS->AcceptTrack(esdtrack);
+
+ if (!(IsTrackAcceptedTPC && IsTrackAcceptedITS)) continue;
+
+ //----------------------------------------------
+
+ //****** Cuts from AliV0Vertex.cxx *************
+
+ Double_t d=esdtrack->GetD(xPrimaryVertex,yPrimaryVertex,lMagneticField);
+ // if (TMath::Abs(d)<fgDPmin) continue;
+ if (TMath::Abs(d)>fgRmax) continue;
+
+ //---- (Usefull) Stuff
+
+ TPCSignal=esdtrack->GetTPCsignal();
+
+ if (TPCSignal<10)continue;
+
+ if(!isTPC)continue;
+
+ if(!esdtrack->GetTPCInnerParam())continue;
+
+ AliExternalTrackParam trackIn(*esdtrack->GetInnerParam());
+ pinTPC = trackIn.GetP();
+
+ poutTPC=pinTPC;
+
+ fhBBTPC->Fill(pinTPC*esdtrack->GetSign(),TPCSignal);
+
+ d=esdtrack->GetD(xPrimaryVertex,yPrimaryVertex,lMagneticField);
+ // if (TMath::Abs(d)<fgDPmin) continue;
+ if (TMath::Abs(d)>fgRmax) continue;
+
+ label = TMath::Abs(esdtrack->GetLabel());
+
+ if (label>=10000000) {
+ // Underlying event. 10000000 is the
+ // value of fkMASKSTEP in AliRunDigitizer
+ cout <<"Strange, there should be no underlying event"<<endl;
+ }
+
+ else {
+ if (label>=lNbMCPart) {
+ cout <<"Strange, label outside the range"<< endl;
+ continue;
+ }
+ }
+
+ TParticle * part = stack->Particle(label);
+
+ Int_t PDGCode=part->GetPdgCode();
+ Int_t mumid = part->GetFirstMother();
+
+ if(mumid>-1){
+ TParticle *mother=(TParticle*)stack->Particle(mumid);
+ mumpdg = mother->GetPdgCode();
+ }
+
+ if(PDGCode==-211)
+ fhBBTPCNegativePions->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());
+
+ if(PDGCode==+211)
+ fhBBTPCPositivePions->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());
+
+
+ // if(PDGCode == 211){
+
+ if(PDGCode==-211 || PDGCode==+211){
+
+ PionsTPC[nPionsTPC++]=j;
+
+ esdtrack->GetImpactParameters(impactXY, impactZ);
+ fhPiDCAXY->Fill(impactXY);
+ fhPiDCAZ->Fill(impactZ);
+
+ MomPionsRec[nPionsRec++]=esdtrack->P();
+
+ PxPionsRec[nPxPionsRec++]=esdtrack->Px();
+ PyPionsRec[nPyPionsRec++]=esdtrack->Py();
+ PzPionsRec[nPzPionsRec++]=esdtrack->Pz();
+
+ }
+
+ if(PDGCode==1000020030 ||PDGCode==-1000020030 ){
+
+
+ HeTPC[nHeTPC++]=j;
+
+ fhBBTPCHe3->Fill(esdtrack->GetSign()*esdtrack->P(),esdtrack->GetTPCsignal());
+
+ esdtrack->GetImpactParameters(impactXY, impactZ);
+ fhHeDCAXY->Fill(impactXY);
+ fhHeDCAZ->Fill(impactZ);
+
+ MomHeRec[nHeRec++]=esdtrack->P();
+
+ PxHeRec[nPxHeRec++]=esdtrack->Px();
+ PyHeRec[nPyHeRec++]=esdtrack->Py();
+ PzHeRec[nPzHeRec++]=esdtrack->Pz();
+
+ }
+
+ } // ! track
+
+ //-------------- LOOP pairs 1 -------------
+ // Fill phase space and inva mass before cuts
+
+ Double_t HeMomRec =0;
+ Double_t PionMomRec=0;
+ Double_t PxHeReco=0, PyHeReco=0,PzHeReco=0;
+ Double_t PxPionReco=0, PyPionReco=0,PzPionReco=0;
+
+ for(Int_t l=0; l < nHeRec; l++){
+
+ HeMomRec=MomHeRec[l];
+
+ PxHeReco=PxHeRec[l];
+ PyHeReco=PyHeRec[l];
+ PzHeReco=PzHeRec[l];
+
+ for(Int_t k=0; k < nPionsRec; k++){
+
+ PionMomRec=MomPionsRec[k];
+
+ PxPionReco=PxPionsRec[k];
+ PyPionReco=PyPionsRec[k];
+ PzPionReco=PzPionsRec[k];
+
+ fhRigidityHevsMomPiRec->Fill(HeMomRec,PionMomRec);
+
+ vHeliumRec.SetXYZM(2*PxHeReco,2*PyHeReco,2*PzHeReco,Helium3Mass);
+ vPionRec.SetXYZM(PxPionReco,PyPionReco,PzPionReco,PionMass);
+ vSumRec=vHeliumRec+vPionRec;
+
+ fhInvMassRec->Fill(vSumRec.M());
+ }
+
+ } // fine loop phase space
+
+ //--------------- LOOP PAIRS ----------------------//
+
+ Double_t DcaHeToPrimVertex=0;
+ Double_t DcaPionToPrimVertex=0;
+
+ impactXY=-999, impactZ=-999;
+ impactXYpi=-999, impactZpi=-999;
+
+ // Track
+
+ AliESDtrack *PionTrack = 0x0;
+ AliESDtrack *HeTrack = 0x0;
+
+ // Vettori per il PxPyPz
+
+ Double_t momPionVett[3];
+ for(Int_t i=0;i<3;i++)momPionVett[i]=0;
+
+ Double_t momHeVett[3];
+ for(Int_t i=0;i<3;i++)momHeVett[i]=0;
+
+ //At SV
+
+ Double_t momPionVettAt[3];
+ for(Int_t i=0;i<3;i++)momPionVettAt[i]=0;
+
+ Double_t momHeVettAt[3];
+ for(Int_t i=0;i<3;i++)momHeVettAt[i]=0;
+
+ Bool_t IsHeITSRefit,IsPiITSRefit ;
+
+ //----------- My 2nd Vertex Finder
+
+ for (Int_t k=0; k < nPionsTPC; k++) { //! Pions Loop
+
+ DcaPionToPrimVertex=0.;
+ DcaHeToPrimVertex=0;
+
+ Int_t PionIdx=PionsTPC[k];
+
+ PionTrack=lESDevent->GetTrack(PionIdx);
+
+ statusPi = (ULong_t)PionTrack->GetStatus();
+ IsPiITSRefit = ((statusPi) & (AliESDtrack::kITSrefit));
+
+ Int_t labelPi = TMath::Abs(PionTrack->GetLabel());
+ TParticle * partNeg = stack->Particle(labelPi);
+ PDGCodeNeg=partNeg->GetPdgCode();
+
+ Int_t mumidNeg = partNeg->GetFirstMother();
+ if(mumidNeg>-1){
+ TParticle *motherNeg=(TParticle*)stack->Particle(mumidNeg);
+ motherPDGNeg = motherNeg->GetPdgCode();
+ }
+
+ if (PionTrack)
+ DcaPionToPrimVertex = TMath::Abs(PionTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK
+
+ if(DcaPionToPrimVertex<0.1)continue;
+
+ AliExternalTrackParam trackInPion(*PionTrack);
+
+ for (Int_t i=0; i<nHeTPC; i++){ //! Helium Loop
+
+ Int_t HeIdx=HeTPC[i];
+
+ HeTrack=lESDevent->GetTrack(HeIdx);
+
+ statusT= (ULong_t)HeTrack->GetStatus();
+ IsHeITSRefit = ((statusT) & (AliESDtrack::kITSrefit));
+
+ Int_t labelHe = TMath::Abs(HeTrack->GetLabel());
+ TParticle * partPos = stack->Particle(labelHe);
+ PDGCodePos=partPos->GetPdgCode();
+
+ Int_t mumidPos = partPos->GetFirstMother();
+ if(mumidPos>-1){
+ TParticle *motherPos=(TParticle*)stack->Particle(mumidPos);
+ motherPDGPos = motherPos->GetPdgCode();
+ }
+
+ if (HeTrack)
+ DcaHeToPrimVertex = TMath::Abs(HeTrack->GetD(xPrimaryVertex, yPrimaryVertex,lMagneticField)); //OK
+
+ AliExternalTrackParam trackInHe(*HeTrack);
+
+ HeTrack->PxPyPz(momHeVett);
+ PionTrack->PxPyPz(momPionVett);
+
+ vHeliumRec.SetXYZM(2*momHeVett[0],2*momHeVett[1],2*momHeVett[2],Helium3Mass);
+ vPionRec.SetXYZM(momPionVett[0],momPionVett[1],momPionVett[2],PionMass);
+ vSumRec=vHeliumRec+vPionRec;
+
+ fhInvMassRec1->Fill(vSumRec.M());
+
+ fhInvMassRec2->Fill(vSumRec.M());
+
+ if ( DcaPionToPrimVertex < fgDNmin) //OK
+ if ( DcaHeToPrimVertex < fgDNmin) continue; //OK
+
+ fhInvMassRec3->Fill(vSumRec.M());
+
+ Double_t xn, xp;
+ Double_t dca=0.;
+
+ dca= PionTrack->GetDCA(HeTrack,lMagneticField,xn,xp); //!distance between two tracks (Neg to Pos)
+ fHistProvaDCA->Fill(xn-xp,dca);
+ if (dca > fgDCAmax) continue;
+
+ fhInvMassRec4->Fill(vSumRec.M());
+
+ if ((xn+xp) > 2*fgRmax) continue;
+ if ((xn+xp) < 2*fgRmin) continue;
+ fhInvMassRec5->Fill(vSumRec.M());
+
+ //CORREZIONE da AliV0Vertex
+
+ Bool_t corrected=kFALSE;
+ if ((trackInPion.GetX() > 3.) && (xn < 3.)) {
+ //correct for the beam pipe material
+ corrected=kTRUE;
+ }
+ if ((trackInHe.GetX() > 3.) && (xp < 3.)) {
+ //correct for the beam pipe material
+ corrected=kTRUE;
+ }
+ if (corrected) {
+ dca=trackInPion.GetDCA(&trackInHe,lMagneticField,xn,xp);
+ if (dca > fgDCAmax) continue;
+ if ((xn+xp) > 2*fgRmax) continue;
+ if ((xn+xp) < 2*fgRmin) continue;
+ }
+
+ //=============================================//
+ // Make a "V0" with Tracks //
+ //=============================================//
+
+ trackInPion.PropagateTo(xn,lMagneticField);
+ trackInHe.PropagateTo(xp,lMagneticField);
+
+ AliESDv0 vertex(trackInPion,PionIdx,trackInHe,HeIdx);
+ if (vertex.GetChi2V0() > fgChi2max) continue;
+ fhInvMassRec6->Fill(vSumRec.M());
+
+ Float_t CosPointingAngle=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex); //PointingAngle
+ if (CosPointingAngle < fgCPAmin) continue;
+
+ fhInvMassRec7->Fill(vSumRec.M());
+
+ vertex.SetDcaV0Daughters(dca);
+ vertex.SetV0CosineOfPointingAngle(CosPointingAngle);
+
+ fPos[0]=vertex.Xv();
+ fPos[1]=vertex.Yv();
+ fPos[2]=vertex.Zv();
+
+
+
+ Double_t raggio=TMath::Sqrt(fPos[0]*fPos[0]+fPos[1]*fPos[1]+fPos[2]*fPos[2]);
+ HeTrack->GetPxPyPzAt(raggio,lMagneticField,momHeVettAt);
+ PionTrack->GetPxPyPzAt(raggio,lMagneticField,momPionVettAt);
+
+ //------------------------------------------------------------------------//
+
+ HeTrack->GetImpactParameters(impactXY, impactZ);
+
+ PionTrack->GetImpactParameters(impactXYpi, impactZpi);
+
+ Float_t timeTOFHe= HeTrack->GetTOFsignal(); // ps
+ Float_t trackLenghtTOFHe= HeTrack->GetIntegratedLength(); // cm
+
+ Float_t timeTOFPi= PionTrack->GetTOFsignal(); // ps
+ Float_t trackLenghtTOFPi= PionTrack->GetIntegratedLength(); // cm
+
+ //----------------------------------------------------------------------//
+
+ vett1[0]=(Float_t)runNumber;
+ vett1[1]=(Float_t)evNumber;
+ vett1[2]=(Float_t)lNbMCPart;
+ vett1[3]=(Float_t)percentile;
+ vett1[4]=(Float_t)xPrimaryVertex; //PRIMARY
+ vett1[5]=(Float_t)yPrimaryVertex;
+ vett1[6]=(Float_t)zPrimaryVertex;
+ vett1[7]=(Float_t)fPos[0]; //SECONDARY
+ vett1[8]=(Float_t)fPos[1];
+ vett1[9]=(Float_t)fPos[2];
+ vett1[10]=(Float_t)dca; //between 2 tracks
+ vett1[11]=(Float_t)CosPointingAngle; //cosPointingAngle da V0
+ vett1[12]=(Float_t)vertex.GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
+ vett1[13]=(Float_t)HeTrack->GetSign(); //He
+ vett1[14]=(Float_t)trackInHe.GetP();
+ vett1[15]=(Float_t)HeTrack->GetTPCsignal();
+ vett1[16]=(Float_t)DcaHeToPrimVertex;
+ vett1[17]=(Float_t)HeTrack->Eta();
+ vett1[18]=(Float_t)momHeVett[0];
+ vett1[19]=(Float_t)momHeVett[1];
+ vett1[20]=(Float_t)momHeVett[2];
+ vett1[21]=(Float_t)momHeVettAt[0];
+ vett1[22]=(Float_t)momHeVettAt[1];
+ vett1[23]=(Float_t)momHeVettAt[2];
+ vett1[24]=(Float_t)HeTrack->GetTPCNcls();
+ vett1[25]=(Float_t)impactXY;
+ vett1[26]=(Float_t)impactZ;
+ vett1[27]=(Float_t)isTOFHe3;
+ vett1[28]=(Float_t)(trackLenghtTOFHe/timeTOFHe)/2.99792458e-2;
+ vett1[29]=(Float_t)HeTrack->GetITSClusterMap();
+ vett1[30]=(Float_t)IsHeITSRefit;
+ vett1[31]=(Float_t)PionTrack->GetSign(); //Pion
+ vett1[32]=(Float_t)trackInPion.GetP();
+ vett1[33]=(Float_t)PionTrack->GetTPCsignal();
+ vett1[34]=(Float_t)DcaPionToPrimVertex;
+ vett1[35]=(Float_t)PionTrack->Eta();
+ vett1[36]=(Float_t)momPionVett[0];
+ vett1[37]=(Float_t)momPionVett[1];
+ vett1[38]=(Float_t)momPionVett[2];
+ vett1[39]=(Float_t)momPionVettAt[0];
+ vett1[40]=(Float_t)momPionVettAt[1];
+ vett1[41]=(Float_t)momPionVettAt[2];
+ vett1[42]=(Float_t)PionTrack->GetTPCNcls();
+ vett1[43]=(Float_t)impactXYpi;
+ vett1[44]=(Float_t)impactZpi;
+ vett1[45]=(Float_t)isTOFPi;
+ vett1[46]=(Float_t)(trackLenghtTOFPi/timeTOFPi)/2.99792458e-2;
+ vett1[47]=(Float_t)PionTrack->GetITSClusterMap();
+ vett1[48]=(Float_t)IsPiITSRefit;
+ vett1[49]=(Float_t)PDGCodeNeg;
+ vett1[50]=(Float_t)PDGCodePos;
+ vett1[51]=(Float_t)motherPDGNeg;
+ vett1[52]=(Float_t)motherPDGPos;
+ vett1[53]=(Float_t)labelPi;
+ vett1[54]=(Float_t)labelHe;
+ vett1[55]=(Float_t)mumidNeg;
+ vett1[56]=(Float_t)mumidPos;
+
+ fNtuple1->Fill(vett1);
+
+ }// positive TPC
+
+ } //negative tpc
+
+ PostData(1,fListHistCascade);
+
+}// end userexec
+
+
+//________________________________________________________________________
+//
+void AliAnalysisTaskHelium3PiMC::Terminate(Option_t *)
+{
+ // Draw result to the screen
+ // Called once at the end of the query
+}
+
-//_________________________________________________________________________\r
-// Utility Class for transverse energy studies; charged hadrons\r
-// Task for analysis\r
-// - reconstruction and MC output\r
-//\r
-//Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili\r
-//University of Tennessee at Knoxville\r
-//_________________________________________________________________________\r
-#ifndef ALIANALYSISTASKHADET_H \r
-#define ALIANALYSISTASKHADET_H \r
-\r
-class AliAnalysisHadEtReconstructed;\r
-class AliAnalysisHadEtMonteCarlo;\r
-class AliESDtrackCuts;\r
-class TH2F;\r
-class TList;\r
-class AliPIDResponse;\r
-\r
-#include "AliAnalysisTaskTransverseEnergy.h"\r
-class AliPWG0Helper;\r
-\r
-class AliAnalysisTaskHadEt : public AliAnalysisTaskTransverseEnergy {\r
-public:\r
- AliAnalysisTaskHadEt(const char *name = "AliAnalysisTaskHadEt", Bool_t isMc = false, TString recoConfigFile = "ConfigHadEtReconstructed.C", TString mcConfigFile = "ConfigHadEtMonteCarlo.C");\r
- virtual ~AliAnalysisTaskHadEt();\r
-\r
- // virtual void ConnectInputData(Option_t *);\r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- void IsSim(){fIsSim = kTRUE;}\r
- AliPIDResponse *fPIDResponse;\r
-\r
-private:\r
-\r
- //Declare it private to avoid compilation warning\r
- AliAnalysisTaskHadEt & operator = (const AliAnalysisTaskHadEt & g) ;//cpy assignment\r
- AliAnalysisTaskHadEt(const AliAnalysisTaskHadEt & g) ; // cpy ctor\r
-\r
- AliAnalysisHadEtReconstructed *fRecAnalysis; // Rec\r
- AliAnalysisHadEtMonteCarlo *fMCAnalysis; // MC\r
- Bool_t fIsSim;//Boolean to keep track of whether or not this is running on simulations\r
- Bool_t kIsOfflineV0AND;//Boolean to keep track of whether or not this matches the offline trigger\r
- Bool_t kIsOfflineMB;//Boolean to keep track of whether or not this matches the offline trigger\r
- ClassDef(AliAnalysisTaskHadEt, 2); // example of analysis\r
-};\r
-\r
-#endif\r
+//_________________________________________________________________________
+// Utility Class for transverse energy studies; charged hadrons
+// Task for analysis
+// - reconstruction and MC output
+//
+//Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
+//University of Tennessee at Knoxville
+//_________________________________________________________________________
+#ifndef ALIANALYSISTASKHADET_H
+#define ALIANALYSISTASKHADET_H
+
+class AliAnalysisHadEtReconstructed;
+class AliAnalysisHadEtMonteCarlo;
+class AliESDtrackCuts;
+class TH2F;
+class TList;
+class AliPIDResponse;
+
+#include "AliAnalysisTaskTransverseEnergy.h"
+class AliPWG0Helper;
+
+class AliAnalysisTaskHadEt : public AliAnalysisTaskTransverseEnergy {
+public:
+ AliAnalysisTaskHadEt(const char *name = "AliAnalysisTaskHadEt", Bool_t isMc = false, TString recoConfigFile = "ConfigHadEtReconstructed.C", TString mcConfigFile = "ConfigHadEtMonteCarlo.C");
+ virtual ~AliAnalysisTaskHadEt();
+
+ // virtual void ConnectInputData(Option_t *);
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ void IsSim(){fIsSim = kTRUE;}
+ AliPIDResponse *fPIDResponse;
+
+private:
+
+ //Declare it private to avoid compilation warning
+ AliAnalysisTaskHadEt & operator = (const AliAnalysisTaskHadEt & g) ;//cpy assignment
+ AliAnalysisTaskHadEt(const AliAnalysisTaskHadEt & g) ; // cpy ctor
+
+ AliAnalysisHadEtReconstructed *fRecAnalysis; // Rec
+ AliAnalysisHadEtMonteCarlo *fMCAnalysis; // MC
+ Bool_t fIsSim;//Boolean to keep track of whether or not this is running on simulations
+ Bool_t kIsOfflineV0AND;//Boolean to keep track of whether or not this matches the offline trigger
+ Bool_t kIsOfflineMB;//Boolean to keep track of whether or not this matches the offline trigger
+ ClassDef(AliAnalysisTaskHadEt, 2); // example of analysis
+};
+
+#endif
-#ifndef ALIANALYSISTASKTOTET_H \r
-#define ALIANALYSISTASKTOTET_H \r
-//_________________________________________________________________________\r
-// Utility Class for transverse energy studies\r
-// Task for analysis\r
-// - reconstruction and MC output\r
-//\r
-//*-- Authors: Oystein Djuvsland (Bergen), David Silvermyr (ORNL)\r
-//_________________________________________________________________________\r
-\r
-class AliAnalysisEtReconstructed;\r
-class AliAnalysisEtMonteCarlo;\r
-class AliESDtrackCuts;\r
-class TH2F;\r
-class TList;\r
-class AliPIDResponse;\r
-\r
-#include "AliAnalysisTaskTransverseEnergy.h"\r
-\r
-class AliAnalysisTaskTotEt : public AliAnalysisTaskTransverseEnergy {\r
- \r
-public:\r
- AliAnalysisTaskTotEt(const char *name = "AliAnalysisTaskTotEt", Bool_t isMc = false);\r
- virtual ~AliAnalysisTaskTotEt();\r
- \r
- // virtual void ConnectInputData(Option_t *);\r
- virtual void UserCreateOutputObjects();\r
- virtual void UserExec(Option_t *option);\r
- virtual void Terminate(Option_t *);\r
- AliPIDResponse *fPIDResponse;\r
- \r
-private:\r
- \r
- //Declare private to avoid compilation warning\r
- AliAnalysisTaskTotEt & operator = (const AliAnalysisTaskTotEt & g) ;//copy assignment\r
- AliAnalysisTaskTotEt(const AliAnalysisTaskTotEt & g) ; // copy ctor\r
-\r
- AliAnalysisEtReconstructed *fRecAnalysis; // Rec \r
- AliAnalysisEtMonteCarlo *fMCAnalysis; // MC\r
- \r
- //THnSparseD *fSparseHistRecVsMc; // Hist Rec vs Mc\r
- //Double_t *fSparseRecVsMc; // Rec vs Mc\r
- \r
- ClassDef(AliAnalysisTaskTotEt, 2) \r
-};\r
-\r
-#endif\r
+#ifndef ALIANALYSISTASKTOTET_H
+#define ALIANALYSISTASKTOTET_H
+//_________________________________________________________________________
+// Utility Class for transverse energy studies
+// Task for analysis
+// - reconstruction and MC output
+//
+//*-- Authors: Oystein Djuvsland (Bergen), David Silvermyr (ORNL)
+//_________________________________________________________________________
+
+class AliAnalysisEtReconstructed;
+class AliAnalysisEtMonteCarlo;
+class AliESDtrackCuts;
+class TH2F;
+class TList;
+class AliPIDResponse;
+
+#include "AliAnalysisTaskTransverseEnergy.h"
+
+class AliAnalysisTaskTotEt : public AliAnalysisTaskTransverseEnergy {
+
+public:
+ AliAnalysisTaskTotEt(const char *name = "AliAnalysisTaskTotEt", Bool_t isMc = false);
+ virtual ~AliAnalysisTaskTotEt();
+
+ // virtual void ConnectInputData(Option_t *);
+ virtual void UserCreateOutputObjects();
+ virtual void UserExec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ AliPIDResponse *fPIDResponse;
+
+private:
+
+ //Declare private to avoid compilation warning
+ AliAnalysisTaskTotEt & operator = (const AliAnalysisTaskTotEt & g) ;//copy assignment
+ AliAnalysisTaskTotEt(const AliAnalysisTaskTotEt & g) ; // copy ctor
+
+ AliAnalysisEtReconstructed *fRecAnalysis; // Rec
+ AliAnalysisEtMonteCarlo *fMCAnalysis; // MC
+
+ //THnSparseD *fSparseHistRecVsMc; // Hist Rec vs Mc
+ //Double_t *fSparseRecVsMc; // Rec vs Mc
+
+ ClassDef(AliAnalysisTaskTotEt, 2)
+};
+
+#endif
-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-\r
-#include "iostream"\r
-#include "TSystem.h"\r
-\r
-#include <TPDGCode.h>\r
-#include <TDatabasePDG.h>\r
-\r
-#include "TChain.h"\r
-#include "TTreeStream.h"\r
-#include "TTree.h"\r
-#include "TH1F.h"\r
-#include "TH3.h"\r
-#include "TCanvas.h"\r
-#include "TList.h"\r
-#include "TObjArray.h"\r
-#include "TFile.h"\r
-#include "TMatrixD.h"\r
-#include "TRandom3.h"\r
-\r
-#include "AliHeader.h" \r
-#include "AliGenEventHeader.h" \r
-#include "AliInputEventHandler.h" \r
-#include "AliStack.h" \r
-#include "AliTrackReference.h" \r
-\r
-#include "AliPhysicsSelection.h"\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDfriend.h"\r
-#include "AliMCEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliESDVertex.h"\r
-#include "AliTracker.h"\r
-#include "AliVTrack.h"\r
-#include "AliGeomManager.h"\r
-\r
-#include "AliCentrality.h"\r
-#include "AliESDVZERO.h"\r
-#include "AliMultiplicity.h"\r
-\r
-#include "AliESDtrackCuts.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliFilteredTreeEventCuts.h"\r
-#include "AliFilteredTreeAcceptanceCuts.h"\r
-\r
-#include "AliAnalysisTaskFilteredTree.h"\r
-#include "AliKFParticle.h"\r
-#include "AliESDv0.h"\r
-#include "TVectorD.h"\r
-\r
-using namespace std;\r
-\r
-ClassImp(AliAnalysisTaskFilteredTree)\r
-\r
-//_____________________________________________________________________________\r
-AliAnalysisTaskFilteredTree::AliAnalysisTaskFilteredTree(const char *name) \r
- : AliAnalysisTaskSE(name)\r
- , fESD(0)\r
- , fMC(0)\r
- , fESDfriend(0)\r
- , fOutput(0)\r
- , fPitList(0)\r
- , fUseMCInfo(kFALSE)\r
- , fUseESDfriends(kFALSE)\r
- , fReducePileUp(kTRUE)\r
- , fFillTree(kTRUE)\r
- , fFilteredTreeEventCuts(0)\r
- , fFilteredTreeAcceptanceCuts(0)\r
- , fFilteredTreeRecAcceptanceCuts(0)\r
- , fEsdTrackCuts(0)\r
- , fTrigger(AliTriggerAnalysis::kMB1) \r
- , fAnalysisMode(kTPCAnalysisMode) \r
- , fTreeSRedirector(0)\r
- , fCentralityEstimator(0)\r
- , fLowPtTrackDownscaligF(0)\r
- , fLowPtV0DownscaligF(0)\r
- , fProcessAll(kFALSE)\r
- , fProcessCosmics(kFALSE)\r
- , fHighPtTree(0)\r
- , fV0Tree(0)\r
- , fdEdxTree(0)\r
- , fLaserTree(0)\r
- , fMCEffTree(0)\r
- , fCosmicPairsTree(0)\r
- , fPtResPhiPtTPC(0)\r
- , fPtResPhiPtTPCc(0)\r
- , fPtResPhiPtTPCITS(0)\r
- , fPtResEtaPtTPC(0)\r
- , fPtResEtaPtTPCc(0)\r
- , fPtResEtaPtTPCITS(0)\r
- , fPtResCentPtTPC(0)\r
- , fPtResCentPtTPCc(0)\r
- , fPtResCentPtTPCITS(0)\r
-{\r
- // Constructor\r
-\r
- // Define input and output slots here\r
- DefineOutput(1, TTree::Class());\r
- DefineOutput(2, TTree::Class());\r
- DefineOutput(3, TTree::Class());\r
- DefineOutput(4, TTree::Class());\r
- DefineOutput(5, TTree::Class());\r
- DefineOutput(6, TTree::Class());\r
- DefineOutput(7, TList::Class());\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliAnalysisTaskFilteredTree::~AliAnalysisTaskFilteredTree()\r
-{\r
- //the output trees not to be deleted in case of proof analysis\r
- //Bool_t deleteTrees=kTRUE;\r
- //if ((AliAnalysisManager::GetAnalysisManager()))\r
- //{\r
- // if (AliAnalysisManager::GetAnalysisManager()->GetAnalysisType() == \r
- // AliAnalysisManager::kProofAnalysis)\r
- // deleteTrees=kFALSE;\r
- //}\r
- //if (deleteTrees) delete fTreeSRedirector;\r
-\r
- delete fFilteredTreeEventCuts;\r
- delete fFilteredTreeAcceptanceCuts;\r
- delete fFilteredTreeRecAcceptanceCuts;\r
- delete fEsdTrackCuts;\r
-}\r
-\r
-//____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::Notify()\r
-{\r
- static Int_t count = 0;\r
- count++;\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(chain)\r
- {\r
- Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());\r
- }\r
-\r
-return kTRUE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::UserCreateOutputObjects()\r
-{\r
- // Create histograms\r
- // Called once\r
-\r
- //\r
- //get the output file to make sure the trees will be associated to it\r
- OpenFile(1);\r
- fTreeSRedirector = new TTreeSRedirector();\r
- \r
- //\r
- // Create trees\r
- fV0Tree = ((*fTreeSRedirector)<<"V0s").GetTree();\r
- fHighPtTree = ((*fTreeSRedirector)<<"highPt").GetTree();\r
- fdEdxTree = ((*fTreeSRedirector)<<"dEdx").GetTree();\r
- fLaserTree = ((*fTreeSRedirector)<<"Laser").GetTree();\r
- fMCEffTree = ((*fTreeSRedirector)<<"MCEffTree").GetTree();\r
- fCosmicPairsTree = ((*fTreeSRedirector)<<"CosmicPairs").GetTree();\r
-\r
-\r
-\r
-\r
- // histogram booking\r
-\r
- Double_t minPt = 0.1; \r
- Double_t maxPt = 100.; \r
- Int_t nbinsPt = 30; \r
-\r
- Double_t logminPt = TMath::Log10(minPt);\r
- Double_t logmaxPt = TMath::Log10(maxPt);\r
- Double_t binwidth = (logmaxPt-logminPt)/nbinsPt;\r
- Double_t *binsPt = new Double_t[nbinsPt+1];\r
- binsPt[0] = minPt;\r
- for (Int_t i=1;i<=nbinsPt;i++) {\r
- binsPt[i] = minPt + TMath::Power(10,logminPt+i*binwidth);\r
- }\r
-\r
- // 1pT resol cov matrix bins\r
- Double_t min1PtRes = 0.; \r
- Double_t max1PtRes = 0.3; \r
- Int_t nbins1PtRes = 300; \r
- Double_t bins1PtRes[301];\r
- for (Int_t i=0;i<=nbins1PtRes;i++) {\r
- bins1PtRes[i] = min1PtRes + i*(max1PtRes-min1PtRes)/nbins1PtRes;\r
- }\r
-\r
- // phi bins\r
- Double_t minPhi = 0.; \r
- Double_t maxPhi = 6.5; \r
- Int_t nbinsPhi = 100; \r
- Double_t binsPhi[101];\r
- for (Int_t i=0;i<=nbinsPhi;i++) {\r
- binsPhi[i] = minPhi + i*(maxPhi-minPhi)/nbinsPhi;\r
- }\r
-\r
- // eta bins\r
- Double_t minEta = -1.;\r
- Double_t maxEta = 1.;\r
- Int_t nbinsEta = 20;\r
- Double_t binsEta[21];\r
- for (Int_t i=0;i<=nbinsEta;i++) {\r
- binsEta[i] = minEta + i*(maxEta-minEta)/nbinsEta;\r
- }\r
-\r
- // mult bins\r
- Double_t minCent = 0.;\r
- Double_t maxCent = 100;\r
- Int_t nbinsCent = 20;\r
- Double_t binsCent[101];\r
- for (Int_t i=0;i<=nbinsCent;i++) {\r
- binsCent[i] = minCent + i*(maxCent-minCent)/nbinsCent;\r
- }\r
- \r
- fPtResPhiPtTPC = new TH3D("fPtResPhiPtTPC","pt rel. resolution from cov. matrix TPC tracks",nbinsPt,binsPt,nbinsPhi,binsPhi,nbins1PtRes,bins1PtRes);\r
- fPtResPhiPtTPCc = new TH3D("fPtResPhiPtTPCc","pt rel. resolution from cov. matrix TPC constrained tracks",nbinsPt,binsPt,nbinsPhi,binsPhi,nbins1PtRes,bins1PtRes);\r
- fPtResPhiPtTPCITS = new TH3D("fPtResPhiPtTPCITS","pt rel. resolution from cov. matrix TPC+ITS tracks",nbinsPt,binsPt,nbinsPhi,binsPhi,nbins1PtRes,bins1PtRes);\r
- \r
-fPtResEtaPtTPC = new TH3D("fPtResEtaPtTPC","pt rel. resolution from cov. matrix TPC tracks",nbinsPt,binsPt,nbinsEta,binsEta,nbins1PtRes,bins1PtRes);\r
- fPtResEtaPtTPCc = new TH3D("fPtResEtaPtTPCc","pt rel. resolution from cov. matrix TPC constrained tracks",nbinsPt,binsPt,nbinsEta,binsEta,nbins1PtRes,bins1PtRes);\r
- fPtResEtaPtTPCITS = new TH3D("fPtResEtaPtTPCITS","pt rel. resolution from cov. matrix TPC+ITS tracks",nbinsPt,binsPt,nbinsEta,binsEta,nbins1PtRes,bins1PtRes);\r
- \r
-fPtResCentPtTPC = new TH3D("fPtResCentPtTPC","pt rel. resolution from cov. matrix TPC tracks",nbinsPt,binsPt,nbinsCent,binsCent,nbins1PtRes,bins1PtRes);\r
- fPtResCentPtTPCc = new TH3D("fPtResCentPtTPCc","pt rel. resolution from cov. matrix TPC constrained tracks",nbinsPt,binsPt,nbinsCent,binsCent,nbins1PtRes,bins1PtRes);\r
- fPtResCentPtTPCITS = new TH3D("fPtResCentPtTPCITS","pt rel. resolution from cov. matrix TPC+ITS tracks",nbinsPt,binsPt,nbinsCent,binsCent,nbins1PtRes,bins1PtRes);\r
-\r
- \r
- fOutput = new TList; \r
- if(!fOutput) return;\r
- fOutput->SetOwner();\r
-\r
- fOutput->Add(fPtResPhiPtTPC);\r
- fOutput->Add(fPtResPhiPtTPCc);\r
- fOutput->Add(fPtResPhiPtTPCITS);\r
- fOutput->Add(fPtResEtaPtTPC);\r
- fOutput->Add(fPtResEtaPtTPCc);\r
- fOutput->Add(fPtResEtaPtTPCITS);\r
- fOutput->Add(fPtResCentPtTPC);\r
- fOutput->Add(fPtResCentPtTPCc);\r
- fOutput->Add(fPtResCentPtTPCITS);\r
-\r
- // post data to outputs\r
-\r
- PostData(1,fV0Tree);\r
- PostData(2,fHighPtTree);\r
- PostData(3,fdEdxTree);\r
- PostData(4,fLaserTree);\r
- PostData(5,fMCEffTree);\r
- PostData(6,fCosmicPairsTree);\r
-\r
- PostData(7,fOutput);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::UserExec(Option_t *) \r
-{\r
- //\r
- // Called for each event\r
- //\r
-\r
- // ESD event\r
- fESD = (AliESDEvent*) (InputEvent());\r
- if (!fESD) {\r
- Printf("ERROR: ESD event not available");\r
- return;\r
- }\r
-\r
- //// MC event\r
- //if(fUseMCInfo) {\r
- // fMC = MCEvent();\r
- // if (!fMC) {\r
- // Printf("ERROR: MC event not available");\r
- // return;\r
- // }\r
- //}\r
- \r
- //if MC info available - use it.\r
- fMC = MCEvent();\r
-\r
- if(fUseESDfriends) {\r
- fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));\r
- if(!fESDfriend) {\r
- Printf("ERROR: ESD friends not available");\r
- }\r
- }\r
-\r
- //if set, use the environment variables to set the downscaling factors\r
- //AliAnalysisTaskFilteredTree_fLowPtTrackDownscaligF\r
- //AliAnalysisTaskFilteredTree_fLowPtV0DownscaligF\r
- TString env;\r
- env = gSystem->Getenv("AliAnalysisTaskFilteredTree_fLowPtTrackDownscaligF");\r
- if (!env.IsNull())\r
- {\r
- fLowPtTrackDownscaligF=env.Atof();\r
- AliInfo(Form("fLowPtTrackDownscaligF=%f",fLowPtTrackDownscaligF));\r
- }\r
- env = gSystem->Getenv("AliAnalysisTaskFilteredTree_fLowPtV0DownscaligF");\r
- if (!env.IsNull())\r
- {\r
- fLowPtV0DownscaligF=env.Atof();\r
- AliInfo(Form("fLowPtV0DownscaligF=%f",fLowPtTrackDownscaligF));\r
- }\r
-\r
- //\r
- if(fProcessAll) { \r
- ProcessAll(fESD,fMC,fESDfriend); // all track stages and MC\r
- }\r
- else {\r
- Process(fESD,fMC,fESDfriend); // only global and TPC tracks\r
- }\r
-\r
- //\r
- ProcessV0(fESD,fMC,fESDfriend);\r
- ProcessLaser(fESD,fMC,fESDfriend);\r
- ProcessdEdx(fESD,fMC,fESDfriend);\r
-\r
- if (fProcessCosmics) { ProcessCosmics(fESD); }\r
- if(fMC) { ProcessMCEff(fESD,fMC,fESDfriend);}\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::ProcessCosmics(AliESDEvent *const event)\r
-{\r
- //\r
- // Select real events with high-pT tracks \r
- //\r
- if(!event) {\r
- AliDebug(AliLog::kError, "event not available");\r
- return;\r
- }\r
-\r
- // \r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
- if (!inputHandler)\r
- {\r
- Printf("ERROR: Could not receive input handler");\r
- return;\r
- }\r
- \r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
-\r
- // check for cosmic pairs\r
- //\r
- // find cosmic pairs trigger by random trigger\r
- //\r
- //\r
- AliESDVertex *vertexSPD = (AliESDVertex *)event->GetPrimaryVertexSPD();\r
- AliESDVertex *vertexTPC = (AliESDVertex *)event->GetPrimaryVertexTPC(); \r
- const Double_t kMinPt=0.8;\r
- const Double_t kMinPtMax=0.8;\r
- const Double_t kMinNcl=50;\r
- const Double_t kMaxDelta[5]={2,600,0.02,0.02,0.1};\r
- Int_t ntracks=event->GetNumberOfTracks(); \r
- // Float_t dcaTPC[2]={0,0};\r
- // Float_t covTPC[3]={0,0,0};\r
-\r
- UInt_t specie = event->GetEventSpecie(); // skip laser events\r
- if (specie==AliRecoParam::kCalib) return;\r
- \r
-\r
-\r
- for (Int_t itrack0=0;itrack0<ntracks;itrack0++) {\r
- AliESDtrack *track0 = event->GetTrack(itrack0);\r
- if (!track0) continue;\r
- if (!track0->IsOn(AliESDtrack::kTPCrefit)) continue;\r
-\r
- if (TMath::Abs(AliTracker::GetBz())>1 && track0->Pt() < kMinPt) continue;\r
- if (track0->Pt() < kMinPt) continue;\r
- if (track0->GetTPCncls() < kMinNcl) continue;\r
- if (TMath::Abs(track0->GetY())<kMaxDelta[0]) continue; \r
- if (track0->GetKinkIndex(0)>0) continue;\r
- const Double_t * par0=track0->GetParameter(); //track param at rhe DCA\r
- //rm primaries\r
- //\r
- //track0->GetImpactParametersTPC(dcaTPC,covTPC);\r
- //if (TMath::Abs(dcaTPC[0])<kMaxDelta[0]) continue;\r
- //if (TMath::Abs(dcaTPC[1])<kMaxDelta[0]*2) continue;\r
- // const AliExternalTrackParam * trackIn0 = track0->GetInnerParam();\r
- for (Int_t itrack1=itrack0+1;itrack1<ntracks;itrack1++) {\r
- AliESDtrack *track1 = event->GetTrack(itrack1);\r
- if (!track1) continue; \r
- if (!track1->IsOn(AliESDtrack::kTPCrefit)) continue;\r
- if (track1->GetKinkIndex(0)>0) continue;\r
- if ((TMath::Abs(AliTracker::GetBz())>1) && (track1->Pt() < kMinPt)) continue;\r
- if (track1->Pt() < kMinPt) continue;\r
- if (track1->GetTPCncls()<kMinNcl) continue;\r
- if (TMath::Abs(AliTracker::GetBz())>1 && TMath::Max(track1->Pt(), track0->Pt())<kMinPtMax) continue;\r
- if (TMath::Abs(track1->GetY())<kMaxDelta[0]) continue;\r
- //track1->GetImpactParametersTPC(dcaTPC,covTPC);\r
- // if (TMath::Abs(dcaTPC[0])<kMaxDelta[0]) continue;\r
- //if (TMath::Abs(dcaTPC[1])<kMaxDelta[0]*2) continue;\r
- //\r
- const Double_t* par1=track1->GetParameter(); //track param at rhe DCA\r
- //\r
- Bool_t isPair=kTRUE;\r
- for (Int_t ipar=0; ipar<5; ipar++){\r
- if (ipar==4&&TMath::Abs(AliTracker::GetBz())<1) continue; // 1/pt not defined for B field off\r
- if (TMath::Abs(TMath::Abs(par0[ipar])-TMath::Abs(par1[ipar]))>kMaxDelta[ipar]) isPair=kFALSE;\r
- }\r
- if (!isPair) continue;\r
- if (TMath::Abs(TMath::Abs(track0->GetAlpha()-track1->GetAlpha())-TMath::Pi())>kMaxDelta[2]) isPair=kFALSE;\r
- //delta with correct sign\r
- /*\r
- TCut cut0="abs(t1.fP[0]+t0.fP[0])<2"\r
- TCut cut3="abs(t1.fP[3]+t0.fP[3])<0.02"\r
- TCut cut4="abs(t1.fP[4]+t0.fP[4])<0.2"\r
- */\r
- if (TMath::Abs(par0[0]+par1[0])>kMaxDelta[0]) isPair=kFALSE; //delta y opposite sign\r
- if (TMath::Abs(par0[3]+par1[3])>kMaxDelta[3]) isPair=kFALSE; //delta tgl opposite sign\r
- if (TMath::Abs(AliTracker::GetBz())>1 && TMath::Abs(par0[4]+par1[4])>kMaxDelta[4]) isPair=kFALSE; //delta 1/pt opposite sign\r
- if (!isPair) continue;\r
- TString filename(AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()->GetName());\r
- Int_t eventNumber = event->GetEventNumberInFile(); \r
- //Bool_t hasFriend = kFALSE;\r
- //Bool_t hasITS=(track0->GetNcls(0)+track1->GetNcls(0)>4);\r
- //printf("DUMPHPTCosmic:%s|%f|%d|%d|%d\n",filename.Data(),(TMath::Min(track0->Pt(),track1->Pt())), eventNumber,hasFriend,hasITS);\r
- // const AliExternalTrackParam * trackIn1 = track1->GetInnerParam(); \r
- //\r
- // \r
- Int_t ntracksSPD = vertexSPD->GetNContributors();\r
- Int_t ntracksTPC = vertexTPC->GetNContributors(); \r
- Int_t runNumber = event->GetRunNumber(); \r
- Int_t timeStamp = event->GetTimeStamp();\r
- ULong64_t triggerMask = event->GetTriggerMask();\r
- Float_t magField = event->GetMagneticField();\r
- TObjString triggerClass = event->GetFiredTriggerClasses().Data();\r
- \r
- //\r
- // Dump to the tree \r
- // vertex\r
- // TPC-ITS tracks\r
- //\r
-\r
- //fCosmicPairsTree->Branch("fileName",&fileName,32000,0);\r
- //fCosmicPairsTree->Branch("runNumber",&runNumber,"runNumber/I");\r
- //fCosmicPairsTree->Branch("timeStamp",&timeStamp,"timeStamp/I");\r
- //fCosmicPairsTree->Branch("eventNumber",&eventNumber,"eventNumber/I");\r
- //fCosmicPairsTree->Branch("triggerMask",&triggerMask,32000,0);\r
- //fCosmicPairsTree->Branch("triggerClass",&triggerClass,32000,0);\r
- //fCosmicPairsTree->Branch("magField",&magField,"magField/F");\r
- //fCosmicPairsTree->Branch("ntracksSPD",&ntracksSPD,"ntracksSPD/I");\r
- //fCosmicPairsTree->Branch("ntracksTPC",&ntracksTPC,"ntracksTPC/I");\r
- //fCosmicPairsTree->Branch("vertexSPD",vertexSPD,32000,0);\r
- //fCosmicPairsTree->Branch("vertexTPC",vertexTPC,32000,0);\r
- //fCosmicPairsTree->Branch("track0",track0,32000,0);\r
- //fCosmicPairsTree->Branch("track1",track1,32000,0);\r
- //\r
- //fCosmicPairsTree->Fill();\r
-\r
- if(!fFillTree) return;\r
- if(!fTreeSRedirector) return;\r
- (*fTreeSRedirector)<<"CosmicPairs"<<\r
- "fileName.="<<&fileName<< // file name\r
- "runNumber="<<runNumber<< // run number \r
- "evtTimeStamp="<<timeStamp<< // time stamp of event\r
- "evtNumberInFile="<<eventNumber<< // event number \r
- "trigger="<<triggerMask<< // trigger\r
- "triggerClass="<<&triggerClass<< // trigger\r
- "Bz="<<magField<< // magnetic field\r
- //\r
- "multSPD="<<ntracksSPD<<\r
- "multTPC="<<ntracksTPC<<\r
- "vertSPD.="<<vertexSPD<< //primary vertex -SPD\r
- "vertTPC.="<<vertexTPC<< //primary vertex -TPC\r
- "t0.="<<track0<< //track0\r
- "t1.="<<track1<< //track1\r
- "\n"; \r
- }\r
- }\r
-}\r
-\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)\r
-{\r
- //\r
- // Select real events with high-pT tracks \r
- //\r
- if(!esdEvent) {\r
- AliDebug(AliLog::kError, "esdEvent not available");\r
- return;\r
- }\r
-\r
- // get selection cuts\r
- AliFilteredTreeEventCuts *evtCuts = GetEventCuts(); \r
- AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
- AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
-\r
- if(!evtCuts || !accCuts || !esdTrackCuts) {\r
- Printf("ERROR cuts not available");\r
- return;\r
- }\r
-\r
- // trigger selection\r
- Bool_t isEventTriggered = kTRUE;\r
- AliPhysicsSelection *physicsSelection = NULL;\r
- AliTriggerAnalysis* triggerAnalysis = NULL;\r
-\r
- // \r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
- if (!inputHandler)\r
- {\r
- Printf("ERROR: Could not receive input handler");\r
- return;\r
- }\r
- \r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
- // trigger\r
- if(evtCuts->IsTriggerRequired()) \r
- {\r
- // always MB\r
- isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;\r
-\r
- physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());\r
- if(!physicsSelection) return;\r
- //SetPhysicsTriggerSelection(physicsSelection);\r
-\r
- if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {\r
- // set trigger (V0AND)\r
- triggerAnalysis = physicsSelection->GetTriggerAnalysis();\r
- if(!triggerAnalysis) return;\r
- isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
- }\r
- }\r
-\r
- // centrality determination\r
- Float_t centralityF = -1;\r
- AliCentrality *esdCentrality = esdEvent->GetCentrality();\r
- centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());\r
-\r
- // use MC information\r
- AliHeader* header = 0;\r
- AliGenEventHeader* genHeader = 0;\r
- AliStack* stack = 0;\r
- TArrayF vtxMC(3);\r
-\r
- Int_t multMCTrueTracks = 0;\r
- if(mcEvent)\r
- {\r
- // get MC event header\r
- header = mcEvent->Header();\r
- if (!header) {\r
- AliDebug(AliLog::kError, "Header not available");\r
- return;\r
- }\r
- // MC particle stack\r
- stack = mcEvent->Stack();\r
- if (!stack) {\r
- AliDebug(AliLog::kError, "Stack not available");\r
- return;\r
- }\r
-\r
- // get MC vertex\r
- genHeader = header->GenEventHeader();\r
- if (!genHeader) {\r
- AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
- return;\r
- }\r
- genHeader->PrimaryVertex(vtxMC);\r
-\r
- // multipliticy of all MC primary tracks\r
- // in Zv, pt and eta ranges)\r
- multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
- } // end bUseMC\r
-\r
- // get reconstructed vertex \r
- //const AliESDVertex* vtxESD = 0; \r
- AliESDVertex* vtxESD = 0; \r
- if(GetAnalysisMode() == kTPCAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();\r
- }\r
- else if(GetAnalysisMode() == kTPCITSAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();\r
- }\r
- else {\r
- return;\r
- }\r
-\r
- AliESDVertex* vtxTPC = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();\r
- AliESDVertex* vtxSPD = (AliESDVertex*)esdEvent->GetPrimaryVertexSPD();\r
-\r
- if(!vtxESD) return;\r
- if(!vtxTPC) return;\r
- if(!vtxSPD) return;\r
-\r
- Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD); \r
- //printf("isEventOK %d, isEventTriggered %d, status %d, vz %f \n",isEventOK, isEventTriggered, vtxESD->GetStatus(), vtxESD->GetZv());\r
- //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
- Int_t ntracks = esdEvent->GetNumberOfTracks();\r
-\r
- // check event cuts\r
- if(isEventOK && isEventTriggered)\r
- {\r
-\r
- //\r
- // get IR information\r
- //\r
- AliESDHeader *esdHeader = 0;\r
- esdHeader = esdEvent->GetHeader();\r
- if(!esdHeader) return;\r
- //Int_t ir1 = esdHeader->GetTriggerIREntries(); //all ir-s\r
- //Int_t ir2 = esdHeader->GetTriggerIREntries(-1,1); // int2 set, 180 ms time interval\r
-\r
- // Use when Peter commit the changes in the header\r
- Int_t ir1 = 0;\r
- Int_t ir2 = 0;\r
-\r
- //\r
- Double_t vert[3] = {0}; \r
- vert[0] = vtxESD->GetXv();\r
- vert[1] = vtxESD->GetYv();\r
- vert[2] = vtxESD->GetZv();\r
- Int_t mult = vtxESD->GetNContributors();\r
- Int_t multSPD = vtxSPD->GetNContributors();\r
- Int_t multTPC = vtxTPC->GetNContributors();\r
-\r
- Float_t bz = esdEvent->GetMagneticField();\r
- Int_t runNumber = esdEvent->GetRunNumber();\r
- Int_t evtTimeStamp = esdEvent->GetTimeStamp();\r
- Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();\r
-\r
- // high pT tracks\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)\r
- {\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack);\r
- if(!track) continue;\r
- if(track->Charge()==0) continue;\r
- if(!esdTrackCuts->AcceptTrack(track)) continue;\r
- if(!accCuts->AcceptTrack(track)) continue;\r
- \r
- // downscale low-pT tracks\r
- Double_t scalempt= TMath::Min(track->Pt(),10.);\r
- Double_t downscaleF = gRandom->Rndm();\r
- downscaleF *= fLowPtTrackDownscaligF;\r
- if(TMath::Exp(2*scalempt)<downscaleF) continue;\r
- //printf("TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);\r
-\r
- AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(track->GetTPCInnerParam());\r
- if (!tpcInner) continue;\r
- // transform to the track reference frame \r
- Bool_t isOK = kFALSE;\r
- isOK = tpcInner->Rotate(track->GetAlpha());\r
- isOK = tpcInner->PropagateTo(track->GetX(),esdEvent->GetMagneticField());\r
- if(!isOK) continue;\r
-\r
- // Dump to the tree \r
- // vertex\r
- // TPC-ITS tracks\r
- //\r
- TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();\r
-\r
- //fHighPtTree->Branch("fileName",&fileName,32000,0);\r
- //fHighPtTree->Branch("runNumber",&runNumber,"runNumber/I");\r
- //fHighPtTree->Branch("evtTimeStamp",&evtTimeStamp,"evtTimeStamp/I");\r
- //fHighPtTree->Branch("evtNumberInFile",&evtNumberInFile,"evtNumberInFile/I");\r
- //fHighPtTree->Branch("triggerClass",&triggerClass,32000,0);\r
- //fHighPtTree->Branch("Bz",&bz,"Bz/F");\r
- //fHighPtTree->Branch("vtxESD",vtxESD,32000,0);\r
- //fHighPtTree->Branch("IRtot",&ir1,"IRtot/I");\r
- //fHighPtTree->Branch("IRint2",&ir2,"IRint2/I");\r
- //fHighPtTree->Branch("mult",&mult,"mult/I");\r
- //fHighPtTree->Branch("esdTrack",track,32000,0);\r
- //fHighPtTree->Branch("centralityF",¢ralityF,"centralityF/F");\r
-\r
- //fHighPtTree->Fill();\r
-\r
- //Double_t vtxX=vtxESD->GetX();\r
- //Double_t vtxY=vtxESD->GetY();\r
- //Double_t vtxZ=vtxESD->GetZ();\r
- if(!fFillTree) return;\r
- if(!fTreeSRedirector) return;\r
- (*fTreeSRedirector)<<"highPt"<<\r
- "fileName.="<<&fileName<< \r
- "runNumber="<<runNumber<<\r
- "evtTimeStamp="<<evtTimeStamp<<\r
- "evtNumberInFile="<<evtNumberInFile<<\r
- "triggerClass="<<&triggerClass<< // trigger\r
- "Bz="<<bz<< // magnetic field\r
- "vtxESD.="<<vtxESD<<\r
- "ntracksESD="<<ntracks<< // number of tracks in the ESD\r
- // "vtxESDx="<<vtxX<<\r
- // "vtxESDy="<<vtxY<<\r
- // "vtxESDz="<<vtxZ<<\r
- "IRtot="<<ir1<< // interaction record history info\r
- "IRint2="<<ir2<<\r
- "mult="<<mult<< // multiplicity of tracks pointing to the primary vertex\r
- "multSPD="<<multSPD<< // multiplicity of tracks pointing to the SPD primary vertex\r
- "multTPC="<<multTPC<< // multiplicity of tracks pointing to the TPC primary vertex\r
- "esdTrack.="<<track<<\r
- "centralityF="<<centralityF<< \r
- "\n";\r
- }\r
- }\r
- \r
-}\r
-\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::ProcessLaser(AliESDEvent *const esdEvent, AliMCEvent * const /*mcEvent*/, AliESDfriend *const /*esdFriend*/)\r
-{\r
- //\r
- // Process laser events\r
- //\r
- if(!esdEvent) {\r
- AliDebug(AliLog::kError, "esdEvent not available");\r
- return;\r
- }\r
-\r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
- // laser events \r
- const AliESDHeader* esdHeader = esdEvent->GetHeader();\r
- if(esdHeader && esdHeader->GetEventSpecie()==AliRecoParam::kCalib) \r
- {\r
- Int_t countLaserTracks = 0;\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)\r
- {\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack);\r
- if(!track) continue;\r
-\r
- if(track->GetTPCInnerParam()) countLaserTracks++;\r
- }\r
- \r
- if(countLaserTracks > 100) \r
- { \r
- Int_t runNumber = esdEvent->GetRunNumber();\r
- Int_t evtTimeStamp = esdEvent->GetTimeStamp();\r
- Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();\r
- Float_t bz = esdEvent->GetMagneticField();\r
- TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();\r
-\r
- //fLaserTree->Branch("fileName",&fileName,32000,0);\r
- //fLaserTree->Branch("runNumber",&runNumber,"runNumber/I");\r
- //fLaserTree->Branch("evtTimeStamp",&evtTimeStamp,"evtTimeStamp/I");\r
- //fLaserTree->Branch("evtNumberInFile",&evtNumberInFile,"evtNumberInFile/I");\r
- //fLaserTree->Branch("triggerClass",&triggerClass,32000,0);\r
- //fLaserTree->Branch("Bz",&bz,"Bz/F");\r
- //fLaserTree->Branch("multTPCtracks",&countLaserTracks,"multTPCtracks/I");\r
-\r
- //fLaserTree->Fill();\r
-\r
- if(!fFillTree) return;\r
- if(!fTreeSRedirector) return;\r
- (*fTreeSRedirector)<<"Laser"<<\r
- "fileName.="<<&fileName<<\r
- "runNumber="<<runNumber<<\r
- "evtTimeStamp="<<evtTimeStamp<<\r
- "evtNumberInFile="<<evtNumberInFile<<\r
- "triggerClass="<<&triggerClass<< // trigger\r
- "Bz="<<bz<<\r
- "multTPCtracks="<<countLaserTracks<<\r
- "\n";\r
- }\r
- }\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::ProcessAll(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const esdFriend)\r
-{\r
- //\r
- // Select real events with high-pT tracks\r
- // Calculate and stor in the output tree:\r
- // TPC constrained tracks\r
- // InnerParams constrained tracks\r
- // TPC-ITS tracks\r
- // ITSout-InnerParams tracks\r
- // chi2 distance between TPC constrained and TPC-ITS tracks\r
- // chi2 distance between TPC refitted constrained and TPC-ITS tracks\r
- // chi2 distance between ITSout and InnerParams tracks\r
- // MC information: \r
- // track references at ITSin, TPCin; InnerParam at first TPC track reference, \r
- // particle ID, mother ID, production mechanism ...\r
- // \r
-\r
- if(!esdEvent) {\r
- AliDebug(AliLog::kError, "esdEvent not available");\r
- return;\r
- }\r
-\r
- // get selection cuts\r
- AliFilteredTreeEventCuts *evtCuts = GetEventCuts(); \r
- AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
- AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
-\r
- if(!evtCuts || !accCuts || !esdTrackCuts) {\r
- AliDebug(AliLog::kError, "cuts not available");\r
- return;\r
- }\r
-\r
- // trigger selection\r
- Bool_t isEventTriggered = kTRUE;\r
- AliPhysicsSelection *physicsSelection = NULL;\r
- AliTriggerAnalysis* triggerAnalysis = NULL;\r
-\r
- // \r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
- if (!inputHandler)\r
- {\r
- Printf("ERROR: Could not receive input handler");\r
- return;\r
- }\r
- \r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
- // trigger\r
- if(evtCuts->IsTriggerRequired()) \r
- {\r
- // always MB\r
- isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;\r
-\r
- physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());\r
- if(!physicsSelection) {AliInfo("no physics selection"); return;}\r
- //SetPhysicsTriggerSelection(physicsSelection);\r
-\r
- if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {\r
- // set trigger (V0AND)\r
- triggerAnalysis = physicsSelection->GetTriggerAnalysis();\r
- if(!triggerAnalysis) {AliInfo("no trigger analysis");return;}\r
- isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
- }\r
- }\r
-\r
- // centrality determination\r
- Float_t centralityF = -1;\r
- AliCentrality *esdCentrality = esdEvent->GetCentrality();\r
- centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());\r
-\r
- // use MC information\r
- AliHeader* header = 0;\r
- AliGenEventHeader* genHeader = 0;\r
- AliStack* stack = 0;\r
- TArrayF vtxMC(3);\r
- Int_t mcStackSize=0;\r
-\r
- Int_t multMCTrueTracks = 0;\r
- if(mcEvent)\r
- {\r
- // get MC event header\r
- header = mcEvent->Header();\r
- if (!header) {\r
- AliDebug(AliLog::kError, "Header not available");\r
- return;\r
- }\r
- // MC particle stack\r
- stack = mcEvent->Stack();\r
- if (!stack) {\r
- AliDebug(AliLog::kError, "Stack not available");\r
- return;\r
- }\r
- mcStackSize=stack->GetNtrack();\r
-\r
- // get MC vertex\r
- genHeader = header->GenEventHeader();\r
- if (!genHeader) {\r
- AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
- return;\r
- }\r
- genHeader->PrimaryVertex(vtxMC);\r
-\r
- // multipliticy of all MC primary tracks\r
- // in Zv, pt and eta ranges)\r
- multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
-\r
- } // end bUseMC\r
-\r
- // get reconstructed vertex \r
- //const AliESDVertex* vtxESD = 0; \r
- AliESDVertex* vtxESD = 0; \r
- if(GetAnalysisMode() == kTPCAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();\r
- }\r
- else if(GetAnalysisMode() == kTPCITSAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();\r
- }\r
- else {\r
- AliInfo("no ESD vertex");\r
- return;\r
- }\r
-\r
- if(!vtxESD) return;\r
-\r
- Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD); \r
- \r
- //\r
- // Vertex info comparison and track multiplicity\r
- //\r
- AliESDVertex *vertexSPD = (AliESDVertex *)esdEvent->GetPrimaryVertexSPD();\r
- AliESDVertex *vertexTPC = (AliESDVertex *)esdEvent->GetPrimaryVertexTPC(); \r
- Int_t contSPD = vertexSPD->GetNContributors();\r
- Int_t contTPC = vertexTPC->GetNContributors(); \r
- TVectorD vertexPosTPC(3), vertexPosSPD(3);\r
- vertexSPD->GetXYZ(vertexPosSPD.GetMatrixArray());\r
- vertexTPC->GetXYZ(vertexPosTPC.GetMatrixArray());\r
- Int_t ntracksTPC=0;\r
- Int_t ntracksITS=0;\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++){\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack); \r
- if(!track) continue;\r
- if (track->IsOn(AliVTrack::kTPCrefit)) ntracksTPC++;\r
- if (track->IsOn(AliVTrack::kITSrefit)) ntracksITS++;\r
- }\r
- \r
- //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
- //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
-\r
-\r
- // check event cuts\r
- if(isEventOK && isEventTriggered)\r
- {\r
- //\r
- // get IR information\r
- //\r
- AliESDHeader *esdHeader = 0;\r
- esdHeader = esdEvent->GetHeader();\r
- if(!esdHeader) {AliInfo("no esdHeader");return;}\r
- //Int_t ir1 = esdHeader->GetTriggerIREntries(); //all ir-s\r
- //Int_t ir2 = esdHeader->GetTriggerIREntries(-1,1); // int2 set, 180 ms time interval\r
- //\r
- Int_t ir1 = 0;\r
- Int_t ir2 = 0;\r
-\r
- //\r
- Double_t vert[3] = {0}; \r
- vert[0] = vtxESD->GetXv();\r
- vert[1] = vtxESD->GetYv();\r
- vert[2] = vtxESD->GetZv();\r
- Int_t mult = vtxESD->GetNContributors();\r
- Float_t bz = esdEvent->GetMagneticField();\r
- Int_t runNumber = esdEvent->GetRunNumber();\r
- Int_t evtTimeStamp = esdEvent->GetTimeStamp();\r
- Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();\r
-\r
- // high pT tracks\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)\r
- {\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack);\r
- if(!track) continue;\r
- if(track->Charge()==0) continue;\r
- if(!esdTrackCuts->AcceptTrack(track)) continue;\r
- if(!accCuts->AcceptTrack(track)) continue;\r
- \r
- // downscale low-pT tracks\r
- Double_t scalempt= TMath::Min(track->Pt(),10.);\r
- Double_t downscaleF = gRandom->Rndm();\r
- downscaleF *= fLowPtTrackDownscaligF;\r
- if(TMath::Exp(2*scalempt)<downscaleF) continue;\r
- //printf("TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);\r
-\r
- // Dump to the tree \r
- // vertex\r
- // TPC constrained tracks\r
- // InnerParams constrained tracks\r
- // TPC-ITS tracks\r
- // ITSout-InnerParams tracks\r
- // chi2 distance between TPC constrained and TPC-ITS tracks\r
- // chi2 distance between TPC refitted constrained and TPC-ITS tracks\r
- // chi2 distance between ITSout and InnerParams tracks\r
- // MC information\r
- \r
- Double_t x[3]; track->GetXYZ(x);\r
- Double_t b[3]; AliTracker::GetBxByBz(x,b);\r
-\r
- //\r
- // Transform TPC inner params to track reference frame\r
- //\r
- Bool_t isOKtpcInner = kFALSE;\r
- AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(track->GetTPCInnerParam());\r
- if (tpcInner) {\r
- // transform to the track reference frame \r
- isOKtpcInner = tpcInner->Rotate(track->GetAlpha());\r
- isOKtpcInner = tpcInner->PropagateTo(track->GetX(),esdEvent->GetMagneticField());\r
- }\r
-\r
- //\r
- // Constrain TPC inner to vertex\r
- // clone TPCinner has to be deleted\r
- //\r
- Bool_t isOKtpcInnerC = kFALSE;\r
- AliExternalTrackParam * tpcInnerC = new AliExternalTrackParam(*(track->GetTPCInnerParam()));\r
- if (tpcInnerC) {\r
- isOKtpcInnerC = ConstrainTPCInner(tpcInnerC,vtxESD,b);\r
- isOKtpcInnerC = tpcInnerC->Rotate(track->GetAlpha());\r
- isOKtpcInnerC = tpcInnerC->PropagateTo(track->GetX(),esdEvent->GetMagneticField());\r
- }\r
-\r
- //\r
- // Constrain TPC refitted tracks at inner TPC wall (InnerParams) to vertex \r
- // Clone track InnerParams has to be deleted\r
- //\r
- Bool_t isOKtrackInnerC = kFALSE;\r
- AliExternalTrackParam * trackInnerC = new AliExternalTrackParam(*(track->GetInnerParam()));\r
- if (trackInnerC) {\r
- isOKtrackInnerC = ConstrainTrackInner(trackInnerC,vtxESD,track->GetMass(),b);\r
- isOKtrackInnerC = trackInnerC->Rotate(track->GetAlpha());\r
- isOKtrackInnerC = trackInnerC->PropagateTo(track->GetX(),esdEvent->GetMagneticField());\r
- } \r
- \r
- //\r
- // calculate chi2 between vi and vj vectors\r
- // with covi and covj covariance matrices\r
- // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj)\r
- //\r
- TMatrixD deltaT(5,1), deltaTtrackC(5,1);\r
- TMatrixD delta(1,5), deltatrackC(1,5);\r
- TMatrixD covarM(5,5), covarMtrackC(5,5);\r
- TMatrixD chi2(1,1);\r
- TMatrixD chi2trackC(1,1);\r
-\r
- if(isOKtpcInnerC && isOKtrackInnerC) \r
- {\r
- for (Int_t ipar=0; ipar<5; ipar++) {\r
- deltaT(ipar,0)=tpcInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];\r
- delta(0,ipar)=tpcInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];\r
-\r
- deltaTtrackC(ipar,0)=trackInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];\r
- deltatrackC(0,ipar)=trackInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];\r
-\r
- for (Int_t jpar=0; jpar<5; jpar++) {\r
- Int_t index=track->GetIndex(ipar,jpar);\r
- covarM(ipar,jpar)=track->GetCovariance()[index]+tpcInnerC->GetCovariance()[index];\r
- covarMtrackC(ipar,jpar)=track->GetCovariance()[index]+trackInnerC->GetCovariance()[index];\r
- }\r
- }\r
-\r
- // chi2 distance TPC constrained and TPC+ITS\r
- TMatrixD covarMInv = covarM.Invert();\r
- TMatrixD mat2 = covarMInv*deltaT;\r
- chi2 = delta*mat2; \r
- //chi2.Print();\r
-\r
- // chi2 distance TPC refitted constrained and TPC+ITS\r
- TMatrixD covarMInvtrackC = covarMtrackC.Invert();\r
- TMatrixD mat2trackC = covarMInvtrackC*deltaTtrackC;\r
- chi2trackC = deltatrackC*mat2trackC; \r
- //chi2trackC.Print();\r
- }\r
-\r
-\r
- //\r
- // Propagate ITSout to TPC inner wall \r
- // and calculate chi2 distance to track (InnerParams)\r
- //\r
- const Double_t kTPCRadius=85; \r
- const Double_t kStep=3; \r
-\r
- // clone track InnerParams has to be deleted\r
- Bool_t isOKtrackInnerC2 = kFALSE;\r
- AliExternalTrackParam *trackInnerC2 = new AliExternalTrackParam(*(track->GetInnerParam()));\r
- if (trackInnerC2) {\r
- isOKtrackInnerC2 = AliTracker::PropagateTrackToBxByBz(trackInnerC2,kTPCRadius,track->GetMass(),kStep,kFALSE);\r
- }\r
-\r
- Bool_t isOKouterITSc = kFALSE;\r
- AliExternalTrackParam *outerITSc = NULL;\r
- TMatrixD chi2OuterITS(1,1);\r
-\r
- if(esdFriend && esdFriend->TestSkipBit()==kFALSE) \r
- {\r
- // propagate ITSout to TPC inner wall\r
- AliESDfriendTrack *friendTrack = esdFriend->GetTrack(iTrack);\r
-\r
- if(friendTrack) \r
- {\r
- outerITSc = new AliExternalTrackParam(*friendTrack->GetITSOut());\r
- if(outerITSc) \r
- {\r
- isOKouterITSc = AliTracker::PropagateTrackToBxByBz(outerITSc,kTPCRadius,track->GetMass(),kStep,kFALSE);\r
- isOKouterITSc = outerITSc->Rotate(trackInnerC2->GetAlpha());\r
- isOKouterITSc = outerITSc->PropagateTo(trackInnerC2->GetX(),esdEvent->GetMagneticField());\r
-\r
- //\r
- // calculate chi2 between outerITS and innerParams\r
- // cov without z-coordinate at the moment\r
- //\r
- TMatrixD deltaTouterITS(4,1);\r
- TMatrixD deltaouterITS(1,4);\r
- TMatrixD covarMouterITS(4,4);\r
-\r
- if(isOKtrackInnerC2 && isOKouterITSc) {\r
- Int_t kipar = 0;\r
- Int_t kjpar = 0;\r
- for (Int_t ipar=0; ipar<5; ipar++) {\r
- if(ipar!=1) {\r
- deltaTouterITS(kipar,0)=outerITSc->GetParameter()[ipar]-trackInnerC2->GetParameter()[ipar];\r
- deltaouterITS(0,kipar)=outerITSc->GetParameter()[ipar]-trackInnerC2->GetParameter()[ipar];\r
- }\r
-\r
- kjpar=0;\r
- for (Int_t jpar=0; jpar<5; jpar++) {\r
- Int_t index=outerITSc->GetIndex(ipar,jpar);\r
- if(ipar !=1 || jpar!=1) {\r
- covarMouterITS(kipar,kjpar)=outerITSc->GetCovariance()[index]+trackInnerC2->GetCovariance()[index];\r
- }\r
- if(jpar!=1) kjpar++;\r
- }\r
- if(ipar!=1) kipar++;\r
- }\r
-\r
- // chi2 distance ITSout and InnerParams\r
- TMatrixD covarMInvouterITS = covarMouterITS.Invert();\r
- TMatrixD mat2outerITS = covarMInvouterITS*deltaTouterITS;\r
- chi2OuterITS = deltaouterITS*mat2outerITS; \r
- //chi2OuterITS.Print();\r
- } \r
- }\r
- }\r
- }\r
-\r
- //\r
- // MC info\r
- //\r
- TParticle *particle=NULL, *particleTPC=NULL, *particleITS=NULL;\r
- TParticle *particleMother=NULL, *particleMotherTPC=NULL, *particleMotherITS=NULL;\r
- Int_t mech=-1, mechTPC=-1, mechITS=-1;\r
- Bool_t isPrim=kFALSE, isPrimTPC=kFALSE, isPrimITS=kFALSE;\r
- Bool_t isFromStrangess=kFALSE, isFromStrangessTPC=kFALSE, isFromStrangessITS=kFALSE;\r
- Bool_t isFromConversion=kFALSE, isFromConversionTPC=kFALSE, isFromConversionITS=kFALSE;\r
- Bool_t isFromMaterial=kFALSE, isFromMaterialTPC=kFALSE, isFromMaterialITS=kFALSE;\r
-\r
- AliTrackReference *refTPCIn = NULL;\r
- AliTrackReference *refTPCOut = NULL;\r
- AliTrackReference *refITS = NULL;\r
- AliTrackReference *refTRD = NULL;\r
- AliTrackReference *refTOF = NULL;\r
- AliTrackReference *refEMCAL = NULL;\r
- AliTrackReference *refPHOS = NULL;\r
- Int_t nrefTPC=0, nrefTRD=0, nrefTOF=0, nrefITS=0, nrefEMCAL=0, nrefPHOS=0;\r
-\r
- Bool_t isOKtrackInnerC3 = kFALSE;\r
- AliExternalTrackParam *trackInnerC3 = new AliExternalTrackParam(*(track->GetInnerParam()));\r
- if(mcEvent) \r
- {\r
- if(!stack) return;\r
- multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
- //\r
- // global track\r
- //\r
- Int_t label = TMath::Abs(track->GetLabel()); \r
- if (label >= mcStackSize) continue;\r
- particle = stack->Particle(label);\r
- if (!particle) continue;\r
- if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0.)\r
- {\r
- particleMother = GetMother(particle,stack);\r
- mech = particle->GetUniqueID();\r
- isPrim = stack->IsPhysicalPrimary(label);\r
- isFromStrangess = IsFromStrangeness(label,stack);\r
- isFromConversion = IsFromConversion(label,stack);\r
- isFromMaterial = IsFromMaterial(label,stack);\r
- }\r
-\r
- //\r
- // TPC track\r
- //\r
- Int_t labelTPC = TMath::Abs(track->GetTPCLabel()); \r
- if (labelTPC >= mcStackSize) continue;\r
- particleTPC = stack->Particle(labelTPC);\r
- if (!particleTPC) continue;\r
- if(particleTPC && particleTPC->GetPDG() && particleTPC->GetPDG()->Charge()!=0.)\r
- {\r
- particleMotherTPC = GetMother(particleTPC,stack);\r
- mechTPC = particleTPC->GetUniqueID();\r
- isPrimTPC = stack->IsPhysicalPrimary(labelTPC);\r
- isFromStrangessTPC = IsFromStrangeness(labelTPC,stack);\r
- isFromConversionTPC = IsFromConversion(labelTPC,stack);\r
- isFromMaterialTPC = IsFromMaterial(labelTPC,stack);\r
- }\r
-\r
- //\r
- // store first track reference\r
- // for TPC track\r
- //\r
- TParticle *part=0;\r
- TClonesArray *trefs=0;\r
- Int_t status = mcEvent->GetParticleAndTR(TMath::Abs(labelTPC), part, trefs);\r
-\r
- if(status>0 && part && trefs && part->GetPDG() && part->GetPDG()->Charge()!=0.) \r
- {\r
- Int_t nTrackRef = trefs->GetEntries();\r
- //printf("nTrackRef %d \n",nTrackRef);\r
-\r
- Int_t countITS = 0;\r
- for (Int_t iref = 0; iref < nTrackRef; iref++) \r
- {\r
- AliTrackReference *ref = (AliTrackReference *)trefs->At(iref);\r
-\r
- // Ref. in the middle ITS \r
- if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kITS)\r
- {\r
- nrefITS++;\r
- if(!refITS && countITS==2) {\r
- refITS = ref;\r
- //printf("refITS %p \n",refITS);\r
- }\r
- countITS++;\r
- }\r
-\r
- // TPC\r
- if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kTPC)\r
- {\r
- nrefTPC++;\r
- refTPCOut=ref;\r
- if(!refTPCIn) {\r
- refTPCIn = ref;\r
- //printf("refTPCIn %p \n",refTPCIn);\r
- //break;\r
- }\r
- }\r
- // TRD\r
- if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kTRD)\r
- {\r
- nrefTRD++;\r
- if(!refTRD) {\r
- refTRD = ref;\r
- }\r
- }\r
- // TOF\r
- if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kTOF)\r
- {\r
- nrefTOF++;\r
- if(!refTOF) {\r
- refTOF = ref;\r
- }\r
- }\r
- // EMCAL\r
- if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kEMCAL)\r
- {\r
- nrefEMCAL++;\r
- if(!refEMCAL) {\r
- refEMCAL = ref;\r
- }\r
- }\r
- // PHOS\r
- // if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kPHOS)\r
-// {\r
-// nrefPHOS++;\r
-// if(!refPHOS) {\r
-// refPHOS = ref;\r
-// }\r
-// }\r
- }\r
-\r
- // transform inner params to TrackRef\r
- // reference frame\r
- if(refTPCIn && trackInnerC3) \r
- {\r
- Double_t kRefPhi = TMath::ATan2(refTPCIn->Y(),refTPCIn->X());\r
- isOKtrackInnerC3 = trackInnerC3->Rotate(kRefPhi);\r
- isOKtrackInnerC3 = AliTracker::PropagateTrackToBxByBz(trackInnerC3,refTPCIn->R(),track->GetMass(),kStep,kFALSE);\r
- }\r
- }\r
-\r
- //\r
- // ITS track\r
- //\r
- Int_t labelITS = TMath::Abs(track->GetITSLabel()); \r
- if (labelITS >= mcStackSize) continue;\r
- particleITS = stack->Particle(labelITS);\r
- if (!particleITS) continue;\r
- if(particleITS && particleITS->GetPDG() && particleITS->GetPDG()->Charge()!=0.)\r
- {\r
- particleMotherITS = GetMother(particleITS,stack);\r
- mechITS = particleITS->GetUniqueID();\r
- isPrimITS = stack->IsPhysicalPrimary(labelITS);\r
- isFromStrangessITS = IsFromStrangeness(labelITS,stack);\r
- isFromConversionITS = IsFromConversion(labelITS,stack);\r
- isFromMaterialITS = IsFromMaterial(labelITS,stack);\r
- }\r
- }\r
-\r
- //\r
- Bool_t dumpToTree=kFALSE;\r
- \r
- if(isOKtpcInnerC && isOKtrackInnerC) dumpToTree = kTRUE;\r
- if(fUseESDfriends && isOKtrackInnerC2 && isOKouterITSc) dumpToTree = kTRUE;\r
- if(mcEvent && isOKtrackInnerC3) dumpToTree = kTRUE;\r
- TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();\r
- if (fReducePileUp){ \r
- //\r
- // 18.03 - Reduce pile-up chunks, done outside of the ESDTrackCuts for 2012/2013 data pile-up about 95 % of tracks\r
- // Done only in case no MC info \r
- //\r
- Float_t dcaTPC[2];\r
- track->GetImpactParametersTPC(dcaTPC[0],dcaTPC[1]);\r
- Bool_t isRoughPrimary = TMath::Abs(dcaTPC[1])<10;\r
- Bool_t hasOuter=(track->IsOn(AliVTrack::kITSin))||(track->IsOn(AliVTrack::kTOFout))||(track->IsOn(AliVTrack::kTRDin));\r
- Bool_t keepPileUp=gRandom->Rndm()<0.05;\r
- if ( (!hasOuter) && (!isRoughPrimary) && (!keepPileUp)){\r
- dumpToTree=kFALSE;\r
- }\r
- }\r
- /////////////////\r
- //book keeping of created dummy objects (to avoid NULL in trees)\r
- Bool_t newvtxESD=kFALSE;\r
- Bool_t newtrack=kFALSE;\r
- Bool_t newtpcInnerC=kFALSE;\r
- Bool_t newtrackInnerC=kFALSE;\r
- Bool_t newtrackInnerC2=kFALSE;\r
- Bool_t newouterITSc=kFALSE;\r
- Bool_t newtrackInnerC3=kFALSE;\r
- Bool_t newrefTPCIn=kFALSE;\r
- Bool_t newrefITS=kFALSE;\r
- Bool_t newparticle=kFALSE;\r
- Bool_t newparticleMother=kFALSE;\r
- Bool_t newparticleTPC=kFALSE;\r
- Bool_t newparticleMotherTPC=kFALSE;\r
- Bool_t newparticleITS=kFALSE;\r
- Bool_t newparticleMotherITS=kFALSE;\r
- \r
- //check that the vertex is there and that it is OK, \r
- //i.e. no null member arrays, otherwise a problem with merging\r
- //later on.\r
- //this is a very ugly hack!\r
- if (!vtxESD)\r
- {\r
- AliInfo("fixing the ESD vertex for streaming");\r
- vtxESD=new AliESDVertex(); \r
- //vtxESD->SetNContributors(1);\r
- //UShort_t pindices[1]; pindices[0]=0;\r
- //vtxESD->SetIndices(1,pindices);\r
- //vtxESD->SetNContributors(0);\r
- newvtxESD=kTRUE;\r
- }\r
- //\r
- if (!track) {track=new AliESDtrack();newtrack=kTRUE;}\r
- if (!tpcInnerC) {tpcInnerC=new AliExternalTrackParam();newtpcInnerC=kTRUE;}\r
- if (!trackInnerC) {trackInnerC=new AliExternalTrackParam();newtrackInnerC=kTRUE;}\r
- if (!trackInnerC2) {trackInnerC2=new AliExternalTrackParam();newtrackInnerC2=kTRUE;}\r
- if (!outerITSc) {outerITSc=new AliExternalTrackParam();newouterITSc=kTRUE;}\r
- if (!trackInnerC3) {trackInnerC3=new AliExternalTrackParam();newtrackInnerC3=kTRUE;}\r
- if (mcEvent)\r
- {\r
- if (!refTPCIn) {refTPCIn=new AliTrackReference(); newrefTPCIn=kTRUE;}\r
- if (!refITS) {refITS=new AliTrackReference();newrefITS=kTRUE;}\r
- if (!particle) {particle=new TParticle(); newparticle=kTRUE;}\r
- if (!particleMother) {particleMother=new TParticle();newparticleMother=kTRUE;}\r
- if (!particleTPC) {particleTPC=new TParticle();newparticleTPC=kTRUE;}\r
- if (!particleMotherTPC) {particleMotherTPC=new TParticle();newparticleMotherTPC=kTRUE;}\r
- if (!particleITS) {particleITS=new TParticle();newparticleITS=kTRUE;}\r
- if (!particleMotherITS) {particleMotherITS=new TParticle();newparticleMotherITS=kTRUE;}\r
- }\r
- /////////////////////////\r
-\r
- //Double_t vtxX=vtxESD->GetX();\r
- //Double_t vtxY=vtxESD->GetY();\r
- //Double_t vtxZ=vtxESD->GetZ();\r
-\r
- AliESDVertex* pvtxESD = (AliESDVertex*)vtxESD->Clone();\r
- AliESDtrack* ptrack=(AliESDtrack*)track->Clone();\r
- AliExternalTrackParam* ptpcInnerC = (AliExternalTrackParam*)tpcInnerC->Clone();\r
- AliExternalTrackParam* ptrackInnerC = (AliExternalTrackParam*)trackInnerC->Clone();\r
- AliExternalTrackParam* ptrackInnerC2 = (AliExternalTrackParam*)trackInnerC2->Clone();\r
- AliExternalTrackParam* pouterITSc = (AliExternalTrackParam*)outerITSc->Clone();\r
- AliExternalTrackParam* ptrackInnerC3 = (AliExternalTrackParam*)trackInnerC3->Clone();\r
- Int_t ntracks = esdEvent->GetNumberOfTracks();\r
- \r
- // fill histograms\r
- FillHistograms(ptrack, ptpcInnerC, centralityF, (Double_t)chi2(0,0));\r
-\r
- if(fTreeSRedirector && dumpToTree && fFillTree) \r
- {\r
-\r
- (*fTreeSRedirector)<<"highPt"<<\r
- "fileName.="<<&fileName<< // name of the chunk file (hopefully full)\r
- "runNumber="<<runNumber<< // runNumber\r
- "evtTimeStamp="<<evtTimeStamp<< // time stamp of event (in seconds)\r
- "evtNumberInFile="<<evtNumberInFile<< // event number\r
- "triggerClass="<<&triggerClass<< // trigger class as a string\r
- "Bz="<<bz<< // solenoid magnetic field in the z direction (in kGaus)\r
- "vtxESD.="<<pvtxESD<< // vertexer ESD tracks (can be biased by TPC pileup tracks)\r
- //"vtxESDx="<<vtxX<<\r
- //"vtxESDy="<<vtxY<<\r
- //"vtxESDz="<<vtxZ<<\r
- "IRtot="<<ir1<< // interaction record (trigger) counters - coutner 1\r
- "IRint2="<<ir2<< // interaction record (trigger) coutners - counter 2\r
- "mult="<<mult<< // multiplicity of tracks pointing to the primary vertex\r
- "ntracks="<<ntracks<< // number of the esd tracks (to take into account the pileup in the TPC)\r
- // important variables for the pile-up studies\r
- "contTPC="<< contTPC<< // number of contributors to the TPC primary vertex candidate\r
- "contSPD="<< contSPD<< // number of contributors to the SPD primary vertex candidate\r
- "vertexPosTPC.="<<&vertexPosTPC<< // TPC vertex position\r
- "vertexPosSPD.="<<&vertexPosSPD<< // SPD vertex position\r
- "ntracksTPC="<<ntracksTPC<< // total number of the TPC tracks which were refitted\r
- "ntracksITS="<<ntracksITS<< // total number of the ITS tracks which were refitted\r
- //\r
- "esdTrack.="<<ptrack<< // esdTrack as used in the physical analysis\r
- "extTPCInnerC.="<<ptpcInnerC<< // ??? \r
- "extInnerParamC.="<<ptrackInnerC<< // ???\r
- "extInnerParam.="<<ptrackInnerC2<< // ???\r
- "extOuterITS.="<<pouterITSc<< // ???\r
- "extInnerParamRef.="<<ptrackInnerC3<< // ???\r
- "chi2TPCInnerC="<<chi2(0,0)<< // chi2 of tracks ???\r
- "chi2InnerC="<<chi2trackC(0,0)<< // chi2s of tracks TPCinner to the combined\r
- "chi2OuterITS="<<chi2OuterITS(0,0)<< // chi2s of tracks TPC at inner wall to the ITSout\r
- "centralityF="<<centralityF;\r
- if (mcEvent)\r
- {\r
- AliTrackReference refDummy;\r
- if (!refITS) refITS = &refDummy;\r
- if (!refTRD) refTRD = &refDummy;\r
- if (!refTOF) refTOF = &refDummy;\r
- if (!refEMCAL) refEMCAL = &refDummy;\r
- if (!refPHOS) refPHOS = &refDummy;\r
- (*fTreeSRedirector)<<"highPt"<< \r
- "multMCTrueTracks="<<multMCTrueTracks<< // mC track multiplicities\r
- "nrefITS="<<nrefITS<< // number of track references in the ITS\r
- "nrefTPC="<<nrefTPC<< // number of track references in the TPC\r
- "nrefTRD="<<nrefTRD<< // number of track references in the TRD\r
- "nrefTOF="<<nrefTOF<< // number of track references in the TOF\r
- "nrefEMCAL="<<nrefEMCAL<< // number of track references in the TOF\r
- "nrefPHOS="<<nrefPHOS<< // number of track references in the TOF\r
- "refTPCIn.="<<refTPCIn<<\r
- "refTPCOut.="<<refTPCOut<<\r
- "refITS.="<<refITS<< \r
- "refTRD.="<<refTRD<< \r
- "refTOF.="<<refTOF<< \r
- "refEMCAL.="<<refEMCAL<< \r
- "refPHOS.="<<refPHOS<< \r
- "particle.="<<particle<<\r
- "particleMother.="<<particleMother<<\r
- "mech="<<mech<<\r
- "isPrim="<<isPrim<<\r
- "isFromStrangess="<<isFromStrangess<<\r
- "isFromConversion="<<isFromConversion<<\r
- "isFromMaterial="<<isFromMaterial<<\r
- "particleTPC.="<<particleTPC<<\r
- "particleMotherTPC.="<<particleMotherTPC<<\r
- "mechTPC="<<mechTPC<<\r
- "isPrimTPC="<<isPrimTPC<<\r
- "isFromStrangessTPC="<<isFromStrangessTPC<<\r
- "isFromConversionTPC="<<isFromConversionTPC<<\r
- "isFromMaterialTPC="<<isFromMaterialTPC<<\r
- "particleITS.="<<particleITS<<\r
- "particleMotherITS.="<<particleMotherITS<<\r
- "mechITS="<<mechITS<<\r
- "isPrimITS="<<isPrimITS<<\r
- "isFromStrangessITS="<<isFromStrangessITS<<\r
- "isFromConversionITS="<<isFromConversionITS<<\r
- "isFromMaterialITS="<<isFromMaterialITS;\r
- }\r
- //finish writing the entry\r
- AliInfo("writing tree highPt");\r
- (*fTreeSRedirector)<<"highPt"<<"\n";\r
- }\r
-\r
- delete pvtxESD;\r
- delete ptrack;\r
- delete ptpcInnerC;\r
- delete ptrackInnerC;\r
- delete ptrackInnerC2;\r
- delete pouterITSc;\r
- delete ptrackInnerC3;\r
-\r
- ////////////////////\r
- //delete the dummy objects we might have created.\r
- if (newvtxESD) {delete vtxESD; vtxESD=NULL;}\r
- if (newtrack) {delete track; track=NULL;}\r
- if (newtpcInnerC) {delete tpcInnerC; tpcInnerC=NULL;}\r
- if (newtrackInnerC) {delete trackInnerC; trackInnerC=NULL;}\r
- if (newtrackInnerC2) {delete trackInnerC2; trackInnerC2=NULL;}\r
- if (newouterITSc) {delete outerITSc; outerITSc=NULL;}\r
- if (newtrackInnerC3) {delete trackInnerC3; trackInnerC3=NULL;}\r
- if (newrefTPCIn) {delete refTPCIn; refTPCIn=NULL;}\r
- if (newrefITS) {delete refITS; refITS=NULL;}\r
- if (newparticle) {delete particle; particle=NULL;}\r
- if (newparticleMother) {delete particleMother; particleMother=NULL;}\r
- if (newparticleTPC) {delete particleTPC; particleTPC=NULL;}\r
- if (newparticleMotherTPC) {delete particleMotherTPC; particleMotherTPC=NULL;}\r
- if (newparticleITS) {delete particleITS; particleITS=NULL;}\r
- if (newparticleMotherITS) {delete particleMotherITS; particleMotherITS=NULL;}\r
- ///////////////\r
-\r
- delete tpcInnerC;\r
- delete trackInnerC;\r
- delete trackInnerC2;\r
- delete outerITSc;\r
- delete trackInnerC3;\r
- }\r
- }\r
-\r
-}\r
-\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::ProcessMCEff(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)\r
-{\r
- //\r
- // Fill tree for efficiency studies MC only\r
- AliInfo("we start!");\r
-\r
- if(!esdEvent) {\r
- AliDebug(AliLog::kError, "esdEvent not available");\r
- return;\r
- }\r
-\r
- if(!mcEvent) {\r
- AliDebug(AliLog::kError, "mcEvent not available");\r
- return;\r
- }\r
-\r
- // get selection cuts\r
- AliFilteredTreeEventCuts *evtCuts = GetEventCuts(); \r
- AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
- AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
-\r
- if(!evtCuts || !accCuts || !esdTrackCuts) {\r
- AliDebug(AliLog::kError, "cuts not available");\r
- return;\r
- }\r
-\r
- // trigger selection\r
- Bool_t isEventTriggered = kTRUE;\r
- AliPhysicsSelection *physicsSelection = NULL;\r
- AliTriggerAnalysis* triggerAnalysis = NULL;\r
-\r
- // \r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
- if (!inputHandler)\r
- {\r
- Printf("ERROR: Could not receive input handler");\r
- return;\r
- }\r
-\r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
- // trigger\r
- if(evtCuts->IsTriggerRequired()) \r
- {\r
- // always MB\r
- isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;\r
-\r
- physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());\r
- if(!physicsSelection) return;\r
-\r
- if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {\r
- // set trigger (V0AND)\r
- triggerAnalysis = physicsSelection->GetTriggerAnalysis();\r
- if(!triggerAnalysis) return;\r
- isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
- }\r
- }\r
-\r
- // centrality determination\r
- Float_t centralityF = -1;\r
- AliCentrality *esdCentrality = esdEvent->GetCentrality();\r
- centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());\r
-\r
- // use MC information\r
- AliHeader* header = 0;\r
- AliGenEventHeader* genHeader = 0;\r
- AliStack* stack = 0;\r
- Int_t mcStackSize=0;\r
- TArrayF vtxMC(3);\r
-\r
- Int_t multMCTrueTracks = 0;\r
- //\r
- if(!mcEvent) {\r
- AliDebug(AliLog::kError, "mcEvent not available");\r
- return;\r
- }\r
- // get MC event header\r
- header = mcEvent->Header();\r
- if (!header) {\r
- AliDebug(AliLog::kError, "Header not available");\r
- return;\r
- }\r
- // MC particle stack\r
- stack = mcEvent->Stack();\r
- if (!stack) {\r
- AliDebug(AliLog::kError, "Stack not available");\r
- return;\r
- }\r
- mcStackSize=stack->GetNtrack();\r
-\r
- // get MC vertex\r
- genHeader = header->GenEventHeader();\r
- if (!genHeader) {\r
- AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
- return;\r
- }\r
- genHeader->PrimaryVertex(vtxMC);\r
-\r
- // multipliticy of all MC primary tracks\r
- // in Zv, pt and eta ranges)\r
- multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
-\r
-\r
- // get reconstructed vertex \r
- //const AliESDVertex* vtxESD = 0; \r
- AliESDVertex* vtxESD = 0; \r
- if(GetAnalysisMode() == kTPCAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();\r
- }\r
- else if(GetAnalysisMode() == kTPCITSAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();\r
- }\r
- else {\r
- return;\r
- }\r
-\r
- if(!vtxESD) return; \r
- //\r
- // Vertex info comparison and track multiplicity\r
- //\r
- AliESDVertex *vertexSPD = (AliESDVertex *)esdEvent->GetPrimaryVertexSPD();\r
- AliESDVertex *vertexTPC = (AliESDVertex *)esdEvent->GetPrimaryVertexTPC(); \r
- Int_t contSPD = vertexSPD->GetNContributors();\r
- Int_t contTPC = vertexTPC->GetNContributors(); \r
- TVectorD vertexPosTPC(3), vertexPosSPD(3);\r
- vertexSPD->GetXYZ(vertexPosSPD.GetMatrixArray());\r
- vertexTPC->GetXYZ(vertexPosTPC.GetMatrixArray());\r
- Int_t ntracksTPC=0;\r
- Int_t ntracksITS=0;\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++){\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack); \r
- if(!track) continue;\r
- if (track->IsOn(AliVTrack::kTPCrefit)) ntracksTPC++;\r
- if (track->IsOn(AliVTrack::kITSrefit)) ntracksITS++;\r
- }\r
-\r
- Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD); \r
- //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
- //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
-\r
- TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();\r
-\r
- // check event cuts\r
- if(isEventOK && isEventTriggered)\r
- {\r
- //if(!stack) return;\r
-\r
- //\r
- // MC info\r
- //\r
- TParticle *particle=NULL;\r
- TParticle *particleMother=NULL;\r
- Int_t mech=-1;\r
-\r
- // reco event info\r
- Double_t vert[3] = {0}; \r
- vert[0] = vtxESD->GetXv();\r
- vert[1] = vtxESD->GetYv();\r
- vert[2] = vtxESD->GetZv();\r
- Int_t mult = vtxESD->GetNContributors();\r
- Double_t bz = esdEvent->GetMagneticField();\r
- Double_t runNumber = esdEvent->GetRunNumber();\r
- Double_t evtTimeStamp = esdEvent->GetTimeStamp();\r
- Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();\r
- // loop over MC stack\r
- for (Int_t iMc = 0; iMc < mcStackSize; ++iMc) \r
- {\r
- particle = stack->Particle(iMc);\r
- if (!particle)\r
- continue;\r
-\r
- // only charged particles\r
- if(!particle->GetPDG()) continue;\r
- Double_t charge = particle->GetPDG()->Charge()/3.;\r
- if (TMath::Abs(charge) < 0.001)\r
- continue;\r
-\r
- // only primary particles\r
- Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
- if(!prim) continue;\r
-\r
- // downscale low-pT particles\r
- Double_t scalempt= TMath::Min(particle->Pt(),10.);\r
- Double_t downscaleF = gRandom->Rndm();\r
- downscaleF *= fLowPtTrackDownscaligF;\r
- if(TMath::Exp(2*scalempt)<downscaleF) continue;\r
-\r
- // is particle in acceptance\r
- if(!accCuts->AcceptTrack(particle)) continue;\r
-\r
- // check if particle reconstructed\r
- Bool_t isRec = kFALSE;\r
- Int_t trackIndex = -1; \r
- Int_t trackLoopIndex = -1; \r
- Int_t isESDtrackCut= 0;\r
- Int_t isAccCuts = 0;\r
- Int_t nRec = 0; // how many times reconstructed \r
- Int_t nFakes = 0; // how many times reconstructed as a fake track\r
- AliESDtrack *recTrack = NULL; \r
-\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)\r
- {\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack);\r
- if(!track) continue;\r
- if(track->Charge()==0) continue;\r
- //\r
- Int_t label = TMath::Abs(track->GetLabel());\r
- if (label >= mcStackSize) continue;\r
- if(label == iMc) { \r
- Bool_t isAcc=esdTrackCuts->AcceptTrack(track);\r
- if (isAcc) isESDtrackCut=1;\r
- if (accCuts->AcceptTrack(track)) isAccCuts=1;\r
- isRec = kTRUE;\r
- trackIndex = iTrack;\r
-\r
- if (recTrack){\r
- if (track->GetTPCncls()<recTrack->GetTPCncls()) continue; // in case looper tracks use longer track\r
- if (!isAcc) continue;\r
- trackLoopIndex = iTrack;\r
- }\r
- recTrack = esdEvent->GetTrack(trackIndex); \r
- nRec++;\r
- if(track->GetLabel()<0) nFakes++;\r
-\r
- continue;\r
- } \r
- }\r
- \r
- // Store information in the output tree\r
- if (trackLoopIndex>-1) { \r
- recTrack = esdEvent->GetTrack(trackLoopIndex); \r
- } else if (trackIndex >-1) {\r
- recTrack = esdEvent->GetTrack(trackIndex); \r
- } else {\r
- recTrack = new AliESDtrack(); \r
- } \r
-\r
- particleMother = GetMother(particle,stack);\r
- mech = particle->GetUniqueID();\r
-\r
- //MC particle track length\r
- Double_t tpcTrackLength = 0.;\r
- AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(iMc);\r
- if(mcParticle) {\r
- Int_t counter;\r
- tpcTrackLength = mcParticle->GetTPCTrackLength(bz,0.05,counter,3.0);\r
- } \r
-\r
-\r
- //\r
- if(fTreeSRedirector && fFillTree) {\r
- (*fTreeSRedirector)<<"MCEffTree"<<\r
- "fileName.="<<&fileName<<\r
- "triggerClass.="<<&triggerClass<<\r
- "runNumber="<<runNumber<<\r
- "evtTimeStamp="<<evtTimeStamp<<\r
- "evtNumberInFile="<<evtNumberInFile<< // \r
- "Bz="<<bz<< // magnetic field\r
- "vtxESD.="<<vtxESD<< // vertex info\r
- //\r
- "mult="<<mult<< // primary vertex 9whatewe found) multiplicity\r
- "multMCTrueTracks="<<multMCTrueTracks<< // mC track multiplicities\r
- // important variables for the pile-up studies\r
- "contTPC="<< contTPC<< // number of contributors to the TPC primary vertex candidate\r
- "contSPD="<< contSPD<< // number of contributors to the SPD primary vertex candidate\r
- "vertexPosTPC.="<<&vertexPosTPC<< // TPC vertex position\r
- "vertexPosSPD.="<<&vertexPosSPD<< // SPD vertex position\r
- "ntracksTPC="<<ntracksTPC<< // total number of the TPC tracks which were refitted\r
- "ntracksITS="<<ntracksITS<< // total number of the ITS tracks which were refitted\r
- //\r
- //\r
- "isAcc0="<<isESDtrackCut<< // track accepted by ESD track cuts\r
- "isAcc1="<<isAccCuts<< // track accepted by acceptance cuts flag\r
- "esdTrack.="<<recTrack<< // reconstructed track (only the longest from the loopers)\r
- "isRec="<<isRec<< // track was reconstructed\r
- "tpcTrackLength="<<tpcTrackLength<< // track length in the TPC r projection\r
- "particle.="<<particle<< // particle properties\r
- "particleMother.="<<particleMother<< // particle mother\r
- "mech="<<mech<< // production mechanizm\r
- "nRec="<<nRec<< // how many times reconstruted\r
- "nFakes="<<nFakes<< // how many times reconstructed as a fake track\r
- "\n";\r
- }\r
-\r
- if(trackIndex <0 && recTrack) delete recTrack; recTrack=0;\r
- }\r
- }\r
-\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::IsHighDeDxParticle(AliESDtrack * track) {\r
- //\r
- // check if particle is Z > 1 \r
- //\r
- if (track->GetTPCNcls() < 60) return kFALSE;\r
- Double_t mom = track->GetInnerParam()->GetP();\r
- if (mom < 0.2) return kFALSE; // protection against unexpected behavior of Aleph parameterization\r
- Float_t dca[2], bCov[3];\r
- track->GetImpactParameters(dca,bCov);\r
- //\r
-\r
- Double_t triggerDeDx = 4*AliExternalTrackParam::BetheBlochAleph((mom*2)/(0.938*3),1.0288,31.9806,5.04114e-11,2.13096,2.38541);\r
-\r
- if (track->GetTPCsignal() > triggerDeDx && track->GetTPCsignal()<1000 && TMath::Abs(dca[0])<3.) return kTRUE;\r
-\r
- return kFALSE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::ProcessV0(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)\r
-{\r
- //\r
- // Select real events with V0 (K0s and Lambda and Gamma) high-pT candidates\r
- //\r
- if(!esdEvent) {\r
- AliDebug(AliLog::kError, "esdEvent not available");\r
- return;\r
- }\r
-\r
- // get selection cuts\r
- AliFilteredTreeEventCuts *evtCuts = GetEventCuts(); \r
- AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
- AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
-\r
- if(!evtCuts || !accCuts || !esdTrackCuts) {\r
- AliDebug(AliLog::kError, "cuts not available");\r
- return;\r
- }\r
-\r
- // trigger selection\r
- Bool_t isEventTriggered = kTRUE;\r
- AliPhysicsSelection *physicsSelection = NULL;\r
- AliTriggerAnalysis* triggerAnalysis = NULL;\r
-\r
- // \r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
- if (!inputHandler)\r
- {\r
- Printf("ERROR: Could not receive input handler");\r
- return;\r
- }\r
- \r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
- // trigger\r
- if(evtCuts->IsTriggerRequired()) \r
- {\r
- // always MB\r
- isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;\r
-\r
- physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());\r
- if(!physicsSelection) return;\r
- //SetPhysicsTriggerSelection(physicsSelection);\r
-\r
- if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {\r
- // set trigger (V0AND)\r
- triggerAnalysis = physicsSelection->GetTriggerAnalysis();\r
- if(!triggerAnalysis) return;\r
- isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
- }\r
- }\r
-\r
- // centrality determination\r
- Float_t centralityF = -1;\r
- AliCentrality *esdCentrality = esdEvent->GetCentrality();\r
- centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());\r
-\r
-\r
- // get reconstructed vertex \r
- //const AliESDVertex* vtxESD = 0; \r
- AliESDVertex* vtxESD = 0; \r
- if(GetAnalysisMode() == kTPCAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();\r
- }\r
- else if(GetAnalysisMode() == kTPCITSAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();\r
- }\r
- else {\r
- return;\r
- }\r
-\r
- if(!vtxESD) return;\r
-\r
- Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD); \r
- //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
- //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
-\r
- // check event cuts\r
- if(isEventOK && isEventTriggered) {\r
- //\r
- // Dump the pt downscaled V0 into the tree\r
- // \r
- Int_t ntracks = esdEvent->GetNumberOfTracks();\r
- Int_t nV0s = esdEvent->GetNumberOfV0s();\r
- Int_t run = esdEvent->GetRunNumber();\r
- Int_t time= esdEvent->GetTimeStamp();\r
- Int_t evNr=esdEvent->GetEventNumberInFile();\r
- Double_t bz = esdEvent->GetMagneticField();\r
-\r
-\r
- for (Int_t iv0=0; iv0<nV0s; iv0++){\r
- AliESDv0 * v0 = esdEvent->GetV0(iv0);\r
- if (!v0) continue;\r
- AliESDtrack * track0 = esdEvent->GetTrack(v0->GetIndex(0));\r
- AliESDtrack * track1 = esdEvent->GetTrack(v0->GetIndex(1));\r
- if (!track0) continue;\r
- if (!track1) continue;\r
- if (track0->GetSign()<0) {\r
- track1 = esdEvent->GetTrack(v0->GetIndex(0));\r
- track0 = esdEvent->GetTrack(v0->GetIndex(1));\r
- }\r
- //\r
- Bool_t isDownscaled = IsV0Downscaled(v0);\r
- if (isDownscaled) continue;\r
- AliKFParticle kfparticle; //\r
- Int_t type=GetKFParticle(v0,esdEvent,kfparticle);\r
- if (type==0) continue; \r
- TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();\r
-\r
- if(!fFillTree) return;\r
- if(!fTreeSRedirector) return;\r
- (*fTreeSRedirector)<<"V0s"<<\r
- "isDownscaled="<<isDownscaled<<\r
- "triggerClass="<<&triggerClass<< // trigger\r
- "Bz="<<bz<<\r
- "fileName.="<<&fileName<<\r
- "runNumber="<<run<<\r
- "evtTimeStamp="<<time<<\r
- "evtNumberInFile="<<evNr<<\r
- "type="<<type<<\r
- "ntracks="<<ntracks<<\r
- "v0.="<<v0<<\r
- "kf.="<<&kfparticle<<\r
- "track0.="<<track0<<\r
- "track1.="<<track1<<\r
- "centralityF="<<centralityF<<\r
- "\n";\r
- }\r
- }\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::ProcessdEdx(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)\r
-{\r
- //\r
- // Select real events with large TPC dEdx signal\r
- //\r
- if(!esdEvent) {\r
- AliDebug(AliLog::kError, "esdEvent not available");\r
- return;\r
- }\r
-\r
- // get selection cuts\r
- AliFilteredTreeEventCuts *evtCuts = GetEventCuts(); \r
- AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
- AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
-\r
- if(!evtCuts || !accCuts || !esdTrackCuts) {\r
- AliDebug(AliLog::kError, "cuts not available");\r
- return;\r
- }\r
-\r
- // get file name\r
- TTree *chain = (TChain*)GetInputData(0);\r
- if(!chain) { \r
- Printf("ERROR: Could not receive input chain");\r
- return;\r
- }\r
- TObjString fileName(chain->GetCurrentFile()->GetName());\r
-\r
- // trigger\r
- Bool_t isEventTriggered = kTRUE;\r
- AliPhysicsSelection *physicsSelection = NULL;\r
- AliTriggerAnalysis* triggerAnalysis = NULL;\r
-\r
- // \r
- AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
- if (!inputHandler)\r
- {\r
- Printf("ERROR: Could not receive input handler");\r
- return;\r
- }\r
-\r
- if(evtCuts->IsTriggerRequired()) \r
- {\r
- // always MB\r
- isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;\r
-\r
- physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());\r
- if(!physicsSelection) return;\r
-\r
- if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {\r
- // set trigger (V0AND)\r
- triggerAnalysis = physicsSelection->GetTriggerAnalysis();\r
- if(!triggerAnalysis) return;\r
- isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
- }\r
- }\r
-\r
- // get reconstructed vertex \r
- AliESDVertex* vtxESD = 0; \r
- if(GetAnalysisMode() == kTPCAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();\r
- }\r
- else if(GetAnalysisMode() == kTPCITSAnalysisMode) {\r
- vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();\r
- }\r
- else {\r
- return;\r
- }\r
- if(!vtxESD) return;\r
-\r
- Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD); \r
- //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
- //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
-\r
-\r
- // check event cuts\r
- if(isEventOK && isEventTriggered)\r
- {\r
- Double_t vert[3] = {0}; \r
- vert[0] = vtxESD->GetXv();\r
- vert[1] = vtxESD->GetYv();\r
- vert[2] = vtxESD->GetZv();\r
- Int_t mult = vtxESD->GetNContributors();\r
- Double_t bz = esdEvent->GetMagneticField();\r
- Double_t runNumber = esdEvent->GetRunNumber();\r
- Double_t evtTimeStamp = esdEvent->GetTimeStamp();\r
- Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();\r
-\r
- // large dEdx\r
- for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)\r
- {\r
- AliESDtrack *track = esdEvent->GetTrack(iTrack);\r
- if(!track) continue;\r
- if(track->Charge()==0) continue;\r
- if(!esdTrackCuts->AcceptTrack(track)) continue;\r
- if(!accCuts->AcceptTrack(track)) continue;\r
-\r
- if(!IsHighDeDxParticle(track)) continue;\r
- TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();\r
-\r
- if(!fFillTree) return;\r
- if(!fTreeSRedirector) return;\r
- (*fTreeSRedirector)<<"dEdx"<<\r
- "fileName.="<<&fileName<<\r
- "runNumber="<<runNumber<<\r
- "evtTimeStamp="<<evtTimeStamp<<\r
- "evtNumberInFile="<<evtNumberInFile<<\r
- "triggerClass="<<&triggerClass<< // trigger\r
- "Bz="<<bz<<\r
- "vtxESD.="<<vtxESD<<\r
- "mult="<<mult<<\r
- "esdTrack.="<<track<<\r
- "\n";\r
- }\r
- }\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Int_t AliAnalysisTaskFilteredTree::GetKFParticle(AliESDv0 *const v0, AliESDEvent * const event, AliKFParticle & kfparticle)\r
-{\r
- //\r
- // Create KF particle in case the V0 fullfill selection criteria\r
- //\r
- // Selection criteria\r
- // 0. algorithm cut\r
- // 1. track cut\r
- // 3. chi2 cut\r
- // 4. rough mass cut\r
- // 5. Normalized pointing angle cut\r
- //\r
- const Double_t cutMass=0.2;\r
- const Double_t kSigmaDCACut=3;\r
- //\r
- // 0.) algo cut - accept only on the fly\r
- //\r
- if (v0->GetOnFlyStatus() ==kFALSE) return 0; \r
- //\r
- // 1.) track cut\r
- // \r
- AliESDtrack * track0 = event->GetTrack(v0->GetIndex(0));\r
- AliESDtrack * track1 = event->GetTrack(v0->GetIndex(1));\r
- /*\r
- TCut cutD="abs(track0.fD/sqrt(track0.fCdd))>2&&abs(track1.fD/sqrt(track1.fCdd))>2";\r
- TCut cutTheta="abs(track0.fP[3])<1&&abs(track1.fP[3])<1";\r
- TCut cutNcl="track0.GetTPCClusterInfo(2,1)>100&&track1.GetTPCClusterInfo(2,1)>100";\r
- */ \r
- if (TMath::Abs(track0->GetTgl())>1) return 0;\r
- if (TMath::Abs(track1->GetTgl())>1) return 0;\r
- if ((track0->GetTPCClusterInfo(2,1))<100) return 0;\r
- if ((track1->GetTPCClusterInfo(2,1))<100) return 0;\r
- //if ((track0->GetITSclusters(0))<2) return 0;\r
- //if ((track1->GetITSclusters(0))<2) return 0; \r
- Float_t pos0[2]={0}, cov0[3]={0};\r
- Float_t pos1[2]={0}, cov1[3]={0};\r
- track0->GetImpactParameters(pos0,cov0);\r
- track0->GetImpactParameters(pos1,cov1);\r
- //\r
- if (TMath::Abs(pos0[0])<kSigmaDCACut*TMath::Sqrt(cov0[0])) return 0;\r
- if (TMath::Abs(pos1[0])<kSigmaDCACut*TMath::Sqrt(cov1[0])) return 0;\r
- // \r
- //\r
- // 3.) Chi2 cut\r
- //\r
- Double_t chi2KF = v0->GetKFInfo(2,2,2);\r
- if (chi2KF>25) return 0;\r
- //\r
- // 4.) Rough mass cut - 0.200 GeV\r
- //\r
- static Double_t masses[2]={-1};\r
- if (masses[0]<0){\r
- masses[0] = TDatabasePDG::Instance()->GetParticle("K_S0")->Mass();\r
- masses[1] = TDatabasePDG::Instance()->GetParticle("Lambda0")->Mass();\r
- }\r
- Double_t mass00= v0->GetEffMass(0,0);\r
- Double_t mass22= v0->GetEffMass(2,2);\r
- Double_t mass42= v0->GetEffMass(4,2);\r
- Double_t mass24= v0->GetEffMass(2,4);\r
- Bool_t massOK=kFALSE;\r
- Int_t type=0;\r
- Int_t ptype=0;\r
- Double_t dmass=1;\r
- Int_t p1=0, p2=0;\r
- if (TMath::Abs(mass00-0)<cutMass) {\r
- massOK=kTRUE; type+=1; \r
- if (TMath::Abs(mass00-0)<dmass) {\r
- ptype=1;\r
- dmass=TMath::Abs(mass00-0); \r
- p1=0; p2=0;\r
- } \r
- }\r
- if (TMath::Abs(mass24-masses[1])<cutMass) {\r
- massOK=kTRUE; type+=2; \r
- if (TMath::Abs(mass24-masses[1])<dmass){\r
- dmass = TMath::Abs(mass24-masses[1]);\r
- ptype=2;\r
- p1=2; p2=4;\r
- }\r
- }\r
- if (TMath::Abs(mass42-masses[1])<cutMass) {\r
- massOK=kTRUE; type+=4;\r
- if (TMath::Abs(mass42-masses[1])<dmass){\r
- dmass = TMath::Abs(mass42-masses[1]);\r
- ptype=4;\r
- p1=4; p2=2;\r
- }\r
- }\r
- if (TMath::Abs(mass22-masses[0])<cutMass) {\r
- massOK=kTRUE; type+=8;\r
- if (TMath::Abs(mass22-masses[0])<dmass){\r
- dmass = TMath::Abs(mass22-masses[0]);\r
- ptype=8;\r
- p1=2; p2=2;\r
- }\r
- }\r
- if (type==0) return 0;\r
- //\r
- const Int_t spdg[5]={kPositron,kMuonPlus,kPiPlus, kKPlus, kProton};\r
- const AliExternalTrackParam *paramP = v0->GetParamP();\r
- const AliExternalTrackParam *paramN = v0->GetParamN();\r
- if (paramP->GetSign()<0){\r
- paramP=v0->GetParamP();\r
- paramN=v0->GetParamN();\r
- }\r
- //Double_t *pparam1 = (Double_t*)paramP->GetParameter();\r
- //Double_t *pparam2 = (Double_t*)paramN->GetParameter();\r
- //\r
- AliKFParticle kfp1( *paramP, spdg[p1] );\r
- AliKFParticle kfp2( *paramN, -1 *spdg[p2] );\r
- AliKFParticle V0KF;\r
- (V0KF)+=kfp1;\r
- (V0KF)+=kfp2;\r
- kfparticle=V0KF;\r
- //\r
- // Pointing angle\r
- //\r
- Double_t errPhi = V0KF.GetErrPhi();\r
- Double_t pointAngle= TMath::ACos(v0->GetV0CosineOfPointingAngle());\r
- if (pointAngle/errPhi>10) return 0; \r
- //\r
- return ptype; \r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::IsV0Downscaled(AliESDv0 *const v0)\r
-{\r
- //\r
- // Downscale randomly low pt V0\r
- //\r
- //return kFALSE;\r
- Double_t maxPt= TMath::Max(v0->GetParamP()->Pt(), v0->GetParamN()->Pt());\r
- Double_t scalempt= TMath::Min(maxPt,10.);\r
- Double_t downscaleF = gRandom->Rndm();\r
- downscaleF *= fLowPtV0DownscaligF;\r
- //\r
- // Special treatment of the gamma conversion pt spectra is softer - \r
- Double_t mass00= v0->GetEffMass(0,0);\r
- const Double_t cutMass=0.2;\r
- if (TMath::Abs(mass00-0)<cutMass){\r
- downscaleF/=10.; // 10 times smaller downscaling for the gamma concersion candidate\r
- }\r
- //printf("V0 TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);\r
- if (TMath::Exp(2*scalempt)<downscaleF) return kTRUE;\r
- return kFALSE;\r
-\r
- /*\r
- TH1F his1("his1","his1",100,0,10);\r
- TH1F his2("his2","his2",100,0,10);\r
- {for (Int_t i=0; i<10000; i++){\r
- Double_t rnd=gRandom->Exp(1);\r
- Bool_t isDownscaled =TMath::Exp(rnd)<100*gRandom->Rndm();\r
- his1->Fill(rnd); \r
- if (!isDownscaled) his2->Fill(rnd); \r
- }}\r
-\r
- */\r
-\r
-}\r
-\r
-\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::ConstrainTPCInner(AliExternalTrackParam *const tpcInnerC, const AliESDVertex* vtx, Double_t b[3])\r
-{\r
- // Constrain TPC inner params constrained\r
- //\r
- if(!tpcInnerC) return kFALSE; \r
- if(!vtx) return kFALSE;\r
-\r
- Double_t dz[2],cov[3];\r
- //AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();\r
- //if(!tpcInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov)) return kFALSE; \r
- //if(!tpcInnerC->PropagateToDCA(vtx, Bz, 3, dz, cov)) return kFALSE; \r
- if(!tpcInnerC->PropagateToDCABxByBz(vtx, b, 3, dz, cov)) return kFALSE; \r
-\r
-\r
- Double_t covar[6]; vtx->GetCovMatrix(covar);\r
- Double_t p[2]={tpcInnerC->GetParameter()[0]-dz[0],tpcInnerC->GetParameter()[1]-dz[1]};\r
- Double_t c[3]={covar[2],0.,covar[5]};\r
- Double_t chi2C=tpcInnerC->GetPredictedChi2(p,c);\r
- if (chi2C>kVeryBig) return kFALSE; \r
-\r
- if(!tpcInnerC->Update(p,c)) return kFALSE;\r
-\r
- return kTRUE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::ConstrainTrackInner(AliExternalTrackParam *const trackInnerC, const AliESDVertex* vtx, Double_t mass, Double_t b[3])\r
-{\r
- // Constrain TPC inner params constrained\r
- //\r
- if(!trackInnerC) return kFALSE; \r
- if(!vtx) return kFALSE;\r
-\r
- const Double_t kRadius = 2.8; \r
- const Double_t kMaxStep = 1.0; \r
-\r
- Double_t dz[2],cov[3];\r
-\r
- //AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();\r
- //if(!trackInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov)) return kFALSE; \r
- //if(!trackInnerC->PropagateToDCA(vtx, Bz, 3, dz, cov)) return kFALSE; \r
-\r
- if(!AliTracker::PropagateTrackToBxByBz(trackInnerC,kRadius,mass,kMaxStep,kFALSE)) return kFALSE;\r
- if(!trackInnerC->PropagateToDCABxByBz(vtx, b, 3, dz, cov)) return kFALSE; \r
-\r
- //\r
- Double_t covar[6]; vtx->GetCovMatrix(covar);\r
- Double_t p[2]={trackInnerC->GetParameter()[0]-dz[0],trackInnerC->GetParameter()[1]-dz[1]};\r
- Double_t c[3]={covar[2],0.,covar[5]};\r
- Double_t chi2C=trackInnerC->GetPredictedChi2(p,c);\r
- if (chi2C>kVeryBig) return kFALSE; \r
-\r
- if(!trackInnerC->Update(p,c)) return kFALSE;\r
-\r
- return kTRUE;\r
-}\r
-\r
-\r
-//_____________________________________________________________________________\r
-TParticle *AliAnalysisTaskFilteredTree::GetMother(TParticle *const particle, AliStack *const stack) \r
-{\r
- if(!particle) return NULL;\r
- if(!stack) return NULL;\r
-\r
- Int_t motherLabel = TMath::Abs(particle->GetMother(0)); \r
- TParticle* mother = NULL; \r
- Int_t mcStackSize=stack->GetNtrack();\r
- if (motherLabel>=mcStackSize) return NULL;\r
- mother = stack->Particle(motherLabel); \r
-\r
-return mother;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::IsFromConversion(const Int_t label, AliStack *const stack) \r
-{\r
- Bool_t isFromConversion = kFALSE;\r
-\r
- if(stack) {\r
- Int_t mcStackSize=stack->GetNtrack();\r
- if (label>=mcStackSize) return kFALSE;\r
- TParticle* particle = stack->Particle(label);\r
- if (!particle) return kFALSE;\r
-\r
- if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0) \r
- {\r
- Int_t mech = particle->GetUniqueID(); // production mechanism \r
- Bool_t isPrim = stack->IsPhysicalPrimary(label);\r
-\r
- Int_t motherLabel = TMath::Abs(particle->GetMother(0)); \r
- if (motherLabel>=mcStackSize) return kFALSE;\r
- TParticle* mother = stack->Particle(motherLabel); \r
- if(mother) {\r
- Int_t motherPdg = mother->GetPdgCode();\r
-\r
- if(!isPrim && mech==5 && motherPdg==kGamma) { \r
- isFromConversion=kTRUE; \r
- }\r
- }\r
- } \r
- } \r
-\r
- return isFromConversion;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::IsFromMaterial(const Int_t label, AliStack *const stack) \r
-{\r
- Bool_t isFromMaterial = kFALSE;\r
-\r
- if(stack) {\r
- Int_t mcStackSize=stack->GetNtrack();\r
- if (label>=mcStackSize) return kFALSE;\r
- TParticle* particle = stack->Particle(label);\r
- if (!particle) return kFALSE;\r
-\r
- if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0) \r
- {\r
- Int_t mech = particle->GetUniqueID(); // production mechanism \r
- Bool_t isPrim = stack->IsPhysicalPrimary(label);\r
-\r
- Int_t motherLabel = TMath::Abs(particle->GetMother(0)); \r
- if (motherLabel>=mcStackSize) return kFALSE;\r
- TParticle* mother = stack->Particle(motherLabel); \r
- if(mother) {\r
- if(!isPrim && mech==13) { \r
- isFromMaterial=kTRUE; \r
- }\r
- }\r
- } \r
- } \r
-\r
- return isFromMaterial;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliAnalysisTaskFilteredTree::IsFromStrangeness(const Int_t label, AliStack *const stack) \r
-{\r
- Bool_t isFromStrangeness = kFALSE;\r
-\r
- if(stack) {\r
- Int_t mcStackSize=stack->GetNtrack();\r
- if (label>=mcStackSize) return kFALSE;\r
- TParticle* particle = stack->Particle(label);\r
- if (!particle) return kFALSE;\r
-\r
- if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0) \r
- {\r
- Int_t mech = particle->GetUniqueID(); // production mechanism \r
- Bool_t isPrim = stack->IsPhysicalPrimary(label);\r
-\r
- Int_t motherLabel = TMath::Abs(particle->GetMother(0)); \r
- if (motherLabel>=mcStackSize) return kFALSE;\r
- TParticle* mother = stack->Particle(motherLabel); \r
- if(mother) {\r
- Int_t motherPdg = mother->GetPdgCode();\r
-\r
- // K+-, lambda, antilambda, K0s decays\r
- if(!isPrim && mech==4 && \r
- (TMath::Abs(motherPdg)==kKPlus || TMath::Abs(motherPdg)==kLambda0 || motherPdg==kK0Short))\r
- {\r
- isFromStrangeness = kTRUE;\r
- } \r
- }\r
- } \r
- } \r
-\r
- return isFromStrangeness;\r
-}\r
-\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::FinishTaskOutput() \r
-{\r
- //\r
- // Called one at the end \r
- // locally on working node\r
- //\r
-\r
- //// must be deleted to store trees\r
- //if(fTreeSRedirector) delete fTreeSRedirector; fTreeSRedirector=0;\r
-\r
- //// open temporary file and copy trees to the ouptut container\r
-\r
- //TChain* chain = 0;\r
- ////\r
- //chain = new TChain("highPt");\r
- //if(chain) { \r
- // chain->Add("jotwinow_Temp_Trees.root");\r
- // fHighPtTree = chain->CopyTree("1");\r
- // delete chain; chain=0; \r
- //}\r
- //if(fHighPtTree) fHighPtTree->Print();\r
-\r
- ////\r
- //chain = new TChain("V0s");\r
- //if(chain) { \r
- // chain->Add("jotwinow_Temp_Trees.root");\r
- // fV0Tree = chain->CopyTree("1");\r
- // delete chain; chain=0; \r
- //}\r
- //if(fV0Tree) fV0Tree->Print();\r
-\r
- ////\r
- //chain = new TChain("dEdx");\r
- //if(chain) { \r
- // chain->Add("jotwinow_Temp_Trees.root");\r
- // fdEdxTree = chain->CopyTree("1");\r
- // delete chain; chain=0; \r
- //}\r
- //if(fdEdxTree) fdEdxTree->Print();\r
-\r
- ////\r
- //chain = new TChain("Laser");\r
- //if(chain) { \r
- // chain->Add("jotwinow_Temp_Trees.root");\r
- // fLaserTree = chain->CopyTree("1");\r
- // delete chain; chain=0; \r
- //}\r
- //if(fLaserTree) fLaserTree->Print();\r
-\r
- ////\r
- //chain = new TChain("MCEffTree");\r
- //if(chain) { \r
- // chain->Add("jotwinow_Temp_Trees.root");\r
- // fMCEffTree = chain->CopyTree("1");\r
- // delete chain; chain=0; \r
- //}\r
- //if(fMCEffTree) fMCEffTree->Print();\r
-\r
- ////\r
- //chain = new TChain("CosmicPairs");\r
- //if(chain) { \r
- // chain->Add("jotwinow_Temp_Trees.root");\r
- // fCosmicPairsTree = chain->CopyTree("1");\r
- // delete chain; chain=0; \r
- //}\r
- //if(fCosmicPairsTree) fCosmicPairsTree->Print(); \r
-\r
- Bool_t deleteTrees=kTRUE;\r
- if ((AliAnalysisManager::GetAnalysisManager()))\r
- {\r
- if (AliAnalysisManager::GetAnalysisManager()->GetAnalysisType() == \r
- AliAnalysisManager::kProofAnalysis)\r
- deleteTrees=kFALSE;\r
- }\r
- if (deleteTrees) delete fTreeSRedirector;\r
- fTreeSRedirector=NULL;\r
-\r
- //OpenFile(1);\r
-\r
- // Post output data.\r
- //PostData(1, fHighPtTree);\r
- //PostData(2, fV0Tree);\r
- //PostData(3, fdEdxTree);\r
- //PostData(4, fLaserTree);\r
- //PostData(5, fMCEffTree);\r
- //PostData(6, fCosmicPairsTree);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::Terminate(Option_t *) \r
-{\r
- // Called one at the end \r
- /*\r
- fOutputSummary = dynamic_cast<TTree*> (GetOutputData(1));\r
- if(fOutputSummary) delete fOutputSummary; fOutputSummary=0;\r
- TChain* chain = new TChain("highPt");\r
- if(!chain) return;\r
- chain->Add("jotwinow_HighPt_TrackAndV0_Trees.root");\r
- TTree *tree = chain->CopyTree("1");\r
- if (chain) { delete chain; chain=0; }\r
- if(!tree) return;\r
- tree->Print();\r
- fOutputSummary = tree;\r
-\r
- if (!fOutputSummary) {\r
- Printf("ERROR: AliAnalysisTaskFilteredTree::Terminate(): Output data not avaiable %p \n", GetOutputData(1));\r
- return;\r
- }\r
- */\r
- \r
-}\r
-\r
-//_____________________________________________________________________________\r
-Int_t AliAnalysisTaskFilteredTree::GetMCTrueTrackMult(AliMCEvent *const mcEvent, AliFilteredTreeEventCuts *const evtCuts, AliFilteredTreeAcceptanceCuts *const accCuts)\r
-{\r
- //\r
- // calculate mc event true track multiplicity\r
- //\r
- if(!mcEvent) return 0;\r
-\r
- AliStack* stack = 0;\r
- Int_t mult = 0;\r
-\r
- // MC particle stack\r
- stack = mcEvent->Stack();\r
- if (!stack) return 0;\r
-\r
- //\r
- //printf("minZv %f, maxZv %f \n", evtCuts->GetMinZv(), evtCuts->GetMaxZv());\r
- //\r
-\r
- Bool_t isEventOK = evtCuts->AcceptMCEvent(mcEvent);\r
- if(!isEventOK) return 0; \r
-\r
- Int_t nPart = stack->GetNtrack();\r
- for (Int_t iMc = 0; iMc < nPart; ++iMc) \r
- {\r
- TParticle* particle = stack->Particle(iMc);\r
- if (!particle)\r
- continue;\r
-\r
- // only charged particles\r
- if(!particle->GetPDG()) continue;\r
- Double_t charge = particle->GetPDG()->Charge()/3.;\r
- if (TMath::Abs(charge) < 0.001)\r
- continue;\r
- \r
- // physical primary\r
- Bool_t prim = stack->IsPhysicalPrimary(iMc);\r
- if(!prim) continue;\r
-\r
- // checked accepted without pt cut\r
- //if(accCuts->AcceptTrack(particle)) \r
- if( particle->Eta() > accCuts->GetMinEta() && particle->Eta() < accCuts->GetMaxEta() ) \r
- {\r
- mult++;\r
- }\r
- }\r
-\r
-return mult; \r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliAnalysisTaskFilteredTree::FillHistograms(AliESDtrack* const ptrack, AliExternalTrackParam* const ptpcInnerC, const Double_t centralityF, const Double_t chi2TPCInnerC) \r
-{\r
-//\r
-// Fill pT relative resolution histograms for \r
-// TPC only, TPC only constrained to vertex and TPC+ITS tracking\r
-//\r
- if(!ptrack) return; \r
- if(!ptpcInnerC) return; \r
-\r
- const AliExternalTrackParam * innerParam = (AliExternalTrackParam *) ptrack->GetInnerParam();\r
- if(!innerParam) return;\r
-\r
- Float_t dxy, dz;\r
- ptrack->GetImpactParameters(dxy,dz);\r
-\r
-// TPC+ITS primary tracks \r
-if( abs(ptrack->Eta())<0.8 && \r
- ptrack->GetTPCClusterInfo(3,1)>120 && \r
- ptrack->IsOn(0x40) && \r
- ptrack->GetTPCclusters(0)>0.0 && \r
- ptrack->GetTPCnclsS()/ptrack->GetTPCclusters(0)<0.4 && \r
- //abs(innerParam->GetX())>0.0 && \r
- //abs(innerParam->GetY()/innerParam->GetX())<0.14 && \r
- //abs(innerParam->GetTgl())<0.85 && \r
- ptrack->IsOn(0x0004) && \r
- ptrack->GetNcls(0)>0 &&\r
- ptrack->GetITSchi2()>0 && \r
- sqrt(ptrack->GetITSchi2()/ptrack->GetNcls(0))<6 &&\r
- sqrt(chi2TPCInnerC)<6 &&\r
- (ptrack->HasPointOnITSLayer(0) || ptrack->HasPointOnITSLayer(1)) &&\r
- abs(dz)<2.0 && \r
- abs(dxy)<(0.018+0.035*abs(ptrack->GetSigned1Pt())) )\r
- {\r
- fPtResPhiPtTPCITS->Fill(ptrack->Pt(),ptrack->Phi(),1./abs(ptrack->GetSigned1Pt())*TMath::Sqrt(ptrack->GetSigma1Pt2()));\r
- fPtResEtaPtTPCITS->Fill(ptrack->Pt(),ptrack->Eta(),1./abs(ptrack->GetSigned1Pt())*TMath::Sqrt(ptrack->GetSigma1Pt2()));\r
- fPtResCentPtTPCITS->Fill(ptrack->Pt(),centralityF,1./abs(ptrack->GetSigned1Pt())*TMath::Sqrt(ptrack->GetSigma1Pt2()));\r
- }\r
-\r
-// TPC primary tracks \r
-// and TPC constrained primary tracks \r
-\r
- AliExternalTrackParam *ptpcInner = (AliExternalTrackParam *) ptrack->GetTPCInnerParam(); \r
- if(!ptpcInner) return;\r
-\r
-\r
- Float_t dxyTPC, dzTPC;\r
- ptrack->GetImpactParametersTPC(dxyTPC,dzTPC);\r
-\r
-if( abs(ptrack->Eta())<0.8 && \r
- ptrack->GetTPCClusterInfo(3,1)>120 && \r
- ptrack->IsOn(0x40)&& \r
- ptrack->GetTPCclusters(0)>0.0 && \r
- ptrack->GetTPCnclsS()/ptrack->GetTPCclusters(0)<0.4 && \r
- //abs(innerParam->GetX())>0.0 && \r
- //abs(innerParam->GetY()/innerParam->GetX())<0.14 && \r
- //abs(innerParam->GetTgl())<0.85 && \r
- abs(dzTPC)<3.2 && \r
- abs(dxyTPC)<2.4 )\r
- {\r
- // TPC only\r
- fPtResPhiPtTPC->Fill(ptpcInner->Pt(),ptpcInner->Phi(),1./abs(ptpcInner->GetSigned1Pt())*TMath::Sqrt(ptpcInner->GetSigma1Pt2()));\r
- fPtResEtaPtTPC->Fill(ptpcInner->Pt(),ptpcInner->Eta(),1./abs(ptpcInner->GetSigned1Pt())*TMath::Sqrt(ptpcInner->GetSigma1Pt2()));\r
- fPtResCentPtTPC->Fill(ptpcInner->Pt(),centralityF,1./abs(ptpcInner->GetSigned1Pt())*TMath::Sqrt(ptpcInner->GetSigma1Pt2()));\r
-\r
- // TPC constrained to vertex \r
- fPtResPhiPtTPCc->Fill(ptpcInnerC->Pt(),ptpcInnerC->Phi(),1./abs(ptpcInnerC->GetSigned1Pt())*TMath::Sqrt(ptpcInnerC->GetSigma1Pt2()));\r
- fPtResEtaPtTPCc->Fill(ptpcInnerC->Pt(),ptpcInnerC->Eta(),1./abs(ptpcInnerC->GetSigned1Pt())*TMath::Sqrt(ptpcInnerC->GetSigma1Pt2()));\r
- fPtResCentPtTPCc->Fill(ptpcInnerC->Pt(),centralityF,1./abs(ptpcInnerC->GetSigned1Pt())*TMath::Sqrt(ptpcInnerC->GetSigma1Pt2()));\r
- }\r
-}\r
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+#include "iostream"
+#include "TSystem.h"
+
+#include <TPDGCode.h>
+#include <TDatabasePDG.h>
+
+#include "TChain.h"
+#include "TTreeStream.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TH3.h"
+#include "TCanvas.h"
+#include "TList.h"
+#include "TObjArray.h"
+#include "TFile.h"
+#include "TMatrixD.h"
+#include "TRandom3.h"
+
+#include "AliHeader.h"
+#include "AliGenEventHeader.h"
+#include "AliInputEventHandler.h"
+#include "AliStack.h"
+#include "AliTrackReference.h"
+
+#include "AliPhysicsSelection.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliESDfriend.h"
+#include "AliMCEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliESDVertex.h"
+#include "AliTracker.h"
+#include "AliVTrack.h"
+#include "AliGeomManager.h"
+
+#include "AliCentrality.h"
+#include "AliESDVZERO.h"
+#include "AliMultiplicity.h"
+
+#include "AliESDtrackCuts.h"
+#include "AliMCEventHandler.h"
+#include "AliFilteredTreeEventCuts.h"
+#include "AliFilteredTreeAcceptanceCuts.h"
+
+#include "AliAnalysisTaskFilteredTree.h"
+#include "AliKFParticle.h"
+#include "AliESDv0.h"
+#include "TVectorD.h"
+
+using namespace std;
+
+ClassImp(AliAnalysisTaskFilteredTree)
+
+//_____________________________________________________________________________
+AliAnalysisTaskFilteredTree::AliAnalysisTaskFilteredTree(const char *name)
+ : AliAnalysisTaskSE(name)
+ , fESD(0)
+ , fMC(0)
+ , fESDfriend(0)
+ , fOutput(0)
+ , fPitList(0)
+ , fUseMCInfo(kFALSE)
+ , fUseESDfriends(kFALSE)
+ , fReducePileUp(kTRUE)
+ , fFillTree(kTRUE)
+ , fFilteredTreeEventCuts(0)
+ , fFilteredTreeAcceptanceCuts(0)
+ , fFilteredTreeRecAcceptanceCuts(0)
+ , fEsdTrackCuts(0)
+ , fTrigger(AliTriggerAnalysis::kMB1)
+ , fAnalysisMode(kTPCAnalysisMode)
+ , fTreeSRedirector(0)
+ , fCentralityEstimator(0)
+ , fLowPtTrackDownscaligF(0)
+ , fLowPtV0DownscaligF(0)
+ , fProcessAll(kFALSE)
+ , fProcessCosmics(kFALSE)
+ , fHighPtTree(0)
+ , fV0Tree(0)
+ , fdEdxTree(0)
+ , fLaserTree(0)
+ , fMCEffTree(0)
+ , fCosmicPairsTree(0)
+ , fPtResPhiPtTPC(0)
+ , fPtResPhiPtTPCc(0)
+ , fPtResPhiPtTPCITS(0)
+ , fPtResEtaPtTPC(0)
+ , fPtResEtaPtTPCc(0)
+ , fPtResEtaPtTPCITS(0)
+ , fPtResCentPtTPC(0)
+ , fPtResCentPtTPCc(0)
+ , fPtResCentPtTPCITS(0)
+{
+ // Constructor
+
+ // Define input and output slots here
+ DefineOutput(1, TTree::Class());
+ DefineOutput(2, TTree::Class());
+ DefineOutput(3, TTree::Class());
+ DefineOutput(4, TTree::Class());
+ DefineOutput(5, TTree::Class());
+ DefineOutput(6, TTree::Class());
+ DefineOutput(7, TList::Class());
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskFilteredTree::~AliAnalysisTaskFilteredTree()
+{
+ //the output trees not to be deleted in case of proof analysis
+ //Bool_t deleteTrees=kTRUE;
+ //if ((AliAnalysisManager::GetAnalysisManager()))
+ //{
+ // if (AliAnalysisManager::GetAnalysisManager()->GetAnalysisType() ==
+ // AliAnalysisManager::kProofAnalysis)
+ // deleteTrees=kFALSE;
+ //}
+ //if (deleteTrees) delete fTreeSRedirector;
+
+ delete fFilteredTreeEventCuts;
+ delete fFilteredTreeAcceptanceCuts;
+ delete fFilteredTreeRecAcceptanceCuts;
+ delete fEsdTrackCuts;
+}
+
+//____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::Notify()
+{
+ static Int_t count = 0;
+ count++;
+ TTree *chain = (TChain*)GetInputData(0);
+ if(chain)
+ {
+ Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());
+ }
+
+return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::UserCreateOutputObjects()
+{
+ // Create histograms
+ // Called once
+
+ //
+ //get the output file to make sure the trees will be associated to it
+ OpenFile(1);
+ fTreeSRedirector = new TTreeSRedirector();
+
+ //
+ // Create trees
+ fV0Tree = ((*fTreeSRedirector)<<"V0s").GetTree();
+ fHighPtTree = ((*fTreeSRedirector)<<"highPt").GetTree();
+ fdEdxTree = ((*fTreeSRedirector)<<"dEdx").GetTree();
+ fLaserTree = ((*fTreeSRedirector)<<"Laser").GetTree();
+ fMCEffTree = ((*fTreeSRedirector)<<"MCEffTree").GetTree();
+ fCosmicPairsTree = ((*fTreeSRedirector)<<"CosmicPairs").GetTree();
+
+
+
+
+ // histogram booking
+
+ Double_t minPt = 0.1;
+ Double_t maxPt = 100.;
+ Int_t nbinsPt = 30;
+
+ Double_t logminPt = TMath::Log10(minPt);
+ Double_t logmaxPt = TMath::Log10(maxPt);
+ Double_t binwidth = (logmaxPt-logminPt)/nbinsPt;
+ Double_t *binsPt = new Double_t[nbinsPt+1];
+ binsPt[0] = minPt;
+ for (Int_t i=1;i<=nbinsPt;i++) {
+ binsPt[i] = minPt + TMath::Power(10,logminPt+i*binwidth);
+ }
+
+ // 1pT resol cov matrix bins
+ Double_t min1PtRes = 0.;
+ Double_t max1PtRes = 0.3;
+ Int_t nbins1PtRes = 300;
+ Double_t bins1PtRes[301];
+ for (Int_t i=0;i<=nbins1PtRes;i++) {
+ bins1PtRes[i] = min1PtRes + i*(max1PtRes-min1PtRes)/nbins1PtRes;
+ }
+
+ // phi bins
+ Double_t minPhi = 0.;
+ Double_t maxPhi = 6.5;
+ Int_t nbinsPhi = 100;
+ Double_t binsPhi[101];
+ for (Int_t i=0;i<=nbinsPhi;i++) {
+ binsPhi[i] = minPhi + i*(maxPhi-minPhi)/nbinsPhi;
+ }
+
+ // eta bins
+ Double_t minEta = -1.;
+ Double_t maxEta = 1.;
+ Int_t nbinsEta = 20;
+ Double_t binsEta[21];
+ for (Int_t i=0;i<=nbinsEta;i++) {
+ binsEta[i] = minEta + i*(maxEta-minEta)/nbinsEta;
+ }
+
+ // mult bins
+ Double_t minCent = 0.;
+ Double_t maxCent = 100;
+ Int_t nbinsCent = 20;
+ Double_t binsCent[101];
+ for (Int_t i=0;i<=nbinsCent;i++) {
+ binsCent[i] = minCent + i*(maxCent-minCent)/nbinsCent;
+ }
+
+ fPtResPhiPtTPC = new TH3D("fPtResPhiPtTPC","pt rel. resolution from cov. matrix TPC tracks",nbinsPt,binsPt,nbinsPhi,binsPhi,nbins1PtRes,bins1PtRes);
+ fPtResPhiPtTPCc = new TH3D("fPtResPhiPtTPCc","pt rel. resolution from cov. matrix TPC constrained tracks",nbinsPt,binsPt,nbinsPhi,binsPhi,nbins1PtRes,bins1PtRes);
+ fPtResPhiPtTPCITS = new TH3D("fPtResPhiPtTPCITS","pt rel. resolution from cov. matrix TPC+ITS tracks",nbinsPt,binsPt,nbinsPhi,binsPhi,nbins1PtRes,bins1PtRes);
+
+fPtResEtaPtTPC = new TH3D("fPtResEtaPtTPC","pt rel. resolution from cov. matrix TPC tracks",nbinsPt,binsPt,nbinsEta,binsEta,nbins1PtRes,bins1PtRes);
+ fPtResEtaPtTPCc = new TH3D("fPtResEtaPtTPCc","pt rel. resolution from cov. matrix TPC constrained tracks",nbinsPt,binsPt,nbinsEta,binsEta,nbins1PtRes,bins1PtRes);
+ fPtResEtaPtTPCITS = new TH3D("fPtResEtaPtTPCITS","pt rel. resolution from cov. matrix TPC+ITS tracks",nbinsPt,binsPt,nbinsEta,binsEta,nbins1PtRes,bins1PtRes);
+
+fPtResCentPtTPC = new TH3D("fPtResCentPtTPC","pt rel. resolution from cov. matrix TPC tracks",nbinsPt,binsPt,nbinsCent,binsCent,nbins1PtRes,bins1PtRes);
+ fPtResCentPtTPCc = new TH3D("fPtResCentPtTPCc","pt rel. resolution from cov. matrix TPC constrained tracks",nbinsPt,binsPt,nbinsCent,binsCent,nbins1PtRes,bins1PtRes);
+ fPtResCentPtTPCITS = new TH3D("fPtResCentPtTPCITS","pt rel. resolution from cov. matrix TPC+ITS tracks",nbinsPt,binsPt,nbinsCent,binsCent,nbins1PtRes,bins1PtRes);
+
+
+ fOutput = new TList;
+ if(!fOutput) return;
+ fOutput->SetOwner();
+
+ fOutput->Add(fPtResPhiPtTPC);
+ fOutput->Add(fPtResPhiPtTPCc);
+ fOutput->Add(fPtResPhiPtTPCITS);
+ fOutput->Add(fPtResEtaPtTPC);
+ fOutput->Add(fPtResEtaPtTPCc);
+ fOutput->Add(fPtResEtaPtTPCITS);
+ fOutput->Add(fPtResCentPtTPC);
+ fOutput->Add(fPtResCentPtTPCc);
+ fOutput->Add(fPtResCentPtTPCITS);
+
+ // post data to outputs
+
+ PostData(1,fV0Tree);
+ PostData(2,fHighPtTree);
+ PostData(3,fdEdxTree);
+ PostData(4,fLaserTree);
+ PostData(5,fMCEffTree);
+ PostData(6,fCosmicPairsTree);
+
+ PostData(7,fOutput);
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::UserExec(Option_t *)
+{
+ //
+ // Called for each event
+ //
+
+ // ESD event
+ fESD = (AliESDEvent*) (InputEvent());
+ if (!fESD) {
+ Printf("ERROR: ESD event not available");
+ return;
+ }
+
+ //// MC event
+ //if(fUseMCInfo) {
+ // fMC = MCEvent();
+ // if (!fMC) {
+ // Printf("ERROR: MC event not available");
+ // return;
+ // }
+ //}
+
+ //if MC info available - use it.
+ fMC = MCEvent();
+
+ if(fUseESDfriends) {
+ fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
+ if(!fESDfriend) {
+ Printf("ERROR: ESD friends not available");
+ }
+ }
+
+ //if set, use the environment variables to set the downscaling factors
+ //AliAnalysisTaskFilteredTree_fLowPtTrackDownscaligF
+ //AliAnalysisTaskFilteredTree_fLowPtV0DownscaligF
+ TString env;
+ env = gSystem->Getenv("AliAnalysisTaskFilteredTree_fLowPtTrackDownscaligF");
+ if (!env.IsNull())
+ {
+ fLowPtTrackDownscaligF=env.Atof();
+ AliInfo(Form("fLowPtTrackDownscaligF=%f",fLowPtTrackDownscaligF));
+ }
+ env = gSystem->Getenv("AliAnalysisTaskFilteredTree_fLowPtV0DownscaligF");
+ if (!env.IsNull())
+ {
+ fLowPtV0DownscaligF=env.Atof();
+ AliInfo(Form("fLowPtV0DownscaligF=%f",fLowPtTrackDownscaligF));
+ }
+
+ //
+ if(fProcessAll) {
+ ProcessAll(fESD,fMC,fESDfriend); // all track stages and MC
+ }
+ else {
+ Process(fESD,fMC,fESDfriend); // only global and TPC tracks
+ }
+
+ //
+ ProcessV0(fESD,fMC,fESDfriend);
+ ProcessLaser(fESD,fMC,fESDfriend);
+ ProcessdEdx(fESD,fMC,fESDfriend);
+
+ if (fProcessCosmics) { ProcessCosmics(fESD); }
+ if(fMC) { ProcessMCEff(fESD,fMC,fESDfriend);}
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::ProcessCosmics(AliESDEvent *const event)
+{
+ //
+ // Select real events with high-pT tracks
+ //
+ if(!event) {
+ AliDebug(AliLog::kError, "event not available");
+ return;
+ }
+
+ //
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (!inputHandler)
+ {
+ Printf("ERROR: Could not receive input handler");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+
+ // check for cosmic pairs
+ //
+ // find cosmic pairs trigger by random trigger
+ //
+ //
+ AliESDVertex *vertexSPD = (AliESDVertex *)event->GetPrimaryVertexSPD();
+ AliESDVertex *vertexTPC = (AliESDVertex *)event->GetPrimaryVertexTPC();
+ const Double_t kMinPt=0.8;
+ const Double_t kMinPtMax=0.8;
+ const Double_t kMinNcl=50;
+ const Double_t kMaxDelta[5]={2,600,0.02,0.02,0.1};
+ Int_t ntracks=event->GetNumberOfTracks();
+ // Float_t dcaTPC[2]={0,0};
+ // Float_t covTPC[3]={0,0,0};
+
+ UInt_t specie = event->GetEventSpecie(); // skip laser events
+ if (specie==AliRecoParam::kCalib) return;
+
+
+
+ for (Int_t itrack0=0;itrack0<ntracks;itrack0++) {
+ AliESDtrack *track0 = event->GetTrack(itrack0);
+ if (!track0) continue;
+ if (!track0->IsOn(AliESDtrack::kTPCrefit)) continue;
+
+ if (TMath::Abs(AliTracker::GetBz())>1 && track0->Pt() < kMinPt) continue;
+ if (track0->Pt() < kMinPt) continue;
+ if (track0->GetTPCncls() < kMinNcl) continue;
+ if (TMath::Abs(track0->GetY())<kMaxDelta[0]) continue;
+ if (track0->GetKinkIndex(0)>0) continue;
+ const Double_t * par0=track0->GetParameter(); //track param at rhe DCA
+ //rm primaries
+ //
+ //track0->GetImpactParametersTPC(dcaTPC,covTPC);
+ //if (TMath::Abs(dcaTPC[0])<kMaxDelta[0]) continue;
+ //if (TMath::Abs(dcaTPC[1])<kMaxDelta[0]*2) continue;
+ // const AliExternalTrackParam * trackIn0 = track0->GetInnerParam();
+ for (Int_t itrack1=itrack0+1;itrack1<ntracks;itrack1++) {
+ AliESDtrack *track1 = event->GetTrack(itrack1);
+ if (!track1) continue;
+ if (!track1->IsOn(AliESDtrack::kTPCrefit)) continue;
+ if (track1->GetKinkIndex(0)>0) continue;
+ if ((TMath::Abs(AliTracker::GetBz())>1) && (track1->Pt() < kMinPt)) continue;
+ if (track1->Pt() < kMinPt) continue;
+ if (track1->GetTPCncls()<kMinNcl) continue;
+ if (TMath::Abs(AliTracker::GetBz())>1 && TMath::Max(track1->Pt(), track0->Pt())<kMinPtMax) continue;
+ if (TMath::Abs(track1->GetY())<kMaxDelta[0]) continue;
+ //track1->GetImpactParametersTPC(dcaTPC,covTPC);
+ // if (TMath::Abs(dcaTPC[0])<kMaxDelta[0]) continue;
+ //if (TMath::Abs(dcaTPC[1])<kMaxDelta[0]*2) continue;
+ //
+ const Double_t* par1=track1->GetParameter(); //track param at rhe DCA
+ //
+ Bool_t isPair=kTRUE;
+ for (Int_t ipar=0; ipar<5; ipar++){
+ if (ipar==4&&TMath::Abs(AliTracker::GetBz())<1) continue; // 1/pt not defined for B field off
+ if (TMath::Abs(TMath::Abs(par0[ipar])-TMath::Abs(par1[ipar]))>kMaxDelta[ipar]) isPair=kFALSE;
+ }
+ if (!isPair) continue;
+ if (TMath::Abs(TMath::Abs(track0->GetAlpha()-track1->GetAlpha())-TMath::Pi())>kMaxDelta[2]) isPair=kFALSE;
+ //delta with correct sign
+ /*
+ TCut cut0="abs(t1.fP[0]+t0.fP[0])<2"
+ TCut cut3="abs(t1.fP[3]+t0.fP[3])<0.02"
+ TCut cut4="abs(t1.fP[4]+t0.fP[4])<0.2"
+ */
+ if (TMath::Abs(par0[0]+par1[0])>kMaxDelta[0]) isPair=kFALSE; //delta y opposite sign
+ if (TMath::Abs(par0[3]+par1[3])>kMaxDelta[3]) isPair=kFALSE; //delta tgl opposite sign
+ if (TMath::Abs(AliTracker::GetBz())>1 && TMath::Abs(par0[4]+par1[4])>kMaxDelta[4]) isPair=kFALSE; //delta 1/pt opposite sign
+ if (!isPair) continue;
+ TString filename(AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()->GetName());
+ Int_t eventNumber = event->GetEventNumberInFile();
+ //Bool_t hasFriend = kFALSE;
+ //Bool_t hasITS=(track0->GetNcls(0)+track1->GetNcls(0)>4);
+ //printf("DUMPHPTCosmic:%s|%f|%d|%d|%d\n",filename.Data(),(TMath::Min(track0->Pt(),track1->Pt())), eventNumber,hasFriend,hasITS);
+ // const AliExternalTrackParam * trackIn1 = track1->GetInnerParam();
+ //
+ //
+ Int_t ntracksSPD = vertexSPD->GetNContributors();
+ Int_t ntracksTPC = vertexTPC->GetNContributors();
+ Int_t runNumber = event->GetRunNumber();
+ Int_t timeStamp = event->GetTimeStamp();
+ ULong64_t triggerMask = event->GetTriggerMask();
+ Float_t magField = event->GetMagneticField();
+ TObjString triggerClass = event->GetFiredTriggerClasses().Data();
+
+ //
+ // Dump to the tree
+ // vertex
+ // TPC-ITS tracks
+ //
+
+ //fCosmicPairsTree->Branch("fileName",&fileName,32000,0);
+ //fCosmicPairsTree->Branch("runNumber",&runNumber,"runNumber/I");
+ //fCosmicPairsTree->Branch("timeStamp",&timeStamp,"timeStamp/I");
+ //fCosmicPairsTree->Branch("eventNumber",&eventNumber,"eventNumber/I");
+ //fCosmicPairsTree->Branch("triggerMask",&triggerMask,32000,0);
+ //fCosmicPairsTree->Branch("triggerClass",&triggerClass,32000,0);
+ //fCosmicPairsTree->Branch("magField",&magField,"magField/F");
+ //fCosmicPairsTree->Branch("ntracksSPD",&ntracksSPD,"ntracksSPD/I");
+ //fCosmicPairsTree->Branch("ntracksTPC",&ntracksTPC,"ntracksTPC/I");
+ //fCosmicPairsTree->Branch("vertexSPD",vertexSPD,32000,0);
+ //fCosmicPairsTree->Branch("vertexTPC",vertexTPC,32000,0);
+ //fCosmicPairsTree->Branch("track0",track0,32000,0);
+ //fCosmicPairsTree->Branch("track1",track1,32000,0);
+ //
+ //fCosmicPairsTree->Fill();
+
+ if(!fFillTree) return;
+ if(!fTreeSRedirector) return;
+ (*fTreeSRedirector)<<"CosmicPairs"<<
+ "fileName.="<<&fileName<< // file name
+ "runNumber="<<runNumber<< // run number
+ "evtTimeStamp="<<timeStamp<< // time stamp of event
+ "evtNumberInFile="<<eventNumber<< // event number
+ "trigger="<<triggerMask<< // trigger
+ "triggerClass="<<&triggerClass<< // trigger
+ "Bz="<<magField<< // magnetic field
+ //
+ "multSPD="<<ntracksSPD<<
+ "multTPC="<<ntracksTPC<<
+ "vertSPD.="<<vertexSPD<< //primary vertex -SPD
+ "vertTPC.="<<vertexTPC<< //primary vertex -TPC
+ "t0.="<<track0<< //track0
+ "t1.="<<track1<< //track1
+ "\n";
+ }
+ }
+}
+
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
+{
+ //
+ // Select real events with high-pT tracks
+ //
+ if(!esdEvent) {
+ AliDebug(AliLog::kError, "esdEvent not available");
+ return;
+ }
+
+ // get selection cuts
+ AliFilteredTreeEventCuts *evtCuts = GetEventCuts();
+ AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts();
+ AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
+
+ if(!evtCuts || !accCuts || !esdTrackCuts) {
+ Printf("ERROR cuts not available");
+ return;
+ }
+
+ // trigger selection
+ Bool_t isEventTriggered = kTRUE;
+ AliPhysicsSelection *physicsSelection = NULL;
+ AliTriggerAnalysis* triggerAnalysis = NULL;
+
+ //
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (!inputHandler)
+ {
+ Printf("ERROR: Could not receive input handler");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+ // trigger
+ if(evtCuts->IsTriggerRequired())
+ {
+ // always MB
+ isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
+
+ physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
+ if(!physicsSelection) return;
+ //SetPhysicsTriggerSelection(physicsSelection);
+
+ if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
+ // set trigger (V0AND)
+ triggerAnalysis = physicsSelection->GetTriggerAnalysis();
+ if(!triggerAnalysis) return;
+ isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
+ }
+ }
+
+ // centrality determination
+ Float_t centralityF = -1;
+ AliCentrality *esdCentrality = esdEvent->GetCentrality();
+ centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
+
+ // use MC information
+ AliHeader* header = 0;
+ AliGenEventHeader* genHeader = 0;
+ AliStack* stack = 0;
+ TArrayF vtxMC(3);
+
+ Int_t multMCTrueTracks = 0;
+ if(mcEvent)
+ {
+ // get MC event header
+ header = mcEvent->Header();
+ if (!header) {
+ AliDebug(AliLog::kError, "Header not available");
+ return;
+ }
+ // MC particle stack
+ stack = mcEvent->Stack();
+ if (!stack) {
+ AliDebug(AliLog::kError, "Stack not available");
+ return;
+ }
+
+ // get MC vertex
+ genHeader = header->GenEventHeader();
+ if (!genHeader) {
+ AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
+ return;
+ }
+ genHeader->PrimaryVertex(vtxMC);
+
+ // multipliticy of all MC primary tracks
+ // in Zv, pt and eta ranges)
+ multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
+ } // end bUseMC
+
+ // get reconstructed vertex
+ //const AliESDVertex* vtxESD = 0;
+ AliESDVertex* vtxESD = 0;
+ if(GetAnalysisMode() == kTPCAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
+ }
+ else if(GetAnalysisMode() == kTPCITSAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
+ }
+ else {
+ return;
+ }
+
+ AliESDVertex* vtxTPC = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
+ AliESDVertex* vtxSPD = (AliESDVertex*)esdEvent->GetPrimaryVertexSPD();
+
+ if(!vtxESD) return;
+ if(!vtxTPC) return;
+ if(!vtxSPD) return;
+
+ Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
+ //printf("isEventOK %d, isEventTriggered %d, status %d, vz %f \n",isEventOK, isEventTriggered, vtxESD->GetStatus(), vtxESD->GetZv());
+ //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
+ Int_t ntracks = esdEvent->GetNumberOfTracks();
+
+ // check event cuts
+ if(isEventOK && isEventTriggered)
+ {
+
+ //
+ // get IR information
+ //
+ AliESDHeader *esdHeader = 0;
+ esdHeader = esdEvent->GetHeader();
+ if(!esdHeader) return;
+ //Int_t ir1 = esdHeader->GetTriggerIREntries(); //all ir-s
+ //Int_t ir2 = esdHeader->GetTriggerIREntries(-1,1); // int2 set, 180 ms time interval
+
+ // Use when Peter commit the changes in the header
+ Int_t ir1 = 0;
+ Int_t ir2 = 0;
+
+ //
+ Double_t vert[3] = {0};
+ vert[0] = vtxESD->GetXv();
+ vert[1] = vtxESD->GetYv();
+ vert[2] = vtxESD->GetZv();
+ Int_t mult = vtxESD->GetNContributors();
+ Int_t multSPD = vtxSPD->GetNContributors();
+ Int_t multTPC = vtxTPC->GetNContributors();
+
+ Float_t bz = esdEvent->GetMagneticField();
+ Int_t runNumber = esdEvent->GetRunNumber();
+ Int_t evtTimeStamp = esdEvent->GetTimeStamp();
+ Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
+
+ // high pT tracks
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
+ {
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+ if(track->Charge()==0) continue;
+ if(!esdTrackCuts->AcceptTrack(track)) continue;
+ if(!accCuts->AcceptTrack(track)) continue;
+
+ // downscale low-pT tracks
+ Double_t scalempt= TMath::Min(track->Pt(),10.);
+ Double_t downscaleF = gRandom->Rndm();
+ downscaleF *= fLowPtTrackDownscaligF;
+ if(TMath::Exp(2*scalempt)<downscaleF) continue;
+ //printf("TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);
+
+ AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(track->GetTPCInnerParam());
+ if (!tpcInner) continue;
+ // transform to the track reference frame
+ Bool_t isOK = kFALSE;
+ isOK = tpcInner->Rotate(track->GetAlpha());
+ isOK = tpcInner->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
+ if(!isOK) continue;
+
+ // Dump to the tree
+ // vertex
+ // TPC-ITS tracks
+ //
+ TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();
+
+ //fHighPtTree->Branch("fileName",&fileName,32000,0);
+ //fHighPtTree->Branch("runNumber",&runNumber,"runNumber/I");
+ //fHighPtTree->Branch("evtTimeStamp",&evtTimeStamp,"evtTimeStamp/I");
+ //fHighPtTree->Branch("evtNumberInFile",&evtNumberInFile,"evtNumberInFile/I");
+ //fHighPtTree->Branch("triggerClass",&triggerClass,32000,0);
+ //fHighPtTree->Branch("Bz",&bz,"Bz/F");
+ //fHighPtTree->Branch("vtxESD",vtxESD,32000,0);
+ //fHighPtTree->Branch("IRtot",&ir1,"IRtot/I");
+ //fHighPtTree->Branch("IRint2",&ir2,"IRint2/I");
+ //fHighPtTree->Branch("mult",&mult,"mult/I");
+ //fHighPtTree->Branch("esdTrack",track,32000,0);
+ //fHighPtTree->Branch("centralityF",¢ralityF,"centralityF/F");
+
+ //fHighPtTree->Fill();
+
+ //Double_t vtxX=vtxESD->GetX();
+ //Double_t vtxY=vtxESD->GetY();
+ //Double_t vtxZ=vtxESD->GetZ();
+ if(!fFillTree) return;
+ if(!fTreeSRedirector) return;
+ (*fTreeSRedirector)<<"highPt"<<
+ "fileName.="<<&fileName<<
+ "runNumber="<<runNumber<<
+ "evtTimeStamp="<<evtTimeStamp<<
+ "evtNumberInFile="<<evtNumberInFile<<
+ "triggerClass="<<&triggerClass<< // trigger
+ "Bz="<<bz<< // magnetic field
+ "vtxESD.="<<vtxESD<<
+ "ntracksESD="<<ntracks<< // number of tracks in the ESD
+ // "vtxESDx="<<vtxX<<
+ // "vtxESDy="<<vtxY<<
+ // "vtxESDz="<<vtxZ<<
+ "IRtot="<<ir1<< // interaction record history info
+ "IRint2="<<ir2<<
+ "mult="<<mult<< // multiplicity of tracks pointing to the primary vertex
+ "multSPD="<<multSPD<< // multiplicity of tracks pointing to the SPD primary vertex
+ "multTPC="<<multTPC<< // multiplicity of tracks pointing to the TPC primary vertex
+ "esdTrack.="<<track<<
+ "centralityF="<<centralityF<<
+ "\n";
+ }
+ }
+
+}
+
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::ProcessLaser(AliESDEvent *const esdEvent, AliMCEvent * const /*mcEvent*/, AliESDfriend *const /*esdFriend*/)
+{
+ //
+ // Process laser events
+ //
+ if(!esdEvent) {
+ AliDebug(AliLog::kError, "esdEvent not available");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+ // laser events
+ const AliESDHeader* esdHeader = esdEvent->GetHeader();
+ if(esdHeader && esdHeader->GetEventSpecie()==AliRecoParam::kCalib)
+ {
+ Int_t countLaserTracks = 0;
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
+ {
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+
+ if(track->GetTPCInnerParam()) countLaserTracks++;
+ }
+
+ if(countLaserTracks > 100)
+ {
+ Int_t runNumber = esdEvent->GetRunNumber();
+ Int_t evtTimeStamp = esdEvent->GetTimeStamp();
+ Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
+ Float_t bz = esdEvent->GetMagneticField();
+ TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();
+
+ //fLaserTree->Branch("fileName",&fileName,32000,0);
+ //fLaserTree->Branch("runNumber",&runNumber,"runNumber/I");
+ //fLaserTree->Branch("evtTimeStamp",&evtTimeStamp,"evtTimeStamp/I");
+ //fLaserTree->Branch("evtNumberInFile",&evtNumberInFile,"evtNumberInFile/I");
+ //fLaserTree->Branch("triggerClass",&triggerClass,32000,0);
+ //fLaserTree->Branch("Bz",&bz,"Bz/F");
+ //fLaserTree->Branch("multTPCtracks",&countLaserTracks,"multTPCtracks/I");
+
+ //fLaserTree->Fill();
+
+ if(!fFillTree) return;
+ if(!fTreeSRedirector) return;
+ (*fTreeSRedirector)<<"Laser"<<
+ "fileName.="<<&fileName<<
+ "runNumber="<<runNumber<<
+ "evtTimeStamp="<<evtTimeStamp<<
+ "evtNumberInFile="<<evtNumberInFile<<
+ "triggerClass="<<&triggerClass<< // trigger
+ "Bz="<<bz<<
+ "multTPCtracks="<<countLaserTracks<<
+ "\n";
+ }
+ }
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::ProcessAll(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const esdFriend)
+{
+ //
+ // Select real events with high-pT tracks
+ // Calculate and stor in the output tree:
+ // TPC constrained tracks
+ // InnerParams constrained tracks
+ // TPC-ITS tracks
+ // ITSout-InnerParams tracks
+ // chi2 distance between TPC constrained and TPC-ITS tracks
+ // chi2 distance between TPC refitted constrained and TPC-ITS tracks
+ // chi2 distance between ITSout and InnerParams tracks
+ // MC information:
+ // track references at ITSin, TPCin; InnerParam at first TPC track reference,
+ // particle ID, mother ID, production mechanism ...
+ //
+
+ if(!esdEvent) {
+ AliDebug(AliLog::kError, "esdEvent not available");
+ return;
+ }
+
+ // get selection cuts
+ AliFilteredTreeEventCuts *evtCuts = GetEventCuts();
+ AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts();
+ AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
+
+ if(!evtCuts || !accCuts || !esdTrackCuts) {
+ AliDebug(AliLog::kError, "cuts not available");
+ return;
+ }
+
+ // trigger selection
+ Bool_t isEventTriggered = kTRUE;
+ AliPhysicsSelection *physicsSelection = NULL;
+ AliTriggerAnalysis* triggerAnalysis = NULL;
+
+ //
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (!inputHandler)
+ {
+ Printf("ERROR: Could not receive input handler");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+ // trigger
+ if(evtCuts->IsTriggerRequired())
+ {
+ // always MB
+ isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
+
+ physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
+ if(!physicsSelection) {AliInfo("no physics selection"); return;}
+ //SetPhysicsTriggerSelection(physicsSelection);
+
+ if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
+ // set trigger (V0AND)
+ triggerAnalysis = physicsSelection->GetTriggerAnalysis();
+ if(!triggerAnalysis) {AliInfo("no trigger analysis");return;}
+ isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
+ }
+ }
+
+ // centrality determination
+ Float_t centralityF = -1;
+ AliCentrality *esdCentrality = esdEvent->GetCentrality();
+ centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
+
+ // use MC information
+ AliHeader* header = 0;
+ AliGenEventHeader* genHeader = 0;
+ AliStack* stack = 0;
+ TArrayF vtxMC(3);
+ Int_t mcStackSize=0;
+
+ Int_t multMCTrueTracks = 0;
+ if(mcEvent)
+ {
+ // get MC event header
+ header = mcEvent->Header();
+ if (!header) {
+ AliDebug(AliLog::kError, "Header not available");
+ return;
+ }
+ // MC particle stack
+ stack = mcEvent->Stack();
+ if (!stack) {
+ AliDebug(AliLog::kError, "Stack not available");
+ return;
+ }
+ mcStackSize=stack->GetNtrack();
+
+ // get MC vertex
+ genHeader = header->GenEventHeader();
+ if (!genHeader) {
+ AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
+ return;
+ }
+ genHeader->PrimaryVertex(vtxMC);
+
+ // multipliticy of all MC primary tracks
+ // in Zv, pt and eta ranges)
+ multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
+
+ } // end bUseMC
+
+ // get reconstructed vertex
+ //const AliESDVertex* vtxESD = 0;
+ AliESDVertex* vtxESD = 0;
+ if(GetAnalysisMode() == kTPCAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
+ }
+ else if(GetAnalysisMode() == kTPCITSAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
+ }
+ else {
+ AliInfo("no ESD vertex");
+ return;
+ }
+
+ if(!vtxESD) return;
+
+ Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
+
+ //
+ // Vertex info comparison and track multiplicity
+ //
+ AliESDVertex *vertexSPD = (AliESDVertex *)esdEvent->GetPrimaryVertexSPD();
+ AliESDVertex *vertexTPC = (AliESDVertex *)esdEvent->GetPrimaryVertexTPC();
+ Int_t contSPD = vertexSPD->GetNContributors();
+ Int_t contTPC = vertexTPC->GetNContributors();
+ TVectorD vertexPosTPC(3), vertexPosSPD(3);
+ vertexSPD->GetXYZ(vertexPosSPD.GetMatrixArray());
+ vertexTPC->GetXYZ(vertexPosTPC.GetMatrixArray());
+ Int_t ntracksTPC=0;
+ Int_t ntracksITS=0;
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++){
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+ if (track->IsOn(AliVTrack::kTPCrefit)) ntracksTPC++;
+ if (track->IsOn(AliVTrack::kITSrefit)) ntracksITS++;
+ }
+
+ //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
+ //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
+
+
+ // check event cuts
+ if(isEventOK && isEventTriggered)
+ {
+ //
+ // get IR information
+ //
+ AliESDHeader *esdHeader = 0;
+ esdHeader = esdEvent->GetHeader();
+ if(!esdHeader) {AliInfo("no esdHeader");return;}
+ //Int_t ir1 = esdHeader->GetTriggerIREntries(); //all ir-s
+ //Int_t ir2 = esdHeader->GetTriggerIREntries(-1,1); // int2 set, 180 ms time interval
+ //
+ Int_t ir1 = 0;
+ Int_t ir2 = 0;
+
+ //
+ Double_t vert[3] = {0};
+ vert[0] = vtxESD->GetXv();
+ vert[1] = vtxESD->GetYv();
+ vert[2] = vtxESD->GetZv();
+ Int_t mult = vtxESD->GetNContributors();
+ Float_t bz = esdEvent->GetMagneticField();
+ Int_t runNumber = esdEvent->GetRunNumber();
+ Int_t evtTimeStamp = esdEvent->GetTimeStamp();
+ Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
+
+ // high pT tracks
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
+ {
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+ if(track->Charge()==0) continue;
+ if(!esdTrackCuts->AcceptTrack(track)) continue;
+ if(!accCuts->AcceptTrack(track)) continue;
+
+ // downscale low-pT tracks
+ Double_t scalempt= TMath::Min(track->Pt(),10.);
+ Double_t downscaleF = gRandom->Rndm();
+ downscaleF *= fLowPtTrackDownscaligF;
+ if(TMath::Exp(2*scalempt)<downscaleF) continue;
+ //printf("TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);
+
+ // Dump to the tree
+ // vertex
+ // TPC constrained tracks
+ // InnerParams constrained tracks
+ // TPC-ITS tracks
+ // ITSout-InnerParams tracks
+ // chi2 distance between TPC constrained and TPC-ITS tracks
+ // chi2 distance between TPC refitted constrained and TPC-ITS tracks
+ // chi2 distance between ITSout and InnerParams tracks
+ // MC information
+
+ Double_t x[3]; track->GetXYZ(x);
+ Double_t b[3]; AliTracker::GetBxByBz(x,b);
+
+ //
+ // Transform TPC inner params to track reference frame
+ //
+ Bool_t isOKtpcInner = kFALSE;
+ AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(track->GetTPCInnerParam());
+ if (tpcInner) {
+ // transform to the track reference frame
+ isOKtpcInner = tpcInner->Rotate(track->GetAlpha());
+ isOKtpcInner = tpcInner->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
+ }
+
+ //
+ // Constrain TPC inner to vertex
+ // clone TPCinner has to be deleted
+ //
+ Bool_t isOKtpcInnerC = kFALSE;
+ AliExternalTrackParam * tpcInnerC = new AliExternalTrackParam(*(track->GetTPCInnerParam()));
+ if (tpcInnerC) {
+ isOKtpcInnerC = ConstrainTPCInner(tpcInnerC,vtxESD,b);
+ isOKtpcInnerC = tpcInnerC->Rotate(track->GetAlpha());
+ isOKtpcInnerC = tpcInnerC->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
+ }
+
+ //
+ // Constrain TPC refitted tracks at inner TPC wall (InnerParams) to vertex
+ // Clone track InnerParams has to be deleted
+ //
+ Bool_t isOKtrackInnerC = kFALSE;
+ AliExternalTrackParam * trackInnerC = new AliExternalTrackParam(*(track->GetInnerParam()));
+ if (trackInnerC) {
+ isOKtrackInnerC = ConstrainTrackInner(trackInnerC,vtxESD,track->GetMass(),b);
+ isOKtrackInnerC = trackInnerC->Rotate(track->GetAlpha());
+ isOKtrackInnerC = trackInnerC->PropagateTo(track->GetX(),esdEvent->GetMagneticField());
+ }
+
+ //
+ // calculate chi2 between vi and vj vectors
+ // with covi and covj covariance matrices
+ // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj)
+ //
+ TMatrixD deltaT(5,1), deltaTtrackC(5,1);
+ TMatrixD delta(1,5), deltatrackC(1,5);
+ TMatrixD covarM(5,5), covarMtrackC(5,5);
+ TMatrixD chi2(1,1);
+ TMatrixD chi2trackC(1,1);
+
+ if(isOKtpcInnerC && isOKtrackInnerC)
+ {
+ for (Int_t ipar=0; ipar<5; ipar++) {
+ deltaT(ipar,0)=tpcInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
+ delta(0,ipar)=tpcInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
+
+ deltaTtrackC(ipar,0)=trackInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
+ deltatrackC(0,ipar)=trackInnerC->GetParameter()[ipar]-track->GetParameter()[ipar];
+
+ for (Int_t jpar=0; jpar<5; jpar++) {
+ Int_t index=track->GetIndex(ipar,jpar);
+ covarM(ipar,jpar)=track->GetCovariance()[index]+tpcInnerC->GetCovariance()[index];
+ covarMtrackC(ipar,jpar)=track->GetCovariance()[index]+trackInnerC->GetCovariance()[index];
+ }
+ }
+
+ // chi2 distance TPC constrained and TPC+ITS
+ TMatrixD covarMInv = covarM.Invert();
+ TMatrixD mat2 = covarMInv*deltaT;
+ chi2 = delta*mat2;
+ //chi2.Print();
+
+ // chi2 distance TPC refitted constrained and TPC+ITS
+ TMatrixD covarMInvtrackC = covarMtrackC.Invert();
+ TMatrixD mat2trackC = covarMInvtrackC*deltaTtrackC;
+ chi2trackC = deltatrackC*mat2trackC;
+ //chi2trackC.Print();
+ }
+
+
+ //
+ // Propagate ITSout to TPC inner wall
+ // and calculate chi2 distance to track (InnerParams)
+ //
+ const Double_t kTPCRadius=85;
+ const Double_t kStep=3;
+
+ // clone track InnerParams has to be deleted
+ Bool_t isOKtrackInnerC2 = kFALSE;
+ AliExternalTrackParam *trackInnerC2 = new AliExternalTrackParam(*(track->GetInnerParam()));
+ if (trackInnerC2) {
+ isOKtrackInnerC2 = AliTracker::PropagateTrackToBxByBz(trackInnerC2,kTPCRadius,track->GetMass(),kStep,kFALSE);
+ }
+
+ Bool_t isOKouterITSc = kFALSE;
+ AliExternalTrackParam *outerITSc = NULL;
+ TMatrixD chi2OuterITS(1,1);
+
+ if(esdFriend && esdFriend->TestSkipBit()==kFALSE)
+ {
+ // propagate ITSout to TPC inner wall
+ AliESDfriendTrack *friendTrack = esdFriend->GetTrack(iTrack);
+
+ if(friendTrack)
+ {
+ outerITSc = new AliExternalTrackParam(*friendTrack->GetITSOut());
+ if(outerITSc)
+ {
+ isOKouterITSc = AliTracker::PropagateTrackToBxByBz(outerITSc,kTPCRadius,track->GetMass(),kStep,kFALSE);
+ isOKouterITSc = outerITSc->Rotate(trackInnerC2->GetAlpha());
+ isOKouterITSc = outerITSc->PropagateTo(trackInnerC2->GetX(),esdEvent->GetMagneticField());
+
+ //
+ // calculate chi2 between outerITS and innerParams
+ // cov without z-coordinate at the moment
+ //
+ TMatrixD deltaTouterITS(4,1);
+ TMatrixD deltaouterITS(1,4);
+ TMatrixD covarMouterITS(4,4);
+
+ if(isOKtrackInnerC2 && isOKouterITSc) {
+ Int_t kipar = 0;
+ Int_t kjpar = 0;
+ for (Int_t ipar=0; ipar<5; ipar++) {
+ if(ipar!=1) {
+ deltaTouterITS(kipar,0)=outerITSc->GetParameter()[ipar]-trackInnerC2->GetParameter()[ipar];
+ deltaouterITS(0,kipar)=outerITSc->GetParameter()[ipar]-trackInnerC2->GetParameter()[ipar];
+ }
+
+ kjpar=0;
+ for (Int_t jpar=0; jpar<5; jpar++) {
+ Int_t index=outerITSc->GetIndex(ipar,jpar);
+ if(ipar !=1 || jpar!=1) {
+ covarMouterITS(kipar,kjpar)=outerITSc->GetCovariance()[index]+trackInnerC2->GetCovariance()[index];
+ }
+ if(jpar!=1) kjpar++;
+ }
+ if(ipar!=1) kipar++;
+ }
+
+ // chi2 distance ITSout and InnerParams
+ TMatrixD covarMInvouterITS = covarMouterITS.Invert();
+ TMatrixD mat2outerITS = covarMInvouterITS*deltaTouterITS;
+ chi2OuterITS = deltaouterITS*mat2outerITS;
+ //chi2OuterITS.Print();
+ }
+ }
+ }
+ }
+
+ //
+ // MC info
+ //
+ TParticle *particle=NULL, *particleTPC=NULL, *particleITS=NULL;
+ TParticle *particleMother=NULL, *particleMotherTPC=NULL, *particleMotherITS=NULL;
+ Int_t mech=-1, mechTPC=-1, mechITS=-1;
+ Bool_t isPrim=kFALSE, isPrimTPC=kFALSE, isPrimITS=kFALSE;
+ Bool_t isFromStrangess=kFALSE, isFromStrangessTPC=kFALSE, isFromStrangessITS=kFALSE;
+ Bool_t isFromConversion=kFALSE, isFromConversionTPC=kFALSE, isFromConversionITS=kFALSE;
+ Bool_t isFromMaterial=kFALSE, isFromMaterialTPC=kFALSE, isFromMaterialITS=kFALSE;
+
+ AliTrackReference *refTPCIn = NULL;
+ AliTrackReference *refTPCOut = NULL;
+ AliTrackReference *refITS = NULL;
+ AliTrackReference *refTRD = NULL;
+ AliTrackReference *refTOF = NULL;
+ AliTrackReference *refEMCAL = NULL;
+ AliTrackReference *refPHOS = NULL;
+ Int_t nrefTPC=0, nrefTRD=0, nrefTOF=0, nrefITS=0, nrefEMCAL=0, nrefPHOS=0;
+
+ Bool_t isOKtrackInnerC3 = kFALSE;
+ AliExternalTrackParam *trackInnerC3 = new AliExternalTrackParam(*(track->GetInnerParam()));
+ if(mcEvent)
+ {
+ if(!stack) return;
+ multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
+ //
+ // global track
+ //
+ Int_t label = TMath::Abs(track->GetLabel());
+ if (label >= mcStackSize) continue;
+ particle = stack->Particle(label);
+ if (!particle) continue;
+ if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0.)
+ {
+ particleMother = GetMother(particle,stack);
+ mech = particle->GetUniqueID();
+ isPrim = stack->IsPhysicalPrimary(label);
+ isFromStrangess = IsFromStrangeness(label,stack);
+ isFromConversion = IsFromConversion(label,stack);
+ isFromMaterial = IsFromMaterial(label,stack);
+ }
+
+ //
+ // TPC track
+ //
+ Int_t labelTPC = TMath::Abs(track->GetTPCLabel());
+ if (labelTPC >= mcStackSize) continue;
+ particleTPC = stack->Particle(labelTPC);
+ if (!particleTPC) continue;
+ if(particleTPC && particleTPC->GetPDG() && particleTPC->GetPDG()->Charge()!=0.)
+ {
+ particleMotherTPC = GetMother(particleTPC,stack);
+ mechTPC = particleTPC->GetUniqueID();
+ isPrimTPC = stack->IsPhysicalPrimary(labelTPC);
+ isFromStrangessTPC = IsFromStrangeness(labelTPC,stack);
+ isFromConversionTPC = IsFromConversion(labelTPC,stack);
+ isFromMaterialTPC = IsFromMaterial(labelTPC,stack);
+ }
+
+ //
+ // store first track reference
+ // for TPC track
+ //
+ TParticle *part=0;
+ TClonesArray *trefs=0;
+ Int_t status = mcEvent->GetParticleAndTR(TMath::Abs(labelTPC), part, trefs);
+
+ if(status>0 && part && trefs && part->GetPDG() && part->GetPDG()->Charge()!=0.)
+ {
+ Int_t nTrackRef = trefs->GetEntries();
+ //printf("nTrackRef %d \n",nTrackRef);
+
+ Int_t countITS = 0;
+ for (Int_t iref = 0; iref < nTrackRef; iref++)
+ {
+ AliTrackReference *ref = (AliTrackReference *)trefs->At(iref);
+
+ // Ref. in the middle ITS
+ if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kITS)
+ {
+ nrefITS++;
+ if(!refITS && countITS==2) {
+ refITS = ref;
+ //printf("refITS %p \n",refITS);
+ }
+ countITS++;
+ }
+
+ // TPC
+ if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kTPC)
+ {
+ nrefTPC++;
+ refTPCOut=ref;
+ if(!refTPCIn) {
+ refTPCIn = ref;
+ //printf("refTPCIn %p \n",refTPCIn);
+ //break;
+ }
+ }
+ // TRD
+ if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kTRD)
+ {
+ nrefTRD++;
+ if(!refTRD) {
+ refTRD = ref;
+ }
+ }
+ // TOF
+ if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kTOF)
+ {
+ nrefTOF++;
+ if(!refTOF) {
+ refTOF = ref;
+ }
+ }
+ // EMCAL
+ if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kEMCAL)
+ {
+ nrefEMCAL++;
+ if(!refEMCAL) {
+ refEMCAL = ref;
+ }
+ }
+ // PHOS
+ // if(ref && ref->Label()==label && ref->DetectorId()==AliTrackReference::kPHOS)
+// {
+// nrefPHOS++;
+// if(!refPHOS) {
+// refPHOS = ref;
+// }
+// }
+ }
+
+ // transform inner params to TrackRef
+ // reference frame
+ if(refTPCIn && trackInnerC3)
+ {
+ Double_t kRefPhi = TMath::ATan2(refTPCIn->Y(),refTPCIn->X());
+ isOKtrackInnerC3 = trackInnerC3->Rotate(kRefPhi);
+ isOKtrackInnerC3 = AliTracker::PropagateTrackToBxByBz(trackInnerC3,refTPCIn->R(),track->GetMass(),kStep,kFALSE);
+ }
+ }
+
+ //
+ // ITS track
+ //
+ Int_t labelITS = TMath::Abs(track->GetITSLabel());
+ if (labelITS >= mcStackSize) continue;
+ particleITS = stack->Particle(labelITS);
+ if (!particleITS) continue;
+ if(particleITS && particleITS->GetPDG() && particleITS->GetPDG()->Charge()!=0.)
+ {
+ particleMotherITS = GetMother(particleITS,stack);
+ mechITS = particleITS->GetUniqueID();
+ isPrimITS = stack->IsPhysicalPrimary(labelITS);
+ isFromStrangessITS = IsFromStrangeness(labelITS,stack);
+ isFromConversionITS = IsFromConversion(labelITS,stack);
+ isFromMaterialITS = IsFromMaterial(labelITS,stack);
+ }
+ }
+
+ //
+ Bool_t dumpToTree=kFALSE;
+
+ if(isOKtpcInnerC && isOKtrackInnerC) dumpToTree = kTRUE;
+ if(fUseESDfriends && isOKtrackInnerC2 && isOKouterITSc) dumpToTree = kTRUE;
+ if(mcEvent && isOKtrackInnerC3) dumpToTree = kTRUE;
+ TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();
+ if (fReducePileUp){
+ //
+ // 18.03 - Reduce pile-up chunks, done outside of the ESDTrackCuts for 2012/2013 data pile-up about 95 % of tracks
+ // Done only in case no MC info
+ //
+ Float_t dcaTPC[2];
+ track->GetImpactParametersTPC(dcaTPC[0],dcaTPC[1]);
+ Bool_t isRoughPrimary = TMath::Abs(dcaTPC[1])<10;
+ Bool_t hasOuter=(track->IsOn(AliVTrack::kITSin))||(track->IsOn(AliVTrack::kTOFout))||(track->IsOn(AliVTrack::kTRDin));
+ Bool_t keepPileUp=gRandom->Rndm()<0.05;
+ if ( (!hasOuter) && (!isRoughPrimary) && (!keepPileUp)){
+ dumpToTree=kFALSE;
+ }
+ }
+ /////////////////
+ //book keeping of created dummy objects (to avoid NULL in trees)
+ Bool_t newvtxESD=kFALSE;
+ Bool_t newtrack=kFALSE;
+ Bool_t newtpcInnerC=kFALSE;
+ Bool_t newtrackInnerC=kFALSE;
+ Bool_t newtrackInnerC2=kFALSE;
+ Bool_t newouterITSc=kFALSE;
+ Bool_t newtrackInnerC3=kFALSE;
+ Bool_t newrefTPCIn=kFALSE;
+ Bool_t newrefITS=kFALSE;
+ Bool_t newparticle=kFALSE;
+ Bool_t newparticleMother=kFALSE;
+ Bool_t newparticleTPC=kFALSE;
+ Bool_t newparticleMotherTPC=kFALSE;
+ Bool_t newparticleITS=kFALSE;
+ Bool_t newparticleMotherITS=kFALSE;
+
+ //check that the vertex is there and that it is OK,
+ //i.e. no null member arrays, otherwise a problem with merging
+ //later on.
+ //this is a very ugly hack!
+ if (!vtxESD)
+ {
+ AliInfo("fixing the ESD vertex for streaming");
+ vtxESD=new AliESDVertex();
+ //vtxESD->SetNContributors(1);
+ //UShort_t pindices[1]; pindices[0]=0;
+ //vtxESD->SetIndices(1,pindices);
+ //vtxESD->SetNContributors(0);
+ newvtxESD=kTRUE;
+ }
+ //
+ if (!track) {track=new AliESDtrack();newtrack=kTRUE;}
+ if (!tpcInnerC) {tpcInnerC=new AliExternalTrackParam();newtpcInnerC=kTRUE;}
+ if (!trackInnerC) {trackInnerC=new AliExternalTrackParam();newtrackInnerC=kTRUE;}
+ if (!trackInnerC2) {trackInnerC2=new AliExternalTrackParam();newtrackInnerC2=kTRUE;}
+ if (!outerITSc) {outerITSc=new AliExternalTrackParam();newouterITSc=kTRUE;}
+ if (!trackInnerC3) {trackInnerC3=new AliExternalTrackParam();newtrackInnerC3=kTRUE;}
+ if (mcEvent)
+ {
+ if (!refTPCIn) {refTPCIn=new AliTrackReference(); newrefTPCIn=kTRUE;}
+ if (!refITS) {refITS=new AliTrackReference();newrefITS=kTRUE;}
+ if (!particle) {particle=new TParticle(); newparticle=kTRUE;}
+ if (!particleMother) {particleMother=new TParticle();newparticleMother=kTRUE;}
+ if (!particleTPC) {particleTPC=new TParticle();newparticleTPC=kTRUE;}
+ if (!particleMotherTPC) {particleMotherTPC=new TParticle();newparticleMotherTPC=kTRUE;}
+ if (!particleITS) {particleITS=new TParticle();newparticleITS=kTRUE;}
+ if (!particleMotherITS) {particleMotherITS=new TParticle();newparticleMotherITS=kTRUE;}
+ }
+ /////////////////////////
+
+ //Double_t vtxX=vtxESD->GetX();
+ //Double_t vtxY=vtxESD->GetY();
+ //Double_t vtxZ=vtxESD->GetZ();
+
+ AliESDVertex* pvtxESD = (AliESDVertex*)vtxESD->Clone();
+ AliESDtrack* ptrack=(AliESDtrack*)track->Clone();
+ AliExternalTrackParam* ptpcInnerC = (AliExternalTrackParam*)tpcInnerC->Clone();
+ AliExternalTrackParam* ptrackInnerC = (AliExternalTrackParam*)trackInnerC->Clone();
+ AliExternalTrackParam* ptrackInnerC2 = (AliExternalTrackParam*)trackInnerC2->Clone();
+ AliExternalTrackParam* pouterITSc = (AliExternalTrackParam*)outerITSc->Clone();
+ AliExternalTrackParam* ptrackInnerC3 = (AliExternalTrackParam*)trackInnerC3->Clone();
+ Int_t ntracks = esdEvent->GetNumberOfTracks();
+
+ // fill histograms
+ FillHistograms(ptrack, ptpcInnerC, centralityF, (Double_t)chi2(0,0));
+
+ if(fTreeSRedirector && dumpToTree && fFillTree)
+ {
+
+ (*fTreeSRedirector)<<"highPt"<<
+ "fileName.="<<&fileName<< // name of the chunk file (hopefully full)
+ "runNumber="<<runNumber<< // runNumber
+ "evtTimeStamp="<<evtTimeStamp<< // time stamp of event (in seconds)
+ "evtNumberInFile="<<evtNumberInFile<< // event number
+ "triggerClass="<<&triggerClass<< // trigger class as a string
+ "Bz="<<bz<< // solenoid magnetic field in the z direction (in kGaus)
+ "vtxESD.="<<pvtxESD<< // vertexer ESD tracks (can be biased by TPC pileup tracks)
+ //"vtxESDx="<<vtxX<<
+ //"vtxESDy="<<vtxY<<
+ //"vtxESDz="<<vtxZ<<
+ "IRtot="<<ir1<< // interaction record (trigger) counters - coutner 1
+ "IRint2="<<ir2<< // interaction record (trigger) coutners - counter 2
+ "mult="<<mult<< // multiplicity of tracks pointing to the primary vertex
+ "ntracks="<<ntracks<< // number of the esd tracks (to take into account the pileup in the TPC)
+ // important variables for the pile-up studies
+ "contTPC="<< contTPC<< // number of contributors to the TPC primary vertex candidate
+ "contSPD="<< contSPD<< // number of contributors to the SPD primary vertex candidate
+ "vertexPosTPC.="<<&vertexPosTPC<< // TPC vertex position
+ "vertexPosSPD.="<<&vertexPosSPD<< // SPD vertex position
+ "ntracksTPC="<<ntracksTPC<< // total number of the TPC tracks which were refitted
+ "ntracksITS="<<ntracksITS<< // total number of the ITS tracks which were refitted
+ //
+ "esdTrack.="<<ptrack<< // esdTrack as used in the physical analysis
+ "extTPCInnerC.="<<ptpcInnerC<< // ???
+ "extInnerParamC.="<<ptrackInnerC<< // ???
+ "extInnerParam.="<<ptrackInnerC2<< // ???
+ "extOuterITS.="<<pouterITSc<< // ???
+ "extInnerParamRef.="<<ptrackInnerC3<< // ???
+ "chi2TPCInnerC="<<chi2(0,0)<< // chi2 of tracks ???
+ "chi2InnerC="<<chi2trackC(0,0)<< // chi2s of tracks TPCinner to the combined
+ "chi2OuterITS="<<chi2OuterITS(0,0)<< // chi2s of tracks TPC at inner wall to the ITSout
+ "centralityF="<<centralityF;
+ if (mcEvent)
+ {
+ AliTrackReference refDummy;
+ if (!refITS) refITS = &refDummy;
+ if (!refTRD) refTRD = &refDummy;
+ if (!refTOF) refTOF = &refDummy;
+ if (!refEMCAL) refEMCAL = &refDummy;
+ if (!refPHOS) refPHOS = &refDummy;
+ (*fTreeSRedirector)<<"highPt"<<
+ "multMCTrueTracks="<<multMCTrueTracks<< // mC track multiplicities
+ "nrefITS="<<nrefITS<< // number of track references in the ITS
+ "nrefTPC="<<nrefTPC<< // number of track references in the TPC
+ "nrefTRD="<<nrefTRD<< // number of track references in the TRD
+ "nrefTOF="<<nrefTOF<< // number of track references in the TOF
+ "nrefEMCAL="<<nrefEMCAL<< // number of track references in the TOF
+ "nrefPHOS="<<nrefPHOS<< // number of track references in the TOF
+ "refTPCIn.="<<refTPCIn<<
+ "refTPCOut.="<<refTPCOut<<
+ "refITS.="<<refITS<<
+ "refTRD.="<<refTRD<<
+ "refTOF.="<<refTOF<<
+ "refEMCAL.="<<refEMCAL<<
+ "refPHOS.="<<refPHOS<<
+ "particle.="<<particle<<
+ "particleMother.="<<particleMother<<
+ "mech="<<mech<<
+ "isPrim="<<isPrim<<
+ "isFromStrangess="<<isFromStrangess<<
+ "isFromConversion="<<isFromConversion<<
+ "isFromMaterial="<<isFromMaterial<<
+ "particleTPC.="<<particleTPC<<
+ "particleMotherTPC.="<<particleMotherTPC<<
+ "mechTPC="<<mechTPC<<
+ "isPrimTPC="<<isPrimTPC<<
+ "isFromStrangessTPC="<<isFromStrangessTPC<<
+ "isFromConversionTPC="<<isFromConversionTPC<<
+ "isFromMaterialTPC="<<isFromMaterialTPC<<
+ "particleITS.="<<particleITS<<
+ "particleMotherITS.="<<particleMotherITS<<
+ "mechITS="<<mechITS<<
+ "isPrimITS="<<isPrimITS<<
+ "isFromStrangessITS="<<isFromStrangessITS<<
+ "isFromConversionITS="<<isFromConversionITS<<
+ "isFromMaterialITS="<<isFromMaterialITS;
+ }
+ //finish writing the entry
+ AliInfo("writing tree highPt");
+ (*fTreeSRedirector)<<"highPt"<<"\n";
+ }
+
+ delete pvtxESD;
+ delete ptrack;
+ delete ptpcInnerC;
+ delete ptrackInnerC;
+ delete ptrackInnerC2;
+ delete pouterITSc;
+ delete ptrackInnerC3;
+
+ ////////////////////
+ //delete the dummy objects we might have created.
+ if (newvtxESD) {delete vtxESD; vtxESD=NULL;}
+ if (newtrack) {delete track; track=NULL;}
+ if (newtpcInnerC) {delete tpcInnerC; tpcInnerC=NULL;}
+ if (newtrackInnerC) {delete trackInnerC; trackInnerC=NULL;}
+ if (newtrackInnerC2) {delete trackInnerC2; trackInnerC2=NULL;}
+ if (newouterITSc) {delete outerITSc; outerITSc=NULL;}
+ if (newtrackInnerC3) {delete trackInnerC3; trackInnerC3=NULL;}
+ if (newrefTPCIn) {delete refTPCIn; refTPCIn=NULL;}
+ if (newrefITS) {delete refITS; refITS=NULL;}
+ if (newparticle) {delete particle; particle=NULL;}
+ if (newparticleMother) {delete particleMother; particleMother=NULL;}
+ if (newparticleTPC) {delete particleTPC; particleTPC=NULL;}
+ if (newparticleMotherTPC) {delete particleMotherTPC; particleMotherTPC=NULL;}
+ if (newparticleITS) {delete particleITS; particleITS=NULL;}
+ if (newparticleMotherITS) {delete particleMotherITS; particleMotherITS=NULL;}
+ ///////////////
+
+ delete tpcInnerC;
+ delete trackInnerC;
+ delete trackInnerC2;
+ delete outerITSc;
+ delete trackInnerC3;
+ }
+ }
+
+}
+
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::ProcessMCEff(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
+{
+ //
+ // Fill tree for efficiency studies MC only
+ AliInfo("we start!");
+
+ if(!esdEvent) {
+ AliDebug(AliLog::kError, "esdEvent not available");
+ return;
+ }
+
+ if(!mcEvent) {
+ AliDebug(AliLog::kError, "mcEvent not available");
+ return;
+ }
+
+ // get selection cuts
+ AliFilteredTreeEventCuts *evtCuts = GetEventCuts();
+ AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts();
+ AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
+
+ if(!evtCuts || !accCuts || !esdTrackCuts) {
+ AliDebug(AliLog::kError, "cuts not available");
+ return;
+ }
+
+ // trigger selection
+ Bool_t isEventTriggered = kTRUE;
+ AliPhysicsSelection *physicsSelection = NULL;
+ AliTriggerAnalysis* triggerAnalysis = NULL;
+
+ //
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (!inputHandler)
+ {
+ Printf("ERROR: Could not receive input handler");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+ // trigger
+ if(evtCuts->IsTriggerRequired())
+ {
+ // always MB
+ isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
+
+ physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
+ if(!physicsSelection) return;
+
+ if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
+ // set trigger (V0AND)
+ triggerAnalysis = physicsSelection->GetTriggerAnalysis();
+ if(!triggerAnalysis) return;
+ isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
+ }
+ }
+
+ // centrality determination
+ Float_t centralityF = -1;
+ AliCentrality *esdCentrality = esdEvent->GetCentrality();
+ centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
+
+ // use MC information
+ AliHeader* header = 0;
+ AliGenEventHeader* genHeader = 0;
+ AliStack* stack = 0;
+ Int_t mcStackSize=0;
+ TArrayF vtxMC(3);
+
+ Int_t multMCTrueTracks = 0;
+ //
+ if(!mcEvent) {
+ AliDebug(AliLog::kError, "mcEvent not available");
+ return;
+ }
+ // get MC event header
+ header = mcEvent->Header();
+ if (!header) {
+ AliDebug(AliLog::kError, "Header not available");
+ return;
+ }
+ // MC particle stack
+ stack = mcEvent->Stack();
+ if (!stack) {
+ AliDebug(AliLog::kError, "Stack not available");
+ return;
+ }
+ mcStackSize=stack->GetNtrack();
+
+ // get MC vertex
+ genHeader = header->GenEventHeader();
+ if (!genHeader) {
+ AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
+ return;
+ }
+ genHeader->PrimaryVertex(vtxMC);
+
+ // multipliticy of all MC primary tracks
+ // in Zv, pt and eta ranges)
+ multMCTrueTracks = GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
+
+
+ // get reconstructed vertex
+ //const AliESDVertex* vtxESD = 0;
+ AliESDVertex* vtxESD = 0;
+ if(GetAnalysisMode() == kTPCAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
+ }
+ else if(GetAnalysisMode() == kTPCITSAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
+ }
+ else {
+ return;
+ }
+
+ if(!vtxESD) return;
+ //
+ // Vertex info comparison and track multiplicity
+ //
+ AliESDVertex *vertexSPD = (AliESDVertex *)esdEvent->GetPrimaryVertexSPD();
+ AliESDVertex *vertexTPC = (AliESDVertex *)esdEvent->GetPrimaryVertexTPC();
+ Int_t contSPD = vertexSPD->GetNContributors();
+ Int_t contTPC = vertexTPC->GetNContributors();
+ TVectorD vertexPosTPC(3), vertexPosSPD(3);
+ vertexSPD->GetXYZ(vertexPosSPD.GetMatrixArray());
+ vertexTPC->GetXYZ(vertexPosTPC.GetMatrixArray());
+ Int_t ntracksTPC=0;
+ Int_t ntracksITS=0;
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++){
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+ if (track->IsOn(AliVTrack::kTPCrefit)) ntracksTPC++;
+ if (track->IsOn(AliVTrack::kITSrefit)) ntracksITS++;
+ }
+
+ Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
+ //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
+ //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
+
+ TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();
+
+ // check event cuts
+ if(isEventOK && isEventTriggered)
+ {
+ //if(!stack) return;
+
+ //
+ // MC info
+ //
+ TParticle *particle=NULL;
+ TParticle *particleMother=NULL;
+ Int_t mech=-1;
+
+ // reco event info
+ Double_t vert[3] = {0};
+ vert[0] = vtxESD->GetXv();
+ vert[1] = vtxESD->GetYv();
+ vert[2] = vtxESD->GetZv();
+ Int_t mult = vtxESD->GetNContributors();
+ Double_t bz = esdEvent->GetMagneticField();
+ Double_t runNumber = esdEvent->GetRunNumber();
+ Double_t evtTimeStamp = esdEvent->GetTimeStamp();
+ Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
+ // loop over MC stack
+ for (Int_t iMc = 0; iMc < mcStackSize; ++iMc)
+ {
+ particle = stack->Particle(iMc);
+ if (!particle)
+ continue;
+
+ // only charged particles
+ if(!particle->GetPDG()) continue;
+ Double_t charge = particle->GetPDG()->Charge()/3.;
+ if (TMath::Abs(charge) < 0.001)
+ continue;
+
+ // only primary particles
+ Bool_t prim = stack->IsPhysicalPrimary(iMc);
+ if(!prim) continue;
+
+ // downscale low-pT particles
+ Double_t scalempt= TMath::Min(particle->Pt(),10.);
+ Double_t downscaleF = gRandom->Rndm();
+ downscaleF *= fLowPtTrackDownscaligF;
+ if(TMath::Exp(2*scalempt)<downscaleF) continue;
+
+ // is particle in acceptance
+ if(!accCuts->AcceptTrack(particle)) continue;
+
+ // check if particle reconstructed
+ Bool_t isRec = kFALSE;
+ Int_t trackIndex = -1;
+ Int_t trackLoopIndex = -1;
+ Int_t isESDtrackCut= 0;
+ Int_t isAccCuts = 0;
+ Int_t nRec = 0; // how many times reconstructed
+ Int_t nFakes = 0; // how many times reconstructed as a fake track
+ AliESDtrack *recTrack = NULL;
+
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
+ {
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+ if(track->Charge()==0) continue;
+ //
+ Int_t label = TMath::Abs(track->GetLabel());
+ if (label >= mcStackSize) continue;
+ if(label == iMc) {
+ Bool_t isAcc=esdTrackCuts->AcceptTrack(track);
+ if (isAcc) isESDtrackCut=1;
+ if (accCuts->AcceptTrack(track)) isAccCuts=1;
+ isRec = kTRUE;
+ trackIndex = iTrack;
+
+ if (recTrack){
+ if (track->GetTPCncls()<recTrack->GetTPCncls()) continue; // in case looper tracks use longer track
+ if (!isAcc) continue;
+ trackLoopIndex = iTrack;
+ }
+ recTrack = esdEvent->GetTrack(trackIndex);
+ nRec++;
+ if(track->GetLabel()<0) nFakes++;
+
+ continue;
+ }
+ }
+
+ // Store information in the output tree
+ if (trackLoopIndex>-1) {
+ recTrack = esdEvent->GetTrack(trackLoopIndex);
+ } else if (trackIndex >-1) {
+ recTrack = esdEvent->GetTrack(trackIndex);
+ } else {
+ recTrack = new AliESDtrack();
+ }
+
+ particleMother = GetMother(particle,stack);
+ mech = particle->GetUniqueID();
+
+ //MC particle track length
+ Double_t tpcTrackLength = 0.;
+ AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(iMc);
+ if(mcParticle) {
+ Int_t counter;
+ tpcTrackLength = mcParticle->GetTPCTrackLength(bz,0.05,counter,3.0);
+ }
+
+
+ //
+ if(fTreeSRedirector && fFillTree) {
+ (*fTreeSRedirector)<<"MCEffTree"<<
+ "fileName.="<<&fileName<<
+ "triggerClass.="<<&triggerClass<<
+ "runNumber="<<runNumber<<
+ "evtTimeStamp="<<evtTimeStamp<<
+ "evtNumberInFile="<<evtNumberInFile<< //
+ "Bz="<<bz<< // magnetic field
+ "vtxESD.="<<vtxESD<< // vertex info
+ //
+ "mult="<<mult<< // primary vertex 9whatewe found) multiplicity
+ "multMCTrueTracks="<<multMCTrueTracks<< // mC track multiplicities
+ // important variables for the pile-up studies
+ "contTPC="<< contTPC<< // number of contributors to the TPC primary vertex candidate
+ "contSPD="<< contSPD<< // number of contributors to the SPD primary vertex candidate
+ "vertexPosTPC.="<<&vertexPosTPC<< // TPC vertex position
+ "vertexPosSPD.="<<&vertexPosSPD<< // SPD vertex position
+ "ntracksTPC="<<ntracksTPC<< // total number of the TPC tracks which were refitted
+ "ntracksITS="<<ntracksITS<< // total number of the ITS tracks which were refitted
+ //
+ //
+ "isAcc0="<<isESDtrackCut<< // track accepted by ESD track cuts
+ "isAcc1="<<isAccCuts<< // track accepted by acceptance cuts flag
+ "esdTrack.="<<recTrack<< // reconstructed track (only the longest from the loopers)
+ "isRec="<<isRec<< // track was reconstructed
+ "tpcTrackLength="<<tpcTrackLength<< // track length in the TPC r projection
+ "particle.="<<particle<< // particle properties
+ "particleMother.="<<particleMother<< // particle mother
+ "mech="<<mech<< // production mechanizm
+ "nRec="<<nRec<< // how many times reconstruted
+ "nFakes="<<nFakes<< // how many times reconstructed as a fake track
+ "\n";
+ }
+
+ if(trackIndex <0 && recTrack) delete recTrack; recTrack=0;
+ }
+ }
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::IsHighDeDxParticle(AliESDtrack * track) {
+ //
+ // check if particle is Z > 1
+ //
+ if (track->GetTPCNcls() < 60) return kFALSE;
+ Double_t mom = track->GetInnerParam()->GetP();
+ if (mom < 0.2) return kFALSE; // protection against unexpected behavior of Aleph parameterization
+ Float_t dca[2], bCov[3];
+ track->GetImpactParameters(dca,bCov);
+ //
+
+ Double_t triggerDeDx = 4*AliExternalTrackParam::BetheBlochAleph((mom*2)/(0.938*3),1.0288,31.9806,5.04114e-11,2.13096,2.38541);
+
+ if (track->GetTPCsignal() > triggerDeDx && track->GetTPCsignal()<1000 && TMath::Abs(dca[0])<3.) return kTRUE;
+
+ return kFALSE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::ProcessV0(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
+{
+ //
+ // Select real events with V0 (K0s and Lambda and Gamma) high-pT candidates
+ //
+ if(!esdEvent) {
+ AliDebug(AliLog::kError, "esdEvent not available");
+ return;
+ }
+
+ // get selection cuts
+ AliFilteredTreeEventCuts *evtCuts = GetEventCuts();
+ AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts();
+ AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
+
+ if(!evtCuts || !accCuts || !esdTrackCuts) {
+ AliDebug(AliLog::kError, "cuts not available");
+ return;
+ }
+
+ // trigger selection
+ Bool_t isEventTriggered = kTRUE;
+ AliPhysicsSelection *physicsSelection = NULL;
+ AliTriggerAnalysis* triggerAnalysis = NULL;
+
+ //
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (!inputHandler)
+ {
+ Printf("ERROR: Could not receive input handler");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+ // trigger
+ if(evtCuts->IsTriggerRequired())
+ {
+ // always MB
+ isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
+
+ physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
+ if(!physicsSelection) return;
+ //SetPhysicsTriggerSelection(physicsSelection);
+
+ if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
+ // set trigger (V0AND)
+ triggerAnalysis = physicsSelection->GetTriggerAnalysis();
+ if(!triggerAnalysis) return;
+ isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
+ }
+ }
+
+ // centrality determination
+ Float_t centralityF = -1;
+ AliCentrality *esdCentrality = esdEvent->GetCentrality();
+ centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
+
+
+ // get reconstructed vertex
+ //const AliESDVertex* vtxESD = 0;
+ AliESDVertex* vtxESD = 0;
+ if(GetAnalysisMode() == kTPCAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
+ }
+ else if(GetAnalysisMode() == kTPCITSAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
+ }
+ else {
+ return;
+ }
+
+ if(!vtxESD) return;
+
+ Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
+ //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
+ //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
+
+ // check event cuts
+ if(isEventOK && isEventTriggered) {
+ //
+ // Dump the pt downscaled V0 into the tree
+ //
+ Int_t ntracks = esdEvent->GetNumberOfTracks();
+ Int_t nV0s = esdEvent->GetNumberOfV0s();
+ Int_t run = esdEvent->GetRunNumber();
+ Int_t time= esdEvent->GetTimeStamp();
+ Int_t evNr=esdEvent->GetEventNumberInFile();
+ Double_t bz = esdEvent->GetMagneticField();
+
+
+ for (Int_t iv0=0; iv0<nV0s; iv0++){
+ AliESDv0 * v0 = esdEvent->GetV0(iv0);
+ if (!v0) continue;
+ AliESDtrack * track0 = esdEvent->GetTrack(v0->GetIndex(0));
+ AliESDtrack * track1 = esdEvent->GetTrack(v0->GetIndex(1));
+ if (!track0) continue;
+ if (!track1) continue;
+ if (track0->GetSign()<0) {
+ track1 = esdEvent->GetTrack(v0->GetIndex(0));
+ track0 = esdEvent->GetTrack(v0->GetIndex(1));
+ }
+ //
+ Bool_t isDownscaled = IsV0Downscaled(v0);
+ if (isDownscaled) continue;
+ AliKFParticle kfparticle; //
+ Int_t type=GetKFParticle(v0,esdEvent,kfparticle);
+ if (type==0) continue;
+ TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();
+
+ if(!fFillTree) return;
+ if(!fTreeSRedirector) return;
+ (*fTreeSRedirector)<<"V0s"<<
+ "isDownscaled="<<isDownscaled<<
+ "triggerClass="<<&triggerClass<< // trigger
+ "Bz="<<bz<<
+ "fileName.="<<&fileName<<
+ "runNumber="<<run<<
+ "evtTimeStamp="<<time<<
+ "evtNumberInFile="<<evNr<<
+ "type="<<type<<
+ "ntracks="<<ntracks<<
+ "v0.="<<v0<<
+ "kf.="<<&kfparticle<<
+ "track0.="<<track0<<
+ "track1.="<<track1<<
+ "centralityF="<<centralityF<<
+ "\n";
+ }
+ }
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::ProcessdEdx(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent, AliESDfriend *const /*esdFriend*/)
+{
+ //
+ // Select real events with large TPC dEdx signal
+ //
+ if(!esdEvent) {
+ AliDebug(AliLog::kError, "esdEvent not available");
+ return;
+ }
+
+ // get selection cuts
+ AliFilteredTreeEventCuts *evtCuts = GetEventCuts();
+ AliFilteredTreeAcceptanceCuts *accCuts = GetAcceptanceCuts();
+ AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
+
+ if(!evtCuts || !accCuts || !esdTrackCuts) {
+ AliDebug(AliLog::kError, "cuts not available");
+ return;
+ }
+
+ // get file name
+ TTree *chain = (TChain*)GetInputData(0);
+ if(!chain) {
+ Printf("ERROR: Could not receive input chain");
+ return;
+ }
+ TObjString fileName(chain->GetCurrentFile()->GetName());
+
+ // trigger
+ Bool_t isEventTriggered = kTRUE;
+ AliPhysicsSelection *physicsSelection = NULL;
+ AliTriggerAnalysis* triggerAnalysis = NULL;
+
+ //
+ AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
+ if (!inputHandler)
+ {
+ Printf("ERROR: Could not receive input handler");
+ return;
+ }
+
+ if(evtCuts->IsTriggerRequired())
+ {
+ // always MB
+ isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
+
+ physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
+ if(!physicsSelection) return;
+
+ if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
+ // set trigger (V0AND)
+ triggerAnalysis = physicsSelection->GetTriggerAnalysis();
+ if(!triggerAnalysis) return;
+ isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
+ }
+ }
+
+ // get reconstructed vertex
+ AliESDVertex* vtxESD = 0;
+ if(GetAnalysisMode() == kTPCAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTPC();
+ }
+ else if(GetAnalysisMode() == kTPCITSAnalysisMode) {
+ vtxESD = (AliESDVertex*)esdEvent->GetPrimaryVertexTracks();
+ }
+ else {
+ return;
+ }
+ if(!vtxESD) return;
+
+ Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
+ //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
+ //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
+
+
+ // check event cuts
+ if(isEventOK && isEventTriggered)
+ {
+ Double_t vert[3] = {0};
+ vert[0] = vtxESD->GetXv();
+ vert[1] = vtxESD->GetYv();
+ vert[2] = vtxESD->GetZv();
+ Int_t mult = vtxESD->GetNContributors();
+ Double_t bz = esdEvent->GetMagneticField();
+ Double_t runNumber = esdEvent->GetRunNumber();
+ Double_t evtTimeStamp = esdEvent->GetTimeStamp();
+ Int_t evtNumberInFile = esdEvent->GetEventNumberInFile();
+
+ // large dEdx
+ for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++)
+ {
+ AliESDtrack *track = esdEvent->GetTrack(iTrack);
+ if(!track) continue;
+ if(track->Charge()==0) continue;
+ if(!esdTrackCuts->AcceptTrack(track)) continue;
+ if(!accCuts->AcceptTrack(track)) continue;
+
+ if(!IsHighDeDxParticle(track)) continue;
+ TObjString triggerClass = esdEvent->GetFiredTriggerClasses().Data();
+
+ if(!fFillTree) return;
+ if(!fTreeSRedirector) return;
+ (*fTreeSRedirector)<<"dEdx"<<
+ "fileName.="<<&fileName<<
+ "runNumber="<<runNumber<<
+ "evtTimeStamp="<<evtTimeStamp<<
+ "evtNumberInFile="<<evtNumberInFile<<
+ "triggerClass="<<&triggerClass<< // trigger
+ "Bz="<<bz<<
+ "vtxESD.="<<vtxESD<<
+ "mult="<<mult<<
+ "esdTrack.="<<track<<
+ "\n";
+ }
+ }
+}
+
+//_____________________________________________________________________________
+Int_t AliAnalysisTaskFilteredTree::GetKFParticle(AliESDv0 *const v0, AliESDEvent * const event, AliKFParticle & kfparticle)
+{
+ //
+ // Create KF particle in case the V0 fullfill selection criteria
+ //
+ // Selection criteria
+ // 0. algorithm cut
+ // 1. track cut
+ // 3. chi2 cut
+ // 4. rough mass cut
+ // 5. Normalized pointing angle cut
+ //
+ const Double_t cutMass=0.2;
+ const Double_t kSigmaDCACut=3;
+ //
+ // 0.) algo cut - accept only on the fly
+ //
+ if (v0->GetOnFlyStatus() ==kFALSE) return 0;
+ //
+ // 1.) track cut
+ //
+ AliESDtrack * track0 = event->GetTrack(v0->GetIndex(0));
+ AliESDtrack * track1 = event->GetTrack(v0->GetIndex(1));
+ /*
+ TCut cutD="abs(track0.fD/sqrt(track0.fCdd))>2&&abs(track1.fD/sqrt(track1.fCdd))>2";
+ TCut cutTheta="abs(track0.fP[3])<1&&abs(track1.fP[3])<1";
+ TCut cutNcl="track0.GetTPCClusterInfo(2,1)>100&&track1.GetTPCClusterInfo(2,1)>100";
+ */
+ if (TMath::Abs(track0->GetTgl())>1) return 0;
+ if (TMath::Abs(track1->GetTgl())>1) return 0;
+ if ((track0->GetTPCClusterInfo(2,1))<100) return 0;
+ if ((track1->GetTPCClusterInfo(2,1))<100) return 0;
+ //if ((track0->GetITSclusters(0))<2) return 0;
+ //if ((track1->GetITSclusters(0))<2) return 0;
+ Float_t pos0[2]={0}, cov0[3]={0};
+ Float_t pos1[2]={0}, cov1[3]={0};
+ track0->GetImpactParameters(pos0,cov0);
+ track0->GetImpactParameters(pos1,cov1);
+ //
+ if (TMath::Abs(pos0[0])<kSigmaDCACut*TMath::Sqrt(cov0[0])) return 0;
+ if (TMath::Abs(pos1[0])<kSigmaDCACut*TMath::Sqrt(cov1[0])) return 0;
+ //
+ //
+ // 3.) Chi2 cut
+ //
+ Double_t chi2KF = v0->GetKFInfo(2,2,2);
+ if (chi2KF>25) return 0;
+ //
+ // 4.) Rough mass cut - 0.200 GeV
+ //
+ static Double_t masses[2]={-1};
+ if (masses[0]<0){
+ masses[0] = TDatabasePDG::Instance()->GetParticle("K_S0")->Mass();
+ masses[1] = TDatabasePDG::Instance()->GetParticle("Lambda0")->Mass();
+ }
+ Double_t mass00= v0->GetEffMass(0,0);
+ Double_t mass22= v0->GetEffMass(2,2);
+ Double_t mass42= v0->GetEffMass(4,2);
+ Double_t mass24= v0->GetEffMass(2,4);
+ Bool_t massOK=kFALSE;
+ Int_t type=0;
+ Int_t ptype=0;
+ Double_t dmass=1;
+ Int_t p1=0, p2=0;
+ if (TMath::Abs(mass00-0)<cutMass) {
+ massOK=kTRUE; type+=1;
+ if (TMath::Abs(mass00-0)<dmass) {
+ ptype=1;
+ dmass=TMath::Abs(mass00-0);
+ p1=0; p2=0;
+ }
+ }
+ if (TMath::Abs(mass24-masses[1])<cutMass) {
+ massOK=kTRUE; type+=2;
+ if (TMath::Abs(mass24-masses[1])<dmass){
+ dmass = TMath::Abs(mass24-masses[1]);
+ ptype=2;
+ p1=2; p2=4;
+ }
+ }
+ if (TMath::Abs(mass42-masses[1])<cutMass) {
+ massOK=kTRUE; type+=4;
+ if (TMath::Abs(mass42-masses[1])<dmass){
+ dmass = TMath::Abs(mass42-masses[1]);
+ ptype=4;
+ p1=4; p2=2;
+ }
+ }
+ if (TMath::Abs(mass22-masses[0])<cutMass) {
+ massOK=kTRUE; type+=8;
+ if (TMath::Abs(mass22-masses[0])<dmass){
+ dmass = TMath::Abs(mass22-masses[0]);
+ ptype=8;
+ p1=2; p2=2;
+ }
+ }
+ if (type==0) return 0;
+ //
+ const Int_t spdg[5]={kPositron,kMuonPlus,kPiPlus, kKPlus, kProton};
+ const AliExternalTrackParam *paramP = v0->GetParamP();
+ const AliExternalTrackParam *paramN = v0->GetParamN();
+ if (paramP->GetSign()<0){
+ paramP=v0->GetParamP();
+ paramN=v0->GetParamN();
+ }
+ //Double_t *pparam1 = (Double_t*)paramP->GetParameter();
+ //Double_t *pparam2 = (Double_t*)paramN->GetParameter();
+ //
+ AliKFParticle kfp1( *paramP, spdg[p1] );
+ AliKFParticle kfp2( *paramN, -1 *spdg[p2] );
+ AliKFParticle V0KF;
+ (V0KF)+=kfp1;
+ (V0KF)+=kfp2;
+ kfparticle=V0KF;
+ //
+ // Pointing angle
+ //
+ Double_t errPhi = V0KF.GetErrPhi();
+ Double_t pointAngle= TMath::ACos(v0->GetV0CosineOfPointingAngle());
+ if (pointAngle/errPhi>10) return 0;
+ //
+ return ptype;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::IsV0Downscaled(AliESDv0 *const v0)
+{
+ //
+ // Downscale randomly low pt V0
+ //
+ //return kFALSE;
+ Double_t maxPt= TMath::Max(v0->GetParamP()->Pt(), v0->GetParamN()->Pt());
+ Double_t scalempt= TMath::Min(maxPt,10.);
+ Double_t downscaleF = gRandom->Rndm();
+ downscaleF *= fLowPtV0DownscaligF;
+ //
+ // Special treatment of the gamma conversion pt spectra is softer -
+ Double_t mass00= v0->GetEffMass(0,0);
+ const Double_t cutMass=0.2;
+ if (TMath::Abs(mass00-0)<cutMass){
+ downscaleF/=10.; // 10 times smaller downscaling for the gamma concersion candidate
+ }
+ //printf("V0 TMath::Exp(2*scalempt) %e, downscaleF %e \n",TMath::Exp(2*scalempt), downscaleF);
+ if (TMath::Exp(2*scalempt)<downscaleF) return kTRUE;
+ return kFALSE;
+
+ /*
+ TH1F his1("his1","his1",100,0,10);
+ TH1F his2("his2","his2",100,0,10);
+ {for (Int_t i=0; i<10000; i++){
+ Double_t rnd=gRandom->Exp(1);
+ Bool_t isDownscaled =TMath::Exp(rnd)<100*gRandom->Rndm();
+ his1->Fill(rnd);
+ if (!isDownscaled) his2->Fill(rnd);
+ }}
+
+ */
+
+}
+
+
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::ConstrainTPCInner(AliExternalTrackParam *const tpcInnerC, const AliESDVertex* vtx, Double_t b[3])
+{
+ // Constrain TPC inner params constrained
+ //
+ if(!tpcInnerC) return kFALSE;
+ if(!vtx) return kFALSE;
+
+ Double_t dz[2],cov[3];
+ //AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();
+ //if(!tpcInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov)) return kFALSE;
+ //if(!tpcInnerC->PropagateToDCA(vtx, Bz, 3, dz, cov)) return kFALSE;
+ if(!tpcInnerC->PropagateToDCABxByBz(vtx, b, 3, dz, cov)) return kFALSE;
+
+
+ Double_t covar[6]; vtx->GetCovMatrix(covar);
+ Double_t p[2]={tpcInnerC->GetParameter()[0]-dz[0],tpcInnerC->GetParameter()[1]-dz[1]};
+ Double_t c[3]={covar[2],0.,covar[5]};
+ Double_t chi2C=tpcInnerC->GetPredictedChi2(p,c);
+ if (chi2C>kVeryBig) return kFALSE;
+
+ if(!tpcInnerC->Update(p,c)) return kFALSE;
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::ConstrainTrackInner(AliExternalTrackParam *const trackInnerC, const AliESDVertex* vtx, Double_t mass, Double_t b[3])
+{
+ // Constrain TPC inner params constrained
+ //
+ if(!trackInnerC) return kFALSE;
+ if(!vtx) return kFALSE;
+
+ const Double_t kRadius = 2.8;
+ const Double_t kMaxStep = 1.0;
+
+ Double_t dz[2],cov[3];
+
+ //AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();
+ //if(!trackInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov)) return kFALSE;
+ //if(!trackInnerC->PropagateToDCA(vtx, Bz, 3, dz, cov)) return kFALSE;
+
+ if(!AliTracker::PropagateTrackToBxByBz(trackInnerC,kRadius,mass,kMaxStep,kFALSE)) return kFALSE;
+ if(!trackInnerC->PropagateToDCABxByBz(vtx, b, 3, dz, cov)) return kFALSE;
+
+ //
+ Double_t covar[6]; vtx->GetCovMatrix(covar);
+ Double_t p[2]={trackInnerC->GetParameter()[0]-dz[0],trackInnerC->GetParameter()[1]-dz[1]};
+ Double_t c[3]={covar[2],0.,covar[5]};
+ Double_t chi2C=trackInnerC->GetPredictedChi2(p,c);
+ if (chi2C>kVeryBig) return kFALSE;
+
+ if(!trackInnerC->Update(p,c)) return kFALSE;
+
+ return kTRUE;
+}
+
+
+//_____________________________________________________________________________
+TParticle *AliAnalysisTaskFilteredTree::GetMother(TParticle *const particle, AliStack *const stack)
+{
+ if(!particle) return NULL;
+ if(!stack) return NULL;
+
+ Int_t motherLabel = TMath::Abs(particle->GetMother(0));
+ TParticle* mother = NULL;
+ Int_t mcStackSize=stack->GetNtrack();
+ if (motherLabel>=mcStackSize) return NULL;
+ mother = stack->Particle(motherLabel);
+
+return mother;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::IsFromConversion(const Int_t label, AliStack *const stack)
+{
+ Bool_t isFromConversion = kFALSE;
+
+ if(stack) {
+ Int_t mcStackSize=stack->GetNtrack();
+ if (label>=mcStackSize) return kFALSE;
+ TParticle* particle = stack->Particle(label);
+ if (!particle) return kFALSE;
+
+ if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0)
+ {
+ Int_t mech = particle->GetUniqueID(); // production mechanism
+ Bool_t isPrim = stack->IsPhysicalPrimary(label);
+
+ Int_t motherLabel = TMath::Abs(particle->GetMother(0));
+ if (motherLabel>=mcStackSize) return kFALSE;
+ TParticle* mother = stack->Particle(motherLabel);
+ if(mother) {
+ Int_t motherPdg = mother->GetPdgCode();
+
+ if(!isPrim && mech==5 && motherPdg==kGamma) {
+ isFromConversion=kTRUE;
+ }
+ }
+ }
+ }
+
+ return isFromConversion;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::IsFromMaterial(const Int_t label, AliStack *const stack)
+{
+ Bool_t isFromMaterial = kFALSE;
+
+ if(stack) {
+ Int_t mcStackSize=stack->GetNtrack();
+ if (label>=mcStackSize) return kFALSE;
+ TParticle* particle = stack->Particle(label);
+ if (!particle) return kFALSE;
+
+ if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0)
+ {
+ Int_t mech = particle->GetUniqueID(); // production mechanism
+ Bool_t isPrim = stack->IsPhysicalPrimary(label);
+
+ Int_t motherLabel = TMath::Abs(particle->GetMother(0));
+ if (motherLabel>=mcStackSize) return kFALSE;
+ TParticle* mother = stack->Particle(motherLabel);
+ if(mother) {
+ if(!isPrim && mech==13) {
+ isFromMaterial=kTRUE;
+ }
+ }
+ }
+ }
+
+ return isFromMaterial;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFilteredTree::IsFromStrangeness(const Int_t label, AliStack *const stack)
+{
+ Bool_t isFromStrangeness = kFALSE;
+
+ if(stack) {
+ Int_t mcStackSize=stack->GetNtrack();
+ if (label>=mcStackSize) return kFALSE;
+ TParticle* particle = stack->Particle(label);
+ if (!particle) return kFALSE;
+
+ if(particle && particle->GetPDG() && particle->GetPDG()->Charge()!=0)
+ {
+ Int_t mech = particle->GetUniqueID(); // production mechanism
+ Bool_t isPrim = stack->IsPhysicalPrimary(label);
+
+ Int_t motherLabel = TMath::Abs(particle->GetMother(0));
+ if (motherLabel>=mcStackSize) return kFALSE;
+ TParticle* mother = stack->Particle(motherLabel);
+ if(mother) {
+ Int_t motherPdg = mother->GetPdgCode();
+
+ // K+-, lambda, antilambda, K0s decays
+ if(!isPrim && mech==4 &&
+ (TMath::Abs(motherPdg)==kKPlus || TMath::Abs(motherPdg)==kLambda0 || motherPdg==kK0Short))
+ {
+ isFromStrangeness = kTRUE;
+ }
+ }
+ }
+ }
+
+ return isFromStrangeness;
+}
+
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::FinishTaskOutput()
+{
+ //
+ // Called one at the end
+ // locally on working node
+ //
+
+ //// must be deleted to store trees
+ //if(fTreeSRedirector) delete fTreeSRedirector; fTreeSRedirector=0;
+
+ //// open temporary file and copy trees to the ouptut container
+
+ //TChain* chain = 0;
+ ////
+ //chain = new TChain("highPt");
+ //if(chain) {
+ // chain->Add("jotwinow_Temp_Trees.root");
+ // fHighPtTree = chain->CopyTree("1");
+ // delete chain; chain=0;
+ //}
+ //if(fHighPtTree) fHighPtTree->Print();
+
+ ////
+ //chain = new TChain("V0s");
+ //if(chain) {
+ // chain->Add("jotwinow_Temp_Trees.root");
+ // fV0Tree = chain->CopyTree("1");
+ // delete chain; chain=0;
+ //}
+ //if(fV0Tree) fV0Tree->Print();
+
+ ////
+ //chain = new TChain("dEdx");
+ //if(chain) {
+ // chain->Add("jotwinow_Temp_Trees.root");
+ // fdEdxTree = chain->CopyTree("1");
+ // delete chain; chain=0;
+ //}
+ //if(fdEdxTree) fdEdxTree->Print();
+
+ ////
+ //chain = new TChain("Laser");
+ //if(chain) {
+ // chain->Add("jotwinow_Temp_Trees.root");
+ // fLaserTree = chain->CopyTree("1");
+ // delete chain; chain=0;
+ //}
+ //if(fLaserTree) fLaserTree->Print();
+
+ ////
+ //chain = new TChain("MCEffTree");
+ //if(chain) {
+ // chain->Add("jotwinow_Temp_Trees.root");
+ // fMCEffTree = chain->CopyTree("1");
+ // delete chain; chain=0;
+ //}
+ //if(fMCEffTree) fMCEffTree->Print();
+
+ ////
+ //chain = new TChain("CosmicPairs");
+ //if(chain) {
+ // chain->Add("jotwinow_Temp_Trees.root");
+ // fCosmicPairsTree = chain->CopyTree("1");
+ // delete chain; chain=0;
+ //}
+ //if(fCosmicPairsTree) fCosmicPairsTree->Print();
+
+ Bool_t deleteTrees=kTRUE;
+ if ((AliAnalysisManager::GetAnalysisManager()))
+ {
+ if (AliAnalysisManager::GetAnalysisManager()->GetAnalysisType() ==
+ AliAnalysisManager::kProofAnalysis)
+ deleteTrees=kFALSE;
+ }
+ if (deleteTrees) delete fTreeSRedirector;
+ fTreeSRedirector=NULL;
+
+ //OpenFile(1);
+
+ // Post output data.
+ //PostData(1, fHighPtTree);
+ //PostData(2, fV0Tree);
+ //PostData(3, fdEdxTree);
+ //PostData(4, fLaserTree);
+ //PostData(5, fMCEffTree);
+ //PostData(6, fCosmicPairsTree);
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::Terminate(Option_t *)
+{
+ // Called one at the end
+ /*
+ fOutputSummary = dynamic_cast<TTree*> (GetOutputData(1));
+ if(fOutputSummary) delete fOutputSummary; fOutputSummary=0;
+ TChain* chain = new TChain("highPt");
+ if(!chain) return;
+ chain->Add("jotwinow_HighPt_TrackAndV0_Trees.root");
+ TTree *tree = chain->CopyTree("1");
+ if (chain) { delete chain; chain=0; }
+ if(!tree) return;
+ tree->Print();
+ fOutputSummary = tree;
+
+ if (!fOutputSummary) {
+ Printf("ERROR: AliAnalysisTaskFilteredTree::Terminate(): Output data not avaiable %p \n", GetOutputData(1));
+ return;
+ }
+ */
+
+}
+
+//_____________________________________________________________________________
+Int_t AliAnalysisTaskFilteredTree::GetMCTrueTrackMult(AliMCEvent *const mcEvent, AliFilteredTreeEventCuts *const evtCuts, AliFilteredTreeAcceptanceCuts *const accCuts)
+{
+ //
+ // calculate mc event true track multiplicity
+ //
+ if(!mcEvent) return 0;
+
+ AliStack* stack = 0;
+ Int_t mult = 0;
+
+ // MC particle stack
+ stack = mcEvent->Stack();
+ if (!stack) return 0;
+
+ //
+ //printf("minZv %f, maxZv %f \n", evtCuts->GetMinZv(), evtCuts->GetMaxZv());
+ //
+
+ Bool_t isEventOK = evtCuts->AcceptMCEvent(mcEvent);
+ if(!isEventOK) return 0;
+
+ Int_t nPart = stack->GetNtrack();
+ for (Int_t iMc = 0; iMc < nPart; ++iMc)
+ {
+ TParticle* particle = stack->Particle(iMc);
+ if (!particle)
+ continue;
+
+ // only charged particles
+ if(!particle->GetPDG()) continue;
+ Double_t charge = particle->GetPDG()->Charge()/3.;
+ if (TMath::Abs(charge) < 0.001)
+ continue;
+
+ // physical primary
+ Bool_t prim = stack->IsPhysicalPrimary(iMc);
+ if(!prim) continue;
+
+ // checked accepted without pt cut
+ //if(accCuts->AcceptTrack(particle))
+ if( particle->Eta() > accCuts->GetMinEta() && particle->Eta() < accCuts->GetMaxEta() )
+ {
+ mult++;
+ }
+ }
+
+return mult;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFilteredTree::FillHistograms(AliESDtrack* const ptrack, AliExternalTrackParam* const ptpcInnerC, const Double_t centralityF, const Double_t chi2TPCInnerC)
+{
+//
+// Fill pT relative resolution histograms for
+// TPC only, TPC only constrained to vertex and TPC+ITS tracking
+//
+ if(!ptrack) return;
+ if(!ptpcInnerC) return;
+
+ const AliExternalTrackParam * innerParam = (AliExternalTrackParam *) ptrack->GetInnerParam();
+ if(!innerParam) return;
+
+ Float_t dxy, dz;
+ ptrack->GetImpactParameters(dxy,dz);
+
+// TPC+ITS primary tracks
+if( abs(ptrack->Eta())<0.8 &&
+ ptrack->GetTPCClusterInfo(3,1)>120 &&
+ ptrack->IsOn(0x40) &&
+ ptrack->GetTPCclusters(0)>0.0 &&
+ ptrack->GetTPCnclsS()/ptrack->GetTPCclusters(0)<0.4 &&
+ //abs(innerParam->GetX())>0.0 &&
+ //abs(innerParam->GetY()/innerParam->GetX())<0.14 &&
+ //abs(innerParam->GetTgl())<0.85 &&
+ ptrack->IsOn(0x0004) &&
+ ptrack->GetNcls(0)>0 &&
+ ptrack->GetITSchi2()>0 &&
+ sqrt(ptrack->GetITSchi2()/ptrack->GetNcls(0))<6 &&
+ sqrt(chi2TPCInnerC)<6 &&
+ (ptrack->HasPointOnITSLayer(0) || ptrack->HasPointOnITSLayer(1)) &&
+ abs(dz)<2.0 &&
+ abs(dxy)<(0.018+0.035*abs(ptrack->GetSigned1Pt())) )
+ {
+ fPtResPhiPtTPCITS->Fill(ptrack->Pt(),ptrack->Phi(),1./abs(ptrack->GetSigned1Pt())*TMath::Sqrt(ptrack->GetSigma1Pt2()));
+ fPtResEtaPtTPCITS->Fill(ptrack->Pt(),ptrack->Eta(),1./abs(ptrack->GetSigned1Pt())*TMath::Sqrt(ptrack->GetSigma1Pt2()));
+ fPtResCentPtTPCITS->Fill(ptrack->Pt(),centralityF,1./abs(ptrack->GetSigned1Pt())*TMath::Sqrt(ptrack->GetSigma1Pt2()));
+ }
+
+// TPC primary tracks
+// and TPC constrained primary tracks
+
+ AliExternalTrackParam *ptpcInner = (AliExternalTrackParam *) ptrack->GetTPCInnerParam();
+ if(!ptpcInner) return;
+
+
+ Float_t dxyTPC, dzTPC;
+ ptrack->GetImpactParametersTPC(dxyTPC,dzTPC);
+
+if( abs(ptrack->Eta())<0.8 &&
+ ptrack->GetTPCClusterInfo(3,1)>120 &&
+ ptrack->IsOn(0x40)&&
+ ptrack->GetTPCclusters(0)>0.0 &&
+ ptrack->GetTPCnclsS()/ptrack->GetTPCclusters(0)<0.4 &&
+ //abs(innerParam->GetX())>0.0 &&
+ //abs(innerParam->GetY()/innerParam->GetX())<0.14 &&
+ //abs(innerParam->GetTgl())<0.85 &&
+ abs(dzTPC)<3.2 &&
+ abs(dxyTPC)<2.4 )
+ {
+ // TPC only
+ fPtResPhiPtTPC->Fill(ptpcInner->Pt(),ptpcInner->Phi(),1./abs(ptpcInner->GetSigned1Pt())*TMath::Sqrt(ptpcInner->GetSigma1Pt2()));
+ fPtResEtaPtTPC->Fill(ptpcInner->Pt(),ptpcInner->Eta(),1./abs(ptpcInner->GetSigned1Pt())*TMath::Sqrt(ptpcInner->GetSigma1Pt2()));
+ fPtResCentPtTPC->Fill(ptpcInner->Pt(),centralityF,1./abs(ptpcInner->GetSigned1Pt())*TMath::Sqrt(ptpcInner->GetSigma1Pt2()));
+
+ // TPC constrained to vertex
+ fPtResPhiPtTPCc->Fill(ptpcInnerC->Pt(),ptpcInnerC->Phi(),1./abs(ptpcInnerC->GetSigned1Pt())*TMath::Sqrt(ptpcInnerC->GetSigma1Pt2()));
+ fPtResEtaPtTPCc->Fill(ptpcInnerC->Pt(),ptpcInnerC->Eta(),1./abs(ptpcInnerC->GetSigned1Pt())*TMath::Sqrt(ptpcInnerC->GetSigma1Pt2()));
+ fPtResCentPtTPCc->Fill(ptpcInnerC->Pt(),centralityF,1./abs(ptpcInnerC->GetSigned1Pt())*TMath::Sqrt(ptpcInnerC->GetSigma1Pt2()));
+ }
+}
-The STARlight Monte Carlo models 2-photon and photon-Pomeron interactions\r
-in ultra-peripheral heavy ion collisions. The physics approach for the photon-Pomeron \r
-interactions is described in Klein and Nystrand, Phys. Rev. C60, 014903 (1999),\r
-with the p_t spectrum (including vector meson interference) discussed in Phys. Rev. \r
-Lett. 84, 2330 (2000). The 2-photon interactions are described in Baltz, Gorbunov, \r
-Klein, Nystrand, Phys.Rev. C80 (2009) 044902. \r
-\r
-STARlight has several input files, all of which are expected to be in the\r
-same directory as the starlight code. User-specified input parameters are\r
-read from a file named "slight.in"; these parameters are described\r
-below.\r
-\r
-The output of the STARlight Monte Carlo will be written to an ascii file\r
-named "slight.out".\r
-\r
-----------------------------------------------------------------------------\r
-\r
-The contents of a sample slight.in file are listed below, with \r
-explanation. The user should modify this file according to his or her\r
-needs.\r
-BEAM_1_Z = 82 #Z of projectile\r
-BEAM_1_A = 208 #A of projectile\r
-BEAM_2_Z = 82 #Z of target\r
-BEAM_2_A = 208 #A of target\r
-BEAM_GAMMA = 1470 #Gamma of the colliding ions\r
-\r
-W_MAX = 12.0 #Max value of w\r
-W_MIN = -1 #Min value of w\r
-W_N_BINS = 40 #Bins i w\r
- # maximum and minimum values for w (the gamma-gamma center of mass\r
- # energy, w = 4(E1)(E2), (Setting W_MIN = -1 tells STARlight to use the default values\r
- # specified in inputParameters.cpp; otherwise, specify wmin here, and the number\r
- # of w bins in the lookup tables\r
-\r
-RAP_MAX = 8. # max rapidity\r
-RAP_N_BINS = 80 # Number of y bins used in the cross section calculation\r
-\r
-CUT_PT = 0 #Cut in pT? 0 = (no, 1 = yes)\r
-PT_MIN = 1.0 #Minimum pT in GeV\r
-PT_MAX = 3.0 #Maximum pT in GeV\r
-CUT_ETA = 0 #Cut in pseudorapidity? (0 = no, 1 = yes)\r
-ETA_MIN = -10 #Minimum pseudorapidity\r
-ETA_MAX = 10 #Maximum pseudorapidity\r
-\r
-PROD_MODE = 2 #gg or gP switch (1 = two-photon, 2 = coherent vector meson, 4 = incoherent vector meson )\r
-\r
-N_EVENTS = 10 #Number of events produced\r
-\r
-PROD_PID = 443013 #Channel of interest (in PDG notation); currently supported options listed below\r
-RND_SEED = 34533 #Random number seed\r
-\r
-OUTPUT_FORMAT = 2 #Form of the output (not considered at this state)\r
-\r
-BREAKUP_MODE = 5 #Controls the nuclear breakup\r
- # Note that this option only works for lead or gold; it should work at any energy\r
- # 1 = hard sphere nuclei (b>2R)\r
- # 2 = require that both nuclei break up (Xn,Xn)\r
- # 3 = a single neutron from each nucleus (1n,1n)\r
- # 4 = require that neither nucleus breaks up (0n,0n) \r
- # 5 = require that there be no hadronic break up \r
- # (This is similar to option 1, but with the actual hadronic interaction\r
- # probability)\r
- # 6 = require break up of one or both nuclei (Xn)\r
- # 7 = require break up of one nucleus (Xn,0n)\r
-\r
-INTERFERENCE = 0 #Interference (0 = off, 1 = on)\r
-IF_STRENGTH = 1. #% of intefernce (0.0 - 0.1)\r
-COHERENT = 1 #Coherent=1,Incoherent=0 production for assym collisions\r
-INCO_FACTOR = 1. #percentage of incoherence\r
-BFORD = 9.5 #Deuteron slope parameter (dsig/dt = exp(BFORD*t))\r
-INT_PT_MAX = 0.24 #Maximum pt considered, when interference is turned on\r
-INT_PT_N_BINS =120 #Number of pt bins when interference is turned on\r
-\r
-\r
-----------------------------------------------------------------------------\r
-\r
-Currently supported 2-photon channel options:\r
- jetset id particle\r
- ---------------------------------\r
- 221 eta \r
- 331 eta-prime \r
- 441 eta-c \r
- 9010221 f0(975) \r
- 225 f2(1270)\r
- 115 a2(1320)\r
- 335 f2(1525)\r
- 33 rho0 pair\r
- 11 e+/e- pair\r
- 13 mu+/mu- pair\r
- 15 tau+/tau- pair\r
-\r
-Currently supported vector meson options:\r
- jetset id particle\r
- ---------------------------------\r
-\r
- 113 rho0\r
- 223 omega\r
- 333 phi\r
- 443011 J/psi --> e+e-\r
- 443013 J/Psi --> mu+mu- \r
- 444011 Psi(2S) --> e+e-\r
- 444013 Psi(2S) --> mu+mu- \r
- 553011 Upsilon(1S) --> e+e- \r
- 553013 Upsilon(1S) --> mu+mu- \r
- 554011 Upsilon(2S) --> e+e- \r
- 554013 Upsilon(2S) --> mu+mu- \r
- 555011 Upsilon(3S) --> e+e- \r
- 555013 Upsilon(3S) --> mu+mu- \r
- 913 rho0 + direct pi+pi- (with interference)\r
-The direct pi+pi- fraction is from the ZEUS results\r
-\r
-\r
-\r
-Logs:\r
-\r
-fixed types for class Particle \r
-- Int -> Double \r
-- fixed Makefile .. \r
- autoconfig will appear in the future .. make sure paths are fixed before compiling \r
- this is for includes and libraries in Makefile\r
-- don't forget about link to pythia xml doc \r
- This is located in main.cpp\r
-\r
-- changed PID of the charged KAON to 321 and neutral kaon to 310 .. it should work now for phi -> kk \r
-\r
-- incoherent formfactor was hardcoded for dAu events, it should now accept coherent too.\r
-- Had hardcoded narrow and wide resonances for VMs. The user can again select gg_or_gp (2 or 3)\r
-except for the psi family. This is still always narrow.\r
-- Changed the spin dependence for VMs going to ee/mumu(gammaavectormeson::gettheta). It was only for psi and now upsilon will follow too\r
-inretrospect, i should probably have done this first and merge psifamily back into gammaavm.cpp\r
+The STARlight Monte Carlo models 2-photon and photon-Pomeron interactions
+in ultra-peripheral heavy ion collisions. The physics approach for the photon-Pomeron
+interactions is described in Klein and Nystrand, Phys. Rev. C60, 014903 (1999),
+with the p_t spectrum (including vector meson interference) discussed in Phys. Rev.
+Lett. 84, 2330 (2000). The 2-photon interactions are described in Baltz, Gorbunov,
+Klein, Nystrand, Phys.Rev. C80 (2009) 044902.
+
+STARlight has several input files, all of which are expected to be in the
+same directory as the starlight code. User-specified input parameters are
+read from a file named "slight.in"; these parameters are described
+below.
+
+The output of the STARlight Monte Carlo will be written to an ascii file
+named "slight.out".
+
+----------------------------------------------------------------------------
+
+The contents of a sample slight.in file are listed below, with
+explanation. The user should modify this file according to his or her
+needs.
+BEAM_1_Z = 82 #Z of projectile
+BEAM_1_A = 208 #A of projectile
+BEAM_2_Z = 82 #Z of target
+BEAM_2_A = 208 #A of target
+BEAM_GAMMA = 1470 #Gamma of the colliding ions
+
+W_MAX = 12.0 #Max value of w
+W_MIN = -1 #Min value of w
+W_N_BINS = 40 #Bins i w
+ # maximum and minimum values for w (the gamma-gamma center of mass
+ # energy, w = 4(E1)(E2), (Setting W_MIN = -1 tells STARlight to use the default values
+ # specified in inputParameters.cpp; otherwise, specify wmin here, and the number
+ # of w bins in the lookup tables
+
+RAP_MAX = 8. # max rapidity
+RAP_N_BINS = 80 # Number of y bins used in the cross section calculation
+
+CUT_PT = 0 #Cut in pT? 0 = (no, 1 = yes)
+PT_MIN = 1.0 #Minimum pT in GeV
+PT_MAX = 3.0 #Maximum pT in GeV
+CUT_ETA = 0 #Cut in pseudorapidity? (0 = no, 1 = yes)
+ETA_MIN = -10 #Minimum pseudorapidity
+ETA_MAX = 10 #Maximum pseudorapidity
+
+PROD_MODE = 2 #gg or gP switch (1 = two-photon, 2 = coherent vector meson, 4 = incoherent vector meson )
+
+N_EVENTS = 10 #Number of events produced
+
+PROD_PID = 443013 #Channel of interest (in PDG notation); currently supported options listed below
+RND_SEED = 34533 #Random number seed
+
+OUTPUT_FORMAT = 2 #Form of the output (not considered at this state)
+
+BREAKUP_MODE = 5 #Controls the nuclear breakup
+ # Note that this option only works for lead or gold; it should work at any energy
+ # 1 = hard sphere nuclei (b>2R)
+ # 2 = require that both nuclei break up (Xn,Xn)
+ # 3 = a single neutron from each nucleus (1n,1n)
+ # 4 = require that neither nucleus breaks up (0n,0n)
+ # 5 = require that there be no hadronic break up
+ # (This is similar to option 1, but with the actual hadronic interaction
+ # probability)
+ # 6 = require break up of one or both nuclei (Xn)
+ # 7 = require break up of one nucleus (Xn,0n)
+
+INTERFERENCE = 0 #Interference (0 = off, 1 = on)
+IF_STRENGTH = 1. #% of intefernce (0.0 - 0.1)
+COHERENT = 1 #Coherent=1,Incoherent=0 production for assym collisions
+INCO_FACTOR = 1. #percentage of incoherence
+BFORD = 9.5 #Deuteron slope parameter (dsig/dt = exp(BFORD*t))
+INT_PT_MAX = 0.24 #Maximum pt considered, when interference is turned on
+INT_PT_N_BINS =120 #Number of pt bins when interference is turned on
+
+
+----------------------------------------------------------------------------
+
+Currently supported 2-photon channel options:
+ jetset id particle
+ ---------------------------------
+ 221 eta
+ 331 eta-prime
+ 441 eta-c
+ 9010221 f0(975)
+ 225 f2(1270)
+ 115 a2(1320)
+ 335 f2(1525)
+ 33 rho0 pair
+ 11 e+/e- pair
+ 13 mu+/mu- pair
+ 15 tau+/tau- pair
+
+Currently supported vector meson options:
+ jetset id particle
+ ---------------------------------
+
+ 113 rho0
+ 223 omega
+ 333 phi
+ 443011 J/psi --> e+e-
+ 443013 J/Psi --> mu+mu-
+ 444011 Psi(2S) --> e+e-
+ 444013 Psi(2S) --> mu+mu-
+ 553011 Upsilon(1S) --> e+e-
+ 553013 Upsilon(1S) --> mu+mu-
+ 554011 Upsilon(2S) --> e+e-
+ 554013 Upsilon(2S) --> mu+mu-
+ 555011 Upsilon(3S) --> e+e-
+ 555013 Upsilon(3S) --> mu+mu-
+ 913 rho0 + direct pi+pi- (with interference)
+The direct pi+pi- fraction is from the ZEUS results
+
+
+
+Logs:
+
+fixed types for class Particle
+- Int -> Double
+- fixed Makefile ..
+ autoconfig will appear in the future .. make sure paths are fixed before compiling
+ this is for includes and libraries in Makefile
+- don't forget about link to pythia xml doc
+ This is located in main.cpp
+
+- changed PID of the charged KAON to 321 and neutral kaon to 310 .. it should work now for phi -> kk
+
+- incoherent formfactor was hardcoded for dAu events, it should now accept coherent too.
+- Had hardcoded narrow and wide resonances for VMs. The user can again select gg_or_gp (2 or 3)
+except for the psi family. This is still always narrow.
+- Changed the spin dependence for VMs going to ee/mumu(gammaavectormeson::gettheta). It was only for psi and now upsilon will follow too
+inretrospect, i should probably have done this first and merge psifamily back into gammaavm.cpp
-**********************************************************************\r
-* Example for a DTUNUC input file.\r
-* Uncomment the input-cards according to your requirements.\r
-*\r
-* Format: A10,6E10.0,A8\r
-* (except for the section enclosed by "PHOINPUT" and "ENDINPUT"\r
-* which is format-free)\r
-* lines starting with "*" are comment lines\r
-**********************************************************************\r
-*\r
-* projectile / target / Energy\r
-* -------------------\r
-* 1 2 3 4 5 6 7\r
-*23456789012345678901234567890123456789012345678901234567890123456789012345678\r
-PROJPAR 0.0 PHOTON\r
-TARPAR 208.0 82.0\r
-ENERGY 6.0 600000.0\r
-*ENERGY 100.0\r
-* Initialize the random number generator\r
-RNDMINIT 55.0 101.0 15.0 73.0 \r
-*\r
-*\r
-* PHOJET-specific input\r
-* ---------------------\r
-* The following lines control the event-generation with PHOJET for\r
-* individual photon/nucleon-nucleon collisions.\r
-* For details see the PHOJET-manual available at\r
-* http://lepton.bartol.udel.edu/~eng/phojet.html\r
-* Any options explained in the PHOJET-manual can be used in between\r
-* the "PHOINPUT" and "ENDINPUT" cards.\r
-PHOINPUT\r
-PROCESS 1 0 1 1 1 1 1 1\r
-ENDINPUT\r
-*\r
-* Output\r
-* ------\r
-* some default output (particle multiplicities etc.)\r
-HISTOGRAM 101.0 102.0\r
-*\r
-* Start of event generation\r
-* -------------------------\r
-*START 5000.0 0.0\r
-START 100.0 0.0\r
-STOP\r
-*...+....1....+....2....+....3....+....4....+....5....+....6....+....7...\r
+**********************************************************************
+* Example for a DTUNUC input file.
+* Uncomment the input-cards according to your requirements.
+*
+* Format: A10,6E10.0,A8
+* (except for the section enclosed by "PHOINPUT" and "ENDINPUT"
+* which is format-free)
+* lines starting with "*" are comment lines
+**********************************************************************
+*
+* projectile / target / Energy
+* -------------------
+* 1 2 3 4 5 6 7
+*23456789012345678901234567890123456789012345678901234567890123456789012345678
+PROJPAR 0.0 PHOTON
+TARPAR 208.0 82.0
+ENERGY 6.0 600000.0
+*ENERGY 100.0
+* Initialize the random number generator
+RNDMINIT 55.0 101.0 15.0 73.0
+*
+*
+* PHOJET-specific input
+* ---------------------
+* The following lines control the event-generation with PHOJET for
+* individual photon/nucleon-nucleon collisions.
+* For details see the PHOJET-manual available at
+* http://lepton.bartol.udel.edu/~eng/phojet.html
+* Any options explained in the PHOJET-manual can be used in between
+* the "PHOINPUT" and "ENDINPUT" cards.
+PHOINPUT
+PROCESS 1 0 1 1 1 1 1 1
+ENDINPUT
+*
+* Output
+* ------
+* some default output (particle multiplicities etc.)
+HISTOGRAM 101.0 102.0
+*
+* Start of event generation
+* -------------------------
+*START 5000.0 0.0
+START 100.0 0.0
+STOP
+*...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
-*\r
-*===program crint======================================================*\r
-*\r
-C OPTIONS/ EXTEND_SOURCE\r
-C SUBROUTINE CRINT\r
- SUBROUTINE DT_PRODUCEEVENT(ENERGY_SL, NPARTICLES)\r
-\r
-\r
- IMPLICIT DOUBLE PRECISION (A-H,O-Z)\r
- REAL ENERGY_SL\r
- INTEGER INIT\r
- REAL ne,etest,prob,slump\r
- SAVE\r
-\r
-* Call the init sub routine in the first event\r
- DATA INIT /0/\r
-\r
- PARAMETER (NMXHKK=200000)\r
-\r
- COMMON /DTIONT/ LINP,LOUT,LDAT\r
-\r
- COMMON /DTEVT1/ NHKK,NEVHKK,ISTHKK(NMXHKK),IDHKK(NMXHKK),\r
- & JMOHKK(2,NMXHKK),JDAHKK(2,NMXHKK),\r
- & PHKK(5,NMXHKK),VHKK(4,NMXHKK),WHKK(4,NMXHKK)\r
-\r
-* event flag\r
- COMMON /DTEVNO/ NEVENT, ICASCA\r
-\r
- IF(INIT.EQ.0) THEN\r
- OPEN (UNIT = 50, file = "my.input") \r
- LINP = 50\r
- CALL DT_DTUINI(NEVTS,EPN,NPMASS,NPCHAR,NTMASS,NTCHAR,IDP,IEMU)\r
-* Init called, make sure it's not called again\r
- INIT = 1\r
- ENDIF\r
-*-----------------------------------------------------------------------\r
-* generation of one event\r
- NEVENT = 1\r
- KKMAT = -1\r
-\r
-* If an energy-range has been defined with the ENERGY input-card the\r
-* laboratory energy ELAB can be set to any value within that range,..\r
-C ELAB = DT_RNDM(EPN)*(EPN-0.5D7)+0.5D7\r
-\r
-* ..otherwise it has to coincide with EPN.\r
-C ELAB = EPN\r
-\r
- ELAB = ENERGY_SL\r
-\r
-* sampling of one event\r
-\r
-* TEST\r
-\r
- CALL DT_KKINC(NPMASS,NPCHAR,NTMASS,NTCHAR,IDP,ELAB,KKMAT,IREJ)\r
-\r
- IF (IREJ.NE.0) RETURN\r
-\r
-c Return the number of particles produced\r
- \r
-c Fill the particle info \r
- CALL DT_GETPARTICLES(NPARTICLES)\r
-\r
- END\r
-\r
-\r
- SUBROUTINE DT_GETPARTICLES(NPARTICLES)\r
-\r
- IMPLICIT DOUBLE PRECISION (A-H,O-Z)\r
- INTEGER pid,qch,q_sum,Ntpc,Nfinal,NACCEPT,IPART,RES\r
- DOUBLE PRECISION yrap,pt,mass,mt,etot\r
- DOUBLE PRECISION pt_cut_tpc\r
- PARAMETER(pt_cut_tpc=0.050)\r
-\r
- SAVE\r
-*\r
-* COMMON /DTEVT1/ :\r
-* NHKK number of entries in common block\r
-* NEVHKK number of the event\r
-* ISTHKK(i) status code for entry i\r
-* IDHKK(i) identifier for the entry\r
-* (for particles: identifier according\r
-* to the PDG numbering scheme)\r
-* JMOHKK(1,i) pointer to the entry of the first mother\r
-* of entry i\r
-* JMOHKK(2,i) pointer to the entry of the second mother\r
-* of entry i\r
-* JDAHKK(1,i) pointer to the entry of the first daughter\r
-* of entry i\r
-* JDAHKK(2,i) pointer to the entry of the second daughter\r
-* of entry i\r
-* PHKK(1..3,i) 3-momentum\r
-* PHKK(4,i) energy\r
-* PHKK(5,i) mass\r
-*\r
-* event history\r
-\r
- PARAMETER (NMXHKK=200000)\r
-\r
- COMMON /DTEVT1/ NHKK,NEVHKK,ISTHKK(NMXHKK),IDHKK(NMXHKK),\r
- & JMOHKK(2,NMXHKK),JDAHKK(2,NMXHKK),\r
- & PHKK(5,NMXHKK),VHKK(4,NMXHKK),WHKK(4,NMXHKK)\r
-\r
-* extended event history\r
- COMMON /DTEVT2/ IDRES(NMXHKK),IDXRES(NMXHKK),NOBAM(NMXHKK),\r
- & IDBAM(NMXHKK),IDCH(NMXHKK),NPOINT(10),\r
- & IHIST(2,NMXHKK)\r
-\r
- DOUBLE PRECISION SLPX, SLPY, SLPZ, SLE, SLM\r
- INTEGER SLPID, SLCHARGE\r
- COMMON /DPMJETPARTICLE/ SLPX(NMXHKK), SLPY(NMXHKK), SLPZ(NMXHKK),\r
- & SLE(NMXHKK), SLM(NMXHKK), SLPID(NMXHKK), SLCHARGE(NMXHKK)\r
-\r
-\r
-C >> Set Counter to Zero\r
-\r
- Nfinal=0\r
- \r
- DO 42 I=1, NHKK\r
-c I = IPART\r
-\r
-CC >> Remove all non-final-state particles\r
- IF(.not.(ISTHKK(I).eq.1.or.ISTHKK(I).eq.-1.or.\r
- $ISTHKK(I).eq.1001)) GOTO 42\r
-\r
-C >> Find Particle Charge, qch\r
- IF((ABS(ISTHKK(I)).eq.1).and.(IDHKK(I).ne.80000))THEN\r
-C >> final state ptcles except nuclei\r
-\r
- qch=IPHO_CHR3(IDHKK(I),1)/3\r
- ELSEIF(IDHKK(I).eq.80000)THEN\r
-C >> final state nuclei\r
- qch=IDXRES(I)\r
- ELSE\r
-C >> not a final state particle, qch not interesting\r
- qch=-999\r
- ENDIF\r
-\r
- Nfinal = Nfinal + 1\r
- SLPX(Nfinal) = PHKK(1,I)\r
- SLPY(Nfinal) = PHKK(2,I)\r
- SLPZ(Nfinal) = PHKK(3,I)\r
- SLE(Nfinal) = PHKK(4,I)\r
- SLM(Nfinal) = PHKK(5,I)\r
- SLPID(Nfinal) = IDHKK(I)\r
- SLCHARGE(Nfinal) = qch\r
-\r
- 42 CONTINUE\r
- NPARTICLES = Nfinal\r
- \r
- END\r
-\r
- SUBROUTINE DT_USRHIS(MODE)\r
-c Dummy to make the linker happy\r
- END\r
-\r
+*
+*===program crint======================================================*
+*
+C OPTIONS/ EXTEND_SOURCE
+C SUBROUTINE CRINT
+ SUBROUTINE DT_PRODUCEEVENT(ENERGY_SL, NPARTICLES)
+
+
+ IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+ REAL ENERGY_SL
+ INTEGER INIT
+ REAL ne,etest,prob,slump
+ SAVE
+
+* Call the init sub routine in the first event
+ DATA INIT /0/
+
+ PARAMETER (NMXHKK=200000)
+
+ COMMON /DTIONT/ LINP,LOUT,LDAT
+
+ COMMON /DTEVT1/ NHKK,NEVHKK,ISTHKK(NMXHKK),IDHKK(NMXHKK),
+ & JMOHKK(2,NMXHKK),JDAHKK(2,NMXHKK),
+ & PHKK(5,NMXHKK),VHKK(4,NMXHKK),WHKK(4,NMXHKK)
+
+* event flag
+ COMMON /DTEVNO/ NEVENT, ICASCA
+
+ IF(INIT.EQ.0) THEN
+ OPEN (UNIT = 50, file = "my.input")
+ LINP = 50
+ CALL DT_DTUINI(NEVTS,EPN,NPMASS,NPCHAR,NTMASS,NTCHAR,IDP,IEMU)
+* Init called, make sure it's not called again
+ INIT = 1
+ ENDIF
+*-----------------------------------------------------------------------
+* generation of one event
+ NEVENT = 1
+ KKMAT = -1
+
+* If an energy-range has been defined with the ENERGY input-card the
+* laboratory energy ELAB can be set to any value within that range,..
+C ELAB = DT_RNDM(EPN)*(EPN-0.5D7)+0.5D7
+
+* ..otherwise it has to coincide with EPN.
+C ELAB = EPN
+
+ ELAB = ENERGY_SL
+
+* sampling of one event
+
+* TEST
+
+ CALL DT_KKINC(NPMASS,NPCHAR,NTMASS,NTCHAR,IDP,ELAB,KKMAT,IREJ)
+
+ IF (IREJ.NE.0) RETURN
+
+c Return the number of particles produced
+
+c Fill the particle info
+ CALL DT_GETPARTICLES(NPARTICLES)
+
+ END
+
+
+ SUBROUTINE DT_GETPARTICLES(NPARTICLES)
+
+ IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+ INTEGER pid,qch,q_sum,Ntpc,Nfinal,NACCEPT,IPART,RES
+ DOUBLE PRECISION yrap,pt,mass,mt,etot
+ DOUBLE PRECISION pt_cut_tpc
+ PARAMETER(pt_cut_tpc=0.050)
+
+ SAVE
+*
+* COMMON /DTEVT1/ :
+* NHKK number of entries in common block
+* NEVHKK number of the event
+* ISTHKK(i) status code for entry i
+* IDHKK(i) identifier for the entry
+* (for particles: identifier according
+* to the PDG numbering scheme)
+* JMOHKK(1,i) pointer to the entry of the first mother
+* of entry i
+* JMOHKK(2,i) pointer to the entry of the second mother
+* of entry i
+* JDAHKK(1,i) pointer to the entry of the first daughter
+* of entry i
+* JDAHKK(2,i) pointer to the entry of the second daughter
+* of entry i
+* PHKK(1..3,i) 3-momentum
+* PHKK(4,i) energy
+* PHKK(5,i) mass
+*
+* event history
+
+ PARAMETER (NMXHKK=200000)
+
+ COMMON /DTEVT1/ NHKK,NEVHKK,ISTHKK(NMXHKK),IDHKK(NMXHKK),
+ & JMOHKK(2,NMXHKK),JDAHKK(2,NMXHKK),
+ & PHKK(5,NMXHKK),VHKK(4,NMXHKK),WHKK(4,NMXHKK)
+
+* extended event history
+ COMMON /DTEVT2/ IDRES(NMXHKK),IDXRES(NMXHKK),NOBAM(NMXHKK),
+ & IDBAM(NMXHKK),IDCH(NMXHKK),NPOINT(10),
+ & IHIST(2,NMXHKK)
+
+ DOUBLE PRECISION SLPX, SLPY, SLPZ, SLE, SLM
+ INTEGER SLPID, SLCHARGE
+ COMMON /DPMJETPARTICLE/ SLPX(NMXHKK), SLPY(NMXHKK), SLPZ(NMXHKK),
+ & SLE(NMXHKK), SLM(NMXHKK), SLPID(NMXHKK), SLCHARGE(NMXHKK)
+
+
+C >> Set Counter to Zero
+
+ Nfinal=0
+
+ DO 42 I=1, NHKK
+c I = IPART
+
+CC >> Remove all non-final-state particles
+ IF(.not.(ISTHKK(I).eq.1.or.ISTHKK(I).eq.-1.or.
+ $ISTHKK(I).eq.1001)) GOTO 42
+
+C >> Find Particle Charge, qch
+ IF((ABS(ISTHKK(I)).eq.1).and.(IDHKK(I).ne.80000))THEN
+C >> final state ptcles except nuclei
+
+ qch=IPHO_CHR3(IDHKK(I),1)/3
+ ELSEIF(IDHKK(I).eq.80000)THEN
+C >> final state nuclei
+ qch=IDXRES(I)
+ ELSE
+C >> not a final state particle, qch not interesting
+ qch=-999
+ ENDIF
+
+ Nfinal = Nfinal + 1
+ SLPX(Nfinal) = PHKK(1,I)
+ SLPY(Nfinal) = PHKK(2,I)
+ SLPZ(Nfinal) = PHKK(3,I)
+ SLE(Nfinal) = PHKK(4,I)
+ SLM(Nfinal) = PHKK(5,I)
+ SLPID(Nfinal) = IDHKK(I)
+ SLCHARGE(Nfinal) = qch
+
+ 42 CONTINUE
+ NPARTICLES = Nfinal
+
+ END
+
+ SUBROUTINE DT_USRHIS(MODE)
+c Dummy to make the linker happy
+ END
+