CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
L1TSync Class Reference

#include <L1TSync.h>

Inheritance diagram for L1TSync:
DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks > edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  BeamMode {
  NOMODE = 1, SETUP = 2, INJPILOT = 3, INJINTR = 4,
  INJNOMN = 5, PRERAMP = 6, RAMP = 7, FLATTOP = 8,
  QUEEZE = 9, ADJUST = 10, STABLE = 11, UNSTABLE = 12,
  BEAMDUMP = 13, RAMPDOWN = 14, RECOVERY = 15, INJDUMP = 16,
  CIRCDUMP = 17, ABORT = 18, CYCLING = 19, WBDUMP = 20,
  NOBEAM = 21
}
 
enum  Errors {
  UNKNOWN = 1, WARNING_DB_CONN_FAILED = 2, WARNING_DB_QUERY_FAILED = 3, WARNING_DB_INCORRECT_NBUNCHES = 4,
  ERROR_UNABLE_RETRIVE_PRODUCT = 5, ERROR_TRIGGERALIAS_NOTVALID = 6, ERROR_LSBLOCK_NOTVALID = 7
}
 
- Public Types inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 L1TSync (const edm::ParameterSet &ps)
 
 ~L1TSync () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
 
void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 BeginRun. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
virtual void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)=0
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void certifyLSBlock (std::string iTrigger, int iInitLs, int iEndLs, float iValue)
 
void doFractionInSync (bool iForce=false, bool iBad=false)
 
void getBeamConfOMDS ()
 

Private Attributes

const std::vector< std::vector< int > > * ListsPrescaleFactors
 
std::map< std::string, bool > m_algoAutoSelect
 
std::map< TString, int > m_algoBit
 
std::map< TString, MonitorElement * > m_algoCertification
 
std::map< TString, MonitorElement * > m_algoVsBunchStructure
 
BeamConfiguration m_beamConfig
 
std::map< TString, unsigned int > m_certFirstLS
 
std::map< TString, unsigned int > m_certLastLS
 
unsigned int m_currentLS
 
bool m_currentLSValid
 
MonitorElementm_ErrorMonitor
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_l1GtDataDaqInputTag
 
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecordm_l1GtEvmSource
 
L1GtUtils m_l1GtUtils
 
unsigned int m_lhcFill
 
std::string m_outputFile
 
edm::ParameterSet m_parameters
 
bool * m_processedLS
 
int m_refPrescaleSet
 
std::map< std::string, std::string > m_selectedTriggers
 
bool m_verbose
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 46 of file L1TSync.h.

Member Enumeration Documentation

Enumerator
NOMODE 
SETUP 
INJPILOT 
INJINTR 
INJNOMN 
PRERAMP 
RAMP 
FLATTOP 
QUEEZE 
ADJUST 
STABLE 
UNSTABLE 
BEAMDUMP 
RAMPDOWN 
RECOVERY 
INJDUMP 
CIRCDUMP 
ABORT 
CYCLING 
WBDUMP 
NOBEAM 

Definition at line 48 of file L1TSync.h.

48  {
49  NOMODE = 1,
50  SETUP = 2,
51  INJPILOT = 3,
52  INJINTR = 4,
53  INJNOMN = 5,
54  PRERAMP = 6,
55  RAMP = 7,
56  FLATTOP = 8,
57  QUEEZE = 9,
58  ADJUST = 10,
59  STABLE = 11,
60  UNSTABLE = 12,
61  BEAMDUMP = 13,
62  RAMPDOWN = 14,
63  RECOVERY = 15,
64  INJDUMP = 16,
65  CIRCDUMP = 17,
66  ABORT = 18,
67  CYCLING = 19,
68  WBDUMP = 20,
69  NOBEAM = 21
70  };
Enumerator
UNKNOWN 
WARNING_DB_CONN_FAILED 
WARNING_DB_QUERY_FAILED 
WARNING_DB_INCORRECT_NBUNCHES 
ERROR_UNABLE_RETRIVE_PRODUCT 
ERROR_TRIGGERALIAS_NOTVALID 
ERROR_LSBLOCK_NOTVALID 

Definition at line 72 of file L1TSync.h.

Constructor & Destructor Documentation

L1TSync::L1TSync ( const edm::ParameterSet ps)

Definition at line 40 of file L1TSync.cc.

References L1TSync_cfi::Categories, gather_cfg::cout, L1TSync_cfi::doGlobalAutoSelection, L1TSync_cfi::forceGlobalParameters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_algoAutoSelect, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_outputFile, m_parameters, m_refPrescaleSet, m_selectedTriggers, m_verbose, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

