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