Skip to content

Commit

Permalink
[CPP20][SIMULATION] Remove deprecated enum arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Mar 20, 2024
1 parent 754f2b8 commit 5dea8f7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator {
ical = &eventSetup->getData(m_interCalibConstantsMCToken);
// adc to GeV
agc = &eventSetup->getData(m_adcToGeVConstantToken);
m_maxEneEB = (agc->getEBValue()) * theDefaultGains[1] * MAXADC * m_EBs25notCont;
m_maxEneEE = (agc->getEEValue()) * theDefaultGains[1] * MAXADC * m_EEs25notCont;
m_maxEneEB = (agc->getEBValue()) * theDefaultGains[1] * static_cast<double>(MAXADC) * m_EBs25notCont;
m_maxEneEE = (agc->getEEValue()) * theDefaultGains[1] * static_cast<double>(MAXADC) * m_EEs25notCont;

if (m_timeDependent) {
//----
Expand Down
2 changes: 1 addition & 1 deletion SimCalorimetry/EcalSimAlgos/src/EcalCoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void EcalCoder::encode(const EcalSamples& ecalSamples, EcalDataFrame& df, CLHEP:

LSB[igain] = 0.;
if (igain > 0)
LSB[igain] = Emax / (MAXADC * gains[igain]);
LSB[igain] = Emax / (static_cast<double>(MAXADC) * gains[igain]);
maxADC[igain] = ADCGAINSWITCH; // saturation at 4080 for middle and high gains x6 & x12
if (igain == NGAINS)
maxADC[igain] = MAXADC; // saturation at 4095 for low gain x1
Expand Down
4 changes: 2 additions & 2 deletions SimCalorimetry/EcalSimAlgos/src/EcalSignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CaloSamples EcalSignalGenerator<EBDigitizerTraits>::samplesInPE(const DIGI &digi
for (unsigned int igain(0); igain <= NGAINS; ++igain) {
LSB[igain] = 0.;
if (igain > 0)
LSB[igain] = Emax / (MAXADC * gainRatios[igain]);
LSB[igain] = Emax / (static_cast<double>(MAXADC) * gainRatios[igain]);
}

// std::cout << " intercal, LSBs, egains " << icalconst << " " << LSB[0] << " " << LSB[1] << " " << gainRatios[0] << " " << gainRatios[1] << " " << Emax << std::endl;
Expand Down Expand Up @@ -141,7 +141,7 @@ CaloSamples EcalSignalGenerator<EEDigitizerTraits>::samplesInPE(const DIGI &digi
for (unsigned int igain(0); igain <= NGAINS; ++igain) {
LSB[igain] = 0.;
if (igain > 0)
LSB[igain] = Emax / (MAXADC * gainRatios[igain]);
LSB[igain] = Emax / (static_cast<double>(MAXADC) * gainRatios[igain]);
}

// std::cout << " intercal, LSBs, egains " << icalconst << " " << LSB[0] << " " << LSB[1] << " " << gainRatios[0] << " " << gainRatios[1] << " " << Emax << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,13 @@ void EcalDigiProducer::checkCalibrations(const edm::Event &event, const edm::Eve

delete defaultRatios;

const double EBscale((agc->getEBValue()) * theGains[1] * (m_Coder->MAXADC) * m_EBs25notCont);
const double EBscale((agc->getEBValue()) * theGains[1] * static_cast<double>(m_Coder->MAXADC) * m_EBs25notCont);

LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue() << "\n"
<< " notCont = " << m_EBs25notCont << "\n"
<< " saturation for EB = " << EBscale << ", " << m_EBs25notCont;

const double EEscale((agc->getEEValue()) * theGains[1] * (m_Coder->MAXADC) * m_EEs25notCont);
const double EEscale((agc->getEEValue()) * theGains[1] * static_cast<double>(m_Coder->MAXADC) * m_EEs25notCont);

LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue() << "\n"
<< " notCont = " << m_EEs25notCont << "\n"
Expand Down
8 changes: 5 additions & 3 deletions SimCalorimetry/HcalSimAlgos/src/HcalSiPMHitResponse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ HcalSiPMHitResponse::HcalSiPMHitResponse(const CaloVSimParameterMap* parameterMa
theSiPM(),
PreMixDigis(PreMix1),
HighFidelityPreMix(HighFidelity),
nbins((PreMixDigis and HighFidelityPreMix) ? 1 : BUNCHSPACE * HcalPulseShapes::invDeltaTSiPM_),
nbins((PreMixDigis and HighFidelityPreMix) ? 1
: static_cast<float>(BUNCHSPACE) * HcalPulseShapes::invDeltaTSiPM_),
dt(HcalPulseShapes::deltaTSiPM_),
invdt(HcalPulseShapes::invDeltaTSiPM_) {
//fill shape map
Expand All @@ -43,7 +44,7 @@ int HcalSiPMHitResponse::getReadoutFrameSize(const DetId& id) const {
int readoutFrameSize = parameters.readoutFrameSize();
if (PreMixDigis and HighFidelityPreMix) {
//preserve fidelity of time info
readoutFrameSize *= BUNCHSPACE * HcalPulseShapes::invDeltaTSiPM_;
readoutFrameSize *= static_cast<float>(BUNCHSPACE) * HcalPulseShapes::invDeltaTSiPM_;
}
return readoutFrameSize;
}
Expand Down Expand Up @@ -127,7 +128,8 @@ void HcalSiPMHitResponse::add(const PCaloHit& hit, CLHEP::HepRandomEngine* engin
LogDebug("HcalSiPMHitResponse") << " energy: " << hit.energy() << " photons: " << photons << " time: " << time;
LogDebug("HcalSiPMHitResponse") << " timePhase: " << pars.timePhase() << " tof: " << tof
<< " binOfMaximum: " << pars.binOfMaximum() << " phaseShift: " << thePhaseShift_;
double tzero(0.0 + pars.timePhase() - (time - tof) - BUNCHSPACE * (pars.binOfMaximum() - thePhaseShift_));
double tzero(0.0 + pars.timePhase() - (time - tof) -
static_cast<double>(BUNCHSPACE) * (pars.binOfMaximum() - thePhaseShift_));
LogDebug("HcalSiPMHitResponse") << " tzero: " << tzero;
double tzero_bin(-tzero * invdt);
LogDebug("HcalSiPMHitResponse") << " corrected tzero: " << tzero_bin << '\n';
Expand Down

0 comments on commit 5dea8f7

Please sign in to comment.