AliPhysics  c2a2810 (c2a2810)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskCalorimeterQA.C
Go to the documentation of this file.
1 
12 
26  Bool_t simulation = kFALSE,
27  TString outputFile = "",
28  Int_t year = 2015,
29  Bool_t printSettings = kFALSE)
30 {
31  // Get the pointer to the existing analysis manager via the static access method.
32  //==============================================================================
33  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34  if (!mgr) {
35  ::Error("AddTaskPartCorr", "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  ::Error("AddTaskPartCorr", "This task requires an input event handler");
43  return NULL;
44  }
45 
46  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
47 
48  Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
49 
50  TString ssuffix = suffix;
51  if(kUseKinematics || simulation)
52  {
53  simulation = kTRUE;
54  printf("AddTaskCalorimeterQA - CAREFUL : Triggered events not checked in simulation!! \n");
55  if(!ssuffix.Contains("default")) return;
56  }
57 
58  // Configure analysis
59  //===========================================================================
60 
61  //Reader
62  //For this particular analysis few things done by the reader.
63  //Nothing else needs to be set.
64 
65  AliCaloTrackReader * reader = 0x0;
66  if (inputDataType.Contains("AOD")) reader = new AliCaloTrackAODReader();
67  else if(inputDataType.Contains("ESD")) reader = new AliCaloTrackESDReader();
68  //reader->SetDebug(10);//10 for lots of messages
69 
70  reader->SwitchOnEMCALCells();
71  reader->SwitchOnEMCAL();
72  reader->SwitchOnPHOSCells(); // For correlation plots
73  reader->SwitchOnPHOS(); // For correlation plots
74  reader->SetEMCALPtMin(0.);
75  reader->SwitchOnCTS();
76  reader->SetCTSPtMin (0.);
77  reader->SetZvertexCut(10.);
78 
79  if(simulation)
80  {
81  if(inputDataType == "ESD")
82  {
83  reader->SwitchOnStack();
84  reader->SwitchOffAODMCParticles();
85  }
86  else if(inputDataType == "AOD")
87  {
88  reader->SwitchOffStack();
89  reader->SwitchOnAODMCParticles();
90  }
91  }
92 
93  reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
94  reader->SwitchOffWriteDeltaAOD() ;
95 
96  if(!ssuffix.Contains("default"))
97  {
100  reader->SetTriggerPatchTimeWindow(8,9);
101  //reader->SetEventTriggerL0Threshold(2.);
102  }
103 
104  if(!simulation) reader->AnalyzeOnlyPhysicsEvents(); // in case physics selection was not on
105 
106  if(printSettings) reader->Print("");
107 
108  // *** Calorimeters Utils ***
110  // Remove clusters close to borders, at least max energy cell is 1 cell away
112 
113  if (year == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year
114  else if (year < 2014) cu->SetNumberOfSuperModulesUsed(10);
115  else cu->SetNumberOfSuperModulesUsed(20);
116 
117  AliEMCALRecoUtils* reco = cu->GetEMCALRecoUtils();
118  reco->SwitchOnRejectExoticCell() ; // reject exotic cells, fill different histograms for exotic clusters and good clusters
119  reco->SetExoticCellDiffTimeCut(10000); // Open
120  reco->SetExoticCellFractionCut(0.95); // 1-Ecross/Ecell > 0.95 -> out
121  reco->SetExoticCellMinAmplitudeCut(0.75); // 750 MeV
122 
123  cu->SetDebug(-1);
124  if(printSettings) cu->Print("");
125 
126  // ##### Analysis algorithm settings ####
127 
128  AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
129  //emcalQA->SetDebug(10); //10 for lots of messages
130  emcalQA->SetCalorimeter("EMCAL");
131  if(simulation)
132  {
133  emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
134  emcalQA->SwitchOffStudyBadClusters();
136  }
137  else
138  {
139  emcalQA->SwitchOffDataMC() ;
140  emcalQA->SwitchOffStudyBadClusters();
141  emcalQA->SwitchOnFillAllCellTimeHisto();
142  }
143 
144  emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
145  emcalQA->SwitchOffFiducialCut();
146  emcalQA->SwitchOnCorrelation();
147  emcalQA->SwitchOffFillAllTH3Histogram();
150 
151  //Set Histrograms bins and ranges
152  emcalQA->GetHistogramRanges()->SetHistoPtRangeAndNBins(0, 50, 100) ;
153  emcalQA->GetHistogramRanges()->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
154  emcalQA->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-0.70, 0.70, 140) ;
155 
156  if ( year==2010 )
157  {
158  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 120*TMath::DegToRad(), 48) ;
159  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-230,90,120);
160  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(370,450,40);
161  }
162  else if ( year < 2014 )
163  {
164  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 180*TMath::DegToRad(), 120) ;
165  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,90,200);
166  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(100,450,100);
167  }
168  else // Run2
169  {
170  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 327*TMath::DegToRad(), 250) ;
171  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-460,460,230);
172  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(-450,450,225);
173  }
174 
175  emcalQA->GetHistogramRanges()->SetHistoMassRangeAndNBins(0., 0.65, 325) ;
176  emcalQA->GetHistogramRanges()->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
177  emcalQA->GetHistogramRanges()->SetHistoPOverERangeAndNBins(0,2.,50);
178  emcalQA->GetHistogramRanges()->SetHistodEdxRangeAndNBins(0.,200.,100);
179  emcalQA->GetHistogramRanges()->SetHistodRRangeAndNBins(0.,0.10,50);
180  emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(400.,850,150);
181  emcalQA->GetHistogramRanges()->SetHistoRatioRangeAndNBins(0.,2.,100);
182  emcalQA->GetHistogramRanges()->SetHistoVertexDistRangeAndNBins(0.,500.,500);
184  emcalQA->GetHistogramRanges()->SetHistoZRangeAndNBins(-350,350,175);
185  emcalQA->GetHistogramRanges()->SetHistoRRangeAndNBins(430,460,30);
186  emcalQA->GetHistogramRanges()->SetHistoV0SignalRangeAndNBins(0,5000,100);
190  emcalQA->GetHistogramRanges()->SetHistoDiffTimeRangeAndNBins(-300, 300, 120);
191  emcalQA->GetHistogramRanges()->SetHistoTrackResidualEtaRangeAndNBins(-0.075,0.075,50);
192  emcalQA->GetHistogramRanges()->SetHistoTrackResidualPhiRangeAndNBins(-0.075,0.075,50);
193 
194  if(printSettings) emcalQA->Print("");
195 
196  // #### Configure Maker ####
198  if(ssuffix.Contains("default")) maker->SwitchOffDataControlHistograms();
199  else maker->SwitchOnDataControlHistograms();
200  maker->SetReader(reader);//pointer to reader
201  maker->SetCaloUtils(cu); //pointer to calorimeter utils
202  maker->AddAnalysis(emcalQA,0);
203  maker->SetAnaDebug(-1) ; // 0 to at least print the event number
204  maker->SwitchOnHistogramsMaker() ;
205  maker->SwitchOffAODsMaker() ;
206  if(printSettings) maker->Print("");
207 
208  printf("======================== \n");
209  printf(" End Configuration of Calorimeter QA \n");
210  printf("======================== \n");
211 
212  // Create task
213  //===========================================================================
214  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CalorimeterPerformance_%s",suffix));
215  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
216  //task->SetDebugLevel(-1);
217  task->SetAnalysisMaker(maker);
218  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
219  mgr->AddTask(task);
220 
221  //Create containers
222  // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
223  // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
224 
225  TString cname;
226  if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
227 
228 
229  cname = Form("CaloQA_%s", suffix);
230  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(cname, TList::Class(),
231  AliAnalysisManager::kOutputContainer,
232  Form("%s:%s",outputFile.Data(),cname.Data()));
233 
234 // cname = Form("CaloQACuts_%s", suffix);
235 // AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(cname, TList::Class(),
236 // AliAnalysisManager::kParamContainer,
237 // Form("%s:%s",outputFile.Data(),cname.Data()));
238 
239  //Form("%s:PartCorrCuts",outputfile.Data()));
240  // Create ONLY the output containers for the data produced by the task.
241  // Get and connect other common input/output containers via the manager as below
242  //==============================================================================
243  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
244  mgr->ConnectOutput (task, 1, cout_pc);
245 // mgr->ConnectOutput (task, 2, cout_cuts);
246 
247  return task;
248 }
249 
250 
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)
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)
AliAnalysisTaskCaloTrackCorrelation * AddTaskCalorimeterQA(const char *suffix="default", Bool_t simulation=kFALSE, TString outputFile="", Int_t year=2015, Bool_t printSettings=kFALSE)
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.
Steering class of package CaloTrackCorrelartions.
void SetDeltaAODFileName(TString name)
Bool_t kUseKinematics
Use the MC information.