191 if (m_outputFile.size() != 0) {
192 std::cout <<
"L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
196 if (disable) {m_outputFile =
"";}
198 if (dbe !=
NULL) {dbe->setCurrentFolder(
"L1T/L1TSync");}
210 if (m_verbose){
cout <<
"[L1TSync_Harvest] Called beginJob." << endl;}
217 dbe->setCurrentFolder(
"L1T/L1TSync");
218 dbe->rmdir(
"L1T/L1TSync");
227 if (m_verbose){
cout <<
"[L1TSync_Harvest] Called endJob." << endl;}
229 if (m_outputFile.size() != 0 && dbe)
230 dbe->save(m_outputFile);
317 if (m_verbose){
cout <<
"[L1TSync_Harvest] Called beginLuminosityBlock." << endl;}
324 cout <<
"[L1TSync_Harvest] None consecutive: doFractionInSync() - LAST="
328 doFractionInSync(
true,
false);
336 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
338 string theTriggerAlias = (*i).second;
339 if(m_certFirstLS[theTriggerAlias]==0){m_certFirstLS[theTriggerAlias] = m_currentLS;}
345 m_currentLSValid =
true;
355 if(m_verbose){
cout <<
"[L1TSync_Harvest] Called endLuminosityBlock." << endl;}
358 cout <<
"[L1TSync_Harvest] m_currentLSValid : " << m_currentLSValid << endl;
359 cout <<
"[L1TSync_Harvest] m_beamConfig.isValid(): " << m_beamConfig.isValid() << endl;
362 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
365 string theTriggerAlias = (*i).second;
366 m_certLastLS[theTriggerAlias] = m_currentLS;
371 if(m_currentLSValid && m_beamConfig.isValid()){
373 if(m_verbose){
cout <<
"[L1TSync_Harvest] Regular call: doFractionInSync()" << endl;}
374 doFractionInSync(
false,
false);
383 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
385 string theTriggerAlias = (*i).second;
387 int fLs = m_certFirstLS[theTriggerAlias];
388 int lLS = m_certLastLS [theTriggerAlias];
392 m_certFirstLS[theTriggerAlias] = 0;
393 m_certLastLS [theTriggerAlias] = 0;
397 m_certLastLS [theTriggerAlias] = m_currentLS-1;
401 doFractionInSync(
true,
false);
404 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
405 string theTriggerAlias = (*i).second;
406 m_certFirstLS[theTriggerAlias] = m_currentLS;
407 m_certLastLS [theTriggerAlias] = m_currentLS;
409 doFractionInSync(
true,
true);
411 if(m_verbose){
cout <<
"[L1TSync_Harvest] Error call: doFractionInSync()" << endl;}
420 if(m_verbose){
cout <<
"[L1TSync_Harvest] Called endRun." << endl;}
424 doFractionInSync(
true,
false);
551 for(map<string,string>::const_iterator
i=m_selectedTriggers.begin() ;
i!=m_selectedTriggers.end() ;
i++){
553 string theCategory = (*i).first;
554 string theTriggerAlias = (*i).second;
557 unsigned int fLS = m_certFirstLS[theTriggerAlias];
558 unsigned int lLS = m_certLastLS [theTriggerAlias];
561 bool triggerAlias_isValid = theTriggerAlias !=
"Undefined" && theTriggerAlias !=
"Undefined (Wrong Name)";
562 bool lsBlock_exists = !(fLS == 0 && lLS == 0);
563 bool lsBlock_isValid = fLS <= lLS && fLS > 0 && lLS > 0;
565 if(triggerAlias_isValid && lsBlock_exists && lsBlock_isValid){
569 certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
570 m_certFirstLS[theTriggerAlias] = 0;
571 m_certLastLS [theTriggerAlias] = 0;
578 double CountSync = 0;
582 for(
unsigned int ls=fLS ;
ls<=lLS ;
ls++){
584 CountSync += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(
ls+1,3);
585 for(
int a=1 ;
a<6 ;
a++){
586 CountAll += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(
ls+1,
a);
591 cout <<
"Alias = " << theTriggerAlias
594 <<
" Events=" << CountAll ;
598 CountAll >= m_parameters.getParameter<
ParameterSet>(
"Categories")
602 if(m_verbose){
cout <<
" <--------------- Enough Statistics: ";}
607 if(CountAll >0){fraction = CountSync/CountAll;}
611 if(fraction==0){fraction=0.000001;}
613 certifyLSBlock(theTriggerAlias,fLS,lLS,fraction);
614 m_certFirstLS[theTriggerAlias] = 0;
615 m_certLastLS [theTriggerAlias] = 0;
618 if(m_verbose){
cout << endl;}
627 if(!triggerAlias_isValid){
628 int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_TRIGGERALIAS_NOTVALID);
630 m_ErrorMonitor->getTH1()->SetBinContent(ERROR_TRIGGERALIAS_NOTVALID,eCount);
631 certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
632 m_certFirstLS[theTriggerAlias] = 0;
633 m_certLastLS [theTriggerAlias] = 0;
637 if(lsBlock_exists && !lsBlock_isValid){
638 int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_LSBLOCK_NOTVALID);
640 m_ErrorMonitor->getTH1()->SetBinContent(ERROR_LSBLOCK_NOTVALID,eCount);
641 certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
642 m_certFirstLS[theTriggerAlias] = 0;
643 m_certLastLS [theTriggerAlias] = 0;
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup)
BeginRun.
#define DEFINE_FWK_MODULE(type)
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
void analyze(const edm::Event &e, const edm::EventSetup &c)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
void doFractionInSync(bool iForce=false, bool iBad=false)
void endRun(const edm::Run &run, const edm::EventSetup &iSetup)
virtual void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
LuminosityBlockNumber_t luminosityBlock() const
L1TSync_Harvest(const edm::ParameterSet &ps)
virtual ~L1TSync_Harvest()