CMS 3D CMS Logo

TinyEvent.h
Go to the documentation of this file.
1 #ifndef DPGanalysis_SiStripTools_TinyEvent_H
2 #define DPGanalysis_SiStripTools_TinyEvent_H
3 
5 #include <vector>
6 
7 namespace edm {
8  class Event;
9 }
10 
11 //class EventIdWithBX;
12 
13 struct TinyEvent {
14  TinyEvent() : _event(0), _orbit(0), _bx(0) {}
15 
16  explicit TinyEvent(const edm::EventNumber_t event, const int orbit, const int bx)
17  : _event(event), _orbit(orbit < 0 ? 0 : orbit), _bx(bx < 0 ? 0 : bx) {}
18 
19  explicit TinyEvent(const edm::EventNumber_t event, const unsigned int orbit, const int bx)
20  : _event(event), _orbit(orbit), _bx(bx < 0 ? 0 : bx) {}
21 
22  TinyEvent(const TinyEvent& se) : _event(se._event), _orbit(se._orbit), _bx(se._bx) {}
23 
24  TinyEvent(const edm::Event& event);
25  TinyEvent(const edm::EventAuxiliary& eaux);
26 
28  if (this != &se) {
29  _event = se._event;
30  _orbit = se._orbit;
31  _bx = se._bx;
32  }
33 
34  return *this;
35  }
36 
37  int operator<(const TinyEvent& other) const { return _event < other._event; }
38 
39  int operator==(const TinyEvent& other) const {
40  return (_event == other._event) && (_orbit == other._orbit) && (_bx == other._bx);
41  }
42 
43  int isNextOf(const TinyEvent& se) const { return (se._event > 0) && ((se._event + 1) == _event); }
44 
45  long long absoluteBX() const { return (long long)_orbit * 3564 + _bx; }
46 
47  long long absoluteBXinCycle(const int bx0) const { return (absoluteBX() - bx0); }
48 
49  long long deltaBX(const TinyEvent& se) const {
50  int sign = 1;
51  if (se._event > _event)
52  sign = -1;
53 
54  long long dorb = (int)(_orbit) - (int)(se._orbit);
55  return (dorb * 3564 + (int)_bx - (int)se._bx) * sign;
56  }
57 
58  long long deltaBXinCycle(const TinyEvent& se, const int bx0) const {
59  long long dbx = deltaBX(se);
60 
61  return dbx + (69 + se.absoluteBX() - bx0 % 70) % 70; // I could use: dbx+(69+se.absoluteBXinCycle(bx0))%70
62  }
63 
65  unsigned int _orbit;
66  unsigned int _bx;
67 };
68 
69 typedef std::vector<TinyEvent> TinyEventCollection;
70 
71 #endif // DPGanalysis_SiStripTools_TinyEvent_H
unsigned int _bx
Definition: TinyEvent.h:66
int operator==(const TinyEvent &other) const
Definition: TinyEvent.h:39
std::vector< TinyEvent > TinyEventCollection
Definition: TinyEvent.h:69
unsigned long long EventNumber_t
long long absoluteBXinCycle(const int bx0) const
Definition: TinyEvent.h:47
TinyEvent(const edm::EventNumber_t event, const int orbit, const int bx)
Definition: TinyEvent.h:16
int operator<(const TinyEvent &other) const
Definition: TinyEvent.h:37
TinyEvent(const edm::EventNumber_t event, const unsigned int orbit, const int bx)
Definition: TinyEvent.h:19
TinyEvent(const TinyEvent &se)
Definition: TinyEvent.h:22
TinyEvent & operator=(const TinyEvent &se)
Definition: TinyEvent.h:27
long long absoluteBX() const
Definition: TinyEvent.h:45
long long deltaBXinCycle(const TinyEvent &se, const int bx0) const
Definition: TinyEvent.h:58
HLT enums.
edm::EventNumber_t _event
Definition: TinyEvent.h:64
unsigned int _orbit
Definition: TinyEvent.h:65
int isNextOf(const TinyEvent &se) const
Definition: TinyEvent.h:43
long long deltaBX(const TinyEvent &se) const
Definition: TinyEvent.h:49
TinyEvent()
Definition: TinyEvent.h:14
Definition: event.py:1