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 43 of file TotemFramePosition.h.

48  : rawPosition(IdxInFiber << offsetIdxInFiber | GOHId << offsetGOHId | OptoRxId << offsetOptoRxId |
49  TOTFEDId << offsetTOTFEDId | SubSystemId << offsetSubSystemId) {}
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 52 of file TotemFramePosition.h.

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

Definition at line 54 of file TotemFramePosition.h.

54 {}

Member Function Documentation

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

returns true if all attributes have been set

Definition at line 129 of file TotemFramePosition.h.

Referenced by TotemDAQMappingESSourceXML::ChipFramePosition().

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

recomended getters and setters

Definition at line 58 of file TotemFramePosition.h.

References maskFEDId, and rawPosition.

Referenced by operator<<().

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

Definition at line 66 of file TotemFramePosition.h.

References maskGOHId, and rawPosition.

Referenced by operator<<(), and RawToDigiConverter::run().

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

Definition at line 74 of file TotemFramePosition.h.

References maskIdxInFiber, and rawPosition.

Referenced by operator<<(), and RawToDigiConverter::run().

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

Definition at line 100 of file TotemFramePosition.h.

References maskOptoRxId, and rawPosition.

Referenced by RawToDigiConverter::run().

100 { 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 109 of file TotemFramePosition.h.

References rawPosition.

109 { return rawPosition; }
unsigned short TotemFramePosition::getSubSystemId ( ) const
inline

the getters and setters below are deprecated

Definition at line 84 of file TotemFramePosition.h.

References maskSubSystemId, and rawPosition.

Referenced by RawToDigiConverter::run().

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

Definition at line 92 of file TotemFramePosition.h.

References maskTOTFEDId, and rawPosition.

Referenced by RawToDigiConverter::run().

92 { 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 111 of file TotemFramePosition.h.

References rawPosition.

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

prints XML formatted DAQ channel to stdout

Definition at line 24 of file TotemFramePosition.cc.

References gather_cfg::cout.

Referenced by operator==().

24  {
25  cout << "\" FEDId=\"" << getFEDId() << "\" GOHId=\"" << getGOHId() << "\" IdxInFiber=\"" << getIdxInFiber() << "\"";
26 }
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 60 of file TotemFramePosition.h.

References maskFEDId, offsetFEDId, and rawPosition.

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

Definition at line 68 of file TotemFramePosition.h.

References maskGOHId, offsetGOHId, and rawPosition.

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

Definition at line 76 of file TotemFramePosition.h.

References maskIdxInFiber, offsetIdxInFiber, and rawPosition.

76  {
77  v &= maskIdxInFiber;
78  rawPosition &= 0xFFFFFFFF - (maskIdxInFiber << offsetIdxInFiber);
80  }
static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber
void TotemFramePosition::setOptoRxId ( unsigned short  v)
inline

Definition at line 102 of file TotemFramePosition.h.

References maskOptoRxId, offsetOptoRxId, and rawPosition.

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

Definition at line 86 of file TotemFramePosition.h.

References maskSubSystemId, offsetSubSystemId, and rawPosition.

86  {
87  v &= maskSubSystemId;
88  rawPosition &= 0xFFFFFFFF - (maskSubSystemId << offsetSubSystemId);
90  }
static const unsigned int offsetSubSystemId
static const unsigned int maskSubSystemId
void TotemFramePosition::setTOTFEDId ( unsigned short  v)
inline

Definition at line 94 of file TotemFramePosition.h.

References maskTOTFEDId, offsetTOTFEDId, and rawPosition.

94  {
95  v &= maskTOTFEDId;
96  rawPosition &= 0xFFFFFFFF - (maskTOTFEDId << offsetTOTFEDId);
98  }
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 30 of file TotemFramePosition.cc.

References findQualityFiles::v.

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

32  {
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 }
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==().

18  {
19  return s << fp.getFEDId() << ":" << fp.getGOHId() << ":" << fp.getIdxInFiber();
20 }
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 36 of file TotemFramePosition.h.

Referenced by getFEDId(), and setFEDId().

const unsigned int TotemFramePosition::maskGOHId = 0xF
static

Definition at line 35 of file TotemFramePosition.h.

Referenced by getGOHId(), and setGOHId().

const unsigned int TotemFramePosition::maskIdxInFiber = 0xF
static

Definition at line 34 of file TotemFramePosition.h.

Referenced by getIdxInFiber(), and setIdxInFiber().

const unsigned int TotemFramePosition::maskOptoRxId = 0x3
static

Definition at line 38 of file TotemFramePosition.h.

Referenced by getOptoRxId(), and setOptoRxId().

const unsigned int TotemFramePosition::maskSubSystemId = 0x7
static

Definition at line 40 of file TotemFramePosition.h.

Referenced by getSubSystemId(), and setSubSystemId().

const unsigned int TotemFramePosition::maskTOTFEDId = 0x1F
static

Definition at line 39 of file TotemFramePosition.h.

Referenced by getTOTFEDId(), and setTOTFEDId().

const unsigned int TotemFramePosition::offsetFEDId = 8
static

Definition at line 36 of file TotemFramePosition.h.

Referenced by setFEDId().

const unsigned int TotemFramePosition::offsetGOHId = 4
static

Definition at line 35 of file TotemFramePosition.h.

Referenced by setGOHId().

const unsigned int TotemFramePosition::offsetIdxInFiber = 0
static

Definition at line 34 of file TotemFramePosition.h.

Referenced by setIdxInFiber().

const unsigned int TotemFramePosition::offsetOptoRxId = 8
static

Definition at line 38 of file TotemFramePosition.h.

Referenced by setOptoRxId().

const unsigned int TotemFramePosition::offsetSubSystemId = 15
static

Definition at line 40 of file TotemFramePosition.h.

Referenced by setSubSystemId().

const unsigned int TotemFramePosition::offsetTOTFEDId = 10
static

Definition at line 39 of file TotemFramePosition.h.

Referenced by setTOTFEDId().

unsigned int TotemFramePosition::rawPosition
protected