CMS 3D CMS Logo

TCCinput.h

Go to the documentation of this file.
00001 #ifndef TCCINPUT_H
00002 #define TCCINPUT_H
00003 
00004 /*\struct TCCinput
00005  *\description structure holding TCC input
00006  *\author Nuno Leonardo (CERN)
00007  *\date February 2007
00008  */
00009 
00010 #include <iostream> 
00011 
00012 struct TCCinput {
00013   
00014   int tower;         //tower number in SM
00015   int bunchCrossing; 
00016   unsigned input;    //11 bit value input (10 energy, 1 fg)
00017   
00018   TCCinput(int tt=0, int bx=0, unsigned val=0x0) : 
00019     tower(tt), bunchCrossing(bx), input(val) {
00020     if (input>0x7ff)  {
00021       std::cout << "[TCCinput] saturated value 0x" 
00022                 << std::hex << input << std::dec
00023                 << std::endl;
00024       input &= 0x7ff;
00025     }
00026   }; 
00027  
00028   int get_energy() const {
00029     return input & 0x3ff; //get bits 9:0
00030   }
00031   
00032   int get_fg() const {
00033     return input & 0x400; //get bit number 10
00034   }
00035 
00036   bool is_current (int n) const {
00037     return (n==bunchCrossing);
00038   }
00039 
00040   bool operator<(const TCCinput &) const;
00041   
00042   std::ostream& operator<<(std::ostream&);
00043 
00044 };
00045 
00046 inline 
00047 std::ostream& TCCinput::operator<<(std::ostream& os) {
00048   os << " tcc input " 
00049      << " bx:"     << bunchCrossing 
00050      << " tt:"     << tower 
00051      << " raw:0x"  << std::hex  << input << std::dec  
00052      << " fg:"     << this->get_fg()
00053      << " energy:" << this->get_energy()
00054      << std::endl;
00055   return os;
00056 }
00057 
00058 inline
00059 bool TCCinput::operator< (const TCCinput &k) const {
00060   return (bunchCrossing < k.bunchCrossing);
00061 }
00062 
00063 #endif 

Generated on Tue Jun 9 17:46:15 2009 for CMSSW by  doxygen 1.5.4