]>
Commit | Line | Data |
---|---|---|
d7c6ab14 | 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 | { | |
301a24f1 | 28 | Clear(); |
d7c6ab14 | 29 | SetMomentum(in.fPx,in.fPy,in.fPz,in.fE); |
30 | fIdxInEvent=in.fIdxInEvent; | |
31 | fLabel=in.fLabel; | |
317552c8 | 32 | fType=in.fType; |
301a24f1 | 33 | fNhits=in.fNhits; |
d7c6ab14 | 34 | } |
35 | ||
301a24f1 | 36 | AliJetParticle::AliJetParticle(const TParticle* p, Int_t idx, Int_t l, Int_t ncl) : |
d7c6ab14 | 37 | TObject() |
38 | { | |
301a24f1 | 39 | Clear(); |
d7c6ab14 | 40 | SetMomentum(p->Px(),p->Py(),p->Pz(),p->Energy()); |
41 | fIdxInEvent=idx; | |
42 | fLabel=l; | |
301a24f1 | 43 | fType=(Int_t)p->GetWeight(); |
44 | fNhits=ncl; | |
d7c6ab14 | 45 | } |
46 | ||
47 | AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz, | |
301a24f1 | 48 | Float_t etot, Int_t idx, Int_t l, Int_t ncl) : |
d7c6ab14 | 49 | TObject() |
50 | { | |
301a24f1 | 51 | Clear(); |
d7c6ab14 | 52 | SetMomentum(px,py,pz,etot); |
53 | fIdxInEvent=idx; | |
54 | fLabel=l; | |
301a24f1 | 55 | fNhits=ncl; |
d7c6ab14 | 56 | } |
57 | ||
58 | AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz, | |
301a24f1 | 59 | Float_t etot, Int_t idx, Int_t l, Int_t ncl, |
d7c6ab14 | 60 | Float_t pt, Float_t phi, Float_t eta) : |
61 | TObject(), | |
62 | fPx(px),fPy(py),fPz(pz), | |
317552c8 | 63 | fE(etot),fIdxInEvent(idx), |
301a24f1 | 64 | fType(0),fLabel(l),fNhits(ncl), |
d7c6ab14 | 65 | fPt(pt),fEta(eta),fPhi(phi) |
66 | { | |
301a24f1 | 67 | } |
d7c6ab14 | 68 | |
301a24f1 | 69 | TParticle* AliJetParticle::Particle() const |
70 | { | |
71 | TParticle *ret=new TParticle(0,0,0,0,0,0,fPx,fPy,fPz,fE,0,0,0,0); | |
72 | ret->SetWeight(fType); | |
73 | return ret; | |
d7c6ab14 | 74 | } |
75 | ||
76 | void AliJetParticle::Calculate() | |
77 | { | |
78 | //calculate values from px, py, pz | |
79 | //which are frequently needed | |
80 | ||
81 | fPt=TMath::Sqrt(fPx*fPx+fPy*fPy); | |
82 | const Float_t kp=P(); | |
83 | fEta=0.5*TMath::Log((kp+fPz+1e-30)/(kp-fPz+1e-30)); | |
84 | fPhi=TMath::Pi()+TMath::ATan2(-fPy,-fPx); | |
85 | } | |
86 | ||
87 | void AliJetParticle::Clear(Option_t* /*t*/) | |
88 | { | |
89 | fPx=0.; | |
90 | fPy=0.; | |
91 | fPz=0.; | |
92 | fE=0.; | |
93 | fIdxInEvent=0; | |
301a24f1 | 94 | fType=0; |
d7c6ab14 | 95 | fLabel=0; |
301a24f1 | 96 | fNhits=0; |
d7c6ab14 | 97 | fPt=0.; |
98 | fEta=0.; | |
99 | fPhi=0.; | |
100 | } | |
101 | ||
102 | void AliJetParticle::Print(Option_t* /*t*/) const | |
103 | { | |
104 | cout << fPt << " " << fEta << " " << fPhi << endl; | |
105 | } | |
106 | ||
f83e88f6 | 107 | Int_t AliJetParticle::Compare(const TObject *obj) const |
d7c6ab14 | 108 | { |
f83e88f6 | 109 | Double_t val=((AliJetParticle*)obj)->Pt(); |
d7c6ab14 | 110 | |
f83e88f6 | 111 | if(fPt>val) return 1; |
112 | else if (fPt<val) return -1; | |
113 | else return 0; | |
d7c6ab14 | 114 | } |