8 #include <TLorentzVector.h>
10 #include <TClonesArray.h>
13 #include "AliVParticle.h"
14 #include "AliVCluster.h"
15 #include "AliVEvent.h"
17 class AliEmcalJet : public AliVParticle
27 AliEmcalJet(Double_t px, Double_t py, Double_t pz);
28 AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m);
29 AliEmcalJet(const AliEmcalJet &jet);
30 AliEmcalJet& operator=(const AliEmcalJet &jet);
32 Double_t Px() const { return fPt*TMath::Cos(fPhi); }
33 Double_t Py() const { return fPt*TMath::Sin(fPhi); }
34 Double_t Pz() const { return fPt*TMath::SinH(fEta); }
35 Double_t Pt() const { return fPt; }
36 Double_t P() const { return fPt*TMath::CosH(fEta); }
37 Bool_t PxPyPz(Double_t p[3]) const { p[0]=Px();p[1]=Py();p[2]=Pz(); return 1; }
38 Double_t Xv() const { return 0.; }
39 Double_t Yv() const { return 0.; }
40 Double_t Zv() const { return 0.; }
41 Bool_t XvYvZv(Double_t x[3]) const { x[0]=0;x[1]=0;x[2]=0; return 1; }
42 Double_t OneOverPt() const { return 1./fPt; }
43 Double_t Phi() const { return fPhi; }
44 Double_t Theta() const { return 2*TMath::ATan(TMath::Exp(-fEta)); }
45 Double_t E() const { Double_t p=P(); return TMath::Sqrt(M()*M()+p*p); }
46 Double_t M() const { return fM; }
47 Double_t Eta() const { return fEta; }
48 Double_t Y() const { return 0.5*TMath::Log((E()+Pz())/(E()-Pz())); }
49 Short_t Charge() const { return 0; }
50 Int_t GetLabel() const { return fLabel; }
51 Int_t PdgCode() const { return 0; }
52 const Double_t *PID() const { return 0; }
53 void GetMom(TLorentzVector &vec) const;
54 void Print(Option_t* option = "") const;
56 Double_t Area() const { return fArea; }
57 Double_t AreaPt() const { return fArea; }
58 Double_t AreaEta() const { return fAreaEta; }
59 Double_t AreaPhi() const { return fAreaPhi; }
60 Double_t AreaEmc() const { return fAreaEmc; }
61 Bool_t AxisInEmcal() const { return fAxisInEmcal; }
62 Int_t Compare(const TObject* obj) const;
63 Short_t ClusterAt(Int_t idx) const { return fClusterIDs.At(idx); }
64 AliVCluster *ClusterAt(Int_t idx, TClonesArray *ca) const { if (!ca) return 0; return dynamic_cast<AliVCluster*>(ca->At(ClusterAt(idx))); }
65 AliVCluster *GetLeadingCluster(TClonesArray *clusters) const;
66 UShort_t GetNumberOfClusters() const { return fClusterIDs.GetSize(); }
67 UShort_t GetNumberOfTracks() const { return fTrackIDs.GetSize(); }
68 UShort_t GetNumberOfConstituents() const { return GetNumberOfClusters()+GetNumberOfTracks(); }
69 Double_t FracEmcalArea() const { return fAreaEmc/fArea; }
70 Bool_t IsInsideEmcal() const { return (fAreaEmc/fArea>0.999); }
71 Bool_t IsInEmcal() const { return (fAreaEmc>0); }
72 Bool_t IsMC() const { return (Bool_t)(MCPt() > 0); }
73 Bool_t IsSortable() const { return kTRUE; }
74 Double_t MaxNeutralPt() const { return fMaxNPt; }
75 Double_t MaxChargedPt() const { return fMaxCPt; }
76 Double_t NEF() const { return fNEF; }
77 UShort_t Nn() const { return fNn; }
78 UShort_t Nch() const { return fNch; }
79 UShort_t N() const { return Nch()+Nn(); }
80 Int_t NEmc() const { return fNEmc; }
81 Double_t MCPt() const { return fMCPt; }
82 Double_t MaxClusterPt() const { return MaxNeutralPt(); }
83 Double_t MaxTrackPt() const { return MaxChargedPt(); }
84 Double_t MaxPartPt() const { return fMaxCPt < fMaxNPt ? fMaxNPt : fMaxCPt; }
85 Double_t PtEmc() const { return fPtEmc; }
86 Double_t PtSub() const { return fPtSub; }
87 Double_t PtSub(Double_t rho) const { return fPt - fArea*rho; }
88 Double_t PtSubVect(Double_t rho) const;
89 Short_t TrackAt(Int_t idx) const { return fTrackIDs.At(idx); }
90 AliVParticle *TrackAt(Int_t idx, TClonesArray *ta) const { if (!ta) return 0; return dynamic_cast<AliVParticle*>(ta->At(TrackAt(idx))); }
91 AliVParticle *GetLeadingTrack(TClonesArray *tracks) const;
92 Int_t GetFlavour() const { return fFlavourTagging; }
94 void AddClusterAt(Int_t clus, Int_t idx){ fClusterIDs.AddAt(clus, idx); }
95 void AddFlavourTag(Int_t tag) { fFlavourTagging |= tag; }
96 void AddTrackAt(Int_t track, Int_t idx) { fTrackIDs.AddAt(track, idx); }
97 void Clear(Option_t */*option*/="") { fClusterIDs.Set(0); fTrackIDs.Set(0); fClosestJets[0] = 0; fClosestJets[1] = 0;
98 fClosestJetsDist[0] = 0; fClosestJetsDist[1] = 0; fMatched = 0; fPtSub = 0; }
99 Double_t DeltaR(const AliVParticle* part) const;
101 void SetLabel(Int_t l) { fLabel = l; }
102 void SetArea(Double_t a) { fArea = a; }
103 void SetAreaEta(Double_t a) { fAreaEta = a; }
104 void SetAreaPhi(Double_t a) { fAreaPhi = a; }
105 void SetAreaEmc(Double_t a) { fAreaEmc = a; }
106 void SetAxisInEmcal(Bool_t b) { fAxisInEmcal = b; }
107 void SetFlavour(Int_t flavour) { fFlavourTagging = flavour; }
108 void SetMaxNeutralPt(Double32_t t) { fMaxNPt = t; }
109 void SetMaxChargedPt(Double32_t t) { fMaxCPt = t; }
110 void SetNEF(Double_t nef) { fNEF = nef; }
111 void SetNumberOfClusters(Int_t n) { fClusterIDs.Set(n); }
112 void SetNumberOfTracks(Int_t n) { fTrackIDs.Set(n); }
113 void SetNumberOfCharged(Int_t n) { fNch = n; }
114 void SetNumberOfNeutrals(Int_t n) { fNn = n; }
115 void SetMCPt(Double_t p) { fMCPt = p; }
116 void SortConstituents();
117 std::vector<int> SortConstituentsPt(TClonesArray *tracks) const;
118 void SetNEmc(Int_t n) { fNEmc = n; }
119 void SetPtEmc(Double_t pt) { fPtEmc = pt; }
120 void SetPtSub(Double_t ps) { fPtSub = ps; }
121 void SetPtSubVect(Double_t ps) { fPtVectSub = ps; }
122 Bool_t TestFlavourTag(Int_t tag) { return (Bool_t)((tag & fFlavourTagging) !=0); }
125 Bool_t IsTriggerJet(UInt_t trigger=AliVEvent::kEMCEJE) const { return (Bool_t)((fTriggers & trigger) != 0); }
126 void SetTrigger(UInt_t trigger) { fTriggers = trigger; }
127 void AddTrigger(UInt_t trigger) { fTriggers |= trigger; }
130 void SetClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[0] = j; fClosestJetsDist[0] = d ; }
131 void SetSecondClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[1] = j; fClosestJetsDist[1] = d ; }
132 void SetMatchedToClosest(UShort_t m) { fMatched = 0; fMatchingType = m ; }
133 void SetMatchedToSecondClosest(UShort_t m) { fMatched = 1; fMatchingType = m ; }
134 void ResetMatching();
135 AliEmcalJet* ClosestJet() const { return fClosestJets[0] ; }
136 Double_t ClosestJetDistance() const { return fClosestJetsDist[0] ; }
137 AliEmcalJet* SecondClosestJet() const { return fClosestJets[1] ; }
138 Double_t SecondClosestJetDistance() const { return fClosestJetsDist[1] ; }
139 AliEmcalJet* MatchedJet() const { return fMatched < 2 ? fClosestJets[fMatched] : 0; }
140 UShort_t GetMatchingType() const { return fMatchingType ; }
142 void SetTaggedJet(AliEmcalJet *j) { fTaggedJet = j ; }
143 void SetTagStatus(Int_t i) { fTagStatus = i ; }
144 AliEmcalJet* GetTaggedJet() const { return fTaggedJet ; }
145 Int_t GetTagStatus() const { return fTagStatus ; }
147 //jet shape derivatives
148 void SetFirstDerivative(Double_t d) { fJetShapeMassFirstDer = d ; }
149 void SetSecondDerivative(Double_t d) { fJetShapeMassSecondDer = d ; }
150 void SetFirstOrderSubtracted(Double_t d) { fJetShapeMassFirstSub = d ; }
151 void SetSecondOrderSubtracted(Double_t d) { fJetShapeMassSecondSub = d ; }
152 Double_t GetFirstDerivative() const { return fJetShapeMassFirstDer ; }
153 Double_t GetSecondDerivative() const { return fJetShapeMassSecondDer ; }
154 Double_t GetFirstOrderSubtracted() const { return fJetShapeMassFirstSub ; }
155 Double_t GetSecondOrderSubtracted() const { return fJetShapeMassSecondSub ; }
158 Double32_t fPt; //[0,0,12] pt
159 Double32_t fEta; //[-1,1,12] eta
160 Double32_t fPhi; //[0,6.3,12] phi
161 Double32_t fM; //[0,0,8] mass
162 Double32_t fNEF; //[0,1,8] neutral energy fraction
163 Double32_t fArea; //[0,0,12] area
164 Double32_t fAreaEta; //[0,0,12] area eta
165 Double32_t fAreaPhi; //[0,0,12] area phi
166 Double32_t fAreaEmc; //[0,0,12] area on EMCAL surface (determined from ghosts)
167 Bool_t fAxisInEmcal; // =true if jet axis inside EMCAL acceptance
168 Int_t fFlavourTagging; // tag jet with a falvour, bit 0 = no tag; bit 1= Dstar; bit 2 = D0
169 Double32_t fMaxCPt; //[0,0,12] pt of maximum charged constituent
170 Double32_t fMaxNPt; //[0,0,12] pt of maximum neutral constituent
171 Double32_t fMCPt; // pt from MC particles contributing to the jet
172 Int_t fNn; // number of neutral constituents
173 Int_t fNch; // number of charged constituents
174 Double32_t fPtEmc; //[0,0,12] pt in EMCAL acceptance
175 Int_t fNEmc; // number of constituents in EMCAL acceptance
176 TArrayI fClusterIDs; // array containing ids of cluster constituents
177 TArrayI fTrackIDs; // array containing ids of track constituents
178 AliEmcalJet *fClosestJets[2]; //! if this is MC it contains the two closest detector level jets in order of distance and viceversa
179 Double32_t fClosestJetsDist[2]; //! distance to closest jets (see above)
180 UShort_t fMatched; //! 0,1 if it is matched with one of the closest jets; 2 if it is not matched
181 UShort_t fMatchingType; //! matching type
182 AliEmcalJet *fTaggedJet; //! jet tagged to this jet
183 Int_t fTagStatus; //! status of tagging -1: NA 0: not tagged 1: tagged
184 Double_t fPtSub; //! background subtracted pt (not stored set from outside)
185 Double_t fPtVectSub; //! background vector subtracted pt (not stored set from outside)
186 UInt_t fTriggers; //! triggers that the jet might have fired (AliVEvent::EOfflineTriggerTypes)
187 Double_t fJetShapeMassFirstDer; //! result from shape derivatives for jet mass: 1st derivative
188 Double_t fJetShapeMassSecondDer; //! result from shape derivatives for jet mass: 2nd derivative
189 Double_t fJetShapeMassFirstSub; //! result from shape derivatives for jet mass: 1st order subtracted
190 Double_t fJetShapeMassSecondSub; //! result from shape derivatives for jet mass: 2nd order subtracted
191 Int_t fLabel; // label to inclusive jet for constituent subtracted jet
195 { // sort in decreasing order
196 // first value of the pair is Pt and the second is entry index
197 bool operator () (const std::pair<Double_t, Int_t>& p1, const std::pair<Double_t, Int_t>& p2) { return p1.first > p2.first ; }
200 ClassDef(AliEmcalJet,14) // Emcal jet class in cylindrical coordinates