// ------------------------------------------------------------------------- // ----- TpcRootGiBUUGenerator header file ----- // ----- Created 03/04/12 by S. Doerheim ----- // ------------------------------------------------------------------------- /** TpcRootGiBUUGenerator.h *@author V.Friese *@author D.Bertini *@author M.Al-Turany *@author S. Dorheim The TpcRootGiBUUGenerator is adapted from the FairAsciiGenerator to read ascii files generated from the GiBUU event generator. The format of the files are as follows: NTRACKS UNUSED WEIGHT UNUSED UNUSED UNUSED PDGCODE PX PY PZ E Mass Momentum in GeV/c, Mass GeV/c^2, Energy in GeV Derived from FairGenerator. **/ #ifndef TPC_GIBUU_ROOTGENERATOR_H #define TPC_GIBUU_ROOTGENERATOR_H #include "FairGenerator.h" #include #include #include class TDatabasePDG; class FairPrimaryGenerator; class TVector3; class TpcRootGiBUUGenerator : public FairGenerator { public: /** Default constructor without arguments should not be used. **/ TpcRootGiBUUGenerator(); /** Standard constructor. ** @param fileName The input file name **/ TpcRootGiBUUGenerator(const char* fileName); /** Sets line in file to start reading events ** @param eventNbr **/ bool SetStartEvent(unsigned int eventNbr); /** Destructor. **/ virtual ~TpcRootGiBUUGenerator(); /**Only write events which contain a particle **with type pdgID **/ void ParticleFilter(int pdgID){ filter_on_PDG=true; pdgToFilter=pdgID; } /** Reads on event from the input file and pushes the tracks onto ** the stack. Abstract method in base class. ** @param primGen pointer to the FairPrimaryGenerator **/ virtual Bool_t ReadEvent(FairPrimaryGenerator* primGen); void SetTargetThickness(double thickness){ targetThickness=thickness; } void SetVetoRadius(double radius){ vetoR=radius; } private: TFile* fInputFile; //! Input file stream TTree* fInputTree; const Char_t* fFileName; //! Input file Name double vetoR; //assumes circular veto detector, alowing for a hole of radius R around the z-axis double targetThickness; bool filter_on_PDG; int pdgToFilter; /** Private method CloseInput. Just for convenience. Closes the ** input file properly. Called from destructor and from ReadEvent. **/ void CloseInput(); int evNb; //general EvNb (used for event filtering) int evNbFile; //line number in tree int realEvNbFile; //Actual eventnumber TpcRootGiBUUGenerator(const TpcRootGiBUUGenerator&); TpcRootGiBUUGenerator& operator=(const TpcRootGiBUUGenerator&); void GenerateVertex(double& vx,double& vy,double& vz); Bool_t ReadFileEvent(std::vector &mom, std::vector &pdgs, std::vector &energies, Bool_t &found); /** PDG data base */ float Evt, Mul, Pid, Px, Py, Pz, E, M; TDatabasePDG *fPDG; //! ClassDef(TpcRootGiBUUGenerator,1); }; #endif