CMS 3D CMS Logo

HepMCFileReader.h
Go to the documentation of this file.
1 #ifndef Input_HepMCFileReader_h
2 #define Input_HepMCFileReader_h
3 
4 
17 #include <vector>
18 #include <map>
19 
21 
22 namespace HepMC {
23  class IO_BaseClass;
24  class GenEvent;
25  class GenParticle;
26 }
27 
28 
30 
31  protected:
33 
34  public:
35  virtual ~HepMCFileReader();
36  virtual void initialize(const std::string &filename);
37  inline bool isInitialized() const;
38 
39  virtual bool setEvent(int event);
40  virtual bool readCurrentEvent();
41  virtual bool printHepMcEvent() const;
42  HepMC::GenEvent *fillCurrentEventData();
43  // virtual bool fillEventData(HepMC::GenEvent *event);
44  // this method prints the event information as
45  // obtained by the input file in HepEvt style
46  void printEvent() const;
47  // get all the 'integer' properties of a particle
48  // like mother, daughter, pid and status
49  // 'j' is the number of the particle in the HepMc
50  virtual void getStatsFromTuple(int &mo1, int &mo2, int &da1, int &da2,
51  int &status, int &pid, int j) const;
52  virtual void ReadStats();
53 
54  static HepMCFileReader *instance();
55 
56  private:
57  HepMC::IO_BaseClass const* input() const {return get_underlying_safe(input_);}
58  HepMC::IO_BaseClass*& input() {return get_underlying_safe(input_);}
59 
60  // current HepMC evt
63 
65 
66  int rdstate() const;
67  //maps to convert HepMC::GenParticle to particles # and vice versa
68  // -> needed for HepEvt like output
69  std::vector<HepMC::GenParticle*> index_to_particle;
70  std::map<HepMC::GenParticle*,int> particle_to_index;
71  // find index to HepMC::GenParticle* p in map m
72  int find_in_map(const std::map<HepMC::GenParticle*,int>& m,
73  HepMC::GenParticle *p) const;
74 };
75 
76 
78 {
79  return input_ != 0;
80 }
81 
82 #endif
static AlgebraicMatrix initialize()
static PFTauRenderPlugin instance
static HepMCFileReader * instance_
std::map< HepMC::GenParticle *, int > particle_to_index
HepMC::IO_BaseClass const * input() const
std::vector< HepMC::GenParticle * > index_to_particle
HepMC::IO_BaseClass *& input()
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
bool isInitialized() const
edm::propagate_const< HepMC::IO_BaseClass * > input_
edm::propagate_const< HepMC::GenEvent * > evt_
Definition: event.py:1