AliPhysics  8417398 (8417398)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskPi0.C
Go to the documentation of this file.
1 
9 TString kAnaPi0 = "";
10 
35 (
36  TString calorimeter = "EMCAL",
37  Bool_t simulation = kFALSE,
38  Int_t year = 2015,
39  TString col = "pp",
40  TString trigger = "EMC7",
41  Bool_t rejectEMCTrig = kFALSE,
42  Bool_t muonCaloPass = kFALSE,
43  TString clustersArray = "",
44  Bool_t tender = kFALSE,
45  Bool_t nonLinOn = kFALSE,
46  Float_t shshMax = 0.5,
47  Bool_t tm = kTRUE,
48  Int_t minCen = -1,
49  Int_t maxCen = -1,
50  Bool_t mixOn = kTRUE,
51  TString outputfile = "",
52  Bool_t printSettings = kFALSE,
53  Int_t debug = 0 // Debug level
54  )
55 
56 {
57  // Get the pointer to the existing analysis manager via the static access method.
58 
59  printf("Passed settings:\n calorimeter <%s>, simulation <%d>, year <%d>,\n col <%s>, trigger <%s>, reject EMC <%d> clustersArray <%s>, tender <%d>, non linearity <%d>\n shshMax <%2.2f>, tm %d, minCen %d, maxCen %d, mixOn <%d>,\n outputfile <%s>, printSettings <%d>, debug <%d>\n",
60  calorimeter.Data(),simulation,year,col.Data(),trigger.Data(), rejectEMCTrig, clustersArray.Data(),tender, nonLinOn, shshMax,tm,
61  minCen,maxCen,mixOn,outputfile.Data(),printSettings,debug);
62 
63  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
64  if (!mgr)
65  {
66  ::Error("AddTask", "No analysis manager to connect to.");
67  return NULL;
68  }
69 
70  // Check the analysis type using the event handlers connected to the analysis manager.
71 
72  if (!mgr->GetInputEventHandler())
73  {
74  ::Error("AddTask", "This task requires an input event handler");
75  return NULL;
76  }
77 
78  // Make sure the B field is enabled for track selection, some cuts need it
79  ((AliInputEventHandler*)mgr->GetInputEventHandler())->SetNeedField(kTRUE);
80 
81  // Name for containers
82 
83  kAnaPi0 = Form("Pi0_%s_Trig%s_Col_%s_Year%d_Cl%s_Ten%d_TM%d_M02_%1.2f_Mix%d",
84  calorimeter.Data(),trigger.Data(),col.Data(),year,clustersArray.Data(),tender,
85  tm, shshMax,mixOn);
86 
87  if(col=="PbPb" && maxCen>=0) kAnaPi0+=Form("Cen%d_%d",minCen,maxCen);
88 
89  printf("<<<< NAME: %s >>>>>\n",kAnaPi0.Data());
90 
91  // #### Configure analysis ####
92 
94 
95  // General frame setting and configuration
96  maker->SetReader ( ConfigureReader (col,simulation,clustersArray,tender,calorimeter,nonLinOn,trigger,rejectEMCTrig,minCen,maxCen,printSettings,debug) );
97  maker->SetCaloUtils( ConfigureCaloUtils(col,simulation,clustersArray,tender,nonLinOn,year, printSettings,debug) );
98 
99  if(muonCaloPass)
100  {
101  maker->GetReader()->SwitchOffPrimaryVertexSelection();
102  maker->GetReader()->SwitchOffRejectNoTrackEvents();
103  }
104 
105  // Remove as soon calibrations are available
106  if(year > 2014)
107  {
108  maker->GetReader()->SwitchOffUseEMCALTimeCut();
109  maker->GetReader()->SetEMCALTimeCut(-1000,1000);
110  maker->GetCaloUtils()->SwitchOffRunDepCorrection();
111  }
112 
113  // Analysis tasks setting and configuration
114  Int_t n = 0;//Analysis number, order is important
115 
116  if(calorimeter.Contains("EMCAL"))
117  {
118  // Photon analysis
119  //
120  maker->AddAnalysis(ConfigurePhotonAnalysis(col, simulation, "EMCAL", year, tm, shshMax, printSettings, debug), n++);
121 
122  // Pi0 analysis
123  //
124  printf("AliAnaPi0: EMCal-EMCal invariant mass\n");
125  maker->AddAnalysis(ConfigurePi0Analysis (col, simulation, "EMCAL", kFALSE, year, tm, mixOn , printSettings, debug), n++);
126  }
127 
128  if(calorimeter.Contains("PHOS"))
129  {
130  // Photon analysis
131  //
132  maker->AddAnalysis(ConfigurePhotonAnalysis(col, simulation, "PHOS", year, tm, shshMax, printSettings, debug), n++);
133 
134  // Pi0 analysis
135  //
136  printf("AliAnaPi0: PHOS-PHOS invariant mass\n");
137  maker->AddAnalysis(ConfigurePi0Analysis (col, simulation, "PHOS", kFALSE, year, tm, mixOn , printSettings, debug), n++);
138  }
139 
140  if(calorimeter.Contains("BothCalo"))
141  {
142  // Pi0 analysis
143  //
144  //Do it with PHOS or EMCal in the main loop and EMCal or PHOS in the mixed event, should be equivalent?
145  printf("AliAnaPi0: DCal-PHOS invariant mass\n");
146  maker->AddAnalysis(ConfigurePi0Analysis (col, simulation, "EMCAL", kTRUE, year, tm, mixOn, printSettings, debug), n++);
147  printf("AliAnaPi0: PHOS-DCal invariant mass\n");
148  maker->AddAnalysis(ConfigurePi0Analysis (col, simulation, "PHOS" , kTRUE, year, tm, mixOn, printSettings, debug), n++);
149  }
150 
151  // Maker
152 
153  maker->SetAnaDebug(debug) ;
154 
155  maker->SwitchOnHistogramsMaker() ;
156  maker->SwitchOnAODsMaker() ;
157 
158  maker->SwitchOffDataControlHistograms();
159  if(rejectEMCTrig) maker->SwitchOnDataControlHistograms();
160 
161  if(simulation)
162  {
163  // Calculate the cross section weights, apply them to all histograms
164  // and fill xsec and trial histo. Sumw2 must be activated.
165  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionCalculation();
166  //maker->SwitchOnSumw2Histograms();
167 
168  // For recent productions where the cross sections and trials are not stored in separate file
169  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionFromEventHeader() ;
170 
171  // Just fill cross section and trials histograms.
172  maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionHistoFill();
173 
174  // Add control histogram with pT hard to control aplication of weights
175  maker->SwitchOnPtHardHistogram();
176  }
177 
178  if(printSettings) maker->Print("");
179 
180  printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, calorimeter.Data());
181 
182  // Create task
183 
185 
186  task->SetDebugLevel(debug);
187 
188  //task->SetBranches("ESD:AliESDRun.,AliESDHeader");
189  //task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
190 
191  task->SetAnalysisMaker(maker);
192 
193  mgr->AddTask(task);
194 
195  //Create containers
196 
197  if(outputfile.Length()==0) outputfile = AliAnalysisManager::GetCommonFileName();
198 
199  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(kAnaPi0, TList::Class(),
200  AliAnalysisManager::kOutputContainer,
201  Form("%s",outputfile.Data()));
202 
203  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("Param_%s",kAnaPi0.Data()), TList::Class(),
204  AliAnalysisManager::kParamContainer,
205  "AnalysisParameters.root");
206 
207  // Create ONLY the output containers for the data produced by the task.
208  // Get and connect other common input/output containers via the manager as below
209  //==============================================================================
210  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
211  //if(!kData.Contains("delta") && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
212  mgr->ConnectOutput (task, 1, cout_pc);
213  mgr->ConnectOutput (task, 2, cout_cuts);
214 
215 // if(!mixOn)
216 // {
217  UInt_t mask = SetTriggerMaskFromName(trigger);
218  task->SelectCollisionCandidates(mask);
219 // }
220 
221  return task;
222 }
223 
227 AliCaloTrackReader * ConfigureReader(TString col, Bool_t simulation,
228  TString clustersArray, Bool_t tender,
229  TString calorimeter, Bool_t nonLinOn,
230  TString trigger, Bool_t rejectEMCTrig,
231  Int_t minCen, Int_t maxCen,
232  Bool_t printSettings, Int_t debug )
233 {
234  // Get the data type ESD or AOD
235  AliAnalysisManager * mgr = AliAnalysisManager::GetAnalysisManager();
236  TString inputDataType = mgr->GetInputEventHandler()->GetDataType();
237 
238  AliCaloTrackReader * reader = 0;
239  if (inputDataType == "AOD") reader = new AliCaloTrackAODReader();
240  else if(inputDataType == "ESD") reader = new AliCaloTrackESDReader();
241  else printf("AliCaloTrackReader::ConfigureReader() - Data not known InputData=%s\n",inputDataType.Data());
242 
243  reader->SetDebug(debug);//10 for lots of messages
244 
245  reader->SetControlHistogramEnergyBinning(80,0, 40) ; // Energy and pt histograms
246  //
247  // MC settings
248  //
249  // Check if kine stack is available, independent of request of simulation
250  Bool_t useKinematics = kFALSE;
251  useKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
252 
253  if(simulation)
254  {
255  if (!useKinematics && inputDataType=="AOD") useKinematics = kTRUE; //AOD primary should be available ...
256  }
257 
258  if(useKinematics)
259  {
260  if(inputDataType == "ESD")
261  {
262  reader->SwitchOnStack();
263  reader->SwitchOffAODMCParticles();
264  }
265  else if(inputDataType == "AOD")
266  {
267  reader->SwitchOffStack();
268  reader->SwitchOnAODMCParticles();
269  }
270  }
271 
272  // In case of Pythia pt Hard bin simulations (jet-jet, gamma-jet)
273  // reject some special events that bother the cross section
274  if(simulation)
275  {
276  // Event rejection cuts for jet-jet simulations, do not use in other
277  reader->SetPtHardAndJetPtComparison(kTRUE);
278  reader->SetPtHardAndJetPtFactor(4);
279 
280  // Gamma-jet
281  //reader->SetPtHardAndClusterPtComparison(kTRUE);
282  //reader->SetPtHardAndClusterPtFactor(1.5);
283  }
284 
285  //------------------------
286  // Detector input filling
287  //------------------------
288 
289  //Min cluster/track E
290  reader->SetEMCALEMin(0.3);
291  reader->SetEMCALEMax(1000);
292  reader->SetPHOSEMin(0.3);
293  reader->SetPHOSEMax(1000);
294  reader->SetCTSPtMin(0.2);
295  reader->SetCTSPtMax(1000);
296 
297 // reader->SetEMCALNCellsCut(1);
298 // reader->SetPHOSNCellsCut(2);
299 //
300 // reader->SetEMCALBadChannelMinDist(2);
301 // reader->SetPHOSBadChannelMinDist(2);
302 
305 
306  // Shower shape smearing
307  // Set it in the train configuration page not here for the moment
308 // if(simulation)
309 // {
310 // reader->SwitchOffShowerShapeSmearing(); // Active only on MC, off by default
311 // reader->SetShowerShapeSmearWidth(0.005);
312 // }
313 
314  //
315  // Tracks
316  //
317  reader->SwitchOnCTS();
318 
319  reader->SwitchOffUseTrackTimeCut();
320  reader->SetTrackTimeCut(0,50);
321 
322  reader->SwitchOffFiducialCut();
323  reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;
324 
325  reader->SwitchOffUseTrackDCACut();
326  //reader->SetTrackDCACut(0,0.0105);
327  //reader->SetTrackDCACut(1,0.035);
328  //reader->SetTrackDCACut(2,1.1);
329 
330  if(inputDataType=="ESD")
331  {
332  gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/CreateTrackCutsPWGJE.C");
333 
334  //AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004);
335  //reader->SetTrackCuts(esdTrackCuts);
336 
337  AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10001008);
338  reader->SetTrackCuts(esdTrackCuts);
339  AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10011008);
340  reader->SetTrackComplementaryCuts(esdTrackCuts2);
341 
343  }
344  else if(inputDataType=="AOD")
345  {
346  reader->SwitchOnAODHybridTrackSelection(); // Check that the AODs have Hybrids!!!!
348  reader->SetTrackStatus(AliVTrack::kITSrefit);
349 
350  //reader->SwitchOnAODPrimaryTrackSelection(); // Used in preliminary results of QM from Nicolas and Xiangrong?
351  //reader->SwitchOnTrackHitSPDSelection(); // Check that the track has at least a hit on the SPD, not much sense to use for hybrid or TPC only tracks
352  //reader->SetTrackFilterMask(128); // Filter bit, not mask, use if off hybrid, TPC only
353  }
354 
355  //
356  // Calorimeter
357  //
358  if(clustersArray == "" && !tender)
359  {
360  printf("**************** Standard EMCAL clusters branch analysis **************** \n");
362  // Check in ConfigureCaloUtils that the recalibration and bad map are ON
363  }
364  else
365  {
366  printf("**************** Input for analysis is Clusterizer %s **************** \n", clustersArray.Data());
367  reader->SetEMCALClusterListName(clustersArray);
369  }
370 
371  // Time cuts
373  if(simulation)
374  {
375  reader->SwitchOffUseEMCALTimeCut();
376  reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut
377  }
378  else
379  {
380  reader->SwitchOnUseEMCALTimeCut();
381  reader->SetEMCALTimeCut(-25,20);
382  }
383 
384  // CAREFUL
385  if(nonLinOn) reader->SwitchOnClusterELinearityCorrection();
387 
388  if(calorimeter.Contains("EMCAL"))
389  {
390  reader->SwitchOnEMCALCells();
391  reader->SwitchOnEMCAL();
392  }
393 
394  if(calorimeter.Contains("PHOS"))
395  { // Should be on if QA is activated with correlation on
396  reader->SwitchOnPHOSCells();
397  reader->SwitchOnPHOS();
398  }
399 
400  //-----------------
401  // Event selection
402  //-----------------
403 
404  //if(!simulation) reader->SetFiredTriggerClassName("CEMC7EGA-B-NOPF-CENTNOTRD"); // L1 Gamma
405 
406  // Event triggered by EMCal selection settings
409 
410 
411  if( rejectEMCTrig && !simulation )
412  {
413  printf("=== Remove bad triggers === \n");
416 
417 // reader->SetTriggerPatchTimeWindow(8,9); // default values
418 // if (kRunNumber < 146861) reader->SetEventTriggerL0Threshold(3.);
419 // else if(kRunNumber < 154000) reader->SetEventTriggerL0Threshold(4.);
420 // else if(kRunNumber < 165000) reader->SetEventTriggerL0Threshold(5.5);
421 // //redefine for other periods, triggers
422 //
423 // if(kRunNumber < 172000)
424 // {
425 // reader->SetEventTriggerL1Bit(4,5); // current LHC11 data
426 // printf("\t Old L1 Trigger data format!\n");
427 // }
428 // else
429 // {
430 // reader->SetEventTriggerL1Bit(6,8); // LHC12-13 data
431 // printf("\t Current L1 Trigger data format!\n");
432 // }
433 
434  if(clustersArray != "" || tender)
435  {
436  printf("Trigger cluster calibration OFF\n");
438  }
439  }
440 
441  //reader->RejectFastClusterEvents() ;
442 
443  reader->SetZvertexCut(10.); // Open cut
444  reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
445  reader->SwitchOnRejectNoTrackEvents();
446 
447  reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
448  reader->SwitchOffPileUpEventRejection(); // remove pileup by default off, apply it only for MB not for trigger
449 
450  if(col=="PbPb")
451  {
452  // Centrality
453  reader->SetCentralityClass("V0M");
454  reader->SetCentralityOpt(100); // 10 (c= 0-10, 10-20 ...), 20 (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..)
455  reader->SetCentralityBin(minCen,maxCen); // Accept all events, if not select range
456 
457  // Event plane (only used in Maker and mixing for AliAnaPi0/AliAnaHadronCorrelation for the moment)
458  reader->SetEventPlaneMethod("V0");
459  }
460 
461  if(printSettings) reader->Print("");
462 
463  return reader;
464 }
465 
469 AliCalorimeterUtils* ConfigureCaloUtils(TString col, Bool_t simulation,
470  TString clustersArray, Bool_t tender,
471  Bool_t nonLinOn, Int_t year,
472  Bool_t printSettings, Int_t debug)
473 {
475 
476  cu->SetDebug(debug);
477 
478  // Remove clusters close to borders, at least max energy cell is 1 cell away
481 
483 
484  if (year == 2010) cu->SetNumberOfSuperModulesUsed(4);
485  else if(year <= 2013) cu->SetNumberOfSuperModulesUsed(10);
486  else if(year > 2013) cu->SetNumberOfSuperModulesUsed(20);
487  else cu->SetNumberOfSuperModulesUsed(10);
488 
489  if(kAnaPi0.Contains("_PHOS_") && !kAnaPi0.Contains("EMCAL") && !kAnaPi0.Contains("Both"))
490  {
491  if(year <= 2013) cu->SetNumberOfSuperModulesUsed(3);
492  else cu->SetNumberOfSuperModulesUsed(4);
493  }
494 
495  printf("xxx Number of SM set to <%d> xxx\n",cu->GetNumberOfSuperModulesUsed());
496 
497  // Search of local maxima in cluster
498  if(col=="pp")
499  {
500  cu->SetLocalMaximaCutE(0.1);
501  cu->SetLocalMaximaCutEDiff(0.03);
502  }
503  else
504  {
505  cu->SetLocalMaximaCutE(0.2);
506  cu->SetLocalMaximaCutEDiff(0.03);
507  }
508 
510 
512 
513  // EMCAL settings
514 
515  if(!simulation)
517 
518  AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
519 
520  // calibrations
521  Bool_t calibEner = kFALSE;
522  Bool_t calibTime = kFALSE;
523  cu->SwitchOffRecalibration();
525 
526  if( !tender )
527  {
528  cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
530 
531  calibEner = kTRUE;
532  calibTime = kTRUE;
533  if (year > 2014) calibTime = kFALSE; // Remove as soon as calib available
534  }
535 
536  if( simulation )
537  {
538  calibEner = kFALSE;
539  calibTime = kFALSE;
540 
541  cu->SwitchOffRecalibration(); // Check the reader if it is taken into account during filtering
543  }
544 
545  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/EMCAL/macros/ConfigureEMCALRecoUtils.C");
547  simulation,
548  kTRUE, // exotic
549  nonLinOn, // Non linearity
550  calibEner, // E calib
551  kTRUE, // bad map
552  calibTime); // time calib
553 
554  if( calibTime ) recou->SetExoticCellDiffTimeCut(200);
555 
556  if( nonLinOn ) cu->SwitchOnCorrectClusterLinearity();
557 
558  printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn());
559  printf("ConfigureCaloUtils() - EMCAL BadMap ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn());
560 
561  // PHOS
563 
564  if(printSettings) cu->Print("");
565 
566  return cu;
567 }
568 
573 AliAnaPhoton* ConfigurePhotonAnalysis(TString col, Bool_t simulation,
574  TString calorimeter, Int_t year,
575  Int_t tm, Float_t shshMax,
576  Bool_t printSettings, Int_t debug)
577 {
578  AliAnaPhoton *ana = new AliAnaPhoton();
579 
580  // cluster selection cuts
581 
583 
584  ana->SwitchOffFiducialCut();
585 
586  ana->SetCalorimeter(calorimeter);
587 
588  ana->SwitchOnFillShowerShapeHistograms(); // Filled before photon shower shape selection
589 
590  //if(!simulation) ana->SwitchOnFillPileUpHistograms();
591 //
592  if(tm) ana->SwitchOnTrackMatchRejection() ;
593  else ana->SwitchOffTrackMatchRejection() ;
594 
595  ana->SwitchOnTMHistoFill() ;
596 
597  if(calorimeter == "PHOS")
598  {
599  ana->SetNCellCut(2);// At least 3 cells
600  ana->SetMinPt(0.5);
601  ana->SetMinDistanceToBadChannel(2, 4, 5);
602  ana->SetTimeCut(-1e10,1e10); // open cut
603  }
604  else
605  {//EMCAL
606  ana->SetNCellCut(1);// At least 2 cells
607  ana->SetMinEnergy(0.5); // avoid mip peak at E = 260 MeV
608  ana->SetMaxEnergy(100);
609  ana->SetTimeCut(-1e10,1e10); // open cut, usual time window of [425-825] ns if time recalibration is off
610  // restrict to less than 100 ns when time calibration is on
611  ana->SetMinDistanceToBadChannel(2, 4, 6);
612 
613  // NLM cut, used in all, exclude clusters with more than 2 maxima
614  // Not needed if M02 cut is already strong or clusterizer V2
615  ana->SetNLMCut(1, 2) ;
616  }
617 
618  //PID cuts (shower shape)
619  ana->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian
620  AliCaloPID* caloPID = ana->GetCaloPID();
621  //Not used in bayesian
622 
623  // EMCAL
624 
625  //caloPID->SetEMCALLambda0CutMax(0.27);
626  if(calorimeter=="EMCAL")
627  {
628  caloPID->SetEMCALLambda0CutMax(shshMax);
629  caloPID->SetEMCALLambda0CutMin(0.10);
630  }
631 
632  // Track matching
633  caloPID->SetEMCALDEtaCut(0.025);
634  caloPID->SetEMCALDPhiCut(0.030);
635 
636  // PHOS
637  caloPID->SetPHOSDispersionCut(2.5);
638  caloPID->SetPHOSRCut(2.);
639  //if(kInputData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored
640 
641  // Branch AOD settings
642  ana->SetOutputAODName(Form("Photon_%s_%s",calorimeter.Data(), kAnaPi0.Data()));
643  ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
644 
645  //Set Histograms name tag, bins and ranges
646  ana->AddToHistogramsName(Form("AnaPhoton_%s_TM%d_",calorimeter.Data(),tm));
647 
648  SetAnalysisCommonParameters(ana,calorimeter,year,col,simulation,printSettings,debug) ; // see method below
649 
650  if(ana->GetFirstSMCoveredByTRD() > 0)
651  printf(">>> Set first SM covered by TRD, SM=%d <<< year %d \n", ana->GetFirstSMCoveredByTRD(),year);
652 
653  // Number of particle type MC histograms
654  ana->FillNOriginHistograms (14); // 18 max
655  ana->FillNPrimaryHistograms(4); // 7 max
656 
657  return ana;
658 }
659 
663 AliAnaPi0* ConfigurePi0Analysis(TString col, Bool_t simulation,
664  TString calorimeter, Bool_t bothCalo, Int_t year,
665  Int_t tm, Bool_t mixOn,
666  Bool_t printSettings, Int_t debug)
667 {
668  AliAnaPi0 *ana = new AliAnaPi0();
669 
670  ana->SetDebug(debug);
671 
672  // Input delta AOD settings
673  ana->SetInputAODName(Form("Photon_%s_%s",calorimeter.Data(),kAnaPi0.Data()));
674 
675  if(bothCalo)
676  {
678  if ( calorimeter == "EMCAL" ) ana->SetOtherDetectorInputName(Form("Photon_PHOS_%s" ,kAnaPi0.Data()));
679  else ana->SetOtherDetectorInputName(Form("Photon_EMCAL_%s",kAnaPi0.Data()));
680  }
681 
682  // Calorimeter settings
683  ana->SetCalorimeter(calorimeter);
684 
685  // settings for pp collision mixing
686  if(mixOn) ana->SwitchOnOwnMix();
687  else ana->SwitchOffOwnMix();
688 
689  // Cuts
690  if (calorimeter == "EMCAL" )
691  {
692  if(year < 2014) ana->SetPairTimeCut(50);
693  else ana->SetPairTimeCut(200); // REMEMBER to remove this when time calib is on
694  }
695 
696  ana->SetNPIDBits(1);
697  ana->SetNAsymCuts(1); // no asymmetry cut, previous studies showed small effect.
698  // In EMCAL assymetry cut prevents combination of assymetric decays which is the main source of pi0 at high E.
699 
700  if (col == "pp" )
701  {
702  ana->SetNCentrBin(1);
703  ana->SwitchOffTrackMultBins();
704  ana->SetNZvertBin(10);
705  ana->SetNRPBin(1);
706  ana->SetNMaxEvMix(100);
707  ana->SetMinPt(0.5); // 0.5
708  }
709  else if(col == "PbPb")
710  {
711  ana->SetNCentrBin(10);
712  ana->SetNZvertBin(10);
713  ana->SetNRPBin(4);
714  ana->SetNMaxEvMix(10);
715  ana->SetMinPt(1.5);
716  }
717  else if(col =="pPb")
718  {
719  ana->SetNCentrBin(1);
720  ana->SetNZvertBin(10);
721  ana->SetNRPBin(4);
722  ana->SetNMaxEvMix(100);
723  ana->SetMinPt(0.5);
724  }
725 
726  // Angle cut, avoid pairs with too large angle
727  ana->SwitchOnAngleSelection();
728  ana->SetAngleMaxCut(TMath::DegToRad()*80.); // EMCal: 4 SM in phi, 2 full SMs in eta
729  ana->SetAngleCut(0.014); // Minimum angle open, cell size
730 
731  //if(!bothCalo) ana->SwitchOnSMCombinations();
732  ana->SwitchOnSMCombinations();
734  ana->SwitchOnFillAngleHisto();
735  ana->SwitchOnFillOriginHisto(); // MC
736 
737  // Set Histograms name tag, bins and ranges
738 
739  if(!bothCalo) ana->AddToHistogramsName(Form("AnaPi0_%s_TM%d_",calorimeter.Data(),tm));
740  else ana->AddToHistogramsName(Form("AnaPi0_%sPlusOther_TM%d_",calorimeter.Data(),tm));
741 
742  SetAnalysisCommonParameters(ana,calorimeter,year,col,simulation,printSettings,debug) ; // see method below
743 
744  if(printSettings) ana->Print("");
745 
746  return ana;
747 }
748 
756  TString calorimeter, Int_t year,
757  TString col, Bool_t simulation,
758  Bool_t printSettings, Int_t debug)
759 {
760  //
761  // Histograms ranges
762  //
763  AliHistogramRanges* histoRanges = ana->GetHistogramRanges();
764 
765  histoRanges->SetHistoPtRangeAndNBins(0, 40, 80) ; // Energy and pt histograms
766 
767  if(calorimeter=="EMCAL")
768  {
769  if(year==2010)
770  {
771  histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
772  histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA
773  histoRanges->SetHistoYRangeAndNBins(370,450,40); // QA
774  }
775  else if ( year < 2014 )
776  {
777  histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 104) ;
778  histoRanges->SetHistoXRangeAndNBins(-460,90,200); // QA
779  histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA
780  }
781  else // Run2
782  {
783  histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 329*TMath::DegToRad(), 250) ;
784  histoRanges->SetHistoXRangeAndNBins(-460,460,230); // QA
785  histoRanges->SetHistoYRangeAndNBins(-450,450,225); // QA
786  }
787 
788  histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
789  }
790  else if(calorimeter=="PHOS")
791  {
792  histoRanges->SetHistoPhiRangeAndNBins(250*TMath::DegToRad(), 320*TMath::DegToRad(), 70) ;
793  histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
794  }
795  else if(calorimeter=="CTS")
796  {
797  ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
798  ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
799  }
800 
801  histoRanges->SetHistoShowerShapeRangeAndNBins(-0.1, 4.9, 500);
802 
803  // Invariant mass histo
804  histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ;
805  histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
806 
807  // check if time calibration is on
808  histoRanges->SetHistoTimeRangeAndNBins(-1000,1000,1000);
809  //histoRanges->SetHistoTimeRangeAndNBins(-400.,400,400);
810  histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
811 
812  // track-cluster residuals
813  histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.05,0.05,100);
814  histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.05,0.05,100);
815  histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA
816 
817  // QA, electron, charged
818  histoRanges->SetHistoPOverERangeAndNBins(0,2.,200);
819  histoRanges->SetHistodEdxRangeAndNBins(0.,200.,200);
820 
821  // QA
822  histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
823  histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
824  histoRanges->SetHistoZRangeAndNBins(-350,350,175);
825  histoRanges->SetHistoRRangeAndNBins(430,460,30);
826  histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500);
827  histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
828 
829  // QA, correlation
830  if(col=="PbPb")
831  {
832  histoRanges->SetHistoNClusterCellRangeAndNBins(0,100,100);
833  histoRanges->SetHistoNClustersRangeAndNBins(0,500,50);
834  histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,2000,200);
835  }
836  else
837  {
838  histoRanges->SetHistoNClusterCellRangeAndNBins(0,50,50);
839  histoRanges->SetHistoNClustersRangeAndNBins(0,50,50);
840  histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,200,200);
841  }
842 
843  // xE, zT
844  histoRanges->SetHistoRatioRangeAndNBins(0.,2.,200);
845  histoRanges->SetHistoHBPRangeAndNBins (0.,10.,200);
846 
847  // Isolation
848  histoRanges->SetHistoPtInConeRangeAndNBins(0, 50 , 250);
849  histoRanges->SetHistoPtSumRangeAndNBins (0, 100, 250);
850 
851  //
852  // TRD SM
853  //
854  if (year == 2011) ana->SetFirstSMCoveredByTRD( 6);
855  else if(year == 2012 ||
856  year == 2013) ana->SetFirstSMCoveredByTRD( 4);
857  else ana->SetFirstSMCoveredByTRD(-1);
858 
859  //
860  // MC histograms?
861  //
862  if(simulation) ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
863  else ana->SwitchOffDataMC() ;
864 
865  if(col.Contains("PbPb")) ana->SwitchOnFillHighMultiplicityHistograms();
867 
868  //Set here generator name, default pythia
869  //ana->GetMCAnalysisUtils()->SetMCGenerator("");
870 
871  //
872  // Debug
873  //
874  if(printSettings) ana->Print("");
875 
876  ana->SetDebug(debug); // 10 for lots of messages
877 }
878 
883 UInt_t SetTriggerMaskFromName(TString trigger)
884 {
885  if(trigger=="EMC7")
886  {
887  printf("CaloTrackCorr trigger EMC7\n");
888  return AliVEvent::kEMC7;
889  }
890  else if (trigger=="INT7")
891  {
892  printf("CaloTrackCorr trigger INT7\n");
893  return AliVEvent::kINT7;
894  }
895  else if(trigger=="EMC1")
896  {
897  printf("CaloTrackCorr trigger EMC1\n");
898  return AliVEvent::kEMC1;
899  }
900  else if(trigger=="MB")
901  {
902  printf("CaloTrackCorr trigger MB\n");
903  return AliVEvent::kMB;
904  }
905  else if(trigger=="PHOS")
906  {
907  printf("CaloTrackCorr trigger PHOS\n");
908  return AliVEvent::kPHI7;
909  }
910  else if(trigger=="PHOSPb")
911  {
912  printf("CaloTrackCorr trigger PHOSPb\n");
913  return AliVEvent::kPHOSPb;
914  }
915  else if(trigger=="AnyINT")
916  {
917  printf("CaloTrackCorr trigger AnyINT\n");
918  return AliVEvent::kAnyINT;
919  }
920  else if(trigger=="INT")
921  {
922  printf("CaloTrackCorr trigger AnyINT\n");
923  return AliVEvent::kAny;
924  }
925  else if(trigger=="EMCEGA")
926  {
927  printf("CaloTrackCorr trigger EMC Gamma\n");
928  return AliVEvent::kEMCEGA;
929  }
930  else if(trigger=="EMCEJE")
931  {
932  printf("CaloTrackCorr trigger EMC Jet\n");
933  return AliVEvent::kEMCEJE;
934  }
935  else if(trigger=="Central")
936  {
937  printf("CaloTrackCorr trigger Central\n");
938  return AliVEvent::kCentral;
939  }
940  else if(trigger=="CentralEGA")
941  {
942  printf("CaloTrackCorr trigger Central+EMCEGA\n");
943  return (AliVEvent::kCentral | AliVEvent::kEMCEGA);
944  }
945  else if(trigger=="SemiCentral")
946  {
947  printf("CaloTrackCorr trigger SemiCentral\n");
948  return AliVEvent::kSemiCentral;
949  }
950  else if(trigger=="SemiOrCentral")
951  {
952  printf("CaloTrackCorr trigger SemiCentral Or Central\n");
953  return (AliVEvent::kSemiCentral | AliVEvent::kCentral);
954  }
955  else return AliVEvent::kAny;
956 }
957 
virtual void SwitchOnAODTrackSharedClusterSelection()
void SetHistoTrackMultiplicityRangeAndNBins(Int_t min, Int_t max, Int_t n)
virtual void SetDebug(Int_t d)
AliAnalysisTaskCaloTrackCorrelation * AddTaskPi0(TString calorimeter="EMCAL", Bool_t simulation=kFALSE, Int_t year=2015, TString col="pp", TString trigger="EMC7", Bool_t rejectEMCTrig=kFALSE, Bool_t muonCaloPass=kFALSE, TString clustersArray="", Bool_t tender=kFALSE, Bool_t nonLinOn=kFALSE, Float_t shshMax=0.5, Bool_t tm=kTRUE, Int_t minCen=-1, Int_t maxCen=-1, Bool_t mixOn=kTRUE, TString outputfile="", Bool_t printSettings=kFALSE, Int_t debug=0)
Definition: AddTaskPi0.C:35
void SetAngleCut(Float_t a)
Definition: AliAnaPi0.h:76
void SetNumberOfCellsFromPHOSBorder(Int_t n)
void SwitchOnPairWithOtherDetector()
Definition: AliAnaPi0.h:141
void SwitchOnFillOriginHisto()
Definition: AliAnaPi0.h:128
void ana(Int_t mode=mGRID)
Definition: ana.C:86
void SetSimpleCTSFiducialCut(Float_t abseta, Float_t phimin, Float_t phimax)
void SetHistoMassRangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual void AddToHistogramsName(TString add)
void SetHistoXRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SwitchOnTrackMatchRejection()
Definition: AliAnaPhoton.h:111
void SwitchOnLoadOwnEMCALGeometryMatrices()
void SwitchOnTMHistoFill()
Definition: AliAnaPhoton.h:83
AliAnaPi0 * ConfigurePi0Analysis(TString col, Bool_t simulation, TString calorimeter, Bool_t bothCalo, Int_t year, Int_t tm, Bool_t mixOn, Bool_t printSettings, Int_t debug)
Definition: AddTaskPi0.C:663
void SetNPIDBits(Int_t s)
Definition: AliAnaPi0.h:115
virtual void SwitchOnAODHybridTrackSelection()
virtual void SetCentralityBin(Int_t min, Int_t max)
AliEMCALRecoUtils * GetEMCALRecoUtils() const
void FillNPrimaryHistograms(Int_t n)
Definition: AliAnaPhoton.h:116
void SwitchOffClusterELinearityCorrection()
void SetCTSPtMax(Float_t pt)
void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n)
Selected photon clusters invariant mass analysis.
Definition: AliAnaPi0.h:38
virtual void SetCalorimeter(TString &calo)
Set the calorimeter for the analysis. A string.
virtual void SetInputAODName(TString name)
virtual void SetTrackComplementaryCuts(AliESDtrackCuts *)
void SetEMCALEMin(Float_t en)
void SwitchOnSMCombinations()
Definition: AliAnaPi0.h:89
void SetMinDistanceToBadChannel(Float_t m1, Float_t m2, Float_t m3)
Definition: AliAnaPhoton.h:94
void SwitchOnAngleSelection()
Definition: AliAnaPi0.h:70
virtual void SetOutputAODClassName(TString name)
void SwitchOffMultipleCutAnalysis()
Definition: AliAnaPi0.h:110
void SetHistodRRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetLocalMaximaCutEDiff(Float_t c)
void SetNumberOfCellsFromEMCALBorder(Int_t n)
void SetNCellCut(Int_t n)
Definition: AliAnaPhoton.h:102
void SetAngleMaxCut(Float_t a)
Definition: AliAnaPi0.h:77
const TString calorimeter
Definition: anaM.C:35
virtual void SetPtHardAndJetPtComparison(Bool_t compare)
Bool_t IsRecalibrationOn() const
void SetHistoTrackResidualEtaRangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
Class for event, clusters and tracks filtering and preparation for the AOD analysis.
void SetCTSPtMin(Float_t pt)
void SetPHOSRCut(Float_t rcut)
Definition: AliCaloPID.h:207
void SetEMCALDPhiCut(Float_t dcut)
Definition: AliCaloPID.h:201
virtual void SetOutputAODName(TString name)
void SwitchOffRecalculateClusterTrackMatching()
void SwitchOnFillAngleHisto()
Definition: AliAnaPi0.h:79
void SwitchOffVertexBCEventSelection()
Base class for CaloTrackCorr analysis algorithms.
void SwitchOffTrackMatchRejection()
Definition: AliAnaPhoton.h:112
void SetHistoPtInConeRangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual void SetDebug(Int_t d)
void SetHistoPOverERangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual AliFiducialCut * GetFiducialCut()
virtual void SetCentralityOpt(Int_t opt)
void SetHistoPhiRangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual AliHistogramRanges * GetHistogramRanges()
void SetHistoPtSumRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetTrackStatus(ULong_t bit)
TString kAnaPi0
Global name to be composed of the settings, used to set the AOD branch name.
Definition: AddTaskPi0.C:9
Bool_t IsBadChannelsRemovalSwitchedOn() const
Filter EMCal/PHOS clusters for photon analysis.
Definition: AliAnaPhoton.h:32
void SetHistoTrackResidualPhiRangeAndNBins(Float_t min, Float_t max, Int_t n)
AliCaloTrackReader * ConfigureReader(TString col, Bool_t simulation, TString clustersArray, Bool_t tender, TString calorimeter, Bool_t nonLinOn, TString trigger, Bool_t rejectEMCTrig, Int_t minCen, Int_t maxCen, Bool_t printSettings, Int_t debug)
Definition: AddTaskPi0.C:227
void SetControlHistogramEnergyBinning(Int_t nBins, Float_t emin, Float_t emax)
void SwitchOffTriggerClusterTimeRecal()
Base class for event, clusters and tracks filtering and preparation for the analysis.
void SetHistoNClusterCellRangeAndNBins(Int_t min, Int_t max, Int_t n)
void SwitchOffBadTriggerEventsRemoval()
void SetEMCALClusterListName(TString &name)
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
Definition: AliAnaPi0.cxx:1384
Int_t GetNumberOfSuperModulesUsed() const
void SetHistoYRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetTimeCut(Double_t min, Double_t max)
Definition: AliAnaPhoton.h:97
void SetAnalysisCommonParameters(AliAnaCaloTrackCorrBaseClass *ana, TString calorimeter, Int_t year, TString col, Bool_t simulation, Bool_t printSettings, Int_t debug)
Definition: AddTaskPi0.C:755
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
virtual void SetZvertexCut(Float_t zcut=10.)
void SetNumberOfSuperModulesUsed(Int_t nSM)
Class containing more common histogram axis types.
void SetEMCALLambda0CutMax(Float_t lcut)
Definition: AliCaloPID.h:192
virtual void SetNCentrBin(Int_t n=1)
Number of bins in reaction plain.
virtual void SetPtHardAndJetPtFactor(Float_t factor)
Class for event, clusters and tracks filtering and preparation for the ESD analysis.
AliAnaPhoton * ConfigurePhotonAnalysis(TString col, Bool_t simulation, TString calorimeter, Int_t year, Int_t tm, Float_t shshMax, Bool_t printSettings, Int_t debug)
Definition: AddTaskPi0.C:573
virtual void SetEventPlaneMethod(TString m)
void SetNAsymCuts(Int_t s)
Definition: AliAnaPi0.h:113
void SetPHOSEMin(Float_t en)
virtual void SetNRPBin(Int_t n=1)
Number of bins for vertex position.
void SetHistoNClustersRangeAndNBins(Int_t min, Int_t max, Int_t n)
void SetPHOSDispersionCut(Float_t dcut)
Definition: AliCaloPID.h:210
UInt_t SetTriggerMaskFromName(TString trigger)
Definition: AddTaskPi0.C:883
virtual void SetTrackCuts(AliESDtrackCuts *)
virtual void SwitchOffFiducialCut()
virtual void SetCentralityClass(TString name)
void SwitchOnFillShowerShapeHistograms()
Definition: AliAnaPhoton.h:69
void SwitchOnBadTriggerEventsRemoval()
void SetHistoEtaRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SwitchOnClusterELinearityCorrection()
void SetTrackTimeCut(Double_t a, Double_t b)
void SetEMCALTimeCut(Double_t a, Double_t b)
void SetHistoAsymmetryRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoV0MultiplicityRangeAndNBins(Int_t min, Int_t max, Int_t n)
Main class conecting the CaloTrackCorrelations package and Analysis Frame.
void SwitchOffLoadOwnPHOSGeometryMatrices()
void SetHistoZRangeAndNBins(Float_t min, Float_t max, Int_t n)
AliCalorimeterUtils * ConfigureCaloUtils(TString col, Bool_t simulation, TString clustersArray, Bool_t tender, Bool_t nonLinOn, Int_t year, Bool_t printSettings, Int_t debug)
Definition: AddTaskPi0.C:469
void SetHistoV0SignalRangeAndNBins(Int_t min, Int_t max, Int_t n)
virtual void Print(const Option_t *) const
Print some relevant parameters set for the analysis.
void SetHistoTimeRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoFinePtRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetEMCALEMax(Float_t en)
void SetOtherDetectorInputName(TString name)
Definition: AliAnaPi0.h:143
Class for PID selection with calorimeters.
Definition: AliCaloPID.h:51
void FillNOriginHistograms(Int_t n)
Definition: AliAnaPhoton.h:114
virtual void SetNMaxEvMix(Int_t n=20)
Number of bins in track multiplicity.
void SetHistoShowerShapeRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetPHOSEMax(Float_t en)
void SetHistodEdxRangeAndNBins(Float_t min, Float_t max, Int_t n)
Class with utils specific to calorimeter clusters/cells.
virtual void SwitchOnConstrainTrackToVertex()
void SetHistoHBPRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetEMCALLambda0CutMin(Float_t lcut)
Definition: AliCaloPID.h:195
void SetHistoRRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoVertexDistRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoDiffTimeRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetEMCALDEtaCut(Float_t dcut)
Definition: AliCaloPID.h:198
void SwitchOffUseParametrizedTimeCut()
void SetLocalMaximaCutE(Float_t cut)
void SetHistoRatioRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetNLMCut(Int_t min, Int_t max)
Definition: AliAnaPhoton.h:105
void ConfigureEMCALRecoUtils(AliEMCALRecoUtils *reco, Bool_t bMC=kFALSE, Bool_t bExotic=kTRUE, Bool_t bNonLin=kFALSE, Bool_t bRecalE=kTRUE, Bool_t bBad=kTRUE, Bool_t bRecalT=kTRUE)
Int_t GetFirstSMCoveredByTRD() const
Time cut in ns.
Steering class of package CaloTrackCorrelartions.