AliPhysics  608b256 (608b256)
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 "AliYAMLConfiguration.h"
31 #include "THistManager.h"
33 class AliTLorentzVector;
34 class AliEmcalJet;
35 class AliJetContainer;
37 
38 // operator<< has to be forward declared carefully to stay in the global namespace so that it works with CINT.
39 // For generally how to keep the operator in the global namespace, See: https://stackoverflow.com/a/38801633
40 namespace PWGJE { namespace EMCALJetTasks { class AliAnalysisTaskEmcalJetHCorrelations; } }
41 std::ostream & operator<< (std::ostream &in, const PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations &myTask);
42 
43 namespace PWGJE {
44 namespace EMCALJetTasks {
45 
47  public:
52  enum jetBias_t {
53  kDisableBias = 10000
54  };
55 
61  kEffDisable = 0,
62  kEffAutomaticConfiguration = 1,
63  kEffPP = 10,
64  };
65 
67  AliAnalysisTaskEmcalJetHCorrelations(const char *name);
69 
70  Double_t GetTrackBias() const { return fTrackBias; }
71  Double_t GetClusterBias() const { return fClusterBias; }
72 
73  // Jet bias - setters
75  virtual void SetTrackBias(Double_t b) { fTrackBias = b; }
77  virtual void SetClusterBias(Double_t b) { fClusterBias = b; }
78 
79  // Event trigger/mixed selection - setters
81  virtual void SetTriggerType(UInt_t te) { fTriggerType = te; }
83  virtual void SetMixedEventTriggerType(UInt_t me) { fMixingEventType = me; }
85  void SetDisableFastPartition(Bool_t b = kTRUE) { fDisableFastPartition = b; }
86  Bool_t GetDisableFastPartition() const { return fDisableFastPartition; }
88  Bool_t GetRequireMatchedJetWhenEmbedding() const { return fRequireMatchedJetWhenEmbedding; }
89  void SetRequireMatchedJetWhenEmbedding(Bool_t b) { fRequireMatchedJetWhenEmbedding = b; }
91  double GetMinimumSharedMomentumFraction() const { return fMinSharedMomentumFraction; }
92  void SetMinimumSharedMomentumFraction(double d) { fMinSharedMomentumFraction = d; }
93  double GetMaximumMatchedJetDistance() const { return fMaxMatchedJetDistance; }
94  void SetMaximumMatchedJetDistance(double d) { fMaxMatchedJetDistance = d; }
95  bool GetRequireMatchedPartLevelJet() const { return fRequireMatchedPartLevelJet; }
96  void SetRequireMatchedPartLevelJet(bool b) { fRequireMatchedPartLevelJet = b; }
97 
98  // Mixed events
99  virtual void SetEventMixing(Bool_t enable) { fDoEventMixing = enable;}
100  virtual void SetNumberOfMixingTracks(Int_t tracks) { fNMixingTracks = tracks; }
101  virtual void SetMinNTracksForMixedEvents(Int_t nmt) { fMinNTracksMixedEvents = nmt; }
102  virtual void SetMinNEventsForMixedEvents(Int_t nme) { fMinNEventsMixedEvents = nme; }
103  virtual void SetNCentBinsMixedEvent(Bool_t centbins) { fNCentBinsMixedEvent = centbins; }
104  // Switch to cut out some unneeded sparse axis
105  void SetDoLessSparseAxes(Bool_t dlsa) { fDoLessSparseAxes = dlsa; }
106  void SetDoWiderTrackBin(Bool_t wtrbin) { fDoWiderTrackBin = wtrbin; }
107  // Set efficiency correction
108  void SetSingleTrackEfficiencyType(ESingleTrackEfficiency_t trackEffType) { fSingleTrackEfficiencyCorrectionType = trackEffType; }
110  void SetArtificialTrackingInefficiency(double eff) { fArtificialTrackInefficiency = eff; }
111  // Setup JES correction
112  void SetJESCorrectionHist(TH2D * hist) { fJESCorrectionHist = hist; }
113  void SetNoMixedEventJESCorrection(Bool_t b) { fNoMixedEventJESCorrection = b; }
114 
116 
117  // Corrections
118  // Public so that it can be tested externally
119  Double_t EffCorrection(Double_t trkETA, Double_t trkPT, AliAnalysisTaskEmcal::BeamType beamType) const;
120 
121  virtual void UserCreateOutputObjects();
122 
123  // AddTask
124  static AliAnalysisTaskEmcalJetHCorrelations * AddTaskEmcalJetHCorrelations(
125  const char *nTracks = "usedefault",
126  const char *nCaloClusters = "usedefault",
127  // Jet options
128  const Double_t trackBias = 5,
129  const Double_t clusterBias = 5,
130  // Mixed event options
131  const Int_t nTracksMixedEvent = 0, // Additionally acts as a switch for enabling mixed events
132  const Int_t minNTracksMixedEvent = 5000,
133  const Int_t minNEventsMixedEvent = 5,
134  const UInt_t nCentBinsMixedEvent = 10,
135  // Triggers
136  UInt_t trigEvent = AliVEvent::kAny,
137  UInt_t mixEvent = AliVEvent::kAny,
138  // Options
139  const Bool_t lessSparseAxes = kFALSE,
140  const Bool_t widerTrackBin = kFALSE,
141  // Corrections
143  const Bool_t JESCorrection = kFALSE,
144  const char * JESCorrectionFilename = "alien:///alice/cern.ch/user/r/rehlersi/JESCorrection.root",
145  const char * JESCorrectionHistName = "JESCorrection",
146  const char *suffix = "biased"
147  );
148 
149  bool ConfigureForStandardAnalysis(std::string trackName = "usedefault",
150  std::string clusName = "usedefault",
151  const double jetConstituentPtCut = 3,
152  const double trackEta = 0.8,
153  const double jetRadius = 0.2);
154 
155  bool ConfigureForEmbeddingAnalysis(std::string trackName = "usedefault",
156  std::string clusName = "caloClustersCombined",
157  const double jetConstituentPtCut = 3,
158  const double trackEta = 0.8,
159  const double jetRadius = 0.2,
160  const std::string & jetTag = "hybridLevelJets",
161  const std::string & correlationsTracksCutsPeriod = "lhc11a");
162 
163  // Task configuration
164  void AddConfigurationFile(const std::string & configurationPath, const std::string & configName = "") { fYAMLConfig.AddConfiguration(configurationPath, configName); }
165  bool Initialize();
166 
167  // Printing
168  std::string toString() const;
169  friend std::ostream & ::operator<<(std::ostream &in, const AliAnalysisTaskEmcalJetHCorrelations &myTask);
170  void Print(Option_t* opt = "") const;
171  std::ostream & Print(std::ostream &in) const;
172 
173  protected:
174 
175  // NOTE: This is not an ideal way to resolve the size of histogram initialization.
176  // Will be resolved when we move fully to the THnSparse
182  kMaxTrackPtBins = 7,
183  kMaxCentralityBins = 5,
184  kMixedEventMultiplicityBins = 8,
185  };
186 
187  // EMCal framework functions
188  virtual void UserExecOnce();
189  Bool_t Run();
190 
191  // Utility functions
192  AliParticleContainer * CreateParticleOrTrackContainer(const std::string & collectionName) const;
193  // Determine if a jet has been matched
194  bool CheckForMatchedJet(AliJetContainer * jets, AliEmcalJet * jet, const std::string & histName);
195  // Apply artificial tracking inefficiency
196  bool CheckArtificialTrackEfficiency(unsigned int trackIndex, std::vector<unsigned int> & rejectedTrackIndices, bool useRejectedList);
197  // Reduce event mixing memory usage
198  TObjArray* CloneAndReduceTrackList(std::vector<unsigned int> & rejectedTrackIndices, const bool useRejectedList);
199  // Histogram helper functions
200  virtual THnSparse* NewTHnSparseF(const char* name, UInt_t entries);
201  virtual void GetDimParams(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
202  // Binning helper functions
203  Int_t GetTrackPtBin(Double_t pt) const;
204  UInt_t RetrieveTriggerMask() const;
205  // Helper functions
206  void InitializeArraysToZero();
207  void GetDeltaEtaDeltaPhiDeltaR(AliTLorentzVector & particleOne, AliVParticle * particleTwo, Double_t & deltaEta, Double_t & deltaPhi, Double_t & deltaR);
208  Double_t GetRelativeEPAngle(Double_t jetAngle, Double_t epAngle) const;
209  // Test for biased jet
210  Bool_t BiasedJet(AliEmcalJet * jet);
211  // Corrections
212  Double_t EffCorrection(Double_t trkETA, Double_t trkPT) const;
213 
214  // Fill methods which allow for the JES correction
215  void FillHist(TH1 * hist, Double_t fillValue, Double_t weight = 1.0, Bool_t noCorrection = kFALSE);
216  void FillHist(THnSparse * hist, Double_t *fillValue, Double_t weight = 1.0, Bool_t noCorrection = kFALSE);
217  void AccessSetOfYBinValues(TH2D * hist, Int_t xBin, std::vector <Double_t> & yBinsContent, Double_t scaleFactor = -1.0);
218 
219  // Configuration
220  void RetrieveAndSetTaskPropertiesFromYAMLConfig();
221 
222  // Configuration
225  // Jet bias
228  // Event Mixing
234  AliEventPoolManager *fPoolMgr;
235  // Event selection types
239  // Efficiency correction
240  TRandom3 fRandom;
243  // JES correction
246  // Histogram binning variables
253 
254  // Histograms
258  TH2 *fHistTrackEtaPhi[7];
260 
261  TH1 *fHistJetPt[6];
262  TH1 *fHistJetPtBias[6];
263  THnSparse *fhnMixedEvents;
264  THnSparse *fhnJH;
265  THnSparse *fhnTrigger;
266 
267  // Pb-Pb Efficiency correction coefficients
268  static Double_t p0_10SG[17];
269  static Double_t p10_30SG[17];
270  static Double_t p30_50SG[17];
271  static Double_t p50_90SG[17];
272  // Good Runs
273  static Double_t p0_10G[17];
274  static Double_t p10_30G[17];
275  static Double_t p30_50G[17];
276  static Double_t p50_90G[17];
277 
278  private:
279 
282 
284 };
285 
286 } /* namespace EMCALJetTasks */
287 } /* namespace PWGJE */
288 
289 #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
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.