CMS 3D CMS Logo

HOTriggerPrimitiveDigi.cc
Go to the documentation of this file.
3 
5  int ieta, int iphi, int nsamples, int whichSampleTriggered, int databits) {
6  if ((nsamples < 0) || (nsamples > HO_TP_SAMPLES_MAX)) {
7  edm::LogWarning("HOTRiggerPrimitiveDigi") << "value " << nsamples << " of nsamples out of range.";
8  if (nsamples < 0) {
9  nsamples = 0;
10  } else {
12  }
13  } else if ((whichSampleTriggered < 0) || (whichSampleTriggered > nsamples)) {
14  edm::LogWarning("HOTriggerPrimitiveDigi")
15  << "value " << whichSampleTriggered << " of specified Triggering Sample out of range.";
16  } else if ((databits >> nsamples) != 0x0000) {
17  edm::LogWarning("HOTRiggerPrimitiveDigi")
18  << "nsamples " << nsamples << " and databits " << databits << "caused specified extra bits ("
19  << (databits >> nsamples) << ") to be out of nsamples range.";
20  }
21  int samples = nsamples;
22 
23  theHO_TP = (abs(ieta) & 0xf) | ((ieta < 0) ? (0x10) : (0x00)) | ((iphi & 0x7F) << 5) | ((samples & 0xF) << 12) |
24  (((whichSampleTriggered) & 0xF) << 16) | ((databits & 0x3FF) << 20);
25 }
26 
27 //Request the value of a given HO TP bit in the HO TP Digi.
28 bool HOTriggerPrimitiveDigi::data(int whichbit) const {
29  if ((whichbit < 0) || (whichbit > nsamples())) {
30  edm::LogWarning("HOTriggerPrimitiveDigi") << "value " << whichbit << " of sample bit requested out of range.";
31  return false;
32  }
33  return ((theHO_TP >> (20 + whichbit)) & 0x0001);
34 }
35 
36 /* Stream the formatted contents of the HOTriggerPrimitiveDigi. */
37 std::ostream& operator<<(std::ostream& s, const HOTriggerPrimitiveDigi& HOtpd) {
38  s << "(HO TP " << HOtpd.ieta() << ", " << HOtpd.iphi() << ", ";
39  // s << HOtpd.whichSampleTriggered() << "_of_" << HOtpd.nsamples() << " [";
40  for (int bit = 0; bit < HOtpd.nsamples(); bit++) {
41  if (HOtpd.data(bit))
42  s << "1";
43  else
44  s << "0";
45  if (bit == HOtpd.whichSampleTriggered())
46  s << "* ";
47  else
48  s << " ";
49  }
50  s << " )";
51  return s;
52 }
int ieta() const
get the signed ieta value
int whichSampleTriggered() const
get the number of the triggering sample
int iphi() const
get the iphi value
bool data(int whichbit=HO_TP_SAMPLES_MAX) const
static const int HO_TP_SAMPLES_MAX
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int nsamples() const
get the number of samples used to compute the TP
std::ostream & operator<<(std::ostream &s, const HOTriggerPrimitiveDigi &HOtpd)
Log< level::Warning, false > LogWarning