CMS 3D CMS Logo

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