CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends
TotemFramePosition Class Reference

#include <TotemFramePosition.h>

Public Member Functions

unsigned short getFEDId () const
 recomended getters and setters More...
 
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
 the getters and setters below are deprecated More...
 
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 setFEDId (unsigned short v)
 
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 maskFEDId = 0x3FF
 
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 offsetFEDId = 8
 
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
 

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 |  10 bits | 4 bits |       4 bits       |
* |  empty  | empty  |  FED ID  | GOH ID | index within fiber |
* 

In the old (TOTEM only) scheme, the FED ID was further split

* |  3 bits   |  5 bits   |  2 bits   |
* | SubSystem | TOTFED ID | OptoRx ID |
* 

IMPORTANT: This splitting is only supported for backward compatibility and should not be used anymore.

Definition at line 32 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 44 of file TotemFramePosition.h.

44  :
45  rawPosition(IdxInFiber<<offsetIdxInFiber | GOHId<<offsetGOHId | OptoRxId<<offsetOptoRxId | TOTFEDId<<offsetTOTFEDId | SubSystemId<<offsetSubSystemId)
46  {
47  }
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 50 of file TotemFramePosition.h.

50  : rawPosition(pos)
51  {
52  }
TotemFramePosition::~TotemFramePosition ( )
inline

Definition at line 54 of file TotemFramePosition.h.

55  {
56  }

Member Function Documentation

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

returns true if all attributes have been set

Definition at line 126 of file TotemFramePosition.h.

Referenced by TotemDAQMappingESSourceXML::ChipFramePosition().

127  {
128  return (flag == 0x1f);
129  }
unsigned short TotemFramePosition::getFEDId ( ) const
inline

recomended getters and setters

Definition at line 60 of file TotemFramePosition.h.

References maskFEDId, and rawPosition.

Referenced by operator<<().

61  {
62  return (rawPosition >> offsetFEDId) & maskFEDId;
63  }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId
unsigned short TotemFramePosition::getGOHId ( ) const
inline

Definition at line 68 of file TotemFramePosition.h.

References maskGOHId, and rawPosition.

Referenced by operator<<().

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

Definition at line 73 of file TotemFramePosition.h.

References maskIdxInFiber, and rawPosition.

Referenced by operator<<().

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

Definition at line 91 of file TotemFramePosition.h.

References maskOptoRxId, and rawPosition.

91 { 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 97 of file TotemFramePosition.h.

References rawPosition.

98  {
99  return rawPosition;
100  }
unsigned short TotemFramePosition::getSubSystemId ( ) const
inline

the getters and setters below are deprecated

Definition at line 81 of file TotemFramePosition.h.

References maskSubSystemId, and rawPosition.

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

Definition at line 86 of file TotemFramePosition.h.

References maskTOTFEDId, and rawPosition.

86 { 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 102 of file TotemFramePosition.h.

References rawPosition.

103  {
104  return (rawPosition < pos.rawPosition);
105  }
bool TotemFramePosition::operator== ( const TotemFramePosition pos) const
inline
void TotemFramePosition::printXML ( )

prints XML formatted DAQ channel to stdout

Definition at line 28 of file TotemFramePosition.cc.

References gather_cfg::cout.

Referenced by operator==().

29 {
30  cout << "\" FEDId=\"" << getFEDId()
31  << "\" GOHId=\"" << getGOHId()
32  << "\" IdxInFiber=\"" << getIdxInFiber()
33  << "\"";
34 }
unsigned short getFEDId() const
recomended getters and setters
unsigned short getIdxInFiber() const
unsigned short getGOHId() const
void TotemFramePosition::setFEDId ( unsigned short  v)
inline

Definition at line 65 of file TotemFramePosition.h.

References maskFEDId, offsetFEDId, and rawPosition.

66  { v &= maskFEDId; rawPosition &= 0xFFFFFFFF - (maskFEDId << offsetFEDId); rawPosition |= (v << offsetFEDId); }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId
void TotemFramePosition::setGOHId ( unsigned short  v)
inline

Definition at line 70 of file TotemFramePosition.h.

References maskGOHId, offsetGOHId, and rawPosition.

71  { 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 75 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 93 of file TotemFramePosition.h.

References maskOptoRxId, offsetOptoRxId, and rawPosition.

94  { 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 83 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 88 of file TotemFramePosition.h.

References maskTOTFEDId, offsetTOTFEDId, and rawPosition.

89  { 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 38 of file TotemFramePosition.cc.

References findQualityFiles::v.

Referenced by TotemDAQMappingESSourceXML::ChipFramePosition(), and operator==().

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 }
void setIdxInFiber(unsigned short v)
void setGOHId(unsigned short v)
void setOptoRxId(unsigned short v)
void setTOTFEDId(unsigned short v)
void setSubSystemId(unsigned short v)
Definition: value.py:1
void setFEDId(unsigned short v)

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 18 of file TotemFramePosition.cc.

Referenced by operator==().

19 {
20  return s
21  << fp.getFEDId() << ":"
22  << fp.getGOHId() << ":"
23  << fp.getIdxInFiber();
24 }
unsigned short getFEDId() const
recomended getters and setters
unsigned short getIdxInFiber() const
unsigned short getGOHId() const

Member Data Documentation

const unsigned int TotemFramePosition::maskFEDId = 0x3FF
static

Definition at line 37 of file TotemFramePosition.h.

Referenced by getFEDId(), and setFEDId().

const unsigned int TotemFramePosition::maskGOHId = 0xF
static

Definition at line 36 of file TotemFramePosition.h.

Referenced by getGOHId(), and setGOHId().

const unsigned int TotemFramePosition::maskIdxInFiber = 0xF
static

Definition at line 35 of file TotemFramePosition.h.

Referenced by getIdxInFiber(), and setIdxInFiber().

const unsigned int TotemFramePosition::maskOptoRxId = 0x3
static

Definition at line 39 of file TotemFramePosition.h.

Referenced by getOptoRxId(), and setOptoRxId().

const unsigned int TotemFramePosition::maskSubSystemId = 0x7
static

Definition at line 41 of file TotemFramePosition.h.

Referenced by getSubSystemId(), and setSubSystemId().

const unsigned int TotemFramePosition::maskTOTFEDId = 0x1F
static

Definition at line 40 of file TotemFramePosition.h.

Referenced by getTOTFEDId(), and setTOTFEDId().

const unsigned int TotemFramePosition::offsetFEDId = 8
static

Definition at line 37 of file TotemFramePosition.h.

Referenced by setFEDId().

const unsigned int TotemFramePosition::offsetGOHId = 4
static

Definition at line 36 of file TotemFramePosition.h.

Referenced by setGOHId().

const unsigned int TotemFramePosition::offsetIdxInFiber = 0
static

Definition at line 35 of file TotemFramePosition.h.

Referenced by setIdxInFiber().

const unsigned int TotemFramePosition::offsetOptoRxId = 8
static

Definition at line 39 of file TotemFramePosition.h.

Referenced by setOptoRxId().

const unsigned int TotemFramePosition::offsetSubSystemId = 15
static

Definition at line 41 of file TotemFramePosition.h.

Referenced by setSubSystemId().

const unsigned int TotemFramePosition::offsetTOTFEDId = 10
static

Definition at line 40 of file TotemFramePosition.h.

Referenced by setTOTFEDId().

unsigned int TotemFramePosition::rawPosition
protected