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 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
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:102
L1TBPTX::STABLE
Definition: L1TBPTX.h:88
L1TBPTX::m_verbose
bool m_verbose
Definition: L1TBPTX.h:137
L1TBPTX::ABORT
Definition: L1TBPTX.h:95
L1TBPTX::m_prescaleFactorsAlgoTrig
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:160
L1TBPTX::m_meTechEfficiency
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:169
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:131
L1GtPrescaleFactors
Definition: L1GtPrescaleFactors.h:32
L1TBPTX::m_currentLSValid
bool m_currentLSValid
Definition: L1TBPTX.h:138
L1TBPTX::INJDUMP
Definition: L1TBPTX.h:93
MessageLogger.h
L1TBPTX::m_meAlgoEfficiency
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:167
ESHandle.h
L1TBPTX::INJNOMN
Definition: L1TBPTX.h:82
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
L1TBPTX::WBDUMP
Definition: L1TBPTX.h:97
edm::Run
Definition: Run.h:45
L1TBPTX::m_missFireDenominator
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:145
edm::EDGetTokenT< Level1TriggerScalersCollection >
L1TBPTX::CIRCDUMP
Definition: L1TBPTX.h:94
LuminosityBlock.h
L1TBPTX::m_missFireNumerator
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:144
L1TBPTX::m_monitorRates
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:133
L1TBPTX::m_currentLS
unsigned int m_currentLS
Definition: L1TBPTX.h:149
L1TBPTX::doFractionInSync
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TBPTX.cc:573
DQMOneEDAnalyzer
Definition: DQMOneEDAnalyzer.h:20
L1TBPTX::ERROR_LSBLOCK_NOTVALID
Definition: L1TBPTX.h:108
DQMStore.h
L1TBPTX::UNSTABLE
Definition: L1TBPTX.h:89
L1TBPTX::l1gtMenuToken_
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > l1gtMenuToken_
Definition: L1TBPTX.h:182
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
L1TBPTX::ERROR_UNABLE_RETRIVE_PRODUCT
Definition: L1TBPTX.h:106
EDAnalyzer.h
L1TBPTX::BEAMDUMP
Definition: L1TBPTX.h:90
L1TBPTX
Definition: L1TBPTX.h:75
L1TBPTX::getBeamConfOMDS
void getBeamConfOMDS()
Definition: L1TBPTX.cc:494
L1TBPTX::SQUEEZE
Definition: L1TBPTX.h:86
L1TBPTX::m_refPrescaleSet
int m_refPrescaleSet
Definition: L1TBPTX.h:147
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:179
L1GtPrescaleFactorsTechTrigRcd
Definition: L1GtPrescaleFactorsTechTrigRcd.h:38
L1TBPTX::ADJUST
Definition: L1TBPTX.h:87
L1TBPTX::m_l1Rate
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:173
L1TBPTX::m_monitorBits
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:132
L1TBPTX::m_l1GtEvmSource
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:180
DQMOneEDAnalyzer.h
L1TBPTX::m_techBit_Alias
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:165
L1TBPTX::PRERAMP
Definition: L1TBPTX.h:83
L1TBPTX::m_l1GtDataDaqInputTag
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:181
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:325
L1TBPTX::WARNING_DB_CONN_FAILED
Definition: L1TBPTX.h:103
L1TBPTX::Errors
Errors
Definition: L1TBPTX.h:101
L1TBPTX::NOMODE
Definition: L1TBPTX.h:78
Service.h
L1TBPTX::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TBPTX.cc:244
L1GtTriggerMenuRcd
Definition: L1GtTriggerMenuRcd.h:32
L1TBPTX::m_prescaleFactorsTechTrig
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:161
L1TBPTX::INJPILOT
Definition: L1TBPTX.h:80
L1TBPTX::~L1TBPTX
~L1TBPTX() override
Definition: L1TBPTX.cc:68
L1TBPTX::WARNING_DB_INCORRECT_NBUNCHES
Definition: L1TBPTX.h:105
L1TBPTX::NOBEAM
Definition: L1TBPTX.h:98
L1TBPTX::FLATTOP
Definition: L1TBPTX.h:85
L1TBPTX::m_effDenominator
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:143
L1TBPTX::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TBPTX.cc:207
L1TBPTX::l1GtPfAlgoToken_
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > l1GtPfAlgoToken_
Definition: L1TBPTX.h:183
edm::ParameterSet
Definition: ParameterSet.h:47
L1GtTriggerMenu
Definition: L1GtTriggerMenu.h:48
Event.h
L1TBPTX::l1GtPfTechToken_
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd > l1GtPfTechToken_
Definition: L1TBPTX.h:184
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:170
L1TBPTX::m_selTechBit
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:157
L1TBPTX::m_ErrorMonitor
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:176
L1TBPTX::RECOVERY
Definition: L1TBPTX.h:92
L1TBPTX::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TBPTX.cc:214
edm::EventSetup
Definition: EventSetup.h:58
L1TBPTX::m_effNumerator
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:142
L1TBPTX::certifyLSBlock
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
Definition: L1TBPTX.cc:583
L1TBPTX::m_selAlgoBit
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:156
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TBPTX::m_beamConfig
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:155
L1TBPTX::ERROR_TRIGGERALIAS_NOTVALID
Definition: L1TBPTX.h:107
BeamConfiguration
Definition: L1TOMDSHelper.h:19
L1TBPTX::CYCLING
Definition: L1TBPTX.h:96
L1TBPTX::RAMP
Definition: L1TBPTX.h:84
L1TBPTX::RAMPDOWN
Definition: L1TBPTX.h:91
L1TBPTX::m_lhcFill
unsigned int m_lhcFill
Definition: L1TBPTX.h:152
L1TBPTX::m_processedLS
bool * m_processedLS
Definition: L1TBPTX.h:139
Frameworkfwd.h
L1TBPTX::SETUP
Definition: L1TBPTX.h:79
L1TBPTX::m_meRate
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:172
L1TBPTX::m_meAlgoMissFire
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:168
dqm::implementation::IBooker
Definition: DQMStore.h:43
L1TBPTX::m_algoBit_Alias
std::map< int, TString > m_algoBit_Alias
Definition: L1TBPTX.h:164
L1TBPTX::m_currentGTLS
unsigned int m_currentGTLS
Definition: L1TBPTX.h:150
RateBuffer::getLSAlgoRate
double getLSAlgoRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:61
ParameterSet.h
L1TBPTX::BeamMode
BeamMode
Definition: L1TBPTX.h:77
L1GtPrescaleFactorsAlgoTrigRcd
Definition: L1GtPrescaleFactorsAlgoTrigRcd.h:38
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
L1TBPTX::m_currentPrescalesIndex
int m_currentPrescalesIndex
Definition: L1TBPTX.h:148
RateBuffer::m_lsAlgoRate
std::map< std::pair< int, int >, double > m_lsAlgoRate
Definition: L1TBPTX.h:65
L1GlobalTriggerReadoutRecord.h
L1TBPTX::INJINTR
Definition: L1TBPTX.h:81
L1TBPTX::bookHistograms
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
Definition: L1TBPTX.cc:73
L1TBPTX::m_outputFile
std::string m_outputFile
Definition: L1TBPTX.h:134
L1TOMDSHelper.h
L1TBPTX::WARNING_DB_QUERY_FAILED
Definition: L1TBPTX.h:104
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37