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