3 //___________________________________________________________
4 /////////////////////////////////////////////////////////////
6 // class AliJetParticle
8 // loizides@ikf.uni-frankfurt.de
10 /////////////////////////////////////////////////////////////
12 #include <Riostream.h>
14 #include <TParticle.h>
15 #include "AliJetParticle.h"
17 ClassImp(AliJetParticle)
19 AliJetParticle::AliJetParticle() :
25 AliJetParticle::AliJetParticle(const AliJetParticle& in) :
29 SetMomentum(in.fPx,in.fPy,in.fPz,in.fE);
30 fIdxInEvent=in.fIdxInEvent;
36 AliJetParticle::AliJetParticle(const TParticle* p, Int_t idx, Int_t l, Int_t ncl) :
40 SetMomentum(p->Px(),p->Py(),p->Pz(),p->Energy());
43 fType=(Int_t)p->GetWeight();
47 AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz,
48 Float_t etot, Int_t idx, Int_t l, Int_t ncl) :
52 SetMomentum(px,py,pz,etot);
58 AliJetParticle::AliJetParticle(Float_t px, Float_t py, Float_t pz,
59 Float_t etot, Int_t idx, Int_t l, Int_t ncl,
60 Float_t pt, Float_t phi, Float_t eta) :
62 fPx(px),fPy(py),fPz(pz),
63 fE(etot),fIdxInEvent(idx),
64 fType(0),fLabel(l),fNhits(ncl),
65 fPt(pt),fEta(eta),fPhi(phi)
69 TParticle* AliJetParticle::Particle() const
71 TParticle *ret=new TParticle(0,0,0,0,0,0,fPx,fPy,fPz,fE,0,0,0,0);
72 ret->SetWeight(fType);
76 void AliJetParticle::Calculate()
78 //calculate values from px, py, pz
79 //which are frequently needed
81 fPt=TMath::Sqrt(fPx*fPx+fPy*fPy);
83 fEta=0.5*TMath::Log((kp+fPz+1e-30)/(kp-fPz+1e-30));
84 fPhi=TMath::Pi()+TMath::ATan2(-fPy,-fPx);
87 void AliJetParticle::Clear(Option_t* /*t*/)
102 void AliJetParticle::Print(Option_t* /*t*/) const
104 cout << fPt << " " << fEta << " " << fPhi << endl;
107 Int_t AliJetParticle::Compare(const TObject *obj) const
109 Double_t val=((AliJetParticle*)obj)->Pt();
111 if(fPt>val) return 1;
112 else if (fPt<val) return -1;