AliPhysics  4e47bdd (4e47bdd)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskEMCALPi0Calibration.C
Go to the documentation of this file.
1 
21 AliAnalysisTaskEMCALPi0CalibSelection * AddTaskEMCALPi0Calibration(TString calibPath = "", // "alienpath/RecalibrationFactors.root"
22  TString trigger ="CEMC7",
23  Bool_t recalE = kFALSE,
24  Bool_t recalT = kFALSE,
25  Bool_t rmBad = kFALSE,
26  Bool_t nonlin = kTRUE,
27  Bool_t simu = kFALSE,
28  TString outputFile = "") // AnalysisResults.root
29 
30 {
31  // Get the pointer to the existing analysis manager via the static access method.
32  //==============================================================================
33  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34  if (!mgr)
35  {
36  ::Error("AddTaskEMCALTriggerQA", "No analysis manager to connect to.");
37  return NULL;
38  }
39 
40  // Check the analysis type using the event handlers connected to the analysis manager.
41  //==============================================================================
42  if (!mgr->GetInputEventHandler())
43  {
44  ::Error("AddTaskEMCALPi0Calibration", "This task requires an input event handler");
45  return NULL;
46  }
47 
48 
49  // Create containers for input/output
50  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
51 
53  //pi0calib->SetDebugLevel(10);
54  //pi0calib->UseFilteredEventAsInput();
55  pi0calib->SetClusterMinEnergy(0.3);
56  pi0calib->SetClusterMaxEnergy(10.);
57  pi0calib->SetClusterLambda0Cuts(0.1,0.5);
58 
59  pi0calib->SetAsymmetryCut(1.);
60  pi0calib->SetClusterMinNCells(1);
61  pi0calib->SetNCellsGroup(0);
62  pi0calib->SwitchOnSameSM();
63 
64  // Timing cuts
65  pi0calib->SetPairDTimeCut(100); // 20 ns in Run1
66  pi0calib->SetClusterMinTime(300); // 560 ns in Run1
67  pi0calib->SetClusterMaxTime(800); // 610 ns in Run1
68 
69  pi0calib->SetTriggerName(trigger);
70 
71  // Cluster recalculation, Reco Utils configuration
72 
73 
74  AliEMCALRecoUtils * reco = pi0calib->GetEMCALRecoUtils();
75 
76  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/EMCAL/macros/ConfigureEMCALRecoUtils.C");
77 
79  simu,
80  kTRUE, // exotic
81  nonlin,
82  recalE,
83  rmBad,
84  recalT);
85 
86  reco->SetNumberOfCellsFromEMCALBorder(0); // Do not remove clusters in borders!
87 
88  // recalibrate energy and do corrections because of Temperature corrections
89  pi0calib->SwitchOnClusterCorrection();
90  reco->SwitchOnRecalibration();
91  reco->SwitchOnRunDepCorrection();
92 
93  //reco->Print("");
94 
95  //---------------------
96  // Geometry alignment
97  //---------------------
98 
99  pi0calib->SetGeometryName("EMCAL_COMPLETE12SMV1_DCAL_8SM");
100 
102 
103  //---------------------
104  // Pass recalibration factors
105  // Do it here or inside the task
106  // If previous pass not available (first) avoid recalculate clusters
107  //---------------------
108 
109  pi0calib->SetCalibrationFilePath(calibPath);
110 
111  if(calibPath != "" && recalE)
112  {
113  printf("AddTaskEMCALPi0Calibration - Get the energy calibration factors from: \n %s \n",calibPath.Data());
114  pi0calib->InitEnergyCalibrationFactors();
115  }
116 
117  if(!recalE)
118  {
119  // Do not calibrate anything
120  // First iteration, just fill histograms, switch off recalculation
121  reco->SwitchOffRecalibration();
122  reco->SwitchOffRunDepCorrection(); // Careful!!!, activate when T corrections are available.
124  pi0calib->SwitchOffRecalculatePosition();
125  printf("AddTaskEMCALPi0Calibration - Pi0 Calibration: Do not recalculate the clusters! First iteration. \n");
126  // check if time is corrected in case of calibration available!!!
127  }
128 
129  pi0calib->PrintInfo();
130 
131  mgr->AddTask(pi0calib);
132 
133  if(outputFile.Length()==0) outputFile = AliAnalysisManager::GetCommonFileName();
134 
135  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
136  AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("Pi0Calibration_Trig%s",trigger.Data()),
137  TList::Class(), AliAnalysisManager::kOutputContainer,
138  outputFile.Data());
139 
140 // AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("ParamsPi0Calibration_Trig%s",trigger.Data()),
141 // TList::Class(), AliAnalysisManager::kOutputContainer,
142 // "AnalysisParameters.root");
143 
144  mgr->AddTask(pi0calib);
145 
146  mgr->ConnectInput (pi0calib, 0, cinput1);
147  mgr->ConnectOutput (pi0calib, 1, coutput);
148 // mgr->ConnectOutput (pi0calib, 2, cout_cuts);
149 
150  return pi0calib;
151 }
This task provides the input for the EMCal energy calibration with pi0 invariant mass analysis per ch...
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 debug=-1)
bool Bool_t
Definition: External.C:53
AliAnalysisTaskEMCALPi0CalibSelection * AddTaskEMCALPi0Calibration(TString calibPath="", TString trigger="CEMC7", Bool_t recalE=kFALSE, Bool_t recalT=kFALSE, Bool_t rmBad=kFALSE, Bool_t nonlin=kTRUE, Bool_t simu=kFALSE, TString outputFile="")