CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EventWithHistory Class Reference

#include <EventWithHistory.h>

Inheritance diagram for EventWithHistory:
TinyEvent

Public Member Functions

long long absoluteBX (const unsigned int ev1) const
 
long long absoluteBX () const
 
long long absoluteBXinCycle (const unsigned int ev1, const int bx0) const
 
long long absoluteBXinCycle (const int bx0) const
 
int add (const EventWithHistory &he, const int idepth)
 
int add (const TinyEvent &he, const int idepth)
 
const int bx () const
 
long long deltaBX (const unsigned int ev2, const unsigned int ev1) const
 
long long deltaBX (const unsigned int ev1) const
 
long long deltaBX () const
 
long long deltaBX (const TinyEvent &se) const
 
long long deltaBXinCycle (const unsigned int ev2, const unsigned int ev1, const int bx0) const
 
long long deltaBXinCycle (const unsigned int ev1, const int bx0) const
 
long long deltaBXinCycle (const int bx0) const
 
long long deltaBXinCycle (const TinyEvent &se, const int bx0) const
 
unsigned int depth () const
 
const edm::EventNumber_t event () const
 
 EventWithHistory ()
 
 EventWithHistory (const TinyEvent &se)
 
 EventWithHistory (const edm::EventNumber_t event, const int orbit, const int bx)
 
 EventWithHistory (const edm::EventNumber_t event, const unsigned int orbit, const int bx)
 
 EventWithHistory (const edm::Event &event)
 
 EventWithHistory (const std::vector< edm::EventAuxiliary > &he)
 
 EventWithHistory (const edm::Event &event, const L1AcceptBunchCrossingCollection &l11bcc, const long long orbitoffset=0, const int bxoffset=0)
 
 EventWithHistory (const EventWithHistory &he)
 
const TinyEventget (const unsigned int ev) const
 
bool isFutureHistory () const
 
EventWithHistoryoperator= (const EventWithHistory &he)
 
int operator== (const EventWithHistory &other) const
 
const unsigned int orbit () const
 
- Public Member Functions inherited from TinyEvent
long long absoluteBX () const
 
long long absoluteBXinCycle (const int bx0) const
 
long long deltaBX (const TinyEvent &se) const
 
long long deltaBXinCycle (const TinyEvent &se, const int bx0) const
 
int isNextOf (const TinyEvent &se) const
 
int operator< (const TinyEvent &other) const
 
TinyEventoperator= (const TinyEvent &se)
 
int operator== (const TinyEvent &other) const
 
 TinyEvent ()
 
 TinyEvent (const edm::EventNumber_t event, const int orbit, const int bx)
 
 TinyEvent (const edm::EventNumber_t event, const unsigned int orbit, const int bx)
 
 TinyEvent (const TinyEvent &se)
 
 TinyEvent (const edm::Event &event)
 
 TinyEvent (const edm::EventAuxiliary &eaux)
 

Private Attributes

std::vector< TinyEvent_prevse
 

Additional Inherited Members

- Public Attributes inherited from TinyEvent
unsigned int _bx
 
edm::EventNumber_t _event
 
unsigned int _orbit
 

Detailed Description

Definition at line 16 of file EventWithHistory.h.

Constructor & Destructor Documentation

EventWithHistory::EventWithHistory ( )

Definition at line 8 of file EventWithHistory.cc.

8 : TinyEvent(), _prevse() {}
std::vector< TinyEvent > _prevse
TinyEvent()
Definition: TinyEvent.h:14
EventWithHistory::EventWithHistory ( const TinyEvent se)
explicit

Definition at line 10 of file EventWithHistory.cc.

10 : TinyEvent(se), _prevse() {}
std::vector< TinyEvent > _prevse
TinyEvent()
Definition: TinyEvent.h:14
EventWithHistory::EventWithHistory ( const edm::EventNumber_t  event,
const int  orbit,
const int  bx 
)
explicit

Definition at line 12 of file EventWithHistory.cc.

13  : TinyEvent(event, orbit, bx), _prevse() {}
const unsigned int orbit() const
std::vector< TinyEvent > _prevse
const int bx() const
TinyEvent()
Definition: TinyEvent.h:14
Definition: event.py:1
EventWithHistory::EventWithHistory ( const edm::EventNumber_t  event,
const unsigned int  orbit,
const int  bx 
)
explicit

