]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALTasks/AliEmcalJet.cxx
258c071e69ef8ba2d436e7ca21384e5d0dd22575
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliEmcalJet.cxx
1 // $Id$
2
3 #include "AliEmcalJet.h"
4
5 ClassImp(AliEmcalJet)
6
7 //__________________________________________________________________________________________________
8 AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) 
9   : AliVParticle(), 
10     fPt(TMath::Sqrt(px*px+py*py)), 
11     fEta(TMath::ASinH(pz/fPt)),
12     fPhi(0), 
13     fM(0), 
14     fNEF(0), 
15     fArea(0), 
16     fMaxCPt(0), 
17     fMaxNPt(0), 
18     fClusterIDs(), 
19     fTrackIDs()
20 {    
21   // Constructor.
22
23   if (fPt != 0) {
24     fPhi = TMath::ATan2(py, px);
25     if (fPhi<0.) 
26       fPhi += 2. * TMath::Pi();
27   }
28 }
29
30 //_________________________________________________________________________________________________
31 AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
32   AliVParticle(), 
33   fPt(pt), 
34   fEta(eta), 
35   fPhi(phi), 
36   fM(m), 
37   fNEF(0), 
38   fArea(0), 
39   fMaxCPt(0), 
40   fMaxNPt(0), 
41   fClusterIDs(), 
42   fTrackIDs()
43 {
44   // Constructor.
45
46  if (fPhi<0.) 
47    fPhi += 2. * TMath::Pi();
48 }
49
50 //_________________________________________________________________________________________________
51 AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
52   AliVParticle(jet),
53   fPt(jet.fPt), 
54   fEta(jet.fEta), 
55   fPhi(jet.fPhi), 
56   fM(jet.fM), 
57   fNEF(jet.fNEF), 
58   fArea(jet.fArea), 
59   fMaxCPt(jet.fMaxCPt), 
60   fMaxNPt(jet.fMaxNPt), 
61   fClusterIDs(jet.fClusterIDs), 
62   fTrackIDs(jet.fTrackIDs)
63 {
64   // Constructor.
65 }
66
67 //_________________________________________________________________________________________________
68 AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
69 {
70   // Assignment operator.
71
72   if (this!=&jet) {
73     AliVParticle::operator=(jet);
74     fPt         = jet.fPt;
75     fEta        = jet.fEta;
76     fPhi        = jet.fPhi;
77     fM          = jet.fM; 
78     fNEF        = jet.fNEF;
79     fArea       = jet.fArea; 
80     fMaxCPt     = jet.fMaxCPt; 
81     fMaxNPt     = jet.fMaxNPt;
82     fClusterIDs = jet.fClusterIDs;
83     fTrackIDs   = jet.fTrackIDs;
84   }
85
86   return *this;
87 }
88
89 //__________________________________________________________________________________________________
90 void AliEmcalJet::GetMom(TLorentzVector &vec) const
91 {
92   // Return momentum as four vector.
93
94   Double_t p = fPt *TMath::CosH(fEta);
95   vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
96 }
97
98 //__________________________________________________________________________________________________
99 void AliEmcalJet::Print(Option_t* /*option*/) const
100 {
101   // Print jet information.
102
103   printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
104 }
105
106 //__________________________________________________________________________________________________
107 void AliEmcalJet::SortConstituents()
108 {
109   // Sort constituent by index (increasing).
110
111   std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
112   std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
113 }