CMS 3D CMS Logo

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

#include <TotemT2FramePosition.h>

Inheritance diagram for TotemT2FramePosition:
TotemFramePosition

Public Member Functions

unsigned short getFEDId () const
 recomended getters and setters More...
 
unsigned short getGOHId () const
 
unsigned short getIdxInFiber () const
 
unsigned short getPayload () const
 
unsigned int getRawPosition () const
 the getters and setters below are deprecated More...
 
bool operator< (const TotemT2FramePosition &pos) const
 
bool operator< (const TotemFramePosition &pos) const
 
bool operator== (const TotemT2FramePosition &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 setPayload (unsigned short v)
 
unsigned char setXMLAttribute (const std::string &attribute, const std::string &value, unsigned char &flag)
 
 TotemT2FramePosition (unsigned short SubSystemId, unsigned short TOTFEDId, unsigned short OptoRxId, unsigned short GOHId, unsigned short IdxInFiber, unsigned short payload)
 the preferred constructor More...
 
 TotemT2FramePosition (unsigned int pos=0)
 don't use this constructor unless you have a good reason More...
 
 ~TotemT2FramePosition ()
 
- Public Member Functions inherited from TotemFramePosition
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 Member Functions inherited from TotemFramePosition
static bool checkXMLAttributeFlag (unsigned char flag)
 returns true if all attributes have been set More...
 

Static Public Attributes

static const unsigned int maskPayload = 0x3
 
static const unsigned int offsetPayload = 18
 
- Static Public Attributes inherited from TotemFramePosition
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
 
- Protected Attributes inherited from TotemFramePosition
unsigned int rawPosition
 

Friends

std::ostream & operator<< (std::ostream &s, const TotemT2FramePosition &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  | T2 payload |  FED ID  | GOH ID | index within fiber |
* 

Definition at line 27 of file TotemT2FramePosition.h.

Constructor & Destructor Documentation

◆ TotemT2FramePosition() [1/2]

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

the preferred constructor

Definition at line 32 of file TotemT2FramePosition.h.

38  : rawPosition(IdxInFiber << offsetIdxInFiber | GOHId << offsetGOHId | OptoRxId << offsetOptoRxId |
39  TOTFEDId << offsetTOTFEDId | SubSystemId << offsetSubSystemId | (payload + 1) << offsetPayload) {}
static const unsigned int offsetPayload
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

◆ TotemT2FramePosition() [2/2]

TotemT2FramePosition::TotemT2FramePosition ( unsigned int  pos = 0)
inline

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

Definition at line 42 of file TotemT2FramePosition.h.

◆ ~TotemT2FramePosition()

TotemT2FramePosition::~TotemT2FramePosition ( )
inline

Definition at line 44 of file TotemT2FramePosition.h.

44 {}

Member Function Documentation

◆ checkXMLAttributeFlag()

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

returns true if all attributes have been set

Definition at line 103 of file TotemT2FramePosition.h.

References RemoveAddSevLevel::flag.

103 { return (flag == 0x3f); }

◆ getFEDId()

unsigned short TotemT2FramePosition::getFEDId ( ) const
inline

recomended getters and setters

Definition at line 48 of file TotemT2FramePosition.h.

References TotemFramePosition::maskFEDId, TotemFramePosition::offsetFEDId, and rawPosition.

48 { return (rawPosition >> offsetFEDId) & maskFEDId; }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId

◆ getGOHId()

unsigned short TotemT2FramePosition::getGOHId ( ) const
inline

Definition at line 62 of file TotemT2FramePosition.h.

References TotemFramePosition::maskGOHId, TotemFramePosition::offsetGOHId, and rawPosition.

62 { return (rawPosition >> offsetGOHId) & maskGOHId; }
static const unsigned int maskGOHId
static const unsigned int offsetGOHId

◆ getIdxInFiber()

unsigned short TotemT2FramePosition::getIdxInFiber ( ) const
inline

Definition at line 70 of file TotemT2FramePosition.h.

References TotemFramePosition::maskIdxInFiber, TotemFramePosition::offsetIdxInFiber, and rawPosition.

static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber

◆ getPayload()

unsigned short TotemT2FramePosition::getPayload ( ) const
inline

Definition at line 49 of file TotemT2FramePosition.h.

References maskPayload, offsetPayload, and rawPosition.

49 { return (((rawPosition >> offsetPayload) & maskPayload) - 1); }
static const unsigned int maskPayload
static const unsigned int offsetPayload

◆ getRawPosition()

unsigned int TotemT2FramePosition::getRawPosition ( ) const
inline

the getters and setters below are deprecated

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

Definition at line 81 of file TotemT2FramePosition.h.

References rawPosition.

Referenced by TotemDAQMapping::insert().

81 { return rawPosition; }

◆ operator<() [1/2]

bool TotemT2FramePosition::operator< ( const TotemT2FramePosition pos) const
inline

Definition at line 83 of file TotemT2FramePosition.h.

References rawPosition.

83 { return (rawPosition < pos.rawPosition); }

◆ operator<() [2/2]

bool TotemT2FramePosition::operator< ( const TotemFramePosition pos) const
inline

Definition at line 84 of file TotemT2FramePosition.h.

References rawPosition.

84 { return (rawPosition < pos.getRawPosition()); }

◆ operator==() [1/2]

bool TotemT2FramePosition::operator== ( const TotemT2FramePosition pos) const
inline

Definition at line 86 of file TotemT2FramePosition.h.

References rawPosition.

86 { return (rawPosition == pos.rawPosition); }

◆ operator==() [2/2]

bool TotemT2FramePosition::operator== ( const TotemFramePosition pos) const
inline

Definition at line 87 of file TotemT2FramePosition.h.

References rawPosition.

87 { return (rawPosition == pos.getRawPosition()); }

◆ printXML()

void TotemT2FramePosition::printXML ( )

prints XML formatted DAQ channel to stdout

Definition at line 24 of file TotemT2FramePosition.cc.

References gather_cfg::cout, and conddblib::getPayload().

24  {
25  cout << "\" FEDId=\"" << getFEDId() << "\" GOHId=\"" << getGOHId() << "\" IdxInFiber=\"" << getIdxInFiber()
26  << "\" pay=\"" << getPayload() << "\"";
27 }
unsigned short getGOHId() const
unsigned short getIdxInFiber() const
unsigned short getFEDId() const
recomended getters and setters
unsigned short getPayload() const

◆ setFEDId()

void TotemT2FramePosition::setFEDId ( unsigned short  v)
inline

Definition at line 51 of file TotemT2FramePosition.h.

References TotemFramePosition::maskFEDId, TotemFramePosition::offsetFEDId, rawPosition, and findQualityFiles::v.

51  {
52  v &= maskFEDId;
53  rawPosition &= 0xFFFFFFFF - (maskFEDId << offsetFEDId);
54  rawPosition |= (v << offsetFEDId);
55  }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId

◆ setGOHId()

void TotemT2FramePosition::setGOHId ( unsigned short  v)
inline

Definition at line 64 of file TotemT2FramePosition.h.

References TotemFramePosition::maskGOHId, TotemFramePosition::offsetGOHId, rawPosition, and findQualityFiles::v.

64  {
65  v &= maskGOHId;
66  rawPosition &= 0xFFFFFFFF - (maskGOHId << offsetGOHId);
67  rawPosition |= (v << offsetGOHId);
68  }
static const unsigned int maskGOHId
static const unsigned int offsetGOHId

◆ setIdxInFiber()

void TotemT2FramePosition::setIdxInFiber ( unsigned short  v)
inline

Definition at line 72 of file TotemT2FramePosition.h.

References TotemFramePosition::maskIdxInFiber, TotemFramePosition::offsetIdxInFiber, rawPosition, and findQualityFiles::v.

72  {
73  v &= maskIdxInFiber;
74  rawPosition &= 0xFFFFFFFF - (maskIdxInFiber << offsetIdxInFiber);
76  }
static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber

◆ setPayload()

void TotemT2FramePosition::setPayload ( unsigned short  v)
inline

Definition at line 56 of file TotemT2FramePosition.h.

References maskPayload, offsetPayload, rawPosition, and findQualityFiles::v.

56  {
57  unsigned short av = (v + 1) & maskPayload;
58  rawPosition &= 0xFFFFFFFF - (maskPayload << offsetPayload);
59  rawPosition |= (av << offsetPayload);
60  }
static const unsigned int maskPayload
static const unsigned int offsetPayload

◆ setXMLAttribute()

unsigned char TotemT2FramePosition::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 31 of file TotemT2FramePosition.cc.

References RemoveAddSevLevel::flag, and findQualityFiles::v.

33  {
34  unsigned int v = atoi(value.c_str());
35 
36  if (attribute == "FEDId") {
37  setFEDId(v);
38  flag |= 0x1C; // SubSystem + TOTFED + OptoRx
39  return 0;
40  }
41 
42  if (attribute == "pay") {
43  setPayload(v);
44  flag |= 0x20; //T2 payload
45  return 0;
46  }
47 
48  if (attribute == "GOHId") {
49  setGOHId(v);
50  flag |= 0x2;
51  return 0;
52  }
53 
54  if (attribute == "IdxInFiber") {
56  flag |= 0x1;
57  return 0;
58  }
59 
60  return 1;
61 }
void setGOHId(unsigned short v)
Definition: value.py:1
void setPayload(unsigned short v)
void setIdxInFiber(unsigned short v)
void setFEDId(unsigned short v)

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const TotemT2FramePosition 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 TotemT2FramePosition.cc.

18  {
19  return s << fp.getFEDId() << ":" << fp.getGOHId() << ":" << fp.getIdxInFiber() << ":" << fp.getPayload();
20 }

Member Data Documentation

◆ maskPayload

const unsigned int TotemT2FramePosition::maskPayload = 0x3
static

Definition at line 29 of file TotemT2FramePosition.h.

Referenced by getPayload(), and setPayload().

◆ offsetPayload

const unsigned int TotemT2FramePosition::offsetPayload = 18
static

Definition at line 29 of file TotemT2FramePosition.h.

Referenced by getPayload(), and setPayload().

◆ rawPosition

unsigned int TotemT2FramePosition::rawPosition
protected