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 
37 #include <TString.h>
38 
39 #include <iostream>
40 #include <fstream>
41 #include <string>
42 #include <vector>
43 
44 class RateBuffer{
45 
46  public:
47 
48  void fill (int ls,bool isAlgo,int bit,double rate){
49  if(isAlgo){m_lsAlgoRate[std::pair<int,int>(ls,bit)]=rate;}
50  else {m_lsTechRate[std::pair<int,int>(ls,bit)]=rate;}
51  }
52  double getLSRate (int ls,bool isAlgo,int bit,double rate){
53  if(isAlgo){return m_lsAlgoRate[std::pair<int,int>(ls,bit)];}
54  else {return m_lsTechRate[std::pair<int,int>(ls,bit)];}
55  }
56  double getLSAlgoRate(int ls,int bit,double rate){
57  return m_lsAlgoRate[std::pair<int,int>(ls,bit)];
58  }
59  double getLSTechRate(int ls,int bit,double rate){
60  return m_lsTechRate[std::pair<int,int>(ls,bit)];
61  }
62 
63  private:
64 
65  std::map<std::pair<int,int>,double> m_lsAlgoRate;
66  std::map<std::pair<int,int>,double> m_lsTechRate;
67 
68 };
69 
70 class L1TBPTX : public edm::EDAnalyzer {
71 
72  public:
73 
74  enum BeamMode{
75  NOMODE=1,
76  SETUP=2,
81  RAMP=7,
84  ADJUST=10,
85  STABLE=11,
90  INJDUMP=16,
92  ABORT=18,
93  CYCLING=19,
94  WBDUMP=20,
95  NOBEAM=21
96  };
97 
98  enum Errors{
99  UNKNOWN = 1,
106  };
107 
108  public:
109 
110  L1TBPTX(const edm::ParameterSet& ps); // Constructor
111  virtual ~L1TBPTX(); // Destructor
112 
113  protected:
114 
115  void analyze (const edm::Event& e, const edm::EventSetup& c); // Analyze
116  void beginJob(); // BeginJob
117  void endJob (void); // EndJob
118  void beginRun(const edm::Run& run, const edm::EventSetup& iSetup);
119  void endRun (const edm::Run& run, const edm::EventSetup& iSetup);
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 
135  DQMStore * dbe; // The DQM Service Handle
136 
138  std::vector<edm::ParameterSet> m_monitorBits;
139  std::vector<edm::ParameterSet> m_monitorRates;
140  std::string m_outputFile; // file name for ROOT ouput
141 
142  // bool
143  bool m_verbose;
146 
147  // Int
148  std::map<TString,int> m_effNumerator;
149  std::map<TString,int> m_effDenominator;
150  std::map<TString,int> m_missFireNumerator;
151  std::map<TString,int> m_missFireDenominator;
152 
155  unsigned int m_currentLS; // Current LS
156  unsigned int m_currentGTLS;
157  //unsigned int m_eventLS;
158  unsigned int m_lhcFill; //
159 
160  // Vectors
161  BeamConfiguration m_beamConfig; // Current Bunch Structure
162  std::vector< std::pair<int,int> > m_selAlgoBit;
163  std::vector< std::pair<int,int> > m_selTechBit;
164 
165  // Const Vectors
166  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
167  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
168 
169  // Maps
170  std::map<int,TString> m_algoBit_Alias;
171  std::map<int,TString> m_techBit_Alias;
172 
173 
174  std::map<TString,MonitorElement*> m_meAlgoEfficiency;
175  std::map<TString,MonitorElement*> m_meAlgoMissFire;
176  std::map<TString,MonitorElement*> m_meTechEfficiency;
177  std::map<TString,MonitorElement*> m_meTechMissFire;
178 
179 
180  std::map<std::pair<bool,int>,MonitorElement*> m_meRate;
181  std::map<std::pair<bool,int>,double> m_l1Rate;
182 
183  // MonitorElement
185 
186  // Input tags
190 
191 };
192 
193 #endif
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:176
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TBPTX.cc:348
unsigned int m_lhcFill
Definition: L1TBPTX.h:158
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TBPTX.cc:565
virtual void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
Definition: L1TBPTX.cc:264
double getLSTechRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:59
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:174
std::string m_outputFile
Definition: L1TBPTX.h:140
std::map< std::pair< int, int >, double > m_lsAlgoRate
Definition: L1TBPTX.h:65
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
Definition: L1TBPTX.cc:232
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:189
unsigned int m_currentLS
Definition: L1TBPTX.h:155
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:162
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:188
L1TBPTX(const edm::ParameterSet &ps)
Definition: L1TBPTX.cc:32
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:161
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:180
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:163
BeamMode
Definition: L1TBPTX.h:74
bool * m_processedLS
Definition: L1TBPTX.h:145
void beginJob()
Definition: L1TBPTX.cc:77
virtual ~L1TBPTX()
Definition: L1TBPTX.cc:73
double getLSAlgoRate(int ls, int bit, double rate)
Definition: L1TBPTX.h:56
DQMStore * dbe
Definition: L1TBPTX.h:135
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:175
bool m_verbose
Definition: L1TBPTX.h:143
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:167
int m_refPrescaleSet
Definition: L1TBPTX.h:153
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:149
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:137
int m_currentPrescalesIndex
Definition: L1TBPTX.h:154
double getLSRate(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:52
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
Definition: L1TBPTX.cc:578
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:139
bool m_currentLSValid
Definition: L1TBPTX.h:144
void endRun(const edm::Run &run, const edm::EventSetup &iSetup)
Definition: L1TBPTX.cc:340
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:151
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:171
double rate(double x)
Definition: Constants.cc:3
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:138
unsigned int m_currentGTLS
Definition: L1TBPTX.h:156
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:148
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:177
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:181
Errors
Definition: L1TBPTX.h:98
void getBeamConfOMDS()
Definition: L1TBPTX.cc:494
std::map< int, TString > m_algoBit_Alias
Definition: L1TBPTX.h:170
void fill(int ls, bool isAlgo, int bit, double rate)
Definition: L1TBPTX.h:48
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup)
BeginRun.
Definition: L1TBPTX.cc:108
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:184
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:166
void endJob(void)
Definition: L1TBPTX.cc:94
std::map< std::pair< int, int >, double > m_lsTechRate
Definition: L1TBPTX.h:66
Definition: Run.h:41
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:187
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:150