Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:18

0001 #include "DataFormats/HcalDigi/interface/HcalLaserDigi.h"
0002 
0003 HcalLaserDigi::HcalLaserDigi() {
0004   for (int i = 0; i < 32; ++i)
0005     qadcraw_[i] = 0;
0006   attenuator1_ = 0;
0007   attenuator2_ = 0;
0008   selector_ = 0;
0009 }
0010 
0011 void HcalLaserDigi::setQADC(const std::vector<uint16_t>& values) {
0012   for (size_t i = 0; i < values.size() && i < 32; ++i)
0013     qadcraw_[i] = values[i];
0014 }
0015 
0016 void HcalLaserDigi::addTDCHit(int channel, int hittime) {
0017   uint32_t packed = (hittime & 0xFFFFFF) | ((channel & 0xFF) << 24);
0018   tdcraw_.push_back(packed);
0019 }
0020 
0021 int HcalLaserDigi::hitChannel(size_t ihit) const {
0022   if (ihit < tdcraw_.size())
0023     return tdcraw_[ihit] >> 24;
0024   else
0025     return -1;
0026 }
0027 
0028 int HcalLaserDigi::hitRaw(size_t ihit) const {
0029   if (ihit < tdcraw_.size())
0030     return tdcraw_[ihit] & 0xFFFFFF;
0031   else
0032     return -1;
0033 }
0034 
0035 double HcalLaserDigi::hitNS(size_t ihit) const { return hitRaw(ihit) * 0.8; }
0036 
0037 void HcalLaserDigi::setLaserControl(int att1, int att2, int select) {
0038   attenuator1_ = att1;
0039   attenuator2_ = att2;
0040   selector_ = select;
0041 }