// ------------------------------------------------------------------------- // ----- TpcAsciiGiBUUGenerator header file ----- // ----- Created 03/04/12 by S. Doerheim ----- // ------------------------------------------------------------------------- /** TpcAsciiGiBUUGenerator.h *@author V.Friese *@author D.Bertini *@author M.Al-Turany *@author S. Dorheim The TpcAsciiGiBUUGenerator 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_ASCIIGENERATOR_H #define TPC_GIBUU_ASCIIGENERATOR_H #include "FairGenerator.h" #include class TDatabasePDG; class FairPrimaryGenerator; class TVector3; class TpcAsciiGiBUUGenerator : public FairGenerator { public: /** Default constructor without arguments should not be used. **/ TpcAsciiGiBUUGenerator(); /** Standard constructor. ** @param fileName The input file name **/ TpcAsciiGiBUUGenerator(const char* fileName); /** Sets line in file to start reading events ** @param eventNbr **/ bool SetStartEvent(unsigned int eventNbr); /** Destructor. **/ virtual ~TpcAsciiGiBUUGenerator(); /**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; } void SetZOffset(double zoff=0){fzoff=zoff;} private: ifstream* fInputFile; //! Input file stream 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; double fzoff; 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; int evNbFile; TpcAsciiGiBUUGenerator(const TpcAsciiGiBUUGenerator&); TpcAsciiGiBUUGenerator& operator=(const TpcAsciiGiBUUGenerator&); 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 */ TDatabasePDG *fPDG; //! ClassDef(TpcAsciiGiBUUGenerator,1); }; #endif