CMS 3D CMS Logo

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

#include <CTPPSPixelFramePosition.h>

Public Member Functions

 CTPPSPixelFramePosition (unsigned short FEDId, unsigned short FMCId, unsigned short ChannelIdx, unsigned short ROC)
 the preferred constructor More...
 
 CTPPSPixelFramePosition (unsigned int pos=0)
 don't use this constructor unless you have a good reason More...
 
unsigned short getChannelIdx () const
 
unsigned short getFEDId () const
 recomended getters and setters More...
 
unsigned short getFMCId () const
 
unsigned int getRawPosition () const
 
unsigned short getROC () const
 
bool operator< (const CTPPSPixelFramePosition &pos) const
 
bool operator== (const CTPPSPixelFramePosition &pos) const
 
void printXML ()
 prints XML formatted DAQ channel to stdout More...
 
void setChannelIdx (unsigned short v)
 
void setFEDId (unsigned short v)
 
void setFMCId (unsigned short v)
 
void setROC (unsigned short v)
 
unsigned char setXMLAttribute (const std::string &attribute, const std::string &value, unsigned char &flag)
 
 ~CTPPSPixelFramePosition ()
 

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 maskChannelIdx = 0x3F
 
static const unsigned int maskFEDId = 0xFFF
 
static const unsigned int maskFMCId = 0x1
 
static const unsigned int maskROC = 0x3
 
static const unsigned int offsetChannelIdx = 2
 
static const unsigned int offsetFEDId = 9
 
static const unsigned int offsetFMCId = 8
 
static const unsigned int offsetROC = 0
 

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 CTPPSPixelFramePosition &fp)
 

Detailed Description

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

The internal representation has the following structure:

* |                                     32 bits raw position                                                                      |
* | 11 bits  |   12 bits |  1  bit          |      6 bits                        |  2bits     |
* |  empty   |  FED ID  |    FMC   0-1  |   fiber index      0-12          | ROC 0-2 |
* 

Definition at line 28 of file CTPPSPixelFramePosition.h.

Constructor & Destructor Documentation

CTPPSPixelFramePosition::CTPPSPixelFramePosition ( unsigned short  FEDId,
unsigned short  FMCId,
unsigned short  ChannelIdx,
unsigned short  ROC 
)
inline

the preferred constructor

Definition at line 36 of file CTPPSPixelFramePosition.h.

37  : rawPosition(ROC << offsetROC | ChannelIdx << offsetChannelIdx | FMCId << FMCId | FEDId << offsetFEDId) {}
static const unsigned int offsetROC
static const unsigned int offsetFEDId
static const unsigned int offsetChannelIdx
CTPPSPixelFramePosition::CTPPSPixelFramePosition ( unsigned int  pos = 0)
inline

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

Definition at line 40 of file CTPPSPixelFramePosition.h.

CTPPSPixelFramePosition::~CTPPSPixelFramePosition ( )
inline

Definition at line 42 of file CTPPSPixelFramePosition.h.

42 {}

Member Function Documentation

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

returns true if all attributes have been set

Definition at line 97 of file CTPPSPixelFramePosition.h.

Referenced by CTPPSPixelDAQMappingESSourceXML::ChipFramePosition().

97 { return (flag == 0xF); }
unsigned short CTPPSPixelFramePosition::getChannelIdx ( ) const
inline

Definition at line 54 of file CTPPSPixelFramePosition.h.

References maskChannelIdx, and rawPosition.

Referenced by operator<<().

static const unsigned int maskChannelIdx
static const unsigned int offsetChannelIdx
unsigned short CTPPSPixelFramePosition::getFEDId ( ) const
inline

recomended getters and setters

Definition at line 46 of file CTPPSPixelFramePosition.h.

References maskFEDId, and rawPosition.

Referenced by operator<<().

46 { return (rawPosition >> offsetFEDId) & maskFEDId; }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId
unsigned short CTPPSPixelFramePosition::getFMCId ( ) const
inline

Definition at line 70 of file CTPPSPixelFramePosition.h.

References maskFMCId, and rawPosition.

Referenced by operator<<().

70 { return (rawPosition >> offsetFMCId) & maskFMCId; }
static const unsigned int offsetFMCId
static const unsigned int maskFMCId
unsigned int CTPPSPixelFramePosition::getRawPosition ( ) const
inline

Definition at line 78 of file CTPPSPixelFramePosition.h.

References rawPosition.

78 { return rawPosition; }
unsigned short CTPPSPixelFramePosition::getROC ( ) const
inline

Definition at line 62 of file CTPPSPixelFramePosition.h.

References maskROC, and rawPosition.

Referenced by operator<<().

62 { return (rawPosition >> offsetROC) & maskROC; }
static const unsigned int offsetROC
static const unsigned int maskROC
bool CTPPSPixelFramePosition::operator< ( const CTPPSPixelFramePosition pos) const
inline

Definition at line 80 of file CTPPSPixelFramePosition.h.

References rawPosition.

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

prints XML formatted DAQ channel to stdout

Definition at line 23 of file CTPPSPixelFramePosition.cc.

Referenced by operator==().

