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
TinyEvent::TinyEvent
TinyEvent(const edm::EventNumber_t event, const unsigned int orbit, const int bx)
Definition: TinyEvent.h:19
TinyEventCollection
std::vector< TinyEvent > TinyEventCollection
Definition: TinyEvent.h:69
edm
HLT enums.
Definition: AlignableModifier.h:19
TinyEvent::TinyEvent
TinyEvent(const TinyEvent &se)
Definition: TinyEvent.h:22
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
TinyEvent::_event
edm::EventNumber_t _event
Definition: TinyEvent.h:64
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
TinyEvent::deltaBXinCycle
long long deltaBXinCycle(const TinyEvent &se, const int bx0) const
Definition: TinyEvent.h:58
TinyEvent::_orbit
unsigned int _orbit
Definition: TinyEvent.h:65
TinyEvent::isNextOf
int isNextOf(const TinyEvent &se) const
Definition: TinyEvent.h:43
TinyEvent::absoluteBX
long long absoluteBX() const
Definition: TinyEvent.h:45
TinyEvent::TinyEvent
TinyEvent()
Definition: TinyEvent.h:14
TinyEvent::deltaBX
long long deltaBX(const TinyEvent &se) const
Definition: TinyEvent.h:49
Event
trackingPlots.other
other
Definition: trackingPlots.py:1464
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
createfilelist.int
int
Definition: createfilelist.py:10
TinyEvent::_bx
unsigned int _bx
Definition: TinyEvent.h:66
TinyEvent::operator==
int operator==(const TinyEvent &other) const
Definition: TinyEvent.h:39
TinyEvent
Definition: TinyEvent.h:13
TinyEvent::absoluteBXinCycle
long long absoluteBXinCycle(const int bx0) const
Definition: TinyEvent.h:47
EventAuxiliary.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
TinyEvent::operator<
int operator<(const TinyEvent &other) const
Definition: TinyEvent.h:37
TinyEvent::TinyEvent
TinyEvent(const edm::EventNumber_t event, const int orbit, const int bx)
Definition: TinyEvent.h:16
TinyEvent::operator=
TinyEvent & operator=(const TinyEvent &se)
Definition: TinyEvent.h:27