test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TCCinput.h
Go to the documentation of this file.
1 #ifndef TCCINPUT_H
2 #define TCCINPUT_H
3 
4 /*\struct TCCinput
5  *\description structure holding TCC input
6  *\author Nuno Leonardo (CERN)
7  *\date February 2007
8  */
9 
10 #include <iostream>
11 
12 struct TCCinput {
13 
14  int tower; //tower number in SM
16  unsigned input; //11 bit value input (10 energy, 1 fg)
17 
18  TCCinput(int tt=0, int bx=0, unsigned val=0x0) :
19  tower(tt), bunchCrossing(bx), input(val) {
20  if (input>0x7ff) {
21  std::cout << "[TCCinput] saturated value 0x"
22  << std::hex << input << std::dec
23  << std::endl;
24  input &= 0x7ff;
25  }
26  };
27 
28  int get_energy() const {
29  return input & 0x3ff; //get bits 9:0
30  }
31 
32  int get_fg() const {
33  return input & 0x400; //get bit number 10
34  }
35 
36  bool is_current (int n) const {
37  return (n==bunchCrossing);
38  }
39 
40  bool operator<(const TCCinput &) const;
41 
42  std::ostream& operator<<(std::ostream&);
43 
44 };
45 
46 inline
47 std::ostream& TCCinput::operator<<(std::ostream& os) {
48  os << " tcc input "
49  << " bx:" << bunchCrossing
50  << " tt:" << tower
51  << " raw:0x" << std::hex << input << std::dec
52  << " fg:" << this->get_fg()
53  << " energy:" << this->get_energy()
54  << std::endl;
55  return os;
56 }
57 
58 inline
59 bool TCCinput::operator< (const TCCinput &k) const {
60  return (bunchCrossing < k.bunchCrossing);
61 }
62 
63 #endif
std::ostream & operator<<(std::ostream &)
Definition: TCCinput.h:47
int bunchCrossing
Definition: TCCinput.h:15
int get_fg() const
Definition: TCCinput.h:32
bool operator<(const TCCinput &) const
Definition: TCCinput.h:59
int get_energy() const
Definition: TCCinput.h:28
TCCinput(int tt=0, int bx=0, unsigned val=0x0)
Definition: TCCinput.h:18
int tower
Definition: TCCinput.h:14
unsigned input
Definition: TCCinput.h:16
bool is_current(int n) const
Definition: TCCinput.h:36
tuple cout
Definition: gather_cfg.py:145