]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALJetTasks/AliEmcalJet.cxx
Compute jet area in emcal from ghost particles. Introduce handy getters for IsInsideE...
[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(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   fAreaEmc(-1), 
21   fAxisInEmcal(0),
22   fMaxCPt(0), 
23   fMaxNPt(0), 
24   fClusterIDs(), 
25   fTrackIDs()
26 {    
27   // Constructor.
28
29   if (fPt != 0) {
30     fPhi = TMath::ATan2(py, px);
31     if (fPhi<0.) 
32       fPhi += 2. * TMath::Pi();
33   }
34 }
35
36 //_________________________________________________________________________________________________
37 AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
38   AliVParticle(), 
39   fPt(pt), 
40   fEta(eta), 
41   fPhi(phi), 
42   fM(m), 
43   fNEF(0), 
44   fArea(0), 
45   fAreaEmc(-1), 
46   fAxisInEmcal(0),
47   fMaxCPt(0), 
48   fMaxNPt(0), 
49   fClusterIDs(), 
50   fTrackIDs()
51 {
52   // Constructor.
53
54  if (fPhi<0.) 
55    fPhi += TMath::TwoPi();
56 }
57
58 //_________________________________________________________________________________________________
59 AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
60   AliVParticle(jet),
61   fPt(jet.fPt), 
62   fEta(jet.fEta), 
63   fPhi(jet.fPhi), 
64   fM(jet.fM), 
65   fNEF(jet.fNEF), 
66   fArea(jet.fArea), 
67   fAreaEmc(jet.fAreaEmc), 
68   fAxisInEmcal(jet.fAxisInEmcal),
69   fMaxCPt(jet.fMaxCPt), 
70   fMaxNPt(jet.fMaxNPt), 
71   fClusterIDs(jet.fClusterIDs), 
72   fTrackIDs(jet.fTrackIDs)
73 {
74   // Copy constructor.
75 }
76
77 //_________________________________________________________________________________________________
78 AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
79 {
80   // Assignment operator.
81
82   if (this!=&jet) {
83     AliVParticle::operator=(jet);
84     fPt           = jet.fPt;
85     fEta          = jet.fEta;
86     fPhi          = jet.fPhi;
87     fM            = jet.fM; 
88     fNEF          = jet.fNEF;
89     fArea         = jet.fArea; 
90     fAreaEmc      = jet.fAreaEmc; 
91     fAxisInEmcal  = jet.fAxisInEmcal; 
92     fMaxCPt       = jet.fMaxCPt; 
93     fMaxNPt       = jet.fMaxNPt;
94     fClusterIDs   = jet.fClusterIDs;
95     fTrackIDs     = jet.fTrackIDs;
96   }
97
98   return *this;
99 }
100
101 //__________________________________________________________________________________________________
102 void AliEmcalJet::GetMom(TLorentzVector &vec) const
103 {
104   // Return momentum as four vector.
105
106   Double_t p = fPt *TMath::CosH(fEta);
107   vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM));
108 }
109
110 //__________________________________________________________________________________________________
111 void AliEmcalJet::Print(Option_t* /*option*/) const
112 {
113   // Print jet information.
114
115   printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
116 }
117
118 //__________________________________________________________________________________________________
119 void AliEmcalJet::SortConstituents()
120 {
121   // Sort constituent by index (increasing).
122
123   std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize());
124   std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
125 }