CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
L1TSync_Harvest Class Reference

#include <L1TSync_Harvest.h>

Inheritance diagram for L1TSync_Harvest:
edm::EDAnalyzer edm::EDConsumerBase

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 edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

 L1TSync_Harvest (const edm::ParameterSet &ps)
 
virtual ~L1TSync_Harvest ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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. More...
 
void endJob (void)
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
void endRun (const edm::Run &run, const edm::EventSetup &iSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

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

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
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 59 of file L1TSync_Harvest.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 63 of file L1TSync_Harvest.h.

63  {
64  NOMODE=1,
65  SETUP=2,
66  INJPILOT=3,
67  INJINTR=4,
68  INJNOMN=5,
69  PRERAMP=6,
70  RAMP=7,
71  FLATTOP=8,
72  QUEEZE=9,
73  ADJUST=10,
74  STABLE=11,
75  UNSTABLE=12,
76  BEAMDUMP=13,
77  RAMPDOWN=14,
78  RECOVERY=15,
79  INJDUMP=16,
80  CIRCDUMP=17,
81  ABORT=18,
82  CYCLING=19,
83  WBDUMP=20,
84  NOBEAM=21
85  };
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 87 of file L1TSync_Harvest.h.

Constructor & Destructor Documentation

L1TSync_Harvest::L1TSync_Harvest ( const edm::ParameterSet ps)

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;}

}

Definition at line 41 of file L1TSync_Harvest.cc.

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

41  {
42 
186  if (pset.getUntrackedParameter < bool > ("dqmStore", false)) {
188  dbe->setVerbose(0);
189  }
190 
191  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");
192 
193  if (m_outputFile.size() != 0) {
194  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
195  }
196 
197  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
198  if (disable) {m_outputFile = "";}
199 
200  if (dbe != NULL) {dbe->setCurrentFolder("L1T/L1TSync");}
201 
202 }
#define NULL
Definition: scimark2.h:8
std::string m_outputFile
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
L1TSync_Harvest::~L1TSync_Harvest ( )
virtual

Definition at line 206 of file L1TSync_Harvest.cc.

206 {}

Member Function Documentation

void L1TSync_Harvest::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

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

// We only start analyzing if current LS is still valid if(m_currentLSValid){

if(m_verbose){cout << "[L1TSync_Harvest] -> 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 getBeamConfOMDS(); // Getting Beam Configuration from OMDS }

if(lhcBeamMode != STABLE){m_currentLSValid = false;} // 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_Harvest] -> m_currentLSValid=" << m_currentLSValid << 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 int eventBx = -1;

// 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[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); }

}

Implements edm::EDAnalyzer.

Definition at line 431 of file L1TSync_Harvest.cc.

431  {
432 
536 }
void L1TSync_Harvest::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 210 of file L1TSync_Harvest.cc.

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

210  {
211 
212  if (m_verbose){cout << "[L1TSync_Harvest] Called beginJob." << endl;}
213 
214  // get hold of back-end interface
215  DQMStore *dbe = 0;
216  dbe = Service < DQMStore > ().operator->();
217 
218  if (dbe) {
219  dbe->setCurrentFolder("L1T/L1TSync");
220  dbe->rmdir("L1T/L1TSync");
221  }
222 
223 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TSync_Harvest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 317 of file L1TSync_Harvest.cc.

References gather_cfg::cout, i, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

317  {
318 
319  if (m_verbose){cout << "[L1TSync_Harvest] Called beginLuminosityBlock." << endl;}
320 
321  // If this LS is not the next to last one force closing of current LS blocks
322  // for certification
323  if(m_currentLS !=0 && m_currentLS+1 != lumiBlock.id().luminosityBlock()){
324 
325  if (m_verbose){
326  cout << "[L1TSync_Harvest] None consecutive: doFractionInSync() - LAST="
327  << m_currentLS << " CURRENT=" << lumiBlock.id().luminosityBlock() << endl;
328  }
329 
330  doFractionInSync(true,false);
331 
332  }
333 
334  // Updating current LS number
335  m_currentLS = lumiBlock.id().luminosityBlock();
336 
337  // If this is the fist valid LS update first LS for certification
338  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
339 
340  string theTriggerAlias = (*i).second;
341  if(m_certFirstLS[theTriggerAlias]==0){m_certFirstLS[theTriggerAlias] = m_currentLS;}
342 
343  }
344 
345  // A LS will be valid if:
346  // * BeamMode == STABLE for all events monitored
347  m_currentLSValid = true;
348 
349 }
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certFirstLS
std::map< std::string, std::string > m_selectedTriggers
void doFractionInSync(bool iForce=false, bool iBad=false)
tuple cout
Definition: gather_cfg.py:121
unsigned int m_currentLS
void L1TSync_Harvest::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

BeginRun.

if (m_verbose){cout << "[L1TSync_Harvest] 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);

}

Reimplemented from edm::EDAnalyzer.

Definition at line 241 of file L1TSync_Harvest.cc.

241  {
242 
312 }
void L1TSync_Harvest::certifyLSBlock ( std::string  iTrigger,
int  iInitLs,
int  iEndLs,
float  iValue 
)
private

// Finding correct bins in the histogram for this block int binInit = m_algoCertification[iTrigger]->getTH1()->FindBin(iInitLs); int binEnd = m_algoCertification[iTrigger]->getTH1()->FindBin(iEndLs);

for(int ls=binInit ; ls<=binEnd ; ls++){ m_algoCertification[iTrigger]->setBinContent(ls,iValue); }

Definition at line 664 of file L1TSync_Harvest.cc.

664  {
665 
673 
674 }
void L1TSync_Harvest::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 553 of file L1TSync_Harvest.cc.

References a, gather_cfg::cout, edm::ParameterSet::getParameter(), i, and python.rootplot.utilities::ls().

553  {
554 
555  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
556 
557  string theCategory = (*i).first;
558  string theTriggerAlias = (*i).second;
559 
560  // Caching frequently used values from maps
561  unsigned int fLS = m_certFirstLS[theTriggerAlias];
562  unsigned int lLS = m_certLastLS [theTriggerAlias];
563 
564  // Checking validity of the trigger alias and of the LS block
565  bool triggerAlias_isValid = theTriggerAlias != "Undefined" && theTriggerAlias != "Undefined (Wrong Name)";
566  bool lsBlock_exists = !(fLS == 0 && lLS == 0);
567  bool lsBlock_isValid = fLS <= lLS && fLS > 0 && lLS > 0;
568 
569  if(triggerAlias_isValid && lsBlock_exists && lsBlock_isValid){
570 
571  // If we are forced to close blocks and mark them bad
572  if(iForce && iBad){
573  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
574  m_certFirstLS[theTriggerAlias] = 0;
575  m_certLastLS [theTriggerAlias] = 0;
576  }
577 
578  // If we are not forced to mark bad, we check if we have enough statistics
579  else{
580 
581  // Getting events with 0 bx difference between BPTX and Algo for current LS
582  double CountSync = 0;
583  double CountAll = 0;
584 
585  // Adding all entries for current LS block
586  for(unsigned int ls=fLS ; ls<=lLS ; ls++){
587 
588  CountSync += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(ls+1,3);
589  for(int a=1 ; a<6 ; a++){
590  CountAll += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(ls+1,a);
591  }
592  }
593 
594  if(m_verbose){
595  cout << "Alias = " << theTriggerAlias
596  << " InitLS=" << fLS
597  << " EndLS=" << lLS
598  << " Events=" << CountAll ;
599  }
600 
601  if(iForce ||
602  CountAll >= m_parameters.getParameter<ParameterSet>("Categories")
603  .getParameter<ParameterSet>(theCategory)
604  .getParameter<int>("CertMinEvents")){
605 
606  if(m_verbose){cout << " <--------------- Enough Statistics: ";}
607 
608 
609  // Calculating fraction of in time
610  double fraction = 0;
611  if(CountAll >0){fraction = CountSync/CountAll;}
612 
613  // This is to avoid having an entry equal to zero and thus
614  // disregarded by the automatic tests
615  if(fraction==0){fraction=0.000001;}
616 
617  certifyLSBlock(theTriggerAlias,fLS,lLS,fraction);
618  m_certFirstLS[theTriggerAlias] = 0;
619  m_certLastLS [theTriggerAlias] = 0;
620  }
621 
622  if(m_verbose){cout << endl;}
623 
624  }
625  }
626 
627  // A problem was found. We report it and set a not physical vale (-1) to the certification plot
628  else{
629 
630  // If trigger alias is not valid report it to m_ErrorMonitor
631  if(!triggerAlias_isValid){
632  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_TRIGGERALIAS_NOTVALID);
633  eCount++;
634  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_TRIGGERALIAS_NOTVALID,eCount);
635  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
636  m_certFirstLS[theTriggerAlias] = 0;
637  m_certLastLS [theTriggerAlias] = 0;
638  }
639 
640  // If LS Block is not valid report it to m_ErrorMonitor
641  if(lsBlock_exists && !lsBlock_isValid){
642  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_LSBLOCK_NOTVALID);
643  eCount++;
644  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_LSBLOCK_NOTVALID,eCount);
645  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
646  m_certFirstLS[theTriggerAlias] = 0;
647  m_certLastLS [theTriggerAlias] = 0;
648  }
649 
650  }
651  }
652 
653 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::ParameterSet m_parameters
std::map< TString, unsigned int > m_certFirstLS
std::map< TString, unsigned int > m_certLastLS
std::map< TString, MonitorElement * > m_algoVsBunchStructure
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
std::map< std::string, std::string > m_selectedTriggers
MonitorElement * m_ErrorMonitor
TH1 * getTH1(void) const
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Harvest::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 227 of file L1TSync_Harvest.cc.

