CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OmtfName.cc
Go to the documentation of this file.
2 
3 
4 namespace {
5  template <typename T> int sgn(T val) { return (T(0) < val) - (val < T(0)); }
6 }
7 
8 OmtfName::OmtfName(unsigned int iProcesor, int endcap)
9 {
10  int iproc = (iProcesor <=5 ) ? static_cast<int>(iProcesor) : -1;
11  int position = (abs(endcap)==1) ? endcap : 0;
12  theBoard = static_cast<Board>( sgn(position)*(iproc+1) );
13 }
14 
15 OmtfName::OmtfName(unsigned int iProcesor, l1t::tftype endcap)
16 {
17  int iproc = (iProcesor <=5 ) ? static_cast<int>(iProcesor) : -1;
18  int position = (endcap == l1t::omtf_pos ) ? 1 : ( (endcap == l1t::omtf_neg ) ? -1 : 0);
19  theBoard = static_cast<Board>( sgn(position)*(iproc+1) );
20 }
21 
23 {
24  if (board=="OMTFn1") theBoard = OMTFn1;
25  else if (board=="OMTFn2") theBoard = OMTFn2;
26  else if (board=="OMTFn3") theBoard = OMTFn3;
27  else if (board=="OMTFn4") theBoard = OMTFn4;
28  else if (board=="OMTFn5") theBoard = OMTFn5;
29  else if (board=="OMTFn6") theBoard = OMTFn6;
30  else if (board=="OMTFp1") theBoard = OMTFp1;
31  else if (board=="OMTFp2") theBoard = OMTFp2;
32  else if (board=="OMTFp3") theBoard = OMTFp3;
33  else if (board=="OMTFp4") theBoard = OMTFp4;
34  else if (board=="OMTFp5") theBoard = OMTFp5;
35  else if (board=="OMTFp6") theBoard = OMTFp6;
36  else theBoard = OMTFp6;
37 }
38 
40 {
41  switch (theBoard) {
42  case (OMTFn1) : return "OMTFn1";
43  case (OMTFn2) : return "OMTFn2";
44  case (OMTFn3) : return "OMTFn3";
45  case (OMTFn4) : return "OMTFn4";
46  case (OMTFn5) : return "OMTFn5";
47  case (OMTFn6) : return "OMTFn6";
48  case (OMTFp1) : return "OMTFp1";
49  case (OMTFp2) : return "OMTFp2";
50  case (OMTFp3) : return "OMTFp3";
51  case (OMTFp4) : return "OMTFp4";
52  case (OMTFp5) : return "OMTFp5";
53  case (OMTFp6) : return "OMTFp6";
54  default: return "UNKNOWN";
55  }
56 }
57 
58 int OmtfName::position() const { return sgn(theBoard); }
59 
60 unsigned int OmtfName::processor() const { return abs(theBoard)-1; }
61 
63 
Board theBoard
Definition: OmtfName.h:42
l1t::tftype tftype() const
Definition: OmtfName.cc:62
float sgn(float val)
Definition: FWPFMaths.cc:9
unsigned int processor() const
Definition: OmtfName.cc:60
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int position() const
Definition: OmtfName.cc:58
OmtfName(Board board=UNKNOWN)
Definition: OmtfName.h:19
std::string name() const
Definition: OmtfName.cc:39
long double T