20 _id_genevent_map.clear();
24 if (_stale) refresh();
25 out <<
"PHGenEventListv1" << endl;
29 if (_stale) refresh();
32 out <<
" size = " <<
size() << endl;
33 for (
size_t i=0; i<
size(); ++i) {
34 _genevents[i].print(out);
44 if (_stale) refresh();
47 =
static_cast<const PHGenEvent*
>(versioned_const);
52 if (_stale) refresh();
59 if (_stale) refresh();
60 if (_id_genevent_map.find(
id) == _id_genevent_map.end())
return false;
65 if (_stale) refresh();
66 for (
size_t i = 0; i < _genevents.size(); ++i) {
67 if (_genevents[i].get_id() ==
id)
return i;
69 return _genevents.size();
73 if (_stale) refresh();
74 if (_id_genevent_map.find(
id) != _id_genevent_map.end()) {
75 return (
const PHGenEvent*)_id_genevent_map[id];
81 if (_stale) refresh();
82 if (_id_genevent_map.find(
id) != _id_genevent_map.end()) {
89 if (_stale) refresh();
98 if (versioned_const) {
100 _id_genevent_map.insert(make_pair(genevent->
get_id(),
101 &_genevents[_genevents.size()-1]));
107 if (_stale) refresh();
109 unsigned int key = 0;
110 if (_id_genevent_map.empty())
return key;
112 key = _id_genevent_map.rbegin()->first + 1;
117 _genevents.erase(_genevents.begin()+i);
123 _id_genevent_map.clear();
126 void PHGenEventListv1::refresh()
const {
128 _id_genevent_map.clear();
130 for (
size_t i = 0; i < _genevents.size(); ++i) {
131 _id_genevent_map.insert(make_pair(_genevents[i].get_id(),&_genevents[i]));
ClassImp(PHGenEventListv1) PHGenEventListv1
unsigned int generate_id() const
void insert(const PHGenEvent *genevent)
bool has(unsigned int id) const
PHGenEventv1 PHGenEventVersion
void print(std::ostream &out=std::cout) const
const PHGenEvent * at(size_t i) const
size_t find(unsigned int id) const
const PHGenEvent * fetch(unsigned int id) const
virtual ~PHGenEventListv1()
void identify(std::ostream &out=std::cout) const
virtual unsigned int get_id() const