AliPhysics  59e0e03 (59e0e03)
AliAnalysisTaskJetExtractor.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKJETEXTRACTOR_H
2 #define ALIANALYSISTASKJETEXTRACTOR_H
3 
4 /* Copyright(c) 1998-2018, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice */
6 
7 
8 //###############################################################################################################################################3
9 class AliRDHFJetsCutsVertex;
10 class AliEmcalJetTree;
11 class AliHFJetsTaggingVertex;
12 
25 //
27  public:
28 
30  AliAnalysisTaskJetExtractor(const char *name);
33  void Terminate(Option_t *option);
35 
36  void ActivateTrueJetMatching(const char* arrayName, const char* rhoName, const char* partArrayName = "mcparticles")
37  {fTruthJetsArrayName = arrayName; fTruthJetsRhoName = rhoName; fTruthParticleArrayName = partArrayName;}
43  void SetVertexerCuts(AliRDHFJetsCutsVertex* val) { fVertexerCuts = val; }
45 
46  protected:
48  void ExecOnce();
49  Bool_t Run();
50  void FillTrackControlHistograms(AliVTrack* track);
53  void AddPIDInformation(AliVParticle* particle, Float_t& sigITS, Float_t& sigTPC, Float_t& sigTOF, Float_t& sigTRD, Short_t& recoPID, Short_t& truePID);
54  Bool_t IsTrackInCone(AliVParticle* track, Double_t eta, Double_t phi, Double_t radius);
55  void GetJetTruePt(AliEmcalJet* jet, Double_t& matchedJetPt, Double_t& truePtFraction);
56  void GetJetType(AliEmcalJet* jet, Int_t& typeHM, Int_t& typePM, Int_t& typeIC);
58 
59  void GetTrackImpactParameters(const AliVVertex* vtx, AliAODTrack* track, Float_t& d0, Float_t& d0cov, Float_t& z0, Float_t& z0cov);
60  void ReconstructSecondaryVertices(const AliVVertex* primVtx, const AliEmcalJet* jet, std::vector<Float_t>& secVtx_X, std::vector<Float_t>& secVtx_Y, std::vector<Float_t>& secVtx_Z,
61  std::vector<Float_t>& secVtx_Mass, std::vector<Float_t>& secVtx_Lxy, std::vector<Float_t>& secVtx_SigmaLxy, std::vector<Float_t>& secVtx_Chi2, std::vector<Float_t>& secVtx_Dispersion);
62 
64  AliHFJetsTaggingVertex* fVtxTagger;
70  AliRDHFJetsCutsVertex* fVertexerCuts;
72 
73 
74 
75  // ################## BASIC EVENT VARIABLES
78  TClonesArray* fTruthParticleArray;
82 
83  // ################## HISTOGRAM HELPER FUNCTIONS
84  void FillHistogram(const char * key, Double_t x);
85  void FillHistogram(const char * key, Double_t x, Double_t y);
86  void FillHistogram(const char * key, Double_t x, Double_t y, Double_t add);
87  void FillHistogram3D(const char * key, Double_t x, Double_t y, Double_t z, Double_t add = 0);
88  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");
89  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");
90  template <class T> T* AddHistogram3D(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, Int_t zBins = 100, Double_t zMin = 0.0, Double_t zMax = 20.0, const char* xTitle = "x axis", const char* yTitle = "y axis", const char* zTitle = "z axis");
91 
92 
93 
94  private:
97 
99  ClassDef(AliAnalysisTaskJetExtractor, 1) // Jet extraction task
101 };
102 
103 
104 //###############################################################################################################################################3
105 static std::vector<Float_t> DEFAULT_VECTOR_FLOAT;
106 static std::vector<Short_t> DEFAULT_VECTOR_SHORT;
116 //
117 class AliEmcalJetTree : public TNamed
118 {
119  public:
120  AliEmcalJetTree();
121  AliEmcalJetTree(const char* name);
122 
123  // ############ SETTERS
124  void AddExtractionPercentage(Float_t minPt, Float_t maxPt, Float_t percentage)
125  {
126  fExtractionPercentagePtBins.push_back(minPt);
127  fExtractionPercentagePtBins.push_back(maxPt);
128  fExtractionPercentages.push_back(percentage);
129  }
130 
131  void AddExtractionJetTypeHM(Int_t type) {fExtractionJetTypes_HM.push_back(type);}
132  void AddExtractionJetTypePM(Int_t type) {fExtractionJetTypes_PM.push_back(type);}
133 
134  void ResetExtractionPercentages() {fExtractionPercentages.clear(); fExtractionPercentagePtBins.clear();}
135 
136  void SetSaveEventProperties(Bool_t val) {fSaveEventProperties = val; fInitialized = kFALSE;}
137  void SetSaveConstituents(Bool_t val) {fSaveConstituents = val; fInitialized = kFALSE;}
138  void SetSaveConstituentsIP(Bool_t val) {fSaveConstituentsIP = val; fInitialized = kFALSE;}
139  void SetSaveConstituentPID(Bool_t val) {fSaveConstituentPID = val; fInitialized = kFALSE;}
140  void SetSaveJetShapes(Bool_t val) {fSaveJetShapes = val; fInitialized = kFALSE;}
141  void SetSaveMCInformation(Bool_t val) {fSaveMCInformation = val; fInitialized = kFALSE;}
142  void SetSaveSecondaryVertices(Bool_t val) {fSaveSecondaryVertices = val; fInitialized = kFALSE;}
143 
144  void InitializeTree();
145 
146  // ############ GETTERS
147  Bool_t GetSaveEventProperties() {return fSaveEventProperties;}
148  Bool_t GetSaveConstituents() {return fSaveConstituents;}
149  Bool_t GetSaveConstituentsIP() {return fSaveConstituentsIP;}
150  Bool_t GetSaveConstituentPID() {return fSaveConstituentPID;}
151  Bool_t GetSaveJetShapes() {return fSaveJetShapes;}
152  Bool_t GetSaveMCInformation() {return fSaveMCInformation;}
153  Bool_t GetSaveSecondaryVertices() {return fSaveSecondaryVertices;}
154 
155  std::vector<Float_t> GetExtractionPercentagePtBins() {return fExtractionPercentagePtBins;}
156  std::vector<Float_t> GetExtractionPercentages() {return fExtractionPercentages;}
157 
159 
160  // ######################################
161  Bool_t AddJetToTree(AliEmcalJet* jet, Float_t bgrdDensity = 0, Float_t vertexX = 0, Float_t vertexY = 0, Float_t vertexZ = 0, Float_t centrality = 0, Long64_t eventID = 0, Float_t magField = 0,
162  AliTrackContainer* trackCont = 0, Int_t motherParton = 0, Int_t motherHadron = 0, Int_t partonInitialCollision = 0, Float_t matchedPt = 0, Float_t truePtFraction = 0, Float_t ptHard = 0,
163  std::vector<Float_t>& trackPID_ITS = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& trackPID_TPC = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& trackPID_TOF = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& trackPID_TRD = DEFAULT_VECTOR_FLOAT, std::vector<Short_t>& trackPID_Reco = DEFAULT_VECTOR_SHORT, std::vector<Short_t>& trackPID_Truth = DEFAULT_VECTOR_SHORT,
164  std::vector<Float_t>& trackIP_d0 = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& trackIP_z0 = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& trackIP_d0cov = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& trackIP_z0cov = DEFAULT_VECTOR_FLOAT,
165  std::vector<Float_t>& secVtx_X = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_Y = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_Z = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_Mass = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_Lxy = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_SigmaLxy = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_Chi2 = DEFAULT_VECTOR_FLOAT, std::vector<Float_t>& secVtx_Dispersion = DEFAULT_VECTOR_FLOAT)
166  {
167  return AddJetToTree(jet, bgrdDensity, vertexX, vertexY, vertexZ, centrality, eventID, magField, trackCont, motherParton, motherHadron, partonInitialCollision, matchedPt, truePtFraction, ptHard,
168  trackPID_ITS.data(), trackPID_TPC.data(), trackPID_TOF.data(), trackPID_TRD.data(), trackPID_Reco.data(), trackPID_Truth.data(),
169  trackIP_d0.data(), trackIP_z0.data(), trackIP_d0cov.data(), trackIP_z0cov.data(),
170  secVtx_X.size(), secVtx_X.data(), secVtx_Y.data(), secVtx_Z.data(), secVtx_Mass.data(), secVtx_Lxy.data(), secVtx_SigmaLxy.data(), secVtx_Chi2.data(), secVtx_Dispersion.data());
171  }
172  Bool_t AddJetToTree(AliEmcalJet* jet, Float_t bgrdDensity, Float_t vertexX, Float_t vertexY, Float_t vertexZ, Float_t centrality, Long64_t eventID, Float_t magField,
173  AliTrackContainer* trackCont, Int_t motherParton, Int_t motherHadron, Int_t partonInitialCollision, Float_t matchedPt, Float_t truePtFraction, Float_t ptHard,
174  Float_t* trackPID_ITS, Float_t* trackPID_TPC, Float_t* trackPID_TOF, Float_t* trackPID_TRD, Short_t* trackPID_Reco, Short_t* trackPID_Truth,
175  Float_t* trackIP_d0, Float_t* trackIP_z0, Float_t* trackIP_d0cov, Float_t* trackIP_z0cov,
176  Int_t numSecVertices, Float_t* secVtx_X, Float_t* secVtx_Y, Float_t* secVtx_Z, Float_t* secVtx_Mass, Float_t* secVtx_Lxy, Float_t* secVtx_SigmaLxy, Float_t* secVtx_Chi2, Float_t* secVtx_Dispersion);
177  // ######################################
178 
179  private:
182 
183  // Save flags
191 
192  // Option flags
193  std::vector<Float_t> fExtractionPercentages;
194  std::vector<Float_t> fExtractionPercentagePtBins;
195  std::vector<Int_t> fExtractionJetTypes_HM;
196  std::vector<Int_t> fExtractionJetTypes_PM;
197 
198  // Buffers that will be added to the tree
204 
213 
221 
223 
229 
231 
232 
234  ClassDef(AliEmcalJetTree, 1) // Jet tree class
236 };
237 
238 #endif
Bool_t fSaveConstituentsIP
save arrays of constituent impact parameters
void ExecOnce()
Perform steps needed to initialize the analysis.
Bool_t fSaveSecondaryVertices
save reconstructed sec. vertex properties
void SetSaveConstituents(Bool_t val)
double Double_t
Definition: External.C:58
TString fTruthParticleArrayName
Array name of MC particles in event (mcparticles)
void AddExtractionJetTypePM(Int_t type)
const char * title
Definition: MakeQAPdf.C:27
void GetJetType(AliEmcalJet *jet, Int_t &typeHM, Int_t &typePM, Int_t &typeIC)
AliAnalysisTaskJetExtractor & operator=(const AliAnalysisTaskJetExtractor &)
void GetTrackImpactParameters(const AliVVertex *vtx, AliAODTrack *track, Float_t &d0, Float_t &d0cov, Float_t &z0, Float_t &z0cov)
Bool_t fSetEmcalJetFlavour
if set, the flavour property of the AliEmcalJets will be set
TTree * fJetTree
! tree structure
long long Long64_t
Definition: External.C:43
T * AddHistogram3D(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, Int_t zBins=100, Double_t zMin=0.0, Double_t zMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
Float_t fBuffer_Event_BackgroundDensity
! array buffer
std::vector< Float_t > GetExtractionPercentages()
Bool_t fSaveMCInformation
save MC information
Container with name, TClonesArray and cuts for particles.
centrality
Double_t fSecondaryVertexMaxChi2
Max chi2 of secondary vertex (others will be discarded)
Double_t fSecondaryVertexMaxDispersion
Max dispersion of secondary vertex (others will be discarded)
std::vector< Float_t > GetExtractionPercentagePtBins()
Bool_t fSaveEventProperties
save general event properties (bgrd. etc.)
static std::vector< Short_t > DEFAULT_VECTOR_SHORT
Bool_t fSaveJetShapes
save jet shapes
Bool_t fSaveConstituentPID
save arrays of constituent PID parameters
AliTrackContainer * fTracksCont
! Tracks
const Int_t kMaxNumConstituents
Bool_t IsTrackInCone(AliVParticle *track, Double_t eta, Double_t phi, Double_t radius)
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")
TString fTruthJetsRhoName
Array name for particle-level rho.
std::vector< Int_t > fExtractionJetTypes_HM
Jet-types that will be extracted with this tree (hadron matching)
Double_t fTrueJetMatchingRadius
Matching radius to true jet.
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
Float_t * fBuffer_Const_Phi
! array buffer
void SetSecondaryVertexMaxDispersion(Double_t val)
Float_t fBuffer_Jet_MC_MatchedPt
! array buffer
std::vector< Float_t > fExtractionPercentages
Percentages which will be extracted for a given pT bin.
TClonesArray * fTruthParticleArray
! Array of MC particles in event (mcparticles)
void FillHistogram3D(const char *key, Double_t x, Double_t y, Double_t z, Double_t add=0)
int Int_t
Definition: External.C:63
Int_t fBuffer_Jet_MC_MotherParton
! array buffer
Float_t fBuffer_Event_PtHard
! array buffer
void SetSaveJetShapes(Bool_t val)
void SetSaveSecondaryVertices(Bool_t val)
Float_t * fBuffer_Const_Charge
! array buffer
float Float_t
Definition: External.C:68
void SetSaveConstituentPID(Bool_t val)
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")
static std::vector< Float_t > DEFAULT_VECTOR_FLOAT
Float_t fBuffer_JetPhi
! array buffer
Float_t fBuffer_JetArea
! array buffer
std::vector< Int_t > fExtractionJetTypes_PM
Jet-types that will be extracted with this tree (parton matching)
std::vector< Float_t > fExtractionPercentagePtBins
pT-bins associated with fExtractionPercentages
Bool_t AddJetToTree(AliEmcalJet *jet, Float_t bgrdDensity=0, Float_t vertexX=0, Float_t vertexY=0, Float_t vertexZ=0, Float_t centrality=0, Long64_t eventID=0, Float_t magField=0, AliTrackContainer *trackCont=0, Int_t motherParton=0, Int_t motherHadron=0, Int_t partonInitialCollision=0, Float_t matchedPt=0, Float_t truePtFraction=0, Float_t ptHard=0, std::vector< Float_t > &trackPID_ITS=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &trackPID_TPC=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &trackPID_TOF=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &trackPID_TRD=DEFAULT_VECTOR_FLOAT, std::vector< Short_t > &trackPID_Reco=DEFAULT_VECTOR_SHORT, std::vector< Short_t > &trackPID_Truth=DEFAULT_VECTOR_SHORT, std::vector< Float_t > &trackIP_d0=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &trackIP_z0=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &trackIP_d0cov=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &trackIP_z0cov=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_X=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_Y=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_Z=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_Mass=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_Lxy=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_SigmaLxy=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_Chi2=DEFAULT_VECTOR_FLOAT, std::vector< Float_t > &secVtx_Dispersion=DEFAULT_VECTOR_FLOAT)
Long64_t fBuffer_Event_ID
! array buffer
Float_t fBuffer_Event_Centrality
! array buffer
Int_t fBuffer_Jet_MC_MotherIC
! array buffer
Float_t * fBuffer_Const_ProdVtx_X
! array buffer
Bool_t fInitialized
init state of tree
void SetSaveConstituentsIP(Bool_t val)
void SetSaveMCInformation(Bool_t val)
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
Analysis task that implements AliEmcalJetTree to extract jets to a tree.
AliHFJetsTaggingVertex * fVtxTagger
! class for sec. vertexing
short Short_t
Definition: External.C:23
TString fTruthJetsArrayName
Array name for particle-level jets.
AliRDHFJetsCutsVertex * fVertexerCuts
Cuts used for the vertexer (given in add task macro)
void AddExtractionJetTypeHM(Int_t type)
void SetSaveEventProperties(Bool_t val)
void FillHistogram(const char *key, Double_t x)
void FillTrackControlHistograms(AliVTrack *track)
Float_t fBuffer_JetPt
! array buffer
void ReconstructSecondaryVertices(const AliVVertex *primVtx, const AliEmcalJet *jet, std::vector< Float_t > &secVtx_X, std::vector< Float_t > &secVtx_Y, std::vector< Float_t > &secVtx_Z, std::vector< Float_t > &secVtx_Mass, std::vector< Float_t > &secVtx_Lxy, std::vector< Float_t > &secVtx_SigmaLxy, std::vector< Float_t > &secVtx_Chi2, std::vector< Float_t > &secVtx_Dispersion)
Float_t fBuffer_Event_Vertex_Y
! array buffer
Bool_t fCalculateSecondaryVertices
Calculate the secondary vertices (instead of loading)
void AddPIDInformation(AliVParticle *particle, Float_t &sigITS, Float_t &sigTPC, Float_t &sigTOF, Float_t &sigTRD, Short_t &recoPID, Short_t &truePID)
Float_t * fBuffer_Const_ProdVtx_Y
! array buffer
void GetJetTruePt(AliEmcalJet *jet, Double_t &matchedJetPt, Double_t &truePtFraction)
Bool_t fSaveConstituents
save arrays of constituent basic properties
void SetVertexerCuts(AliRDHFJetsCutsVertex *val)
Double_t fHadronMatchingRadius
Matching radius to search for beauty/charm hadrons around jet.
Base task in the EMCAL jet framework.
Float_t * fBuffer_Const_Pt
! array buffer
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Float_t * fBuffer_Const_Eta
! array buffer
Float_t fBuffer_JetEta
! array buffer
const char Option_t
Definition: External.C:48
Int_t fBuffer_NumConstituents
! array buffer
void AddExtractionPercentage(Float_t minPt, Float_t maxPt, Float_t percentage)
Float_t fBuffer_Event_Vertex_X
! array buffer
bool Bool_t
Definition: External.C:53
Double_t yMin
void ActivateTrueJetMatching(const char *arrayName, const char *rhoName, const char *partArrayName="mcparticles")
Int_t fBuffer_Jet_MC_MotherHadron
! array buffer
Float_t fBuffer_Shape_Mass
! array buffer
void FillJetControlHistograms(AliEmcalJet *jet)
Float_t * fBuffer_Const_ProdVtx_Z
! array buffer
Container for jet within the EMCAL jet framework.
Float_t fBuffer_Jet_MC_TruePtFraction
! array buffer
Class managing creation of a tree containing jets.
Double_t yMax
Float_t fBuffer_Event_Vertex_Z
! array buffer
Float_t fBuffer_Event_MagneticField
! array buffer