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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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) override
 
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
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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
 
L1TMenuHelper::Tokens m_helperTokens
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_l1GtDataDaqInputTag
 
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecordm_l1GtEvmSource
 
L1GtUtils m_l1GtUtils
 
unsigned int m_lhcFill
 
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcdm_menuToken
 
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 44 of file L1TSync.h.

Member Enumeration Documentation

◆ BeamMode

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 46 of file L1TSync.h.

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

◆ Errors

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 70 of file L1TSync.h.

Constructor & Destructor Documentation

◆ L1TSync()

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

Definition at line 37 of file L1TSync.cc.

References L1TSync_cfi::Categories, gather_cfg::cout, L1TSync_cfi::doGlobalAutoSelection, L1TSync_cfi::forceGlobalParameters, m_algoAutoSelect, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_outputFile, m_parameters, m_refPrescaleSet, m_selectedTriggers, m_verbose, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

38  : m_menuToken(esConsumes<edm::Transition::BeginRun>()),
39  m_helperTokens(L1TMenuHelper::consumes<edm::Transition::BeginRun>(consumesCollector())),
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:110
L1TMenuHelper::Tokens m_helperTokens
Definition: L1TSync.h:137
bool m_verbose
Definition: L1TSync.h:105
std::string m_outputFile
Definition: L1TSync.h:102
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TSync.h:135
std::map< std::string, bool > m_algoAutoSelect
Definition: L1TSync.h:127
edm::ParameterSet m_parameters
Definition: L1TSync.h:100
L1GtUtils m_l1GtUtils
Definition: L1TSync.h:139
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TSync.h:134
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:128
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_menuToken
Definition: L1TSync.h:136

◆ ~L1TSync()

L1TSync::~L1TSync ( )
override

Definition at line 300 of file L1TSync.cc.

300 {}

Member Function Documentation

◆ analyze()

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

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

Definition at line 480 of file L1TSync.cc.

References a, funct::abs(), BeamConfiguration::beam1, BeamConfiguration::beam2, L1GtfeExtWord::beamMode(), BeamConfiguration::bxConfig(), gather_cfg::cout, ERROR_UNABLE_RETRIVE_PRODUCT, getBeamConfOMDS(), dqm::impl::MonitorElement::getTH1(), L1GlobalTriggerReadoutRecord::gtFdlVector(), L1GlobalTriggerEvmReadoutRecord::gtfeWord(), mps_fire::i, iEvent, 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.

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

◆ beginLuminosityBlock()

void L1TSync::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 383 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.

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

◆ bookHistograms()

void L1TSync::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 311 of file L1TSync.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, ERROR_UNABLE_RETRIVE_PRODUCT, edm::EventSetup::getData(), L1TMenuHelper::getLUSOTrigger(), mps_fire::i, m_algoAutoSelect, m_algoBit, m_algoCertification, m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_currentLS, m_ErrorMonitor, m_helperTokens, m_l1GtUtils, m_lhcFill, m_menuToken, m_refPrescaleSet, m_selectedTriggers, optionsL1T::menu, L1GtUtils::retrieveL1EventSetup(), dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::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
322  const L1GtTriggerMenu& menu = iSetup.getData(m_menuToken);
323 
324  // Filling Alias-Bit Map
325  for (const auto& algo : menu.gtAlgorithmAliasMap()) {
326  m_algoBit[algo.second.algoAlias()] = algo.second.algoBitNumber();
327  }
328 
329  // Getting fill number for this run
330  //Handle<ConditionsInRunBlock> runConditions;
331  //iRun.getByType(runConditions);
332  //int lhcFillNumber = runConditions->lhcFillNumber;
333 
334  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
335  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
336  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
337 
338  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup, m_helperTokens);
339 
341 
343  map<string, string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
344  m_selectedTriggers.insert(tAutoSelTrig.begin(), tAutoSelTrig.end());
345 
346  // Initializing DQM Monitor Elements
347  ibooker.setCurrentFolder("L1T/L1TSync");
348  m_ErrorMonitor = ibooker.book1D("ErrorMonitor", "ErrorMonitor", 7, 0, 7);
349  m_ErrorMonitor->setBinLabel(UNKNOWN, "UNKNOWN");
350  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED, "WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
351  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED, "WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
353  "WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
354  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT, "ERROR_UNABLE_RETRIVE_PRODUCT");
355  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID, "ERROR_TRIGGERALIAS_NOTVALID");
356  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID, "ERROR_LSBLOCK_NOTVALID");
357 
358  // Looping over selected triggers
359  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
360  string tCategory = (*i).first;
361  string tTrigger = (*i).second;
362 
363  // Initializing LS blocks for certification
364  m_certFirstLS[(*i).second] = 0;
365  m_certLastLS[(*i).second] = 0;
366 
367  // Initializing DQM Monitors
368  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
369  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(
370  tCategory, "min #Delta(" + tTrigger + ",Bunch)", maxNbins, -0.5, double(maxNbins) - 0.5, 5, -2.5, 2.5);
371  m_algoVsBunchStructure[tTrigger]->setAxisTitle("Lumi Section", 1);
372 
373  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
374  m_algoCertification[tTrigger] =
375  ibooker.book1D(tCategory, "fraction of in sync: " + tTrigger, maxNbins, -0.5, double(maxNbins) - 0.5);
376  m_algoCertification[tTrigger]->setAxisTitle("Lumi Section", 1);
377  }
378 }
int m_refPrescaleSet
Definition: L1TSync.h:110
void retrieveL1EventSetup(const edm::EventSetup &, bool isRun=true)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:128
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::map< TString, int > m_algoBit
Definition: L1TSync.h:122
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
L1TMenuHelper::Tokens m_helperTokens
Definition: L1TSync.h:137
unsigned int m_lhcFill
Definition: L1TSync.h:113
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:126
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:123
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:127
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
std::map< TString, MonitorElement * > m_algoCertification
Definition: L1TSync.h:125
L1GtUtils m_l1GtUtils
Definition: L1TSync.h:139
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:124
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:131
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:128
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:111
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_menuToken
Definition: L1TSync.h:136