Definition at line 15 of file EventWithHistory.cc.

16  : TinyEvent(event, orbit, bx), _prevse() {}
const unsigned int orbit() const
std::vector< TinyEvent > _prevse
const int bx() const
TinyEvent()
Definition: TinyEvent.h:14
Definition: event.py:1
EventWithHistory::EventWithHistory ( const edm::Event event)
explicit

Definition at line 18 of file EventWithHistory.cc.

18 : TinyEvent(event), _prevse() {}
std::vector< TinyEvent > _prevse
TinyEvent()
Definition: TinyEvent.h:14
EventWithHistory::EventWithHistory ( const std::vector< edm::EventAuxiliary > &  he)

Definition at line 20 of file EventWithHistory.cc.

References _prevse.

21  : TinyEvent((!veaux.empty()) ? veaux[veaux.size() - 1] : TinyEvent()), _prevse() {
22  for (std::vector<edm::EventAuxiliary>::const_reverse_iterator eaux = veaux.rbegin(); eaux != veaux.rend(); eaux++) {
23  if (eaux != veaux.rbegin()) {
24  _prevse.push_back(*eaux);
25  }
26  }
27 }
std::vector< TinyEvent > _prevse
TinyEvent()
Definition: TinyEvent.h:14
EventWithHistory::EventWithHistory ( const edm::Event event,
const L1AcceptBunchCrossingCollection l11bcc,
const long long  orbitoffset = 0,
const int  bxoffset = 0 
)

Definition at line 29 of file EventWithHistory.cc.

References _prevse, counter, deltaBX(), edm::EventID::event(), edm::EventBase::id(), and TinyEvent::operator=().

33  : TinyEvent(), _prevse() {
34  std::map<int, TinyEvent> tmpmap;
35 
36  for (L1AcceptBunchCrossingCollection::const_iterator l1abc = l1abcc.begin(); l1abc != l1abcc.end(); ++l1abc) {
37  if (event.id().event() > (edm::EventNumber_t)(-1 * l1abc->l1AcceptOffset())) {
38  edm::EventNumber_t evnumb = event.id().event() + l1abc->l1AcceptOffset();
39  if (orbitoffset < (long long)l1abc->orbitNumber()) {
40  unsigned int neworbit = l1abc->orbitNumber() - orbitoffset;
41  int newbx = l1abc->bunchCrossing() - bxoffset;
42 
43  /*
44  the lines below assumes that the BX number is between 0 and 3563. If this is not the case it will jump to 0 and to the next orbit in case of
45  evets with BX=3564
46  */
47  while (newbx > 3563) {
48  ++neworbit;
49  newbx -= 3564;
50  }
51  while (newbx < 0) {
52  --neworbit;
53  newbx += 3564;
54  }
55 
56  if (l1abc->eventType() != 0) {
57  TinyEvent tmpse(evnumb, neworbit, newbx);
58  tmpmap[l1abc->l1AcceptOffset()] = tmpse;
59  } else {
60  edm::LogWarning("L1AcceptBunchCrossingNoType") << "L1AcceptBunchCrossing with no type found: ";
61  for (L1AcceptBunchCrossingCollection::const_iterator debu = l1abcc.begin(); debu != l1abcc.end(); ++debu) {
62  edm::LogPrint("L1AcceptBunchCrossingNoType") << *debu;
63  }
64  }
65  } else {
66  edm::LogError("L1AcceptBunchCrossingOffsetTooLarge")
67  << " Too large orbit offset " << orbitoffset << " " << l1abc->orbitNumber();
68  }
69  } else {
70  edm::LogInfo("L1AcceptBunchCrossingNegativeEvent") << "L1AcceptBunchCrossing with negative event: ";
71  for (L1AcceptBunchCrossingCollection::const_iterator debu = l1abcc.begin(); debu != l1abcc.end(); ++debu) {
72  edm::LogVerbatim("L1AcceptBunchCrossingNegativeEvent") << *debu;
73  }
74  }
75  }
76  // look for the event itself
77  if (tmpmap.find(0) != tmpmap.end()) {
78  TinyEvent::operator=(tmpmap[0]);
79 
80  // loop on the rest of the map and stop when it is missing
81  // check that the events are in the right order and break if not
82 
83  int counter = -1;
84  while (tmpmap.find(counter) != tmpmap.end()) {
85  if (tmpmap[counter + 1].deltaBX(tmpmap[counter]) > 0) {
86  _prevse.push_back(tmpmap[counter]);
87  --counter;
88  } else {
89  edm::LogWarning("L1AcceptBunchCrossingNotInOrder")
90  << "L1AcceptBunchCrossing not in order: orbit " << event.orbitNumber() << " BX " << event.bunchCrossing()
91  << " orbit offset " << orbitoffset << " bx offset " << bxoffset << " :";
92  for (L1AcceptBunchCrossingCollection::const_iterator debu = l1abcc.begin(); debu != l1abcc.end(); ++debu) {
93  edm::LogPrint("L1AcceptBunchCrossingNotInOrder") << *debu;
94  }
95  break;
96  }
97  }
98  } else {
99  TinyEvent::operator=(event);
100  edm::LogWarning("L1AcceptBunchCrossingNoCollection") << " L1AcceptBunchCrossing with offset=0 not found "
101  << " likely L1ABCCollection is empty ";
102  }
103 }
EventNumber_t event() const
Definition: EventID.h:40
long long deltaBX() const
unsigned long long EventNumber_t
std::vector< TinyEvent > _prevse
TinyEvent & operator=(const TinyEvent &se)
Definition: TinyEvent.h:27
edm::EventID id() const
Definition: EventBase.h:59
static std::atomic< unsigned int > counter
TinyEvent()
Definition: TinyEvent.h:14
EventWithHistory::EventWithHistory ( const EventWithHistory he)

