CMS 3D CMS Logo

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  int tower; // tower number in SM
15  unsigned input; // 11 bit value input (10 energy, 1 fg)
16 
17  TCCinput(int tt = 0, int bx = 0, unsigned val = 0x0) : tower(tt), bunchCrossing(bx), input(val) {
18  if (input > 0x7ff) {
19  std::cout << "[TCCinput] saturated value 0x" << std::hex << input << std::dec << std::endl;
20  input &= 0x7ff;
21  }
22  };
23 
24  int get_energy() const {
25  return input & 0x3ff; // get bits 9:0
26  }
27 
28  int get_fg() const {
29  return input & 0x400; // get bit number 10
30  }
31 
32  bool is_current(int n) const { return (n == bunchCrossing); }
33 
34  bool operator<(const TCCinput &) const;
35 
36  std::ostream &operator<<(std::ostream &);
37 };
38 
39 inline std::ostream &TCCinput::operator<<(std::ostream &os) {
40  os << " tcc input "
41  << " bx:" << bunchCrossing << " tt:" << tower << " raw:0x" << std::hex << input << std::dec
42  << " fg:" << this->get_fg() << " energy:" << this->get_energy() << std::endl;
43  return os;
44 }
45 
46 inline bool TCCinput::operator<(const TCCinput &k) const { return (bunchCrossing < k.bunchCrossing); }
47 
48 #endif
std::ostream & operator<<(std::ostream &)
Definition: TCCinput.h:39
int bunchCrossing
Definition: TCCinput.h:14
int get_fg() const
Definition: TCCinput.h:28
bool operator<(const TCCinput &) const
Definition: TCCinput.h:46
int get_energy() const
Definition: TCCinput.h:24
TCCinput(int tt=0, int bx=0, unsigned val=0x0)
Definition: TCCinput.h:17
int k[5][pyjets_maxn]
int tower
Definition: TCCinput.h:13
unsigned input
Definition: TCCinput.h:15
bool is_current(int n) const
Definition: TCCinput.h:32