40  : m_l1GtUtils(pset, consumesCollector(), false, *this) {
42 
43  // Mapping parameter input variables
44  m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter<InputTag>("inputTagL1GtDataDaq"));
45  m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter<InputTag>("inputTagtEvmSource"));
46  m_verbose = pset.getUntrackedParameter<bool>("verbose", false);
47  m_refPrescaleSet = pset.getParameter<int>("refPrescaleSet");
48 
49  // Getting which categories to monitor
50  ParameterSet Categories = pset.getParameter<ParameterSet>("Categories");
51 
52  bool forceGlobalParameters = Categories.getParameter<bool>("forceGlobalParameters");
53  bool doGlobalAutoSelection = Categories.getParameter<bool>("doGlobalAutoSelection");
54 
55  ParameterSet CatBPTX = Categories.getParameter<ParameterSet>("BPTX");
56  ParameterSet CatMu = Categories.getParameter<ParameterSet>("Mu");
57  ParameterSet CatEG = Categories.getParameter<ParameterSet>("EG");
58  ParameterSet CatIsoEG = Categories.getParameter<ParameterSet>("IsoEG");
59  ParameterSet CatJet = Categories.getParameter<ParameterSet>("Jet");
60  ParameterSet CatCenJet = Categories.getParameter<ParameterSet>("CenJet");
61  ParameterSet CatForJet = Categories.getParameter<ParameterSet>("ForJet");
62  ParameterSet CatTauJet = Categories.getParameter<ParameterSet>("TauJet");
63  ParameterSet CatETM = Categories.getParameter<ParameterSet>("ETT");
64  ParameterSet CatETT = Categories.getParameter<ParameterSet>("ETM");
65  ParameterSet CatHTT = Categories.getParameter<ParameterSet>("HTT");
66  ParameterSet CatHTM = Categories.getParameter<ParameterSet>("HTM");
67 
68  // --> Setting parameters related to which algos to monitor
69  // If global parameters are forced they take precedence over algo-by-algo parameters
71  // If global automatic selection if enable all categories set to be monitored will have
72  // their algos auto selected (the lowest prescale algo will be selected)
74  if (CatMu.getParameter<bool>("monitor")) {
75  m_algoAutoSelect["Mu"] = true;
76  } else {
77  m_algoAutoSelect["Mu"] = false;
78  }
79  if (CatEG.getParameter<bool>("monitor")) {
80  m_algoAutoSelect["EG"] = true;
81  } else {
82  m_algoAutoSelect["EG"] = false;
83  }
84  if (CatIsoEG.getParameter<bool>("monitor")) {
85  m_algoAutoSelect["IsoEG"] = true;
86  } else {
87  m_algoAutoSelect["IsoEG"] = false;
88  }
89  if (CatJet.getParameter<bool>("monitor")) {
90  m_algoAutoSelect["Jet"] = true;
91  } else {
92  m_algoAutoSelect["Jet"] = false;
93  }
94  if (CatCenJet.getParameter<bool>("monitor")) {
95  m_algoAutoSelect["CenJet"] = true;
96  } else {
97  m_algoAutoSelect["CenJet"] = false;
98  }
99  if (CatForJet.getParameter<bool>("monitor")) {
100  m_algoAutoSelect["ForJet"] = true;
101  } else {
102  m_algoAutoSelect["ForJet"] = false;
103  }
104  if (CatTauJet.getParameter<bool>("monitor")) {
105  m_algoAutoSelect["TauJet"] = true;
106  } else {
107  m_algoAutoSelect["TauJet"] = false;
108  }
109  if (CatETM.getParameter<bool>("monitor")) {
110  m_algoAutoSelect["ETM"] = true;
111  } else {
112  m_algoAutoSelect["ETM"] = false;
113  }
114  if (CatETT.getParameter<bool>("monitor")) {
115  m_algoAutoSelect["ETT"] = true;
116  } else {
117  m_algoAutoSelect["ETT"] = false;
118  }
119  if (CatHTM.getParameter<bool>("monitor")) {
120  m_algoAutoSelect["HTM"] = true;
121  } else {
122  m_algoAutoSelect["HTM"] = false;
123  }
124  if (CatHTT.getParameter<bool>("monitor")) {
125  m_algoAutoSelect["HTT"] = true;
126  } else {
127  m_algoAutoSelect["HTT"] = false;
128  }
129 
130  // If global non-automatic selection is enable all categories set to be monitored will use
131  // user defined algos
132  } else {
133  m_algoAutoSelect["Mu"] = false;
134  m_algoAutoSelect["EG"] = false;
135  m_algoAutoSelect["IsoEG"] = false;
136  m_algoAutoSelect["Jet"] = false;
137  m_algoAutoSelect["CenJet"] = false;
138  m_algoAutoSelect["ForJet"] = false;
139  m_algoAutoSelect["TauJet"] = false;
140  m_algoAutoSelect["ETM"] = false;
141  m_algoAutoSelect["ETT"] = false;
142  m_algoAutoSelect["HTM"] = false;
143  m_algoAutoSelect["HTT"] = false;
144 
145  if (CatMu.getParameter<bool>("monitor")) {
146  m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");
147  }
148  if (CatEG.getParameter<bool>("monitor")) {
149  m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");
150  }
151  if (CatIsoEG.getParameter<bool>("monitor")) {
152  m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");
153  }
154  if (CatJet.getParameter<bool>("monitor")) {
155  m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");
156  }
157  if (CatCenJet.getParameter<bool>("monitor")) {
158  m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");
159  }
160  if (CatForJet.getParameter<bool>("monitor")) {
161  m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");
162  }
163  if (CatTauJet.getParameter<bool>("monitor")) {
164  m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");
165  }
166  if (CatETM.getParameter<bool>("monitor")) {
167  m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");
168  }
169  if (CatETT.getParameter<bool>("monitor")) {
170  m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");
171  }
172  if (CatHTM.getParameter<bool>("monitor")) {
173  m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");
174  }
175  if (CatHTT.getParameter<bool>("monitor")) {
176  m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");
177  }
178  }
179 
180  // If we are using algo-by-algo parametes we get them and set what is needed
181  } else {
182  if (CatBPTX.getParameter<bool>("monitor")) {
183  m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
184  }
185 
186  if (CatMu.getParameter<bool>("monitor")) {
187  m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
188  if (!m_algoAutoSelect["Mu"]) {
189  m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");
190  }
191  } else {
192  m_algoAutoSelect["Mu"] = false;
193  }
194 
195  if (CatEG.getParameter<bool>("monitor")) {
196  m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
197  if (!m_algoAutoSelect["EG"]) {
198  m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");
199  }
200  } else {
201  m_algoAutoSelect["EG"] = false;
202  }
203 
204  if (CatIsoEG.getParameter<bool>("monitor")) {
205  m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
206  if (!m_algoAutoSelect["IsoEG"]) {
207  m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");
208  }
209  } else {
210  m_algoAutoSelect["IsoEG"] = false;
211  }
212 
213  if (CatJet.getParameter<bool>("monitor")) {
214  m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
215  if (!m_algoAutoSelect["Jet"]) {
216  m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");
217  }
218  } else {
219  m_algoAutoSelect["Jet"] = false;
220  }
221 
222  if (CatCenJet.getParameter<bool>("monitor")) {
223  m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
224  if (!m_algoAutoSelect["CenJet"]) {
225  m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");
226  }
227  } else {
228  m_algoAutoSelect["CenJet"] = false;
229  }
230 
231  if (CatForJet.getParameter<bool>("monitor")) {
232  m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
233  if (!m_algoAutoSelect["CatForJet"]) {
234  m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");
235  }
236  } else {
237  m_algoAutoSelect["CatForJet"] = false;
238  }
239 
240  if (CatTauJet.getParameter<bool>("monitor")) {
241  m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
242  if (!m_algoAutoSelect["TauJet"]) {
243  m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");
244  }
245  } else {
246  m_algoAutoSelect["TauJet"] = false;
247  }
248 
249  if (CatETM.getParameter<bool>("monitor")) {
250  m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
251  if (!m_algoAutoSelect["ETM"]) {
252  m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");
253  }
254  } else {
255  m_algoAutoSelect["ETM"] = false;
256  }
257 
258  if (CatETT.getParameter<bool>("monitor")) {
259  m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
260  if (!m_algoAutoSelect["ETT"]) {
261  m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");
262  }
263  } else {
264  m_algoAutoSelect["ETT"] = false;
265  }
266 
267  if (CatHTM.getParameter<bool>("monitor")) {
268  m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
269  if (!m_algoAutoSelect["HTM"]) {
270  m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");
271  }
272  } else {
273  m_algoAutoSelect["HTM"] = false;
274  }
275 
276  if (CatHTT.getParameter<bool>("monitor")) {
277  m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
278  if (!m_algoAutoSelect["HTT"]) {
279  m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");
280  }
281  } else {
282  m_algoAutoSelect["HTT"] = false;
283  }
284  }
285 
286  m_outputFile = pset.getUntrackedParameter<std::string>("outputFile", "");
287 
288  if (!m_outputFile.empty()) {
289  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
290  }
291 
292  bool disable = pset.getUntrackedParameter<bool>("disableROOToutput", false);
293  if (disable) {
294  m_outputFile = "";
295  }
296 }
int m_refPrescaleSet
Definition: L1TSync.h:112
bool m_verbose
Definition: L1TSync.h:107
std::string m_outputFile
Definition: L1TSync.h:104
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TSync.h:137
std::map< std::string, bool > m_algoAutoSelect
Definition: L1TSync.h:129
edm::ParameterSet m_parameters
Definition: L1TSync.h:102
L1GtUtils m_l1GtUtils
Definition: L1TSync.h:139
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TSync.h:136
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:130
L1TSync::~L1TSync ( )
override