Definition at line 105 of file EventWithHistory.cc.

105 : TinyEvent(he), _prevse(he._prevse) {}
std::vector< TinyEvent > _prevse
TinyEvent()
Definition: TinyEvent.h:14

Member Function Documentation

long long EventWithHistory::absoluteBX ( const unsigned int  ev1) const

Definition at line 212 of file EventWithHistory.cc.

References _prevse, TinyEvent::absoluteBX(), and absoluteBX().

Referenced by SiStripMonitorDigi::analyze(), SiStripMonitorCluster::analyze(), EventTimeDistribution::analyze(), and EventWithHistoryFilter::is_selected().

212  {
213  if (ev1 == 0)
214  return TinyEvent::absoluteBX();
215  if (ev1 <= _prevse.size())
216  return _prevse[ev1 - 1].absoluteBX();
217 
218  return -1;
219 }
std::vector< TinyEvent > _prevse
long long absoluteBX() const
Definition: TinyEvent.h:45
long long absoluteBX() const
long long EventWithHistory::absoluteBX ( ) const

Definition at line 221 of file EventWithHistory.cc.

References TinyEvent::absoluteBX().

Referenced by absoluteBX().

221 { return TinyEvent::absoluteBX(); }
long long absoluteBX() const
Definition: TinyEvent.h:45
long long EventWithHistory::absoluteBXinCycle ( const unsigned int  ev1,
const int  bx0 
) const

Definition at line 223 of file EventWithHistory.cc.

References _prevse, and TinyEvent::absoluteBXinCycle().

Referenced by APVShotsAnalyzer::analyze(), and EventWithHistoryFilter::is_selected().

223  {
224  if (ev1 == 0)
225  return TinyEvent::absoluteBXinCycle(bx0);
226  if (ev1 <= _prevse.size())
227  return _prevse[ev1 - 1].absoluteBXinCycle(bx0);
228 
229  return -1;
230 }
long long absoluteBXinCycle(const int bx0) const
Definition: TinyEvent.h:47
long long absoluteBXinCycle(const unsigned int ev1, const int bx0) const
std::vector< TinyEvent > _prevse
long long EventWithHistory::absoluteBXinCycle ( const int  bx0) const

Definition at line 232 of file EventWithHistory.cc.

References TinyEvent::absoluteBXinCycle().

232 { return TinyEvent::absoluteBXinCycle(bx0); }
long long absoluteBXinCycle(const int bx0) const
Definition: TinyEvent.h:47
int EventWithHistory::add ( const EventWithHistory he,
const int  idepth 
)

Definition at line 133 of file EventWithHistory.cc.

References ev.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

