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
 

Public Member Functions

 L1TSync_Harvest (const edm::ParameterSet &ps)
 
virtual ~L1TSync_Harvest ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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::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

Description: offline DQM module for L1Trigger/bunchStructure synchronization

Implementation: <TODO: enter implementation details>

Author
: Pietro Vischia - LIP Lisbon pietr.nosp@m.o.vi.nosp@m.schia.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Changelog: 2012/08/10 11:01:01: First creation. Dummy module with actual code commented.

Todo:

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

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

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

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

Definition at line 204 of file L1TSync_Harvest.cc.

204 {}

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;

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

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 429 of file L1TSync_Harvest.cc.

429  {
430 
532 }
void L1TSync_Harvest::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 208 of file L1TSync_Harvest.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 315 of file L1TSync_Harvest.cc.

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

315  {
316 
317  if (m_verbose){cout << "[L1TSync_Harvest] Called beginLuminosityBlock." << endl;}
318 
319  // If this LS is not the next to last one force closing of current LS blocks
320  // for certification
321  if(m_currentLS !=0 && m_currentLS+1 != lumiBlock.id().luminosityBlock()){
322 
323  if (m_verbose){
324  cout << "[L1TSync_Harvest] None consecutive: doFractionInSync() - LAST="
325  << m_currentLS << " CURRENT=" << lumiBlock.id().luminosityBlock() << endl;
326  }
327 
328  doFractionInSync(true,false);
329 
330  }
331 
332  // Updating current LS number
333  m_currentLS = lumiBlock.id().luminosityBlock();
334 
335  // If this is the fist valid LS update first LS for certification
336  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
337 
338  string theTriggerAlias = (*i).second;
339  if(m_certFirstLS[theTriggerAlias]==0){m_certFirstLS[theTriggerAlias] = m_currentLS;}
340 
341  }
342 
343  // A LS will be valid if:
344  // * BeamMode == STABLE for all events monitored
345  m_currentLSValid = true;
346 
347 }
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 239 of file L1TSync_Harvest.cc.

239  {
240 
310 }
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 660 of file L1TSync_Harvest.cc.

660  {
661 
669 
670 }
void L1TSync_Harvest::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 549 of file L1TSync_Harvest.cc.

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

549  {
550 
551  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
552 
553  string theCategory = (*i).first;
554  string theTriggerAlias = (*i).second;
555 
556  // Caching frequently used values from maps
557  unsigned int fLS = m_certFirstLS[theTriggerAlias];
558  unsigned int lLS = m_certLastLS [theTriggerAlias];
559 
560  // Checking validity of the trigger alias and of the LS block
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;
564 
565  if(triggerAlias_isValid && lsBlock_exists && lsBlock_isValid){
566 
567  // If we are forced to close blocks and mark them bad
568  if(iForce && iBad){
569  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
570  m_certFirstLS[theTriggerAlias] = 0;
571  m_certLastLS [theTriggerAlias] = 0;
572  }
573 
574  // If we are not forced to mark bad, we check if we have enough statistics
575  else{
576 
577  // Getting events with 0 bx difference between BPTX and Algo for current LS
578  double CountSync = 0;
579  double CountAll = 0;
580 
581  // Adding all entries for current LS block
582  for(unsigned int ls=fLS ; ls<=lLS ; ls++){
583 
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);
587  }
588  }
589 
590  if(m_verbose){
591  cout << "Alias = " << theTriggerAlias
592  << " InitLS=" << fLS
593  << " EndLS=" << lLS
594  << " Events=" << CountAll ;
595  }
596 
597  if(iForce ||
598  CountAll >= m_parameters.getParameter<ParameterSet>("Categories")
599  .getParameter<ParameterSet>(theCategory)
600  .getParameter<int>("CertMinEvents")){
601 
602  if(m_verbose){cout << " <--------------- Enough Statistics: ";}
603 
604 
605  // Calculating fraction of in time
606  double fraction = 0;
607  if(CountAll >0){fraction = CountSync/CountAll;}
608 
609  // This is to avoid having an entry equal to zero and thus
610  // disregarded by the automatic tests
611  if(fraction==0){fraction=0.000001;}
612 
613  certifyLSBlock(theTriggerAlias,fLS,lLS,fraction);
614  m_certFirstLS[theTriggerAlias] = 0;
615  m_certLastLS [theTriggerAlias] = 0;
616  }
617 
618  if(m_verbose){cout << endl;}
619 
620  }
621  }
622 
623  // A problem was found. We report it and set a not physical vale (-1) to the certification plot
624  else{
625 
626  // If trigger alias is not valid report it to m_ErrorMonitor
627  if(!triggerAlias_isValid){
628  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_TRIGGERALIAS_NOTVALID);
629  eCount++;
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;
634  }
635 
636  // If LS Block is not valid report it to m_ErrorMonitor
637  if(lsBlock_exists && !lsBlock_isValid){
638  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_LSBLOCK_NOTVALID);
639  eCount++;
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;
644  }
645 
646  }
647  }
648 
649 }
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 225 of file L1TSync_Harvest.cc.

