7 #include "AliEmcalJet.h"
11 //__________________________________________________________________________________________________
12 AliEmcalJet::AliEmcalJet() :
42 fClosestJetsDist[0] = 999;
43 fClosestJetsDist[1] = 999;
46 //__________________________________________________________________________________________________
47 AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) :
49 fPt(TMath::Sqrt(px*px+py*py)),
50 fEta(TMath::ASinH(pz/fPt)),
76 fPhi = TMath::ATan2(py, px);
78 fPhi += 2. * TMath::Pi();
83 fClosestJetsDist[0] = 999;
84 fClosestJetsDist[1] = 999;
87 //_________________________________________________________________________________________________
88 AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
117 fPhi += TMath::TwoPi();
121 fClosestJetsDist[0] = 999;
122 fClosestJetsDist[1] = 999;
125 //_________________________________________________________________________________________________
126 AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
134 fAreaEta(jet.fAreaEta),
135 fAreaPhi(jet.fAreaPhi),
136 fAreaEmc(jet.fAreaEmc),
137 fAxisInEmcal(jet.fAxisInEmcal),
138 fMaxCPt(jet.fMaxCPt),
139 fMaxNPt(jet.fMaxNPt),
145 fClusterIDs(jet.fClusterIDs),
146 fTrackIDs(jet.fTrackIDs),
147 fMatched(jet.fMatched),
148 fMatchingType(jet.fMatchingType),
150 fPtVectSub(jet.fPtVectSub)
154 fClosestJets[0] = jet.fClosestJets[0];
155 fClosestJets[1] = jet.fClosestJets[1];
156 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
157 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
160 //_________________________________________________________________________________________________
161 AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
163 // Assignment operator.
166 AliVParticle::operator=(jet);
173 fAreaEta = jet.fAreaEta;
174 fAreaPhi = jet.fAreaPhi;
175 fAreaEmc = jet.fAreaEmc;
176 fAxisInEmcal = jet.fAxisInEmcal;
177 fMaxCPt = jet.fMaxCPt;
178 fMaxNPt = jet.fMaxNPt;
184 fClusterIDs = jet.fClusterIDs;
185 fTrackIDs = jet.fTrackIDs;
186 fClosestJets[0] = jet.fClosestJets[0];
187 fClosestJets[1] = jet.fClosestJets[1];
188 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
189 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
190 fMatched = jet.fMatched;
192 fPtVectSub = jet.fPtVectSub;
198 //_________________________________________________________________________________________________
199 Int_t AliEmcalJet::Compare(const TObject* obj) const
201 //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
203 const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj);
211 //__________________________________________________________________________________________________
212 void AliEmcalJet::GetMom(TLorentzVector &vec) const
214 // Return momentum as four vector.
216 Double_t p = fPt *TMath::CosH(fEta);
217 vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
220 //__________________________________________________________________________________________________
221 void AliEmcalJet::Print(Option_t* /*option*/) const
223 // Print jet information.
225 printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
228 //__________________________________________________________________________________________________
229 Double_t AliEmcalJet::PtSubVect(Double_t rho) const
231 // Return vectorial subtracted transverse momentum.
233 Double_t dx = Px() - rho * fArea * TMath::Cos(fAreaPhi);
234 Double_t dy = Py() - rho * fArea * TMath::Sin(fAreaPhi);
235 //Double_t dz = Pz() - rho * fArea * TMath::SinH(fAreaEta);
236 return TMath::Sqrt(dx*dx+dy*dy);
239 //__________________________________________________________________________________________________
240 void AliEmcalJet::SortConstituents()
242 // Sort constituent by index (increasing).
244 std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
245 std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
248 //__________________________________________________________________________________________________
249 AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const
251 AliVParticle* maxTrack = 0;
252 for (Int_t i = 0; i < GetNumberOfTracks(); i++) {
253 AliVParticle *track = TrackAt(i, tracks);
254 if (!maxTrack || track->Pt() > maxTrack->Pt())
261 //__________________________________________________________________________________________________
262 AliVCluster* AliEmcalJet::GetLeadingCluster(TClonesArray *clusters) const
264 AliVCluster* maxCluster = 0;
265 for (Int_t i = 0; i < GetNumberOfClusters(); i++) {
266 AliVCluster *cluster = ClusterAt(i, clusters);
267 if (!maxCluster || cluster->E() > maxCluster->E())
268 maxCluster = cluster;
274 //__________________________________________________________________________________________________
275 void AliEmcalJet::ResetMatching()
279 fClosestJetsDist[0] = 999;
280 fClosestJetsDist[1] = 999;