133  {
134  if (!add((const TinyEvent&)he, idepth))
135  return 0;
136 
137  for (std::vector<TinyEvent>::const_iterator ev = he._prevse.begin(); ev != he._prevse.end(); ev++) {
138  if (!add(*ev, idepth))
139  return 0;
140  }
141  return 1;
142 }
bool ev
int add(const EventWithHistory &he, const int idepth)
int EventWithHistory::add ( const TinyEvent he,
const int  idepth 
)

Definition at line 144 of file EventWithHistory.cc.

References _prevse, funct::abs(), depth(), isFutureHistory(), and TinyEvent::isNextOf().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

144  {
145  bool isfuture = (idepth < 0);
146  const unsigned int adepth = abs(idepth);
147 
148  // protect against the possibility of filling with past and future history
149 
150  if (depth() > 0 && ((isfuture && !isFutureHistory()) || (!isfuture && isFutureHistory())))
151  return 0;
152 
153  if (adepth == 0)
154  return 0;
155  if (_prevse.size() >= adepth)
156  return 0;
157 
158  if (_prevse.empty()) {
159  if ((!isfuture && isNextOf(se)) || (isfuture && se.isNextOf(*this))) {
160  _prevse.push_back(se);
161  return 1;
162  } else {
163  return 0;
164  }
165  } else {
166  if ((!isfuture && _prevse[_prevse.size() - 1].isNextOf(se)) ||
167  (isfuture && se.isNextOf(_prevse[_prevse.size() - 1]))) {
168  _prevse.push_back(se);
169  return 1;
170  } else {
171  return 0;
172  }
173  }
174  return 0;
175 }
unsigned int depth() const
std::vector< TinyEvent > _prevse
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int isNextOf(const TinyEvent &se) const
Definition: TinyEvent.h:43
bool isFutureHistory() const
const int EventWithHistory::bx ( ) const

Definition at line 179 of file EventWithHistory.cc.

References TinyEvent::_bx.

179 { return TinyEvent::_bx; }
unsigned int _bx
Definition: TinyEvent.h:66
long long EventWithHistory::deltaBX ( const unsigned int  ev2,
const unsigned int  ev1 
) const

Definition at line 193 of file EventWithHistory.cc.

References _prevse, and TinyEvent::deltaBX().

Referenced by SiStripMonitorCluster::analyze(), EventTimeDistribution::analyze(), SiStripFEDMonitorPlugin::analyze(), MultiplicityTimeCorrelations::analyze(), APVShotsAnalyzer::analyze(), and EventWithHistoryFilter::is_selected().

193  {
194  if (ev2 == ev1)
195  return 0;
196 
197  if (ev2 < ev1 && ev1 <= _prevse.size()) {
198  if (ev2 == 0)
199  return TinyEvent::deltaBX(_prevse[ev1 - 1]);
200  return _prevse[ev2 - 1].deltaBX(_prevse[ev1 - 1]);
201  }
202 
203  return -1;
204 }
std::vector< TinyEvent > _prevse
long long deltaBX(const TinyEvent &se) const
Definition: TinyEvent.h:49
long long EventWithHistory::deltaBX ( const unsigned int  ev1) const

Definition at line 206 of file EventWithHistory.cc.

References deltaBX().

206 { return deltaBX(0, ev1); }
long long deltaBX() const
long long EventWithHistory::deltaBX ( ) const

Definition at line 208 of file EventWithHistory.cc.

Referenced by deltaBX(), and EventWithHistory().

208 { return deltaBX(0, 1); }
long long deltaBX() const
long long EventWithHistory::deltaBX ( const TinyEvent se) const

Definition at line 210 of file EventWithHistory.cc.

References TinyEvent::deltaBX().

210 { return TinyEvent::deltaBX(se); }
long long deltaBX(const TinyEvent &se) const
Definition: TinyEvent.h:49
long long EventWithHistory::deltaBXinCycle ( const unsigned int  ev2,
const unsigned int  ev1,
const int  bx0 
) const

Definition at line 234 of file EventWithHistory.cc.

References _prevse, and TinyEvent::deltaBXinCycle().

Referenced by SiStripMonitorCluster::analyze(), CommonModeAnalyzer::analyze(), APVShotsAnalyzer::analyze(), deltaBXinCycle(), and EventWithHistoryFilter::is_selected().