Definition at line 300 of file L1TSync.cc.

300 {}

Member Function Documentation

void L1TSync::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 482 of file L1TSync.cc.

References a, funct::abs(), BeamConfiguration::beam1, BeamConfiguration::beam2, L1GtfeExtWord::beamMode(), BeamConfiguration::bxConfig(), gather_cfg::cout, ERROR_UNABLE_RETRIVE_PRODUCT, getBeamConfOMDS(), edm::Event::getByToken(), dqm::impl::MonitorElement::getTH1(), L1GlobalTriggerReadoutRecord::gtFdlVector(), L1GlobalTriggerEvmReadoutRecord::gtfeWord(), mps_fire::i, BeamConfiguration::isValid(), edm::HandleBase::isValid(), L1GtfeExtWord::lhcFillNumber(), m_algoBit, m_algoVsBunchStructure, m_beamConfig, m_currentLS, m_currentLSValid, m_ErrorMonitor, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_lhcFill, m_selectedTriggers, m_verbose, and STABLE.

482  {
483  if (m_verbose) {
484  cout << "[L1TSync] Called analyze." << endl;
485  }
486 
487  // We only start analyzing if current LS is still valid
488  if (m_currentLSValid) {
489  if (m_verbose) {
490  cout << "[L1TSync] -> m_currentLSValid=" << m_currentLSValid << endl;
491  }
492 
493  // Retriving information from GT
495  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
496 
497  // Determining beam mode and fill number
498  if (gtEvmReadoutRecord.isValid()) {
499  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
500  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
501 
502  if (m_lhcFill == 0) {
503  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
504  getBeamConfOMDS(); // Getting Beam Configuration from OMDS
505  }
506 
507  if (lhcBeamMode != STABLE) {
508  m_currentLSValid = false;
509  } // If Beams are not stable we invalidate this LS
510 
511  } else {
512  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
513  eCount++;
514  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT, eCount);
515  }
516  } else {
517  if (m_verbose) {
518  cout << "[L1TSync] -> m_currentLSValid=" << m_currentLSValid << endl;
519  }
520  }
521 
522  //------------------------------------------------------------------------------
523  // If current LS is valid and Beam Configuration is Valid we analyse this event
524  //------------------------------------------------------------------------------
526  // Getting Final Decision Logic (FDL) Data from GT
527  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
528  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
529 
530  if (gtReadoutRecordData.isValid()) {
531  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
532 
533  // Running over selected triggers
534  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
535  string tTrigger = (*i).second;
536 
537  // Analyse only defined triggers
538  if (tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)") {
539  bool beamSingleConfig = false; // Single beam configured for this event
540  bool firedAlgo = false; // Algo fired in this event
541  int eventBx = -1;
542 
543  // Running over FDL results to get which bits fired
544  for (unsigned int a = 0; a < gtFdlVectorData.size(); a++) {
545  // Selecting the FDL that triggered
546  if (gtFdlVectorData[a].bxInEvent() == 0) {
547  eventBx = gtFdlVectorData[a].localBxNr();
548  if (gtFdlVectorData[a].gtDecisionWord()[m_algoBit[tTrigger]]) {
549  firedAlgo = true;
550  }
551  }
552  }
553 
554  // Checking beam configuration
555  if (m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]) {
556  beamSingleConfig = true;
557  }
558  if (!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]) {
559  beamSingleConfig = true;
560  }
561 
562  // Analyse only if this trigger fired in this event
563  // NOTE: Veto cases where a single beam is configured since
564  // for this cases this could be a real-satelite bunch collision
565  // -> Calculate the minimum bx diference between this event and a configured bx
566  if (firedAlgo && !beamSingleConfig) {
567  int DifAlgoVsBunchStructure = 9999; // Majorated
568 
569  for (unsigned int a = 0; a < gtFdlVectorData.size(); a++) {
570  int bxFDL = gtFdlVectorData[a].localBxNr();
571  int bxInEvent = gtFdlVectorData[a].bxInEvent();
572 
573  if (m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent) < abs(DifAlgoVsBunchStructure)) {
574  DifAlgoVsBunchStructure = -1 * bxInEvent;
575  }
576  }
577 
578  m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS, DifAlgoVsBunchStructure);
579  }
580  }
581  }
582  } else {
583  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
584  eCount++;
585  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT, eCount);
586  }
587  }
588 }
std::map< TString, int > m_algoBit
Definition: L1TSync.h:124
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
unsigned int m_lhcFill
Definition: L1TSync.h:115
BeamConfiguration m_beamConfig
Definition: L1TSync.h:118
bool m_verbose
Definition: L1TSync.h:107
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:128
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool bxConfig(int iBx)
Definition: L1TOMDSHelper.h:26
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TSync.h:137
const cms_uint32_t lhcFillNumber() const
void getBeamConfOMDS()
Definition: L1TSync.cc:595
bool m_currentLSValid
Definition: L1TSync.h:108
double a
Definition: hdecay.h:119
std::vector< bool > beam2
Definition: L1TOMDSHelper.h:39
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:133
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TSync.h:136
std::vector< bool > beam1
Definition: L1TOMDSHelper.h:38
const cms_uint16_t beamMode() const
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:130
unsigned int m_currentLS
Definition: L1TSync.h:113
void L1TSync::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 385 of file L1TSync.cc.

