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
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 L1TBPTX : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
70 public:
71  enum BeamMode {
72  NOMODE = 1,
73  SETUP = 2,
74  INJPILOT = 3,
75  INJINTR = 4,
76  INJNOMN = 5,
77  PRERAMP = 6,
78  RAMP = 7,
79  FLATTOP = 8,
80  SQUEEZE = 9,
81  ADJUST = 10,
82  STABLE = 11,
83  UNSTABLE = 12,
84  BEAMDUMP = 13,
85  RAMPDOWN = 14,
86  RECOVERY = 15,
87  INJDUMP = 16,
88  CIRCDUMP = 17,
89  ABORT = 18,
90  CYCLING = 19,
91  WBDUMP = 20,
92  NOBEAM = 21
93  };
94 
95  enum Errors {
96  UNKNOWN = 1,
103  };
104 
105 public:
106  L1TBPTX(const edm::ParameterSet& ps); // Constructor
107  ~L1TBPTX() override; // Destructor
108 
109 protected:
110  void analyze(const edm::Event& e, const edm::EventSetup& c) override; // Analyze
111  void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) override;
112  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
113 
114  void beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
115  void endLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
116 
117  // Private Methods
118 private:
119  void getBeamConfOMDS();
120  void doFractionInSync(bool iForce = false, bool iBad = false);
121  void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue);
122 
123  // Variables
124 private:
126  std::vector<edm::ParameterSet> m_monitorBits;
127  std::vector<edm::ParameterSet> m_monitorRates;
128  std::string m_outputFile; // file name for ROOT ouput
129 
130  // bool
131  bool m_verbose;
134 
135  // Int
136  std::map<TString, int> m_effNumerator;
137  std::map<TString, int> m_effDenominator;
138  std::map<TString, int> m_missFireNumerator;
139  std::map<TString, int> m_missFireDenominator;
140 
143  unsigned int m_currentLS; // Current LS
144  unsigned int m_currentGTLS;
145  //unsigned int m_eventLS;
146  unsigned int m_lhcFill; //
147 
148  // Vectors
149  BeamConfiguration m_beamConfig; // Current Bunch Structure
150  std::vector<std::pair<int, int> > m_selAlgoBit;
151  std::vector<std::pair<int, int> > m_selTechBit;
152 
153  // Const Vectors
154  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
155  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
156 
157  // Maps
158  std::map<int, TString> m_algoBit_Alias;
159  std::map<int, TString> m_techBit_Alias;
160 
161  std::map<TString, MonitorElement*> m_meAlgoEfficiency;
162  std::map<TString, MonitorElement*> m_meAlgoMissFire;
163  std::map<TString, MonitorElement*> m_meTechEfficiency;
164  std::map<TString, MonitorElement*> m_meTechMissFire;
165 
166  std::map<std::pair<bool, int>, MonitorElement*> m_meRate;
167  std::map<std::pair<bool, int>, double> m_l1Rate;
168 
169  // MonitorElement
171 
172  // Input tags
176 };
177 
178 #endif
L1TBPTX::L1TBPTX
L1TBPTX(const edm::ParameterSet &ps)
Definition: L1TBPTX.cc:33
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
L1TBPTX::UNKNOWN
Definition: L1TBPTX.h:96
L1TBPTX::STABLE
Definition: L1TBPTX.h:82
L1TBPTX::m_verbose
bool m_verbose
Definition: L1TBPTX.h:131
L1TBPTX::ABORT
Definition: L1TBPTX.h:89
L1TBPTX::m_prescaleFactorsAlgoTrig
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:154
L1TBPTX::m_meTechEfficiency
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:163
RateBuffer::getLSRate
double getLSRate(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:54
L1TBPTX::m_parameters
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:125
L1TBPTX::m_currentLSValid
bool m_currentLSValid
Definition: L1TBPTX.h:132
L1TBPTX::INJDUMP
Definition: L1TBPTX.h:87
MessageLogger.h
L1TBPTX::m_meAlgoEfficiency
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:161
ESHandle.h
L1TBPTX::INJNOMN
Definition: L1TBPTX.h:76
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
L1TBPTX::WBDUMP
Definition: L1TBPTX.h:91
edm::Run
Definition: Run.h:45
L1TBPTX::m_missFireDenominator
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:139
edm::EDGetTokenT< Level1TriggerScalersCollection >
L1TBPTX::CIRCDUMP
Definition: L1TBPTX.h:88
LuminosityBlock.h
L1TBPTX::m_missFireNumerator
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:138
L1TBPTX::m_monitorRates
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:127
L1TBPTX::m_currentLS
unsigned int m_currentLS
Definition: L1TBPTX.h:143
L1TBPTX::doFractionInSync
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TBPTX.cc:575
DQMOneEDAnalyzer
Definition: DQMOneEDAnalyzer.h:20
L1TBPTX::ERROR_LSBLOCK_NOTVALID
Definition: L1TBPTX.h:102
DQMStore.h
L1TBPTX::UNSTABLE
Definition: L1TBPTX.h:83
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
L1TBPTX::ERROR_UNABLE_RETRIVE_PRODUCT
Definition: L1TBPTX.h:100
EDAnalyzer.h
L1TBPTX::BEAMDUMP
Definition: L1TBPTX.h:84
L1TBPTX
Definition: L1TBPTX.h:69
L1TBPTX::getBeamConfOMDS
void getBeamConfOMDS()
Definition: L1TBPTX.cc:496
L1TBPTX::SQUEEZE
Definition: L1TBPTX.h:80
L1TBPTX::m_refPrescaleSet
int m_refPrescaleSet
Definition: L1TBPTX.h:141
RateBuffer::m_lsTechRate
std::map< std::pair< int, int >, double > m_lsTechRate
Definition: L1TBPTX.h:66
RPCpg::rate
double rate(double x)
Definition: Constants.cc:3
L1TBPTX::m_scalersSource
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:173
L1TBPTX::ADJUST
Definition: L1TBPTX.h:81
L1TBPTX::m_l1Rate
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:167
L1TBPTX::m_monitorBits
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:126
L1TBPTX::m_l1GtEvmSource
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:174
DQMOneEDAnalyzer.h
L1TBPTX::m_techBit_Alias
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:159
L1TBPTX::PRERAMP
Definition: L1TBPTX.h:77
L1TBPTX::m_l1GtDataDaqInputTag
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:175
MakerMacros.h
RateBuffer
Definition: L1TBPTX.h:45
L1GlobalTriggerEvmReadoutRecord.h
Level1TriggerScalers.h
RateBuffer::fill
void fill(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:47
L1TBPTX::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TBPTX.cc:327
L1TBPTX::WARNING_DB_CONN_FAILED
Definition: L1TBPTX.h:97
L1TBPTX::Errors
Errors
Definition: L1TBPTX.h:95
L1TBPTX::NOMODE
Definition: L1TBPTX.h:72
Service.h
L1TBPTX::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TBPTX.cc:246
L1TBPTX::m_prescaleFactorsTechTrig
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:155
L1TBPTX::INJPILOT
Definition: L1TBPTX.h:74
L1TBPTX::~L1TBPTX
~L1TBPTX() override
Definition: L1TBPTX.cc:65
L1TBPTX::WARNING_DB_INCORRECT_NBUNCHES
Definition: L1TBPTX.h:99
L1TBPTX::NOBEAM
Definition: L1TBPTX.h:92
L1TBPTX::FLATTOP
Definition: L1TBPTX.h:79
L1TBPTX::m_effDenominator
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:137
L1TBPTX::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TBPTX.cc:209
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
RateBuffer::getLSTechRate
double getLSTechRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:62
L1TBPTX::m_meTechMissFire
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:164
L1TBPTX::m_selTechBit
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:151
L1TBPTX::m_ErrorMonitor
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:170
L1TBPTX::RECOVERY
Definition: L1TBPTX.h:86
L1TBPTX::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TBPTX.cc:216
edm::EventSetup
Definition: EventSetup.h:57
L1TBPTX::m_effNumerator
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:136
L1TBPTX::certifyLSBlock
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
Definition: L1TBPTX.cc:585
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1TBPTX::m_selAlgoBit
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:150
L1TBPTX::m_beamConfig
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:149
L1TBPTX::ERROR_TRIGGERALIAS_NOTVALID
Definition: L1TBPTX.h:101
BeamConfiguration
Definition: L1TOMDSHelper.h:19
L1TBPTX::CYCLING
Definition: L1TBPTX.h:90
L1TBPTX::RAMP
Definition: L1TBPTX.h:78
L1TBPTX::RAMPDOWN
Definition: L1TBPTX.h:85
L1TBPTX::m_lhcFill
unsigned int m_lhcFill
Definition: L1TBPTX.h:146
L1TBPTX::m_processedLS
bool * m_processedLS
Definition: L1TBPTX.h:133
Frameworkfwd.h
L1TBPTX::SETUP
Definition: L1TBPTX.h:73
L1TBPTX::m_meRate
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:166
L1TBPTX::m_meAlgoMissFire
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:162
dqm::implementation::IBooker
Definition: DQMStore.h:43
L1TBPTX::m_algoBit_Alias
std::map< int, TString > m_algoBit_Alias
Definition: L1TBPTX.h:158
L1TBPTX::m_currentGTLS
unsigned int m_currentGTLS
Definition: L1TBPTX.h:144
RateBuffer::getLSAlgoRate
double getLSAlgoRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:61
ParameterSet.h
L1TBPTX::BeamMode
BeamMode
Definition: L1TBPTX.h:71
edm::Event
Definition: Event.h:73
L1TBPTX::m_currentPrescalesIndex
int m_currentPrescalesIndex
Definition: L1TBPTX.h:142
RateBuffer::m_lsAlgoRate
std::map< std::pair< int, int >, double > m_lsAlgoRate
Definition: L1TBPTX.h:65
L1GlobalTriggerReadoutRecord.h
L1TBPTX::INJINTR
Definition: L1TBPTX.h:75
L1TBPTX::bookHistograms
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
Definition: L1TBPTX.cc:70
L1TBPTX::m_outputFile
std::string m_outputFile
Definition: L1TBPTX.h:128
L1TOMDSHelper.h
L1TBPTX::WARNING_DB_QUERY_FAILED
Definition: L1TBPTX.h:98
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37