CMS 3D CMS Logo

TotemFramePosition.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
10 
11 #include <iomanip>
12 #include <cstdlib>
13 
14 using namespace std;
15 
16 //----------------------------------------------------------------------------------------------------
17 
18 std::ostream& operator << (std::ostream& s, const TotemFramePosition &fp)
19 {
20  return s
21  << fp.getFEDId() << ":"
22  << fp.getGOHId() << ":"
23  << fp.getIdxInFiber();
24 }
25 
26 //----------------------------------------------------------------------------------------------------
27 
29 {
30  cout << "\" FEDId=\"" << getFEDId()
31  << "\" GOHId=\"" << getGOHId()
32  << "\" IdxInFiber=\"" << getIdxInFiber()
33  << "\"";
34 }
35 
36 //----------------------------------------------------------------------------------------------------
37 
38 unsigned char TotemFramePosition::setXMLAttribute(const std::string &attribute, const std::string &value,
39  unsigned char &flag)
40 {
41  unsigned int v = atoi(value.c_str());
42 
43  if (attribute == "FEDId")
44  {
45  setFEDId(v);
46  flag |= 0x1C; // SubSystem + TOTFED + OptoRx
47  return 0;
48  }
49 
50  if (attribute == "SubSystemId")
51  {
52  setSubSystemId(v);
53  flag |= 0x10;
54  return 0;
55  }
56 
57  if (attribute == "TOTFEDId")
58  {
59  setTOTFEDId(v);
60  flag |= 0x8;
61  return 0;
62  }
63 
64  if (attribute == "OptoRxId")
65  {
66  setOptoRxId(v);
67  flag |= 0x4;
68  return 0;
69  }
70 
71  if (attribute == "GOHId")
72  {
73  setGOHId(v);
74  flag |= 0x2;
75  return 0;
76  }
77 
78  if (attribute == "IdxInFiber")
79  {
80  setIdxInFiber(v);
81  flag |= 0x1;
82  return 0;
83  }
84 
85  return 1;
86 }
unsigned short getFEDId() const
recomended getters and setters
unsigned short getIdxInFiber() const
ostream & operator<<(std::ostream &o, vector< std::string > const &iValue)
Definition: refresh.cc:45
void printXML()
prints XML formatted DAQ channel to stdout
Definition: value.py:1
unsigned short getGOHId() const
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag)