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 
14 // Other classes
15 class EventSetup;
16 
17 namespace sistrip {
18 
19  namespace SpyUtilities {
20  struct Frame {
21  uint32_t detId;
22  uint16_t digitalLow;
23  uint16_t digitalHigh;
24  uint16_t firstHeaderBit;
25  uint16_t firstTrailerBit;
26  float baseline;
27  std::pair<bool, bool> apvErrorBit;
28  std::pair<uint8_t, uint8_t> apvAddress;
29  };
30 
31  struct FrameQuality {
32  uint16_t minDigiRange;
33  uint16_t maxDigiRange;
34  uint16_t minZeroLight;
35  uint16_t maxZeroLight;
36  uint16_t minTickHeight;
37  uint16_t maxTickHeight;
38  };
39 
40  //fill variables from frame
42  bool aPrintDebug = false);
43 
45  uint16_t& firstHeaderBit,
46  bool printResult = true);
47 
48  //check frame is valid
49  const bool isValid(const Frame& aFrame, const FrameQuality& aQuality, const uint16_t aExpectedPos);
50 
51  //extract range, threshold and apvAddress
52  const uint16_t range(const Frame& aFrame);
53 
54  const uint16_t threshold(const Frame& aFrame);
55 
56  const uint8_t extractAPVaddress(const Frame& aFrame);
57 
58  //find position of the first header and trailer bit
59  const uint16_t findHeaderBits(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
60  const uint16_t threshold);
61 
62  const uint16_t findTrailerBits(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
63  const uint16_t threshold);
64 
65  //find both APV addresses and error bits
66  const std::pair<bool, bool> findAPVErrorBits(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
67  const uint16_t threshold,
68  const uint16_t aFirstBits);
69 
70  const std::pair<uint8_t, uint8_t> findAPVAddresses(const edm::DetSetVector<SiStripRawDigi>::detset& channelDigis,
71  const uint16_t threshold,
72  const uint16_t aFirstBits);
73 
74  std::string print(const Frame& aFrame, std::string aErr);
75 
76  void fedIndex(uint32_t aFedIndex, uint16_t& aFedId, uint16_t& aFedChannel);
77 
78  std::pair<uint16_t, uint32_t> findMajorityValue(std::vector<uint16_t>& values, const uint16_t aFedId = 0);
79 
80  void fillFEDMajorities(const std::map<uint32_t, uint32_t>& channelValues,
81  std::vector<uint32_t>& fedMajoritiesToFill);
82 
83  } // namespace SpyUtilities
84 } // namespace sistrip
85 
86 #endif // DQM_SiStripMonitorHardware_SiStripSpyUtilities_H
const uint16_t findHeaderBits(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
void fillFEDMajorities(const std::map< uint32_t, uint32_t > &channelValues, std::vector< uint32_t > &fedMajoritiesToFill)
std::pair< uint8_t, uint8_t > apvAddress
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
std::string print(const Frame &aFrame, std::string aErr)
const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
void fedIndex(uint32_t aFedIndex, uint16_t &aFedId, uint16_t &aFedChannel)
sistrip classes
const uint16_t threshold(const Frame &aFrame)
const uint16_t range(const Frame &aFrame)
std::pair< bool, bool > apvErrorBit
void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
const uint8_t extractAPVaddress(const Frame &aFrame)
std::pair< uint16_t, uint32_t > findMajorityValue(std::vector< uint16_t > &values, const uint16_t aFedId=0)
const std::pair< bool, bool > findAPVErrorBits(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, const uint16_t aFirstBits)
const uint16_t findTrailerBits(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
const std::pair< uint8_t, uint8_t > findAPVAddresses(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, const uint16_t aFirstBits)