CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
29 
31 
32 //Data Formats
36 
38 
39 #include <TString.h>
40 
41 #include <iostream>
42 #include <fstream>
43 #include <string>
44 #include <vector>
45 
46 class RateBuffer{
47 
48  public:
49 
50  void fill (int ls,bool isAlgo,int bit,double rate){
51  if(isAlgo){m_lsAlgoRate[std::pair<int,int>(ls,bit)]=rate;}
52  else {m_lsTechRate[std::pair<int,int>(ls,bit)]=rate;}
53  }
54  double getLSRate (int ls,bool isAlgo,int bit,double rate){
55  if(isAlgo){return m_lsAlgoRate[std::pair<int,int>(ls,bit)];}
56  else {return m_lsTechRate[std::pair<int,int>(ls,bit)];}
57  }
58  double getLSAlgoRate(int ls,int bit,double rate){
59  return m_lsAlgoRate[std::pair<int,int>(ls,bit)];
60  }
61  double getLSTechRate(int ls,int bit,double rate){
62  return m_lsTechRate[std::pair<int,int>(ls,bit)];
63  }
64 
65  private:
66 
67  std::map<std::pair<int,int>,double> m_lsAlgoRate;
68  std::map<std::pair<int,int>,double> m_lsTechRate;
69 
70 };
71 
72 class L1TBPTX : public DQMEDAnalyzer {
73 
74  public:
75 
76  enum BeamMode{
77  NOMODE=1,
78  SETUP=2,
83  RAMP=7,
86  ADJUST=10,
87  STABLE=11,
92  INJDUMP=16,
94  ABORT=18,
95  CYCLING=19,
96  WBDUMP=20,
97  NOBEAM=21
98  };
99 
100  enum Errors{
101  UNKNOWN = 1,
108  };
109 
110  public:
111 
112  L1TBPTX(const edm::ParameterSet& ps); // Constructor
113  virtual ~L1TBPTX(); // Destructor
114 
115  protected:
116 
117  void analyze (const edm::Event& e, const edm::EventSetup& c); // Analyze
118  virtual void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run&, const edm::EventSetup&) override;
119  virtual void dqmBeginRun(const edm::Run&, const edm::EventSetup&);
120 
121  virtual void beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c);
122  virtual void endLuminosityBlock (edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c);
123 
124 
125  // Private Methods
126  private:
127 
128  void getBeamConfOMDS();
129  void doFractionInSync(bool iForce=false, bool iBad=false);
130  void certifyLSBlock (std::string iTrigger, int iInitLs, int iEndLs ,float iValue);
131 
132  // Variables
133  private:
134 
136  std::vector<edm::ParameterSet> m_monitorBits;
137  std::vector<edm::ParameterSet> m_monitorRates;
138  std::string m_outputFile; // file name for ROOT ouput
139 
140  // bool
141  bool m_verbose;
144 
145  // Int
146  std::map<TString,int> m_effNumerator;
147  std::map<TString,int> m_effDenominator;
148  std::map<TString,int> m_missFireNumerator;
149  std::map<TString,int> m_missFireDenominator;
150 
153  unsigned int m_currentLS; // Current LS
154  unsigned int m_currentGTLS;
155  //unsigned int m_eventLS;
156  unsigned int m_lhcFill; //
157 
158  // Vectors
159  BeamConfiguration m_beamConfig; // Current Bunch Structure
160  std::vector< std::pair<int,int> > m_selAlgoBit;
161  std::vector< std::pair<int,int> > m_selTechBit;
162 
163  // Const Vectors
164  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
165  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
166 
167  // Maps
168  std::map<int,TString> m_algoBit_Alias;
169  std::map<int,TString> m_techBit_Alias;
170 
171 
172  std::map<TString,MonitorElement*> m_meAlgoEfficiency;
173  std::map<TString,MonitorElement*> m_meAlgoMissFire;
174  std::map<TString,MonitorElement*> m_meTechEfficiency;
175  std::map<TString,MonitorElement*> m_meTechMissFire;
176 
177 
178  std::map<std::pair<bool,int>,MonitorElement*> m_meRate;
179  std::map<std::pair<bool,int>,double> m_l1Rate;
180 
181  // MonitorElement
183 
184  // Input tags
188 
189 };
190 
191 #endif
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:174
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TBPTX.cc:312
unsigned int m_lhcFill
Definition: L1TBPTX.h:156
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TBPTX.cc:528
virtual void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
Definition: L1TBPTX.cc:235
double getLSTechRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:61
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:172
std::string m_outputFile
Definition: L1TBPTX.h:138
std::map< std::pair< int, int >, double > m_lsAlgoRate
Definition: L1TBPTX.h:67
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
Definition: L1TBPTX.cc:203
def ls
Definition: eostools.py:348
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:187
unsigned int m_currentLS
Definition: L1TBPTX.h:153
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:160
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:186
L1TBPTX(const edm::ParameterSet &ps)
Definition: L1TBPTX.cc:32
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:159
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:178
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:161
BeamMode
Definition: L1TBPTX.h:76
bool * m_processedLS
Definition: L1TBPTX.h:143
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
Definition: L1TBPTX.cc:196
virtual ~L1TBPTX()
Definition: L1TBPTX.cc:68
virtual 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:58
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:173
bool m_verbose
Definition: L1TBPTX.h:141
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:165
int m_refPrescaleSet
Definition: L1TBPTX.h:151
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:147
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:135
int m_currentPrescalesIndex
Definition: L1TBPTX.h:152
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:541
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:137
bool m_currentLSValid
Definition: L1TBPTX.h:142
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:149
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:169
double rate(double x)
Definition: Constants.cc:3
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:136
unsigned int m_currentGTLS
Definition: L1TBPTX.h:154
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:146
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:175
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:179
void getBeamConfOMDS()
Definition: L1TBPTX.cc:457
std::map< int, TString > m_algoBit_Alias
Definition: L1TBPTX.h:168
void fill(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:50
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:182
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:164
std::map< std::pair< int, int >, double > m_lsTechRate
Definition: L1TBPTX.h:68
Definition: Run.h:43
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:185
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:148