CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HepMCFileReader.h
Go to the documentation of this file.
1 #ifndef Input_HepMCFileReader_h
2 #define Input_HepMCFileReader_h
3 
16 #include <vector>
17 #include <map>
18 
20 
21 namespace HepMC {
22  class IO_BaseClass;
23  class GenEvent;
24  class GenParticle;
25 } // namespace HepMC
26 
28 protected:
30 
31 public:
32  virtual ~HepMCFileReader();
33  virtual void initialize(const std::string &filename);
34  inline bool isInitialized() const;
35 
36  virtual bool setEvent(int event);
37  virtual bool readCurrentEvent();
38  virtual bool printHepMcEvent() const;
40  // virtual bool fillEventData(HepMC::GenEvent *event);
41  // this method prints the event information as
42  // obtained by the input file in HepEvt style
43  void printEvent() const;
44  // get all the 'integer' properties of a particle
45  // like mother, daughter, pid and status
46  // 'j' is the number of the particle in the HepMc
47  virtual void getStatsFromTuple(int &mo1, int &mo2, int &da1, int &da2, int &status, int &pid, int j) const;
48  virtual void ReadStats();
49 
50  static HepMCFileReader *instance();
51 
52 private:
53  HepMC::IO_BaseClass const *input() const { return get_underlying_safe(input_); }
54  HepMC::IO_BaseClass *&input() { return get_underlying_safe(input_); }
55 
56  // current HepMC evt
59 
61 
62  int rdstate() const;
63  //maps to convert HepMC::GenParticle to particles # and vice versa
64  // -> needed for HepEvt like output
65  std::vector<HepMC::GenParticle *> index_to_particle;
66  std::map<HepMC::GenParticle *, int> particle_to_index;
67  // find index to HepMC::GenParticle* p in map m
68  int find_in_map(const std::map<HepMC::GenParticle *, int> &m, HepMC::GenParticle *p) const;
69 };
70 
71 bool HepMCFileReader::isInitialized() const { return input_ != nullptr; }
72 
73 #endif
void printEvent() const
static HepMCFileReader * instance_
virtual void ReadStats()
edm::propagate_const< HepMC::IO_BaseClass * > input_
list status
Definition: mps_update.py:107
int rdstate() const
virtual void initialize(const std::string &filename)
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
virtual bool setEvent(int event)
HepMC::IO_BaseClass const * input() const
HepMC::IO_BaseClass *& input()
virtual ~HepMCFileReader()
std::vector< HepMC::GenParticle * > index_to_particle
static HepMCFileReader * instance()
edm::propagate_const< HepMC::GenEvent * > evt_
virtual void getStatsFromTuple(int &mo1, int &mo2, int &da1, int &da2, int &status, int &pid, int j) const
int find_in_map(const std::map< HepMC::GenParticle *, int > &m, HepMC::GenParticle *p) const
std::map< HepMC::GenParticle *, int > particle_to_index
bool isInitialized() const
virtual bool printHepMcEvent() const
virtual bool readCurrentEvent()
HepMC::GenEvent * fillCurrentEventData()
tuple filename
Definition: lut2db_cfg.py:20