]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWGJE/EMCALJetTasks/AliEmcalJet.cxx
changes confusing histo names
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJet.cxx
... / ...
CommitLineData
1// $Id$
2//
3// Emcal jet class.
4//
5// Author: C.Loizides
6
7#include "AliEmcalJet.h"
8
9#include "AliLog.h"
10#include "Riostream.h"
11
12ClassImp(AliEmcalJet)
13
14//__________________________________________________________________________________________________
15AliEmcalJet::AliEmcalJet() :
16 AliVParticle(),
17 fPt(0),
18 fEta(0),
19 fPhi(0),
20 fM(0),
21 fNEF(0),
22 fArea(0),
23 fAreaEta(0),
24 fAreaPhi(0),
25 fAreaEmc(-1),
26 fAxisInEmcal(0),
27 fFlavourTagging(0),
28 fMaxCPt(0),
29 fMaxNPt(0),
30 fMCPt(0),
31 fNn(0),
32 fNch(0),
33 fPtEmc(0),
34 fNEmc(0),
35 fClusterIDs(),
36 fTrackIDs(),
37 fMatched(2),
38 fMatchingType(0),
39 fTaggedJet(0x0),
40 fTagStatus(-1),
41 fPtSub(0),
42 fPtVectSub(0),
43 fTriggers(0)
44{
45 // Constructor.
46
47 fClosestJets[0] = 0;
48 fClosestJets[1] = 0;
49 fClosestJetsDist[0] = 999;
50 fClosestJetsDist[1] = 999;
51}
52
53//__________________________________________________________________________________________________
54AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) :
55 AliVParticle(),
56 fPt(TMath::Sqrt(px*px+py*py)),
57 fEta(TMath::ASinH(pz/fPt)),
58 fPhi(0),
59 fM(0),
60 fNEF(0),
61 fArea(0),
62 fAreaEta(0),
63 fAreaPhi(0),
64 fAreaEmc(-1),
65 fAxisInEmcal(0),
66 fFlavourTagging(0),
67 fMaxCPt(0),
68 fMaxNPt(0),
69 fMCPt(0),
70 fNn(0),
71 fNch(0),
72 fPtEmc(0),
73 fNEmc(0),
74 fClusterIDs(),
75 fTrackIDs(),
76 fMatched(2),
77 fMatchingType(0),
78 fTaggedJet(0x0),
79 fTagStatus(-1),
80 fPtSub(0),
81 fPtVectSub(0),
82 fTriggers(0)
83{
84 // Constructor.
85
86 if (fPt != 0) {
87 fPhi = TMath::ATan2(py, px);
88 if (fPhi<0.)
89 fPhi += 2. * TMath::Pi();
90 }
91
92 fClosestJets[0] = 0;
93 fClosestJets[1] = 0;
94 fClosestJetsDist[0] = 999;
95 fClosestJetsDist[1] = 999;
96}
97
98//_________________________________________________________________________________________________
99AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
100 AliVParticle(),
101 fPt(pt),
102 fEta(eta),
103 fPhi(phi),
104 fM(m),
105 fNEF(0),
106 fArea(0),
107 fAreaEta(0),
108 fAreaPhi(0),
109 fAreaEmc(-1),
110 fAxisInEmcal(0),
111 fFlavourTagging(0),
112 fMaxCPt(0),
113 fMaxNPt(0),
114 fMCPt(0),
115 fNn(0),
116 fNch(0),
117 fPtEmc(0),
118 fNEmc(0),
119 fClusterIDs(),
120 fTrackIDs(),
121 fMatched(2),
122 fMatchingType(0),
123 fTaggedJet(0x0),
124 fTagStatus(-1),
125 fPtSub(0),
126 fPtVectSub(0),
127 fTriggers(0)
128{
129 // Constructor.
130
131 if (fPhi<0.)
132 fPhi += TMath::TwoPi();
133
134 fClosestJets[0] = 0;
135 fClosestJets[1] = 0;
136 fClosestJetsDist[0] = 999;
137 fClosestJetsDist[1] = 999;
138}
139
140//_________________________________________________________________________________________________
141AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
142 AliVParticle(jet),
143 fPt(jet.fPt),
144 fEta(jet.fEta),
145 fPhi(jet.fPhi),
146 fM(jet.fM),
147 fNEF(jet.fNEF),
148 fArea(jet.fArea),
149 fAreaEta(jet.fAreaEta),
150 fAreaPhi(jet.fAreaPhi),
151 fAreaEmc(jet.fAreaEmc),
152 fAxisInEmcal(jet.fAxisInEmcal),
153 fFlavourTagging(jet.fFlavourTagging),
154 fMaxCPt(jet.fMaxCPt),
155 fMaxNPt(jet.fMaxNPt),
156 fMCPt(jet.fMCPt),
157 fNn(jet.fNn),
158 fNch(jet.fNch),
159 fPtEmc(jet.fPtEmc),
160 fNEmc(jet.fNEmc),
161 fClusterIDs(jet.fClusterIDs),
162 fTrackIDs(jet.fTrackIDs),
163 fMatched(jet.fMatched),
164 fMatchingType(jet.fMatchingType),
165 fTaggedJet(jet.fTaggedJet),
166 fTagStatus(jet.fTagStatus),
167 fPtSub(jet.fPtSub),
168 fPtVectSub(jet.fPtVectSub),
169 fTriggers(jet.fTriggers)
170{
171 // Copy constructor.
172
173 fClosestJets[0] = jet.fClosestJets[0];
174 fClosestJets[1] = jet.fClosestJets[1];
175 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
176 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
177}
178
179//_________________________________________________________________________________________________
180AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
181{
182 // Assignment operator.
183
184 if (this!=&jet) {
185 AliVParticle::operator=(jet);
186 fPt = jet.fPt;
187 fEta = jet.fEta;
188 fPhi = jet.fPhi;
189 fM = jet.fM;
190 fNEF = jet.fNEF;
191 fArea = jet.fArea;
192 fAreaEta = jet.fAreaEta;
193 fAreaPhi = jet.fAreaPhi;
194 fAreaEmc = jet.fAreaEmc;
195 fAxisInEmcal = jet.fAxisInEmcal;
196 fFlavourTagging = jet.fFlavourTagging;
197 fMaxCPt = jet.fMaxCPt;
198 fMaxNPt = jet.fMaxNPt;
199 fMCPt = jet.fMCPt;
200 fNn = jet.fNn;
201 fNch = jet.fNch;
202 fPtEmc = jet.fPtEmc;
203 fNEmc = jet.fNEmc;
204 fClusterIDs = jet.fClusterIDs;
205 fTrackIDs = jet.fTrackIDs;
206 fClosestJets[0] = jet.fClosestJets[0];
207 fClosestJets[1] = jet.fClosestJets[1];
208 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
209 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
210 fMatched = jet.fMatched;
211 fTaggedJet = jet.fTaggedJet;
212 fTagStatus = jet.fTagStatus;
213 fPtSub = jet.fPtSub;
214 fPtVectSub = jet.fPtVectSub;
215 fTriggers = jet.fTriggers;
216 }
217
218 return *this;
219}
220
221//_________________________________________________________________________________________________
222Int_t AliEmcalJet::Compare(const TObject* obj) const
223{
224 //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
225
226 const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj);
227 if (!obj)
228 return 0;
229 if (Pt()>jet->Pt())
230 return -1;
231 return 1;
232}
233
234//__________________________________________________________________________________________________
235void AliEmcalJet::GetMom(TLorentzVector &vec) const
236{
237 // Return momentum as four vector.
238
239 Double_t p = fPt *TMath::CosH(fEta);
240 vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
241}
242
243//__________________________________________________________________________________________________
244void AliEmcalJet::Print(Option_t* /*option*/) const
245{
246 // Print jet information.
247
248 Printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f", fPt, fEta, fPhi, fArea, fNEF);
249}
250
251//__________________________________________________________________________________________________
252Double_t AliEmcalJet::PtSubVect(Double_t rho) const
253{
254 // Return vectorial subtracted transverse momentum.
255
256 Double_t dx = Px() - rho * fArea * TMath::Cos(fAreaPhi);
257 Double_t dy = Py() - rho * fArea * TMath::Sin(fAreaPhi);
258 //Double_t dz = Pz() - rho * fArea * TMath::SinH(fAreaEta);
259 return TMath::Sqrt(dx*dx+dy*dy);
260}
261
262//__________________________________________________________________________________________________
263void AliEmcalJet::SortConstituents()
264{
265 // Sort constituent by index (increasing).
266
267 std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
268 std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
269}
270
271//__________________________________________________________________________________________________
272AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const
273{
274 AliVParticle* maxTrack = 0;
275 for (Int_t i = 0; i < GetNumberOfTracks(); i++) {
276 AliVParticle *track = TrackAt(i, tracks);
277 if (!track) {
278 AliError(Form("Unable to find jet track %d in collection %s (pos in collection %d, max %d)",
279 i,tracks->GetName(),TrackAt(i),tracks->GetEntriesFast()));
280 continue;
281 }
282 if (!maxTrack || track->Pt() > maxTrack->Pt())
283 maxTrack = track;
284 }
285
286 return maxTrack;
287}
288
289//__________________________________________________________________________________________________
290AliVCluster* AliEmcalJet::GetLeadingCluster(TClonesArray *clusters) const
291{
292 AliVCluster* maxCluster = 0;
293 for (Int_t i = 0; i < GetNumberOfClusters(); i++) {
294 AliVCluster *cluster = ClusterAt(i, clusters);
295 if (!cluster) {
296 AliError(Form("Unable to find jet cluster %d in collection %s (pos in collection %d, max %d)",
297 i,clusters->GetName(),ClusterAt(i),clusters->GetEntriesFast()));
298 continue;
299 }
300 if (!maxCluster || cluster->E() > maxCluster->E())
301 maxCluster = cluster;
302 }
303
304 return maxCluster;
305}
306
307//__________________________________________________________________________________________________
308void AliEmcalJet::ResetMatching()
309{
310 fClosestJets[0] = 0;
311 fClosestJets[1] = 0;
312 fClosestJetsDist[0] = 999;
313 fClosestJetsDist[1] = 999;
314 fMatched = 2;
315}