AliPhysics  vAN-20150425 (2dcf1b0)
 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 = 2012,
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(printSettings) reader->Print("");
105 
106  // *** Calorimeters Utils ***
108  // Remove clusters close to borders, at least max energy cell is 1 cell away
110 
111  if (year == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year
112  else if (year < 2014) cu->SetNumberOfSuperModulesUsed(10);
113  else cu->SetNumberOfSuperModulesUsed(20);
114 
115  AliEMCALRecoUtils* reco = cu->GetEMCALRecoUtils();
116  reco->SwitchOnRejectExoticCell() ; // reject exotic cells, fill different histograms for exotic clusters and good clusters
117  reco->SetExoticCellDiffTimeCut(10000); // Open
118  reco->SetExoticCellFractionCut(0.95); // 1-Ecross/Ecell > 0.95 -> out
119  reco->SetExoticCellMinAmplitudeCut(0.75); // 750 MeV
120 
121  cu->SetDebug(-1);
122  if(printSettings) cu->Print("");
123 
124  // ##### Analysis algorithm settings ####
125 
126  AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
127  //emcalQA->SetDebug(10); //10 for lots of messages
128  emcalQA->SetCalorimeter("EMCAL");
129  if(simulation)
130  {
131  emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
132  emcalQA->SwitchOffStudyBadClusters();
134  }
135  else
136  {
137  emcalQA->SwitchOffDataMC() ;
138  emcalQA->SwitchOffStudyBadClusters();
139  emcalQA->SwitchOnFillAllCellTimeHisto();
140  }
141  emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
142  emcalQA->SwitchOffFiducialCut();
143  emcalQA->SwitchOnCorrelation();
144  emcalQA->SwitchOffFillAllTH3Histogram();
147 
148  //Set Histrograms bins and ranges
149  emcalQA->GetHistogramRanges()->SetHistoPtRangeAndNBins(0, 50, 100) ;
150  emcalQA->GetHistogramRanges()->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
151  emcalQA->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-0.70, 0.70, 140) ;
152 
153  if (year==2010)
154  {
155  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 120*TMath::DegToRad(), 48) ;
156  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-230,90,120);
157  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(370,450,40);
158  }
159  else //if(year==2011 || year==2012)
160  {
161  emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 180*TMath::DegToRad(), 120) ;
162  emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-600,90,200);
163  emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(100,450,100);
164  }
165 // else
166 // {
167 // emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(79*TMath::DegToRad(), 320*TMath::DegToRad(), 400) ; // revise
168 // emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-700,90,200); // revise
169 // emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(50,450,100); // revise
170 // }
171 
172  emcalQA->GetHistogramRanges()->SetHistoMassRangeAndNBins(0., 0.65, 325) ;
173  emcalQA->GetHistogramRanges()->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
174  emcalQA->GetHistogramRanges()->SetHistoPOverERangeAndNBins(0,2.,50);
175  emcalQA->GetHistogramRanges()->SetHistodEdxRangeAndNBins(0.,200.,100);
176  emcalQA->GetHistogramRanges()->SetHistodRRangeAndNBins(0.,0.10,50);
177  emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(400.,850,150);
178  emcalQA->GetHistogramRanges()->SetHistoRatioRangeAndNBins(0.,2.,100);
179  emcalQA->GetHistogramRanges()->SetHistoVertexDistRangeAndNBins(0.,500.,500);
181  emcalQA->GetHistogramRanges()->SetHistoZRangeAndNBins(-400,400,200);
182  emcalQA->GetHistogramRanges()->SetHistoRRangeAndNBins(400,450,25);
183  emcalQA->GetHistogramRanges()->SetHistoV0SignalRangeAndNBins(0,5000,100);
187  emcalQA->GetHistogramRanges()->SetHistoDiffTimeRangeAndNBins(-300, 300, 120);
188  emcalQA->GetHistogramRanges()->SetHistoTrackResidualEtaRangeAndNBins(-0.075,0.075,50);
189  emcalQA->GetHistogramRanges()->SetHistoTrackResidualPhiRangeAndNBins(-0.075,0.075,50);
190 
191  if(printSettings) emcalQA->Print("");
192 
193  // #### Configure Maker ####
195  if(ssuffix.Contains("default")) maker->SwitchOffDataControlHistograms();
196  else maker->SwitchOnDataControlHistograms();
197  maker->SetReader(reader);//pointer to reader
198  maker->SetCaloUtils(cu); //pointer to calorimeter utils
199  maker->AddAnalysis(emcalQA,0);
200  maker->SetAnaDebug(-1) ; // 0 to at least print the event number
201  maker->SwitchOnHistogramsMaker() ;
202  maker->SwitchOffAODsMaker() ;
203  if(printSettings) maker->Print("");
204 
205  printf("======================== \n");
206  printf(" End Configuration of Calorimeter QA \n");
207  printf("======================== \n");
208 
209  // Create task
210  //===========================================================================
211  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CalorimeterPerformance_%s",suffix));
212  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
213  //task->SetDebugLevel(-1);
214  task->SetAnalysisMaker(maker);
215  task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
216  mgr->AddTask(task);
217 
218  //Create containers
219  // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
220  // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
221 
222  TString cname;
223  if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
224 
225 
226  cname = Form("CaloQA_%s", suffix);
227  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(cname, TList::Class(),
228  AliAnalysisManager::kOutputContainer,
229  Form("%s:%s",outputFile.Data(),cname.Data()));
230 
231 // cname = Form("CaloQACuts_%s", suffix);
232 // AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(cname, TList::Class(),
233 // AliAnalysisManager::kParamContainer,
234 // Form("%s:%s",outputFile.Data(),cname.Data()));
235 
236  //Form("%s:PartCorrCuts",outputfile.Data()));
237  // Create ONLY the output containers for the data produced by the task.
238  // Get and connect other common input/output containers via the manager as below
239  //==============================================================================
240  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
241  mgr->ConnectOutput (task, 1, cout_pc);
242 // mgr->ConnectOutput (task, 2, cout_cuts);
243 
244  return task;
245 }
246 
247 
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.
AliAnalysisTaskCaloTrackCorrelation * AddTaskCalorimeterQA(const char *suffix="default", Bool_t simulation=kFALSE, TString outputFile="", Int_t year=2012, Bool_t printSettings=kFALSE)
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.
Steering class of package CaloTrackCorrelartions.
void SetDeltaAODFileName(TString name)
Bool_t kUseKinematics
Use the MC information.