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