test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends
TotemFramePosition Class Reference

#include <TotemFramePosition.h>

Public Types

enum  SubSystemType {
  ssNone =0, ssT1 =1, ssT2 =2, ssRP =3,
  ssTrigger =4, ssTTC =5, ssFEC =6
}
 the official enumeration of DAQ subsystems More...
 

Public Member Functions

unsigned short getFullOptoRxId () const
 
unsigned short getGOHId () const
 
unsigned short getIdxInFiber () const
 
unsigned short getOptoRxId () const
 
unsigned int getRawPosition () const
 don't use this method unless you have a good reason More...
 
unsigned short getSubSystemId () const
 
unsigned short getTOTFEDId () const
 
bool operator< (const TotemFramePosition &pos) const
 
bool operator== (const TotemFramePosition &pos) const
 
void printXML ()
 prints XML formatted DAQ channel to stdout More...
 
void setAllIDs (unsigned short SubSystemId, unsigned short TOTFEDId, unsigned short OptoRxId, unsigned short GOHId, unsigned short IdxInFiber)
 
void setGOHId (unsigned short v)
 
void setIdxInFiber (unsigned short v)
 
void setOptoRxId (unsigned short v)
 
void setSubSystemId (unsigned short v)
 
void setTOTFEDId (unsigned short v)
 
unsigned char setXMLAttribute (const std::string &attribute, const std::string &value, unsigned char &flag)
 
 TotemFramePosition (unsigned short SubSystemId, unsigned short TOTFEDId, unsigned short OptoRxId, unsigned short GOHId, unsigned short IdxInFiber)
 the preferred constructor More...
 
 TotemFramePosition (unsigned int pos=0)
 don't use this constructor unless you have a good reason More...
 
 ~TotemFramePosition ()
 

Static Public Member Functions

static bool checkXMLAttributeFlag (unsigned char flag)
 returns true if all attributes have been set More...
 

Static Public Attributes

static const unsigned int maskGOHId = 0xF
 
static const unsigned int maskIdxInFiber = 0xF
 
static const unsigned int maskOptoRxId = 0x3
 
static const unsigned int maskSubSystemId = 0x7
 
static const unsigned int maskTOTFEDId = 0x1F
 
static const unsigned int offsetGOHId = 4
 
static const unsigned int offsetIdxInFiber = 0
 
static const unsigned int offsetOptoRxId = 8
 
static const unsigned int offsetSubSystemId = 15
 
static const unsigned int offsetTOTFEDId = 10
 
static const std::string tagSSFEC = "FEC"
 
static const std::string tagSSNone = "None"
 XML sub-system tags. More...
 
static const std::string tagSSRP = "RP"
 
static const std::string tagSST1 = "T1"
 
static const std::string tagSST2 = "T2"
 
static const std::string tagSSTrigger = "Trigger"
 
static const std::string tagSSTTC = "TTC"
 

Protected Attributes

unsigned int rawPosition
 

Friends

std::ostream & operator<< (std::ostream &s, const TotemFramePosition &fp)
 

Detailed Description

Uniquely identifies the DAQ channel through which a VFAT frame has been received.

The internal representation has the following structure:

* |                               32 bits raw position                                 |
* | 12 bits | 2 bits |  3 bits   |  5 bits   |  2 bits   | 4 bits |       4 bits       |
* |  empty  | empty  | SubSystem | TOTFED ID | OptoRx ID | GOH ID | index within fiber |
* |         |   (this part is encoded in OptoRx header)  |                             |
* 

According to the convention SubSystemId goes from 1 to 6, TOTFEDId from 1 to 21 and OptoRx from 1 to 3.

Definition at line 27 of file TotemFramePosition.h.

Member Enumeration Documentation

the official enumeration of DAQ subsystems

Enumerator
ssNone 
ssT1 
ssT2 
ssRP 
ssTrigger 
ssTTC 
ssFEC 

Definition at line 31 of file TotemFramePosition.h.

