//----------------------------------------------------------------------------- // TGenParticle: STNTUPLE description of the generator-level MC particle // It inherits from ROOT's TParticle and adds more functions to it // particle number in the original list is saved in TObject::fUniqueID // Nov 25 2000 P.Murat (CDF/FNAL) //----------------------------------------------------------------------------- #ifdef __GNUG__ #pragma implementation #endif #ifdef CDF1 #include "run1cpp/bnk/GenpParticle.hh" #endif #include "Stntuple/obj/TGenParticle.hh" ClassImp(TGenParticle) //_____________________________________________________________________________ TGenParticle::TGenParticle() { SetUniqueID(UINT_MAX); } //_____________________________________________________________________________ TGenParticle::TGenParticle(GENP_PARTICLE* mc) { } //_____________________________________________________________________________ TGenParticle::TGenParticle(Int_t ip, Int_t idhep, Int_t istdhep, Int_t jm1, Int_t jm2, Int_t jd1, Int_t jd2, Float_t px, Float_t py, Float_t pz, Float_t e, Float_t vx, Float_t vy, Float_t vz, Float_t t) : TParticle(idhep,istdhep,jm1,jm2,jd1,jd2,px,py,pz,e,vx,vy,vz,t) { SetUniqueID(ip); } //_____________________________________________________________________________ TGenParticle::TGenParticle(Int_t ip, const TParticle* p): TParticle(*p) { SetUniqueID(ip); fMother [0] -= 1; fMother [1] -= 1; fDaughter[0] -= 1; fDaughter[1] -= 1; } //_____________________________________________________________________________ Int_t TGenParticle::Init(Int_t ip, Int_t idhep, Int_t istdhep, Int_t jm1, Int_t jm2, Int_t jd1, Int_t jd2, Float_t px, Float_t py, Float_t pz, Float_t e, Float_t vx, Float_t vy, Float_t vz, Float_t t) { SetUniqueID(ip); fPdgCode = idhep; fStatusCode = istdhep; fMother[0] = jm1; fMother[1] = jm2; fDaughter[0] = jd1; fDaughter[1] = jd2; fWeight = 1.; fParticlePDG = TDatabasePDG::Instance()->GetParticle(idhep); fPx = px; fPy = py; fPz = pz; fE = e; fVx = vx; fVy = vy; fVz = vz; fVt = t; fPolarTheta = 0; fPolarPhi = 0; if (fParticlePDG) { fCalcMass = fParticlePDG->Mass(); } else { Double_t a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz; if (a2 >= 0) fCalcMass = TMath::Sqrt(a2); else fCalcMass = -TMath::Sqrt(-a2); } return 0; } //_____________________________________________________________________________ Int_t TGenParticle::Init(Int_t Ip, const TParticle* P) { SetUniqueID(Ip); fPdgCode = P->GetPdgCode(); fStatusCode = P->GetStatusCode(); fMother[0] = P->GetMother (0)-1; fMother[1] = P->GetMother (1)-1; fDaughter[0] = P->GetDaughter(0)-1; fDaughter[1] = P->GetDaughter(1)-1; fWeight = 1.; fPx = P->Px(); fPy = P->Py(); fPz = P->Pz(); fE = P->Energy(); fVx = P->Vx(); fVy = P->Vy(); fVz = P->Vz(); fVt = P->T(); fPolarTheta = 0; fPolarPhi = 0; fParticlePDG = TDatabasePDG::Instance()->GetParticle(fPdgCode); if (fParticlePDG) { fCalcMass = fParticlePDG->Mass(); } else { Double_t a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz; if (a2 >= 0) fCalcMass = TMath::Sqrt(a2); else fCalcMass = -TMath::Sqrt(-a2); } return 0; } //_____________________________________________________________________________ TGenParticle::~TGenParticle() { } //_____________________________________________________________________________ void TGenParticle::Print(Option_t* Opt) const { TString opt = Opt; if ((opt == "banner") || (opt == "")) { // print banner printf(" i name PDG isthep im1 im2 id1 id2 px"); printf(" py pz e vx vy vz t\n"); } TDatabasePDG* db = TDatabasePDG::Instance(); TParticlePDG* pdg = ((TParticle*)this)->GetPDG(); if ((opt == "data") || (opt == "")) { printf("%4i",Number()); if (pdg) printf(" %-19s",pdg->GetName()); else printf(" %-19s","*** unknown ***"); printf("%7i",GetPdgCode()); printf("%6i",GetStatusCode()); printf(" "); printf("%5i",GetMother(0)); printf("%5i",GetMother(1)); printf("%5i",GetDaughter(0)); printf("%5i",GetDaughter(1)); printf("%9.3f",Px()); printf("%9.3f",Py()); printf("%9.3f",Pz()); printf("%9.3f",Energy()); printf("%9.3f",Vx()); printf("%9.3f",Vy()); printf("%9.3f",Vz()); printf("%9.3f",T ()); printf("\n"); } }