CMS 3D CMS Logo

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

#include <TotemFramePosition.h>

Inheritance diagram for TotemFramePosition:
TotemT2FramePosition

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
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
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 33 of file TotemFramePosition.h.

Constructor & Destructor Documentation

◆ TotemFramePosition() [1/2]

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.

49  : rawPosition(IdxInFiber << offsetIdxInFiber | GOHId << offsetGOHId | OptoRxId << offsetOptoRxId |
50  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() [2/2]

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

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

Definition at line 53 of file TotemFramePosition.h.

53 : rawPosition(pos) {}

◆ ~TotemFramePosition()

TotemFramePosition::~TotemFramePosition ( )
inline

Definition at line 55 of file TotemFramePosition.h.

55 {}

Member Function Documentation

◆ checkXMLAttributeFlag()

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

returns true if all attributes have been set

Definition at line 130 of file TotemFramePosition.h.

References RemoveAddSevLevel::flag.

130 { return (flag == 0x1f); }

◆ getFEDId()

unsigned short TotemFramePosition::getFEDId ( ) const
inline

recomended getters and setters

Definition at line 59 of file TotemFramePosition.h.

References maskFEDId, offsetFEDId, and rawPosition.

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

◆ getGOHId()

unsigned short TotemFramePosition::getGOHId ( ) const
inline

Definition at line 67 of file TotemFramePosition.h.

References maskGOHId, offsetGOHId, and rawPosition.

Referenced by RawToDigiConverter::run().

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

◆ getIdxInFiber()

unsigned short TotemFramePosition::getIdxInFiber ( ) const
inline

Definition at line 75 of file TotemFramePosition.h.

References maskIdxInFiber, offsetIdxInFiber, and rawPosition.

Referenced by RawToDigiConverter::run().

static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber

◆ getOptoRxId()

unsigned short TotemFramePosition::getOptoRxId ( ) const
inline

Definition at line 101 of file TotemFramePosition.h.

References maskOptoRxId, offsetOptoRxId, and rawPosition.

Referenced by RawToDigiConverter::run().

101 { return (rawPosition >> offsetOptoRxId) & maskOptoRxId; }
static const unsigned int offsetOptoRxId
static const unsigned int maskOptoRxId

◆ getRawPosition()

unsigned int TotemFramePosition::getRawPosition ( ) const
inline

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

Definition at line 110 of file TotemFramePosition.h.

References rawPosition.

110 { return rawPosition; }

◆ getSubSystemId()

unsigned short TotemFramePosition::getSubSystemId ( ) const
inline

the getters and setters below are deprecated

Definition at line 85 of file TotemFramePosition.h.

References maskSubSystemId, offsetSubSystemId, and rawPosition.

Referenced by RawToDigiConverter::run().

static const unsigned int offsetSubSystemId
static const unsigned int maskSubSystemId

◆ getTOTFEDId()

unsigned short TotemFramePosition::getTOTFEDId ( ) const
inline

Definition at line 93 of file TotemFramePosition.h.

References maskTOTFEDId, offsetTOTFEDId, and rawPosition.

Referenced by RawToDigiConverter::run().

93 { return (rawPosition >> offsetTOTFEDId) & maskTOTFEDId; }
static const unsigned int maskTOTFEDId
static const unsigned int offsetTOTFEDId

◆ operator<()

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

Definition at line 112 of file TotemFramePosition.h.

References rawPosition.

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

◆ operator==()

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

Definition at line 114 of file TotemFramePosition.h.

References rawPosition.

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

◆ printXML()

void TotemFramePosition::printXML ( )

prints XML formatted DAQ channel to stdout

Definition at line 24 of file TotemFramePosition.cc.

References gather_cfg::cout.

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

◆ serialize()

template<class Archive >
void TotemFramePosition::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setFEDId()

void TotemFramePosition::setFEDId ( unsigned short  v)
inline

Definition at line 61 of file TotemFramePosition.h.

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

61  {
62  v &= maskFEDId;
63  rawPosition &= 0xFFFFFFFF - (maskFEDId << offsetFEDId);
64  rawPosition |= (v << offsetFEDId);
65  }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId

◆ setGOHId()

void TotemFramePosition::setGOHId ( unsigned short  v)
inline

Definition at line 69 of file TotemFramePosition.h.

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

69  {
70  v &= maskGOHId;
71  rawPosition &= 0xFFFFFFFF - (maskGOHId << offsetGOHId);
72  rawPosition |= (v << offsetGOHId);
73  }
static const unsigned int maskGOHId
static const unsigned int offsetGOHId

◆ setIdxInFiber()

void TotemFramePosition::setIdxInFiber ( unsigned short  v)
inline

Definition at line 77 of file TotemFramePosition.h.

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

77  {
78  v &= maskIdxInFiber;
79  rawPosition &= 0xFFFFFFFF - (maskIdxInFiber << offsetIdxInFiber);
81  }
static const unsigned int offsetIdxInFiber
static const unsigned int maskIdxInFiber

◆ setOptoRxId()

void TotemFramePosition::setOptoRxId ( unsigned short  v)
inline

Definition at line 103 of file TotemFramePosition.h.

References maskOptoRxId, offsetOptoRxId, rawPosition, and findQualityFiles::v.

103  {
104  v &= maskOptoRxId;
105  rawPosition &= 0xFFFFFFFF - (maskOptoRxId << offsetOptoRxId);
106  rawPosition |= (v << offsetOptoRxId);
107  }
static const unsigned int offsetOptoRxId
static const unsigned int maskOptoRxId

◆ setSubSystemId()

void TotemFramePosition::setSubSystemId ( unsigned short  v)
inline

Definition at line 87 of file TotemFramePosition.h.

References maskSubSystemId, offsetSubSystemId, rawPosition, and findQualityFiles::v.

87  {
88  v &= maskSubSystemId;
89  rawPosition &= 0xFFFFFFFF - (maskSubSystemId << offsetSubSystemId);
91  }
static const unsigned int offsetSubSystemId
static const unsigned int maskSubSystemId

◆ setTOTFEDId()

void TotemFramePosition::setTOTFEDId ( unsigned short  v)
inline

Definition at line 95 of file TotemFramePosition.h.

References maskTOTFEDId, offsetTOTFEDId, rawPosition, and findQualityFiles::v.

95  {
96  v &= maskTOTFEDId;
97  rawPosition &= 0xFFFFFFFF - (maskTOTFEDId << offsetTOTFEDId);
99  }
static const unsigned int maskTOTFEDId
static const unsigned int offsetTOTFEDId

◆ setXMLAttribute()

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 RemoveAddSevLevel::flag, and findQualityFiles::v.

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") {
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") {
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

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 135 of file TotemFramePosition.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 135 of file TotemFramePosition.h.

◆ operator<<

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.

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

Member Data Documentation

◆ maskFEDId

const unsigned int TotemFramePosition::maskFEDId = 0x3FF
static

◆ maskGOHId

const unsigned int TotemFramePosition::maskGOHId = 0xF
static

◆ maskIdxInFiber

const unsigned int TotemFramePosition::maskIdxInFiber = 0xF
static

◆ maskOptoRxId

const unsigned int TotemFramePosition::maskOptoRxId = 0x3
static

Definition at line 39 of file TotemFramePosition.h.

Referenced by getOptoRxId(), and setOptoRxId().

◆ maskSubSystemId

const unsigned int TotemFramePosition::maskSubSystemId = 0x7
static

Definition at line 41 of file TotemFramePosition.h.

Referenced by getSubSystemId(), and setSubSystemId().

◆ maskTOTFEDId

const unsigned int TotemFramePosition::maskTOTFEDId = 0x1F
static

Definition at line 40 of file TotemFramePosition.h.

Referenced by getTOTFEDId(), and setTOTFEDId().

◆ offsetFEDId

const unsigned int TotemFramePosition::offsetFEDId = 8
static

◆ offsetGOHId

const unsigned int TotemFramePosition::offsetGOHId = 4
static

◆ offsetIdxInFiber

const unsigned int TotemFramePosition::offsetIdxInFiber = 0
static

◆ offsetOptoRxId

const unsigned int TotemFramePosition::offsetOptoRxId = 8
static

Definition at line 39 of file TotemFramePosition.h.

Referenced by getOptoRxId(), and setOptoRxId().

◆ offsetSubSystemId

const unsigned int TotemFramePosition::offsetSubSystemId = 15
static

Definition at line 41 of file TotemFramePosition.h.

Referenced by getSubSystemId(), and setSubSystemId().

◆ offsetTOTFEDId

const unsigned int TotemFramePosition::offsetTOTFEDId = 10
static

Definition at line 40 of file TotemFramePosition.h.

Referenced by getTOTFEDId(), and setTOTFEDId().

◆ rawPosition

unsigned int TotemFramePosition::rawPosition
protected