Constructor & Destructor Documentation

TotemFramePosition::TotemFramePosition ( unsigned short  SubSystemId,
unsigned short  TOTFEDId,
unsigned short  OptoRxId,
unsigned short  GOHId,
unsigned short  IdxInFiber 
)
inline

the preferred constructor

Definition at line 40 of file TotemFramePosition.h.

40  :
41  rawPosition(IdxInFiber<<offsetIdxInFiber | GOHId<<offsetGOHId | OptoRxId<<offsetOptoRxId | TOTFEDId<<offsetTOTFEDId | SubSystemId<<offsetSubSystemId)
42  {
43  }
static const unsigned int offsetSubSystemId
static const unsigned int offsetIdxInFiber
static const unsigned int offsetOptoRxId
static const unsigned int offsetTOTFEDId
static const unsigned int offsetGOHId
TotemFramePosition::TotemFramePosition ( unsigned int  pos = 0)
inline

don't use this constructor unless you have a good reason

Definition at line 46 of file TotemFramePosition.h.

46  : rawPosition(pos)
47  {
48  }
TotemFramePosition::~TotemFramePosition ( )
inline

Definition at line 50 of file TotemFramePosition.h.

51  {
52  }

Member Function Documentation

static bool TotemFramePosition::checkXMLAttributeFlag ( unsigned char  flag)
inlinestatic

returns true if all attributes have been set

Definition at line 121 of file TotemFramePosition.h.

Referenced by TotemDAQMappingESSourceXML::ChipFramePosition().

122  {
123  return ((flag == 0x1f) | (flag == 0x20) | (flag == 0x40));
124  }
unsigned short TotemFramePosition::getFullOptoRxId ( ) const
inline

Definition at line 126 of file TotemFramePosition.h.

References rawPosition.

127  {
128  return (rawPosition >> 8) & 0xFFF;
129  }
unsigned short TotemFramePosition::getGOHId ( ) const
inline

Definition at line 57 of file TotemFramePosition.h.

References maskGOHId, offsetGOHId, and rawPosition.

Referenced by operator<<().

57 { return (rawPosition >> offsetGOHId) & maskGOHId; }
static const unsigned int maskGOHId
static const unsigned int offsetGOHId
unsigned short TotemFramePosition::getIdxInFiber ( ) const
inline

Definition at line 58 of file TotemFramePosition.h.

References maskIdxInFiber, offsetIdxInFiber, and rawPosition.

Referenced by operator<<().

static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber
unsigned short TotemFramePosition::getOptoRxId ( ) const
inline

Definition at line 56 of file TotemFramePosition.h.

References maskOptoRxId, offsetOptoRxId, and rawPosition.

Referenced by operator<<().

56 { return (rawPosition >> offsetOptoRxId) & maskOptoRxId; }
static const unsigned int offsetOptoRxId
static const unsigned int maskOptoRxId
unsigned int TotemFramePosition::getRawPosition ( ) const
inline

don't use this method unless you have a good reason

Definition at line 82 of file TotemFramePosition.h.

References rawPosition.

83  {
84  return rawPosition;
85  }
unsigned short TotemFramePosition::getSubSystemId ( ) const
inline

Definition at line 54 of file TotemFramePosition.h.

References maskSubSystemId, offsetSubSystemId, and rawPosition.

Referenced by operator<<().

static const unsigned int offsetSubSystemId
static const unsigned int maskSubSystemId
unsigned short TotemFramePosition::getTOTFEDId ( ) const
inline

Definition at line 55 of file TotemFramePosition.h.

References maskTOTFEDId, offsetTOTFEDId, and rawPosition.

Referenced by operator<<().

55 { return (rawPosition >> offsetTOTFEDId) & maskTOTFEDId;}
static const unsigned int maskTOTFEDId
static const unsigned int offsetTOTFEDId
bool TotemFramePosition::operator< ( const TotemFramePosition pos) const
inline

Definition at line 88 of file TotemFramePosition.h.

