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 Int_t AliEmcalJet::Compare(const TObject* obj) const
200 //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
202 const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj);
210 //__________________________________________________________________________________________________
211 void AliEmcalJet::GetMom(TLorentzVector &vec) const
213 // Return momentum as four vector.
215 Double_t p = fPt *TMath::CosH(fEta);
216 vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
219 //__________________________________________________________________________________________________
220 void AliEmcalJet::Print(Option_t* /*option*/) const
222 // Print jet information.
224 printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
227 //__________________________________________________________________________________________________
228 Double_t AliEmcalJet::PtSubVect(Double_t rho) const
230 // Return vectorial subtracted transverse momentum.
232 Double_t dx = Px() - rho * fArea * TMath::Cos(fAreaPhi);
233 Double_t dy = Py() - rho * fArea * TMath::Sin(fAreaPhi);
234 //Double_t dz = Pz() - rho * fArea * TMath::SinH(fAreaEta);
235 return TMath::Sqrt(dx*dx+dy*dy);
238 //__________________________________________________________________________________________________
239 void AliEmcalJet::SortConstituents()
241 // Sort constituent by index (increasing).
243 std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
244 std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
247 //__________________________________________________________________________________________________
248 AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const
250 AliVParticle* maxTrack = 0;
251 for (Int_t i = 0; i < GetNumberOfTracks(); i++) {
252 AliVParticle *track = TrackAt(i, tracks);
253 if (!maxTrack || track->Pt() > maxTrack->Pt())
260 //__________________________________________________________________________________________________
261 AliVCluster* AliEmcalJet::GetLeadingCluster(TClonesArray *clusters) const
263 AliVCluster* maxCluster = 0;
264 for (Int_t i = 0; i < GetNumberOfClusters(); i++) {
265 AliVCluster *cluster = ClusterAt(i, clusters);
266 if (!maxCluster || cluster->E() > maxCluster->E())
267 maxCluster = cluster;