AliPhysics  abafffd (abafffd)
AliAnalysisTaskEmcalJetHCorrelations.h
Go to the documentation of this file.
1 #ifndef AliAnalysisTaskEmcalJetHCorrelations_H
2 #define AliAnalysisTaskEmcalJetHCorrelations_H
3 
20 #include <vector>
21 
22 #include <TRandom3.h>
23 class TH1;
24 class TH2;
25 class TH3;
26 class THnSparse;
27 
28 class AliEventPoolManager;
29 
30 #include "AliEventCuts.h"
31 #include "AliYAMLConfiguration.h"
32 #include "THistManager.h"
34 class AliTLorentzVector;
35 class AliEmcalJet;
36 class AliJetContainer;
38 
39 // operator<< has to be forward declared carefully to stay in the global namespace so that it works with CINT.
40 // For generally how to keep the operator in the global namespace, See: https://stackoverflow.com/a/38801633
41 namespace PWGJE { namespace EMCALJetTasks { class AliAnalysisTaskEmcalJetHCorrelations; } }
42 std::ostream & operator<< (std::ostream &in, const PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations &myTask);
43 
44 namespace PWGJE {
45 namespace EMCALJetTasks {
46 
48  public:
53  enum jetBias_t {
54  kDisableBias = 10000
55  };
56 
62  kEffDisable = 0,
63  kEffAutomaticConfiguration = 1,
64  kEffPP = 10,
65  };
66 
68  AliAnalysisTaskEmcalJetHCorrelations(const char *name);
70 
71  Double_t GetTrackBias() const { return fTrackBias; }
72  Double_t GetClusterBias() const { return fClusterBias; }
73 
74  // Jet bias - setters
76  virtual void SetTrackBias(Double_t b) { fTrackBias = b; }
78  virtual void SetClusterBias(Double_t b) { fClusterBias = b; }
79 
80  // Event trigger/mixed selection - setters
82  virtual void SetTriggerType(UInt_t te) { fTriggerType = te; }
84  virtual void SetMixedEventTriggerType(UInt_t me) { fMixingEventType = me; }
86  void SetDisableFastPartition(Bool_t b = kTRUE) { fDisableFastPartition = b; }
87  Bool_t GetDisableFastPartition() const { return fDisableFastPartition; }
89  Bool_t GetRequireMatchedJetWhenEmbedding() const { return fRequireMatchedJetWhenEmbedding; }
90  void SetRequireMatchedJetWhenEmbedding(Bool_t b) { fRequireMatchedJetWhenEmbedding = b; }
92  double GetMinimumSharedMomentumFraction() const { return fMinSharedMomentumFraction; }
93  void SetMinimumSharedMomentumFraction(double d) { fMinSharedMomentumFraction = d; }
94  double GetMaximumMatchedJetDistance() const { return fMaxMatchedJetDistance; }
95  void SetMaximumMatchedJetDistance(double d) { fMaxMatchedJetDistance = d; }
96  bool GetRequireMatchedPartLevelJet() const { return fRequireMatchedPartLevelJet; }
97  void SetRequireMatchedPartLevelJet(bool b) { fRequireMatchedPartLevelJet = b; }
98 
99  // Mixed events
100  virtual void SetEventMixing(Bool_t enable) { fDoEventMixing = enable;}
101  virtual void SetNumberOfMixingTracks(Int_t tracks) { fNMixingTracks = tracks; }
102  virtual void SetMinNTracksForMixedEvents(Int_t nmt) { fMinNTracksMixedEvents = nmt; }
103  virtual void SetMinNEventsForMixedEvents(Int_t nme) { fMinNEventsMixedEvents = nme; }
104  virtual void SetNCentBinsMixedEvent(Bool_t centbins) { fNCentBinsMixedEvent = centbins; }
105  // Switch to cut out some unneeded sparse axis
106  void SetDoLessSparseAxes(Bool_t dlsa) { fDoLessSparseAxes = dlsa; }
107  void SetDoWiderTrackBin(Bool_t wtrbin) { fDoWiderTrackBin = wtrbin; }
108  // Set efficiency correction
109  void SetSingleTrackEfficiencyType(ESingleTrackEfficiency_t trackEffType) { fSingleTrackEfficiencyCorrectionType = trackEffType; }
111  void SetArtificialTrackingInefficiency(double eff) { fArtificialTrackInefficiency = eff; }
112  // Setup JES correction
113  void SetJESCorrectionHist(TH2D * hist) { fJESCorrectionHist = hist; }
114  void SetNoMixedEventJESCorrection(Bool_t b) { fNoMixedEventJESCorrection = b; }
115 
117 
118  // Corrections
119  // Public so that it can be tested externally
120  Double_t EffCorrection(Double_t trkETA, Double_t trkPT, AliAnalysisTaskEmcal::BeamType beamType) const;
121 
122  virtual void UserCreateOutputObjects();
123 
124  // AddTask
125  static AliAnalysisTaskEmcalJetHCorrelations * AddTaskEmcalJetHCorrelations(
126  const char *nTracks = "usedefault",
127  const char *nCaloClusters = "usedefault",
128  // Jet options
129  const Double_t trackBias = 5,
130  const Double_t clusterBias = 5,
131  // Mixed event options
132  const Int_t nTracksMixedEvent = 0, // Additionally acts as a switch for enabling mixed events
133  const Int_t minNTracksMixedEvent = 5000,
134  const Int_t minNEventsMixedEvent = 5,
135  const UInt_t nCentBinsMixedEvent = 10,
136  // Triggers
137  UInt_t trigEvent = AliVEvent::kAny,
138  UInt_t mixEvent = AliVEvent::kAny,
139  // Options
140  const Bool_t lessSparseAxes = kFALSE,
141  const Bool_t widerTrackBin = kFALSE,
142  // Corrections
144  const Bool_t JESCorrection = kFALSE,
145  const char * JESCorrectionFilename = "alien:///alice/cern.ch/user/r/rehlersi/JESCorrection.root",
146  const char * JESCorrectionHistName = "JESCorrection",
147  const char *suffix = "biased"
148  );
149 
150  bool ConfigureForStandardAnalysis(std::string trackName = "usedefault",
151  std::string clusName = "usedefault",
152  const double jetConstituentPtCut = 3,
153  const double trackEta = 0.8,
154  const double jetRadius = 0.2);
155 
156  bool ConfigureForEmbeddingAnalysis(std::string trackName = "usedefault",
157  std::string clusName = "caloClustersCombined",
158  const double jetConstituentPtCut = 3,
159  const double trackEta = 0.8,
160  const double jetRadius = 0.2,
161  const std::string & jetTag = "hybridLevelJets",
162  const std::string & correlationsTracksCutsPeriod = "lhc11a");
163 
164  // Task configuration
165  void AddConfigurationFile(const std::string & configurationPath, const std::string & configName = "") { fYAMLConfig.AddConfiguration(configurationPath, configName); }
166  bool Initialize();
167 
168  // Printing
169  std::string toString() const;
170  friend std::ostream & ::operator<<(std::ostream &in, const AliAnalysisTaskEmcalJetHCorrelations &myTask);
171  void Print(Option_t* opt = "") const;
172  std::ostream & Print(std::ostream &in) const;
173 
174  protected:
175 
176  // NOTE: This is not an ideal way to resolve the size of histogram initialization.
177  // Will be resolved when we move fully to the THnSparse
183  kMaxTrackPtBins = 7,
184  kMaxCentralityBins = 5,
185  kMixedEventMultiplicityBins = 8,
186  };
187 
188  // EMCal framework functions
189  virtual void UserExecOnce();
190  Bool_t IsEventSelected();
191  Bool_t Run();
192 
193  // Utility functions
194  AliParticleContainer * CreateParticleOrTrackContainer(const std::string & collectionName) const;
195  // Determine if a jet has been matched
196  bool CheckForMatchedJet(AliJetContainer * jets, AliEmcalJet * jet, const std::string & histName);
197  // Apply artificial tracking inefficiency
198  bool CheckArtificialTrackEfficiency(unsigned int trackIndex, std::vector<unsigned int> & rejectedTrackIndices, bool useRejectedList);
199  // Reduce event mixing memory usage
200  TObjArray* CloneAndReduceTrackList(std::vector<unsigned int> & rejectedTrackIndices, const bool useRejectedList);
201  // Histogram helper functions
202  virtual THnSparse* NewTHnSparseF(const char* name, UInt_t entries);
203  virtual void GetDimParams(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
204  // Binning helper functions
205  Int_t GetTrackPtBin(Double_t pt) const;
206  UInt_t RetrieveTriggerMask() const;
207  // Helper functions
208  void InitializeArraysToZero();
209  void GetDeltaEtaDeltaPhiDeltaR(AliTLorentzVector & particleOne, AliVParticle * particleTwo, Double_t & deltaEta, Double_t & deltaPhi, Double_t & deltaR);
210  Double_t GetRelativeEPAngle(Double_t jetAngle, Double_t epAngle) const;
211  // Test for biased jet
212  Bool_t BiasedJet(AliEmcalJet * jet);
213  // Corrections
214  Double_t EffCorrection(Double_t trkETA, Double_t trkPT) const;
215 
216  // Fill methods which allow for the JES correction
217  void FillHist(TH1 * hist, Double_t fillValue, Double_t weight = 1.0, Bool_t noCorrection = kFALSE);
218  void FillHist(THnSparse * hist, Double_t *fillValue, Double_t weight = 1.0, Bool_t noCorrection = kFALSE);
219  void AccessSetOfYBinValues(TH2D * hist, Int_t xBin, std::vector <Double_t> & yBinsContent, Double_t scaleFactor = -1.0);
220 
221  // Configuration
222  void RetrieveAndSetTaskPropertiesFromYAMLConfig();
223 
224  // Configuration
227  // Event cuts
228  AliEventCuts fEventCuts;
230  // Jet bias
233  // Event Mixing
239  AliEventPoolManager *fPoolMgr;
240  // Event selection types
244  // Efficiency correction
245  TRandom3 fRandom;
248  // JES correction
251  // Histogram binning variables
258 
259  // Histograms
263  TH2 *fHistTrackEtaPhi[7];
265 
266  TH1 *fHistJetPt[6];
267  TH1 *fHistJetPtBias[6];
268  THnSparse *fhnMixedEvents;
269  THnSparse *fhnJH;
270  THnSparse *fhnTrigger;
271 
272  // Pb-Pb Efficiency correction coefficients
273  static Double_t p0_10SG[17];
274  static Double_t p10_30SG[17];
275  static Double_t p30_50SG[17];
276  static Double_t p50_90SG[17];
277  // Good Runs
278  static Double_t p0_10G[17];
279  static Double_t p10_30G[17];
280  static Double_t p30_50G[17];
281  static Double_t p50_90G[17];
282 
283  private:
284 
287 
289 };
290 
291 } /* namespace EMCALJetTasks */
292 } /* namespace PWGJE */
293 
294 #endif
Bool_t fNoMixedEventJESCorrection
True if the jet energy scale correction should be applied to mixed event histograms.
const char * filename
Definition: TestFCM.C:1
void Print(std::ostream &o, const char *name, Double_t dT, Double_t dVM, Double_t alldT, Double_t alldVM)
Definition: PlotSysInfo.C:121
AliEventCuts fEventCuts
AliEventCuts to handle event selection.
double Double_t
Definition: External.C:58
Definition: External.C:244
TH2D * fJESCorrectionHist
Histogram containing the jet energy scale correction.
virtual void SetTrackBias(Double_t b)
Require a track with pt > b in jet.
Bool_t fDoLessSparseAxes
True if there should be fewer THnSparse axes.
Double_t fMaxMatchedJetDistance
Maximum distance between two matched jets.
Bool_t fDoWiderTrackBin
True if the track pt bins in the THnSparse should be wider.
UInt_t fTriggerType
Event selection for jets (ie triggered events).
Container for particles within the EMCAL framework.
BeamType
Switch for the beam type.
std::ostream & operator<<(std::ostream &in, const PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations &myTask)
double GetMinimumSharedMomentumFraction() const
Mimimum shared momentum fraction for matched jet.
int Int_t
Definition: External.C:63
virtual void SetClusterBias(Double_t b)
Require a cluster with pt > b in jet.
unsigned int UInt_t
Definition: External.C:33
void AddConfigurationFile(const std::string &configurationPath, const std::string &configName="")
Definition: External.C:228
virtual void SetMixedEventTriggerType(UInt_t me)
Set the mixed event trigger selection.
Bool_t GetRequireMatchedJetWhenEmbedding() const
Require jet to be matched when embedding.
Double_t fMinSharedMomentumFraction
Minimum shared momentum with matched jet.
Bool_t fRequireMatchedJetWhenEmbedding
True if jets are required to be matched (ie. jet->MatchedJet() != nullptr)
PWG::Tools::AliYAMLConfiguration fYAMLConfig
YAML configuration file.
Definition: External.C:220
bool fConfigurationInitialized
True if the task configuration has been successfully initialized.
Bool_t fDisableFastPartition
True if task should be disabled for the fast partition, where the EMCal is not included.
YAML configuration class for AliPhysics.
void SetArtificialTrackingInefficiency(double eff)
Artificial tracking inefficiency from 0 to 1. 1.0 (default) will disable it.
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Container class for histograms.
Definition: THistManager.h:99
const char Option_t
Definition: External.C:48
TH2 * fHistJetHEtaPhi
! Eta-phi distribution of jets which are in jet-hadron correlations
ESingleTrackEfficiency_t fSingleTrackEfficiencyCorrectionType
Control the efficiency correction. See EffCorrection() for meaning of values.
const Int_t nbins
bool Bool_t
Definition: External.C:53
Jet-hadron correlations analysis task for central Pb-Pb and pp.
virtual void SetTriggerType(UInt_t te)
Set the trigger event trigger selection.
! Arbitrarily large value which can be used to disable the constituent bias. Can be used for either t...
void SetDisableFastPartition(Bool_t b=kTRUE)
True if the task should be disabled for the fast partition.
Container for jet within the EMCAL jet framework.
bool fRequireMatchedPartLevelJet
True if matched jets are required to be matched to a particle level jet.
Definition: External.C:196
Double_t fArtificialTrackInefficiency
Artificial track inefficiency. Enabled if < 1.0.
TRandom3 fRandom
! Random number generator for artificial track inefficiency.