#ifndef HEP_HepMCParticle
#include <HepMCParticle.h>
#endif
#include <iostream>
using namespace std;
#ifndef __CINT__
ClassImp(HepMCParticle);
#endif
HepMCParticle::HepMCParticle() {
fMothers = new TRefArray;
fDaughters = new TRefArray;
fStartVertex = new TRef;
fDecayVertex = new TRef;
}
HepMCParticle::HepMCParticle(Int_t Id, Int_t PdgCode,
Float_t Px, Float_t Py,Float_t Pz,
Float_t E, Int_t MCStatus,
Bool_t IsGenerator,
Bool_t IsGenNonInteracting,
Bool_t IsGenStable,
Bool_t IsGenSimulStable,
Bool_t IsGenInteracting,
Bool_t IsConversion,
Bool_t IsBremsstrahlung ) :
HepParticle(Id, Px, Py, Pz, E, PdgCode),
fMCStatus(MCStatus),
fIsGenerator(IsGenerator),
fIsGenNonInteracting(IsGenNonInteracting),
fIsGenStable(IsGenStable),
fIsGenSimulStable(IsGenSimulStable),
fIsGenInteracting(IsGenInteracting),
fIsConversion(IsConversion),
fIsBremsstrahlung(IsBremsstrahlung) {
fDaughters = new TRefArray;
fMothers = new TRefArray;
fStartVertex = new TRef;
fDecayVertex = new TRef;
}
HepMCParticle::~HepMCParticle() {
delete fDaughters; fDaughters = 0;
delete fMothers; fMothers = 0;
delete fStartVertex; fStartVertex = 0;
delete fDecayVertex; fDecayVertex = 0;
}
void HepMCParticle::Clear(Option_t *option) {
HepParticle::Clear(option);
delete fMothers; fMothers = 0;
delete fDaughters; fDaughters = 0;
delete fStartVertex; fStartVertex = 0;
delete fDecayVertex; fDecayVertex = 0;
fIsGenerator = 0;
fIsGenNonInteracting = 0;
fIsGenStable = 0;
fIsGenSimulStable = 0;
fIsGenInteracting = 0;
fIsConversion = 0;
fIsBremsstrahlung = 0;
}
void HepMCParticle::Print(Option_t *option) {
TString opt = option;
opt.ToLower();
if ( !opt.Contains("nohead") ) PrintHeader();
cout.setf(ios::showpoint | ios::fixed, ios::floatfield);
cout.width(4); cout << fId;
cout.width(12); cout << GetPdgName();
cout.precision(3);
cout.width(12); cout << fP.E();
cout.width(12); cout << fP.P();
cout.width(12); cout << fP.Pt();
cout.width(12); cout << fP.Theta()*180/TMath::Pi();
cout.width(12); cout << fP.Phi()*180/TMath::Pi();
if ( fP.Pt() != 0. ) {
cout.width(12); cout << fP.Eta();
} else {
if ( fP.Pz() > 0. ) {
cout << " infinity";
} else {
cout << " -infinity";
}
}
cout.width(10); cout << fIsGenerator;
cout.width(1); cout << fIsGenInteracting;
cout.width(1); cout << fIsGenNonInteracting;
cout.width(1); cout << fIsGenSimulStable;
cout.width(1); cout << fIsGenStable;
cout << endl;
if ( !opt.Contains("nohead") ) PrintFooter();
}
void HepMCParticle::PrintHeader() {
cout << "---------------------------------------------------------------------------------------------------------" << endl
<< " Id Type E P Pt Theta Phi Eta GINUS " << endl
<< "---------------------------------------------------------------------------------------------------------" << endl;
}
void HepMCParticle::PrintFooter() {
cout << "---------------------------------------------------------------------------------------------------------" << endl;
}
Bool_t HepMCParticle::IsGoodMother(){
if (!fDaughters->GetEntries()) {return kFALSE;}
HepParticle *Daughter;
Daughter=(HepParticle*)fDaughters->At(0);
if ( this->GetPdgCode() == Daughter->GetPdgCode() ) {return kFALSE;}
return kTRUE;
}
Double_t HepMCParticle::GetBremsLoss() {
Double_t Bremsstrahlung=0;
HepMCParticle *Mother;
HepMCParticle *PhotonCandidate;
if ( !fMothers->GetEntries() ) { return 0.;}
Mother=(HepMCParticle*)fMothers->At(0);
while ( Mother->GetPdgCode() == fPdgCode ){
for ( Int_t i=1; i<Mother->GetN_Daughters() ; i++ ){
PhotonCandidate=(HepMCParticle*)Mother->GetDaughters()->At(i);
if ( PhotonCandidate->IsPhoton() ){ Bremsstrahlung+=PhotonCandidate->E(); }
}
if ( Mother->GetN_Mothers() ) { Mother=Mother->GetMother(); }
else { return Bremsstrahlung; }
}
return Bremsstrahlung;
}