CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCWireDigi.cc
Go to the documentation of this file.
1 
8 
9 #include <iostream>
10 #include <stdint.h>
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::cout << " CSC Wire " << getWireGroup() << " | "
64  << " CSC Wire BX # " << getWireGroupBX() << " | "
65  << " CSC BX + Wire " << std::hex << getBXandWireGroup() << " | " << std::dec
66  << " CSC Wire First Time Bin On " << getTimeBin()
67  << std::endl;
68  std::cout << " CSC Time Bins On ";
69  std::vector<int> tbins=getTimeBinsOn();
70  for(unsigned int i=0; i<tbins.size();i++) std::cout<<tbins[i]<<" ";
71  std::cout<<std::endl;
72 }
73 
74 std::ostream & operator<<(std::ostream & o, const CSCWireDigi& digi) {
75  o << " CSC Wire " << digi.getWireGroup()
76  << " CSC Wire First Time Bin On " << digi.getTimeBin()
77  << " CSC Time Bins On ";
78  for (unsigned int i = 0; i<digi.getTimeBinsOn().size(); ++i ){
79  o <<" " <<digi.getTimeBinsOn()[i]; }
80  return o;
81 }
82 
int i
Definition: DBlmapReader.cc:9
CSCWireDigi()
wiregroup#, tbin bit word
Definition: CSCWireDigi.cc:25
void print() const
Print content of digi.
Definition: CSCWireDigi.cc:62
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
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
int getTimeBin() const
return first tbin ON number
Definition: CSCWireDigi.cc:37
tuple cout
Definition: gather_cfg.py:121
int getBXandWireGroup() const
Definition: CSCWireDigi.h:29
uint32_t tbinb_
Definition: CSCWireDigi.h:49