1 #include "StarGenerator.h"
6 #include "StarGenerator/EVENT/StarGenParticle.h"
14 StarGenerator::StarGenerator(
const Char_t *name )
15 :
StMaker(name), mm(0.1), cm(1.0),
17 mNumberOfParticles(0),
26 mBlueMomentum(0,0,+255,255.0),
27 mYellMomentum(0,0,-255,255.0),
40 for ( Int_t i=0;i<4;i++ ) { mBlueMomentum[i]=0;
91 Error(
GetName(),
"This method only applies to CMS and FIXT frames");
103 if ( !
mFrame.Contains(
"MOM") )
105 Error(
GetName(),
"This method only applies to 3MOM, 4MOM or 5MOM frames");
109 Int_t n=3;
if (
mFrame==
"4MOM" ) n=4;
110 for ( Int_t i=0;i<n;i++ ) {
119 cout <<
"== SetFrame == " << endl;
142 TString bclass =
mEvent->IsA()->GetName();
151 void StarGenerator::SetInputFile(
const Char_t *filename,
const Char_t *treename,
const Char_t *branchname )
153 TFile *file = TFile::Open( filename,
"read" );
156 LOG_WARN <<
"-- WARNING: root event file " << filename <<
" not found." << endm;
159 TTree *tree = (TTree *)file->Get(treename);
162 LOG_WARN <<
"-- WARNING: tree "<< treename<<
" not found in " << filename << endm;
175 TString bname =
mEvent->GetName();
185 LOG_INFO <<
"Input Tree with " << tree -> GetEntries() <<
" loaded" << endm;
191 Int_t StarGenerator::PreGenerateHook()
205 Int_t mother1 = 0, kid1 = -1, mother2 = 0, kid2 = -1;
213 mother1 = blue->PdgCode();
222 mother2 = yell->PdgCode();
249 mEvent -> AddParticle( status, pdgid, mother1, mother2, kid1, kid2, px, py, pz, E, M, vx, vy, vz, tof );
264 Int_t StarGenerator::PostGenerateHook()
271 (*mEvent)[0]->SetLastDaughter( kid2 );
Double_t mRootS
CMS energy or incident beam momentum for fixed target collisions.
void SetOutputTree(TTree *tree)
TString mYell
Name of the yellow beam particle (-z)
void SetFrame(const Char_t *frame, const Double_t val)
TLorentzVector mYellMomentum
4-Momentum of the yellow beam
Int_t mIOMode
IO flag. 0=no IO, 1=write, 2=read.
ABC for defining event generator interfaces.
void Clear(const Option_t *opts="")
Clear the event.
void SetInputTree(TTree *tree, const Char_t *bname=0)
StarGenEvent * mEvent
Generated event.
virtual void Clear(const Option_t *opts="part,data")
Clear the event.
static StarParticleData & instance()
Returns a reference to the single instance of this class.
TTree * mOutputTree
Pointer to the tree for writing out events.
void SetBlue(const Char_t *b)
Sets the particle species for the blue beam.
Double_t mDirect
Direction (+1 = W, -1 = E) of the beam in fixted target mode.
Int_t GetNumberOfParticles()
Returns the number of particles in the event.
TLorentzVector mBlueMomentum
4-Momentum of the blue beam
virtual Int_t PostGenerate()
Developers may provide a post-generate method which will execute after Generate().
TTree * mInputTree
Pointer to the tree for reading in events.
virtual const char * GetName() const
special overload
Double_t mBlueMass
Mass of the blue beam.
void SetYell(const Char_t *y)
Sets the particle species for the yellow beam.
Double_t mYellMass
Mass of the yellow beam.
StarParticleData * mParticleDb
Database for particle information (based on TDatabasePDG)
TString mFrame
Frame of the collision, i.e. CMS, FIXT, 3MOM, 4MOM, 5MOM.
TString mBlue
Name of the blue beam particle (+z)
virtual Int_t PreGenerate()
Developers may provide a pre-generate method which will execute before Generate().