References gather_cfg::cout, doFractionInSync(), mps_fire::i, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), m_certFirstLS, m_currentLS, m_currentLSValid, m_selectedTriggers, and m_verbose.

385  {
386  if (m_verbose) {
387  cout << "[L1TSync] Called beginLuminosityBlock." << endl;
388  }
389 
390  // If this LS is not the next to last one force closing of current LS blocks
391  // for certification
392  if (m_currentLS != 0 && m_currentLS + 1 != lumiBlock.id().luminosityBlock()) {
393  if (m_verbose) {
394  cout << "[L1TSync] None consecutive: doFractionInSync() - LAST=" << m_currentLS
395  << " CURRENT=" << lumiBlock.id().luminosityBlock() << endl;
396  }
397  doFractionInSync(true, false);
398  }
399 
400  // Updating current LS number
401  m_currentLS = lumiBlock.id().luminosityBlock();
402 
403  // If this is the fist valid LS update first LS for certification
404  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
405  string theTriggerAlias = (*i).second;
406  if (m_certFirstLS[theTriggerAlias] == 0) {
407  m_certFirstLS[theTriggerAlias] = m_currentLS;
408  }
409  }
410 
411  // A LS will be valid if:
412  // * BeamMode == STABLE for all events monitored
413  m_currentLSValid = true;
414 }
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TSync.cc:675
bool m_verbose
Definition: L1TSync.h:107
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:125
bool m_currentLSValid
Definition: L1TSync.h:108
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:130
unsigned int m_currentLS
Definition: L1TSync.h:113
void L1TSync::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 311 of file L1TSync.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::book2D(), ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, ERROR_UNABLE_RETRIVE_PRODUCT, edm::EventSetup::get(), L1TMenuHelper::getLUSOTrigger(), L1GtTriggerMenu::gtAlgorithmAliasMap(), mps_fire::i, m_algoAutoSelect, m_algoBit, m_algoCertification, m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_currentLS, m_ErrorMonitor, m_l1GtUtils, m_lhcFill, m_refPrescaleSet, m_selectedTriggers, optionsL1T::menu, edm::ESHandle< T >::product(), L1GtUtils::retrieveL1EventSetup(), dqm::impl::MonitorElement::setBinLabel(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), L1TMenuHelper::testAlgos(), UNKNOWN, WARNING_DB_CONN_FAILED, WARNING_DB_INCORRECT_NBUNCHES, and WARNING_DB_QUERY_FAILED.

