CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:15
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:15
EventWithHistory::EventWithHistory ( const edm::EventNumber_t  event,
const int  orbit,
const int  bx 
)
explicit

Definition at line 12 of file EventWithHistory.cc.

12  :
const unsigned int orbit() const
std::vector< TinyEvent > _prevse
const int bx() const
const edm::EventNumber_t event() const
TinyEvent()
Definition: TinyEvent.h:15
EventWithHistory::EventWithHistory ( const edm::EventNumber_t  event,
const unsigned int  orbit,
const int  bx 
)
explicit

Definition at line 15 of file EventWithHistory.cc.

15  :
const unsigned int orbit() const
std::vector< TinyEvent > _prevse
const int bx() const
const edm::EventNumber_t event() const
TinyEvent()
Definition: TinyEvent.h:15
EventWithHistory::EventWithHistory ( const edm::Event event)
explicit

Definition at line 18 of file EventWithHistory.cc.

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

Definition at line 21 of file EventWithHistory.cc.

References _prevse.

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

Definition at line 31 of file EventWithHistory.cc.

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

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

Definition at line 112 of file EventWithHistory.cc.

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

Member Function Documentation

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

Definition at line 227 of file EventWithHistory.cc.

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

Referenced by EventWithHistoryFilter::is_selected().

227  {
228 
229  if(ev1==0) return TinyEvent::absoluteBX();
230  if(ev1<=_prevse.size()) return _prevse[ev1-1].absoluteBX();
231 
232  return -1;
233 
234 }
std::vector< TinyEvent > _prevse
long long absoluteBX() const
Definition: TinyEvent.h:57
long long absoluteBX() const
long long EventWithHistory::absoluteBX ( ) const

Definition at line 236 of file EventWithHistory.cc.

References TinyEvent::absoluteBX().

Referenced by absoluteBX().

236  {
237 
238  return TinyEvent::absoluteBX();
239 
240 }
long long absoluteBX() const
Definition: TinyEvent.h:57
long long EventWithHistory::absoluteBXinCycle ( const unsigned int  ev1,
const int  bx0 
) const

Definition at line 242 of file EventWithHistory.cc.

References _prevse, and TinyEvent::absoluteBXinCycle().

Referenced by EventWithHistoryFilter::is_selected().

242  {
243 
244  if(ev1==0) return TinyEvent::absoluteBXinCycle(bx0);
245  if(ev1<=_prevse.size()) return _prevse[ev1-1].absoluteBXinCycle(bx0);
246 
247  return -1;
248 
249 }
long long absoluteBXinCycle(const int bx0) const
Definition: TinyEvent.h:63
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 251 of file EventWithHistory.cc.

References TinyEvent::absoluteBXinCycle().

251  {
252 
253  return TinyEvent::absoluteBXinCycle(bx0);
254 
255 }
long long absoluteBXinCycle(const int bx0) const
Definition: TinyEvent.h:63
int EventWithHistory::add ( const EventWithHistory he,
const int  idepth 
)

Definition at line 142 of file EventWithHistory.cc.

References ev.

Referenced by counter.Counter::register().

142  {
143 
144  if(!add((const TinyEvent&) he,idepth)) return 0;
145 
146  for(std::vector<TinyEvent>::const_iterator ev=he._prevse.begin();ev!=he._prevse.end();ev++) {
147  if(!add(*ev,idepth)) return 0;
148  }
149  return 1;
150 }
bool ev
int add(const EventWithHistory &he, const int idepth)
int EventWithHistory::add ( const TinyEvent he,
const int  idepth 
)

Definition at line 152 of file EventWithHistory.cc.

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

Referenced by counter.Counter::register().

152  {
153 
154  bool isfuture = (idepth <0);
155  const unsigned int adepth = abs(idepth);
156 
157  // protect against the possibility of filling with past and future history
158 
159  if( depth()>0 && ((isfuture && !isFutureHistory()) || (!isfuture && isFutureHistory()))) return 0;
160 
161  if(adepth==0) return 0;
162  if(_prevse.size()>= adepth) return 0;
163 
164  if(_prevse.size()==0) {
165  if((!isfuture && isNextOf(se)) || (isfuture && se.isNextOf(*this))) {
166  _prevse.push_back(se);
167  return 1;
168  }
169  else {
170  return 0;
171  }
172  }
173  else {
174  if((!isfuture && _prevse[_prevse.size()-1].isNextOf(se)) || (isfuture && se.isNextOf(_prevse[_prevse.size()-1]))) {
175  _prevse.push_back(se);
176  return 1;
177  }
178  else {
179  return 0;
180  }
181  }
182  return 0;
183 }
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:51
bool isFutureHistory() const
const int EventWithHistory::bx ( ) const

Definition at line 187 of file EventWithHistory.cc.

References TinyEvent::_bx.

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

Definition at line 205 of file EventWithHistory.cc.

References _prevse, and TinyEvent::deltaBX().