23  {
24  edm::LogInfo("printXML") << "\" FEDId=\"" << getFEDId() << "\" FMCId=\"" << getFMCId() << "\" ChannelIdx=\""
25  << getChannelIdx() << "\" ROC=\"" << getROC() << "\"";
26 }
unsigned short getFMCId() const
unsigned short getChannelIdx() const
unsigned short getROC() const
unsigned short getFEDId() const
recomended getters and setters
template<class Archive >
void CTPPSPixelFramePosition::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void CTPPSPixelFramePosition::setChannelIdx ( unsigned short  v)
inline

Definition at line 56 of file CTPPSPixelFramePosition.h.

References maskChannelIdx, offsetChannelIdx, and rawPosition.

56  {
57  v &= maskChannelIdx;
58  rawPosition &= 0xFFFFFFFF - (maskChannelIdx << offsetChannelIdx);
60  }
static const unsigned int maskChannelIdx
static const unsigned int offsetChannelIdx
void CTPPSPixelFramePosition::setFEDId ( unsigned short  v)
inline

Definition at line 48 of file CTPPSPixelFramePosition.h.

References maskFEDId, offsetFEDId, and rawPosition.

48  {
49  v &= maskFEDId;
50  rawPosition &= 0xFFFFFFFF - (maskFEDId << offsetFEDId);
51  rawPosition |= (v << offsetFEDId);
52  }
static const unsigned int offsetFEDId
static const unsigned int maskFEDId
void CTPPSPixelFramePosition::setFMCId ( unsigned short  v)
inline

Definition at line 72 of file CTPPSPixelFramePosition.h.

References maskFMCId, offsetFMCId, and rawPosition.

72  {
73  v &= maskFMCId;
74  rawPosition &= 0xFFFFFFFF - (maskFMCId << offsetFMCId);
75  rawPosition |= (v << offsetFMCId);
76  }
static const unsigned int offsetFMCId
static const unsigned int maskFMCId
void CTPPSPixelFramePosition::setROC ( unsigned short  v)
inline

Definition at line 64 of file CTPPSPixelFramePosition.h.

References maskROC, offsetROC, and rawPosition.

64  {
65  v &= maskROC;
66  rawPosition &= 0xFFFFFFFF - (maskROC << offsetROC);
67  rawPosition |= (v << offsetROC);
68  }
static const unsigned int offsetROC
static const unsigned int maskROC
unsigned char CTPPSPixelFramePosition::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 CTPPSPixelFramePosition.cc.

References findQualityFiles::v.

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

32  {
33  unsigned int v = atoi(value.c_str());
34 
35  if (attribute == "FEDId") {
36  setFEDId(v);
37  flag |= 0x8;
38  return 0;
39  }
40 
41  if (attribute == "FMC") {
42  setFMCId(v);
43  flag |= 0x4;
44  return 0;
45  }
46 
47  if (attribute == "FEDChannel") {
48  setChannelIdx(v);
49  flag |= 0x2;
50  return 0;
51  }
52 
53  if (attribute == "ROCinChannel") {
54  setROC(v);
55  flag |= 0x1;
56  return 0;
57  }
58 
59  return 1;
60 }
void setChannelIdx(unsigned short v)
void setFMCId(unsigned short v)
void setROC(unsigned short v)
Definition: value.py:1
void setFEDId(unsigned short v)

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 102 of file CTPPSPixelFramePosition.h.

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

Definition at line 102 of file CTPPSPixelFramePosition.h.

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

Condensed representation of the DAQ channel. prints 5-digit hex number,

Definition at line 17 of file CTPPSPixelFramePosition.cc.

Referenced by operator==().

17  {
18  return s << fp.getFEDId() << ":" << fp.getFMCId() << ":" << fp.getChannelIdx() << ":" << fp.getROC();
19 }
unsigned short getFMCId() const
unsigned short getChannelIdx() const
unsigned short getROC() const
unsigned short getFEDId() const
recomended getters and setters

Member Data Documentation

const unsigned int CTPPSPixelFramePosition::maskChannelIdx = 0x3F
static

Definition at line 31 of file CTPPSPixelFramePosition.h.

Referenced by getChannelIdx(), and setChannelIdx().

const unsigned int CTPPSPixelFramePosition::maskFEDId = 0xFFF
static

Definition at line 33 of file CTPPSPixelFramePosition.h.

Referenced by getFEDId(), and setFEDId().

const unsigned int CTPPSPixelFramePosition::maskFMCId = 0x1
static

Definition at line 32 of file CTPPSPixelFramePosition.h.

Referenced by getFMCId(), and setFMCId().

const unsigned int CTPPSPixelFramePosition::maskROC = 0x3
static

Definition at line 30 of file CTPPSPixelFramePosition.h.

Referenced by getROC(), and setROC().

const unsigned int CTPPSPixelFramePosition::offsetChannelIdx = 2
static

Definition at line 31 of file CTPPSPixelFramePosition.h.

Referenced by setChannelIdx().

const unsigned int CTPPSPixelFramePosition::offsetFEDId = 9
static

Definition at line 33 of file CTPPSPixelFramePosition.h.

Referenced by setFEDId().

const unsigned int CTPPSPixelFramePosition::offsetFMCId = 8
static

Definition at line 32 of file CTPPSPixelFramePosition.h.

Referenced by setFMCId().

const unsigned int CTPPSPixelFramePosition::offsetROC = 0
static

Definition at line 30 of file CTPPSPixelFramePosition.h.

Referenced by setROC().

unsigned int CTPPSPixelFramePosition::rawPosition
protected