311  {
312  // Initializing variables
313  int maxNbins = 2501;
314 
315  // Reseting run dependent variables
316  m_lhcFill = 0;
317  m_currentLS = 0;
318  m_certFirstLS.clear();
319  m_certLastLS.clear();
320 
321  // Getting Trigger menu from GT
323  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
324  const L1GtTriggerMenu* menu = menuRcd.product();
325 
326  // Filling Alias-Bit Map
327  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo != menu->gtAlgorithmAliasMap().end(); ++algo) {
328  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
329  }
330 
331  // Getting fill number for this run
332  //Handle<ConditionsInRunBlock> runConditions;
333  //iRun.getByType(runConditions);
334  //int lhcFillNumber = runConditions->lhcFillNumber;
335 
336  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
337  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
338  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
339 
340  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
341 
343 
345  map<string, string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
346  m_selectedTriggers.insert(tAutoSelTrig.begin(), tAutoSelTrig.end());
347 
348  // Initializing DQM Monitor Elements
349  ibooker.setCurrentFolder("L1T/L1TSync");
350  m_ErrorMonitor = ibooker.book1D("ErrorMonitor", "ErrorMonitor", 7, 0, 7);
351  m_ErrorMonitor->setBinLabel(UNKNOWN, "UNKNOWN");
352  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED, "WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
353  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED, "WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
355  "WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
356  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT, "ERROR_UNABLE_RETRIVE_PRODUCT");
357  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID, "ERROR_TRIGGERALIAS_NOTVALID");
358  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID, "ERROR_LSBLOCK_NOTVALID");
359 
360  // Looping over selected triggers
361  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
362  string tCategory = (*i).first;
363  string tTrigger = (*i).second;
364 
365  // Initializing LS blocks for certification
366  m_certFirstLS[(*i).second] = 0;
367  m_certLastLS[(*i).second] = 0;
368 
369  // Initializing DQM Monitors
370  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
371  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(
372  tCategory, "min #Delta(" + tTrigger + ",Bunch)", maxNbins, -0.5, double(maxNbins) - 0.5, 5, -2.5, 2.5);
373  m_algoVsBunchStructure[tTrigger]->setAxisTitle("Lumi Section", 1);
374 
375  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
376  m_algoCertification[tTrigger] =
377  ibooker.book1D(tCategory, "fraction of in sync: " + tTrigger, maxNbins, -0.5, double(maxNbins) - 0.5);
378  m_algoCertification[tTrigger]->setAxisTitle("Lumi Section", 1);
379  }
380 }
int m_refPrescaleSet
Definition: L1TSync.h:112
std::map< TString, int > m_algoBit
Definition: L1TSync.h:124
unsigned int m_lhcFill
Definition: L1TSync.h:115
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:128
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:112
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:125
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
std::map< std::string, bool > m_algoAutoSelect
Definition: L1TSync.h:129
std::map< TString, MonitorElement * > m_algoCertification
Definition: L1TSync.h:127
L1GtUtils m_l1GtUtils
Definition: L1TSync.h:139
T get() const
Definition: EventSetup.h:73
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:126
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:133
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
T const * product() const
Definition: ESHandle.h:86
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:130
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)
unsigned int m_currentLS
Definition: L1TSync.h:113
void L1TSync::certifyLSBlock ( std::string  iTrigger,
int  iInitLs,
int  iEndLs,
float  iValue 
)
private

