Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:59

0001 #include "RecoLocalMuon/CSCRecHitD/src/CSCStripHit.h"
0002 #include <iostream>
0003 
0004 CSCStripHit::CSCStripHit(const CSCDetId& id,
0005                          const float& sHitPos,
0006                          const int& tmax,
0007                          const ChannelContainer& strips,
0008                          const StripHitADCContainer& s_adc,
0009                          const StripHitADCContainer& s_adcRaw,
0010                          const int& numberOfConsecutiveStrips,
0011                          const int& closestMaximum,
0012                          const short int& deadStrip)
0013     : theDetId(id),
0014       theStripHitPosition(sHitPos),
0015       theStripHitTmax(tmax),
0016       theStrips(strips),
0017       theStripHitADCs(s_adc),
0018       theStripHitRawADCs(s_adcRaw),
0019       theConsecutiveStrips(numberOfConsecutiveStrips),
0020       theClosestMaximum(closestMaximum),
0021       theDeadStrip(deadStrip) {
0022   /// Extract the 2 lowest bytes for strip number
0023   theStripsLowBits.clear();
0024   for (int i = 0; i < (int)theStrips.size(); i++) {
0025     theStripsLowBits.push_back(theStrips[i] & 0x000000FF);
0026   }
0027   /// Extract the 2 highest bytes for L1A phase
0028   theStripsHighBits.clear();
0029   for (int i = 0; i < (int)theStrips.size(); i++) {
0030     theStripsHighBits.push_back(theStrips[i] & 0x0000FF00);
0031   }
0032 }
0033 
0034 /// Debug
0035 void CSCStripHit::print() const {
0036   std::cout << "CSCStripHit in CSC Detector: " << std::dec << cscDetId() << std::endl;
0037   std::cout << "  sHitPos: " << sHitPos() << std::endl;
0038   std::cout << "  TMAX: " << tmax() << std::endl;
0039   std::cout << "  STRIPS: ";
0040   for (int i = 0; i < (int)strips().size(); i++) {
0041     std::cout << std::dec << strips()[i] << " ("
0042               << "HEX: " << std::hex << strips()[i] << ")"
0043               << " ";
0044   }
0045   std::cout << std::endl;
0046 
0047   /// L1A
0048   std::cout << "  L1APhase: ";
0049   for (int i = 0; i < (int)stripsl1a().size(); i++) {
0050     //uint16_t L1ABitSet=(strips()[i] & 0xFF00);
0051     //std::cout << std::hex << (stripsl1a()[i] >> 15)<< " ";
0052 
0053     std::cout << "|";
0054     for (int k = 0; k < 8; k++) {
0055       std::cout << ((stripsl1a()[i] >> (15 - k)) & 0x1) << " ";
0056     }
0057     std::cout << "| ";
0058   }
0059   std::cout << std::endl;
0060 
0061   std::cout << "  S_ADC: ";
0062   for (int i = 0; i < (float)s_adc().size(); i++) {
0063     std::cout << s_adc()[i] << " ";
0064   }
0065   std::cout << std::endl;
0066   std::cout << "  S_ADC_RAW: ";
0067   for (int i = 0; i < (float)s_adcRaw().size(); i++) {
0068     std::cout << s_adcRaw()[i] << " ";
0069   }
0070   std::cout << std::endl;
0071 }