References gather_cfg::cout.

225  {
226 
227  if (m_verbose){cout << "[L1TSync_Harvest] Called endJob." << endl;}
228 
229  if (m_outputFile.size() != 0 && dbe)
231 
232  return;
233 
234 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2297
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 353 of file L1TSync_Harvest.cc.

References gather_cfg::cout, and i.

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

References gather_cfg::cout.

418  {
419 
420  if(m_verbose){cout << "[L1TSync_Harvest] Called endRun." << endl;}
421 
422  // When the run end for closing of the LS certification blocks and evaluation
423  // of synchronization for that block
424  doFractionInSync(true,false);
425 
426 }
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 124 of file L1TSync_Harvest.h.

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

Definition at line 147 of file L1TSync_Harvest.h.

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

Definition at line 155 of file L1TSync_Harvest.h.

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

Definition at line 150 of file L1TSync_Harvest.h.

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

Definition at line 153 of file L1TSync_Harvest.h.

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

Definition at line 154 of file L1TSync_Harvest.h.

L1TBeamConfiguration L1TSync_Harvest::m_beamConfig
private

Definition at line 144 of file L1TSync_Harvest.h.

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

Definition at line 151 of file L1TSync_Harvest.h.

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

Definition at line 152 of file L1TSync_Harvest.h.

unsigned int L1TSync_Harvest::m_currentLS
private

Definition at line 139 of file L1TSync_Harvest.h.

bool L1TSync_Harvest::m_currentLSValid
private

Definition at line 134 of file L1TSync_Harvest.h.

MonitorElement* L1TSync_Harvest::m_ErrorMonitor
private

Definition at line 159 of file L1TSync_Harvest.h.

edm::InputTag L1TSync_Harvest::m_l1GtDataDaqInputTag
private

Definition at line 164 of file L1TSync_Harvest.h.

edm::InputTag L1TSync_Harvest::m_l1GtEvmSource
private

Definition at line 163 of file L1TSync_Harvest.h.

unsigned int L1TSync_Harvest::m_lhcFill
private

Definition at line 141 of file L1TSync_Harvest.h.

std::string L1TSync_Harvest::m_outputFile
private

Definition at line 130 of file L1TSync_Harvest.h.

edm::ParameterSet L1TSync_Harvest::m_parameters
private

Definition at line 127 of file L1TSync_Harvest.h.

bool* L1TSync_Harvest::m_processedLS
private

Definition at line 135 of file L1TSync_Harvest.h.

int L1TSync_Harvest::m_refPrescaleSet
private

Definition at line 138 of file L1TSync_Harvest.h.

edm::InputTag L1TSync_Harvest::m_scalersSource
private

Definition at line 162 of file L1TSync_Harvest.h.

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

Definition at line 156 of file L1TSync_Harvest.h.

bool L1TSync_Harvest::m_verbose
private

Definition at line 133 of file L1TSync_Harvest.h.