]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALJetTasks/AliEmcalJet.cxx
coverty
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / AliEmcalJet.cxx
1 // $Id$
2 //
3 // Emcal jet class.
4 //
5 // Author: C.Loizides
6
7 #include "AliEmcalJet.h"
8
9 ClassImp(AliEmcalJet)
10
11 //__________________________________________________________________________________________________
12 AliEmcalJet::AliEmcalJet() : 
13   AliVParticle(), 
14   fPt(0), 
15   fEta(0), 
16   fPhi(0), 
17   fM(0), 
18   fNEF(0),
19   fArea(0),       
20   fAreaEmc(-1), 
21   fAxisInEmcal(0), 
22   fMaxCPt(0), 
23   fMaxNPt(0), 
24   fMCPt(0),
25   fNn(0), 
26   fNch(0),        
27   fClusterIDs(),
28   fTrackIDs(),
29   fMatched(2) 
30 {
31   // Constructor.
32
33   fClosestJets[0] = 0;
34   fClosestJets[1] = 0; 
35   fClosestJetsDist[0] = 999; 
36   fClosestJetsDist[1] = 999; 
37 }
38
39 //__________________________________________________________________________________________________
40 AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) : 
41   AliVParticle(), 
42   fPt(TMath::Sqrt(px*px+py*py)), 
43   fEta(TMath::ASinH(pz/fPt)),
44   fPhi(0), 
45   fM(0), 
46   fNEF(0), 
47   fArea(0), 
48   fAreaEmc(-1), 
49   fAxisInEmcal(0),
50   fMaxCPt(0), 
51   fMaxNPt(0), 
52   fMCPt(0),
53   fNn(0),
54   fNch(0),
55   fClusterIDs(), 
56   fTrackIDs(),
57   fMatched(2)
58 {    
59   // Constructor.
60
61   if (fPt != 0) {
62     fPhi = TMath::ATan2(py, px);
63     if (fPhi<0.) 
64       fPhi += 2. * TMath::Pi();
65   }
66
67   fClosestJets[0] = 0; 
68   fClosestJets[1] = 0;
69   fClosestJetsDist[0] = 999; 
70   fClosestJetsDist[1] = 999;
71 }
72
73 //_________________________________________________________________________________________________
74 AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
75   AliVParticle(), 
76   fPt(pt), 
77   fEta(eta), 
78   fPhi(phi), 
79   fM(m), 
80   fNEF(0), 
81   fArea(0), 
82   fAreaEmc(-1), 
83   fAxisInEmcal(0),
84   fMaxCPt(0), 
85   fMaxNPt(0),
86   fMCPt(0),
87   fNn(0),
88   fNch(0), 
89   fClusterIDs(), 
90   fTrackIDs(),
91   fMatched(2)
92 {
93   // Constructor.
94
95   if (fPhi<0.) 
96     fPhi += TMath::TwoPi();
97
98   fClosestJets[0] = 0; 
99   fClosestJets[1] = 0;
100   fClosestJetsDist[0] = 999; 
101   fClosestJetsDist[1] = 999;
102 }
103
104 //_________________________________________________________________________________________________
105 AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
106   AliVParticle(jet),
107   fPt(jet.fPt), 
108   fEta(jet.fEta), 
109   fPhi(jet.fPhi), 
110   fM(jet.fM), 
111   fNEF(jet.fNEF), 
112   fArea(jet.fArea), 
113   fAreaEmc(jet.fAreaEmc), 
114   fAxisInEmcal(jet.fAxisInEmcal),
115   fMaxCPt(jet.fMaxCPt), 
116   fMaxNPt(jet.fMaxNPt), 
117   fMCPt(jet.fMCPt),
118   fNn(jet.fNn),
119   fNch(jet.fNch),
120   fClusterIDs(jet.fClusterIDs), 
121   fTrackIDs(jet.fTrackIDs),
122   fMatched(jet.fMatched) 
123 {
124   // Copy constructor.
125
126   fClosestJets[0]     = jet.fClosestJets[0]; 
127   fClosestJets[1]     = jet.fClosestJets[1]; 
128   fClosestJetsDist[0] = jet.fClosestJetsDist[0];  
129   fClosestJetsDist[1] = jet.fClosestJetsDist[1]; 
130 }
131
132 //_________________________________________________________________________________________________
133 AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
134 {
135   // Assignment operator.
136
137   if (this!=&jet) {
138     AliVParticle::operator=(jet);
139     fPt                 = jet.fPt;
140     fEta                = jet.fEta;
141     fPhi                = jet.fPhi;
142     fM                  = jet.fM; 
143     fNEF                = jet.fNEF;
144     fArea               = jet.fArea; 
145     fAreaEmc            = jet.fAreaEmc; 
146     fAxisInEmcal        = jet.fAxisInEmcal; 
147     fMaxCPt             = jet.fMaxCPt; 
148     fMaxNPt             = jet.fMaxNPt;
149     fMCPt               = jet.fMCPt;
150     fNn                 = jet.fNn;
151     fNch                = jet.fNch;
152     fClusterIDs         = jet.fClusterIDs;
153     fTrackIDs           = jet.fTrackIDs;
154     fClosestJets[0]     = jet.fClosestJets[0]; 
155     fClosestJets[1]     = jet.fClosestJets[1]; 
156     fClosestJetsDist[0] = jet.fClosestJetsDist[0];  
157     fClosestJetsDist[1] = jet.fClosestJetsDist[1]; 
158     fMatched            = jet.fMatched;
159   }
160
161   return *this;
162 }
163
164 //__________________________________________________________________________________________________
165 void AliEmcalJet::GetMom(TLorentzVector &vec) const
166 {
167   // Return momentum as four vector.
168
169   Double_t p = fPt *TMath::CosH(fEta);
170   vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
171 }
172
173 //__________________________________________________________________________________________________
174 void AliEmcalJet::Print(Option_t* /*option*/) const
175 {
176   // Print jet information.
177
178   printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
179 }
180
181 //__________________________________________________________________________________________________
182 void AliEmcalJet::SortConstituents()
183 {
184   // Sort constituent by index (increasing).
185
186   std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
187   std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
188 }