2 AliAnalysisTaskCaloTrackCorrelation *AddTaskPi0IMGammaCorrQA(const TString calorimeter = "EMCAL",
3 const Bool_t simulation = kFALSE,
4 const TString collision = "pp",
5 const TString suffix = "default",
6 const Bool_t qaan = kFALSE,
7 const Bool_t hadronan = kFALSE,
8 const Int_t minCen = -1,
9 const Int_t maxCen = -1,
10 const Int_t debugLevel = -1
13 // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
18 printf("AddTaskPi0IMGammaCorrQA - CAREFUL : Triggered events not checked in simulation!! \n");
19 TString ssuffix = suffix;
20 if(!ssuffix.Contains("default")) return;
23 // Get the pointer to the existing analysis manager via the static access method.
25 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
28 ::Error("AddTaskPi0IMGammaCorrQA", "No analysis manager to connect to.");
32 // Check the analysis type using the event handlers connected to the analysis manager.
34 if (!mgr->GetInputEventHandler())
36 ::Error("AddTaskPi0IMGammaCorrQA", "This task requires an input event handler");
40 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
42 // Name for containers
44 TString containerName = Form("%s_%s",calorimeter.Data(), suffix.Data());
46 if(collision!="pp" && maxCen>=0) containerName+=Form("Cen%d_%d",minCen,maxCen);
48 printf("AddTaskPi0IMGammaCorrQA - Container NAME: %s \n",containerName.Data());
50 // #### Configure analysis ####
52 AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker();
54 // General frame setting and configuration
55 maker->SetReader ( ConfigureReader (inputDataType,minCen,maxCen,simulation,debugLevel) );
56 maker->SetCaloUtils( ConfigureCaloUtils(simulation,debugLevel) );
58 // Analysis tasks setting and configuration
59 Int_t n = 0;//Analysis number, order is important
62 maker->AddAnalysis(ConfigurePhotonAnalysis(calorimeter, containerName,simulation ,debugLevel), n++); // Photon cluster selection
63 maker->AddAnalysis(ConfigurePi0Analysis (calorimeter,collision,containerName,simulation,qaan,debugLevel) ,n++); // Previous photon invariant mass
67 maker->GetReader()->SwitchOnCTS();
68 maker->AddAnalysis(ConfigureChargedAnalysis(containerName,simulation,debugLevel), n++); // charged tracks plots
69 maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",calorimeter,collision,containerName,simulation,debugLevel), n++); // Gamma hadron correlation
72 if(qaan) maker->AddAnalysis(ConfigureQAAnalysis(calorimeter,simulation,debugLevel),n++);
74 maker->SetAnaDebug(debugLevel) ;
75 maker->SwitchOnHistogramsMaker() ;
76 maker->SwitchOnAODsMaker() ;
77 if(simulation || !suffix.Contains("EMC"))
78 maker->SwitchOffDataControlHistograms();
80 maker->SwitchOnDataControlHistograms();
82 if(debugLevel > 0) maker->Print("");
86 TString taskName =Form("Pi0IM_GammaTrackCorr_%s",containerName.Data());
88 AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (taskName);
89 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
90 task->SetDebugLevel(debugLevel);
91 //task->SetBranches("ESD:AliESDRun.,AliESDHeader");
92 //task->SetBranches("AOD:header,tracks,vertices,emcalCells,caloClusters");
93 task->SetAnalysisMaker(maker);
98 TString outputfile = AliAnalysisManager::GetCommonFileName();
100 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(taskName, TList::Class(),
101 AliAnalysisManager::kOutputContainer,
102 Form("%s:%s",outputfile.Data(),taskName.Data()));
104 AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("Param_%s",taskName.Data()), TList::Class(),
105 AliAnalysisManager::kParamContainer,
106 Form("%s_Parameters.root",taskName.Data()));
108 // Create ONLY the output containers for the data produced by the task.
109 // Get and connect other common input/output containers via the manager as below
110 //==============================================================================
111 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
112 mgr->ConnectOutput (task, 1, cout_pc);
113 mgr->ConnectOutput (task, 2, cout_cuts);
118 //___________________________________________________________________________
119 AliCaloTrackReader * ConfigureReader(TString inputDataType,
120 Int_t minCen, Int_t maxCen,
121 Bool_t simulation, Int_t debugLevel)
124 AliCaloTrackReader * reader = 0;
125 if (inputDataType=="AOD")
126 reader = new AliCaloTrackAODReader();
127 else if(inputDataType=="ESD")
128 reader = new AliCaloTrackESDReader();
130 printf("AliCaloTrackReader::ConfigureReader() - Data combination not known input Data=%s\n",
131 inputDataType.Data());
133 reader->SetDebug(debugLevel);//10 for lots of messages
138 if(inputDataType == "ESD")
140 reader->SwitchOnStack();
141 reader->SwitchOffAODMCParticles();
143 else if(inputDataType == "AOD")
145 reader->SwitchOffStack();
146 reader->SwitchOnAODMCParticles();
150 //------------------------
151 // Detector input filling
152 //------------------------
154 //Min cluster/track E
155 reader->SetEMCALEMin(0.3);
156 reader->SetEMCALEMax(1000);
157 reader->SetPHOSEMin(0.3);
158 reader->SetPHOSEMax(1000);
159 reader->SetCTSPtMin(0.2);
160 reader->SetCTSPtMax(1000);
163 reader->SwitchOffUseTrackTimeCut();
164 reader->SwitchOffUseParametrizedTimeCut();
165 reader->SwitchOffUseEMCALTimeCut() ;
166 reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut
167 reader->SetTrackTimeCut(-1e10,1e10);
169 reader->SwitchOnFiducialCut();
172 reader->SwitchOffCTS();
173 reader->SwitchOffRejectNoTrackEvents();
174 reader->SwitchOffRecalculateVertexBC();
175 reader->SwitchOffVertexBCEventSelection();
176 reader->SwitchOffUseTrackDCACut();
177 //reader->SetTrackDCACut(0,0.0105);
178 //reader->SetTrackDCACut(1,0.035);
179 //reader->SetTrackDCACut(2,1.1);
181 if(inputDataType=="ESD")
183 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
187 AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10001008);
188 reader->SetTrackCuts(esdTrackCuts);
189 AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10011008);
190 reader->SetTrackComplementaryCuts(esdTrackCuts2);
195 // AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10001006);
196 // reader->SetTrackCuts(esdTrackCuts);
197 // AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10041006);
198 // reader->SetTrackComplementaryCuts(esdTrackCuts2);
201 else if(inputDataType=="AOD")
203 reader->SwitchOnAODHybridTrackSelection(); // Check that the AODs have Hybrids!!!!
204 reader->SetTrackStatus(AliVTrack::kITSrefit);
209 reader->SetEMCALClusterListName("");
210 reader->SwitchOffClusterRecalculation();
212 reader->SwitchOnEMCALCells();
213 reader->SwitchOnEMCAL();
215 reader->SwitchOnPHOSCells();
216 reader->SwitchOnPHOS();
222 reader->SwitchOnEventTriggerAtSE();
224 reader->SetZvertexCut(10.);
225 reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
226 reader->SwitchOffPileUpEventRejection(); // remove pileup
227 reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
229 reader->SetCentralityBin(minCen,maxCen); // Accept all events, if not select range
230 reader->SetCentralityOpt(100); // 10 (c= 0-10, 10-20 ...), 20 (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
232 if(debugLevel > 0) reader->Print("");
238 //__________________________________________________________________________
239 AliCalorimeterUtils* ConfigureCaloUtils(Bool_t simulation, Int_t debugLevel)
242 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
243 cu->SetDebug(debugLevel);
245 // Remove clusters close to borders, at least max energy cell is 1 cell away
246 cu->SetNumberOfCellsFromEMCALBorder(1);
247 cu->SetNumberOfCellsFromPHOSBorder(2);
249 // Search of local maxima in cluster
250 cu->SetLocalMaximaCutE(0.1);
251 cu->SetLocalMaximaCutEDiff(0.03);
253 cu->SwitchOffClusterPlot();
254 cu->SwitchOffRecalculateClusterTrackMatching();
256 cu->SwitchOnBadChannelsRemoval() ;
261 cu->SwitchOnLoadOwnEMCALGeometryMatrices();
263 AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
264 cu->SwitchOffRecalibration(); // Check the reader if it is taken into account during filtering
265 cu->SwitchOffRunDepCorrection();
267 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C");
268 ConfigureEMCALRecoUtils(recou,
271 kTRUE,//kNonLinearity,
275 recou->SetExoticCellDiffTimeCut(50.);
277 cu->SwitchOnCorrectClusterLinearity();
279 if(kCalorimeter=="PHOS")
280 cu->SetNumberOfSuperModulesUsed(3);
282 cu->SetNumberOfSuperModulesUsed(10);
285 cu->SwitchOffLoadOwnPHOSGeometryMatrices();
287 if(debugLevel > 0) cu->Print("");
293 //_______________________________________________________________________________
294 AliAnaPhoton* ConfigurePhotonAnalysis(TString calorimeter, TString containerName,
295 Bool_t simulation, Int_t debugLevel)
298 AliAnaPhoton *ana = new AliAnaPhoton();
299 ana->SetDebug(debugLevel); //10 for lots of messages
301 // cluster selection cuts
303 ana->SwitchOffFiducialCut();
305 ana->SetCalorimeter(calorimeter);
307 if(calorimeter == "PHOS")
309 ana->SetNCellCut(2);// At least 3 cells
311 ana->SetMinDistanceToBadChannel(2, 4, 5);
312 ana->SetTimeCut(-1e10,1e10); // open cut
316 ana->SetNCellCut(1);// At least 2 cells
317 ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV
318 ana->SetMaxEnergy(1000);
319 ana->SetTimeCut(-1e10,1e10); // open cut, usual time window of [425-825] ns if time recalibration is off
320 // restrict to less than 100 ns when time calibration is on
321 ana->SetMinDistanceToBadChannel(2, 4, 6);
322 // Not useful if M02 cut is already strong
323 ana->SetNLMCut(1, 2) ;
326 ana->SwitchOnTrackMatchRejection() ;
327 ana->SwitchOffTMHistoFill() ;
330 //PID cuts (shower shape)
331 ana->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian
332 AliCaloPID* caloPID = ana->GetCaloPID();
333 //Not used in bayesian
336 caloPID->SetEMCALLambda0CutMax(0.4); // Rather open
337 caloPID->SetEMCALLambda0CutMin(0.10);
339 caloPID->SetEMCALDEtaCut(0.025);
340 caloPID->SetEMCALDPhiCut(0.030);
343 caloPID->SetPHOSDispersionCut(2.5);
344 caloPID->SetPHOSRCut(2.);
346 ana->SwitchOnFillShowerShapeHistograms(); // Filled before photon shower shape selection
347 //if(!simulation)ana->SwitchOnFillPileUpHistograms();
349 // Input / output delta AOD settings
350 ana->SetOutputAODName(Form("Photon%s",containerName.Data()));
351 ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
352 ana->SetInputAODName (Form("Photon%s",containerName.Data()));
354 //Set Histograms name tag, bins and ranges
356 ana->AddToHistogramsName("AnaPhoton_");
357 SetHistoRangeAndNBins(ana->GetHistogramRanges(),calorimeter); // see method below
359 // Number of particle type MC histograms
360 ana->FillNOriginHistograms(7);
361 ana->FillNPrimaryHistograms(4);
363 if(simulation) ana->SwitchOnDataMC();
365 if(debugLevel > 0 ) ana->Print("");
371 //_________________________________________________________________________
372 AliAnaPi0* ConfigurePi0Analysis(TString calorimeter, TString collision,
373 TString containerName, Bool_t simulation,
374 Bool_t qaan, Int_t debugLevel)
377 AliAnaPi0 *ana = new AliAnaPi0();
379 ana->SetDebug(debugLevel);//10 for lots of messages
381 // Input delta AOD settings
382 ana->SetInputAODName(Form("Photon%s",containerName.Data()));
384 // Calorimeter settings
385 ana->SetCalorimeter(calorimeter);
387 //settings for pp collision mixing
388 ana->SwitchOnOwnMix(); //Off when mixing done with general mixing frame
391 if(calorimeter=="EMCAL") ana->SetPairTimeCut(70);
393 if (collision == "pp" )
395 ana->SetNCentrBin(1);
396 ana->SetNZvertBin(10);
398 ana->SetNMaxEvMix(100);
400 else if(collision =="PbPb")
402 ana->SetNCentrBin(10);
403 ana->SetNZvertBin(10);
405 ana->SetNMaxEvMix(10);
407 else if(collision =="pPb")
409 ana->SetNCentrBin(1);
410 ana->SetNZvertBin(10);
412 ana->SetNMaxEvMix(100);
415 ana->SwitchOffMultipleCutAnalysis();
416 ana->SwitchOnSMCombinations();
417 ana->SwitchOffFillAngleHisto();
418 ana->SwitchOffFillOriginHisto();
420 //Set Histograms name tag, bins and ranges
422 ana->AddToHistogramsName("AnaPi0_");
423 SetHistoRangeAndNBins(ana->GetHistogramRanges(),calorimeter); // see method below
425 if(simulation) ana->SwitchOnDataMC();
427 if(debugLevel > 0) ana->Print("");
433 //___________________________________________________________________________________
434 AliAnaChargedParticles* ConfigureChargedAnalysis(TString containerName,
435 Bool_t simulation, Int_t debugLevel)
438 AliAnaChargedParticles *ana = new AliAnaChargedParticles();
439 ana->SetDebug(debugLevel); //10 for lots of messages
444 ana->SwitchOnFiducialCut();
445 ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ; //more restrictive cut in reader and after in isolation
447 ana->SwitchOffFillVertexBC0Histograms() ;
448 //if(!simulation) ana->SwitchOnFillPileUpHistograms();
450 // Input / output delta AOD settings
452 ana->SetOutputAODName(Form("Hadron%s",containerName.Data()));
453 ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
454 ana->SetInputAODName(Form("Hadron%s",containerName.Data()));
456 //Set Histograms name tag, bins and ranges
458 ana->AddToHistogramsName("AnaHadrons_");
459 SetHistoRangeAndNBins(ana->GetHistogramRanges(),""); // see method below
461 ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
462 ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
464 if(debugLevel > 0) ana->Print("");
470 //__________________________________________________________________________________________________________
471 AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString particle, TString calorimeter,
472 TString collision, TString containerName,
473 Bool_t simulation, Int_t debugLevel)
476 AliAnaParticleHadronCorrelation *ana = new AliAnaParticleHadronCorrelation();
477 ana->SetDebug(debugLevel);
479 ana->SetMinimumTriggerPt(5);
480 ana->SetAssociatedPtRange(0.2,100);
481 ana->SetDeltaPhiCutRange( TMath::Pi()/2,3*TMath::Pi()/2 ); //[90 deg, 270 deg]
483 ana->SetNAssocPtBins(4);
485 ana->SetAssocPtBinLimit(0, 0.5) ;
486 ana->SetAssocPtBinLimit(1, 2) ;
487 ana->SetAssocPtBinLimit(2, 5) ;
488 ana->SetAssocPtBinLimit(3, 10) ;
489 ana->SetAssocPtBinLimit(4, 20) ;
491 ana->SelectIsolated(kFALSE); // do correlation with isolated photons
493 //if(!simulation) ana->SwitchOnFillPileUpHistograms();
495 ana->SwitchOnAbsoluteLeading(); // Select trigger leading particle of all the selected tracks
496 ana->SwitchOffNearSideLeading(); // Select trigger leading particle of all the particles at +-90 degrees, default
498 // Mixing with own pool
499 ana->SwitchOffOwnMix();
501 ana->SetNZvertBin(20);
505 ana->SetNMaxEvMix(100);
506 ana->SwitchOnTrackMultBins();
507 ana->SetNCentrBin(9); // Fixed track mult values
512 ana->SetNMaxEvMix(10);
513 ana->SwitchOffTrackMultBins(); // centrality bins
514 ana->SetNCentrBin(10);
518 // Input / output delta AOD settings
520 ana->SetInputAODName(Form("%s%s",particle.Data(),containerName.Data()));
521 ana->SetAODObjArrayName(Form("%sHadronCorr_%s",particle.Data(),containerName.Data()));
523 ana->SwitchOffPi0TriggerDecayCorr();
524 ana->SwitchOffDecayTriggerDecayCorr();
525 ana->SwitchOffNeutralCorr(); // Do only correlation with TPC
526 ana->SwitchOffHMPIDCorrelation();
527 ana->SwitchOffFillBradHistograms();
530 ana->SwitchOffEventSelection();
531 ana->SwitchOffSeveralUECalculation();
532 ana->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
535 //Set Histograms name tag, bins and ranges
537 ana->AddToHistogramsName(Form("Ana%sHadronCorr_",particle.Data()));
538 SetHistoRangeAndNBins(ana->GetHistogramRanges(),calorimeter); // see method below
540 if(simulation) ana->SwitchOnDataMC();
542 if(debugLevel > 0) ana->Print("");
548 //________________________________________________________________________________
549 AliAnaCalorimeterQA* ConfigureQAAnalysis(TString calorimeter, Bool_t simulation,
553 AliAnaCalorimeterQA *ana = new AliAnaCalorimeterQA();
554 ana->SetDebug(debugLevel); //10 for lots of messages
555 ana->SetCalorimeter(calorimeter);
557 ana->SetTimeCut(-1e10,1e10); // Open time cut
558 ana->SwitchOnCorrelation();
559 ana->SwitchOffStudyBadClusters() ;
560 ana->SwitchOffFiducialCut();
561 ana->SwitchOffFillAllTH3Histogram();
562 ana->SwitchOffFillAllPositionHistogram();
563 ana->SwitchOffFillAllPositionHistogram2();
564 ana->SwitchOffStudyBadClusters();
565 ana->SwitchOffStudyClustersAsymmetry();
566 ana->SwitchOffStudyWeight();
567 ana->SwitchOnFillAllTrackMatchingHistogram();
568 ana->SwitchOnFillAllCellTimeHisto() ;
570 ana->AddToHistogramsName("QA_"); //Begining of histograms name
571 SetHistoRangeAndNBins(ana->GetHistogramRanges(),calorimeter); // see method below
573 if(simulation) ana->SwitchOnDataMC();
575 if(debugLevel > 0) ana->Print("");
582 //________________________________________________________
583 void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges,
586 // Set common bins for all analysis and MC histograms filling
588 histoRanges->SetHistoPtRangeAndNBins(0, 100, 200) ; // Energy and pt histograms
590 if(calorimeter=="EMCAL")
594 // histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
595 // histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA
596 // histoRanges->SetHistoYRangeAndNBins(370,450,40); // QA
598 // else if(year==2011)
600 // histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
601 // histoRanges->SetHistoXRangeAndNBins(-600,90,200); // QA
602 // histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA
606 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 190*TMath::DegToRad(), 122) ;
607 histoRanges->SetHistoXRangeAndNBins(-100,90,200); // QA
608 histoRanges->SetHistoYRangeAndNBins(50,450,100); // QA
611 histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
615 histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
616 histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
619 histoRanges->SetHistoShowerShapeRangeAndNBins(-0.1, 4.9, 500);
621 // Invariant mass histoRangeslysis
622 histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ;
623 histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
625 // check if time calibration is on
626 histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,2000);
627 //histoRanges->SetHistoTimeRangeAndNBins(-400.,400,400);
628 histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
630 // track-cluster residuals
631 histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.15,0.15,300);
632 histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,300);
633 histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA
635 // QA, electron, charged
636 histoRanges->SetHistoPOverERangeAndNBins(0, 2.5 ,500);
637 histoRanges->SetHistodEdxRangeAndNBins (0.,250.0,500);
640 histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
641 histoRanges->SetHistoRatioRangeAndNBins(0.,2.,100);
642 histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
643 histoRanges->SetHistoNClusterCellRangeAndNBins(0,50,50);
644 histoRanges->SetHistoNClustersRangeAndNBins(0,100,100);
645 histoRanges->SetHistoZRangeAndNBins(-400,400,200);
646 histoRanges->SetHistoRRangeAndNBins(400,450,25);
647 histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500);
648 histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
649 histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);