AliPhysics  ec7afe5 (ec7afe5)
 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  if(simulation)
83  {
84  if(inputDataType == "ESD")
85  {
86  reader->SwitchOnStack();
87  reader->SwitchOffAODMCParticles();
88  }
89  else if(inputDataType == "AOD")
90  {
91  reader->SwitchOffStack();
92  reader->SwitchOnAODMCParticles();
93  }
94  }
95 
96  reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
97  reader->SwitchOffWriteDeltaAOD() ;
98 
99  if(!ssuffix.Contains("default"))
100  {
103  reader->SetTriggerPatchTimeWindow(8,9);
104  //reader->SetEventTriggerL0Threshold(2.);
105  }
106 
107  if(!simulation) reader->AnalyzeOnlyPhysicsEvents(); // in case physics selection was not on
108 
109  if(calibrate && !simulation) reader->SwitchOnClusterRecalculation();
110  else reader->SwitchOffClusterRecalculation();
111 
112  if(printSettings) reader->Print("");
113 
114  // *** Calorimeters Utils ***
116  // Remove clusters close to borders, at least max energy cell is 1 cell away
118 
119  if (year == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year
120  else if (year < 2014) cu->SetNumberOfSuperModulesUsed(10);
121  else cu->SetNumberOfSuperModulesUsed(20);
122 
123 
124  cu->SwitchOffRecalibration(); // Check the reader if it is taken into account during filtering
126 
128 
129  Bool_t bExotic = kTRUE;
130  Bool_t bNonLin = kTRUE;
131  Bool_t bBadMap = kTRUE;
132 
133  Bool_t bEnCalib = kFALSE;
134  Bool_t bTiCalib = kFALSE;
135 
136  if(calibrate && !simulation)
137  {
138  cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering
141 
142  bEnCalib = kTRUE;
143  bTiCalib = kTRUE;
144  }
145 
146  AliEMCALRecoUtils* recou = cu->GetEMCALRecoUtils();
147 
148  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/EMCAL/macros/ConfigureEMCALRecoUtils.C");
150  simulation,
151  bExotic,
152  bNonLin,
153  bEnCalib,
154  bBadMap,
155  bTiCalib);
156 
157  if(bBadMap)
159 
160  cu->SetDebug(-1);
161  if(printSettings) cu->Print("");
162 
163  // ##### Analysis algorithm settings ####
164 
165  AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
166  //emcalQA->SetDebug(10); //10 for lots of messages
167  emcalQA->SetCalorimeter("EMCAL");
168  if(simulation)
169  {
170  emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
171  emcalQA->SwitchOffStudyBadClusters();
173  }
174  else
175  {
176  emcalQA->SwitchOffDataMC() ;
177  emcalQA->SwitchOffStudyBadClusters();
178  emcalQA->SwitchOnFillAllCellTimeHisto();
179  }
180 
181  emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
182  emcalQA->SwitchOffFiducialCut();
183  emcalQA->SwitchOnCorrelation();
184  emcalQA->SwitchOffFillAllTH3Histogram();
187 
188  //Set Histrograms bins and ranges
189  emcalQA->GetHistogramRanges()->SetHistoPtRangeAndNBins(0, 50, 100) ;
190  emcalQA->GetHistogramRanges()->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
191  emcalQA->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-0.70, 0.70, 140) ;
192 
193  if ( year==2010 )
194  {
195  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 120*TMath::DegToRad(), 48) ;
196  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-230,90,120);
197  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(370,450,40);
198  }
199  else if ( year < 2014 )
200  {
201  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 180*TMath::DegToRad(), 120) ;
202  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,90,200);
203  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(100,450,100);
204  }
205  else // Run2
206  {
207  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 327*TMath::DegToRad(), 250) ;
208  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,460,230);
209  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(-450,450,225);
210  }
211 
212  emcalQA->GetHistogramRanges()->SetHistoMassRangeAndNBins(0., 0.65, 325) ;
213  emcalQA->GetHistogramRanges()->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
214  emcalQA->GetHistogramRanges()->SetHistoPOverERangeAndNBins(0,2.,50);
215  emcalQA->GetHistogramRanges()->SetHistodEdxRangeAndNBins(0.,200.,100);
216  emcalQA->GetHistogramRanges()->SetHistodRRangeAndNBins(0.,0.10,50);
217  //emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins( 400,900,250);
218  //emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(-275,275,250);
219  emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(-275,975,250);
220  emcalQA->GetHistogramRanges()->SetHistoRatioRangeAndNBins(0.,2.,100);
221  emcalQA->GetHistogramRanges()->SetHistoVertexDistRangeAndNBins(0.,500.,500);
223  emcalQA->GetHistogramRanges()->SetHistoZRangeAndNBins(-350,350,175);
224  emcalQA->GetHistogramRanges()->SetHistoRRangeAndNBins(430,460,30);
225  emcalQA->GetHistogramRanges()->SetHistoV0SignalRangeAndNBins(0,5000,100);
229  emcalQA->GetHistogramRanges()->SetHistoDiffTimeRangeAndNBins(-300, 300, 120);
230  emcalQA->GetHistogramRanges()->SetHistoTrackResidualEtaRangeAndNBins(-0.075,0.075,50);
231  emcalQA->GetHistogramRanges()->SetHistoTrackResidualPhiRangeAndNBins(-0.075,0.075,50);
232 
233  if(printSettings) emcalQA->Print("");
234 
235  // #### Configure Maker ####
237  if(ssuffix.Contains("default")) maker->SwitchOffDataControlHistograms();
238  else maker->SwitchOnDataControlHistograms();
239  maker->SetReader(reader);//pointer to reader
240  maker->SetCaloUtils(cu); //pointer to calorimeter utils
241  maker->AddAnalysis(emcalQA,0);
242  maker->SetAnaDebug(-1) ; // 0 to at least print the event number
243  maker->SwitchOnHistogramsMaker() ;
244  maker->SwitchOffAODsMaker() ;
245 
246  if(simulation)
247  {
248  // Calculate the cross section weights, apply them to all histograms
249  // and fill xsec and trial histo. Sumw2 must be activated.
250  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionCalculation();
251  //maker->SwitchOnSumw2Histograms();
252 
253  // For recent productions where the cross sections and trials are not stored in separate file
254  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionFromEventHeader() ;
255 
256  // Just fill cross section and trials histograms.
258 
259  // Add control histogram with pT hard to control aplication of weights
260  maker->SwitchOnPtHardHistogram();
261  }
262 
263  if(printSettings) maker->Print("");
264 
265  printf("======================== \n");
266  printf(" End Configuration of Calorimeter QA \n");
267  printf("======================== \n");
268 
269  // Create task
270  //===========================================================================
271  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CalorimeterPerformance_%s",suffix));
272  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
273  //task->SetDebugLevel(-1);
274  task->SetAnalysisMaker(maker);
275  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
276  mgr->AddTask(task);
277 
278  //Create containers
279  // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
280  // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
281 
282  TString cname;
283  if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
284 
285 
286  cname = Form("CaloQA_%s", suffix);
287  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(cname, TList::Class(),
288  AliAnalysisManager::kOutputContainer,
289  Form("%s:%s",outputFile.Data(),cname.Data()));
290 
291 // cname = Form("CaloQACuts_%s", suffix);
292 // AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(cname, TList::Class(),
293 // AliAnalysisManager::kParamContainer,
294 // Form("%s:%s",outputFile.Data(),cname.Data()));
295 
296  //Form("%s:PartCorrCuts",outputfile.Data()));
297  // Create ONLY the output containers for the data produced by the task.
298  // Get and connect other common input/output containers via the manager as below
299  //==============================================================================
300  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
301  mgr->ConnectOutput (task, 1, cout_pc);
302 // mgr->ConnectOutput (task, 2, cout_cuts);
303 
304  return task;
305 }
306 
307 
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)
Bool_t kUseKinematics
Use the MC information.