References rawPosition.

89  {
90  return (rawPosition < pos.rawPosition);
91  }
bool TotemFramePosition::operator== ( const TotemFramePosition pos) const
inline

Definition at line 93 of file TotemFramePosition.h.

References rawPosition.

94  {
95  return (rawPosition == pos.rawPosition);
96  }
void TotemFramePosition::printXML ( )

prints XML formatted DAQ channel to stdout

Definition at line 40 of file TotemFramePosition.cc.

References gather_cfg::cout, TauDecayModes::dec, and contentValuesCheck::ss.

41 {
42  cout << dec << "SubSystemId=\"";
43 
44  const unsigned char &ss = getSubSystemId();
45  switch (ss)
46  {
47  case ssT1: cout << "T1"; break;
48  case ssT2: cout << "T2"; break;
49  case ssRP: cout << "RP"; break;
50  case ssTrigger: cout << "Trigger"; break;
51  case ssTTC: cout << "TTC"; break;
52  case ssFEC: cout << "FEC"; break;
53  default: cout << "None";
54  }
55 
56  cout << "\" TOTFEDId=\"" << getTOTFEDId()
57  << "\" OptoRxId=\"" << getOptoRxId()
58  << "\" GOHId=\"" << getGOHId()
59  << "\" IdxInFiber=\"" << getIdxInFiber()
60  << "\"";
61 }
unsigned short getIdxInFiber() const
unsigned short getTOTFEDId() const
unsigned short getOptoRxId() const
unsigned short getSubSystemId() const
unsigned short getGOHId() const
tuple cout
Definition: gather_cfg.py:145
void TotemFramePosition::setAllIDs ( unsigned short  SubSystemId,
unsigned short  TOTFEDId,
unsigned short  OptoRxId,
unsigned short  GOHId,
unsigned short  IdxInFiber 
)
inline

Definition at line 75 of file TotemFramePosition.h.

References offsetGOHId, offsetIdxInFiber, offsetOptoRxId, offsetSubSystemId, offsetTOTFEDId, and rawPosition.

76  {
77  rawPosition = (IdxInFiber<<offsetIdxInFiber | GOHId<<offsetGOHId | OptoRxId<<offsetOptoRxId
78  | TOTFEDId<<offsetTOTFEDId | SubSystemId<<offsetSubSystemId);
79  }
static const unsigned int offsetSubSystemId
static const unsigned int offsetIdxInFiber
static const unsigned int offsetOptoRxId
static const unsigned int offsetTOTFEDId
static const unsigned int offsetGOHId
void TotemFramePosition::setGOHId ( unsigned short  v)
inline

Definition at line 69 of file TotemFramePosition.h.

References maskGOHId, offsetGOHId, and rawPosition.

70  { v &= maskGOHId; rawPosition &= 0xFFFFFFFF - (maskGOHId << offsetGOHId); rawPosition |= (v << offsetGOHId); }
static const unsigned int maskGOHId
static const unsigned int offsetGOHId
void TotemFramePosition::setIdxInFiber ( unsigned short  v)
inline

Definition at line 72 of file TotemFramePosition.h.

References maskIdxInFiber, offsetIdxInFiber, and rawPosition.

static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber
void TotemFramePosition::setOptoRxId ( unsigned short  v)
inline

Definition at line 66 of file TotemFramePosition.h.

References maskOptoRxId, offsetOptoRxId, and rawPosition.

67  { v &= maskOptoRxId; rawPosition &= 0xFFFFFFFF - (maskOptoRxId << offsetOptoRxId); rawPosition |= (v << offsetOptoRxId); }
static const unsigned int offsetOptoRxId
static const unsigned int maskOptoRxId
void TotemFramePosition::setSubSystemId ( unsigned short  v)
inline

Definition at line 60 of file TotemFramePosition.h.

References maskSubSystemId, offsetSubSystemId, and rawPosition.

