CMS 3D CMS Logo

SiStripSpyUtilities.h
Go to the documentation of this file.
1 #ifndef DQM_SiStripMonitorHardware_SiStripSpyUtilities_H
2 #define DQM_SiStripMonitorHardware_SiStripSpyUtilities_H
3 
4 // Standard includes.
5 //#include <utility>
6 #include <string>
7 
10 
13 
18 
19 // Other classes
20 class EventSetup;
21 
22 namespace sistrip {
23 
24  class SpyUtilities {
25  public:
26  struct Frame {
27  uint32_t detId;
28  uint16_t digitalLow;
29  uint16_t digitalHigh;
30  uint16_t firstHeaderBit;
31  uint16_t firstTrailerBit;
32  float baseline;
33  std::pair<bool, bool> apvErrorBit;
34  std::pair<uint8_t, uint8_t> apvAddress;
35  };
36 
37  struct FrameQuality {
38  uint16_t minDigiRange;
39  uint16_t maxDigiRange;
40  uint16_t minZeroLight;
41  uint16_t maxZeroLight;
42  uint16_t minTickHeight;
43  uint16_t maxTickHeight;
44  };
45 
46  SpyUtilities();
47  ~SpyUtilities();
48 
49  //get cabling for an eventSetup: internal counter to see if cabling has changed.
52 
55 
56  //fill variables from frame
57  static const Frame extractFrameInfo(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
58  bool aPrintDebug = false);
59 
60  static void getMajorityHeader(const edm::DetSetVector<SiStripRawDigi>* aInputDigis,
61  uint16_t& firstHeaderBit,
62  bool printResult = true);
63 
64  //check frame is valid
65  static const bool isValid(const Frame& aFrame, const FrameQuality& aQuality, const uint16_t aExpectedPos);
66 
67  //extract range, threshold and apvAddress
68  static const uint16_t range(const Frame& aFrame);
69 
70  static const uint16_t threshold(const Frame& aFrame);
71 
72  static const uint8_t extractAPVaddress(const Frame& aFrame);
73 
74  //find position of the first header and trailer bit
75  static const uint16_t findHeaderBits(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
76  const uint16_t threshold);
77 
78  static const uint16_t findTrailerBits(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
79  const uint16_t threshold);
80 
81  //find both APV addresses and error bits
82  static const std::pair<bool, bool> findAPVErrorBits(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
83  const uint16_t threshold,
84  const uint16_t aFirstBits);
85 
86  static const std::pair<uint8_t, uint8_t> findAPVAddresses(
88  const uint16_t threshold,
89  const uint16_t aFirstBits);
90 
91  static std::string print(const Frame& aFrame, std::string aErr);
92 
93  static void fedIndex(uint32_t aFedIndex, uint16_t& aFedId, uint16_t& aFedChannel);
94 
95  static std::pair<uint16_t, uint32_t> findMajorityValue(std::vector<uint16_t>& values, const uint16_t aFedId = 0);
96 
97  static void fillFEDMajorities(const std::map<uint32_t, uint32_t>& channelValues,
98  std::vector<uint32_t>& fedMajoritiesToFill);
99 
100  private:
101  // Cabling
103  uint32_t cacheId_;
104 
105  // DetCabling
107  uint32_t cacheIdDet_;
108 
109  //used to see if the pedestals have changed.
110  uint32_t pedsCacheId_;
112 
113  //used to see if the noises have changed.
114  uint32_t noiseCacheId_;
116  };
117 
118 } // namespace sistrip
119 
120 #endif // DQM_SiStripMonitorHardware_SiStripSpyUtilities_H
edm::DetSetVector< SiStripRawDigi >
sistrip::SpyUtilities::isValid
static const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Definition: SiStripSpyUtilities.cc:222
sistrip::SpyUtilities::Frame::firstTrailerBit
uint16_t firstTrailerBit
Definition: SiStripSpyUtilities.h:31
sistrip::SpyUtilities::noiseHandle_
edm::ESHandle< SiStripNoises > noiseHandle_
Definition: SiStripSpyUtilities.h:115
ESHandle.h
sistrip::SpyUtilities::Frame::digitalLow
uint16_t digitalLow
Definition: SiStripSpyUtilities.h:28
edm::DetSet
Definition: DetSet.h:23
sistrip::SpyUtilities::noiseCacheId_
uint32_t noiseCacheId_
Definition: SiStripSpyUtilities.h:114
SiStripRawDigi.h
sistrip::SpyUtilities::FrameQuality
Definition: SiStripSpyUtilities.h:37
sistrip::SpyUtilities::Frame::detId
uint32_t detId
Definition: SiStripSpyUtilities.h:27
SiStripFedCabling.h
sistrip::SpyUtilities::findAPVErrorBits
static const std::pair< bool, bool > findAPVErrorBits(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, const uint16_t aFirstBits)
Definition: SiStripSpyUtilities.cc:314
sistrip::SpyUtilities::Frame::apvAddress
std::pair< uint8_t, uint8_t > apvAddress
Definition: SiStripSpyUtilities.h:34
sistrip::SpyUtilities::findAPVAddresses
static const std::pair< uint8_t, uint8_t > findAPVAddresses(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, const uint16_t aFirstBits)
Definition: SiStripSpyUtilities.cc:348
sistrip::SpyUtilities::getNoiseHandle
edm::ESHandle< SiStripNoises > getNoiseHandle(const edm::EventSetup &eventSetup)
Definition: SiStripSpyUtilities.cc:98
SiStripNoises.h
sistrip::SpyUtilities::getDetCabling
const SiStripDetCabling * getDetCabling(const edm::EventSetup &)
Updates the det cabling object from the DB.
Definition: SiStripSpyUtilities.cc:73
sistrip::SpyUtilities::getPedestalHandle
edm::ESHandle< SiStripPedestals > getPedestalHandle(const edm::EventSetup &eventSetup)
Definition: SiStripSpyUtilities.cc:87
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
sistrip::SpyUtilities::findHeaderBits
static const uint16_t findHeaderBits(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
Definition: SiStripSpyUtilities.cc:245
sistrip::SpyUtilities::cacheIdDet_
uint32_t cacheIdDet_
DB cache ID used to establish if the cabling has changed during the run.
Definition: SiStripSpyUtilities.h:107
sistrip::SpyUtilities::fillFEDMajorities
static void fillFEDMajorities(const std::map< uint32_t, uint32_t > &channelValues, std::vector< uint32_t > &fedMajoritiesToFill)
Definition: SiStripSpyUtilities.cc:439
SiStripDetCabling.h
sistrip::SpyUtilities::SpyUtilities
SpyUtilities()
Definition: SiStripSpyUtilities.cc:20
sistrip::SpyUtilities::detCabling_
const SiStripDetCabling * detCabling_
The cabling object.
Definition: SiStripSpyUtilities.h:106
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
sistrip::SpyUtilities
Definition: SiStripSpyUtilities.h:24
SiStripDetCabling
Definition: SiStripDetCabling.h:21
edm::ESHandle< SiStripPedestals >
sistrip::SpyUtilities::Frame::baseline
float baseline
Definition: SiStripSpyUtilities.h:32
sistrip::SpyUtilities::extractFrameInfo
static const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
Definition: SiStripSpyUtilities.cc:109
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
sistrip::SpyUtilities::range
static const uint16_t range(const Frame &aFrame)
Definition: SiStripSpyUtilities.cc:174
sistrip::SpyUtilities::findMajorityValue
static std::pair< uint16_t, uint32_t > findMajorityValue(std::vector< uint16_t > &values, const uint16_t aFedId=0)
Definition: SiStripSpyUtilities.cc:409
sistrip::SpyUtilities::pedsCacheId_
uint32_t pedsCacheId_
Definition: SiStripSpyUtilities.h:110
sistrip::SpyUtilities::threshold
static const uint16_t threshold(const Frame &aFrame)
Definition: SiStripSpyUtilities.cc:181
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
sistrip::SpyUtilities::cabling_
const SiStripFedCabling * cabling_
The cabling object.
Definition: SiStripSpyUtilities.h:102
sistrip::SpyUtilities::FrameQuality::maxTickHeight
uint16_t maxTickHeight
Definition: SiStripSpyUtilities.h:43
sistrip::SpyUtilities::FrameQuality::minZeroLight
uint16_t minZeroLight
Definition: SiStripSpyUtilities.h:40
sistrip::SpyUtilities::~SpyUtilities
~SpyUtilities()
Definition: SiStripSpyUtilities.cc:30
sistrip::SpyUtilities::getCabling
const SiStripFedCabling * getCabling(const edm::EventSetup &)
Updates the cabling object from the DB.
Definition: SiStripSpyUtilities.cc:37
sistrip::SpyUtilities::Frame::firstHeaderBit
uint16_t firstHeaderBit
Definition: SiStripSpyUtilities.h:30
sistrip::SpyUtilities::FrameQuality::minDigiRange
uint16_t minDigiRange
Definition: SiStripSpyUtilities.h:38
sistrip::SpyUtilities::findTrailerBits
static const uint16_t findTrailerBits(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
Definition: SiStripSpyUtilities.cc:276
sistrip::SpyUtilities::Frame::digitalHigh
uint16_t digitalHigh
Definition: SiStripSpyUtilities.h:29
sistrip::SpyUtilities::getMajorityHeader
static void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
Definition: SiStripSpyUtilities.cc:195
options_cfi.eventSetup
eventSetup
Definition: options_cfi.py:12
SiStripPedestals.h
sistrip::SpyUtilities::Frame::apvErrorBit
std::pair< bool, bool > apvErrorBit
Definition: SiStripSpyUtilities.h:33
EventSetup.h
sistrip::SpyUtilities::pedsHandle_
edm::ESHandle< SiStripPedestals > pedsHandle_
Definition: SiStripSpyUtilities.h:111
sistrip::SpyUtilities::print
static std::string print(const Frame &aFrame, std::string aErr)
Definition: SiStripSpyUtilities.cc:381
sistrip::SpyUtilities::Frame
Definition: SiStripSpyUtilities.h:26
EventSetup
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
cmsCodeRulesChecker.printResult
printResult
Definition: cmsCodeRulesChecker.py:156
sistrip::SpyUtilities::FrameQuality::maxZeroLight
uint16_t maxZeroLight
Definition: SiStripSpyUtilities.h:41
sistrip::SpyUtilities::FrameQuality::maxDigiRange
uint16_t maxDigiRange
Definition: SiStripSpyUtilities.h:39
sistrip::SpyUtilities::extractAPVaddress
static const uint8_t extractAPVaddress(const Frame &aFrame)
Definition: SiStripSpyUtilities.cc:185
sistrip::SpyUtilities::FrameQuality::minTickHeight
uint16_t minTickHeight
Definition: SiStripSpyUtilities.h:42
sistrip::SpyUtilities::cacheId_
uint32_t cacheId_
DB cache ID used to establish if the cabling has changed during the run.
Definition: SiStripSpyUtilities.h:103
sistrip::SpyUtilities::fedIndex
static void fedIndex(uint32_t aFedIndex, uint16_t &aFedId, uint16_t &aFedChannel)
Definition: SiStripSpyUtilities.cc:398