]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliJetParticle.cxx
Added Hijing vars.
[u/mrichter/AliRoot.git] / JETAN / AliJetParticle.cxx
1 // $Id$
2
3 //___________________________________________________________
4 /////////////////////////////////////////////////////////////
5 //
6 // class AliJetParticle
7 //
8 // loizides@ikf.uni-frankfurt.de
9 //
10 /////////////////////////////////////////////////////////////
11
12 #include <Riostream.h>
13 #include <TMath.h>
14 #include <TParticle.h>
15 #include "AliJetParticle.h"
16
17 ClassImp(AliJetParticle)
18
19 AliJetParticle::AliJetParticle() : 
20   TObject()    
21 {
22   Clear();
23 }
24
25 AliJetParticle::AliJetParticle(const AliJetParticle& in) :
26   TObject(in)
27 {
28   SetMomentum(in.fPx,in.fPy,in.fPz,in.fE);
29   fIdxInEvent=in.fIdxInEvent;
30   fLabel=in.fLabel;
31   fType=in.fType;
32 }
33  
34 AliJetParticle::AliJetParticle(const TParticle* p, Int_t idx, Int_t l) :
35   TObject()
36 {
37   SetMomentum(p->Px(),p->Py(),p->Pz(),p->Energy());
38   fIdxInEvent=idx;
39   fLabel=l;
40   fType=0;
41 }
42
43 AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz, 
44                                Float_t etot, Int_t idx, Int_t l) :
45   TObject()
46 {
47   SetMomentum(px,py,pz,etot);
48   fIdxInEvent=idx;
49   fLabel=l;
50   fType=0;
51 }
52
53 AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz, 
54                                Float_t etot, Int_t idx, Int_t l,
55                                Float_t pt, Float_t phi, Float_t eta) :
56   TObject(),
57   fPx(px),fPy(py),fPz(pz),
58   fE(etot),fIdxInEvent(idx),
59   fType(0),fLabel(l),
60   fPt(pt),fEta(eta),fPhi(phi)
61 {
62
63 }
64
65 void AliJetParticle::Calculate()
66 {
67   //calculate values from px, py, pz
68   //which are frequently needed
69
70   fPt=TMath::Sqrt(fPx*fPx+fPy*fPy);
71   const Float_t kp=P();
72   fEta=0.5*TMath::Log((kp+fPz+1e-30)/(kp-fPz+1e-30)); 
73   fPhi=TMath::Pi()+TMath::ATan2(-fPy,-fPx);
74 }
75
76 void AliJetParticle::Clear(Option_t* /*t*/)
77 {
78   fType=0;
79   fPx=0.;
80   fPy=0.;
81   fPz=0.;
82   fE=0.;
83   fIdxInEvent=0;
84   fLabel=0;
85   fPt=0.;
86   fEta=0.;
87   fPhi=0.;
88 }
89
90 void AliJetParticle::Print(Option_t* /*t*/) const
91 {
92   cout << fPt << " " << fEta << " " << fPhi << endl;
93 }
94
95 Int_t AliJetParticle::Compare(const TObject *obj) const
96 {
97   Double_t val=((AliJetParticle*)obj)->Pt();
98
99   if(fPt>val) return 1;
100   else if (fPt<val) return -1;
101   else return 0;
102 }