static const unsigned int offsetSubSystemId
static const unsigned int maskSubSystemId
void TotemFramePosition::setTOTFEDId ( unsigned short  v)
inline

Definition at line 63 of file TotemFramePosition.h.

References maskTOTFEDId, offsetTOTFEDId, and rawPosition.

64  { v &= maskTOTFEDId; rawPosition &= 0xFFFFFFFF - (maskTOTFEDId << offsetTOTFEDId); rawPosition |= (v << offsetTOTFEDId); }
static const unsigned int maskTOTFEDId
static const unsigned int offsetTOTFEDId
unsigned char TotemFramePosition::setXMLAttribute ( const std::string &  attribute,
const std::string &  value,
unsigned char &  flag 
)

Sets attribute with XML name 'attribute' and value 'value'. Also turns on attribute presents bit in the flag parameter returns 0 if the attribute is known, non-zero value else

Definition at line 65 of file TotemFramePosition.cc.

References NULL, contentValuesCheck::ss, and findQualityFiles::v.

Referenced by TotemDAQMappingESSourceXML::ChipFramePosition().

67 {
68  if (attribute == "DAQPosition")
69  {
70  size_t dd1 = value.find(':', 0);
71  size_t dd2 = value.find(':', dd1+1);
72  size_t dd3 = value.find(':', dd2+1);
73  size_t dd4 = value.find(':', dd3+1);
74  size_t dd5 = value.find(':', dd4+1);
75 
76  if (dd1 == string::npos || dd2 == string::npos || dd3 == string::npos || dd4 == string::npos ||
77  dd5 != string::npos)
78  return 3;
79 
80  unsigned short ss = strtol(value.substr(0, dd1).c_str(), NULL, 16);
81  unsigned short ti = strtol(value.substr(dd1+1, dd2-dd1).c_str(), NULL, 16);
82  unsigned short oi = strtol(value.substr(dd2+1, dd3-dd2).c_str(), NULL, 16);
83  unsigned short gi = strtol(value.substr(dd3+1, dd4-dd3).c_str(), NULL, 16);
84  unsigned short fi = strtol(value.substr(dd4+1).c_str(), NULL, 16);
85 
86  setAllIDs(ss, ti, oi, gi, fi);
87  flag |= 0x40;
88  return 0;
89  }
90 
91  unsigned int v = atoi(value.c_str());
92 
93  if (attribute == "SubSystemId")
94  {
96  else if (value == tagSST1) setSubSystemId(ssT1);
97  else if (value == tagSST2) setSubSystemId(ssT2);
98  else if (value == tagSSRP) setSubSystemId(ssRP);
100  else if (value == tagSSTTC) setSubSystemId(ssTTC);
101  else if (value == tagSSFEC) setSubSystemId(ssFEC);
102  else setSubSystemId(v);
103 
104  flag |= 0x10;
105  return 0;
106  }
107 
108  if (attribute == "TOTFEDId")
109  {
110  setTOTFEDId(v);
111  flag |= 0x8;
112  return 0;
113  }
114 
115  if (attribute == "OptoRxId")
116  {
117  setOptoRxId(v);
118  flag |= 0x4;
119  return 0;
120  }
121 
122  if (attribute == "GOHId")
123  {
124  setGOHId(v);
125  flag |= 0x2;
126  return 0;
127  }
128 
129  if (attribute == "IdxInFiber")
130  {
131  setIdxInFiber(v);
132  flag |= 0x1;
133  return 0;
134  }
135 
136  return 1;
137 }
static const std::string tagSSTrigger
void setIdxInFiber(unsigned short v)
static const std::string tagSST2
void setGOHId(unsigned short v)
void setOptoRxId(unsigned short v)
#define NULL
Definition: scimark2.h:8
void setTOTFEDId(unsigned short v)
static const std::string tagSST1
void setSubSystemId(unsigned short v)
static const std::string tagSSRP
static const std::string tagSSFEC
static const std::string tagSSNone
XML sub-system tags.
void setAllIDs(unsigned short SubSystemId, unsigned short TOTFEDId, unsigned short OptoRxId, unsigned short GOHId, unsigned short IdxInFiber)
static const std::string tagSSTTC

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const TotemFramePosition fp 
)
friend

