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 
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 getDDUHisto(const HistoId& histo, const HwId& dduID, MonitorObject*& me);
146  const bool getCSCHisto(const HistoId& histo, const HwId& crateID, const HwId& dmbSlot, MonitorObject*& me);
147  const bool getCSCHisto(const HistoId& histo, const HwId& crateID, const HwId& dmbSlot, const HwId& adId, MonitorObject*& me);
148  const bool getParHisto(const HistoId& histo, MonitorObject*& me);
149  void preProcessEvent();
150 
151  const bool getCSCFromMap(const unsigned int& crateId, const unsigned int& dmbId, unsigned int& cscType, unsigned int& cscPosition) const;
152  void setEmuEventDisplayBit(MonitorObject*& mo, const unsigned int x, const unsigned int y, const unsigned int bit);
153  void resetEmuEventDisplays();
154 
157 
160 
161  std::map<uint32_t, uint32_t> L1ANumbers;
162  uint32_t L1ANumber;
163  uint32_t BXN;
165  bool fCloseL1As; // Close L1A bit from DDU Trailer
167 
168 // ===================================================================================================
169 // Local ONLY stuff
170 // ===================================================================================================
171 
172 #ifdef DQMLOCAL
173 
174  public:
175 
176  void processEvent(const char* data, const int32_t dataSize, const uint32_t errorStat, const int32_t nodeNumber);
177 
178 #endif
179 
180 // ===================================================================================================
181 // Global ONLY stuff
182 // ===================================================================================================
183 
184 #ifdef DQMGLOBAL
185 
186  private:
187 
188  bool bCSCEventCounted;
189 
190  public:
191 
192  void processEvent(const edm::Event& e, const edm::InputTag& inputTag);
193 
194 #endif
195 
196  };
197 
198 }
199 
200 #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.
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
tuple histo
Definition: trackerHits.py:12
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.
CSCDQM Framework Global Configuration.
unsigned int HistoId
EventProcessor(Configuration *const p_config)
Constructor.
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)
CSC Format Status Object.
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.
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.