CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

L1TSync_Offline Class Reference

#include <L1TSync_Offline.h>

Inheritance diagram for L1TSync_Offline:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

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 Member Functions

 L1TSync_Offline (const edm::ParameterSet &ps)
virtual ~L1TSync_Offline ()

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob ()
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
void beginRun (const edm::Run &run, const edm::EventSetup &iSetup)
 BeginRun.
void endJob (void)
void endRun (const edm::Run &run, const edm::EventSetup &iSetup)

Private Member Functions

void getBeamConfOffline (const edm::Event &)

Private Attributes

DQMStoredbe
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
L1TBeamConfiguration 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::InputTag m_l1GtDataDaqInputTag
edm::InputTag m_l1GtEvmSource
unsigned int m_lhcFill
std::string m_outputFile
edm::ParameterSet m_parameters
bool * m_processedLS
int m_refPrescaleSet
edm::InputTag m_scalersSource
std::map< std::string,
std::string > 
m_selectedTriggers
bool m_verbose

Detailed Description

Definition at line 60 of file L1TSync_Offline.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 64 of file L1TSync_Offline.h.

                 {
      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
    };
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 88 of file L1TSync_Offline.h.


Constructor & Destructor Documentation

L1TSync_Offline::L1TSync_Offline ( const edm::ParameterSet ps)

