CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  return s << fp.getFEDId() << ":" << fp.getGOHId() << ":" << fp.getIdxInFiber();
20 }
21 
22 //----------------------------------------------------------------------------------------------------
23 
25  cout << "\" FEDId=\"" << getFEDId() << "\" GOHId=\"" << getGOHId() << "\" IdxInFiber=\"" << getIdxInFiber() << "\"";
26 }
27 
28 //----------------------------------------------------------------------------------------------------
29 
30 unsigned char TotemFramePosition::setXMLAttribute(const std::string &attribute,
31  const std::string &value,
32  unsigned char &flag) {
33  unsigned int v = atoi(value.c_str());
34 
35  if (attribute == "FEDId") {
36  setFEDId(v);
37  flag |= 0x1C; // SubSystem + TOTFED + OptoRx
38  return 0;
39  }
40 
41  if (attribute == "SubSystemId") {
42  setSubSystemId(v);
43  flag |= 0x10;
44  return 0;
45  }
46 
47  if (attribute == "TOTFEDId") {
48  setTOTFEDId(v);
49  flag |= 0x8;
50  return 0;
51  }
52 
53  if (attribute == "OptoRxId") {
54  setOptoRxId(v);
55  flag |= 0x4;
56  return 0;
57  }
58 
59  if (attribute == "GOHId") {
60  setGOHId(v);
61  flag |= 0x2;
62  return 0;
63  }
64 
65  if (attribute == "IdxInFiber") {
66  setIdxInFiber(v);
67  flag |= 0x1;
68  return 0;
69  }
70 
71  return 1;
72 }
std::ostream & operator<<(std::ostream &out, const std::tuple< Types...> &value)
Definition: Utilities.h:32
unsigned short getFEDId() const
recomended getters and setters
unsigned short getIdxInFiber() const
void printXML()
prints XML formatted DAQ channel to stdout
unsigned short getGOHId() const
tuple cout
Definition: gather_cfg.py:144
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag)