test
CMS 3D CMS Logo

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