Definition at line 67 of file L1TSync_Offline.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), NULL, cppFunctionSkipper::operator, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                         {

  m_parameters = pset;
  
  // Mapping parameter input variables
  m_scalersSource       = pset.getParameter         <InputTag>("inputTagScalersResults");
  m_l1GtDataDaqInputTag = pset.getParameter         <InputTag>("inputTagL1GtDataDaq");
  m_l1GtEvmSource       = pset.getParameter         <InputTag>("inputTagtEvmSource");
  m_verbose             = pset.getUntrackedParameter<bool>    ("verbose",false);
  m_refPrescaleSet      = pset.getParameter         <int>     ("refPrescaleSet");  

  // Getting which categories to monitor
  ParameterSet Categories = pset.getParameter< ParameterSet >("Categories");

  bool forceGlobalParameters = Categories.getParameter<bool>("forceGlobalParameters");
  bool doGlobalAutoSelection = Categories.getParameter<bool>("doGlobalAutoSelection");

  ParameterSet CatBPTX    = Categories.getParameter<ParameterSet>("BPTX");
  ParameterSet CatMu      = Categories.getParameter<ParameterSet>("Mu");  
  ParameterSet CatEG      = Categories.getParameter<ParameterSet>("EG");  
  ParameterSet CatIsoEG   = Categories.getParameter<ParameterSet>("IsoEG");  
  ParameterSet CatJet     = Categories.getParameter<ParameterSet>("Jet");  
  ParameterSet CatCenJet  = Categories.getParameter<ParameterSet>("CenJet");  
  ParameterSet CatForJet  = Categories.getParameter<ParameterSet>("ForJet");  
  ParameterSet CatTauJet  = Categories.getParameter<ParameterSet>("TauJet");  
  ParameterSet CatETM     = Categories.getParameter<ParameterSet>("ETT");  
  ParameterSet CatETT     = Categories.getParameter<ParameterSet>("ETM");  
  ParameterSet CatHTT     = Categories.getParameter<ParameterSet>("HTT");  
  ParameterSet CatHTM     = Categories.getParameter<ParameterSet>("HTM");  

  // --> Setting parameters related to which algos to monitor
  // If global parameters are forced they take precedence over algo-by-algo parameters 
  if(forceGlobalParameters){

    // If global automatic selection if enable all categories set to be monitored will have
    // their algos auto selected (the lowest prescale algo will be selected) 
    if(doGlobalAutoSelection){
 
      if(CatMu    .getParameter<bool>("monitor")){m_algoAutoSelect["Mu"]     = true;}else{m_algoAutoSelect["Mu"]     = false;}
      if(CatEG    .getParameter<bool>("monitor")){m_algoAutoSelect["EG"]     = true;}else{m_algoAutoSelect["EG"]     = false;}
      if(CatIsoEG .getParameter<bool>("monitor")){m_algoAutoSelect["IsoEG"]  = true;}else{m_algoAutoSelect["IsoEG"]  = false;}
      if(CatJet   .getParameter<bool>("monitor")){m_algoAutoSelect["Jet"]    = true;}else{m_algoAutoSelect["Jet"]    = false;}
      if(CatCenJet.getParameter<bool>("monitor")){m_algoAutoSelect["CenJet"] = true;}else{m_algoAutoSelect["CenJet"] = false;}
      if(CatForJet.getParameter<bool>("monitor")){m_algoAutoSelect["ForJet"] = true;}else{m_algoAutoSelect["ForJet"] = false;}
      if(CatTauJet.getParameter<bool>("monitor")){m_algoAutoSelect["TauJet"] = true;}else{m_algoAutoSelect["TauJet"] = false;}
      if(CatETM   .getParameter<bool>("monitor")){m_algoAutoSelect["ETM"]    = true;}else{m_algoAutoSelect["ETM"]    = false;}
      if(CatETT   .getParameter<bool>("monitor")){m_algoAutoSelect["ETT"]    = true;}else{m_algoAutoSelect["ETT"]    = false;}
      if(CatHTM   .getParameter<bool>("monitor")){m_algoAutoSelect["HTM"]    = true;}else{m_algoAutoSelect["HTM"]    = false;}
      if(CatHTT   .getParameter<bool>("monitor")){m_algoAutoSelect["HTT"]    = true;}else{m_algoAutoSelect["HTT"]    = false;}

    // If global non-automatic selection is enable all categories set to be monitored will use
    // user defined algos
    }else{

      m_algoAutoSelect["Mu"]     = false;
      m_algoAutoSelect["EG"]     = false;
      m_algoAutoSelect["IsoEG"]  = false;
      m_algoAutoSelect["Jet"]    = false;
      m_algoAutoSelect["CenJet"] = false;
      m_algoAutoSelect["ForJet"] = false;
      m_algoAutoSelect["TauJet"] = false;
      m_algoAutoSelect["ETM"]    = false;
      m_algoAutoSelect["ETT"]    = false;
      m_algoAutoSelect["HTM"]    = false;
      m_algoAutoSelect["HTT"]    = false;   

      if(CatMu    .getParameter<bool>("monitor")){m_selectedTriggers["Mu"]        = CatMu    .getParameter<string>("algo");}
      if(CatEG    .getParameter<bool>("monitor")){m_selectedTriggers["EG"]        = CatEG    .getParameter<string>("algo");}
      if(CatIsoEG .getParameter<bool>("monitor")){m_selectedTriggers["IsoEG"]     = CatIsoEG .getParameter<string>("algo");}
      if(CatJet   .getParameter<bool>("monitor")){m_selectedTriggers["Jet"]       = CatJet   .getParameter<string>("algo");}
      if(CatCenJet.getParameter<bool>("monitor")){m_selectedTriggers["CenJet"]    = CatCenJet.getParameter<string>("algo");}
      if(CatForJet.getParameter<bool>("monitor")){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
      if(CatTauJet.getParameter<bool>("monitor")){m_selectedTriggers["TauJet"]    = CatTauJet.getParameter<string>("algo");}
      if(CatETM   .getParameter<bool>("monitor")){m_selectedTriggers["ETM"]       = CatETM   .getParameter<string>("algo");}
      if(CatETT   .getParameter<bool>("monitor")){m_selectedTriggers["ETT"]       = CatETT   .getParameter<string>("algo");}
      if(CatHTM   .getParameter<bool>("monitor")){m_selectedTriggers["HTM"]       = CatHTM   .getParameter<string>("algo");}
      if(CatHTT   .getParameter<bool>("monitor")){m_selectedTriggers["HTT"]       = CatHTT   .getParameter<string>("algo");}

    }

  // If we are using algo-by-algo parametes we get them and set what is needed
  }else{

    if(CatBPTX.getParameter<bool>("monitor")){
      m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
    }

    if(CatMu.getParameter<bool>("monitor")){
      m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["Mu"]){m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");}
    }else{m_algoAutoSelect["Mu"] = false;}

    if(CatEG.getParameter<bool>("monitor")){
      m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["EG"]){m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");}
    }else{m_algoAutoSelect["EG"] = false;}

    if(CatIsoEG.getParameter<bool>("monitor")){
      m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["IsoEG"]){m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");}
    }else{m_algoAutoSelect["IsoEG"] = false;}

    if(CatJet.getParameter<bool>("monitor")){
      m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["Jet"]){m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");}
    }else{m_algoAutoSelect["Jet"] = false;}

    if(CatCenJet.getParameter<bool>("monitor")){
      m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["CenJet"]){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
    }else{m_algoAutoSelect["CenJet"] = false;}

    if(CatForJet.getParameter<bool>("monitor")){
      m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["CatForJet"]){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
    }else{m_algoAutoSelect["CatForJet"] = false;}

    if(CatTauJet.getParameter<bool>("monitor")){
      m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["TauJet"]){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
    }else{m_algoAutoSelect["TauJet"] = false;}

    if(CatETM.getParameter<bool>("monitor")){
      m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["ETM"]){m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");}
    }else{m_algoAutoSelect["ETM"] = false;}

    if(CatETT.getParameter<bool>("monitor")){
      m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["ETT"]){m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");}
    }else{m_algoAutoSelect["ETT"] = false;}

    if(CatHTM.getParameter<bool>("monitor")){
      m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["HTM"]){m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");}
    }else{m_algoAutoSelect["HTM"] = false;}

    if(CatHTT.getParameter<bool>("monitor")){
      m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
      if(!m_algoAutoSelect["HTT"]){m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");}
    }else{m_algoAutoSelect["HTT"] = false;}

  }


  if (pset.getUntrackedParameter < bool > ("dqmStore", false)) {
    dbe = Service < DQMStore > ().operator->();
    dbe->setVerbose(0);
  }

  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");

  if (m_outputFile.size() != 0) {
    std::cout << "L1T Monitoring histograms will be saved to " <<       m_outputFile.c_str() << std::endl;
  }

  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
  if (disable) {m_outputFile = "";}

  if (dbe != NULL) {dbe->setCurrentFolder("L1T/L1TSync");}

}
L1TSync_Offline::~L1TSync_Offline ( ) [virtual]

Definition at line 232 of file L1TSync_Offline.cc.

{}

Member Function Documentation

void L1TSync_Offline::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 366 of file L1TSync_Offline.cc.

References a, abs, L1GtfeExtWord::beamMode(), gather_cfg::cout, edm::Event::getByLabel(), i, edm::HandleBase::isValid(), and L1GtfeExtWord::lhcFillNumber().

                                                                                {


  if(m_verbose){cout << "[L1TSync_Offline] Called analyze." << endl;}

  // We only start analyzing if current LS is still valid
  if(m_currentLSValid){
  
    if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
    
    // Retriving information from GT
    edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord;
    iEvent.getByLabel(m_l1GtEvmSource, gtEvmReadoutRecord);

    // Determining beam mode and fill number
    if(gtEvmReadoutRecord.isValid()){

      const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
      unsigned int lhcBeamMode         = gtfeEvmWord.beamMode();          // Updating beam mode

      if(m_lhcFill == 0){
        m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT

        //I AM HERE
        getBeamConfOffline(iEvent);                       // Getting Beam Configuration from OMDS
        // no OMDS //
        /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
          Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
          The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
          In the meantime, for being able to test the module, he suggested to pass the correct bunch structure by hand for the specific run which is run during the test.
          The idea of the temporary fix is setting the vector variable that stores the bunch structure either by hand or filling it with the BPTX fires (that is check for the event the BX's where tech0 fired and set those as true in the vector.
        */
        // no OMDS //    m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that


        
        
      }

      if(lhcBeamMode != STABLE){m_currentLSValid = false;
        if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << "because beams mode not stable, being " << lhcBeamMode << endl;}
      } // If Beams are not stable we invalidate this LS
    }else{
      int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
      eCount++;
      m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
    }
  }else{
    if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
  }

  // Commenting out un-necessary  print outs (S.Dutta)
  /*  for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
    cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
    }*/
  //------------------------------------------------------------------------------
  // If current LS is valid and Beam Configuration is Valid we analyse this event
  //------------------------------------------------------------------------------
  if(m_currentLSValid && m_beamConfig.isValid()){     

    // Getting Final Decision Logic (FDL) Data from GT
    edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
    iEvent.getByLabel(m_l1GtDataDaqInputTag, gtReadoutRecordData);

    if(gtReadoutRecordData.isValid()){

      const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();

      // Running over selected triggers
      for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){

        string tTrigger = (*i).second;

        // Analyse only defined triggers
        if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){

          bool beamSingleConfig = false; // Single beam configured for this event
          bool firedAlgo        = false; // Algo fired in this event
          unsigned int  eventBx = ~0;      

          // Running over FDL results to get which bits fired
          for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
   
            // Selecting the FDL that triggered
            if(gtFdlVectorData[a].bxInEvent() == 0){
              eventBx = gtFdlVectorData[a].localBxNr();
              if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
            }
          }

          // Checking beam configuration
          if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
            if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
            if(!m_beamConfig.beam1[eventBx] &&  m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
          } 
          // Analyse only if this trigger fired in this event
          // NOTE: Veto cases where a single beam is configured since
          //       for this cases this could be a real-satelite bunch collision
          // -> Calculate the minimum bx diference between this event and a configured bx
          if(firedAlgo && !beamSingleConfig){

            int DifAlgoVsBunchStructure = 9999; // Majorated

            for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){

              int bxFDL     = gtFdlVectorData[a].localBxNr();
              int bxInEvent = gtFdlVectorData[a].bxInEvent();

              if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
                DifAlgoVsBunchStructure = -1*bxInEvent;
              }
            }

            m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);

          }
        }
      }
    }
    else{
      int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
      eCount++;
      m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
    }

  }
}
void L1TSync_Offline::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file L1TSync_Offline.cc.

References gather_cfg::cout, cppFunctionSkipper::operator, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

                                  {

  if (m_verbose){cout << "[L1TSync_Offline] Called beginJob." << endl;}

  // get hold of back-end interface
  DQMStore *dbe = 0;
  dbe = Service < DQMStore > ().operator->();

  if (dbe) {
    dbe->setCurrentFolder("L1T/L1TSync");
    dbe->rmdir("L1T/L1TSync");
  }
 
}
void L1TSync_Offline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 343 of file L1TSync_Offline.cc.

References gather_cfg::cout.

                                                                                                 {
 
   if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
 
   m_currentLSValid = true; 
 
 }
void L1TSync_Offline::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 267 of file L1TSync_Offline.cc.

References gather_cfg::cout, edm::EventSetup::get(), L1TMenuHelper::getLUSOTrigger(), L1GtTriggerMenu::gtAlgorithmAliasMap(), i, relval_steps::menu, edm::ESHandle< T >::product(), L1TMenuHelper::testAlgos(), and pat::UNKNOWN.

                                                                             {

  if (m_verbose){cout << "[L1TSync_Offline] Called beginRun." << endl;}

  // Initializing variables
  int maxNbins = 2501;

  // Reseting run dependent variables
  m_lhcFill     = 0; 
  m_currentLS   = 0;
  m_certFirstLS.clear();
  m_certLastLS .clear();
  
  // Getting Trigger menu from GT
  ESHandle<L1GtTriggerMenu> menuRcd;
  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
  const L1GtTriggerMenu* menu = menuRcd.product();

  // Filling Alias-Bit Map
  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
    m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
  }

  // Getting fill number for this run
  //Handle<ConditionsInRunBlock> runConditions;
  //iRun.getByType(runConditions);
  //int lhcFillNumber = runConditions->lhcFillNumber;
  //
  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();

  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);  
         
  m_selectedTriggers = myMenuHelper.testAlgos(m_selectedTriggers);

  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet);
  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());

  // Initializing DQM Monitor Elements
  dbe->setCurrentFolder("L1T/L1TSync");
  m_ErrorMonitor = dbe->book1D("ErrorMonitor","ErrorMonitor",7,0,7);
  m_ErrorMonitor->setBinLabel(UNKNOWN                      ,"UNKNOWN");
  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED       ,"WARNING_DB_CONN_FAILED");        // Errors from L1TOMDSHelper
  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED      ,"WARNING_DB_QUERY_FAILED");       // Errors from L1TOMDSHelper
  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT"); 
  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID  ,"ERROR_TRIGGERALIAS_NOTVALID"); 
  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID       ,"ERROR_LSBLOCK_NOTVALID"); 

  // Looping over selected triggers
  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){

    string tCategory = (*i).first;
    string tTrigger  = (*i).second;

    // Initializing LS blocks for certification
    m_certFirstLS[(*i).second] = 0;
    m_certLastLS [(*i).second] = 0;

    // Initializing DQM Monitors 
    dbe->setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
    m_algoVsBunchStructure[tTrigger] = dbe->book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
    m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
    
    dbe->setCurrentFolder("L1T/L1TSync/Certification/");
    m_algoCertification[tTrigger] = dbe->book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
    m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);

 }   

}
void L1TSync_Offline::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 253 of file L1TSync_Offline.cc.

References gather_cfg::cout.

                                {

  if (m_verbose){cout << "[L1TSync_Offline] Called endJob." << endl;}

  if (m_outputFile.size() != 0 && dbe)
    dbe->save(m_outputFile);

  return;

}
void L1TSync_Offline::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 353 of file L1TSync_Offline.cc.

References gather_cfg::cout.

                                                                          {
  
  if(m_verbose){cout << "[L1TSync_Offline] Called endRun." << endl;}
  
  // When the run end for closing of the LS certification blocks and evaluation
  // of synchronization for that block

  // This will be for Harvesting
  //  doFractionInSync(true,false);    

}
void L1TSync_Offline::getBeamConfOffline ( const edm::Event iEvent) [private]

Definition at line 499 of file L1TSync_Offline.cc.

References a, edm::Event::getByLabel(), and edm::HandleBase::isValid().

                                                           {

  //Getting connection parameters
  //  [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
  //  [11:21:51] Joao Pela: no
  //  [11:21:56] Pietro Vischia: cool
  //  [11:21:58] Pietro Vischia: tks
  //  [11:22:00] Joao Pela: well
  //  [11:22:02] Joao Pela: maybe
  //  [11:22:05] Joao Pela: but assume no
  //  [11:22:22] Joao Pela: definitely assume no
  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync

  // string oracleDB   = m_parameters.getParameter<string>("oracleDB");
  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
  
  //  m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
  //  m_lhcFill -> lhcFillNumber
  //  errorRetrieve -> error
  // m_beamConfig -> bConfig
  

  // No error codes at the moment. Taking info from BPTX fires
  //  int errorRetrieve = 0; // NO_ERROR;
  m_beamConfig.m_valid = true;



  //  bool beamSingleConfig = false; // Single beam configured for this event
  bool firedAlgo        = false; // Algo fired in this event
  //  int  eventBx          = -1;      
  
  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
  // Getting Final Decision Logic (FDL) Data from GT
  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
  iEvent.getByLabel(m_l1GtDataDaqInputTag, gtReadoutRecordData);
  
  if(gtReadoutRecordData.isValid()){
    
    const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
    
    for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
      // Selecting the FDL that triggered
      if(gtFdlVectorData[a].bxInEvent() == 0){
        //eventBx = gtFdlVectorData[a].localBxNr();
        if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers["BPTX"] ] ]){firedAlgo = true;}
      }
      
      // Fill beam status with BPTX fires
      if(firedAlgo){
        m_beamConfig.beam1.push_back(true);
        m_beamConfig.beam2.push_back(true);
      }
      else {
        m_beamConfig.beam1.push_back(false);
        m_beamConfig.beam2.push_back(false);
      }
      // End fill beam status with BPTX fires
    } // End loop on FDL
  } // End if readout is valid  
  
}

