AliPhysics  vAN-20151012 (2287573)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskCalorimeterQA.C
Go to the documentation of this file.
1 
12 
27  Bool_t simulation = kFALSE,
28  TString outputFile = "",
29  Int_t year = 2015,
30  Bool_t printSettings = kFALSE,
31  Bool_t calibrate = kTRUE)
32 {
33  // Get the pointer to the existing analysis manager via the static access method.
34  //==============================================================================
35  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
36  if (!mgr) {
37  ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
38  return NULL;
39  }
40 
41  // Check the analysis type using the event handlers connected to the analysis manager.
42  //==============================================================================
43  if (!mgr->GetInputEventHandler()) {
44  ::Error("AddTaskPartCorr", "This task requires an input event handler");
45  return NULL;
46  }
47 
48  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
49 
50  Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
51 
52  TString ssuffix = suffix;
53  if(kUseKinematics || simulation)
54  {
55  simulation = kTRUE;
56  printf("AddTaskCalorimeterQA - CAREFUL : Triggered events not checked in simulation!! \n");
57  if(!ssuffix.Contains("default")) return;
58  }
59 
60  // Configure analysis
61  //===========================================================================
62 
63  //Reader
64  //For this particular analysis few things done by the reader.
65  //Nothing else needs to be set.
66 
67  AliCaloTrackReader * reader = 0x0;
68  if (inputDataType.Contains("AOD")) reader = new AliCaloTrackAODReader();
69  else if(inputDataType.Contains("ESD")) reader = new AliCaloTrackESDReader();
70  //reader->SetDebug(10);//10 for lots of messages
71 
72  reader->SwitchOnEMCALCells();
73  reader->SwitchOnEMCAL();
74  reader->SwitchOnPHOSCells(); // For correlation plots
75  reader->SwitchOnPHOS(); // For correlation plots
76  reader->SetEMCALPtMin(0.);
77  reader->SwitchOnCTS();
78  reader->SetCTSPtMin (0.);
79  reader->SetZvertexCut(10.);
80 
81  if(simulation)
82  {
83  if(inputDataType == "ESD")
84  {
85  reader->SwitchOnStack();
86  reader->SwitchOffAODMCParticles();
87  }
88  else if(inputDataType == "AOD")
89  {
90  reader->SwitchOffStack();
91  reader->SwitchOnAODMCParticles();
92  }
93  }
94 
95  reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
96  reader->SwitchOffWriteDeltaAOD() ;
97 
98  if(!ssuffix.Contains("default"))
99  {
102  reader->SetTriggerPatchTimeWindow(8,9);
103  //reader->SetEventTriggerL0Threshold(2.);
104  }
105 
106  if(!simulation) reader->AnalyzeOnlyPhysicsEvents(); // in case physics selection was not on
107 
108  if(calibrate && !simulation) reader->SwitchOnClusterRecalculation();
109  else reader->SwitchOffClusterRecalculation();
110 
111  if(printSettings) reader->Print("");
112 
113  // *** Calorimeters Utils ***
115  // Remove clusters close to borders, at least max energy cell is 1 cell away
117 
118  if (year == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year
119  else if (year < 2014) cu->SetNumberOfSuperModulesUsed(10);
120  else cu->SetNumberOfSuperModulesUsed(20);
121 
122 
123  cu->SwitchOffRecalibration(); // Check the reader if it is taken into account during filtering
125 
127 
128  Bool_t bExotic = kTRUE;
129  Bool_t bNonLin = kTRUE;
130  Bool_t bBadMap = kTRUE;
131 
132  Bool_t bEnCalib = kFALSE;
133  Bool_t bTiCalib = kFALSE;
134 
135  if(calibrate && !simulation)
136  {
137  cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
140 
141  bEnCalib = kTRUE;
142  bTiCalib = kTRUE;
143  }
144 
145  AliEMCALRecoUtils* recou = cu->GetEMCALRecoUtils();
146 
147  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/EMCAL/macros/ConfigureEMCALRecoUtils.C");
149  simulation,
150  bExotic,
151  bNonLin,
152  bEnCalib,
153  bBadMap,
154  bTiCalib);
155 
156  cu->SetDebug(-1);
157  if(printSettings) cu->Print("");
158 
159  // ##### Analysis algorithm settings ####
160 
161  AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
162  //emcalQA->SetDebug(10); //10 for lots of messages
163  emcalQA->SetCalorimeter("EMCAL");
164  if(simulation)
165  {
166  emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
167  emcalQA->SwitchOffStudyBadClusters();
169  }
170  else
171  {
172  emcalQA->SwitchOffDataMC() ;
173  emcalQA->SwitchOffStudyBadClusters();
174  emcalQA->SwitchOnFillAllCellTimeHisto();
175  }
176 
177  emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
178  emcalQA->SwitchOffFiducialCut();
179  emcalQA->SwitchOnCorrelation();
180  emcalQA->SwitchOffFillAllTH3Histogram();
183 
184  //Set Histrograms bins and ranges
185  emcalQA->GetHistogramRanges()->SetHistoPtRangeAndNBins(0, 50, 100) ;
186  emcalQA->GetHistogramRanges()->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
187  emcalQA->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-0.70, 0.70, 140) ;
188 
189  if ( year==2010 )
190  {
191  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 120*TMath::DegToRad(), 48) ;
192  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-230,90,120);
193  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(370,450,40);
194  }
195  else if ( year < 2014 )
196  {
197  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 180*TMath::DegToRad(), 120) ;
198  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,90,200);
199  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(100,450,100);
200  }
201  else // Run2
202  {
203  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 327*TMath::DegToRad(), 250) ;
204  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,460,230);
205  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(-450,450,225);
206  }
207 
208  emcalQA->GetHistogramRanges()->SetHistoMassRangeAndNBins(0., 0.65, 325) ;
209  emcalQA->GetHistogramRanges()->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
210  emcalQA->GetHistogramRanges()->SetHistoPOverERangeAndNBins(0,2.,50);
211  emcalQA->GetHistogramRanges()->SetHistodEdxRangeAndNBins(0.,200.,100);
212  emcalQA->GetHistogramRanges()->SetHistodRRangeAndNBins(0.,0.10,50);
213  //emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins( 400,900,250);
214  //emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(-275,275,250);
215  emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(-275,975,250);
216  emcalQA->GetHistogramRanges()->SetHistoRatioRangeAndNBins(0.,2.,100);
217  emcalQA->GetHistogramRanges()->SetHistoVertexDistRangeAndNBins(0.,500.,500);
219  emcalQA->GetHistogramRanges()->SetHistoZRangeAndNBins(-350,350,175);
220  emcalQA->GetHistogramRanges()->SetHistoRRangeAndNBins(430,460,30);
221  emcalQA->GetHistogramRanges()->SetHistoV0SignalRangeAndNBins(0,5000,100);
225  emcalQA->GetHistogramRanges()->SetHistoDiffTimeRangeAndNBins(-300, 300, 120);
226  emcalQA->GetHistogramRanges()->SetHistoTrackResidualEtaRangeAndNBins(-0.075,0.075,50);
227  emcalQA->GetHistogramRanges()->SetHistoTrackResidualPhiRangeAndNBins(-0.075,0.075,50);
228 
229  if(printSettings) emcalQA->Print("");
230 
231  // #### Configure Maker ####
233  if(ssuffix.Contains("default")) maker->SwitchOffDataControlHistograms();
234  else maker->SwitchOnDataControlHistograms();
235  maker->SetReader(reader);//pointer to reader
236  maker->SetCaloUtils(cu); //pointer to calorimeter utils
237  maker->AddAnalysis(emcalQA,0);
238  maker->SetAnaDebug(-1) ; // 0 to at least print the event number
239  maker->SwitchOnHistogramsMaker() ;
240  maker->SwitchOffAODsMaker() ;
241  if(printSettings) maker->Print("");
242 
243  printf("======================== \n");
244  printf(" End Configuration of Calorimeter QA \n");
245  printf("======================== \n");
246 
247  // Create task
248  //===========================================================================
249  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CalorimeterPerformance_%s",suffix));
250  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
251  //task->SetDebugLevel(-1);
252  task->SetAnalysisMaker(maker);
253  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
254  mgr->AddTask(task);
255 
256  //Create containers
257  // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
258  // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
259 
260  TString cname;
261  if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
262 
263 
264  cname = Form("CaloQA_%s", suffix);
265  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(cname, TList::Class(),
266  AliAnalysisManager::kOutputContainer,
267  Form("%s:%s",outputFile.Data(),cname.Data()));
268 
269 // cname = Form("CaloQACuts_%s", suffix);
270 // AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(cname, TList::Class(),
271 // AliAnalysisManager::kParamContainer,
272 // Form("%s:%s",outputFile.Data(),cname.Data()));
273 
274  //Form("%s:PartCorrCuts",outputfile.Data()));
275  // Create ONLY the output containers for the data produced by the task.
276  // Get and connect other common input/output containers via the manager as below
277  //==============================================================================
278  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
279  mgr->ConnectOutput (task, 1, cout_pc);
280 // mgr->ConnectOutput (task, 2, cout_cuts);
281 
282  return task;
283 }
284 
285 
void SetHistoTrackMultiplicityRangeAndNBins(Int_t min, Int_t max, Int_t n)
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 SetTriggerPatchTimeWindow(Int_t min, Int_t max)
AliEMCALRecoUtils * GetEMCALRecoUtils() const
void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual void SetCalorimeter(TString &calo)
Set the calorimeter for the analysis. A string.
void AddAnalysis(TObject *ana, Int_t n)
Add analysis depending on AliAnaCaloTrackCorrBaseClass to list.
Class for the Calorimeter QA analysis.
void SetHistodRRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetNumberOfCellsFromEMCALBorder(Int_t n)
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)
AliAnalysisTaskCaloTrackCorrelation * AddTaskCalorimeterQA(const char *suffix="default", Bool_t simulation=kFALSE, TString outputFile="", Int_t year=2015, Bool_t printSettings=kFALSE, Bool_t calibrate=kTRUE)
virtual void SetDebug(Int_t d)
void SetHistoPOverERangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoPhiRangeAndNBins(Float_t min, Float_t max, Int_t n)
virtual AliHistogramRanges * GetHistogramRanges()
void SetReader(AliCaloTrackReader *reader)
void SetHistoTrackResidualPhiRangeAndNBins(Float_t min, Float_t max, Int_t n)
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 SetAnalysisMaker(AliAnaCaloTrackCorrMaker *const maker)
void SetHistoYRangeAndNBins(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.
virtual void SetZvertexCut(Float_t zcut=10.)
void SetNumberOfSuperModulesUsed(Int_t nSM)
Class for event, clusters and tracks filtering and preparation for the ESD analysis.
void SetCaloUtils(AliCalorimeterUtils *caloutils)
void SetEMCALPtMin(Float_t pt)
void SetHistoEtaRangeAndNBins(Float_t min, Float_t max, Int_t n)
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 SetHistoZRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoV0SignalRangeAndNBins(Int_t min, Int_t max, Int_t n)
void SetHistoTimeRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoFinePtRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoShowerShapeRangeAndNBins(Float_t min, Float_t max, Int_t n)
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
void SetHistodEdxRangeAndNBins(Float_t min, Float_t max, Int_t n)
Class with utils specific to calorimeter clusters/cells.
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 SetHistoRatioRangeAndNBins(Float_t min, Float_t max, Int_t n)
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
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)
Steering class of package CaloTrackCorrelartions.
void SetDeltaAODFileName(TString name)
Bool_t kUseKinematics
Use the MC information.