66 m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.
getParameter <
InputTag>(
"inputTagL1GtDataDaq"));
67 m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.
getParameter <
InputTag>(
"inputTagtEvmSource"));
69 m_refPrescaleSet = pset.
getParameter <
int> (
"refPrescaleSet");
74 bool forceGlobalParameters = Categories.
getParameter<
bool>(
"forceGlobalParameters");
75 bool doGlobalAutoSelection = Categories.getParameter<
bool>(
"doGlobalAutoSelection");
92 if(forceGlobalParameters){
96 if(doGlobalAutoSelection){
98 if(CatMu .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"Mu"] =
true;}
else{m_algoAutoSelect[
"Mu"] =
false;}
99 if(CatEG .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"EG"] =
true;}
else{m_algoAutoSelect[
"EG"] =
false;}
100 if(CatIsoEG .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"IsoEG"] =
true;}
else{m_algoAutoSelect[
"IsoEG"] =
false;}
101 if(CatJet .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"Jet"] =
true;}
else{m_algoAutoSelect[
"Jet"] =
false;}
102 if(CatCenJet.getParameter<
bool>(
"monitor")){m_algoAutoSelect[
"CenJet"] =
true;}
else{m_algoAutoSelect[
"CenJet"] =
false;}
103 if(CatForJet.getParameter<
bool>(
"monitor")){m_algoAutoSelect[
"ForJet"] =
true;}
else{m_algoAutoSelect[
"ForJet"] =
false;}
104 if(CatTauJet.getParameter<
bool>(
"monitor")){m_algoAutoSelect[
"TauJet"] =
true;}
else{m_algoAutoSelect[
"TauJet"] =
false;}
105 if(CatETM .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"ETM"] =
true;}
else{m_algoAutoSelect[
"ETM"] =
false;}
106 if(CatETT .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"ETT"] =
true;}
else{m_algoAutoSelect[
"ETT"] =
false;}
107 if(CatHTM .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"HTM"] =
true;}
else{m_algoAutoSelect[
"HTM"] =
false;}
108 if(CatHTT .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"HTT"] =
true;}
else{m_algoAutoSelect[
"HTT"] =
false;}
114 m_algoAutoSelect[
"Mu"] =
false;
115 m_algoAutoSelect[
"EG"] =
false;
116 m_algoAutoSelect[
"IsoEG"] =
false;
117 m_algoAutoSelect[
"Jet"] =
false;
118 m_algoAutoSelect[
"CenJet"] =
false;
119 m_algoAutoSelect[
"ForJet"] =
false;
120 m_algoAutoSelect[
"TauJet"] =
false;
121 m_algoAutoSelect[
"ETM"] =
false;
122 m_algoAutoSelect[
"ETT"] =
false;
123 m_algoAutoSelect[
"HTM"] =
false;
124 m_algoAutoSelect[
"HTT"] =
false;
126 if(CatMu .getParameter<bool>(
"monitor")){m_selectedTriggers[
"Mu"] = CatMu .
getParameter<
string>(
"algo");}
127 if(CatEG .getParameter<bool>(
"monitor")){m_selectedTriggers[
"EG"] = CatEG .getParameter<
string>(
"algo");}
128 if(CatIsoEG .getParameter<bool>(
"monitor")){m_selectedTriggers[
"IsoEG"] = CatIsoEG .getParameter<
string>(
"algo");}
129 if(CatJet .getParameter<bool>(
"monitor")){m_selectedTriggers[
"Jet"] = CatJet .getParameter<
string>(
"algo");}
130 if(CatCenJet.getParameter<
bool>(
"monitor")){m_selectedTriggers[
"CenJet"] = CatCenJet.getParameter<
string>(
"algo");}
131 if(CatForJet.getParameter<
bool>(
"monitor")){m_selectedTriggers[
"CatForJet"] = CatForJet.getParameter<
string>(
"algo");}
132 if(CatTauJet.getParameter<
bool>(
"monitor")){m_selectedTriggers[
"TauJet"] = CatTauJet.getParameter<
string>(
"algo");}
133 if(CatETM .getParameter<bool>(
"monitor")){m_selectedTriggers[
"ETM"] = CatETM .getParameter<
string>(
"algo");}
134 if(CatETT .getParameter<bool>(
"monitor")){m_selectedTriggers[
"ETT"] = CatETT .getParameter<
string>(
"algo");}
135 if(CatHTM .getParameter<bool>(
"monitor")){m_selectedTriggers[
"HTM"] = CatHTM .getParameter<
string>(
"algo");}
136 if(CatHTT .getParameter<bool>(
"monitor")){m_selectedTriggers[
"HTT"] = CatHTT .getParameter<
string>(
"algo");}
143 if(CatBPTX.getParameter<
bool>(
"monitor")){
144 m_selectedTriggers[
"BPTX"] = CatBPTX.getParameter<
string>(
"algo");
147 if(CatMu.getParameter<
bool>(
"monitor")){
148 m_algoAutoSelect[
"Mu"] = CatMu.getParameter<
bool>(
"doAutoSelection");
149 if(!m_algoAutoSelect[
"Mu"]){m_selectedTriggers[
"Mu"] = CatMu.getParameter<
string>(
"algo");}
150 }
else{m_algoAutoSelect[
"Mu"] =
false;}
152 if(CatEG.getParameter<
bool>(
"monitor")){
153 m_algoAutoSelect[
"EG"] = CatEG.getParameter<
bool>(
"doAutoSelection");
154 if(!m_algoAutoSelect[
"EG"]){m_selectedTriggers[
"EG"] = CatEG.getParameter<
string>(
"algo");}
155 }
else{m_algoAutoSelect[
"EG"] =
false;}
157 if(CatIsoEG.getParameter<
bool>(
"monitor")){
158 m_algoAutoSelect[
"IsoEG"] = CatIsoEG.getParameter<
bool>(
"doAutoSelection");
159 if(!m_algoAutoSelect[
"IsoEG"]){m_selectedTriggers[
"IsoEG"] = CatIsoEG.getParameter<
string>(
"algo");}
160 }
else{m_algoAutoSelect[
"IsoEG"] =
false;}
162 if(CatJet.getParameter<
bool>(
"monitor")){
163 m_algoAutoSelect[
"Jet"] = CatJet.getParameter<
bool>(
"doAutoSelection");
164 if(!m_algoAutoSelect[
"Jet"]){m_selectedTriggers[
"Jet"] = CatJet.getParameter<
string>(
"algo");}
165 }
else{m_algoAutoSelect[
"Jet"] =
false;}
167 if(CatCenJet.getParameter<
bool>(
"monitor")){
168 m_algoAutoSelect[
"CenJet"] = CatCenJet.getParameter<
bool>(
"doAutoSelection");
169 if(!m_algoAutoSelect[
"CenJet"]){m_selectedTriggers[
"CenJet"] = CatCenJet.getParameter<
string>(
"algo");}
170 }
else{m_algoAutoSelect[
"CenJet"] =
false;}
172 if(CatForJet.getParameter<
bool>(
"monitor")){
173 m_algoAutoSelect[
"CatForJet"] = CatForJet.getParameter<
bool>(
"doAutoSelection");
174 if(!m_algoAutoSelect[
"CatForJet"]){m_selectedTriggers[
"CatForJet"] = CatForJet.getParameter<
string>(
"algo");}
175 }
else{m_algoAutoSelect[
"CatForJet"] =
false;}
177 if(CatTauJet.getParameter<
bool>(
"monitor")){
178 m_algoAutoSelect[
"TauJet"] = CatTauJet.getParameter<
bool>(
"doAutoSelection");
179 if(!m_algoAutoSelect[
"TauJet"]){m_selectedTriggers[
"TauJet"] = CatTauJet.getParameter<
string>(
"algo");}
180 }
else{m_algoAutoSelect[
"TauJet"] =
false;}
182 if(CatETM.getParameter<
bool>(
"monitor")){
183 m_algoAutoSelect[
"ETM"] = CatETM.getParameter<
bool>(
"doAutoSelection");
184 if(!m_algoAutoSelect[
"ETM"]){m_selectedTriggers[
"ETM"] = CatETM.getParameter<
string>(
"algo");}
185 }
else{m_algoAutoSelect[
"ETM"] =
false;}
187 if(CatETT.getParameter<
bool>(
"monitor")){
188 m_algoAutoSelect[
"ETT"] = CatETT.getParameter<
bool>(
"doAutoSelection");
189 if(!m_algoAutoSelect[
"ETT"]){m_selectedTriggers[
"ETT"] = CatETT.getParameter<
string>(
"algo");}
190 }
else{m_algoAutoSelect[
"ETT"] =
false;}
192 if(CatHTM.getParameter<
bool>(
"monitor")){
193 m_algoAutoSelect[
"HTM"] = CatHTM.getParameter<
bool>(
"doAutoSelection");
194 if(!m_algoAutoSelect[
"HTM"]){m_selectedTriggers[
"HTM"] = CatHTM.getParameter<
string>(
"algo");}
195 }
else{m_algoAutoSelect[
"HTM"] =
false;}
197 if(CatHTT.getParameter<
bool>(
"monitor")){
198 m_algoAutoSelect[
"HTT"] = CatHTT.getParameter<
bool>(
"doAutoSelection");
199 if(!m_algoAutoSelect[
"HTT"]){m_selectedTriggers[
"HTT"] = CatHTT.getParameter<
string>(
"algo");}
200 }
else{m_algoAutoSelect[
"HTT"] =
false;}
206 if (m_outputFile.size() != 0) {
207 std::cout <<
"L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
211 if (disable) {m_outputFile =
"";}
228 if (m_verbose){
cout <<
"[L1TSync_Offline] Called beginRun." << endl;}
236 m_certFirstLS.clear();
237 m_certLastLS .clear();
246 m_algoBit[(
algo->second).algoAlias()] = (
algo->second).algoBitNumber();
260 m_selectedTriggers = myMenuHelper.
testAlgos(m_selectedTriggers);
262 map<string,string> tAutoSelTrig = myMenuHelper.
getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet);
263 m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
267 m_ErrorMonitor = ibooker.
book1D(
"ErrorMonitor",
"ErrorMonitor",7,0,7);
269 m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,
"WARNING_DB_CONN_FAILED");
270 m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,
"WARNING_DB_QUERY_FAILED");
271 m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,
"WARNING_DB_INCORRECT_NBUNCHES");
272 m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,
"ERROR_UNABLE_RETRIVE_PRODUCT");
273 m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,
"ERROR_TRIGGERALIAS_NOTVALID");
274 m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,
"ERROR_LSBLOCK_NOTVALID");
277 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
279 string tCategory = (*i).first;
280 string tTrigger = (*i).second;
283 m_certFirstLS[(*i).second] = 0;
284 m_certLastLS [(*i).second] = 0;
288 m_algoVsBunchStructure[tTrigger] = ibooker.
book2D(tCategory,
"min #Delta("+tTrigger+
",Bunch)",maxNbins,-0.5,
double(maxNbins)-0.5,5,-2.5,2.5);
289 m_algoVsBunchStructure[tTrigger] ->
setAxisTitle(
"Lumi Section" ,1);
292 m_algoCertification[tTrigger] = ibooker.
book1D(tCategory,
"fraction of in sync: "+tTrigger,maxNbins,-0.5,
double(maxNbins)-0.5);
293 m_algoCertification[tTrigger] ->
setAxisTitle(
"Lumi Section" ,1);
303 if (m_verbose){
cout <<
"[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
305 m_currentLSValid =
true;
313 if(m_verbose){
cout <<
"[L1TSync_Offline] Called analyze." << endl;}
316 if(m_currentLSValid){
318 if(m_verbose){
cout <<
"[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
322 iEvent.
getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
325 if(gtEvmReadoutRecord.
isValid()){
327 const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
328 unsigned int lhcBeamMode = gtfeEvmWord.
beamMode();
334 getBeamConfOffline(iEvent);
349 if(lhcBeamMode != STABLE){m_currentLSValid =
false;
350 if(m_verbose){
cout <<
"[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid <<
"because beams mode not stable, being " << lhcBeamMode << endl;}
353 int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
355 m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
358 if(m_verbose){
cout <<
"[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
368 if(m_currentLSValid && m_beamConfig.isValid()){
372 iEvent.
getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
374 if(gtReadoutRecordData.
isValid()){
376 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
379 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
381 string tTrigger = (*i).second;
384 if(tTrigger !=
"Undefined" && tTrigger !=
"Undefined (Wrong Name)"){
386 bool beamSingleConfig =
false;
387 bool firedAlgo =
false;
388 unsigned int eventBx = ~0;
391 for(
unsigned int a=0 ;
a<gtFdlVectorData.size() ;
a++){
394 if(gtFdlVectorData[
a].bxInEvent() == 0){
395 eventBx = gtFdlVectorData[
a].localBxNr();
396 if(gtFdlVectorData[
a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo =
true;}
401 if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
402 if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig =
true;}
403 if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig =
true;}
409 if(firedAlgo && !beamSingleConfig){
411 int DifAlgoVsBunchStructure = 9999;
413 for(
unsigned int a=0 ;
a<gtFdlVectorData.size() ;
a++){
415 int bxFDL = gtFdlVectorData[
a].localBxNr();
416 int bxInEvent = gtFdlVectorData[
a].bxInEvent();
418 if(m_beamConfig.bxConfig(bxFDL) &&
abs(bxInEvent)<
abs(DifAlgoVsBunchStructure)){
419 DifAlgoVsBunchStructure = -1*bxInEvent;
423 m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
430 int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
432 m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
467 m_beamConfig.m_valid =
true;
472 bool firedAlgo =
false;
478 iEvent.
getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
480 if(gtReadoutRecordData.
isValid()){
482 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
484 for(
unsigned int a=0 ;
a<gtFdlVectorData.size() ;
a++){
486 if(gtFdlVectorData[
a].bxInEvent() == 0){
488 if(gtFdlVectorData[
a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers[
"BPTX"] ] ]){firedAlgo =
true;}
493 m_beamConfig.beam1.push_back(
true);
494 m_beamConfig.beam2.push_back(
true);
497 m_beamConfig.beam1.push_back(
false);
498 m_beamConfig.beam2.push_back(
false);
T getParameter(std::string const &) const
void getBeamConfOffline(const edm::Event &)
T getUntrackedParameter(std::string const &, T const &) const
L1TSync_Offline(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
0: Unidentified isolated particle
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)
virtual void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
const cms_uint32_t lhcFillNumber() const
T const * product() const
virtual ~L1TSync_Offline()
void analyze(const edm::Event &e, const edm::EventSetup &c)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
const cms_uint16_t beamMode() const