7 #include "AliEmcalJet.h"
10 #include "Riostream.h"
14 //__________________________________________________________________________________________________
15 AliEmcalJet::AliEmcalJet() :
49 fClosestJetsDist[0] = 999;
50 fClosestJetsDist[1] = 999;
53 //__________________________________________________________________________________________________
54 AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) :
56 fPt(TMath::Sqrt(px*px+py*py)),
57 fEta(TMath::ASinH(pz/fPt)),
87 fPhi = TMath::ATan2(py, px);
89 fPhi += 2. * TMath::Pi();
94 fClosestJetsDist[0] = 999;
95 fClosestJetsDist[1] = 999;
98 //_________________________________________________________________________________________________
99 AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
132 fPhi += TMath::TwoPi();
136 fClosestJetsDist[0] = 999;
137 fClosestJetsDist[1] = 999;
140 //_________________________________________________________________________________________________
141 AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
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),
161 fClusterIDs(jet.fClusterIDs),
162 fTrackIDs(jet.fTrackIDs),
163 fMatched(jet.fMatched),
164 fMatchingType(jet.fMatchingType),
165 fTaggedJet(jet.fTaggedJet),
166 fTagStatus(jet.fTagStatus),
168 fPtVectSub(jet.fPtVectSub),
169 fTriggers(jet.fTriggers)
173 fClosestJets[0] = jet.fClosestJets[0];
174 fClosestJets[1] = jet.fClosestJets[1];
175 fClosestJetsDist[0] = jet.fClosestJetsDist[0];
176 fClosestJetsDist[1] = jet.fClosestJetsDist[1];
179 //_________________________________________________________________________________________________
180 AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
182 // Assignment operator.
185 AliVParticle::operator=(jet);
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;
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;
214 fPtVectSub = jet.fPtVectSub;
215 fTriggers = jet.fTriggers;
221 //_________________________________________________________________________________________________
222 Int_t AliEmcalJet::Compare(const TObject* obj) const
224 //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
226 const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj);
234 //__________________________________________________________________________________________________
235 void AliEmcalJet::GetMom(TLorentzVector &vec) const
237 // Return momentum as four vector.
239 Double_t p = fPt *TMath::CosH(fEta);
240 vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
243 //__________________________________________________________________________________________________
244 void AliEmcalJet::Print(Option_t* /*option*/) const
246 // Print jet information.
248 Printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f", fPt, fEta, fPhi, fArea, fNEF);
251 //__________________________________________________________________________________________________
252 Double_t AliEmcalJet::PtSubVect(Double_t rho) const
254 // Return vectorial subtracted transverse momentum.
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);
262 //__________________________________________________________________________________________________
263 void AliEmcalJet::SortConstituents()
265 // Sort constituent by index (increasing).
267 std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
268 std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
271 //__________________________________________________________________________________________________
272 AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const
274 AliVParticle* maxTrack = 0;
275 for (Int_t i = 0; i < GetNumberOfTracks(); i++) {
276 AliVParticle *track = TrackAt(i, tracks);
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()));
282 if (!maxTrack || track->Pt() > maxTrack->Pt())
289 //__________________________________________________________________________________________________
290 AliVCluster* AliEmcalJet::GetLeadingCluster(TClonesArray *clusters) const
292 AliVCluster* maxCluster = 0;
293 for (Int_t i = 0; i < GetNumberOfClusters(); i++) {
294 AliVCluster *cluster = ClusterAt(i, clusters);
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()));
300 if (!maxCluster || cluster->E() > maxCluster->E())
301 maxCluster = cluster;
307 //__________________________________________________________________________________________________
308 void AliEmcalJet::ResetMatching()
312 fClosestJetsDist[0] = 999;
313 fClosestJetsDist[1] = 999;