Referenced by EventWithHistoryFilter::is_selected().

205  {
206 
207  if(ev2==ev1) return 0;
208 
209  if(ev2<ev1 && ev1<=_prevse.size()) {
210  if(ev2==0) return TinyEvent::deltaBX(_prevse[ev1-1]);
211  return _prevse[ev2-1].deltaBX(_prevse[ev1-1]);
212  }
213 
214  return -1;
215 }
std::vector< TinyEvent > _prevse
long long deltaBX(const TinyEvent &se) const
Definition: TinyEvent.h:69
long long EventWithHistory::deltaBX ( const unsigned int  ev1) const

Definition at line 217 of file EventWithHistory.cc.

References deltaBX().

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

Definition at line 219 of file EventWithHistory.cc.

Referenced by deltaBX(), and EventWithHistory().

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

Definition at line 221 of file EventWithHistory.cc.

References TinyEvent::deltaBX().

221  {
222 
223  return TinyEvent::deltaBX(se);
224 
225 }
long long deltaBX(const TinyEvent &se) const
Definition: TinyEvent.h:69
long long EventWithHistory::deltaBXinCycle ( const unsigned int  ev2,
const unsigned int  ev1,
const int  bx0 
) const

Definition at line 257 of file EventWithHistory.cc.

References _prevse, and TinyEvent::deltaBXinCycle().

Referenced by deltaBXinCycle(), and EventWithHistoryFilter::is_selected().

257  {
258 
259  if(ev2==ev1 && ev1<=_prevse.size()) {
260  if(ev2==0) return TinyEvent::deltaBXinCycle(*this,bx0);
261  return _prevse[ev2-1].deltaBXinCycle(_prevse[ev1-1],bx0);
262  }
263 
264  if(ev2<ev1 && ev1<=_prevse.size()) {
265  if(ev2==0) return TinyEvent::deltaBXinCycle(_prevse[ev1-1],bx0);
266  return _prevse[ev2-1].deltaBXinCycle(_prevse[ev1-1],bx0);
267  }
268 
269  return -1;
270 }
std::vector< TinyEvent > _prevse
long long deltaBXinCycle(const TinyEvent &se, const int bx0) const
Definition: TinyEvent.h:79
long long EventWithHistory::deltaBXinCycle ( const unsigned int  ev1,
const int  bx0 
) const

Definition at line 272 of file EventWithHistory.cc.

References deltaBXinCycle().

272  {
273  return deltaBXinCycle(0,ev1,bx0);
274 }
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 276 of file EventWithHistory.cc.

References deltaBXinCycle().

276  {
277  return deltaBXinCycle(0,1,bx0);
278 }
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 280 of file EventWithHistory.cc.

References TinyEvent::deltaBXinCycle().

280  {
281 
282  return TinyEvent::deltaBXinCycle(se,bx0);
283 
284 }
long long deltaBXinCycle(const TinyEvent &se, const int bx0) const
Definition: TinyEvent.h:79
unsigned int EventWithHistory::depth ( void  ) const

Definition at line 197 of file EventWithHistory.cc.

References _prevse.

Referenced by add(), EventWithHistoryFilter::is_selected(), isFutureHistory(), and operator==().

197 { return _prevse.size(); }
std::vector< TinyEvent > _prevse
const edm::EventNumber_t EventWithHistory::event ( ) const

Definition at line 185 of file EventWithHistory.cc.

References TinyEvent::_event.

Referenced by Types.EventID::cppID().

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

Definition at line 199 of file EventWithHistory.cc.

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

Referenced by add().

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

Definition at line 114 of file EventWithHistory.cc.

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

114  {
115 
116  if(this != &he) {
118  _prevse = he._prevse;
119  }
120  return *this;
121 }
std::vector< TinyEvent > _prevse
TinyEvent & operator=(const TinyEvent &se)
Definition: TinyEvent.h:29
int EventWithHistory::operator== ( const EventWithHistory other) const

Definition at line 125 of file EventWithHistory.cc.

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

125  {
126 
127  int equal = TinyEvent::operator==(other);
128 
129  // depth is not checked anymore
130 
131  // equal = equal && (depth() == other.depth());
132 
133  if(equal) {
134  for(unsigned int i=0;i<((depth()<other.depth())?depth():other.depth());i++) {
135  equal = equal && (_prevse[i] == other._prevse[i]);
136  }
137  }
138 
139  return equal;
140 }
unsigned int depth() const
int i
Definition: DBlmapReader.cc:9
bool equal(const T &first, const T &second)
Definition: Equal.h:34
std::vector< TinyEvent > _prevse
int operator==(const TinyEvent &other) const
Definition: TinyEvent.h:45
const unsigned int EventWithHistory::orbit ( ) const

Definition at line 186 of file EventWithHistory.cc.

References TinyEvent::_orbit.

186 { return TinyEvent::_orbit; }
unsigned int _orbit
Definition: TinyEvent.h:88

Member Data Documentation

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