Added type which is not used yet, but will be for mixed events.
[u/mrichter/AliRoot.git] / JETAN / AliJetParticle.cxx
CommitLineData
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
17ClassImp(AliJetParticle)
18
19AliJetParticle::AliJetParticle() :
20 TObject()
21{
22 Clear();
23}
24
25AliJetParticle::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;
317552c8 31 fType=in.fType;
d7c6ab14 32}
33
34AliJetParticle::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;
317552c8 40 fType=0;
d7c6ab14 41}
42
43AliJetParticle::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;
317552c8 50 fType=0;
d7c6ab14 51}
52
53AliJetParticle::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),
317552c8 58 fE(etot),fIdxInEvent(idx),
59 fType(0),fLabel(l),
d7c6ab14 60 fPt(pt),fEta(eta),fPhi(phi)
61{
62
63}
64
65void 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
76void AliJetParticle::Clear(Option_t* /*t*/)
77{
317552c8 78 fType=0;
d7c6ab14 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
90void AliJetParticle::Print(Option_t* /*t*/) const
91{
92 cout << fPt << " " << fEta << " " << fPhi << endl;
93}
94
f83e88f6 95Int_t AliJetParticle::Compare(const TObject *obj) const
d7c6ab14 96{
f83e88f6 97 Double_t val=((AliJetParticle*)obj)->Pt();
d7c6ab14 98
f83e88f6 99 if(fPt>val) return 1;
100 else if (fPt<val) return -1;
101 else return 0;
d7c6ab14 102}