CMS 3D CMS Logo

CSCWireDigi.cc
Go to the documentation of this file.
1 
9 #include <iostream>
10 #include <cstdint>
11 
13 
14 CSCWireDigi::CSCWireDigi (int wire, unsigned int tbinb){
16  wire_ = wire & 0x0000FFFF;
17  tbinb_ = tbinb;
19  wireBX_= (wire >> 16) & 0x0000FFFF;
21  wireBXandWires_=wire;
22 }
23 
26  wire_ = 0;
27  tbinb_ = 0;
28  wireBX_=0;
30 }
31 
34  return getTimeBin();
35 }
38  uint32_t tbit=1;
39  int tbin=-1;
40  for(int i=0;i<32;i++) {
41  if(tbit & tbinb_) tbin=i;
42  if(tbin>-1) break;
43  tbit=tbit<<1;
44  }
45  return tbin;
46 }
48 std::vector<int> CSCWireDigi::getTimeBinsOn() const {
49  std::vector<int> tbins;
50  uint32_t tbit=tbinb_;
51  uint32_t one=1;
52  for(int i=0;i<32;i++) {
53  if(tbit & one) tbins.push_back(i);
54  tbit=tbit>>1;
55  if(tbit==0) break;
56  }
57  return tbins;
58 }
59 
61 
62 void CSCWireDigi::print() const {
63  std::ostringstream ost;
64  ost << "CSCWireDigi | wg " << getWireGroup() << " | "
65  << " BX # " << getWireGroupBX() << " | "
66  << " BX + Wire " << std::hex << getBXandWireGroup() << " | " << std::dec
67  << " First Time Bin On " << getTimeBin() << " | Time Bins On ";
68  std::vector<int> tbins=getTimeBinsOn();
69  for(unsigned int i=0; i<tbins.size();i++) {ost << tbins[i] << " ";}
70  edm::LogVerbatim("CSCDigi") << ost.str();
71 }
72 
73 std::ostream & operator<<(std::ostream & o, const CSCWireDigi& digi) {
74  o << " CSC Wire " << digi.getWireGroup()
75  << " CSC Wire First Time Bin On " << digi.getTimeBin()
76  << " CSC Time Bins On ";
77  for (unsigned int i = 0; i<digi.getTimeBinsOn().size(); ++i ){
78  o <<" " <<digi.getTimeBinsOn()[i]; }
79  return o;
80 }
81 
CSCWireDigi()
wiregroup#, tbin bit word
Definition: CSCWireDigi.cc:25
void print() const
Print content of digi.
Definition: CSCWireDigi.cc:62
int wireBXandWires_
BX in the wire digis (16 upper bits from the wire group number)
Definition: CSCWireDigi.h:51
std::vector< int > getTimeBinsOn() const
return vector of time bins ON
Definition: CSCWireDigi.cc:48
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
Definition: CSCWireDigi.cc:33
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
int getWireGroupBX() const
return BX assigned for the wire group (16 upper bits from the wire group number)
Definition: CSCWireDigi.h:26
std::ostream & operator<<(std::ostream &o, const CSCWireDigi &digi)
Definition: CSCWireDigi.cc:73
int getTimeBin() const
return first tbin ON number
Definition: CSCWireDigi.cc:37
int getBXandWireGroup() const
Definition: CSCWireDigi.h:29
uint32_t tbinb_
Definition: CSCWireDigi.h:49