#include #include #include #include #include #include #include "Event.h" ClassImp(Particle) ClassImp(Event) TClonesArray *Event::fgParticles = 0; using namespace std; // Particle Particle::Particle() { fType = ""; fPDGid = 0; for(int i=0; i<3; i++){ fColor_Charge[i] = 0; } fEnergy_Momentum = NULL; } Particle::Particle(Int_t EPArraySize, ifstream &in, string inType, Double_t &fPbhMass) : TObject() { if(inType == "Pbh"){ PbhBuild(EPArraySize, in, fPbhMass); }else if(inType == "Parent"){ ParentBuild(in); }else if(inType == "Pem"){ PemBuild(EPArraySize, in); }else if(inType == "Elast"){ ElastBuild(in); } } Particle::~Particle(){ delete [] fEnergy_Momentum; fEnergy_Momentum=0; printf(" Particle REPORT: Class Destructor Called\n"); } void Particle::ParentBuild(ifstream & in) { fEPArraySize = 4; fEnergy_Momentum = new Double_t[fEPArraySize]; fType = "Parent"; in >> fPDGid; for(int i=0; i<3; i++){ in >> fColor_Charge[i]; } for(int i=0; i> fEnergy_Momentum[i]; } } void Particle::PbhBuild(Int_t EPArraySize, ifstream & in, Double_t & fPbhMass) { fEPArraySize = EPArraySize+1; fEnergy_Momentum = new Double_t[fEPArraySize]; fType = "Pbh"; in >> fPDGid; for(int i=0; i<3; i++){ in >> fColor_Charge[i]; } for(int i=0; i> fEnergy_Momentum[i]; if(i==0){ fPbhMass = fEnergy_Momentum[i]*fEnergy_Momentum[i]; }else{ fPbhMass-= fEnergy_Momentum[i]*fEnergy_Momentum[i]; } } cout << " Particle REPORT: Event Black Hole Mass^2:" << fPbhMass << endl; fPbhMass = sqrt(fPbhMass); cout << " Particle REPORT: Event Black Hole Mass :" << fPbhMass << endl; } void Particle::PemBuild(Int_t EPArraySize, ifstream & in) { fEPArraySize = EPArraySize; fEnergy_Momentum = new Double_t[fEPArraySize]; fType = "Pem"; in >> fPDGid; for(int i=0; i<3; i++){ in >> fColor_Charge[i]; } cout << " Particle REPORT: Pem, fEnergy_Momentum ="; for(int i=0; i> fEnergy_Momentum[i]; cout << " " << fEnergy_Momentum[i]; } cout << endl; } void Particle::ElastBuild(ifstream & in) { fEPArraySize = 4; fEnergy_Momentum = new Double_t[fEPArraySize]; fType = "Elast"; in >> fPDGid; for(int i=0; i<3; i++){ in >> fColor_Charge[i]; } cout << " Particle REPORT: Elast, fEnergy_Momentum ="; for(int i=0; i> fEnergy_Momentum[i]; cout << " " << fEnergy_Momentum[i]; } cout << endl; } /////////////////////////////////////////////////////////////////////////////////*/ // Event Event::Event() { fEvent_Number = 0; fNumber_Particles = 0; if (!fgParticles) fgParticles = new TClonesArray("Particle", 1000); fParticle = fgParticles; } Event::~Event(){ printf(" Event REPORT: Class Destructor Called\n"); } void Event::Build(Int_t EPArraySize, TTree *tree, ifstream & in) { cout << " \n******************************************************************************\n"; cout << " Event REPORT: Event.Build(Int_t EPArraySize, TTree *tree, ifstream & in) Initiated, Event #"; string inType; in >> inType; Int_t inEvntNmbr; in >> inEvntNmbr; Int_t oldEvntNmbr = inEvntNmbr; Particle *particle = 0; cout << inEvntNmbr << endl; while(oldEvntNmbr==inEvntNmbr && in.good()){ TClonesArray &particles = *fParticle; // &particles is the list of all particles in "THIS" event particle = new(particles[fNumber_Particles++]) Particle(EPArraySize, in, inType, fPbhMass); in >> inType; in >> inEvntNmbr; } fEvent_Number = oldEvntNmbr; for(int i=0; i<14; i++){in.unget();} cout << " Event REPORT: Event contains the folowing number of particles:" << fNumber_Particles << endl; cout << " Event REPORT: Event.Build(Int_t EPArraySize, TTree *tree, ifstream & in) Finished" << endl; }