AliPhysics  97344c9 (97344c9)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  if(bBadMap)
158 
159  cu->SetDebug(-1);
160  if(printSettings) cu->Print("");
161 
162  // ##### Analysis algorithm settings ####
163 
164  AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
165  //emcalQA->SetDebug(10); //10 for lots of messages
166  emcalQA->SetCalorimeter("EMCAL");
167  if(simulation)
168  {
169  emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
170  emcalQA->SwitchOffStudyBadClusters();
172  }
173  else
174  {
175  emcalQA->SwitchOffDataMC() ;
176  emcalQA->SwitchOffStudyBadClusters();
177  emcalQA->SwitchOnFillAllCellTimeHisto();
178  }
179 
180  emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
181  emcalQA->SwitchOffFiducialCut();
182  emcalQA->SwitchOnCorrelation();
183  emcalQA->SwitchOffFillAllTH3Histogram();
186 
187  //Set Histrograms bins and ranges
188  emcalQA->GetHistogramRanges()->SetHistoPtRangeAndNBins(0, 50, 100) ;
189  emcalQA->GetHistogramRanges()->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
190  emcalQA->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-0.70, 0.70, 140) ;
191 
192  if ( year==2010 )
193  {
194  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 120*TMath::DegToRad(), 48) ;
195  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-230,90,120);
196  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(370,450,40);
197  }
198  else if ( year < 2014 )
199  {
200  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 180*TMath::DegToRad(), 120) ;
201  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,90,200);
202  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(100,450,100);
203  }
204  else // Run2
205  {
206  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 327*TMath::DegToRad(), 250) ;
207  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,460,230);
208  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(-450,450,225);
209  }
210 
211  emcalQA->GetHistogramRanges()->SetHistoMassRangeAndNBins(0., 0.65, 325) ;
212  emcalQA->GetHistogramRanges()->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
213  emcalQA->GetHistogramRanges()->SetHistoPOverERangeAndNBins(0,2.,50);
214  emcalQA->GetHistogramRanges()->SetHistodEdxRangeAndNBins(0.,200.,100);
215  emcalQA->GetHistogramRanges()->SetHistodRRangeAndNBins(0.,0.10,50);
216  //emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins( 400,900,250);
217  //emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(-275,275,250);
218  emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(-275,975,250);
219  emcalQA->GetHistogramRanges()->SetHistoRatioRangeAndNBins(0.,2.,100);
220  emcalQA->GetHistogramRanges()->SetHistoVertexDistRangeAndNBins(0.,500.,500);
222  emcalQA->GetHistogramRanges()->SetHistoZRangeAndNBins(-350,350,175);
223  emcalQA->GetHistogramRanges()->SetHistoRRangeAndNBins(430,460,30);
224  emcalQA->GetHistogramRanges()->SetHistoV0SignalRangeAndNBins(0,5000,100);
228  emcalQA->GetHistogramRanges()->SetHistoDiffTimeRangeAndNBins(-300, 300, 120);
229  emcalQA->GetHistogramRanges()->SetHistoTrackResidualEtaRangeAndNBins(-0.075,0.075,50);
230  emcalQA->GetHistogramRanges()->SetHistoTrackResidualPhiRangeAndNBins(-0.075,0.075,50);
231 
232  if(printSettings) emcalQA->Print("");
233 
234  // #### Configure Maker ####
236  if(ssuffix.Contains("default")) maker->SwitchOffDataControlHistograms();
237  else maker->SwitchOnDataControlHistograms();
238  maker->SetReader(reader);//pointer to reader
239  maker->SetCaloUtils(cu); //pointer to calorimeter utils
240  maker->AddAnalysis(emcalQA,0);
241  maker->SetAnaDebug(-1) ; // 0 to at least print the event number
242  maker->SwitchOnHistogramsMaker() ;
243  maker->SwitchOffAODsMaker() ;
244 
245  if(simulation)
246  {
247  // Calculate the cross section weights, apply them to all histograms
248  // and fill xsec and trial histo. Sumw2 must be activated.
249  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionCalculation();
250  //maker->SwitchOnSumw2Histograms();
251 
252  // For recent productions where the cross sections and trials are not stored in separate file
253  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionFromEventHeader() ;
254 
255  // Just fill cross section and trials histograms.
257 
258  // Add control histogram with pT hard to control aplication of weights
259  maker->SwitchOnPtHardHistogram();
260  }
261 
262  if(printSettings) maker->Print("");
263 
264  printf("======================== \n");
265  printf(" End Configuration of Calorimeter QA \n");
266  printf("======================== \n");
267 
268  // Create task
269  //===========================================================================
270  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CalorimeterPerformance_%s",suffix));
271  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
272  //task->SetDebugLevel(-1);
273  task->SetAnalysisMaker(maker);
274  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
275  mgr->AddTask(task);
276 
277  //Create containers
278  // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
279  // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
280 
281  TString cname;
282  if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
283 
284 
285  cname = Form("CaloQA_%s", suffix);
286  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(cname, TList::Class(),
287  AliAnalysisManager::kOutputContainer,
288  Form("%s:%s",outputFile.Data(),cname.Data()));
289 
290 // cname = Form("CaloQACuts_%s", suffix);
291 // AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(cname, TList::Class(),
292 // AliAnalysisManager::kParamContainer,
293 // Form("%s:%s",outputFile.Data(),cname.Data()));
294 
295  //Form("%s:PartCorrCuts",outputfile.Data()));
296  // Create ONLY the output containers for the data produced by the task.
297  // Get and connect other common input/output containers via the manager as below
298  //==============================================================================
299  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
300  mgr->ConnectOutput (task, 1, cout_pc);
301 // mgr->ConnectOutput (task, 2, cout_cuts);
302 
303  return task;
304 }
305 
306 
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:77
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 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 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 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)
void SetCaloUtils(AliCalorimeterUtils *cu)
Steering class of package CaloTrackCorrelartions.
void SetDeltaAODFileName(TString name)
Bool_t kUseKinematics
Use the MC information.