Definition at line 778 of file L1TSync.cc.

References eostools::ls(), and m_algoCertification.

Referenced by doFractionInSync().

778  {
779  // Finding correct bins in the histogram for this block
780  int binInit = m_algoCertification[iTrigger]->getTH1()->FindBin(iInitLs);
781  int binEnd = m_algoCertification[iTrigger]->getTH1()->FindBin(iEndLs);
782 
783  for (int ls = binInit; ls <= binEnd; ls++) {
784  m_algoCertification[iTrigger]->setBinContent(ls, iValue);
785  }
786 }
def ls(path, rec=False)
Definition: eostools.py:349
std::map< TString, MonitorElement * > m_algoCertification
Definition: L1TSync.h:127
void L1TSync::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 675 of file L1TSync.cc.

References a, certifyLSBlock(), gather_cfg::cout, ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, hcaldqm::quantity::fLS, HLT_2018_cff::fraction, edm::ParameterSet::getParameter(), dqm::impl::MonitorElement::getTH1(), mps_fire::i, eostools::ls(), m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_ErrorMonitor, m_parameters, m_selectedTriggers, and m_verbose.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

675  {
676  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
677  string theCategory = (*i).first;
678  string theTriggerAlias = (*i).second;
679 
680  // Caching frequently used values from maps
681  unsigned int fLS = m_certFirstLS[theTriggerAlias];
682  unsigned int lLS = m_certLastLS[theTriggerAlias];
683 
684  // Checking validity of the trigger alias and of the LS block
685  bool triggerAlias_isValid = theTriggerAlias != "Undefined" && theTriggerAlias != "Undefined (Wrong Name)";
686  bool lsBlock_exists = !(fLS == 0 && lLS == 0);
687  bool lsBlock_isValid = fLS <= lLS && fLS > 0 && lLS > 0;
688 
689  if (triggerAlias_isValid && lsBlock_exists && lsBlock_isValid) {
690  // If we are forced to close blocks and mark them bad
691  if (iForce && iBad) {
692  certifyLSBlock(theTriggerAlias, fLS, lLS, -1);
693  m_certFirstLS[theTriggerAlias] = 0;
694  m_certLastLS[theTriggerAlias] = 0;
695  }
696 
697  // If we are not forced to mark bad, we check if we have enough statistics
698  else {
699  // Getting events with 0 bx difference between BPTX and Algo for current LS
700  double CountSync = 0;
701  double CountAll = 0;
702 
703  // Adding all entries for current LS block
704  for (unsigned int ls = fLS; ls <= lLS; ls++) {
705  CountSync += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(ls + 1, 3);
706  for (int a = 1; a < 6; a++) {
707  CountAll += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(ls + 1, a);
708  }
709  }
710 
711  if (m_verbose) {
712  cout << "Alias = " << theTriggerAlias << " InitLS=" << fLS << " EndLS=" << lLS << " Events=" << CountAll;
713  }
714 
715  if (iForce || CountAll >= m_parameters.getParameter<ParameterSet>("Categories")
716  .getParameter<ParameterSet>(theCategory)
717  .getParameter<int>("CertMinEvents")) {
718  if (m_verbose) {
719  cout << " <--------------- Enough Statistics: ";
720  }
721 
722  // Calculating fraction of in time
723  double fraction = 0;
724  if (CountAll > 0) {
725  fraction = CountSync / CountAll;
726  }
727 
728  // This is to avoid having an entry equal to zero and thus
729  // disregarded by the automatic tests
730  if (fraction == 0) {
731  fraction = 0.000001;
732  }
733 
734  certifyLSBlock(theTriggerAlias, fLS, lLS, fraction);
735  m_certFirstLS[theTriggerAlias] = 0;
736  m_certLastLS[theTriggerAlias] = 0;
737  }
738 
739  if (m_verbose) {
740  cout << endl;
741  }
742  }
743  }
744 
745  // A problem was found. We report it and set a not physical vale (-1) to the certification plot
746  else {
747  // If trigger alias is not valid report it to m_ErrorMonitor
748  if (!triggerAlias_isValid) {
749  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_TRIGGERALIAS_NOTVALID);
750  eCount++;
751  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_TRIGGERALIAS_NOTVALID, eCount);
752  certifyLSBlock(theTriggerAlias, fLS, lLS, -1);
753  m_certFirstLS[theTriggerAlias] = 0;
754  m_certLastLS[theTriggerAlias] = 0;
755  }
756 
757  // If LS Block is not valid report it to m_ErrorMonitor
758  if (lsBlock_exists && !lsBlock_isValid) {
759  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_LSBLOCK_NOTVALID);
760  eCount++;
761  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_LSBLOCK_NOTVALID, eCount);
762  certifyLSBlock(theTriggerAlias, fLS, lLS, -1);
763  m_certFirstLS[theTriggerAlias] = 0;
764  m_certLastLS[theTriggerAlias] = 0;
765  }
766  }
767  }
768 }
T getParameter(std::string const &) const
bool m_verbose
Definition: L1TSync.h:107
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:128
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
Definition: L1TSync.cc:778
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:125
def ls(path, rec=False)
Definition: eostools.py:349
edm::ParameterSet m_parameters
Definition: L1TSync.h:102
double a
Definition: hdecay.h:119
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:126
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:133
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:130
void L1TSync::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

