Class Reference for E1039 Core & Analysis Software
PHHepMCGenEventMap.h
Go to the documentation of this file.
1 #ifndef __PHHEPMCGENEVENTMAP_H__
2 #define __PHHEPMCGENEVENTMAP_H__
3 
4 #include "PHHepMCGenEvent.h"
5 
6 #include <phool/PHObject.h>
7 #include <map>
8 
15 {
16  public:
21  typedef std::map<int, PHHepMCGenEvent*> HepMCGenEventMap;
22  typedef std::map<int, PHHepMCGenEvent*>::const_iterator ConstIter;
23  typedef std::map<int, PHHepMCGenEvent*>::iterator Iter;
24  typedef std::map<int, PHHepMCGenEvent*>::const_reverse_iterator ConstReverseIter;
25  typedef std::map<int, PHHepMCGenEvent*>::reverse_iterator ReverseIter;
26 
28  PHHepMCGenEventMap(const PHHepMCGenEventMap& eventmap);
30 
31  virtual ~PHHepMCGenEventMap();
32 
33  void identify(std::ostream& os = std::cout) const;
34  void Reset();
35  int isValid() const { return 1; }
36  PHHepMCGenEventMap* Clone(const char* newname = "") const { return new PHHepMCGenEventMap(*this); }
38  bool empty() const { return _map.empty(); }
39  size_t size() const { return _map.size(); }
40  size_t count(int idkey) const { return _map.count(idkey); }
41  void clear() { Reset(); }
43  const PHHepMCGenEvent* get(int idkey) const;
44  PHHepMCGenEvent* get(int idkey);
45 
47  PHHepMCGenEvent* insert(const PHHepMCGenEvent* event) { return insert_active_event(event); }
49  PHHepMCGenEvent* insert_active_event(const PHHepMCGenEvent* event = nullptr);
53  PHHepMCGenEvent* insert_event(const int embedding_id, const PHHepMCGenEvent* event = nullptr);
54 
55  size_t erase(int idkey)
56  {
57  delete _map[idkey];
58  return _map.erase(idkey);
59  }
60 
62  ConstIter find(unsigned int idkey) const { return _map.find(idkey); }
63  Iter find(int idkey) { return _map.find(idkey); }
65  ConstIter begin() const { return _map.begin(); }
66  ConstIter end() const { return _map.end(); }
67  Iter begin() { return _map.begin(); }
68  Iter end() { return _map.end(); }
70  ConstReverseIter rbegin() const { return _map.rbegin(); }
71  ConstReverseIter rend() const { return _map.rend(); }
72  ReverseIter rbegin() { return _map.rbegin(); }
73  ReverseIter rend() { return _map.rend(); }
74  //
76  const HepMCGenEventMap& get_map() const { return _map; }
77  HepMCGenEventMap& get_map() { return _map; }
78  private:
79  HepMCGenEventMap _map;
80 
81  ClassDef(PHHepMCGenEventMap, 4);
82 };
83 
84 #endif
PHHepMCGenEventMap is collection of HEPMC events input into this simulation map of embedding ID -> PH...
bool empty() const
container service
PHHepMCGenEvent * insert_active_event(const PHHepMCGenEvent *event=nullptr)
insert a event of interest, e.g. jetty event from pythia
ConstReverseIter rend() const
std::map< int, PHHepMCGenEvent * >::iterator Iter
size_t erase(int idkey)
PHHepMCGenEventMap & operator=(const PHHepMCGenEventMap &eventmap)
PHHepMCGenEventMap * Clone(const char *newname="") const
HepMCGenEventMap & get_map()
const PHHepMCGenEvent * get(int idkey) const
fetch event
PHHepMCGenEvent * insert(const PHHepMCGenEvent *event)
insert a event of interest, e.g. jetty event from pythia
void Reset()
Clear Event.
size_t count(int idkey) const
std::map< int, PHHepMCGenEvent * >::const_iterator ConstIter
PHHepMCGenEvent * insert_background_event(const PHHepMCGenEvent *event=nullptr)
insert a event of background, e.g. Au+Au collision background. First event has embedding ID = 0,...
ConstReverseIter rbegin() const
iterator from lowest ID to highest, i.e. signal to background
std::map< int, PHHepMCGenEvent * >::const_reverse_iterator ConstReverseIter
int isValid() const
isValid returns non zero if object contains vailid data
PHHepMCGenEvent * insert_event(const int embedding_id, const PHHepMCGenEvent *event=nullptr)
insert a event with specific embedding ID
ConstIter end() const
void identify(std::ostream &os=std::cout) const
const HepMCGenEventMap & get_map() const
for c++11 range-based for loop
Iter find(int idkey)
ConstIter find(unsigned int idkey) const
find
ConstIter begin() const
iterator from lowest ID to highest, i.e. background to signal
std::map< int, PHHepMCGenEvent * >::reverse_iterator ReverseIter
std::map< int, PHHepMCGenEvent * > HepMCGenEventMap