Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:24

0001 #ifndef TCCINPUT_H
0002 #define TCCINPUT_H
0003 
0004 /*\struct TCCinput
0005  *\description structure holding TCC input
0006  *\author Nuno Leonardo (CERN)
0007  *\date February 2007
0008  */
0009 
0010 #include <iostream>
0011 
0012 struct TCCinput {
0013   int tower;  // tower number in SM
0014   int bunchCrossing;
0015   unsigned input;  // 11 bit value input (10 energy, 1 fg)
0016 
0017   TCCinput(int tt = 0, int bx = 0, unsigned val = 0x0) : tower(tt), bunchCrossing(bx), input(val) {
0018     if (input > 0x7ff) {
0019       std::cout << "[TCCinput] saturated value 0x" << std::hex << input << std::dec << std::endl;
0020       input &= 0x7ff;
0021     }
0022   };
0023 
0024   int get_energy() const {
0025     return input & 0x3ff;  // get bits 9:0
0026   }
0027 
0028   int get_fg() const {
0029     return input & 0x400;  // get bit number 10
0030   }
0031 
0032   bool is_current(int n) const { return (n == bunchCrossing); }
0033 
0034   bool operator<(const TCCinput &) const;
0035 
0036   std::ostream &operator<<(std::ostream &);
0037 };
0038 
0039 inline std::ostream &TCCinput::operator<<(std::ostream &os) {
0040   os << " tcc input "
0041      << " bx:" << bunchCrossing << " tt:" << tower << " raw:0x" << std::hex << input << std::dec
0042      << " fg:" << this->get_fg() << " energy:" << this->get_energy() << std::endl;
0043   return os;
0044 }
0045 
0046 inline bool TCCinput::operator<(const TCCinput &k) const { return (bunchCrossing < k.bunchCrossing); }
0047 
0048 #endif