CMS 3D CMS Logo

CSCWireDigi.cc

Go to the documentation of this file.
00001 
00009 #include <DataFormats/CSCDigi/interface/CSCWireDigi.h>
00010 
00011 using namespace std;
00012 
00014 
00015 CSCWireDigi::CSCWireDigi (int wire, unsigned int tbinb){
00016   wire_  = wire;
00017   tbinb_ = tbinb;
00018 }
00019 
00021 CSCWireDigi::CSCWireDigi (){
00022   wire_ = 0;
00023   tbinb_ = 0;
00024 }
00025 
00027 int CSCWireDigi::getBeamCrossingTag() const {
00028   return getTimeBin();
00029 }
00031 int CSCWireDigi::getTimeBin() const {
00032   uint32_t tbit=1;
00033   int tbin=-1;
00034   for(int i=0;i<32;i++) {
00035     if(tbit & tbinb_) tbin=i;
00036     if(tbin>-1) break;
00037     tbit=tbit<<1;
00038   }
00039   return tbin;
00040 }
00042 std::vector<int> CSCWireDigi::getTimeBinsOn() const {
00043   std::vector<int> tbins;
00044   uint32_t tbit=tbinb_;
00045   uint32_t one=1;
00046   for(int i=0;i<32;i++) {
00047     if(tbit & one) tbins.push_back(i);
00048     tbit=tbit>>1;
00049     if(tbit==0) break;
00050   }
00051   return tbins;
00052 }
00053 
00055 
00056 void CSCWireDigi::print() const {
00057   std::cout << " CSC Wire " << getWireGroup() 
00058             << " CSC Wire First Time Bin On" << getTimeBin() 
00059             << std::endl;
00060   std::cout << " CSC Time Bins On ";
00061   std::vector<int> tbins=getTimeBinsOn();
00062   for(unsigned int i=0; i<tbins.size();i++) std::cout<<tbins[i]<<" ";
00063   std::cout<<std::endl; 
00064 }

Generated on Tue Jun 9 17:30:40 2009 for CMSSW by  doxygen 1.5.4