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 
10 
11 #include <iostream>
12 #include <stdint.h>
13 
15 
16 CSCWireDigi::CSCWireDigi (int wire, unsigned int tbinb){
18  wire_ = wire & 0x0000FFFF;
19  tbinb_ = tbinb;
21  wireBX_= (wire >> 16) & 0x0000FFFF;
23  wireBXandWires_=wire;
24 }
25 
28  wire_ = 0;
29  tbinb_ = 0;
30  wireBX_=0;
32 }
33 
36  return getTimeBin();
37 }
40  uint32_t tbit=1;
41  int tbin=-1;
42  for(int i=0;i<32;i++) {
43  if(tbit & tbinb_) tbin=i;
44  if(tbin>-1) break;
45  tbit=tbit<<1;
46  }
47  return tbin;
48 }
50 std::vector<int> CSCWireDigi::getTimeBinsOn() const {
51  std::vector<int> tbins;
52  uint32_t tbit=tbinb_;
53  uint32_t one=1;
54  for(int i=0;i<32;i++) {
55  if(tbit & one) tbins.push_back(i);
56  tbit=tbit>>1;
57  if(tbit==0) break;
58  }
59  return tbins;
60 }
61 
63 
64 void CSCWireDigi::print() const {
65  std::cout << " CSC Wire " << getWireGroup() << " | "
66  << " CSC Wire BX # " << getWireGroupBX() << " | "
67  << " CSC BX + Wire " << std::hex << getBXandWireGroup() << " | " << std::dec
68  << " CSC Wire First Time Bin On " << getTimeBin()
69  << std::endl;
70  std::cout << " CSC Time Bins On ";
71  std::vector<int> tbins=getTimeBinsOn();
72  for(unsigned int i=0; i<tbins.size();i++) std::cout<<tbins[i]<<" ";
73  std::cout<<std::endl;
74 }
75 
76 std::ostream & operator<<(std::ostream & o, const CSCWireDigi& digi) {
77  o << " CSC Wire " << digi.getWireGroup()
78  << " CSC Wire First Time Bin On " << digi.getTimeBin()
79  << " CSC Time Bins On ";
80  for (unsigned int i = 0; i<digi.getTimeBinsOn().size(); ++i ){
81  o <<" " <<digi.getTimeBinsOn()[i]; }
82  return o;
83 }
84 
int i
Definition: DBlmapReader.cc:9
CSCWireDigi()
wiregroup#, tbin bit word
Definition: CSCWireDigi.cc:27
void print() const
Print content of digi.
Definition: CSCWireDigi.cc:64
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:50
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
Definition: CSCWireDigi.cc:35
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:39
tuple cout
Definition: gather_cfg.py:121
int getBXandWireGroup() const
Definition: CSCWireDigi.h:29
uint32_t tbinb_
Definition: CSCWireDigi.h:49