Condensed representation of the DAQ channel. prints 5-digit hex number, the digits correspond to SubSystem, TOTFED ID, OptoRx ID, GOH ID, index within fiber in this order

Definition at line 26 of file TotemFramePosition.cc.

27 {
28  return s << std::hex
29  << fp.getSubSystemId() << ":"
30  << std::setw(2) << std::setfill('0')
31  << fp.getTOTFEDId() << ":"
32  << fp.getOptoRxId() << ":"
33  << fp.getGOHId() << ":"
34  << fp.getIdxInFiber()
35  << std::dec;
36 }
unsigned short getIdxInFiber() const
unsigned short getTOTFEDId() const
unsigned short getOptoRxId() const
unsigned short getSubSystemId() const
unsigned short getGOHId() const

Member Data Documentation

const unsigned int TotemFramePosition::maskGOHId = 0xF
static

Definition at line 34 of file TotemFramePosition.h.

Referenced by getGOHId(), and setGOHId().

const unsigned int TotemFramePosition::maskIdxInFiber = 0xF
static

Definition at line 33 of file TotemFramePosition.h.

Referenced by getIdxInFiber(), and setIdxInFiber().

const unsigned int TotemFramePosition::maskOptoRxId = 0x3
static

Definition at line 35 of file TotemFramePosition.h.

Referenced by getOptoRxId(), and setOptoRxId().

const unsigned int TotemFramePosition::maskSubSystemId = 0x7
static

Definition at line 37 of file TotemFramePosition.h.

Referenced by getSubSystemId(), and setSubSystemId().

const unsigned int TotemFramePosition::maskTOTFEDId = 0x1F
static

Definition at line 36 of file TotemFramePosition.h.

Referenced by getTOTFEDId(), and setTOTFEDId().

const unsigned int TotemFramePosition::offsetGOHId = 4
static

Definition at line 34 of file TotemFramePosition.h.

Referenced by getGOHId(), setAllIDs(), and setGOHId().

const unsigned int TotemFramePosition::offsetIdxInFiber = 0
static

Definition at line 33 of file TotemFramePosition.h.

Referenced by getIdxInFiber(), setAllIDs(), and setIdxInFiber().

const unsigned int TotemFramePosition::offsetOptoRxId = 8
static

Definition at line 35 of file TotemFramePosition.h.

Referenced by getOptoRxId(), setAllIDs(), and setOptoRxId().

const unsigned int TotemFramePosition::offsetSubSystemId = 15
static

Definition at line 37 of file TotemFramePosition.h.

Referenced by getSubSystemId(), setAllIDs(), and setSubSystemId().

const unsigned int TotemFramePosition::offsetTOTFEDId = 10
static

Definition at line 36 of file TotemFramePosition.h.

Referenced by getTOTFEDId(), setAllIDs(), and setTOTFEDId().

unsigned int TotemFramePosition::rawPosition
protected
const string TotemFramePosition::tagSSFEC = "FEC"
static

Definition at line 110 of file TotemFramePosition.h.

const string TotemFramePosition::tagSSNone = "None"
static

XML sub-system tags.

Definition at line 104 of file TotemFramePosition.h.

const string TotemFramePosition::tagSSRP = "RP"
static

Definition at line 108 of file TotemFramePosition.h.

const string TotemFramePosition::tagSST1 = "T1"
static

Definition at line 106 of file TotemFramePosition.h.

const string TotemFramePosition::tagSST2 = "T2"
static

Definition at line 107 of file TotemFramePosition.h.

const string TotemFramePosition::tagSSTrigger = "Trigger"
static

Definition at line 105 of file TotemFramePosition.h.

const string TotemFramePosition::tagSSTTC = "TTC"
static

Definition at line 109 of file TotemFramePosition.h.