AliPhysics  vAN-20150630 (513c479)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
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  //---------------------
104  // Pass recalibration factors
105  // Do it here or inside the task
106  //---------------------
107 
108  pi0calib->SetCalibrationFilePath(calibPath);
109 
110  if(recalE && calibPath == "")
111  {
112  printf("Get the calibration file from AddTask!!!\n");
113 
114  TFile * calibFile = TFile::Open("RecalibrationFactors.root");
115  if(!calibFile)
116  {
117  printf("File %d not found!\n",calibPath.Data());
118  return;
119  }
120 
121  for(Int_t ism = 0; ism < 20; ism++)
122  {
123  TH2F * h = (TH2F*)calibFile->Get(Form("EMCALRecalFactors_SM%d",ism));
124 
125  if(h) reco->SetEMCALChannelRecalibrationFactors(ism,h);
126  else printf("Null histogram with calibration factors for SM%d, 1 will be used in the full SM\n",ism);
127  }
128  }
129 
130  pi0calib->PrintInfo();
131 
132  mgr->AddTask(pi0calib);
133 
134  if(outputFile.Length()==0) outputFile = AliAnalysisManager::GetCommonFileName();
135 
136  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
137  AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("Pi0Calibration_Trig%s",trigger.Data()),
138  TList::Class(), AliAnalysisManager::kOutputContainer,
139  outputFile.Data());
140 
141  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("ParamsPi0Calibration_Trig%s",trigger.Data()),
142  TList::Class(), AliAnalysisManager::kOutputContainer,
143  "AnalysisParameters.root");
144 
145  mgr->AddTask(pi0calib);
146 
147  mgr->ConnectInput (pi0calib, 0, cinput1);
148  mgr->ConnectOutput (pi0calib, 1, coutput);
149  mgr->ConnectOutput (pi0calib, 2, cout_cuts);
150 
151  return pi0calib;
152 }
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)
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="")