]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/AliEmcalJet.h
updates to AliEmcalJet, AliEmcalJetTask and AliFJWrapper to include subtraction of...
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJet.h
CommitLineData
914d486c 1#ifndef AliEmcalJet_H
2#define AliEmcalJet_H
7df864a3 3
d1f0108e 4#include <vector>
5#include <algorithm>
6#include <utility>
f8087a81 7#include <TArrayS.h>
7efbea04 8#include <TLorentzVector.h>
9#include <TMath.h>
a55e4f1d 10#include <TClonesArray.h>
d1f0108e 11#include <TVector2.h>
a55e4f1d 12
f8087a81 13#include "AliVParticle.h"
a55e4f1d 14#include "AliVCluster.h"
85d48773 15#include "AliVEvent.h"
7efbea04 16
914d486c 17class AliEmcalJet : public AliVParticle
7efbea04 18{
7df864a3 19 public:
3c9775d9 20 enum EFlavourTag{
21 kDStar = 1<<0,
32ca8069 22 kD0 = 1<<1,
23 kSig1 = 1<<2,
24 kSig2 = 1<<3,
25 kBckgrd1 = 1<<4,
26 kBckgrd2 = 1<<5,
27 kBckgrd3 = 1<<6
3c9775d9 28 //.....
29 };
30
96919f91 31 AliEmcalJet();
914d486c 32 AliEmcalJet(Double_t px, Double_t py, Double_t pz);
101cefde 33 AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m);
914d486c 34 AliEmcalJet(const AliEmcalJet &jet);
35 AliEmcalJet& operator=(const AliEmcalJet &jet);
7efbea04 36
a55e4f1d 37 Double_t Px() const { return fPt*TMath::Cos(fPhi); }
da1bd0e7 38 Double_t Py() const { return fPt*TMath::Sin(fPhi); }
a55e4f1d 39 Double_t Pz() const { return fPt*TMath::SinH(fEta); }
40 Double_t Pt() const { return fPt; }
41 Double_t P() const { return fPt*TMath::CosH(fEta); }
42 Bool_t PxPyPz(Double_t p[3]) const { p[0]=Px();p[1]=Py();p[2]=Pz(); return 1; }
43 Double_t Xv() const { return 0.; }
44 Double_t Yv() const { return 0.; }
45 Double_t Zv() const { return 0.; }
46 Bool_t XvYvZv(Double_t x[3]) const { x[0]=0;x[1]=0;x[2]=0; return 1; }
47 Double_t OneOverPt() const { return 1./fPt; }
48 Double_t Phi() const { return fPhi; }
49 Double_t Theta() const { return 2*TMath::ATan(TMath::Exp(-fEta)); }
50 Double_t E() const { Double_t p=P(); return TMath::Sqrt(M()*M()+p*p); }
abfd90d8 51 Double_t M() const { return fM; }
a55e4f1d 52 Double_t Eta() const { return fEta; }
53 Double_t Y() const { return 0.5*TMath::Log((E()+Pz())/(E()-Pz())); }
54 Short_t Charge() const { return 0; }
8082a80b 55 Int_t GetLabel() const { return fLabel; }
a55e4f1d 56 Int_t PdgCode() const { return 0; }
57 const Double_t *PID() const { return 0; }
58 void GetMom(TLorentzVector &vec) const;
59 void Print(Option_t* option = "") const;
688670de 60
a55e4f1d 61 Double_t Area() const { return fArea; }
db8a0184 62 Double_t AreaPt() const { return fArea; }
63 Double_t AreaEta() const { return fAreaEta; }
64 Double_t AreaPhi() const { return fAreaPhi; }
101cefde 65 Double_t AreaEmc() const { return fAreaEmc; }
66 Bool_t AxisInEmcal() const { return fAxisInEmcal; }
db8a0184 67 Int_t Compare(const TObject* obj) const;
a55e4f1d 68 Short_t ClusterAt(Int_t idx) const { return fClusterIDs.At(idx); }
8895e61b 69 AliVCluster *ClusterAt(Int_t idx, TClonesArray *ca) const { if (!ca) return 0; return dynamic_cast<AliVCluster*>(ca->At(ClusterAt(idx))); }
f660c2d6 70 AliVCluster *GetLeadingCluster(TClonesArray *clusters) const;
db8a0184 71 UShort_t GetNumberOfClusters() const { return fClusterIDs.GetSize(); }
96919f91 72 UShort_t GetNumberOfTracks() const { return fTrackIDs.GetSize(); }
624bef5b 73 UShort_t GetNumberOfConstituents() const { return GetNumberOfClusters()+GetNumberOfTracks(); }
101cefde 74 Double_t FracEmcalArea() const { return fAreaEmc/fArea; }
101cefde 75 Bool_t IsInsideEmcal() const { return (fAreaEmc/fArea>0.999); }
76 Bool_t IsInEmcal() const { return (fAreaEmc>0); }
db8a0184 77 Bool_t IsMC() const { return (Bool_t)(MCPt() > 0); }
78 Bool_t IsSortable() const { return kTRUE; }
96919f91 79 Double_t MaxNeutralPt() const { return fMaxNPt; }
80 Double_t MaxChargedPt() const { return fMaxCPt; }
a55e4f1d 81 Double_t NEF() const { return fNEF; }
96919f91 82 UShort_t Nn() const { return fNn; }
83 UShort_t Nch() const { return fNch; }
a55e4f1d 84 UShort_t N() const { return Nch()+Nn(); }
8895e61b 85 Int_t NEmc() const { return fNEmc; }
96919f91 86 Double_t MCPt() const { return fMCPt; }
96919f91 87 Double_t MaxClusterPt() const { return MaxNeutralPt(); }
88 Double_t MaxTrackPt() const { return MaxChargedPt(); }
e44e8726 89 Double_t MaxPartPt() const { return fMaxCPt < fMaxNPt ? fMaxNPt : fMaxCPt; }
8895e61b 90 Double_t PtEmc() const { return fPtEmc; }
91 Double_t PtSub() const { return fPtSub; }
92 Double_t PtSub(Double_t rho) const { return fPt - fArea*rho; }
db8a0184 93 Double_t PtSubVect(Double_t rho) const;
db8a0184 94 Short_t TrackAt(Int_t idx) const { return fTrackIDs.At(idx); }
6d12a4a0 95 AliVParticle *TrackAt(Int_t idx, TClonesArray *ta) const { if (!ta) return 0; return dynamic_cast<AliVParticle*>(ta->At(TrackAt(idx))); }
f660c2d6 96 AliVParticle *GetLeadingTrack(TClonesArray *tracks) const;
3c9775d9 97 Int_t GetFlavour() const { return fFlavourTagging; }
98
a55e4f1d 99 void AddClusterAt(Int_t clus, Int_t idx){ fClusterIDs.AddAt(clus, idx); }
3c9775d9 100 void AddFlavourTag(Int_t tag) { fFlavourTagging |= tag; }
a55e4f1d 101 void AddTrackAt(Int_t track, Int_t idx) { fTrackIDs.AddAt(track, idx); }
038f0049 102 void Clear(Option_t */*option*/="") { fClusterIDs.Set(0); fTrackIDs.Set(0); fClosestJets[0] = 0; fClosestJets[1] = 0;
103 fClosestJetsDist[0] = 0; fClosestJetsDist[1] = 0; fMatched = 0; fPtSub = 0; }
d1f0108e 104 Double_t DeltaR(const AliVParticle* part) const;
8082a80b 105
106 void SetLabel(Int_t l) { fLabel = l; }
101cefde 107 void SetArea(Double_t a) { fArea = a; }
db8a0184 108 void SetAreaEta(Double_t a) { fAreaEta = a; }
109 void SetAreaPhi(Double_t a) { fAreaPhi = a; }
101cefde 110 void SetAreaEmc(Double_t a) { fAreaEmc = a; }
111 void SetAxisInEmcal(Bool_t b) { fAxisInEmcal = b; }
3c9775d9 112 void SetFlavour(Int_t flavour) { fFlavourTagging = flavour; }
96919f91 113 void SetMaxNeutralPt(Double32_t t) { fMaxNPt = t; }
114 void SetMaxChargedPt(Double32_t t) { fMaxCPt = t; }
101cefde 115 void SetNEF(Double_t nef) { fNEF = nef; }
a55e4f1d 116 void SetNumberOfClusters(Int_t n) { fClusterIDs.Set(n); }
117 void SetNumberOfTracks(Int_t n) { fTrackIDs.Set(n); }
96919f91 118 void SetNumberOfCharged(Int_t n) { fNch = n; }
119 void SetNumberOfNeutrals(Int_t n) { fNn = n; }
120 void SetMCPt(Double_t p) { fMCPt = p; }
a55e4f1d 121 void SortConstituents();
d1f0108e 122 std::vector<int> SortConstituentsPt(TClonesArray *tracks) const;
3c9775d9 123 void SetNEmc(Int_t n) { fNEmc = n; }
124 void SetPtEmc(Double_t pt) { fPtEmc = pt; }
125 void SetPtSub(Double_t ps) { fPtSub = ps; }
126 void SetPtSubVect(Double_t ps) { fPtVectSub = ps; }
127 Bool_t TestFlavourTag(Int_t tag) { return (Bool_t)((tag & fFlavourTagging) !=0); }
85d48773 128
129 // Trigger
130 Bool_t IsTriggerJet(UInt_t trigger=AliVEvent::kEMCEJE) const { return (Bool_t)((fTriggers & trigger) != 0); }
131 void SetTrigger(UInt_t trigger) { fTriggers = trigger; }
132 void AddTrigger(UInt_t trigger) { fTriggers |= trigger; }
cfc2ac24 133
134 // Matching
2103dc6a 135 void SetClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[0] = j; fClosestJetsDist[0] = d ; }
cfc2ac24 136 void SetSecondClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[1] = j; fClosestJetsDist[1] = d ; }
137 void SetMatchedToClosest(UShort_t m) { fMatched = 0; fMatchingType = m ; }
138 void SetMatchedToSecondClosest(UShort_t m) { fMatched = 1; fMatchingType = m ; }
2103dc6a 139 void ResetMatching();
cfc2ac24 140 AliEmcalJet* ClosestJet() const { return fClosestJets[0] ; }
141 Double_t ClosestJetDistance() const { return fClosestJetsDist[0] ; }
142 AliEmcalJet* SecondClosestJet() const { return fClosestJets[1] ; }
143 Double_t SecondClosestJetDistance() const { return fClosestJetsDist[1] ; }
144 AliEmcalJet* MatchedJet() const { return fMatched < 2 ? fClosestJets[fMatched] : 0; }
145 UShort_t GetMatchingType() const { return fMatchingType ; }
629e03fc 146
254370e1 147 void SetTaggedJet(AliEmcalJet *j) { fTaggedJet = j ; }
148 void SetTagStatus(Int_t i) { fTagStatus = i ; }
149 AliEmcalJet* GetTaggedJet() const { return fTaggedJet ; }
150 Int_t GetTagStatus() const { return fTagStatus ; }
151
8082a80b 152 //jet shape derivatives
153 void SetFirstDerivative(Double_t d) { fJetShapeMassFirstDer = d ; }
154 void SetSecondDerivative(Double_t d) { fJetShapeMassSecondDer = d ; }
155 void SetFirstOrderSubtracted(Double_t d) { fJetShapeMassFirstSub = d ; }
156 void SetSecondOrderSubtracted(Double_t d) { fJetShapeMassSecondSub = d ; }
157 Double_t GetFirstDerivative() const { return fJetShapeMassFirstDer ; }
158 Double_t GetSecondDerivative() const { return fJetShapeMassSecondDer ; }
159 Double_t GetFirstOrderSubtracted() const { return fJetShapeMassFirstSub ; }
160 Double_t GetSecondOrderSubtracted() const { return fJetShapeMassSecondSub ; }
726c9488 161
162 TArrayF GetGRNumerator() const { return fGRNumerator ; }
163 TArrayF GetGRDenominator() const { return fGRDenominator ; }
164 TArrayF GetGRNumeratorSub() const { return fGRNumeratorSub ; }
165 TArrayF GetGRDenominatorSub() const { return fGRDenominatorSub ; }
166 void AddGRNumAt(Float_t num, Int_t idx) { fGRNumerator.AddAt(num, idx); }
167 void AddGRDenAt(Float_t den, Int_t idx) { fGRDenominator.AddAt(den, idx); }
168 void SetGRNumSize(UInt_t s) {fGRNumerator.Set(s); }
169 void SetGRDenSize(UInt_t s) {fGRDenominator.Set(s); }
170
171 void AddGRNumSubAt(Float_t num, Int_t idx) { fGRNumeratorSub.AddAt(num, idx); }
172 void AddGRDenSubAt(Float_t den, Int_t idx) { fGRDenominatorSub.AddAt(den, idx); }
173 void SetGRNumSubSize(UInt_t s) {fGRNumeratorSub.Set(s); }
174 void SetGRDenSubSize(UInt_t s) {fGRDenominatorSub.Set(s); }
175 void PrintGR();
8082a80b 176
7df864a3 177 protected:
43a9dcd0 178 Double32_t fPt; //[0,0,12] pt
179 Double32_t fEta; //[-1,1,12] eta
180 Double32_t fPhi; //[0,6.3,12] phi
181 Double32_t fM; //[0,0,8] mass
182 Double32_t fNEF; //[0,1,8] neutral energy fraction
183 Double32_t fArea; //[0,0,12] area
db8a0184 184 Double32_t fAreaEta; //[0,0,12] area eta
185 Double32_t fAreaPhi; //[0,0,12] area phi
43a9dcd0 186 Double32_t fAreaEmc; //[0,0,12] area on EMCAL surface (determined from ghosts)
187 Bool_t fAxisInEmcal; // =true if jet axis inside EMCAL acceptance
3c9775d9 188 Int_t fFlavourTagging; // tag jet with a falvour, bit 0 = no tag; bit 1= Dstar; bit 2 = D0
43a9dcd0 189 Double32_t fMaxCPt; //[0,0,12] pt of maximum charged constituent
190 Double32_t fMaxNPt; //[0,0,12] pt of maximum neutral constituent
191 Double32_t fMCPt; // pt from MC particles contributing to the jet
192 Int_t fNn; // number of neutral constituents
193 Int_t fNch; // number of charged constituents
8895e61b 194 Double32_t fPtEmc; //[0,0,12] pt in EMCAL acceptance
195 Int_t fNEmc; // number of constituents in EMCAL acceptance
6d12a4a0 196 TArrayI fClusterIDs; // array containing ids of cluster constituents
197 TArrayI fTrackIDs; // array containing ids of track constituents
43a9dcd0 198 AliEmcalJet *fClosestJets[2]; //! if this is MC it contains the two closest detector level jets in order of distance and viceversa
199 Double32_t fClosestJetsDist[2]; //! distance to closest jets (see above)
200 UShort_t fMatched; //! 0,1 if it is matched with one of the closest jets; 2 if it is not matched
cfc2ac24 201 UShort_t fMatchingType; //! matching type
254370e1 202 AliEmcalJet *fTaggedJet; //! jet tagged to this jet
203 Int_t fTagStatus; //! status of tagging -1: NA 0: not tagged 1: tagged
8895e61b 204 Double_t fPtSub; //! background subtracted pt (not stored set from outside)
db8a0184 205 Double_t fPtVectSub; //! background vector subtracted pt (not stored set from outside)
85d48773 206 UInt_t fTriggers; //! triggers that the jet might have fired (AliVEvent::EOfflineTriggerTypes)
8082a80b 207 Double_t fJetShapeMassFirstDer; //! result from shape derivatives for jet mass: 1st derivative
208 Double_t fJetShapeMassSecondDer; //! result from shape derivatives for jet mass: 2nd derivative
209 Double_t fJetShapeMassFirstSub; //! result from shape derivatives for jet mass: 1st order subtracted
210 Double_t fJetShapeMassSecondSub; //! result from shape derivatives for jet mass: 2nd order subtracted
211 Int_t fLabel; // label to inclusive jet for constituent subtracted jet
7df864a3 212
726c9488 213 TArrayF fGRNumerator; //! array with angular structure function numerator
214 TArrayF fGRDenominator; //! array with angular structure function denominator
215 TArrayF fGRNumeratorSub; //! array with angular structure function numerator
216 TArrayF fGRDenominatorSub; //! array with angular structure function denominator
217
d1f0108e 218 private:
219 struct sort_descend
220 { // sort in decreasing order
221 // first value of the pair is Pt and the second is entry index
222 bool operator () (const std::pair<Double_t, Int_t>& p1, const std::pair<Double_t, Int_t>& p2) { return p1.first > p2.first ; }
223 };
224
726c9488 225 ClassDef(AliEmcalJet,15) // Emcal jet class in cylindrical coordinates
7df864a3 226};
f472e642 227#endif