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;
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
HepMCFileReader::getStatsFromTuple
virtual void getStatsFromTuple(int &mo1, int &mo2, int &da1, int &da2, int &status, int &pid, int j) const
Definition: HepMCFileReader.cc:205
mps_update.status
status
Definition: mps_update.py:68
HepMCFileReader::fillCurrentEventData
HepMC::GenEvent * fillCurrentEventData()
Definition: HepMCFileReader.cc:108
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
HepMCFileReader::evt_
edm::propagate_const< HepMC::GenEvent * > evt_
Definition: HepMCFileReader.h:57
GenParticle
Definition: GenParticle.py:1
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
HepMCFileReader::initialize
virtual void initialize(const std::string &filename)
Definition: HepMCFileReader.cc:56
edm::propagate_const< HepMC::GenEvent * >
HepMCFileReader::printHepMcEvent
virtual bool printHepMcEvent() const
Definition: HepMCFileReader.cc:101
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
HepMCFileReader::printEvent
void printEvent() const
Definition: HepMCFileReader.cc:115
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
HepMCFileReader::ReadStats
virtual void ReadStats()
Definition: HepMCFileReader.cc:166
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HepMCFileReader::setEvent
virtual bool setEvent(int event)
Definition: HepMCFileReader.cc:98
HepMCFileReader::instance
static HepMCFileReader * instance()
Definition: HepMCFileReader.cc:28
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HepMCFileReader::particle_to_index
std::map< HepMC::GenParticle *, int > particle_to_index
Definition: HepMCFileReader.h:66
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
HepMCFileReader::HepMCFileReader
HepMCFileReader()
Definition: HepMCFileReader.cc:38
HepMC
Definition: GenParticle.h:15
HepMCFileReader::input
HepMC::IO_BaseClass *& input()
Definition: HepMCFileReader.h:54
HepMCFileReader::input_
edm::propagate_const< HepMC::IO_BaseClass * > input_
Definition: HepMCFileReader.h:58
HepMCFileReader::input
const HepMC::IO_BaseClass * input() const
Definition: HepMCFileReader.h:53
HepMCFileReader::rdstate
int rdstate() const
Definition: HepMCFileReader.cc:71
HepMCFileReader::~HepMCFileReader
virtual ~HepMCFileReader()
Definition: HepMCFileReader.cc:48
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
get_underlying_safe.h
HepMCFileReader::readCurrentEvent
virtual bool readCurrentEvent()
Definition: HepMCFileReader.cc:82
HepMCFileReader::find_in_map
int find_in_map(const std::map< HepMC::GenParticle *, int > &m, HepMC::GenParticle *p) const
Definition: HepMCFileReader.cc:252
HepMCFileReader
Definition: HepMCFileReader.h:27
HepMCFileReader::instance_
static HepMCFileReader * instance_
Definition: HepMCFileReader.h:60
HepMCFileReader::index_to_particle
std::vector< HepMC::GenParticle * > index_to_particle
Definition: HepMCFileReader.h:65
HepMCFileReader::isInitialized
bool isInitialized() const
Definition: HepMCFileReader.h:71