2 AliAnalysisTaskParticleCorrelation *AddTaskPi0EMCALPbPb(
3 const TString data = "AOD",
4 const TString calorimeter = "EMCAL",
5 const Bool_t printSettings = kFALSE,
6 const Bool_t simulation = kFALSE,
7 const Bool_t outputAOD = kFALSE,
8 const TString outputfile = "",
9 const Int_t year = 2011,
10 const TString col = "PbPb",
11 const TString trig = "",
12 const TString clustersArray = ""
15 // Creates a PartCorr task, configures it and adds it to the analysis manager.
17 // Get the pointer to the existing analysis manager via the static access method.
19 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
21 ::Error("AddTask", "No analysis manager to connect to.");
25 // Check the analysis type using the event handlers connected to the analysis manager.
27 if (!mgr->GetInputEventHandler()) {
28 ::Error("AddTask", "This task requires an input event handler");
31 Bool_t kInputDataType = "AOD";
32 if(!data.Contains("delta"))
33 kInputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
35 Bool_t kUseKinematics = kFALSE;
37 kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
38 if (!kUseKinematics && data=="AOD" && kInputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ...
41 //cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
43 // #### Configure analysis ####
45 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
47 // General frame setting and configuration
48 maker->SetReader (ConfigureReader(data,kInputDataType,calorimeter,clustersArray,col,outputAOD,kUseKinematics,printSettings) );
49 maker->SetCaloUtils(ConfigureCaloUtils(year,col,clustersArray, simulation, printSettings));
51 // Analysis tasks setting and configuration
52 Int_t n = 0;//Analysis number, order is important
53 maker->AddAnalysis(ConfigurePhotonAnalysis(data,calorimeter,year,col,clustersArray,simulation,"",printSettings), n++); // Photon cluster selection
54 maker->AddAnalysis(ConfigurePi0Analysis (data,calorimeter,year,col,clustersArray,simulation,"",printSettings), n++); // Pi0 invariant mass analysis
56 maker->SetAnaDebug(-1) ;
57 maker->SwitchOnHistogramsMaker() ;
58 if(data.Contains("delta")) maker->SwitchOffAODsMaker() ;
59 else maker->SwitchOnAODsMaker() ;
61 if(printSettings) maker->Print("");
63 //printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, calorimeter.Data());
67 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s_Trig%s_Cl%s",calorimeter.Data(),trig.Data(),clustersArray.Data()));
68 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
69 //task->SetDebugLevel(-1);
70 task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
71 task->SetAnalysisMaker(maker);
76 if(outputfile.Length()==0)outputfile = AliAnalysisManager::GetCommonFileName();
77 TString name(Form("%s_Trig%s_Cl%s",calorimeter.Data(),trig.Data(),clustersArray.Data()));
78 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(name.Data(), TList::Class(),
79 AliAnalysisManager::kOutputContainer,
80 Form("%s:%s",outputfile.Data(),name.Data()));
82 AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",name.Data()), TList::Class(),
83 AliAnalysisManager::kParamContainer,
84 Form("%s:%sCuts",outputfile.Data(),name.Data()));
86 // Create ONLY the output containers for the data produced by the task.
87 // Get and connect other common input/output containers via the manager as below
88 //==============================================================================
89 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
90 // AOD output slot will be used in a different way in future
91 if(!data.Contains("delta") && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
92 mgr->ConnectOutput (task, 1, cout_pc);
93 mgr->ConnectOutput (task, 2, cout_cuts);
98 //____________________________________
99 AliCaloTrackReader * ConfigureReader(TString kData,TString kInputDataType, TString kCalorimeter,
100 TString kClusterArray, TString kCollisions,
101 Bool_t kOutputAOD, Bool_t kUseKinematics, Bool_t kPrint)
104 AliCaloTrackReader * reader = 0;
105 if (kData.Contains("AOD")) reader = new AliCaloTrackAODReader();
106 else if(kData=="ESD") reader = new AliCaloTrackESDReader();
107 else if(kData=="MC" &&
108 kInputDataType == "ESD") reader = new AliCaloTrackMCReader();
110 reader->SetDebug(-1);//10 for lots of messages
113 //reader->SetDeltaAODFileName("");
114 if(kOutputAOD) reader->SwitchOnWriteDeltaAOD() ;
118 if(kInputDataType == "ESD"){
119 reader->SwitchOnStack();
120 reader->SwitchOffAODMCParticles();
122 else if(kInputDataType == "AOD"){
123 reader->SwitchOffStack();
124 reader->SwitchOnAODMCParticles();
128 //------------------------
129 // Detector input filling
130 //------------------------
132 //Min cluster/track E
133 reader->SetEMCALEMin(0.5);
134 reader->SetEMCALEMax(1000);
135 reader->SetPHOSEMin(0.3);
136 reader->SetPHOSEMax(1000);
137 reader->SetCTSPtMin(0.1);
138 reader->SetCTSPtMax(1000);
140 reader->SwitchOffFiducialCut();
143 reader->SwitchOffCTS();
144 //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/CreateTrackCutsPWG4.C");
145 //AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWG4(10011004);
146 //reader->SetTrackCuts(esdTrackCuts);
150 reader->SetEMCALClusterListName(kClusterArray);
151 if(kClusterArray == "") {
152 //printf("**************** Normal analysis **************** \n");
153 reader->SwitchOnClusterRecalculation(); // Bad map removal
156 printf("**************** Input for analysis is Clusterizer %s **************** \n", kClusterArray.Data());
157 reader->SwitchOffClusterRecalculation();
160 if(kCalorimeter == "EMCAL") {
161 reader->SwitchOnEMCALCells();
162 reader->SwitchOnEMCAL();
164 if(kCalorimeter == "PHOS") {
165 reader->SwitchOnPHOSCells();
166 reader->SwitchOnPHOS();
169 // for case data="deltaAOD", no need to fill the EMCAL/PHOS cluster lists
170 if(kData.Contains("delta")){
171 reader->SwitchOffEMCAL();
172 reader->SwitchOffPHOS();
173 reader->SwitchOffEMCALCells();
174 reader->SwitchOffPHOSCells();
181 //if(!kUseKinematics) reader->SetFiredTriggerClassName("CEMC7EGA-B-NOPF-CENTNOTRD"); // L1 Gamma
183 if (kCollisions=="pp" ) {
184 reader->SwitchOffEventSelection();
185 reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
186 reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex
187 reader->SetZvertexCut(50.); // Open cut
189 else if(kCollisions=="PbPb") {
190 reader->SwitchOffEventSelection(); // remove pileup by default
191 reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
192 reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex
193 reader->SetZvertexCut(10.); // Centrality defined in this range.
196 reader->SetCentralityClass("V0M");
197 reader->SetCentralityOpt(10); // 10 centrality bins
198 reader->SetCentralityBin(-1,-1); // Accept all events, if not select range
200 // Event plane (only used in AliAnaPi0 for the moment)
201 reader->SetEventPlaneMethod("Q");
204 if(kPrint) reader->Print("");
210 //_______________________________________
211 AliCalorimeterUtils* ConfigureCaloUtils(Int_t kYears, TString kCollisions, TString kClusterArray,
212 Bool_t kSimulation, Bool_t kPrint)
215 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
218 if(kYears==2010) cu->SetEMCALGeometryName("EMCAL_FIRSTYEARV1");
219 else cu->SetEMCALGeometryName("EMCAL_COMPLETEV1");
221 // Remove clusters close to borders, at least max energy cell is 1 cell away
222 cu->SetNumberOfCellsFromEMCALBorder(1);
223 cu->SetNumberOfCellsFromPHOSBorder(2);
225 //if(kClusterArray == "")
226 // cu->SwitchOffRecalculateClusterTrackMatching(); // Done in clusterization
228 // cu->SwitchOnRecalculateClusterTrackMatching();
230 //EMCAL only settings
231 AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
234 if(kCollisions=="pp" ) { // Do only for pp for the moment
235 cu->SwitchOnCorrectClusterLinearity();
236 if(!kSimulation) recou->SetNonLinearityFunction(AliEMCALRecoUtils::kBeamTestCorrected);
237 else recou->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC);
240 recou->SwitchOnRejectExoticCell();
241 if(kClusterArray == "") recou->SwitchOnRejectExoticCluster();
242 else recou->SwitchOffRejectExoticCluster();
244 if(kPrint) cu->Print("");
250 //_____________________________________
251 AliAnaPhoton* ConfigurePhotonAnalysis(TString kData, TString kCalorimeter, Int_t kYears, TString kCollisions, TString kClusterArray,
252 Bool_t kSimulation, TString kTrig = "", Bool_t kPrint)
255 AliAnaPhoton *anaphoton = new AliAnaPhoton();
256 anaphoton->SetDebug(-1); //10 for lots of messages
258 // cluster selection cuts
260 anaphoton->SwitchOffFiducialCut();
262 anaphoton->SetCalorimeter(kCalorimeter);
264 if(kCalorimeter == "PHOS"){
265 anaphoton->SetNCellCut(2);// At least 2 cells
266 anaphoton->SetMinPt(0.3);
267 anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
270 anaphoton->SetNCellCut(1);// At least 2 cells
271 anaphoton->SetMinPt(0.5); // avoid mip peak at E = 260 MeV
272 anaphoton->SetMaxPt(1000);
273 anaphoton->SetTimeCut(-1000,1000); // open cut, usual time window of [425-825] ns if time recalibration is off
274 anaphoton->SetMinDistanceToBadChannel(1, 2, 3); // For filtered AODs, new releases.
277 anaphoton->SwitchOnTrackMatchRejection() ;
279 //PID cuts (shower shape)
280 anaphoton->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian
281 AliCaloPID* caloPID = anaphoton->GetCaloPID();
282 //Not used in bayesian
285 caloPID->SetEMCALLambda0CutMax(0.30);
286 caloPID->SetEMCALLambda0CutMin(0.10);
288 caloPID->SetEMCALDEtaCut(0.025);
289 caloPID->SetEMCALDPhiCut(0.05);
290 // In case of official AODs when dX and dZ was not stored, open the cuts
291 // and rely on having a match recorded. In case of reclusterization, try.
292 if(kData=="AOD" && kClusterArray==""){
293 caloPID->SetEMCALDEtaCut(2000);
294 caloPID->SetEMCALDPhiCut(2000);
298 caloPID->SetPHOSDispersionCut(2.5);
299 caloPID->SetPHOSRCut(2.);
300 if(kData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored
302 if(kCalorimeter=="PHOS"){
303 caloPID->SetHistoDEtaRangeAndNBins(-200, 200, 200); // dZ
304 caloPID->SetHistoDPhiRangeAndNBins(-200, 200, 200); // dX
307 //caloPID->SetTOFCut(10000000); // Not used, only to set PID bits
309 anaphoton->SwitchOffFillShowerShapeHistograms(); // Filled before photon shower shape selection
311 // Input / output delta AOD settings
313 if(!kData.Contains("delta")) {
314 anaphoton->SetOutputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
315 anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
316 //anaphoton->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done
318 else anaphoton->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
320 //Set Histograms name tag, bins and ranges
322 anaphoton->AddToHistogramsName("AnaPhoton_");
323 SetHistoRangeAndNBins(anaphoton); // see method below
325 // Number of particle type MC histograms
326 anaphoton->FillNOriginHistograms(8);
327 anaphoton->FillNPrimaryHistograms(4);
329 if(kPrint) anaphoton->Print("");
337 //_______________________________
338 AliAnaPi0* ConfigurePi0Analysis(TString kData, TString kCalorimeter, Int_t kYears, TString kCollisions, TString kClusterArray,
339 Bool_t kSimulation, TString kTrig = "", Bool_t kPrint)
342 AliAnaPi0 *anapi0 = new AliAnaPi0();
344 anapi0->SetDebug(-1);//10 for lots of messages
345 if(kPrint) anapi0->Print("");
347 // Input delta AOD settings
348 anapi0->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()));
350 // Calorimeter settings
351 anapi0->SetCalorimeter(kCalorimeter);
352 if(kCalorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
354 if(kYears==2010) anapi0->SetNumberOfModules(4); //EMCAL first year
355 else anapi0->SetNumberOfModules(10);
358 //settings for pp collision mixing
359 anapi0->SwitchOnOwnMix(); //Off when mixing done with general mixing frame
362 if(kCalorimeter=="EMCAL") anapi0->SetPairTimeCut(70);
364 if (kCollisions=="pp" ) {
365 printf("****** Configure Pi0 for pp analysis\n");
366 anapi0->SetNCentrBin(1);
367 anapi0->SetNZvertBin(10);
368 anapi0->SetNRPBin(1);
369 anapi0->SetNMaxEvMix(100);
371 else if(kCollisions=="PbPb") {
372 printf("****** Configure Pi0 for PbPb analysis\n");
373 anapi0->SetNCentrBin(5);
374 anapi0->SetNZvertBin(3);
375 anapi0->SetNRPBin(1);
376 anapi0->SetNMaxEvMix(5);
379 anapi0->SwitchOffMultipleCutAnalysis();
380 anapi0->SwitchOffSMCombinations();
382 //Set Histograms name tag, bins and ranges
384 anapi0->AddToHistogramsName("AnaPi0_");
385 SetHistoRangeAndNBins(anapi0, kCalorimeter, kYears, kCollisions, kSimulation); // see method below
391 //________________________________________________________
392 void SetHistoRangeAndNBins (AliAnaPartCorrBaseClass* ana, TString kCalorimeter,
393 Int_t kYears, TString kCollisions, Bool_t kSimulation)
395 // Set common bins for all analysis and MC histograms filling
397 if(kSimulation) ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
398 else ana->SwitchOffDataMC() ;
400 ana->SetHistoPtRangeAndNBins(0, 100, 250) ; // Energy and pt histograms
402 if(kCalorimeter=="EMCAL"){
404 ana->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
405 ana->SetHistoXRangeAndNBins(-230,90,120); // QA
406 ana->SetHistoYRangeAndNBins(370,450,40); // QA
409 ana->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
410 ana->SetHistoXRangeAndNBins(-600,90,200); // QA
411 ana->SetHistoYRangeAndNBins(100,450,100); // QA
414 ana->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
417 ana->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
418 ana->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
422 ana->SetHistoShowerShapeRangeAndNBins(0, 3, 300);
424 // Invariant mass analysis
425 ana->SetHistoMassRangeAndNBins(0., 1., 200) ;
426 ana->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
428 // check if time calibration is on
429 ana->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
430 ana->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
432 // QA, electron, charged
433 ana->SetHistoPOverERangeAndNBins(0,10.,100);
434 ana->SetHistodEdxRangeAndNBins(0.,200.,200);
437 ana->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
438 ana->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
439 ana->SetHistoRatioRangeAndNBins(0.,2.,100);
440 ana->SetHistoVertexDistRangeAndNBins(0.,500.,500);
441 ana->SetHistoNClusterCellRangeAndNBins(0,500,500);
442 ana->SetHistoZRangeAndNBins(-400,400,200);
443 ana->SetHistoRRangeAndNBins(400,450,25);
444 ana->SetHistoV0SignalRangeAndNBins(0,5000,500);
445 ana->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
446 ana->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);