◆ certifyLSBlock()

void L1TSync::certifyLSBlock ( std::string  iTrigger,
int  iInitLs,
int  iEndLs,
float  iValue 
)
private

Definition at line 776 of file L1TSync.cc.

References eostools::ls(), and m_algoCertification.

Referenced by doFractionInSync().

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

◆ doFractionInSync()

void L1TSync::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 673 of file L1TSync.cc.

References a, certifyLSBlock(), gather_cfg::cout, ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, hcaldqm::quantity::fLS, HLT_2023v12_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().

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

◆ dqmBeginRun()

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:105

◆ endLuminosityBlock()

void L1TSync::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 418 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.

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

◆ getBeamConfOMDS()

void L1TSync::getBeamConfOMDS ( )
private

Definition at line 593 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().

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

Member Data Documentation

◆ ListsPrescaleFactors

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

Definition at line 119 of file L1TSync.h.

◆ m_algoAutoSelect

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

Definition at line 127 of file L1TSync.h.

Referenced by bookHistograms(), and L1TSync().

◆ m_algoBit

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

Definition at line 122 of file L1TSync.h.

Referenced by analyze(), and bookHistograms().

◆ m_algoCertification

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

Definition at line 125 of file L1TSync.h.

Referenced by bookHistograms(), and certifyLSBlock().

◆ m_algoVsBunchStructure

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

Definition at line 126 of file L1TSync.h.

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

◆ m_beamConfig

BeamConfiguration L1TSync::m_beamConfig
private

Definition at line 116 of file L1TSync.h.

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

◆ m_certFirstLS

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

◆ m_certLastLS

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

Definition at line 124 of file L1TSync.h.

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

◆ m_currentLS

unsigned int L1TSync::m_currentLS
private

Definition at line 111 of file L1TSync.h.

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

◆ m_currentLSValid

bool L1TSync::m_currentLSValid
private

Definition at line 106 of file L1TSync.h.

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

◆ m_ErrorMonitor

MonitorElement* L1TSync::m_ErrorMonitor
private

Definition at line 131 of file L1TSync.h.

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

◆ m_helperTokens

L1TMenuHelper::Tokens L1TSync::m_helperTokens
private

Definition at line 137 of file L1TSync.h.

Referenced by bookHistograms().

◆ m_l1GtDataDaqInputTag

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

Definition at line 135 of file L1TSync.h.

Referenced by analyze(), and L1TSync().

◆ m_l1GtEvmSource

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

Definition at line 134 of file L1TSync.h.

Referenced by analyze(), and L1TSync().

◆ m_l1GtUtils

L1GtUtils L1TSync::m_l1GtUtils
private

Definition at line 139 of file L1TSync.h.

Referenced by bookHistograms().

◆ m_lhcFill

unsigned int L1TSync::m_lhcFill
private

Definition at line 113 of file L1TSync.h.

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

◆ m_menuToken

const edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> L1TSync::m_menuToken
private

Definition at line 136 of file L1TSync.h.

Referenced by bookHistograms().

◆ m_outputFile

std::string L1TSync::m_outputFile
private

Definition at line 102 of file L1TSync.h.

Referenced by L1TSync().

◆ m_parameters

edm::ParameterSet L1TSync::m_parameters
private

Definition at line 100 of file L1TSync.h.

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

◆ m_processedLS

bool* L1TSync::m_processedLS
private

Definition at line 107 of file L1TSync.h.

◆ m_refPrescaleSet

int L1TSync::m_refPrescaleSet
private

Definition at line 110 of file L1TSync.h.

Referenced by bookHistograms(), and L1TSync().

◆ m_selectedTriggers

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

◆ m_verbose

bool L1TSync::m_verbose
private