234  {
235  if (ev2 == ev1 && ev1 <= _prevse.size()) {
236  if (ev2 == 0)
237  return TinyEvent::deltaBXinCycle(*this, bx0);
238  return _prevse[ev2 - 1].deltaBXinCycle(_prevse[ev1 - 1], bx0);
239  }
240 
241  if (ev2 < ev1 && ev1 <= _prevse.size()) {
242  if (ev2 == 0)
243  return TinyEvent::deltaBXinCycle(_prevse[ev1 - 1], bx0);
244  return _prevse[ev2 - 1].deltaBXinCycle(_prevse[ev1 - 1], bx0);
245  }
246 
247  return -1;
248 }
std::vector< TinyEvent > _prevse
long long deltaBXinCycle(const TinyEvent &se, const int bx0) const
Definition: TinyEvent.h:58
long long EventWithHistory::deltaBXinCycle ( const unsigned int  ev1,
const int  bx0 
) const

Definition at line 250 of file EventWithHistory.cc.

References deltaBXinCycle().

250  {
251  return deltaBXinCycle(0, ev1, bx0);
252 }
long long deltaBXinCycle(const unsigned int ev2, const unsigned int ev1, const int bx0) const
long long EventWithHistory::deltaBXinCycle ( const int  bx0) const

Definition at line 254 of file EventWithHistory.cc.

References deltaBXinCycle().

254 { return deltaBXinCycle(0, 1, bx0); }
long long deltaBXinCycle(const unsigned int ev2, const unsigned int ev1, const int bx0) const
long long EventWithHistory::deltaBXinCycle ( const TinyEvent se,
const int  bx0 
) const

Definition at line 256 of file EventWithHistory.cc.

References TinyEvent::deltaBXinCycle().

256  {
257  return TinyEvent::deltaBXinCycle(se, bx0);
258 }
long long deltaBXinCycle(const TinyEvent &se, const int bx0) const
Definition: TinyEvent.h:58
unsigned int EventWithHistory::depth ( void  ) const
const edm::EventNumber_t EventWithHistory::event ( ) const

Definition at line 177 of file EventWithHistory.cc.

References TinyEvent::_event.

Referenced by Types.EventID::cppID().

177 { return TinyEvent::_event; }
edm::EventNumber_t _event
Definition: TinyEvent.h:64
const TinyEvent * EventWithHistory::get ( const unsigned int  ev) const
bool EventWithHistory::isFutureHistory ( ) const

Definition at line 191 of file EventWithHistory.cc.

References _prevse, depth(), and TinyEvent::isNextOf().

Referenced by add().

191 { return (depth() > 0 && _prevse[0].isNextOf(*this)); }
unsigned int depth() const
std::vector< TinyEvent > _prevse
int isNextOf(const TinyEvent &se) const
Definition: TinyEvent.h:43
EventWithHistory & EventWithHistory::operator= ( const EventWithHistory he)

Definition at line 107 of file EventWithHistory.cc.

References _prevse, and TinyEvent::operator=().

107  {
108  if (this != &he) {
110  _prevse = he._prevse;
111  }
112  return *this;
113 }
std::vector< TinyEvent > _prevse
TinyEvent & operator=(const TinyEvent &se)
Definition: TinyEvent.h:27
int EventWithHistory::operator== ( const EventWithHistory other) const

Definition at line 117 of file EventWithHistory.cc.

References _prevse, depth(), cond::serialization::equal(), mps_fire::i, and TinyEvent::operator==().

117  {
118  int equal = TinyEvent::operator==(other);
119 
120  // depth is not checked anymore
121 
122  // equal = equal && (depth() == other.depth());
123 
124  if (equal) {
125  for (unsigned int i = 0; i < ((depth() < other.depth()) ? depth() : other.depth()); i++) {
126  equal = equal && (_prevse[i] == other._prevse[i]);
127  }
128  }
129 
130  return equal;
131 }
unsigned int depth() const
bool equal(const T &first, const T &second)
Definition: Equal.h:32
std::vector< TinyEvent > _prevse
int operator==(const TinyEvent &other) const
Definition: TinyEvent.h:39
const unsigned int EventWithHistory::orbit ( ) const

Definition at line 178 of file EventWithHistory.cc.

References TinyEvent::_orbit.

178 { return TinyEvent::_orbit; }
unsigned int _orbit
Definition: TinyEvent.h:65

Member Data Documentation

std::vector<TinyEvent> EventWithHistory::_prevse
private