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 
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 one::DQMEDAnalyzer<edm::one::WatchLuminosityBlocks> {
73 
74  public:
75 
76  enum BeamMode{
77  NOMODE=1,
78  SETUP=2,
79  INJPILOT=3,
80  INJINTR=4,
81  INJNOMN=5,
82  PRERAMP=6,
83  RAMP=7,
84  FLATTOP=8,
85  SQUEEZE=9,
86  ADJUST=10,
87  STABLE=11,
88  UNSTABLE=12,
89  BEAMDUMP=13,
90  RAMPDOWN=14,
91  RECOVERY=15,
92  INJDUMP=16,
93  CIRCDUMP=17,
94  ABORT=18,
95  CYCLING=19,
96  WBDUMP=20,
97  NOBEAM=21
98  };
99 
100  enum Errors{
101  UNKNOWN = 1,
102  WARNING_DB_CONN_FAILED = 2,
103  WARNING_DB_QUERY_FAILED = 3,
104  WARNING_DB_INCORRECT_NBUNCHES = 4,
105  ERROR_UNABLE_RETRIVE_PRODUCT = 5,
106  ERROR_TRIGGERALIAS_NOTVALID = 6,
107  ERROR_LSBLOCK_NOTVALID = 7
108  };
109 
110  public:
111 
112  L1TBPTX(const edm::ParameterSet& ps); // Constructor
113  ~L1TBPTX() override; // Destructor
114 
115  protected:
116 
117  void analyze (const edm::Event& e, const edm::EventSetup& c) override; // Analyze
118  void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run&, const edm::EventSetup&) override;
119  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
120 
121  void beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
122  void endLuminosityBlock (edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
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
unsigned int m_lhcFill
Definition: L1TBPTX.h:156
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
0: Unidentified isolated particle
Definition: ParticleCode.h:19
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
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
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
bool * m_processedLS
Definition: L1TBPTX.h:143
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
def ls(path, rec=False)
Definition: eostools.py:349
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:137
bool m_currentLSValid
Definition: L1TBPTX.h:142
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
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
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:45
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:185
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:148