Member Data Documentation

Definition at line 127 of file L1TSync_Offline.h.

const std::vector< std::vector<int> >* L1TSync_Offline::ListsPrescaleFactors [private]

Definition at line 150 of file L1TSync_Offline.h.

std::map<std::string,bool> L1TSync_Offline::m_algoAutoSelect [private]

Definition at line 158 of file L1TSync_Offline.h.

std::map<TString,int> L1TSync_Offline::m_algoBit [private]

Definition at line 153 of file L1TSync_Offline.h.

Definition at line 156 of file L1TSync_Offline.h.

Definition at line 157 of file L1TSync_Offline.h.

Definition at line 147 of file L1TSync_Offline.h.

std::map<TString,unsigned int> L1TSync_Offline::m_certFirstLS [private]

Definition at line 154 of file L1TSync_Offline.h.

std::map<TString,unsigned int> L1TSync_Offline::m_certLastLS [private]

Definition at line 155 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_currentLS [private]

Definition at line 142 of file L1TSync_Offline.h.

Definition at line 137 of file L1TSync_Offline.h.

Definition at line 162 of file L1TSync_Offline.h.

Definition at line 167 of file L1TSync_Offline.h.

Definition at line 166 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_lhcFill [private]

Definition at line 144 of file L1TSync_Offline.h.

std::string L1TSync_Offline::m_outputFile [private]

Definition at line 133 of file L1TSync_Offline.h.

Definition at line 130 of file L1TSync_Offline.h.

Definition at line 138 of file L1TSync_Offline.h.

Definition at line 141 of file L1TSync_Offline.h.

Definition at line 165 of file L1TSync_Offline.h.

std::map<std::string,std::string> L1TSync_Offline::m_selectedTriggers [private]

Definition at line 159 of file L1TSync_Offline.h.

Definition at line 136 of file L1TSync_Offline.h.