CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDQM_EventProcessor.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: EventProcessor.h
5  *
6  * Description: Object which processes Event and provides Hits to
7  * HitHandler object.
8  *
9  * Version: 1.0
10  * Created: 10/03/2008 10:26:04 AM
11  * Revision: none
12  * Compiler: gcc
13  *
14  * Author: Valdas Rapsevicius, valdas.rapsevicius@cern.ch
15  * Company: CERN, CH
16  *
17  * =====================================================================================
18  */
19 
20 #ifndef CSCDQM_EventProcessor_H
21 #define CSCDQM_EventProcessor_H
22 
23 #include <set>
24 #include <string>
25 #include <math.h>
26 
27 #include <TString.h>
28 
29 #ifdef DQMGLOBAL
30 
35 
36 #endif
37 
38 #include "CSCDQM_Logger.h"
39 #include "CSCDQM_Summary.h"
41 #include "CSCDQM_Configuration.h"
42 #include "CSCDQM_Configuration.h"
43 
48 
51 
52 namespace cscdqm {
53 
57  struct HWStandbyType {
58 
59  // if standby flag should be considered at all?
60  // at the start it will be false, thus good for last value ;)
61  bool process;
62 
63  // ME+
64  bool MeP;
65 
66  // ME-
67  bool MeM;
68 
70  process = MeP = MeM = false;
71  }
72 
73  void applyMeP(bool ready) {
74  MeP = MeP || !ready;
75  }
76 
77  void applyMeM(bool ready) {
78  MeM = MeM || !ready;
79  }
80 
81  bool fullStandby() const {
82  return (MeM && MeP);
83  }
84 
85  bool operator==(const HWStandbyType& t) const {
86  return (t.MeP == MeP && t.MeM == MeM && t.process == process);
87  }
88 
89  bool operator!=(const HWStandbyType& t) const {
90  return !(*this == t);
91  }
92 
94  MeP = t.MeP;
95  MeM = t.MeM;
96  process = t.process;
97  return *this;
98  }
99 
100  };
101 
102  typedef std::map<CSCIdType, ExaminerStatusType> CSCExaminerMapType;
103  typedef std::vector<DDUIdType> DDUExaminerVectorType;
104  // typedef std::map<int, long> CSCExaminerMapType;
105  // typedef std::vector<int> DDUExaminerVectorType;
106 
112 
113 // ===================================================================================================
114 // General stuff
115 // ===================================================================================================
116 
117  public:
118 
119  EventProcessor(Configuration* const p_config);
120 
125 
126  void init();
127 
128  void updateFractionHistos();
129  void updateEfficiencyHistos();
130  void standbyEfficiencyHistos(HWStandbyType& standby);
131  void writeShifterHistograms();
132 
133  unsigned int maskHWElements(std::vector<std::string>& tokens);
134 
135  private:
136 
137  bool processExaminer(const CSCDCCExaminer& binChecker);
138  bool processExaminer(const CSCDCCExaminer& binChecker, const CSCDCCFormatStatusDigi& digi);
139  void processDDU(const CSCDDUEventData& data, const CSCDCCExaminer& binChecker);
140  void processCSC(const CSCEventData& data, const int dduID, const CSCDCCExaminer& binChecker);
141 
142  void calcEMUFractionHisto(const HistoId& result, const HistoId& set, const HistoId& subset);
143 
144  const bool getEMUHisto(const HistoId& histo, MonitorObject*& me);
145  const bool getFEDHisto(const HistoId& histo, const HwId& fedID, MonitorObject*& me);
146  const bool getDDUHisto(const HistoId& histo, const HwId& dduID, MonitorObject*& me);
147  const bool getCSCHisto(const HistoId& histo, const HwId& crateID, const HwId& dmbSlot, MonitorObject*& me);
148  const bool getCSCHisto(const HistoId& histo, const HwId& crateID, const HwId& dmbSlot, const HwId& adId, MonitorObject*& me);
149  const bool getParHisto(const HistoId& histo, MonitorObject*& me);
150  void preProcessEvent();
151 
152  const bool getCSCFromMap(const unsigned int& crateId, const unsigned int& dmbId, unsigned int& cscType, unsigned int& cscPosition) const;
153  void setEmuEventDisplayBit(MonitorObject*& mo, const unsigned int x, const unsigned int y, const unsigned int bit);
154  void resetEmuEventDisplays();
155 
158 
161 
162  std::map<uint32_t, uint32_t> L1ANumbers;
163  std::map<uint32_t, bool> fNotFirstEvent;
164  uint32_t L1ANumber;
165  uint32_t BXN;
166  uint32_t cntDMBs;
167  uint32_t cntCFEBs;
168  uint32_t cntALCTs;
169  uint32_t cntTMBs;
170 
171 
172  // bool fFirstEvent;
173  bool fCloseL1As; // Close L1A bit from DDU Trailer
175 
176 // ===================================================================================================
177 // Local ONLY stuff
178 // ===================================================================================================
179 
180 #ifdef DQMLOCAL
181 
182  public:
183 
184  void processEvent(const char* data, const int32_t dataSize, const uint32_t errorStat, const int32_t nodeNumber);
185 
186 #endif
187 
188 // ===================================================================================================
189 // Global ONLY stuff
190 // ===================================================================================================
191 
192 #ifdef DQMGLOBAL
193 
194  private:
195 
196  bool bCSCEventCounted;
197 
198  public:
199 
200  void processEvent(const edm::Event& e, const edm::InputTag& inputTag);
201 
202 #endif
203 
204  };
205 
206 }
207 
208 #endif
Object used to process Events and compute statistics.
const bool getCSCFromMap(const unsigned int &crateId, const unsigned int &dmbId, unsigned int &cscType, unsigned int &cscPosition) const
Get CSC type and position from crate and dmb identifiers.
uint32_t cntCFEBs
Total Number of DMBs per event from DDU Header DAV.
unsigned int HwId
bool operator!=(const HWStandbyType &t) const
void preProcessEvent()
Common Local and Global DQM function to be called before processing Event.
const bool getDDUHisto(const HistoId &histo, const HwId &dduID, MonitorObject *&me)
Get DDU Level Monitoring Object.
std::map< CSCIdType, ExaminerStatusType > CSCExaminerMapType
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
void updateEfficiencyHistos()
Update Efficiency MOs.
Hardware and Physics Efficiency data structures and routines.
void processCSC(const CSCEventData &data, const int dduID, const CSCDCCExaminer &binChecker)
Process Chamber Data and fill MOs.
std::map< uint32_t, uint32_t > L1ANumbers
void init()
Initialize EventProcessor: reading out config information.
bool operator==(const HWStandbyType &t) const
void setEmuEventDisplayBit(MonitorObject *&mo, const unsigned int x, const unsigned int y, const unsigned int bit)
Set a single bit in the 3D Histogram (aka EMU level event display). Checks if mo and x != null...
const bool getCSCHisto(const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
Get CSC (Chamber) Level Monitoring Object.
uint32_t cntTMBs
Total Number of ALCTs per event from DMB DAV.
CSCDQM Framework Global Configuration.
unsigned int HistoId
EventProcessor(Configuration *const p_config)
Constructor.
uint32_t cntALCTs
Total Number of CFEBs per event from DMB DAV.
tuple result
Definition: query.py:137
const bool getParHisto(const HistoId &histo, MonitorObject *&me)
Get Parameter Monitoring Object.
void processDDU(const CSCDDUEventData &data, const CSCDCCExaminer &binChecker)
Process DDU output and fill MOs.
bool processExaminer(const CSCDCCExaminer &binChecker)
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!
const HWStandbyType & operator=(const HWStandbyType &t)
const bool getFEDHisto(const HistoId &histo, const HwId &fedID, MonitorObject *&me)
Get FED Level Monitoring Object.
CSC Format Status Object.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void calcEMUFractionHisto(const HistoId &result, const HistoId &set, const HistoId &subset)
Calculate fractional histogram.
std::vector< DDUIdType > DDUExaminerVectorType
void resetEmuEventDisplays()
Reset Emu level EventDisplay histograms once per event.
bool fCloseL1As
Total Number of TMBs per event from DMB DAV.
Definition: DDAxes.h:10
std::map< uint32_t, bool > fNotFirstEvent
void updateFractionHistos()
Update Fractional MOs.
void standbyEfficiencyHistos(HWStandbyType &standby)
apply standby flags/parameters
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.