AliPhysics  master (3d17d9d)
AliAnalysisTaskEmcalJetHMEC.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"
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 
58  AliAnalysisTaskEmcalJetHCorrelations(const char *name);
60 
61  Double_t GetTrackBias() const { return fTrackBias; }
62  Double_t GetClusterBias() const { return fClusterBias; }
63 
64  // Jet bias - setters
66  virtual void SetTrackBias(Double_t b) { fTrackBias = b; }
68  virtual void SetClusterBias(Double_t b) { fClusterBias = b; }
69 
70  // Event trigger/mixed selection - setters
72  virtual void SetTriggerType(UInt_t te) { fTriggerType = te; }
74  virtual void SetMixedEventTriggerType(UInt_t me) { fMixingEventType = me; }
76  void SetDisableFastPartition(Bool_t b = kTRUE) { fDisableFastPartition = b; }
77  Bool_t GetDisableFastPartition() const { return fDisableFastPartition; }
79  Bool_t GetRequireMatchedJetWhenEmbedding() const { return fRequireMatchedJetWhenEmbedding; }
80  void SetRequireMatchedJetWhenEmbedding(Bool_t b) { fRequireMatchedJetWhenEmbedding = b; }
82  double GetMinimumSharedMomentumFraction() const { return fMinSharedMomentumFraction; }
83  void SetMinimumSharedMomentumFraction(double d) { fMinSharedMomentumFraction = d; }
84  double GetMaximumMatchedJetDistance() const { return fMaxMatchedJetDistance; }
85  void SetMaximumMatchedJetDistance(double d) { fMaxMatchedJetDistance = d; }
86  bool GetRequireMatchedPartLevelJet() const { return fRequireMatchedPartLevelJet; }
87  void SetRequireMatchedPartLevelJet(bool b) { fRequireMatchedPartLevelJet = b; }
88 
89  // Mixed events
90  virtual void SetEventMixing(Bool_t enable) { fDoEventMixing = enable;}
91  virtual void SetNumberOfMixingTracks(Int_t tracks) { fNMixingTracks = tracks; }
92  virtual void SetMinNTracksForMixedEvents(Int_t nmt) { fMinNTracksMixedEvents = nmt; }
93  virtual void SetMinNEventsForMixedEvents(Int_t nme) { fMinNEventsMixedEvents = nme; }
94  virtual void SetNCentBinsMixedEvent(Bool_t centbins) { fNCentBinsMixedEvent = centbins; }
95  // Switch to cut out some unneeded sparse axis
96  void SetDoLessSparseAxes(Bool_t dlsa) { fDoLessSparseAxes = dlsa; }
97  void SetDoWiderTrackBin(Bool_t wtrbin) { fDoWiderTrackBin = wtrbin; }
99  void SetArtificialTrackingInefficiency(double eff) { fArtificialTrackInefficiency = eff; }
100  // Setup JES correction
101  void SetJESCorrectionHist(TH2D * hist) { fJESCorrectionHist = hist; }
102  void SetNoMixedEventJESCorrection(Bool_t b) { fNoMixedEventJESCorrection = b; }
103 
105 
106  virtual void UserCreateOutputObjects();
107 
108  // AddTask
109  static AliAnalysisTaskEmcalJetHCorrelations * AddTaskEmcalJetHCorrelations(
110  const char *nTracks = "usedefault",
111  const char *nCaloClusters = "usedefault",
112  // Jet options
113  const Double_t trackBias = 5,
114  const Double_t clusterBias = 5,
115  // Mixed event options
116  const Int_t nTracksMixedEvent = 0, // Additionally acts as a switch for enabling mixed events
117  const Int_t minNTracksMixedEvent = 5000,
118  const Int_t minNEventsMixedEvent = 5,
119  const UInt_t nCentBinsMixedEvent = 10,
120  // Triggers
121  UInt_t trigEvent = AliVEvent::kAny,
122  UInt_t mixEvent = AliVEvent::kAny,
123  // Options
124  const Bool_t lessSparseAxes = kFALSE,
125  const Bool_t widerTrackBin = kFALSE,
126  const Bool_t JESCorrection = kFALSE,
127  const char * JESCorrectionFilename = "alien:///alice/cern.ch/user/r/rehlersi/JESCorrection.root",
128  const char * JESCorrectionHistName = "JESCorrection",
129  const char *suffix = "biased"
130  );
131 
132  bool ConfigureForStandardAnalysis(std::string trackName = "usedefault",
133  std::string clusName = "usedefault",
134  const double jetConstituentPtCut = 3,
135  const double trackEta = 0.8,
136  const double jetRadius = 0.2);
137 
138  bool ConfigureForEmbeddingAnalysis(std::string trackName = "usedefault",
139  std::string clusName = "caloClustersCombined",
140  const double jetConstituentPtCut = 3,
141  const double trackEta = 0.8,
142  const double jetRadius = 0.2,
143  const std::string & jetTag = "hybridLevelJets",
144  const std::string & correlationsTracksCutsPeriod = "lhc11a");
145 
146  // Task configuration
147  void AddConfigurationFile(const std::string & configurationPath, const std::string & configName = "") { fYAMLConfig.AddConfiguration(configurationPath, configName); }
148  bool Initialize();
149 
150  // Printing
151  std::string toString() const;
152  friend std::ostream & ::operator<<(std::ostream &in, const AliAnalysisTaskEmcalJetHCorrelations &myTask);
153  void Print(Option_t* opt = "") const;
154  std::ostream & Print(std::ostream &in) const;
155 
156  protected:
157 
158  // NOTE: This is not an ideal way to resolve the size of histogram initialization.
159  // Will be resolved when we move fully to the THnSparse
165  kMaxTrackPtBins = 7,
166  kMaxCentralityBins = 5,
167  kMixedEventMultiplicityBins = 8,
168  };
169 
170  // EMCal framework functions
171  virtual void UserExecOnce();
172  Bool_t Run();
173 
174  // Utility functions
175  // Determine if a jet has been matched
176  bool CheckForMatchedJet(AliJetContainer * jets, AliEmcalJet * jet, const std::string & histName);
177  // Apply artificial tracking inefficiency
178  bool CheckArtificialTrackEfficiency(unsigned int trackIndex, std::vector<unsigned int> & rejectedTrackIndices, bool useRejectedList);
179  // Reduce event mixing memory usage
180  TObjArray* CloneAndReduceTrackList(std::vector<unsigned int> & rejectedTrackIndices, const bool useRejectedList);
181  // Histogram helper functions
182  virtual THnSparse* NewTHnSparseF(const char* name, UInt_t entries);
183  virtual void GetDimParams(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
184  // Binning helper functions
185  Int_t GetTrackPtBin(Double_t pt) const;
186  UInt_t RetrieveTriggerMask() const;
187  // Helper functions
188  void InitializeArraysToZero();
189  void GetDeltaEtaDeltaPhiDeltaR(AliTLorentzVector & particleOne, AliVParticle * particleTwo, Double_t & deltaEta, Double_t & deltaPhi, Double_t & deltaR);
190  Double_t GetRelativeEPAngle(Double_t jetAngle, Double_t epAngle) const;
191  // Test for biased jet
192  Bool_t BiasedJet(AliEmcalJet * jet);
193  // Corrections
194  Double_t EffCorrection(Double_t trackEta, Double_t trackPt) const;
195 
196  // Fill methods which allow for the JES correction
197  void FillHist(TH1 * hist, Double_t fillValue, Double_t weight = 1.0, Bool_t noCorrection = kFALSE);
198  void FillHist(THnSparse * hist, Double_t *fillValue, Double_t weight = 1.0, Bool_t noCorrection = kFALSE);
199  void AccessSetOfYBinValues(TH2D * hist, Int_t xBin, std::vector <Double_t> & yBinsContent, Double_t scaleFactor = -1.0);
200 
201  // Configuration
202  void RetrieveAndSetTaskPropertiesFromYAMLConfig();
203 
204  // Configuration
206  bool fConfigurationInitialized;
207  // Jet bias
208  Double_t fTrackBias;
209  Double_t fClusterBias;
210  // Event Mixing
211  Bool_t fDoEventMixing;
212  Int_t fNMixingTracks;
213  Int_t fMinNTracksMixedEvents;
214  Int_t fMinNEventsMixedEvents;
215  UInt_t fNCentBinsMixedEvent;
216  AliEventPoolManager *fPoolMgr;
217  // Event selection types
218  UInt_t fTriggerType;
219  UInt_t fMixingEventType;
220  Bool_t fDisableFastPartition;
221  // Efficiency correction
222  TRandom3 fRandom;
224  Double_t fArtificialTrackInefficiency;
225  // JES correction
226  Bool_t fNoMixedEventJESCorrection;
227  TH2D *fJESCorrectionHist;
228  // Histogram binning variables
229  Bool_t fDoLessSparseAxes;
230  Bool_t fDoWiderTrackBin;
231  Bool_t fRequireMatchedJetWhenEmbedding;
232  Double_t fMinSharedMomentumFraction;
233  bool fRequireMatchedPartLevelJet;
234  Double_t fMaxMatchedJetDistance;
235 
236  // Histograms
237  THistManager fHistManager;
238  TH1 *fHistJetHTrackPt;
239  TH2 *fHistJetEtaPhi;
240  TH2 *fHistTrackEtaPhi[7];
241  TH2 *fHistJetHEtaPhi;
242 
243  TH1 *fHistJetPt[6];
244  TH1 *fHistJetPtBias[6];
245  THnSparse *fhnMixedEvents;
246  THnSparse *fhnJH;
247  THnSparse *fhnTrigger;
248 
249  private:
250 
253 
255 };
256 
257 } /* namespace EMCALJetTasks */
258 } /* namespace PWGJE */
259 
260 #endif
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
virtual void SetTrackBias(Double_t b)
Require a track with pt > b in jet.
std::ostream & operator<<(std::ostream &in, const PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHCorrelations &myTask)
Container for particles within the EMCAL framework.
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.
Definition: External.C:220
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
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.
EEfficiencyPeriodIdentifier_t
Identify the beam type and period that is being analyzed.
! 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.
Definition: External.C:196