7 #include "AliEmcalJet.h"
10 #include "Riostream.h"
14 //__________________________________________________________________________________________________
15 AliEmcalJet::AliEmcalJet() :
47 fClosestJetsDist[0] = 999;
48 fClosestJetsDist[1] = 999;
51 //__________________________________________________________________________________________________
52 AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) :
54 fPt(TMath::Sqrt(px*px+py*py)),
55 fEta(TMath::ASinH(pz/fPt)),
83 fPhi = TMath::ATan2(py, px);
85 fPhi += 2. * TMath::Pi();
90 fClosestJetsDist[0] = 999;
91 fClosestJetsDist[1] = 999;
94 //_________________________________________________________________________________________________
95 AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
126 fPhi += TMath::TwoPi();
130 fClosestJetsDist[0] = 999;
131 fClosestJetsDist[1] = 999;
134 //_________________________________________________________________________________________________
135 AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
143 fAreaEta(jet.fAreaEta),
144 fAreaPhi(jet.fAreaPhi),
145 fAreaEmc(jet.fAreaEmc),
146 fAxisInEmcal(jet.fAxisInEmcal),
147 fFlavourTagging(jet.fFlavourTagging),
148 fMaxCPt(jet.fMaxCPt),
149 fMaxNPt(jet.fMaxNPt),
155 fClusterIDs(jet.fClusterIDs),
156 fTrackIDs(jet.fTrackIDs),
157 fMatched(jet.fMatched),
158 fMatchingType(jet.fMatchingType),
160 fPtVectSub(jet.fPtVectSub),
161 fTriggers(jet.fTriggers)
165 fClosestJets[0] = jet.fClosestJets[0];
166 fClosestJets[1] = jet.fClosestJets[1];
167 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
168 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
171 //_________________________________________________________________________________________________
172 AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
174 // Assignment operator.
177 AliVParticle::operator=(jet);
184 fAreaEta = jet.fAreaEta;
185 fAreaPhi = jet.fAreaPhi;
186 fAreaEmc = jet.fAreaEmc;
187 fAxisInEmcal = jet.fAxisInEmcal;
188 fFlavourTagging = jet.fFlavourTagging;
189 fMaxCPt = jet.fMaxCPt;
190 fMaxNPt = jet.fMaxNPt;
196 fClusterIDs = jet.fClusterIDs;
197 fTrackIDs = jet.fTrackIDs;
198 fClosestJets[0] = jet.fClosestJets[0];
199 fClosestJets[1] = jet.fClosestJets[1];
200 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
201 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
202 fMatched = jet.fMatched;
204 fPtVectSub = jet.fPtVectSub;
205 fTriggers = jet.fTriggers;
211 //_________________________________________________________________________________________________
212 Int_t AliEmcalJet::Compare(const TObject* obj) const
214 //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
216 const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj);
224 //__________________________________________________________________________________________________
225 void AliEmcalJet::GetMom(TLorentzVector &vec) const
227 // Return momentum as four vector.
229 Double_t p = fPt *TMath::CosH(fEta);
230 vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
233 //__________________________________________________________________________________________________
234 void AliEmcalJet::Print(Option_t* /*option*/) const
236 // Print jet information.
238 Printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f", fPt, fEta, fPhi, fArea, fNEF);
241 //__________________________________________________________________________________________________
242 Double_t AliEmcalJet::PtSubVect(Double_t rho) const
244 // Return vectorial subtracted transverse momentum.
246 Double_t dx = Px() - rho * fArea * TMath::Cos(fAreaPhi);
247 Double_t dy = Py() - rho * fArea * TMath::Sin(fAreaPhi);
248 //Double_t dz = Pz() - rho * fArea * TMath::SinH(fAreaEta);
249 return TMath::Sqrt(dx*dx+dy*dy);
252 //__________________________________________________________________________________________________
253 void AliEmcalJet::SortConstituents()
255 // Sort constituent by index (increasing).
257 std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
258 std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
261 //__________________________________________________________________________________________________
262 AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const
264 AliVParticle* maxTrack = 0;
265 for (Int_t i = 0; i < GetNumberOfTracks(); i++) {
266 AliVParticle *track = TrackAt(i, tracks);
268 AliError(Form("Unable to find jet track %d in collection %s (pos in collection %d, max %d)",
269 i,tracks->GetName(),TrackAt(i),tracks->GetEntriesFast()));
272 if (!maxTrack || track->Pt() > maxTrack->Pt())
279 //__________________________________________________________________________________________________
280 AliVCluster* AliEmcalJet::GetLeadingCluster(TClonesArray *clusters) const
282 AliVCluster* maxCluster = 0;
283 for (Int_t i = 0; i < GetNumberOfClusters(); i++) {
284 AliVCluster *cluster = ClusterAt(i, clusters);
286 AliError(Form("Unable to find jet cluster %d in collection %s (pos in collection %d, max %d)",
287 i,clusters->GetName(),ClusterAt(i),clusters->GetEntriesFast()));
290 if (!maxCluster || cluster->E() > maxCluster->E())
291 maxCluster = cluster;
297 //__________________________________________________________________________________________________
298 void AliEmcalJet::ResetMatching()
302 fClosestJetsDist[0] = 999;
303 fClosestJetsDist[1] = 999;