Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MessageLogger in HOTriggerPrimitiveDigi #46116

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions DataFormats/HcalDigi/src/HOTriggerPrimitiveDigi.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
#include "DataFormats/HcalDigi/interface/HOTriggerPrimitiveDigi.h"
#include <cstdio>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

HOTriggerPrimitiveDigi::HOTriggerPrimitiveDigi(
int ieta, int iphi, int nsamples, int whichSampleTriggered, int databits) {
if ((nsamples < 0) || (nsamples > HO_TP_SAMPLES_MAX))
printf("HOTRiggerPrimitiveDigi: nsamples out of range.");
if ((whichSampleTriggered < 0) || (whichSampleTriggered > nsamples))
printf("HOTriggerPrimitiveDigi: specified Triggering Sample out of range");
if ((databits >> nsamples) != 0x0000)
printf("HOTRiggerPrimitiveDigi: Specified extra bits out of nsamples range.");
if ((nsamples < 0) || (nsamples > HO_TP_SAMPLES_MAX)) {
edm::LogWarning("HOTRiggerPrimitiveDigi") << "value " << nsamples << " of nsamples out of range.";
if (nsamples < 0) {
nsamples = 0;
} else {
nsamples = HO_TP_SAMPLES_MAX;
}
} else if ((whichSampleTriggered < 0) || (whichSampleTriggered > nsamples)) {
edm::LogWarning("HOTriggerPrimitiveDigi")
<< "value " << whichSampleTriggered << " of specified Triggering Sample out of range.";
} else if ((databits >> nsamples) != 0x0000) {
edm::LogWarning("HOTRiggerPrimitiveDigi")
<< "nsamples " << nsamples << " and databits " << databits << "caused specified extra bits ("
<< (databits >> nsamples) << ") to be out of nsamples range.";
}
int samples = nsamples;
if (samples < 0)
samples = 0;
if (samples > HO_TP_SAMPLES_MAX)
samples = HO_TP_SAMPLES_MAX;

theHO_TP = (abs(ieta) & 0xf) | ((ieta < 0) ? (0x10) : (0x00)) | ((iphi & 0x7F) << 5) | ((samples & 0xF) << 12) |
(((whichSampleTriggered) & 0xF) << 16) | ((databits & 0x3FF) << 20);
Expand All @@ -22,7 +27,7 @@ HOTriggerPrimitiveDigi::HOTriggerPrimitiveDigi(
//Request the value of a given HO TP bit in the HO TP Digi.
bool HOTriggerPrimitiveDigi::data(int whichbit) const {
if ((whichbit < 0) || (whichbit > nsamples())) {
printf("HOTPDigi: Sample bit requested out of range.");
edm::LogWarning("HOTriggerPrimitiveDigi") << "value " << whichbit << " of sample bit requested out of range.";
return false;
}
return ((theHO_TP >> (20 + whichbit)) & 0x0001);
Expand Down