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