CMS 3D CMS Logo

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;
39  HepMC::GenEvent *fillCurrentEventData();
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
static AlgebraicMatrix initialize()
static PFTauRenderPlugin instance
static HepMCFileReader * instance_
edm::propagate_const< HepMC::IO_BaseClass * > input_
HepMC::IO_BaseClass const * input() const
HepMC::IO_BaseClass *& input()
std::vector< HepMC::GenParticle * > index_to_particle
edm::propagate_const< HepMC::GenEvent * > evt_
std::map< HepMC::GenParticle *, int > particle_to_index
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
bool isInitialized() const
Definition: event.py:1