76 m_refPrescaleSet = pset.
getParameter <
int> (
"refPrescaleSet");
81 bool forceGlobalParameters = Categories.
getParameter<
bool>(
"forceGlobalParameters");
82 bool doGlobalAutoSelection = Categories.getParameter<
bool>(
"doGlobalAutoSelection");
99 if(forceGlobalParameters){
103 if(doGlobalAutoSelection){
105 if(CatMu .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"Mu"] =
true;}
else{m_algoAutoSelect[
"Mu"] =
false;}
106 if(CatEG .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"EG"] =
true;}
else{m_algoAutoSelect[
"EG"] =
false;}
107 if(CatIsoEG .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"IsoEG"] =
true;}
else{m_algoAutoSelect[
"IsoEG"] =
false;}
108 if(CatJet .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"Jet"] =
true;}
else{m_algoAutoSelect[
"Jet"] =
false;}
109 if(CatCenJet.getParameter<
bool>(
"monitor")){m_algoAutoSelect[
"CenJet"] =
true;}
else{m_algoAutoSelect[
"CenJet"] =
false;}
110 if(CatForJet.getParameter<
bool>(
"monitor")){m_algoAutoSelect[
"ForJet"] =
true;}
else{m_algoAutoSelect[
"ForJet"] =
false;}
111 if(CatTauJet.getParameter<
bool>(
"monitor")){m_algoAutoSelect[
"TauJet"] =
true;}
else{m_algoAutoSelect[
"TauJet"] =
false;}
112 if(CatETM .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"ETM"] =
true;}
else{m_algoAutoSelect[
"ETM"] =
false;}
113 if(CatETT .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"ETT"] =
true;}
else{m_algoAutoSelect[
"ETT"] =
false;}
114 if(CatHTM .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"HTM"] =
true;}
else{m_algoAutoSelect[
"HTM"] =
false;}
115 if(CatHTT .getParameter<bool>(
"monitor")){m_algoAutoSelect[
"HTT"] =
true;}
else{m_algoAutoSelect[
"HTT"] =
false;}
121 m_algoAutoSelect[
"Mu"] =
false;
122 m_algoAutoSelect[
"EG"] =
false;
123 m_algoAutoSelect[
"IsoEG"] =
false;
124 m_algoAutoSelect[
"Jet"] =
false;
125 m_algoAutoSelect[
"CenJet"] =
false;
126 m_algoAutoSelect[
"ForJet"] =
false;
127 m_algoAutoSelect[
"TauJet"] =
false;
128 m_algoAutoSelect[
"ETM"] =
false;
129 m_algoAutoSelect[
"ETT"] =
false;
130 m_algoAutoSelect[
"HTM"] =
false;
131 m_algoAutoSelect[
"HTT"] =
false;
133 if(CatMu .getParameter<bool>(
"monitor")){m_selectedTriggers[
"Mu"] = CatMu .
getParameter<
string>(
"algo");}
134 if(CatEG .getParameter<bool>(
"monitor")){m_selectedTriggers[
"EG"] = CatEG .getParameter<
string>(
"algo");}
135 if(CatIsoEG .getParameter<bool>(
"monitor")){m_selectedTriggers[
"IsoEG"] = CatIsoEG .getParameter<
string>(
"algo");}
136 if(CatJet .getParameter<bool>(
"monitor")){m_selectedTriggers[
"Jet"] = CatJet .getParameter<
string>(
"algo");}
137 if(CatCenJet.getParameter<
bool>(
"monitor")){m_selectedTriggers[
"CenJet"] = CatCenJet.getParameter<
string>(
"algo");}
138 if(CatForJet.getParameter<
bool>(
"monitor")){m_selectedTriggers[
"CatForJet"] = CatForJet.getParameter<
string>(
"algo");}
139 if(CatTauJet.getParameter<
bool>(
"monitor")){m_selectedTriggers[
"TauJet"] = CatTauJet.getParameter<
string>(
"algo");}
140 if(CatETM .getParameter<bool>(
"monitor")){m_selectedTriggers[
"ETM"] = CatETM .getParameter<
string>(
"algo");}
141 if(CatETT .getParameter<bool>(
"monitor")){m_selectedTriggers[
"ETT"] = CatETT .getParameter<
string>(
"algo");}
142 if(CatHTM .getParameter<bool>(
"monitor")){m_selectedTriggers[
"HTM"] = CatHTM .getParameter<
string>(
"algo");}
143 if(CatHTT .getParameter<bool>(
"monitor")){m_selectedTriggers[
"HTT"] = CatHTT .getParameter<
string>(
"algo");}
150 if(CatBPTX.getParameter<
bool>(
"monitor")){
151 m_selectedTriggers[
"BPTX"] = CatBPTX.getParameter<
string>(
"algo");
154 if(CatMu.getParameter<
bool>(
"monitor")){
155 m_algoAutoSelect[
"Mu"] = CatMu.getParameter<
bool>(
"doAutoSelection");
156 if(!m_algoAutoSelect[
"Mu"]){m_selectedTriggers[
"Mu"] = CatMu.getParameter<
string>(
"algo");}
157 }
else{m_algoAutoSelect[
"Mu"] =
false;}
159 if(CatEG.getParameter<
bool>(
"monitor")){
160 m_algoAutoSelect[
"EG"] = CatEG.getParameter<
bool>(
"doAutoSelection");
161 if(!m_algoAutoSelect[
"EG"]){m_selectedTriggers[
"EG"] = CatEG.getParameter<
string>(
"algo");}
162 }
else{m_algoAutoSelect[
"EG"] =
false;}
164 if(CatIsoEG.getParameter<
bool>(
"monitor")){
165 m_algoAutoSelect[
"IsoEG"] = CatIsoEG.getParameter<
bool>(
"doAutoSelection");
166 if(!m_algoAutoSelect[
"IsoEG"]){m_selectedTriggers[
"IsoEG"] = CatIsoEG.getParameter<
string>(
"algo");}
167 }
else{m_algoAutoSelect[
"IsoEG"] =
false;}
169 if(CatJet.getParameter<
bool>(
"monitor")){
170 m_algoAutoSelect[
"Jet"] = CatJet.getParameter<
bool>(
"doAutoSelection");
171 if(!m_algoAutoSelect[
"Jet"]){m_selectedTriggers[
"Jet"] = CatJet.getParameter<
string>(
"algo");}
172 }
else{m_algoAutoSelect[
"Jet"] =
false;}
174 if(CatCenJet.getParameter<
bool>(
"monitor")){
175 m_algoAutoSelect[
"CenJet"] = CatCenJet.getParameter<
bool>(
"doAutoSelection");
176 if(!m_algoAutoSelect[
"CenJet"]){m_selectedTriggers[
"CenJet"] = CatCenJet.getParameter<
string>(
"algo");}
177 }
else{m_algoAutoSelect[
"CenJet"] =
false;}
179 if(CatForJet.getParameter<
bool>(
"monitor")){
180 m_algoAutoSelect[
"CatForJet"] = CatForJet.getParameter<
bool>(
"doAutoSelection");
181 if(!m_algoAutoSelect[
"CatForJet"]){m_selectedTriggers[
"CatForJet"] = CatForJet.getParameter<
string>(
"algo");}
182 }
else{m_algoAutoSelect[
"CatForJet"] =
false;}
184 if(CatTauJet.getParameter<
bool>(
"monitor")){
185 m_algoAutoSelect[
"TauJet"] = CatTauJet.getParameter<
bool>(
"doAutoSelection");
186 if(!m_algoAutoSelect[
"TauJet"]){m_selectedTriggers[
"TauJet"] = CatTauJet.getParameter<
string>(
"algo");}
187 }
else{m_algoAutoSelect[
"TauJet"] =
false;}
189 if(CatETM.getParameter<
bool>(
"monitor")){
190 m_algoAutoSelect[
"ETM"] = CatETM.getParameter<
bool>(
"doAutoSelection");
191 if(!m_algoAutoSelect[
"ETM"]){m_selectedTriggers[
"ETM"] = CatETM.getParameter<
string>(
"algo");}
192 }
else{m_algoAutoSelect[
"ETM"] =
false;}
194 if(CatETT.getParameter<
bool>(
"monitor")){
195 m_algoAutoSelect[
"ETT"] = CatETT.getParameter<
bool>(
"doAutoSelection");
196 if(!m_algoAutoSelect[
"ETT"]){m_selectedTriggers[
"ETT"] = CatETT.getParameter<
string>(
"algo");}
197 }
else{m_algoAutoSelect[
"ETT"] =
false;}
199 if(CatHTM.getParameter<
bool>(
"monitor")){
200 m_algoAutoSelect[
"HTM"] = CatHTM.getParameter<
bool>(
"doAutoSelection");
201 if(!m_algoAutoSelect[
"HTM"]){m_selectedTriggers[
"HTM"] = CatHTM.getParameter<
string>(
"algo");}
202 }
else{m_algoAutoSelect[
"HTM"] =
false;}
204 if(CatHTT.getParameter<
bool>(
"monitor")){
205 m_algoAutoSelect[
"HTT"] = CatHTT.getParameter<
bool>(
"doAutoSelection");
206 if(!m_algoAutoSelect[
"HTT"]){m_selectedTriggers[
"HTT"] = CatHTT.getParameter<
string>(
"algo");}
207 }
else{m_algoAutoSelect[
"HTT"] =
false;}
219 if (m_outputFile.size() != 0) {
220 std::cout <<
"L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
224 if (disable) {m_outputFile =
"";}
226 if (dbe !=
NULL) {dbe->setCurrentFolder(
"L1T/L1TSync");}
238 if (m_verbose){
cout <<
"[L1TSync_Offline] Called beginJob." << endl;}
246 dbe->
rmdir(
"L1T/L1TSync");
255 if (m_verbose){
cout <<
"[L1TSync_Offline] Called endJob." << endl;}
257 if (m_outputFile.size() != 0 && dbe)
258 dbe->save(m_outputFile);
269 if (m_verbose){
cout <<
"[L1TSync_Offline] Called beginRun." << endl;}
277 m_certFirstLS.clear();
278 m_certLastLS .clear();
287 m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
301 m_selectedTriggers = myMenuHelper.
testAlgos(m_selectedTriggers);
303 map<string,string> tAutoSelTrig = myMenuHelper.
getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet);
304 m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
307 dbe->setCurrentFolder(
"L1T/L1TSync");
308 m_ErrorMonitor = dbe->book1D(
"ErrorMonitor",
"ErrorMonitor",7,0,7);
309 m_ErrorMonitor->setBinLabel(
UNKNOWN ,
"UNKNOWN");
310 m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,
"WARNING_DB_CONN_FAILED");
311 m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,
"WARNING_DB_QUERY_FAILED");
312 m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,
"WARNING_DB_INCORRECT_NBUNCHES");
313 m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,
"ERROR_UNABLE_RETRIVE_PRODUCT");
314 m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,
"ERROR_TRIGGERALIAS_NOTVALID");
315 m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,
"ERROR_LSBLOCK_NOTVALID");
318 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
320 string tCategory = (*i).first;
321 string tTrigger = (*i).second;
324 m_certFirstLS[(*i).second] = 0;
325 m_certLastLS [(*i).second] = 0;
328 dbe->setCurrentFolder(
"L1T/L1TSync/AlgoVsBunchStructure/");
329 m_algoVsBunchStructure[tTrigger] = dbe->book2D(tCategory,
"min #Delta("+tTrigger+
",Bunch)",maxNbins,-0.5,
double(maxNbins)-0.5,5,-2.5,2.5);
330 m_algoVsBunchStructure[tTrigger] ->setAxisTitle(
"Lumi Section" ,1);
332 dbe->setCurrentFolder(
"L1T/L1TSync/Certification/");
333 m_algoCertification[tTrigger] = dbe->book1D(tCategory,
"fraction of in sync: "+tTrigger,maxNbins,-0.5,
double(maxNbins)-0.5);
334 m_algoCertification[tTrigger] ->setAxisTitle(
"Lumi Section" ,1);
345 if (m_verbose){
cout <<
"[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
347 m_currentLSValid =
true;
355 if(m_verbose){
cout <<
"[L1TSync_Offline] Called endRun." << endl;}
369 if(m_verbose){
cout <<
"[L1TSync_Offline] Called analyze." << endl;}
372 if(m_currentLSValid){
374 if(m_verbose){
cout <<
"[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
378 iEvent.
getByLabel(m_l1GtEvmSource, gtEvmReadoutRecord);
381 if(gtEvmReadoutRecord.
isValid()){
383 const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
384 unsigned int lhcBeamMode = gtfeEvmWord.
beamMode();
390 getBeamConfOffline(iEvent);
405 if(lhcBeamMode != STABLE){m_currentLSValid =
false;
406 if(m_verbose){
cout <<
"[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid <<
"because beams mode not stable, being " << lhcBeamMode << endl;}
409 int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
411 m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
414 if(m_verbose){
cout <<
"[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
424 if(m_currentLSValid && m_beamConfig.isValid()){
428 iEvent.
getByLabel(m_l1GtDataDaqInputTag, gtReadoutRecordData);
430 if(gtReadoutRecordData.
isValid()){
432 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
435 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
437 string tTrigger = (*i).second;
440 if(tTrigger !=
"Undefined" && tTrigger !=
"Undefined (Wrong Name)"){
442 bool beamSingleConfig =
false;
443 bool firedAlgo =
false;
444 unsigned int eventBx = ~0;
447 for(
unsigned int a=0 ;
a<gtFdlVectorData.size() ;
a++){
450 if(gtFdlVectorData[
a].bxInEvent() == 0){
451 eventBx = gtFdlVectorData[
a].localBxNr();
452 if(gtFdlVectorData[
a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo =
true;}
457 if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
458 if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig =
true;}
459 if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig =
true;}
465 if(firedAlgo && !beamSingleConfig){
467 int DifAlgoVsBunchStructure = 9999;
469 for(
unsigned int a=0 ;
a<gtFdlVectorData.size() ;
a++){
471 int bxFDL = gtFdlVectorData[
a].localBxNr();
472 int bxInEvent = gtFdlVectorData[
a].bxInEvent();
474 if(m_beamConfig.bxConfig(bxFDL) &&
abs(bxInEvent)<
abs(DifAlgoVsBunchStructure)){
475 DifAlgoVsBunchStructure = -1*bxInEvent;
479 m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
486 int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
488 m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
523 m_beamConfig.m_valid =
true;
528 bool firedAlgo =
false;
534 iEvent.
getByLabel(m_l1GtDataDaqInputTag, gtReadoutRecordData);
536 if(gtReadoutRecordData.
isValid()){
538 const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
540 for(
unsigned int a=0 ;
a<gtFdlVectorData.size() ;
a++){
542 if(gtFdlVectorData[
a].bxInEvent() == 0){
544 if(gtFdlVectorData[
a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers[
"BPTX"] ] ]){firedAlgo =
true;}
549 m_beamConfig.beam1.push_back(
true);
550 m_beamConfig.beam2.push_back(
true);
553 m_beamConfig.beam1.push_back(
false);
554 m_beamConfig.beam2.push_back(
false);
T getParameter(std::string const &) const
void getBeamConfOffline(const edm::Event &)
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup)
BeginRun.
T getUntrackedParameter(std::string const &, T const &) const
void rmdir(const std::string &fullpath)
L1TSync_Offline(const edm::ParameterSet &ps)
0: Unidentified isolated particle
DEFINE_FWK_MODULE(HiMixingModule)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const cms_uint32_t lhcFillNumber() const
T const * product() const
virtual ~L1TSync_Offline()
void analyze(const edm::Event &e, const edm::EventSetup &c)
const cms_uint16_t beamMode() const
void setCurrentFolder(const std::string &fullpath)
void endRun(const edm::Run &run, const edm::EventSetup &iSetup)