BeginRun.

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 304 of file L1TSync.cc.

References gather_cfg::cout, and m_verbose.

304  {
305  //
306  if (m_verbose) {
307  cout << "[L1TSync] Called beginRun." << endl;
308  }
309 }
bool m_verbose
Definition: L1TSync.h:107
void L1TSync::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 420 of file L1TSync.cc.

References gather_cfg::cout, doFractionInSync(), mps_fire::i, BeamConfiguration::isValid(), m_beamConfig, m_certFirstLS, m_certLastLS, m_currentLS, m_currentLSValid, m_selectedTriggers, and m_verbose.

420  {
421  if (m_verbose) {
422  cout << "[L1TSync] Called endLuminosityBlock." << endl;
423  }
424 
425  if (m_verbose) {
426  cout << "[L1TSync] m_currentLSValid : " << m_currentLSValid << endl;
427  cout << "[L1TSync] m_beamConfig.isValid(): " << m_beamConfig.isValid() << endl;
428  }
429 
430  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
431  // Update last LS for certification
432  string theTriggerAlias = (*i).second;
433  m_certLastLS[theTriggerAlias] = m_currentLS;
434  }
435 
436  // If this LS is valid (i.e. all events recorded with stable beams)
438  if (m_verbose) {
439  cout << "[L1TSync] Regular call: doFractionInSync()" << endl;
440  }
441  doFractionInSync(false, false);
442 
443  }
444  // If this LS is not valid it can be in the following context:
445  // * We still hadn't stable beam (no need to certify nothing
446  // * Beam just got unstable or dumped (we may have a complete block of data do certify)
447  else {
448  //-> First we close all blocks from certFirstLS[] to m_currentLS-1
449  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
450  string theTriggerAlias = (*i).second;
451 
452  int fLs = m_certFirstLS[theTriggerAlias];
453  int lLS = m_certLastLS[theTriggerAlias];
454 
455  // If this is a single LS block we do nothing (in this step)
456  if (fLs == lLS) {
457  m_certFirstLS[theTriggerAlias] = 0;
458  m_certLastLS[theTriggerAlias] = 0;
459  }
460  // If block is multi LS then we remove the current LS
461  else {
462  m_certLastLS[theTriggerAlias] = m_currentLS - 1;
463  }
464  }
465  doFractionInSync(true, false);
466 
467  //-> Second we mark this single LS bad for all triggers
468  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
469  string theTriggerAlias = (*i).second;
470  m_certFirstLS[theTriggerAlias] = m_currentLS;
471  m_certLastLS[theTriggerAlias] = m_currentLS;
472  }
473  doFractionInSync(true, true);
474 
475  if (m_verbose) {
476  cout << "[L1TSync] Error call: doFractionInSync()" << endl;
477  }
478  }
479 }
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TSync.cc:675
BeamConfiguration m_beamConfig
Definition: L1TSync.h:118
bool m_verbose
Definition: L1TSync.h:107
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:125
bool m_currentLSValid
Definition: L1TSync.h:108
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:126
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:130
unsigned int m_currentLS
Definition: L1TSync.h:113
void L1TSync::getBeamConfOMDS ( )
private

Definition at line 595 of file L1TSync.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), dqm::impl::MonitorElement::getTH1(), m_beamConfig, m_ErrorMonitor, m_lhcFill, m_parameters, BeamConfiguration::m_valid, m_verbose, BeamConfiguration::nCollidingBunches, L1TOMDSHelper::NO_ERROR, L1TBPTX_cfi::oracleDB, L1TBPTX_cfi::pathCondDB, UNKNOWN, L1TOMDSHelper::WARNING_DB_CONN_FAILED, WARNING_DB_CONN_FAILED, WARNING_DB_INCORRECT_NBUNCHES, L1TOMDSHelper::WARNING_DB_QUERY_FAILED, and WARNING_DB_QUERY_FAILED.

Referenced by analyze().