References gather_cfg::cout.

227  {
228 
229  if (m_verbose){cout << "[L1TSync_Harvest] Called endJob." << endl;}
230 
231  if (m_outputFile.size() != 0 && dbe)
233 
234  return;
235 
236 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
std::string m_outputFile
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Harvest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 355 of file L1TSync_Harvest.cc.

References gather_cfg::cout, and i.

355  {
356 
357  if(m_verbose){cout << "[L1TSync_Harvest] Called endLuminosityBlock." << endl;}
358 
359  if(m_verbose){
360  cout << "[L1TSync_Harvest] m_currentLSValid : " << m_currentLSValid << endl;
361  cout << "[L1TSync_Harvest] m_beamConfig.isValid(): " << m_beamConfig.isValid() << endl;
362  }
363 
364  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
365 
366  // Update last LS for certification
367  string theTriggerAlias = (*i).second;
368  m_certLastLS[theTriggerAlias] = m_currentLS;
369 
370  }
371 
372  // If this LS is valid (i.e. all events recorded with stable beams)
374 
375  if(m_verbose){cout << "[L1TSync_Harvest] Regular call: doFractionInSync()" << endl;}
376  doFractionInSync(false,false);
377 
378  }
379  // If this LS is not valid it can be in the following context:
380  // * We still hadn't stable beam (no need to certify nothing
381  // * Beam just got unstable or dumped (we may have a complete block of data do certify)
382  else{
383 
384  //-> First we close all blocks from certFirstLS[] to m_currentLS-1
385  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
386 
387  string theTriggerAlias = (*i).second;
388 
389  int fLs = m_certFirstLS[theTriggerAlias];
390  int lLS = m_certLastLS [theTriggerAlias];
391 
392  // If this is a single LS block we do nothing (in this step)
393  if(fLs == lLS){
394  m_certFirstLS[theTriggerAlias] = 0;
395  m_certLastLS [theTriggerAlias] = 0;
396  }
397  // If block is multi LS then we remove the current LS
398  else{
399  m_certLastLS [theTriggerAlias] = m_currentLS-1;
400  }
401 
402  }
403  doFractionInSync(true,false);
404 
405  //-> Second we mark this single LS bad for all triggers
406  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
407  string theTriggerAlias = (*i).second;
408  m_certFirstLS[theTriggerAlias] = m_currentLS;
409  m_certLastLS [theTriggerAlias] = m_currentLS;
410  }
411  doFractionInSync(true,true);
412 
413  if(m_verbose){cout << "[L1TSync_Harvest] Error call: doFractionInSync()" << endl;}
414 
415  }
416 
417 }
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certFirstLS
std::map< TString, unsigned int > m_certLastLS
std::map< std::string, std::string > m_selectedTriggers
void doFractionInSync(bool iForce=false, bool iBad=false)
L1TBeamConfiguration m_beamConfig
tuple cout
Definition: gather_cfg.py:121
unsigned int m_currentLS
void L1TSync_Harvest::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 420 of file L1TSync_Harvest.cc.

