CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EncodedEventId.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_EncodedEventId_H
2 #define SimDataFormats_EncodedEventId_H 1
3 
4 #include <TMath.h>
5 #include <boost/cstdint.hpp> //INCLUDECHECKER:SKIP
6 #include <ostream>
7 
12  public:
16  explicit EncodedEventId(uint32_t id);
18  EncodedEventId(int bunchX, int event){
19  id_ = TMath::Abs(bunchX)<< bunchXStartBit_ |event ;
20  if (bunchX<0) id_=id_ | bunchNegMask_;
21  }
22 
24  int bunchCrossing() const { int bcr= int((id_ >> bunchXStartBit_) & 0x7FFF); return id_ & bunchNegMask_ ? -bcr : bcr; }
26  int event() const { return int(id_ & 0xFFFF); }
27  uint32_t operator()() { return id_; }
29  uint32_t rawId() const { return id_; }
31  int operator==(const EncodedEventId& id) const { return id_==id.id_; }
33  int operator!=(const EncodedEventId& id) const { return id_!=id.id_; }
35  int operator<(const EncodedEventId& id) const { return id_<id.id_; }
36  private:
37  static const unsigned int bunchXStartBit_ = 16;
38  static const unsigned int eventStartBit_ = 0;
39  static const unsigned int bunchXMask_ = 0x10;
40  static const unsigned int bunchNegMask_ = 0x80000000;
41  static const unsigned int eventMask_ = 0x10;
42  protected:
43  uint32_t id_;
44 };
45 #endif
static const unsigned int eventMask_
int event() const
get the contents of the subdetector field (should be protected?)
static const unsigned int bunchXMask_
static const unsigned int bunchXStartBit_
EncodedEventId(int bunchX, int event)
Create an id, filling the bunch crossing and event infomrations.
EncodedEventId()
Create an empty or null id (also for persistence)
int bunchCrossing() const
get the detector field from this detid
uint32_t operator()()
int operator!=(const EncodedEventId &id) const
inequality
uint32_t rawId() const
get the raw id
static const unsigned int eventStartBit_
int operator<(const EncodedEventId &id) const
comparison
static const unsigned int bunchNegMask_
int operator==(const EncodedEventId &id) const
equality