CMS 3D CMS Logo

L1TBPTX.h
Go to the documentation of this file.
1 #ifndef L1TBPTX_H
2 #define L1TBPTX_H
3 
4 /*
5  * \file L1TBPTX.h
6  *
7  * \author J. Pela
8  *
9 */
10 
11 // system include files
12 #include <memory>
13 #include <unistd.h>
14 
15 // user include files
17 
22 
24 
28 
30 
31 //Data Formats
35 
37 
38 #include <TString.h>
39 
40 #include <iostream>
41 #include <fstream>
42 #include <string>
43 #include <vector>
44 
45 class RateBuffer {
46 public:
47  void fill(int ls, bool isAlgo, int bit, double rate) {
48  if (isAlgo) {
49  m_lsAlgoRate[std::pair<int, int>(ls, bit)] = rate;
50  } else {
51  m_lsTechRate[std::pair<int, int>(ls, bit)] = rate;
52  }
53  }
54  double getLSRate(int ls, bool isAlgo, int bit, double rate) {
55  if (isAlgo) {
56  return m_lsAlgoRate[std::pair<int, int>(ls, bit)];
57  } else {
58  return m_lsTechRate[std::pair<int, int>(ls, bit)];
59  }
60  }
61  double getLSAlgoRate(int ls, int bit, double rate) { return m_lsAlgoRate[std::pair<int, int>(ls, bit)]; }
62  double getLSTechRate(int ls, int bit, double rate) { return m_lsTechRate[std::pair<int, int>(ls, bit)]; }
63 
64 private:
65  std::map<std::pair<int, int>, double> m_lsAlgoRate;
66  std::map<std::pair<int, int>, double> m_lsTechRate;
67 };
68 
69 class L1GtTriggerMenu;
70 class L1GtTriggerMenuRcd;
74 
75 class L1TBPTX : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
76 public:
77  enum BeamMode {
78  NOMODE = 1,
79  SETUP = 2,
80  INJPILOT = 3,
81  INJINTR = 4,
82  INJNOMN = 5,
83  PRERAMP = 6,
84  RAMP = 7,
85  FLATTOP = 8,
86  SQUEEZE = 9,
87  ADJUST = 10,
88  STABLE = 11,
89  UNSTABLE = 12,
90  BEAMDUMP = 13,
91  RAMPDOWN = 14,
92  RECOVERY = 15,
93  INJDUMP = 16,
94  CIRCDUMP = 17,
95  ABORT = 18,
96  CYCLING = 19,
97  WBDUMP = 20,
98  NOBEAM = 21
99  };
100 
101  enum Errors {
102  UNKNOWN = 1,
109  };
110 
111 public:
112  L1TBPTX(const edm::ParameterSet& ps); // Constructor
113  ~L1TBPTX() override; // Destructor
114 
115 protected:
116  void analyze(const edm::Event& e, const edm::EventSetup& c) override; // Analyze
117  void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) override;
118  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
119 
120  void beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
121  void endLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
122 
123  // Private Methods
124 private:
125  void getBeamConfOMDS();
126  void doFractionInSync(bool iForce = false, bool iBad = false);
127  void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue);
128 
129  // Variables
130 private:
132  std::vector<edm::ParameterSet> m_monitorBits;
133  std::vector<edm::ParameterSet> m_monitorRates;
134  std::string m_outputFile; // file name for ROOT ouput
135 
136  // bool
137  bool m_verbose;
140 
141  // Int
142  std::map<TString, int> m_effNumerator;
143  std::map<TString, int> m_effDenominator;
144  std::map<TString, int> m_missFireNumerator;
145  std::map<TString, int> m_missFireDenominator;
146 
149  unsigned int m_currentLS; // Current LS
150  unsigned int m_currentGTLS;
151  //unsigned int m_eventLS;
152  unsigned int m_lhcFill; //
153 
154  // Vectors
155  BeamConfiguration m_beamConfig; // Current Bunch Structure
156  std::vector<std::pair<int, int> > m_selAlgoBit;
157  std::vector<std::pair<int, int> > m_selTechBit;
158 
159  // Const Vectors
160  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
161  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
162 
163  // Maps
164  std::map<int, TString> m_algoBit_Alias;
165  std::map<int, TString> m_techBit_Alias;
166 
167  std::map<TString, MonitorElement*> m_meAlgoEfficiency;
168  std::map<TString, MonitorElement*> m_meAlgoMissFire;
169  std::map<TString, MonitorElement*> m_meTechEfficiency;
170  std::map<TString, MonitorElement*> m_meTechMissFire;
171 
172  std::map<std::pair<bool, int>, MonitorElement*> m_meRate;
173  std::map<std::pair<bool, int>, double> m_l1Rate;
174 
175  // MonitorElement
177 
178  // Input tags
185 };
186 
187 #endif
unsigned int m_lhcFill
Definition: L1TBPTX.h:152
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TBPTX.cc:558
double getLSTechRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:62
std::string m_outputFile
Definition: L1TBPTX.h:134
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:170
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:167
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:156
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TBPTX.cc:214
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:181
unsigned int m_currentLS
Definition: L1TBPTX.h:149
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:180
L1TBPTX(const edm::ParameterSet &ps)
Definition: L1TBPTX.cc:33
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:145
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:155
BeamMode
Definition: L1TBPTX.h:77
bool * m_processedLS
Definition: L1TBPTX.h:139
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:168
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TBPTX.cc:207
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:173
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:169
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
Definition: L1TBPTX.cc:73
double getLSAlgoRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:61
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:144
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd > l1GtPfTechToken_
Definition: L1TBPTX.h:184
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TBPTX.cc:325
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TBPTX.cc:244
bool m_verbose
Definition: L1TBPTX.h:137
std::map< std::pair< int, int >, double > m_lsAlgoRate
Definition: L1TBPTX.h:65
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:161
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > l1gtMenuToken_
Definition: L1TBPTX.h:182
int m_refPrescaleSet
Definition: L1TBPTX.h:147
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:131
int m_currentPrescalesIndex
Definition: L1TBPTX.h:148
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:165
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > l1GtPfAlgoToken_
Definition: L1TBPTX.h:183
double getLSRate(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:54
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
Definition: L1TBPTX.cc:568
def ls(path, rec=False)
Definition: eostools.py:349
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:133
bool m_currentLSValid
Definition: L1TBPTX.h:138
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:172
double rate(double x)
Definition: Constants.cc:3
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:132
std::map< std::pair< int, int >, double > m_lsTechRate
Definition: L1TBPTX.h:66
unsigned int m_currentGTLS
Definition: L1TBPTX.h:150
std::map< int, TString > m_algoBit_Alias
Definition: L1TBPTX.h:164
void getBeamConfOMDS()
Definition: L1TBPTX.cc:479
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:157
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:143
void fill(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:47
~L1TBPTX() override
Definition: L1TBPTX.cc:68
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:142
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:176
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:160
Definition: Run.h:45
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:179