References gather_cfg::cout.

420  {
421 
422  if(m_verbose){cout << "[L1TSync_Harvest] Called endRun." << endl;}
423 
424  // When the run end for closing of the LS certification blocks and evaluation
425  // of synchronization for that block
426  doFractionInSync(true,false);
427 
428 }
void doFractionInSync(bool iForce=false, bool iBad=false)
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Harvest::getBeamConfOMDS ( )
private

Member Data Documentation

DQMStore* L1TSync_Harvest::dbe
private

Definition at line 126 of file L1TSync_Harvest.h.

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

Definition at line 149 of file L1TSync_Harvest.h.

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

Definition at line 157 of file L1TSync_Harvest.h.

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

Definition at line 152 of file L1TSync_Harvest.h.

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

Definition at line 155 of file L1TSync_Harvest.h.

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

Definition at line 156 of file L1TSync_Harvest.h.

L1TBeamConfiguration L1TSync_Harvest::m_beamConfig
private

Definition at line 146 of file L1TSync_Harvest.h.

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

Definition at line 153 of file L1TSync_Harvest.h.

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

Definition at line 154 of file L1TSync_Harvest.h.

unsigned int L1TSync_Harvest::m_currentLS
private

Definition at line 141 of file L1TSync_Harvest.h.

bool L1TSync_Harvest::m_currentLSValid
private

Definition at line 136 of file L1TSync_Harvest.h.

MonitorElement* L1TSync_Harvest::m_ErrorMonitor
private

Definition at line 161 of file L1TSync_Harvest.h.

edm::InputTag L1TSync_Harvest::m_l1GtDataDaqInputTag
private

Definition at line 166 of file L1TSync_Harvest.h.

edm::InputTag L1TSync_Harvest::m_l1GtEvmSource
private

Definition at line 165 of file L1TSync_Harvest.h.

unsigned int L1TSync_Harvest::m_lhcFill
private

Definition at line 143 of file L1TSync_Harvest.h.

std::string L1TSync_Harvest::m_outputFile
private

Definition at line 132 of file L1TSync_Harvest.h.

edm::ParameterSet L1TSync_Harvest::m_parameters
private

Definition at line 129 of file L1TSync_Harvest.h.

bool* L1TSync_Harvest::m_processedLS
private

Definition at line 137 of file L1TSync_Harvest.h.

int L1TSync_Harvest::m_refPrescaleSet
private

Definition at line 140 of file L1TSync_Harvest.h.

edm::InputTag L1TSync_Harvest::m_scalersSource
private

Definition at line 164 of file L1TSync_Harvest.h.

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

Definition at line 158 of file L1TSync_Harvest.h.

bool L1TSync_Harvest::m_verbose
private

Definition at line 135 of file L1TSync_Harvest.h.