CMS 3D CMS Logo

CTPPSPixelFramePosition.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  *
4  * Authors:
5  * F.Ferro ferro@ge.infn.it
6  *
7  ****************************************************************************/
8 
9 #ifndef CondFormats_PPSObjects_CTPPSPixelFramePosition
10 #define CondFormats_PPSObjects_CTPPSPixelFramePosition
11 
12 #include <iostream>
13 #include <string>
14 
16 
29 public:
30  static const unsigned int offsetROC = 0, maskROC = 0x3;
31  static const unsigned int offsetChannelIdx = 2, maskChannelIdx = 0x3F;
32  static const unsigned int offsetFMCId = 8, maskFMCId = 0x1;
33  static const unsigned int offsetFEDId = 9, maskFEDId = 0xFFF;
34 
36  CTPPSPixelFramePosition(unsigned short FEDId, unsigned short FMCId, unsigned short ChannelIdx, unsigned short ROC)
37  : rawPosition(ROC << offsetROC | ChannelIdx << offsetChannelIdx | FMCId << FMCId | FEDId << offsetFEDId) {}
38 
40  CTPPSPixelFramePosition(unsigned int pos = 0) : rawPosition(pos) {}
41 
43 
45 
46  unsigned short getFEDId() const { return (rawPosition >> offsetFEDId) & maskFEDId; }
47 
48  void setFEDId(unsigned short v) {
49  v &= maskFEDId;
50  rawPosition &= 0xFFFFFFFF - (maskFEDId << offsetFEDId);
51  rawPosition |= (v << offsetFEDId);
52  }
53 
54  unsigned short getChannelIdx() const { return (rawPosition >> offsetChannelIdx) & maskChannelIdx; }
55 
56  void setChannelIdx(unsigned short v) {
57  v &= maskChannelIdx;
60  }
61 
62  unsigned short getROC() const { return (rawPosition >> offsetROC) & maskROC; }
63 
64  void setROC(unsigned short v) {
65  v &= maskROC;
66  rawPosition &= 0xFFFFFFFF - (maskROC << offsetROC);
67  rawPosition |= (v << offsetROC);
68  }
69 
70  unsigned short getFMCId() const { return (rawPosition >> offsetFMCId) & maskFMCId; }
71 
72  void setFMCId(unsigned short v) {
73  v &= maskFMCId;
74  rawPosition &= 0xFFFFFFFF - (maskFMCId << offsetFMCId);
75  rawPosition |= (v << offsetFMCId);
76  }
77 
78  unsigned int getRawPosition() const { return rawPosition; }
79 
80  bool operator<(const CTPPSPixelFramePosition &pos) const { return (rawPosition < pos.rawPosition); }
81 
82  bool operator==(const CTPPSPixelFramePosition &pos) const { return (rawPosition == pos.rawPosition); }
83 
86  friend std::ostream &operator<<(std::ostream &s, const CTPPSPixelFramePosition &fp);
87 
89  void printXML();
90 
94  unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag);
95 
97  static bool checkXMLAttributeFlag(unsigned char flag) { return (flag == 0xF); }
98 
99 protected:
100  unsigned int rawPosition;
101 
103 };
104 
105 #endif
CTPPSPixelFramePosition::offsetChannelIdx
static const unsigned int offsetChannelIdx
Definition: CTPPSPixelFramePosition.h:35
CTPPSPixelFramePosition::setFEDId
void setFEDId(unsigned short v)
Definition: CTPPSPixelFramePosition.h:52
CTPPSPixelFramePosition::setXMLAttribute
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag)
Definition: CTPPSPixelFramePosition.cc:29
CTPPSPixelFramePosition::operator<
bool operator<(const CTPPSPixelFramePosition &pos) const
Definition: CTPPSPixelFramePosition.h:84
CTPPSPixelFramePosition::getRawPosition
unsigned int getRawPosition() const
Definition: CTPPSPixelFramePosition.h:82
CTPPSPixelFramePosition::rawPosition
unsigned int rawPosition
Definition: CTPPSPixelFramePosition.h:104
pos
Definition: PixelAliasList.h:18
CTPPSPixelFramePosition::getChannelIdx
unsigned short getChannelIdx() const
Definition: CTPPSPixelFramePosition.h:58
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
CTPPSPixelFramePosition::operator==
bool operator==(const CTPPSPixelFramePosition &pos) const
Definition: CTPPSPixelFramePosition.h:86
CTPPSPixelFramePosition
Definition: CTPPSPixelFramePosition.h:27
personalPlayback.fp
fp
Definition: personalPlayback.py:523
findQualityFiles.v
v
Definition: findQualityFiles.py:179
CTPPSPixelFramePosition::offsetFMCId
static const unsigned int offsetFMCId
Definition: CTPPSPixelFramePosition.h:36
CTPPSPixelFramePosition::setChannelIdx
void setChannelIdx(unsigned short v)
Definition: CTPPSPixelFramePosition.h:60
CTPPSPixelFramePosition::maskFEDId
static const unsigned int maskFEDId
Definition: CTPPSPixelFramePosition.h:37
CTPPSPixelFramePosition::offsetROC
static const unsigned int offsetROC
Definition: CTPPSPixelFramePosition.h:34
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CTPPSPixelFramePosition::CTPPSPixelFramePosition
CTPPSPixelFramePosition(unsigned short FEDId, unsigned short FMCId, unsigned short ChannelIdx, unsigned short ROC)
the preferred constructor
Definition: CTPPSPixelFramePosition.h:40
CTPPSPixelFramePosition::maskFMCId
static const unsigned int maskFMCId
Definition: CTPPSPixelFramePosition.h:36
CTPPSPixelFramePosition::checkXMLAttributeFlag
static bool checkXMLAttributeFlag(unsigned char flag)
returns true if all attributes have been set
Definition: CTPPSPixelFramePosition.h:101
CTPPSPixelFramePosition::operator<<
friend std::ostream & operator<<(std::ostream &s, const CTPPSPixelFramePosition &fp)
Definition: CTPPSPixelFramePosition.cc:16
CTPPSPixelFramePosition::printXML
void printXML()
prints XML formatted DAQ channel to stdout
Definition: CTPPSPixelFramePosition.cc:22
CTPPSPixelFramePosition::offsetFEDId
static const unsigned int offsetFEDId
Definition: CTPPSPixelFramePosition.h:37
CTPPSPixelFramePosition::maskROC
static const unsigned int maskROC
Definition: CTPPSPixelFramePosition.h:34
CTPPSPixelFramePosition::~CTPPSPixelFramePosition
~CTPPSPixelFramePosition()
Definition: CTPPSPixelFramePosition.h:46
CTPPSPixelFramePosition::maskChannelIdx
static const unsigned int maskChannelIdx
Definition: CTPPSPixelFramePosition.h:35
Serializable.h
value
Definition: value.py:1
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSPixelFramePosition::setFMCId
void setFMCId(unsigned short v)
Definition: CTPPSPixelFramePosition.h:76
CTPPSPixelFramePosition::getFMCId
unsigned short getFMCId() const
Definition: CTPPSPixelFramePosition.h:74
CTPPSPixelFramePosition::setROC
void setROC(unsigned short v)
Definition: CTPPSPixelFramePosition.h:68
CTPPSPixelFramePosition::getFEDId
unsigned short getFEDId() const
recomended getters and setters
Definition: CTPPSPixelFramePosition.h:50
CTPPSPixelFramePosition::getROC
unsigned short getROC() const
Definition: CTPPSPixelFramePosition.h:66
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117