AliPhysics  master (3d17d9d)
AddTaskGenKine.C
Go to the documentation of this file.
1 
12 // Set includes for compilation
13 
14 #if !defined(__CINT__) || defined(__MAKECINT__)
15 
16 // ROOT
17 #include <TString.h>
18 #include <TSystem.h>
19 #include <TROOT.h>
20 
21 // AliPhysics
22 #include "AliAnalysisManager.h"
23 #include "AliInputEventHandler.h"
24 
25 // CaloTrackCorrelations frame
26 #include "AliCaloTrackMCReader.h"
29 #include "AliIsolationCut.h"
30 #include "AliAnaGeneratorKine.h"
31 
32 #endif
33 
35 TString kCalorimeter = "EMCAL";
36 Int_t kYears = 2011;
38 Int_t kDebug = -1;
39 Bool_t kPrintConf = kFALSE;
45 
51 {
53 
54  reader->SetDebug(kDebug);//10 for lots of messages
55 
56 // reader->SetPtHardAndJetPtComparison(kTRUE);
57 // reader->SetPtHardAndJetPtFactor(4);
58 //
59 // reader->SetPtHardAndClusterPtComparison(kTRUE);
60 // reader->SetPtHardAndClusterPtFactor(1.);
61 
62  reader->SwitchOffWriteDeltaAOD() ;
63 
64  //------------------------
65  // Detector input filling
66  //------------------------
67 
68  //Min cluster/track E
69  reader->SetEMCALEMin(0.3);
70  reader->SetEMCALEMax(1000);
71  reader->SetPHOSEMin(0.3);
72  reader->SetPHOSEMax(1000);
73  reader->SetCTSPtMin(0.2);
74  reader->SetCTSPtMax(1000);
75 
76  reader->SwitchOnFiducialCut();
77  //reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;
78 
79  reader->SwitchOffCTS();
80  reader->SwitchOffEMCALCells();
81  reader->SwitchOffEMCAL();
82  reader->SwitchOffPHOSCells();
83  reader->SwitchOffPHOS();
84 
85  reader->SetZvertexCut(10.); // Open cut
86  reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
87 
88  reader->SwitchOffPileUpEventRejection(); // remove pileup by default
89  reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
90 
91  if ( kPrintConf ) reader->Print("");
92 
93  return reader;
94 
95 }
96 
102 {
103 
105  cu->SetDebug(kDebug);
106 
107  cu->SwitchOffClusterPlot();
108 
109  cu->SwitchOffRecalculateClusterTrackMatching(); // Done in clusterization
110 
112 
114 
115  AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
116 
117  cu->SwitchOffRecalibration();
121  cu->SwitchOffEMCALOADB() ;
122 
123  // PHOS
125 
126  if ( kPrintConf ) cu->Print("");
127 
128  return cu;
129 
130 }
131 
136 {
137  histoRanges->SetHistoPtRangeAndNBins(0, 200, 400) ; // Energy and pt histograms
138 
139  if ( kCalorimeter == "EMCAL" )
140  {
141  if ( kYears == 2010 )
142  {
143  histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
144  }
145  else if ( kYears < 2014 )
146  {
147  histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 104) ;
148  }
149  else // Run2
150  {
151  histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 189*TMath::DegToRad(), 111) ;
152  }
153 
154  histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
155  }
156  else if ( kCalorimeter=="DCAL" )
157  {
158  histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 327*TMath::DegToRad(), 67) ;
159  histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
160  }
161  else if ( kCalorimeter == "PHOS" )
162  {
163  histoRanges->SetHistoPhiRangeAndNBins(250*TMath::DegToRad(), 320*TMath::DegToRad(), 70) ;
164  histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
165  }
166  else if ( kCalorimeter == "CTS" )
167  {
168  histoRanges->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ;
169  histoRanges->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ;
170  }
171 
172  if ( kCalorimeter == "FullCalo" )
173  {
174  histoRanges->SetHistoPhiRangeAndNBins(80*TMath::DegToRad(), 327*TMath::DegToRad(), 247) ;
175  }
176 }
177 
178 
186 {
187  ic->SetDebug(kDebug);
189  ic->SetICMethod(kIsoMethod);
190  ic->SetPtFraction(0.1);
191  ic->SetPtThreshold(0.5); // default, change in next lines
192  ic->SetSumPtThreshold(1.0); // default, change in next lines
193 
194  if ( kConeSize > 0 && kIsoCut > 0 )
195  {
196  ic->SetConeSize(kConeSize);
198  ic->SetPtThresholdMax(10000);
199 
201  {
202  printf("ConfigureIsolationCuts() *** PtThresMin = %1.1f GeV/c *** R = %1.2f *** R min %1.2f\n",kIsoCut,kConeSize,kConeSizeMin);
203  ic->SetPtThreshold(kIsoCut);
204  }
205 
208  {
209  printf("ConfigureIsolationCuts() *** SumPtMin = %1.1f GeV/c *** R = %1.1f *** R min %1.2f\n",kIsoCut,kConeSize,kConeSizeMin);
211  }
212  }
213  else
214  {
215  printf("ConfigureIsolationCuts() *** Careful, use old hardcoded values\n");
216  if ( kCollisName == "pp" )
217  {
218  ic->SetPtThreshold(0.5);
219  ic->SetSumPtThreshold(1.0) ;
220  ic->SetConeSize(0.4);
221  ic->SetMinDistToTrigger(-1);
222  }
223  if ( kCollisName == "PbPb" )
224  {
225  ic->SetPtThreshold(3.);
226  ic->SetSumPtThreshold(3.0) ;
227  ic->SetConeSize(0.3);
228  ic->SetMinDistToTrigger(-1);
229  }
230  }
231 
232  //ic->SwitchOnFillEtaPhiHistograms();
233 
234 // if ( kAnaCutsString.Contains("FixIsoConeExcess") )
235 // ic->SwitchOnConeExcessCorrectionHistograms();
236 // else
237 // ic->SwitchOffConeExcessCorrectionHistograms();
238 }
239 
245 {
247 
248  // Trigger detector, acceptance and pT cut
249  ana->SetTriggerDetector(kCalorimeter);
250  if ( kCalorimeter == "DCAL" )
251  {
252  TString calo = "EMCAL";
253  ana->SetTriggerDetector(calo);
254  }
255 
256  ana->SetMinPt(2); // Trigger photon, pi0 minimum pT
257  if ( kCalorimeter == "EMCAL" )
258  {
259  if ( kYears > 2014 ) ana->GetFiducialCutForTrigger()->SetSimpleEMCALFiducialCut(0.67, 81.2, 185.8) ; //12 SM
260  else if ( kYears > 2010 ) ana->GetFiducialCutForTrigger()->SetSimpleEMCALFiducialCut(0.67, 81.2, 178.8) ; //10 SM
261  else ana->GetFiducialCutForTrigger()->SetSimpleEMCALFiducialCut(0.67, 81.2, 118.8) ; // 4 SM
262  }
263  else if ( kCalorimeter == "DCAL" ) ana->GetFiducialCutForTrigger()->SetSimpleEMCALFiducialCut(0.67, 261.2, 325.8) ;
264  else if ( kCalorimeter == "PHOS" )
265  {
266  if ( kYears > 2014 ) ana->GetFiducialCutForTrigger()->SetSimplePHOSFiducialCut (0.125, 250.5, 319.5) ;
267  else ana->GetFiducialCutForTrigger()->SetSimplePHOSFiducialCut (0.125, 260.5, 319.5) ;
268  }
269 
270  if ( kCalorimeter == "FullCalo" )
271  {
272  ana->GetFiducialCutForTrigger()->SetSimpleEMCALFiducialCut(0.67, 81.2, 325.8) ;
273  }
274 
275  // Particles associated to trigger or isolation cone acceptance and pT cut
276  ana->SetCalorimeter(kCalorimeter);
277  if ( kCalorimeter == "DCAL" || kCalorimeter == "FullCalo" )
278  {
279  TString calo = "EMCAL";
280  ana->SetCalorimeter(calo);
281  }
282 
283  ana->SetMinChargedPt(0.2);
284  ana->SetMinNeutralPt(0.5);
285 
286  if ( kCalorimeter == "EMCAL" )
287  {
288  if ( kYears > 2014 ) ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.67, 81.2, 185.8) ; //12 SM
289  else if ( kYears > 2010 ) ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.67, 81.2, 178.8) ; //10 SM
290  else ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.67, 81.2, 118.8) ; // 4 SM
291  }
292  else if ( kCalorimeter == "DCAL" ) ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.67, 261.2, 325.8) ;
293  else if ( kCalorimeter == "PHOS" )
294  {
295  if ( kYears > 2014 ) ana->GetFiducialCut()->SetSimplePHOSFiducialCut (0.125, 250.5, 319.5) ;
296  else ana->GetFiducialCut()->SetSimplePHOSFiducialCut (0.125, 260.5, 319.5) ;
297  }
298 
299  if ( kCalorimeter == "FullCalo" )
300  {
301  ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.67, 81.2, 325.8) ;
302  }
303 
304  ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.9, 0, 360);
305 
306  // Isolation paramters
307  AliIsolationCut * ic = ana->GetIsolationCut();
309 
310  ana->SwitchOnPartonAnalysis();
311  if ( !makePartonAna )
313 
314  ana->AddToHistogramsName("AnaGenKine_");
315  SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
316 
317  return ana;
318 }
319 
320 
340  (
341  Double_t scaleFactor = -1,
342  Bool_t makePartonAna = kFALSE,
344  Int_t isoMethod = AliIsolationCut::kSumPtIC,
345  Float_t cone = 0.4,
346  Float_t coneMin = -1,
347  Float_t isoCut = 2,
348  TString calorimeter = "EMCAL",
349  Int_t year = 2017,
350  TString col = "pp",
351  Int_t debug = -1,
352  Bool_t printConf = kFALSE,
353  TString outputfile = "")
354 {
355  // Change global variables
356  kCalorimeter = calorimeter;
357  kYears = year;
358  kCollisName = col;
359  kDebug = debug;
360  kPrintConf = printConf;
361  kConeSize = cone;
362  kConeSizeMin = coneMin;
363  kIsoCut = isoCut;
364  kPartInCone = partInCone;
365  kIsoMethod = isoMethod;
366 
367  // Get the pointer to the existing analysis manager via the static access method.
368 
369  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
370  if (!mgr)
371  {
372  ::Error("AddTask", "No analysis manager to connect to.");
373  return NULL;
374  }
375 
376  // #### Configure analysis ####
377 
379  printf("SCALE FACTOR %e\n",scaleFactor);
380  maker->SetScaleFactor(scaleFactor); // for MC, negative (not scaled) by default
381 
382  // General frame setting and configuration
383  maker->SetReader (ConfigureReader() );
384  maker->SetCaloUtils(ConfigureCaloUtils());
385 
386  // Analysis tasks setting and configuration
387  Int_t n = 0;//Analysis number, order is important
388  maker->AddAnalysis(ConfigureGenKineAnalysis(makePartonAna), n++); // Photon cluster selection
389 
390  maker->SetAnaDebug(kDebug) ;
391  maker->SwitchOnHistogramsMaker() ;
392  maker->SwitchOffAODsMaker() ;
394 
395  // Calculate the cross section weights, apply them to all histograms
396  // and fill xsec and trial histo. Sumw2 must be activated.
397  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionCalculation();
398  //maker->SwitchOnSumw2Histograms();
399 
400  // For recent productions where the cross sections and trials are not stored in separate file
401  //maker->GetReader()->GetWeightUtils()->SwitchOnMCCrossSectionFromEventHeader() ;
402 
403  // Just fill cross section and trials histograms.
405 
406  if ( kPrintConf ) maker->Print("");
407 
408  // Create task
409 
410  AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation ("GeneratorKineAnalysis");
411  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
412  task->SetDebugLevel(kDebug);
413  task->SetBranches("ESD:AliESDRun.,AliESDHeader");
414  task->SetAnalysisMaker(maker);
415  mgr->AddTask(task);
416 
417  //Create containers
418 
419  if(outputfile.Length()==0) outputfile = AliAnalysisManager::GetCommonFileName();
420 
421  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("GenKine", TList::Class(),
422  AliAnalysisManager::kOutputContainer,
423  Form("%s",outputfile.Data()));
424 
425  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer("Param_GemKine", TList::Class(),
426  AliAnalysisManager::kParamContainer,
427  "AnalysisParameters.root");
428 
429  // Create ONLY the output containers for the data produced by the task.
430  // Get and connect other common input/output containers via the manager as below
431  //==============================================================================
432  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
433  // AOD output slot will be used in a different way in future
434  mgr->ConnectOutput (task, 1, cout_pc);
435  mgr->ConnectOutput (task, 2, cout_cuts);
436 
437  return task;
438 }
Float_t kIsoCut
A float setting the isolation cone size lower limit.
void SetPtThreshold(Float_t pt)
virtual void SetDebug(Int_t d)
TString kCalorimeter
Global variables to be accessed by the different methods.
void SetSimpleCTSFiducialCut(Float_t abseta, Float_t phimin, Float_t phimax)
Bool_t kPrintConf
Debug level.
double Double_t
Definition: External.C:58
Float_t kConeSizeMin
A float setting the isolation cone size higher limit.
virtual void AddToHistogramsName(TString add)
virtual void SwitchOnFiducialCut()
Class with utils to perform Isolation Cuts.
AliEMCALRecoUtils * GetEMCALRecoUtils() const
void SetConeSize(Float_t r)
void SetPtFraction(Float_t pt)
void SetCTSPtMax(Float_t pt)
void ConfigureIsolationCut(AliIsolationCut *ic)
Consider tracks and neutral calorimeter clusters in cone for isolation decission. ...
void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetDebug(Int_t d)
void SetMinChargedPt(Float_t pt)
virtual AliIsolationCut * GetIsolationCut()
void SetEMCALEMin(Float_t en)
void AddAnalysis(TObject *ana, Int_t n)
Add analysis depending on AliAnaCaloTrackCorrBaseClass to list.
void SetTriggerDetector(TString det)
Set the calorimeter for the analysis.
void SetSimpleEMCALFiducialCut(Float_t abseta, Float_t phimin, Float_t phimax)
void SetSumPtThreshold(Float_t s)
TString kCollisName
Year configuration for geometry setting.
void SwitchOnMCCrossSectionHistoFill()
Definition: AliAnaWeights.h:88
Get trigger particles/partons/jets and correlations at generator level.
void SetSimplePHOSFiducialCut(Float_t abseta, Float_t phimin, Float_t phimax)
const TString calorimeter
Definition: anaM.C:36
Some utilities for cluster and cell treatment.
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
void SetCTSPtMin(Float_t pt)
Isolated if any particle pt in cone < fPtThreshold.
Int_t kYears
Detector acceptance of trigger particle: EMCAL, DCAL, PHOS, FullCalo.
void SwitchOffRecalculateClusterTrackMatching()
void SetICMethod(Int_t i)
virtual void SetCalorimeter(TString calo)
Set the calorimeter for the analysis. A string.
void SetScaleFactor(Double_t scale)
virtual void SetDebug(Int_t d)
virtual AliFiducialCut * GetFiducialCut()
void SetHistoPhiRangeAndNBins(Float_t min, Float_t max, Int_t n)
int Int_t
Definition: External.C:63
virtual AliHistogramRanges * GetHistogramRanges()
float Float_t
Definition: External.C:68
AliCalorimeterUtils * ConfigureCaloUtils()
AliCaloTrackReader * ConfigureReader()
An int setting the isolation method: AliIsolationCut::kPtThresIC, kSumPtIC, ...
Class for filtering generated MC particles and prepare them as input for the analysis.
Base class for event, clusters and tracks filtering and preparation for the analysis.
void SetMinNeutralPt(Float_t pt)
void SetAnalysisMaker(AliAnaCaloTrackCorrMaker *const maker)
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
Float_t kConeSize
Print configuration settings.
void SetPtThresholdMax(Float_t pt)
virtual void SetZvertexCut(Float_t zcut=10.)
AliFiducialCut * GetFiducialCutForTrigger()
Class containing more common histogram axis types.
void SetPHOSEMin(Float_t en)
void SetReader(AliCaloTrackReader *re)
Int_t kDebug
A string with the colliding system.
Int_t kIsoMethod
Type of particles inside the isolation cone: AliIsolationCut::kNeutralAndCharged, kOnlyNeutral...
void SetHistoEtaRangeAndNBins(Float_t min, Float_t max, Int_t n)
void SetHistoRangeAndNBins(AliHistogramRanges *histoRanges)
Main class conecting the CaloTrackCorrelations package and Analysis Frame.
void SwitchOffLoadOwnPHOSGeometryMatrices()
Int_t kPartInCone
A float setting the isolation pT threshold (sum of particles in cone or leading particle) ...
Same as kSumPtIC, but sum pt particle in cone subtracted from UE estimated in perpendicular cones...
void SwitchOffLoadOwnEMCALGeometryMatrices()
void SetEMCALEMax(Float_t en)
AliAnaGeneratorKine * ConfigureGenKineAnalysis(Bool_t makePartonAna=kTRUE)
AliAnalysisTaskCaloTrackCorrelation * AddTaskGenKine(Double_t scaleFactor=-1, Bool_t makePartonAna=kFALSE, Int_t partInCone=AliIsolationCut::kNeutralAndCharged, Int_t isoMethod=AliIsolationCut::kSumPtIC, Float_t cone=0.4, Float_t coneMin=-1, Float_t isoCut=2, TString calorimeter="EMCAL", Int_t year=2017, TString col="pp", Int_t debug=-1, Bool_t printConf=kFALSE, TString outputfile="")
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
bool Bool_t
Definition: External.C:53
void SetPHOSEMax(Float_t en)
Class with utils specific to calorimeter clusters/cells.
AliCaloTrackReader * GetReader()
void ana(anaModes mode=mGRID)
Definition: ana.C:1036
AliAnaWeights * GetWeightUtils()
void SetParticleTypeInCone(Int_t i)
Isolated if sum pt particle in cone < fSumPtThreshold.
void SetMinDistToTrigger(Float_t md)
void SetCaloUtils(AliCalorimeterUtils *cu)
Steering class of package CaloTrackCorrelartions.