595  {
596  //Getting connection paremeters
597  string oracleDB = m_parameters.getParameter<string>("oracleDB");
598  string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
599 
600  // Connecting to OMDS
601  L1TOMDSHelper myOMDSHelper = L1TOMDSHelper();
602  int conError;
603  myOMDSHelper.connect(oracleDB, pathCondDB, conError);
604 
605  if (conError == L1TOMDSHelper::NO_ERROR) {
606  if (m_verbose) {
607  cout << "[L1TSync] Connected to DB with no error." << endl;
608  }
609 
610  int errorRetrive;
611  m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill, errorRetrive);
612 
613  if (errorRetrive == L1TOMDSHelper::NO_ERROR) {
614  if (m_verbose) {
615  cout << "[L1TSync] Retriving LHC Bunch Structure: NO_ERROR" << endl;
616  cout << "[L1TSync] -> LHC Bunch Structure valid=" << m_beamConfig.m_valid
617  << " nBunches=" << m_beamConfig.nCollidingBunches << endl;
618  }
619  } else if (errorRetrive == L1TOMDSHelper::WARNING_DB_CONN_FAILED) {
620  if (m_verbose) {
621  cout << "[L1TSync] Retriving LHC Bunch Structure: WARNING_DB_CONN_FAILED" << endl;
622  }
623 
624  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_INCORRECT_NBUNCHES);
625  eCount++;
626  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_INCORRECT_NBUNCHES, eCount);
627  } else if (errorRetrive == L1TOMDSHelper::WARNING_DB_QUERY_FAILED) {
628  if (m_verbose) {
629  cout << "[L1TSync] Retriving LHC Bunch Structure: WARNING_DB_QUERY_FAILED" << endl;
630  }
631 
632  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_QUERY_FAILED);
633  eCount++;
634  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_QUERY_FAILED, eCount);
635  } else {
636  if (m_verbose) {
637  cout << "[L1TSync] Retriving LHC Bunch Structure: UNKNOWN" << endl;
638  }
639 
640  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
641  eCount++;
642  m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN, eCount);
643  }
644 
645  } else {
646  if (conError == L1TOMDSHelper::WARNING_DB_CONN_FAILED) {
647  if (m_verbose) {
648  cout << "[L1TSync] Connect to DB: WARNING_DB_CONN_FAILED" << endl;
649  }
650 
651  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_CONN_FAILED);
652  eCount++;
653  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_CONN_FAILED, eCount);
654  } else {
655  if (m_verbose) {
656  cout << "[L1TSync] Connect to DB: UNKNOWN" << endl;
657  }
658 
659  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
660  eCount++;
661  m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN, eCount);
662  }
663  }
664 }
T getParameter(std::string const &) const
unsigned int m_lhcFill
Definition: L1TSync.h:115
BeamConfiguration m_beamConfig
Definition: L1TSync.h:118
bool m_verbose
Definition: L1TSync.h:107
edm::ParameterSet m_parameters
Definition: L1TSync.h:102
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:133

Member Data Documentation

const std::vector<std::vector<int> >* L1TSync::ListsPrescaleFactors
private

Definition at line 121 of file L1TSync.h.

std::map<std::string, bool> L1TSync::m_algoAutoSelect
private

Definition at line 129 of file L1TSync.h.

Referenced by bookHistograms(), and L1TSync().

std::map<TString, int> L1TSync::m_algoBit
private

Definition at line 124 of file L1TSync.h.

Referenced by analyze(), and bookHistograms().

std::map<TString, MonitorElement*> L1TSync::m_algoCertification
private

Definition at line 127 of file L1TSync.h.

Referenced by bookHistograms(), and certifyLSBlock().

std::map<TString, MonitorElement*> L1TSync::m_algoVsBunchStructure
private

Definition at line 128 of file L1TSync.h.

Referenced by analyze(), bookHistograms(), and doFractionInSync().

BeamConfiguration L1TSync::m_beamConfig
private

Definition at line 118 of file L1TSync.h.

Referenced by analyze(), endLuminosityBlock(), and getBeamConfOMDS().

std::map<TString, unsigned int> L1TSync::m_certFirstLS
private
std::map<TString, unsigned int> L1TSync::m_certLastLS
private

Definition at line 126 of file L1TSync.h.

Referenced by bookHistograms(), doFractionInSync(), and endLuminosityBlock().

unsigned int L1TSync::m_currentLS
private

Definition at line 113 of file L1TSync.h.

Referenced by analyze(), beginLuminosityBlock(), bookHistograms(), and endLuminosityBlock().

bool L1TSync::m_currentLSValid
private

Definition at line 108 of file L1TSync.h.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().

MonitorElement* L1TSync::m_ErrorMonitor
private

Definition at line 133 of file L1TSync.h.

Referenced by analyze(), bookHistograms(), doFractionInSync(), and getBeamConfOMDS().

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1TSync::m_l1GtDataDaqInputTag
private

Definition at line 137 of file L1TSync.h.

Referenced by analyze(), and L1TSync().

edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> L1TSync::m_l1GtEvmSource
private

Definition at line 136 of file L1TSync.h.

Referenced by analyze(), and L1TSync().

L1GtUtils L1TSync::m_l1GtUtils
private

Definition at line 139 of file L1TSync.h.

Referenced by bookHistograms().

unsigned int L1TSync::m_lhcFill
private

Definition at line 115 of file L1TSync.h.

Referenced by analyze(), bookHistograms(), and getBeamConfOMDS().

std::string L1TSync::m_outputFile
private

Definition at line 104 of file L1TSync.h.

Referenced by L1TSync().

edm::ParameterSet L1TSync::m_parameters
private

Definition at line 102 of file L1TSync.h.

Referenced by doFractionInSync(), getBeamConfOMDS(), and L1TSync().

bool* L1TSync::m_processedLS
private

Definition at line 109 of file L1TSync.h.

int L1TSync::m_refPrescaleSet
private

Definition at line 112 of file L1TSync.h.

Referenced by bookHistograms(), and L1TSync().

std::map<std::string, std::string> L1TSync::m_selectedTriggers
private
bool L1TSync::m_verbose
private