AliPhysics  32b88a8 (32b88a8)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskChargedJetsPA.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKCHARGEDJETSPA_H
2 #define ALIANALYSISTASKCHARGEDJETSPA_H
3 
4 //#define DEBUGMODE
5 
6 class TList;
7 class TClonesArray;
8 class TString;
9 class AliEmcalJet;
10 class AliRhoParameter;
11 class AliVParticle;
12 class AliLog;
13 class AliAnalysisUtils;
14 class TRandom3;
15 class AliESDtrack;
16 
17 #include "AliESDtrackCuts.h"
18 #include "THn.h"
19 
20 // Class for the hybrid track cuts
22  public:
25  virtual ~AliESDHybridTrackcuts() {delete fAdditionalCuts; delete fMainCuts;};
26 
27  virtual void Copy(AliESDHybridTrackcuts &c) const
28  {
31  target.fMainCuts = fMainCuts;
32  };
33 
34  // Meta function to accept hybrid tracks
35  Int_t AcceptTrack (const AliESDtrack* esdTrack) {
36  if (AcceptNormalTrack(esdTrack))
37  return 1;
38  else if (AcceptAdditionalTrack(esdTrack))
39  return 2;
40  else
41  return 0;
42  };
43 
44  Bool_t AcceptNormalTrack (const AliESDtrack* esdTrack) {if(fMainCuts) return fMainCuts->AcceptTrack(esdTrack); else return kFALSE;};
45  Bool_t AcceptAdditionalTrack (const AliESDtrack* esdTrack) {if(fAdditionalCuts) return fAdditionalCuts->AcceptTrack(esdTrack); else return kFALSE;};
46  void SetMainCuts (AliESDtrackCuts* trackCuts) {fMainCuts = trackCuts;};
47  void SetAdditionalCuts (AliESDtrackCuts* trackCuts) {fAdditionalCuts = trackCuts;};
48  AliESDtrackCuts* GetAdditionalCuts () {return fAdditionalCuts;};
49  AliESDtrackCuts* GetMainCuts () {return fMainCuts;};
50 
51  AliESDHybridTrackcuts &operator=(const AliESDHybridTrackcuts &c) {if (this != &c) ((AliESDHybridTrackcuts &) c).Copy(*this); return *this;};
52  protected:
53  AliESDtrackCuts* fMainCuts; // trackcut object for the global tracks
54  AliESDtrackCuts* fAdditionalCuts; // trackcut object for the complementary tracks
55 
56 // ClassDef(AliESDHybridTrackcuts, 2);
57 };
58 
60  public:
61  enum{
63  };
64  static const double kMaxChi2;
65  // ######### CONTRUCTORS/DESTRUCTORS AND STD FUNCTIONS
67  {
68  // dummy
69  }
70 
71  AliAnalysisTaskChargedJetsPA(const char *name, const char* trackArrayName, const char* jetArrayName, const char* backgroundJetArrayName, Bool_t analyzeJetProfile, Bool_t analyzeTrackcuts);
73  virtual void UserCreateOutputObjects();
74  virtual void UserExec(Option_t *option);
75  virtual Bool_t UserNotify();
76  virtual void Terminate(Option_t *);
77 
78  // ######### SETTERS/GETTERS
85  void SetUsePileUpCut (Bool_t val) {fUsePileUpCut = val;}
86  void SetNoTerminate (Bool_t val) {fNoTerminate = val;}
87  void SetIsPA (Bool_t val) {fIsPA = val;}
93 
95  void SetTrackMinPt(Double_t minPt) {fMinJetPt = minPt;}
96  void SetSignalJetMinPt(Double_t minPt) {fMinJetPt = minPt;}
97  void SetSignalJetMinArea(Double_t minArea) {fMinJetArea = minArea;}
99  void SetRandConeRadius(Double_t radius) {fRandConeRadius = radius;}
100  void SetRandConeNumber(Int_t number) {fRandConeNumber = number;}
103  void SetCentralityType(const char* type) {fCentralityType = type;}
104  void SetExternalRhoTaskName(const char* name) {fRhoTaskName = name;}
105  void SetAcceptanceEta(Double_t minEta, Double_t maxEta) {fMinEta = minEta; fMaxEta = maxEta;}
106  void SetAcceptanceJetEta(Double_t minEta, Double_t maxEta) {fMinJetEta = minEta; fMaxJetEta = maxEta;}
109  {
110  if(i==0)
111  {
113  }
114  else if(i==1)
115  {
118  else
119  AliError("Non-existing output list demanded!");
120  }
121  else if(i==2)
122  {
127  else
128  AliError("Non-existing output list demanded!");
129  }
130  }
131 
132  private:
133 
134  // ######### MAIN CALCULATION FUNCTIONS
135  void InitializeTrackcuts();
136  void GetLeadingJets();
138  Double_t GetDeltaPt(Double_t rho, Double_t overlappingJetExclusionProbability = 0);
139 
140  void GetKTBackgroundDensityAll(Int_t numberExcludeLeadingJets, Double_t& rhoPbPb, Double_t& rhoPbPbWithGhosts, Double_t& rhoCMS, Double_t& rhoImprovedCMS, Double_t& rhoMean, Double_t& rhoTrackLike);
141  void GetTRBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t& rhoNoExclusion, Double_t& rhoConeExclusion02, Double_t& rhoConeExclusion04, Double_t& rhoConeExclusion06, Double_t& rhoConeExclusion08, Double_t& rhoExactExclusion);
142  void GetPPBackgroundDensity(Double_t& background);
143 
144  Double_t GetConePt(Double_t eta, Double_t phi, Double_t radius);
145  Double_t GetCorrectedConePt(Double_t eta, Double_t phi, Double_t radius, Double_t background);
148  void CreateJetProfilePlots(Double_t bgrd);
149  void CreateCutHistograms();
151  void GetPerpendicularCone(Double_t vecPhi, Double_t vecTheta, Double_t& conePt);
152 
153  // ######### CHECK FUNCTIONS
154  Bool_t IsTrackInAcceptance(AliVParticle* track);
155  Bool_t IsTrackInCone(AliVTrack* track, Double_t eta, Double_t phi, Double_t radius);
156  Bool_t IsTrackInJet(AliEmcalJet* jet, Int_t trackIndex);
158 
159  Bool_t IsEventInAcceptance(AliVEvent* event);
161  Bool_t IsSignalJetInAcceptance(AliEmcalJet* jet, Bool_t usePtCut = kFALSE);
162 
163  // ######### HELPER FUNCTIONS
167  Double_t MCGetOverlapCircleRectancle(Double_t cPosX, Double_t cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax);
168  Double_t MCGetOverlapMultipleCirclesRectancle(Int_t numCircles, std::vector<Double_t> cPosX, std::vector<Double_t> cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax);
169  void Match(AliESDtrack* tr0, AliESDtrack* tr1, Int_t& nmatch, Bool_t excludeMom = kFALSE, Double_t rotate=0);
170 
171  // ######### HISTOGRAM FUNCTIONS
172  void FillHistogram(const char * key, Double_t x);
173  void FillHistogram(const char * key, Double_t x, Double_t y);
174  void FillHistogram(const char * key, Double_t x, Double_t y, Double_t add);
175  void FillCutHistogram(const char * key, Double_t cut, Double_t pT, Double_t eta, Double_t phi, Int_t isAdditionalTrack);
176 
177  const char* GetHistoName(const char* name)
178  {
179  if (fParticleLevel)
180  return Form("%s_MC", name);
181  return Form("%s", name);
182  }
183  template <class T> T* AddHistogram1D(const char* name = "CustomHistogram", const char* title = "NO_TITLE", const char* options = "", Int_t xBins = 100, Double_t xMin = 0.0, Double_t xMax = 20.0, const char* xTitle = "x axis", const char* yTitle = "y axis");
184  template <class T> T* AddHistogram2D(const char* name = "CustomHistogram", const char* title = "NO_TITLE", const char* options = "", Int_t xBins = 100, Double_t xMin = 0.0, Double_t xMax = 20.0, Int_t yBins = 100, Double_t yMin = 0.0, Double_t yMax = 20.0, const char* xTitle = "x axis", const char* yTitle = "y axis", const char* zTitle = "z axis");
185  THnF* AddCutHistogram(const char* name, const char* title, const char* cutName, Int_t nBins, Double_t xMin, Double_t xMax);
186  void BinLogAxis(const THn *h, Int_t axisNumber);
187 
188  // ######### STANDARD FUNCTIONS
189  void Calculate(AliVEvent* event);
190  void ExecOnce();
191  void Init ();
192 
193  std::vector<TList*> fOutputLists;
195  // ########## USAGE TRIGGERS
196  Bool_t fDoJetAnalysis; // trigger if jets/tracks etc. should be analyzed
197  Bool_t fAnalyzeJetProfile; // trigger if jet profile should be analyzed
198  Bool_t fAnalyzeTrackcuts; // trigger if trackcuts should be analyzed
199  Bool_t fAnalyzeJetConstituents;// trigger if constituents should be analyzed
200  Bool_t fParticleLevel; // trigger if data is kinematics only (for naming reasons)
201  Bool_t fUseDefaultVertexCut; // trigger if automatic vertex cut from helper class should be done
202  Bool_t fUsePileUpCut; // trigger if pileup cut should be done
203  Bool_t fSetCentralityToOne; // trigger if centrality val. should be set to one for every event (failsafe)
204  Bool_t fNoExternalBackground; // External background is set to 0 (e.g. for PP)
205  Int_t fBackgroundForJetProfile; // Which background will be subtracted for the profile calculation (0=External,1=Improved CMS,2=CMS,3=PP,4=TR,5=None)
206  Int_t fPartialAnalysisNParts; // take only every Nth event
207  Int_t fPartialAnalysisIndex; // using e.g. only every 5th event, this specifies which one
208 
209 
210  // ########## SOURCE INFORMATION
211  TClonesArray* fJetArray;
212  TClonesArray* fTrackArray;
213  TClonesArray* fBackgroundJetArray;
214  TString fJetArrayName; // name of object containing the jets
215  TString fTrackArrayName; // name of object containing the tracks
216  TString fBackgroundJetArrayName;// name of object containing event wise bckgrds
217  TString fRhoTaskName; // name of rho task for this analysis
218  // ########## JET/DIJET/RC PROPERTIES
219  Double_t fRandConeRadius; // Radius for the random cones
220  Int_t fRandConeNumber; // Number of random cones thrown per event
221  Double_t fSignalJetRadius; // Radius for the signal jets
222  Double_t fBackgroundJetRadius; // Radius for the KT background jets
223  Int_t fNumberExcludedJets; // Number of jets to be excluded from backgrounds
224  // ########## CUTS
225  Double_t fMinEta; // min eta of tracks
226  Double_t fMaxEta; // max eta of tracks
227  Double_t fMinJetEta; // min eta of jets
228  Double_t fMaxJetEta; // max eta of jets
229  Double_t fMinTrackPt; // Min track pt to be accepted
230  Double_t fMinJetPt; // Min jet pt to be accepted
231  Double_t fMinJetArea; // Min jet area to be accepted
232  Double_t fMinBackgroundJetPt; // Min jet pt to be accepted as background jet
233  Int_t fMinNCrossedRows; // Min number of crossed TPC rows for trackcut analysis
234  Bool_t fUsePtDepCrossedRowsCut;// Trigger if linear pT dep. for crossed rows cut should be applied
235  Int_t fNumberOfCentralityBins;// Number of centrality bins used for histograms
236  TString fCentralityType; // Used centrality estimate (V0A, V0C, V0M, ...)
237 
238  AliESDtrack* fMatchTr[kMaxMatch];
240 
241 
242  // ########## EVENT PROPERTIES
243  const AliVVertex* fPrimaryVertex;
248  Int_t fNumberSignalJets; // Number of signal jets in event
249  Int_t fNumberSignalJetsAbove5GeV; // Number of signal jets in event > 5GeV
250  // ########## GENERAL VARS
251  TRandom3* fRandom;
252  AliAnalysisUtils* fHelperClass;
253  Bool_t fInitialized; // trigger if tracks/jets are loaded
254  Int_t fTaskInstanceCounter; // for naming reasons
255  Bool_t fIsDEBUG; // Debug trigger
256  Bool_t fIsPA; // pPb trigger
257  Bool_t fNoTerminate; // don't use terminate routines
258  ULong_t fEventCounter; // Internal event counter
259  // ########### HELPER VARS
260  Int_t fTempExcludedRCs; // used for delta pt signal exclusion
261  Int_t fTempAllRCs; // used for delta pt signal exclusion
262  Int_t fTempOverlapCounter; // used for delta pt signal exclusion
263  Double_t fTempMeanExclusionProbability; // used for delta pt signal exclusion
264 
268 
271 
272  ClassDef(AliAnalysisTaskChargedJetsPA, 3); // Charged jet analysis for pA
273 
274 };
275 #endif
Bool_t fDoJetAnalysis
Currently selected list where the histograms will be saved to.
Double_t GetDeltaPt(Double_t rho, Double_t overlappingJetExclusionProbability=0)
AliEmcalJet * fFirstLeadingKTJet
next to leading jet in event
AliESDHybridTrackcuts & operator=(const AliESDHybridTrackcuts &c)
double Double_t
Definition: External.C:58
void GetKTBackgroundDensityAll(Int_t numberExcludeLeadingJets, Double_t &rhoPbPb, Double_t &rhoPbPbWithGhosts, Double_t &rhoCMS, Double_t &rhoImprovedCMS, Double_t &rhoMean, Double_t &rhoTrackLike)
const char * title
Definition: MakeQAPdf.C:26
virtual void UserExec(Option_t *option)
AliAnalysisUtils * fHelperClass
A random number.
TString fJetArrayName
object containing background jets
Bool_t IsSignalJetInAcceptance(AliEmcalJet *jet, Bool_t usePtCut=kFALSE)
Bool_t IsJetOverlapping(AliEmcalJet *jet1, AliEmcalJet *jet2)
void GetTRBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t &rhoNoExclusion, Double_t &rhoConeExclusion02, Double_t &rhoConeExclusion04, Double_t &rhoConeExclusion06, Double_t &rhoConeExclusion08, Double_t &rhoExactExclusion)
TCanvas * c
Definition: TestFitELoss.C:172
Bool_t IsTrackInJet(AliEmcalJet *jet, Int_t trackIndex)
Bool_t IsTrackInCone(AliVTrack *track, Double_t eta, Double_t phi, Double_t radius)
AliESDHybridTrackcuts(const AliESDHybridTrackcuts &pd)
Bool_t IsTrackInAcceptance(AliVParticle *track)
Bool_t AcceptAdditionalTrack(const AliESDtrack *esdTrack)
AliESDtrackCuts * GetAdditionalCuts()
Double_t GetCorrectedConePt(Double_t eta, Double_t phi, Double_t radius, Double_t background)
T * AddHistogram2D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
void GetPPBackgroundDensity(Double_t &background)
void SetAcceptanceJetEta(Double_t minEta, Double_t maxEta)
void SetAdditionalCuts(AliESDtrackCuts *trackCuts)
THnF * AddCutHistogram(const char *name, const char *title, const char *cutName, Int_t nBins, Double_t xMin, Double_t xMax)
int Int_t
Definition: External.C:63
Double_t GetConePt(Double_t eta, Double_t phi, Double_t radius)
AliAnalysisTaskChargedJetsPA & operator=(const AliAnalysisTaskChargedJetsPA &)
Double_t MCGetOverlapMultipleCirclesRectancle(Int_t numCircles, std::vector< Double_t > cPosX, std::vector< Double_t > cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax)
void FillCutHistogram(const char *key, Double_t cut, Double_t pT, Double_t eta, Double_t phi, Int_t isAdditionalTrack)
void BinLogAxis(const THn *h, Int_t axisNumber)
T * AddHistogram1D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis")
Double_t fMatchChi[kMaxMatch]
Helper variables track matching.
AliEmcalJet * fSecondLeadingJet
leading jet in event
Int_t fNumberSignalJets
next to leading kT jet in event
AliEmcalJet * fFirstLeadingJet
Vertex found per event.
unsigned long ULong_t
Definition: External.C:38
void SetAcceptanceEta(Double_t minEta, Double_t maxEta)
Bool_t fInitialized
Vertex selection helper.
const AliVVertex * fPrimaryVertex
Helper variables track matching.
void Match(AliESDtrack *tr0, AliESDtrack *tr1, Int_t &nmatch, Bool_t excludeMom=kFALSE, Double_t rotate=0)
void SetMainCuts(AliESDtrackCuts *trackCuts)
Double_t MCGetOverlapCircleRectancle(Double_t cPosX, Double_t cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax)
Bool_t AcceptNormalTrack(const AliESDtrack *esdTrack)
Int_t GetConeConstituentCount(Double_t eta, Double_t phi, Double_t radius)
Double_t GetCorrectedJetPt(AliEmcalJet *jet, Double_t background)
TClonesArray * fTrackArray
object containing the jets
Double_t GetDeltaPhi(Double_t phi1, Double_t phi2)
Int_t AcceptTrack(const AliESDtrack *esdTrack)
AliESDHybridTrackcuts * fHybridESDtrackCuts_variedPtDep
these trackcuts are applied
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
const char Option_t
Definition: External.C:48
AliESDHybridTrackcuts * fHybridESDtrackCuts_variedPtDep2
these trackcuts are applied
bool Bool_t
Definition: External.C:53
void SetAnalyzePartialEvents(Int_t nParts, Int_t index)
virtual void Copy(AliESDHybridTrackcuts &c) const
void FillHistogram(const char *key, Double_t x)
const char * GetHistoName(const char *name)
void GetPerpendicularCone(Double_t vecPhi, Double_t vecTheta, Double_t &conePt)
AliEmcalJet * fSecondLeadingKTJet
leading kT jet in event
TClonesArray * fBackgroundJetArray
object containing the tracks
Bool_t IsBackgroundJetInAcceptance(AliEmcalJet *jet)
ClassDef(AliAnalysisTaskChargedJetsPA, 3)