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_Offline Class Reference

#include <L1TSync_Offline.h>

Inheritance diagram for L1TSync_Offline:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase 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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 L1TSync_Offline (const edm::ParameterSet &ps)
 
virtual ~L1TSync_Offline ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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)
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
virtual void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
 BeginRun. More...
 
virtual void dqmBeginRun (const edm::Run &, const edm::EventSetup &)
 
- 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 getBeamConfOffline (const edm::Event &)
 

Private Attributes

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::EDGetTokenT
< L1GlobalTriggerReadoutRecord
m_l1GtDataDaqInputTag
 
edm::EDGetTokenT
< L1GlobalTriggerEvmReadoutRecord
m_l1GtEvmSource
 
L1GtUtils m_l1GtUtils
 
unsigned int m_lhcFill
 
std::string m_outputFile
 
edm::ParameterSet m_parameters
 
bool * m_processedLS
 
int m_refPrescaleSet
 
std::map< std::string,
std::string > 
m_selectedTriggers
 
bool m_verbose
 

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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 63 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 67 of file L1TSync_Offline.h.

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

Constructor & Destructor Documentation

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

Definition at line 61 of file L1TSync_Offline.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_algoAutoSelect, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_outputFile, m_parameters, m_refPrescaleSet, m_selectedTriggers, m_verbose, TrackValidation_cff::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

61  :
62  m_l1GtUtils(pset, consumesCollector(), false, *this) {
63 
65 
66  // Mapping parameter input variables
67  m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter <InputTag>("inputTagL1GtDataDaq"));
68  m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter <InputTag>("inputTagtEvmSource"));
69  m_verbose = pset.getUntrackedParameter<bool> ("verbose",false);
70  m_refPrescaleSet = pset.getParameter <int> ("refPrescaleSet");
71 
72  // Getting which categories to monitor
73  ParameterSet Categories = pset.getParameter< ParameterSet >("Categories");
74 
75  bool forceGlobalParameters = Categories.getParameter<bool>("forceGlobalParameters");
76  bool doGlobalAutoSelection = Categories.getParameter<bool>("doGlobalAutoSelection");
77 
78  ParameterSet CatBPTX = Categories.getParameter<ParameterSet>("BPTX");
79  ParameterSet CatMu = Categories.getParameter<ParameterSet>("Mu");
80  ParameterSet CatEG = Categories.getParameter<ParameterSet>("EG");
81  ParameterSet CatIsoEG = Categories.getParameter<ParameterSet>("IsoEG");
82  ParameterSet CatJet = Categories.getParameter<ParameterSet>("Jet");
83  ParameterSet CatCenJet = Categories.getParameter<ParameterSet>("CenJet");
84  ParameterSet CatForJet = Categories.getParameter<ParameterSet>("ForJet");
85  ParameterSet CatTauJet = Categories.getParameter<ParameterSet>("TauJet");
86  ParameterSet CatETM = Categories.getParameter<ParameterSet>("ETT");
87  ParameterSet CatETT = Categories.getParameter<ParameterSet>("ETM");
88  ParameterSet CatHTT = Categories.getParameter<ParameterSet>("HTT");
89  ParameterSet CatHTM = Categories.getParameter<ParameterSet>("HTM");
90 
91  // --> Setting parameters related to which algos to monitor
92  // If global parameters are forced they take precedence over algo-by-algo parameters
93  if(forceGlobalParameters){
94 
95  // If global automatic selection if enable all categories set to be monitored will have
96  // their algos auto selected (the lowest prescale algo will be selected)
97  if(doGlobalAutoSelection){
98 
99  if(CatMu .getParameter<bool>("monitor")){m_algoAutoSelect["Mu"] = true;}else{m_algoAutoSelect["Mu"] = false;}
100  if(CatEG .getParameter<bool>("monitor")){m_algoAutoSelect["EG"] = true;}else{m_algoAutoSelect["EG"] = false;}
101  if(CatIsoEG .getParameter<bool>("monitor")){m_algoAutoSelect["IsoEG"] = true;}else{m_algoAutoSelect["IsoEG"] = false;}
102  if(CatJet .getParameter<bool>("monitor")){m_algoAutoSelect["Jet"] = true;}else{m_algoAutoSelect["Jet"] = false;}
103  if(CatCenJet.getParameter<bool>("monitor")){m_algoAutoSelect["CenJet"] = true;}else{m_algoAutoSelect["CenJet"] = false;}
104  if(CatForJet.getParameter<bool>("monitor")){m_algoAutoSelect["ForJet"] = true;}else{m_algoAutoSelect["ForJet"] = false;}
105  if(CatTauJet.getParameter<bool>("monitor")){m_algoAutoSelect["TauJet"] = true;}else{m_algoAutoSelect["TauJet"] = false;}
106  if(CatETM .getParameter<bool>("monitor")){m_algoAutoSelect["ETM"] = true;}else{m_algoAutoSelect["ETM"] = false;}
107  if(CatETT .getParameter<bool>("monitor")){m_algoAutoSelect["ETT"] = true;}else{m_algoAutoSelect["ETT"] = false;}
108  if(CatHTM .getParameter<bool>("monitor")){m_algoAutoSelect["HTM"] = true;}else{m_algoAutoSelect["HTM"] = false;}
109  if(CatHTT .getParameter<bool>("monitor")){m_algoAutoSelect["HTT"] = true;}else{m_algoAutoSelect["HTT"] = false;}
110 
111  // If global non-automatic selection is enable all categories set to be monitored will use
112  // user defined algos
113  }else{
114 
115  m_algoAutoSelect["Mu"] = false;
116  m_algoAutoSelect["EG"] = false;
117  m_algoAutoSelect["IsoEG"] = false;
118  m_algoAutoSelect["Jet"] = false;
119  m_algoAutoSelect["CenJet"] = false;
120  m_algoAutoSelect["ForJet"] = false;
121  m_algoAutoSelect["TauJet"] = false;
122  m_algoAutoSelect["ETM"] = false;
123  m_algoAutoSelect["ETT"] = false;
124  m_algoAutoSelect["HTM"] = false;
125  m_algoAutoSelect["HTT"] = false;
126 
127  if(CatMu .getParameter<bool>("monitor")){m_selectedTriggers["Mu"] = CatMu .getParameter<string>("algo");}
128  if(CatEG .getParameter<bool>("monitor")){m_selectedTriggers["EG"] = CatEG .getParameter<string>("algo");}
129  if(CatIsoEG .getParameter<bool>("monitor")){m_selectedTriggers["IsoEG"] = CatIsoEG .getParameter<string>("algo");}
130  if(CatJet .getParameter<bool>("monitor")){m_selectedTriggers["Jet"] = CatJet .getParameter<string>("algo");}
131  if(CatCenJet.getParameter<bool>("monitor")){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
132  if(CatForJet.getParameter<bool>("monitor")){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
133  if(CatTauJet.getParameter<bool>("monitor")){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
134  if(CatETM .getParameter<bool>("monitor")){m_selectedTriggers["ETM"] = CatETM .getParameter<string>("algo");}
135  if(CatETT .getParameter<bool>("monitor")){m_selectedTriggers["ETT"] = CatETT .getParameter<string>("algo");}
136  if(CatHTM .getParameter<bool>("monitor")){m_selectedTriggers["HTM"] = CatHTM .getParameter<string>("algo");}
137  if(CatHTT .getParameter<bool>("monitor")){m_selectedTriggers["HTT"] = CatHTT .getParameter<string>("algo");}
138 
139  }
140 
141  // If we are using algo-by-algo parametes we get them and set what is needed
142  }else{
143 
144  if(CatBPTX.getParameter<bool>("monitor")){
145  m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
146  }
147 
148  if(CatMu.getParameter<bool>("monitor")){
149  m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
150  if(!m_algoAutoSelect["Mu"]){m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");}
151  }else{m_algoAutoSelect["Mu"] = false;}
152 
153  if(CatEG.getParameter<bool>("monitor")){
154  m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
155  if(!m_algoAutoSelect["EG"]){m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");}
156  }else{m_algoAutoSelect["EG"] = false;}
157 
158  if(CatIsoEG.getParameter<bool>("monitor")){
159  m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
160  if(!m_algoAutoSelect["IsoEG"]){m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");}
161  }else{m_algoAutoSelect["IsoEG"] = false;}
162 
163  if(CatJet.getParameter<bool>("monitor")){
164  m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
165  if(!m_algoAutoSelect["Jet"]){m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");}
166  }else{m_algoAutoSelect["Jet"] = false;}
167 
168  if(CatCenJet.getParameter<bool>("monitor")){
169  m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
170  if(!m_algoAutoSelect["CenJet"]){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
171  }else{m_algoAutoSelect["CenJet"] = false;}
172 
173  if(CatForJet.getParameter<bool>("monitor")){
174  m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
175  if(!m_algoAutoSelect["CatForJet"]){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
176  }else{m_algoAutoSelect["CatForJet"] = false;}
177 
178  if(CatTauJet.getParameter<bool>("monitor")){
179  m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
180  if(!m_algoAutoSelect["TauJet"]){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
181  }else{m_algoAutoSelect["TauJet"] = false;}
182 
183  if(CatETM.getParameter<bool>("monitor")){
184  m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
185  if(!m_algoAutoSelect["ETM"]){m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");}
186  }else{m_algoAutoSelect["ETM"] = false;}
187 
188  if(CatETT.getParameter<bool>("monitor")){
189  m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
190  if(!m_algoAutoSelect["ETT"]){m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");}
191  }else{m_algoAutoSelect["ETT"] = false;}
192 
193  if(CatHTM.getParameter<bool>("monitor")){
194  m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
195  if(!m_algoAutoSelect["HTM"]){m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");}
196  }else{m_algoAutoSelect["HTM"] = false;}
197 
198  if(CatHTT.getParameter<bool>("monitor")){
199  m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
200  if(!m_algoAutoSelect["HTT"]){m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");}
201  }else{m_algoAutoSelect["HTT"] = false;}
202 
203  }
204 
205  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");
206 
207  if (m_outputFile.size() != 0) {
208  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
209  }
210 
211  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
212  if (disable) {m_outputFile = "";}
213 }
T getParameter(std::string const &) const
std::map< std::string, std::string > m_selectedTriggers
L1GtUtils m_l1GtUtils
edm::ParameterSet m_parameters
std::string m_outputFile
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
tuple cout
Definition: gather_cfg.py:145
std::map< std::string, bool > m_algoAutoSelect
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
L1TSync_Offline::~L1TSync_Offline ( )
virtual

Definition at line 217 of file L1TSync_Offline.cc.

217 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 312 of file L1TSync_Offline.cc.

References a, funct::abs(), L1TBeamConfiguration::beam1, L1TBeamConfiguration::beam2, L1GtfeExtWord::beamMode(), L1TBeamConfiguration::bxConfig(), gather_cfg::cout, ERROR_UNABLE_RETRIVE_PRODUCT, getBeamConfOffline(), edm::Event::getByToken(), MonitorElement::getTH1(), i, L1TBeamConfiguration::isValid(), edm::HandleBase::isValid(), L1GtfeExtWord::lhcFillNumber(), m_algoBit, m_algoVsBunchStructure, m_beamConfig, m_currentLS, m_currentLSValid, m_ErrorMonitor, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_lhcFill, m_selectedTriggers, m_verbose, and STABLE.

312  {
313 
314 
315  if(m_verbose){cout << "[L1TSync_Offline] Called analyze." << endl;}
316 
317  // We only start analyzing if current LS is still valid
318  if(m_currentLSValid){
319 
320  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
321 
322  // Retriving information from GT
324  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
325 
326  // Determining beam mode and fill number
327  if(gtEvmReadoutRecord.isValid()){
328 
329  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
330  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
331 
332  if(m_lhcFill == 0){
333  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
334 
335  //I AM HERE
336  getBeamConfOffline(iEvent); // Getting Beam Configuration from OMDS
337  // no OMDS //
338  /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
339  Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
340  The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
341  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.
342  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.
343  */
344  // no OMDS // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that
345 
346 
347 
348 
349  }
350 
351  if(lhcBeamMode != STABLE){m_currentLSValid = false;
352  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << "because beams mode not stable, being " << lhcBeamMode << endl;}
353  } // If Beams are not stable we invalidate this LS
354  }else{
355  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
356  eCount++;
357  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
358  }
359  }else{
360  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
361  }
362 
363  // Commenting out un-necessary print outs (S.Dutta)
364  /* for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
365  cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
366  }*/
367  //------------------------------------------------------------------------------
368  // If current LS is valid and Beam Configuration is Valid we analyse this event
369  //------------------------------------------------------------------------------
371 
372  // Getting Final Decision Logic (FDL) Data from GT
373  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
374  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
375 
376  if(gtReadoutRecordData.isValid()){
377 
378  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
379 
380  // Running over selected triggers
381  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
382 
383  string tTrigger = (*i).second;
384 
385  // Analyse only defined triggers
386  if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){
387 
388  bool beamSingleConfig = false; // Single beam configured for this event
389  bool firedAlgo = false; // Algo fired in this event
390  unsigned int eventBx = ~0;
391 
392  // Running over FDL results to get which bits fired
393  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
394 
395  // Selecting the FDL that triggered
396  if(gtFdlVectorData[a].bxInEvent() == 0){
397  eventBx = gtFdlVectorData[a].localBxNr();
398  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
399  }
400  }
401 
402  // Checking beam configuration
403  if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
404  if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
405  if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
406  }
407  // Analyse only if this trigger fired in this event
408  // NOTE: Veto cases where a single beam is configured since
409  // for this cases this could be a real-satelite bunch collision
410  // -> Calculate the minimum bx diference between this event and a configured bx
411  if(firedAlgo && !beamSingleConfig){
412 
413  int DifAlgoVsBunchStructure = 9999; // Majorated
414 
415  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
416 
417  int bxFDL = gtFdlVectorData[a].localBxNr();
418  int bxInEvent = gtFdlVectorData[a].bxInEvent();
419 
420  if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
421  DifAlgoVsBunchStructure = -1*bxInEvent;
422  }
423  }
424 
425  m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
426 
427  }
428  }
429  }
430  }
431  else{
432  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
433  eCount++;
434  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
435  }
436 
437  }
438 }
void getBeamConfOffline(const edm::Event &)
int i
Definition: DBlmapReader.cc:9
MonitorElement * m_ErrorMonitor
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, int > m_algoBit
int iEvent
Definition: GenABIO.cc:230
unsigned int m_lhcFill
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1 * getTH1(void) const
bool isValid() const
Definition: HandleBase.h:75
bool bxConfig(unsigned iBx)
std::vector< bool > beam2
const cms_uint32_t lhcFillNumber() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:145
unsigned int m_currentLS
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
std::vector< bool > beam1
const cms_uint16_t beamMode() const
L1TBeamConfiguration m_beamConfig
std::map< TString, MonitorElement * > m_algoVsBunchStructure
void L1TSync_Offline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 303 of file L1TSync_Offline.cc.

References gather_cfg::cout, m_currentLSValid, and m_verbose.

303  {
304 
305  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
306 
307  m_currentLSValid = true;
308 
309  }
tuple cout
Definition: gather_cfg.py:145
void L1TSync_Offline::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

BeginRun.

Implements DQMEDAnalyzer.

Definition at line 227 of file L1TSync_Offline.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), gather_cfg::cout, ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, ERROR_UNABLE_RETRIVE_PRODUCT, edm::EventSetup::get(), L1TMenuHelper::getLUSOTrigger(), L1GtTriggerMenu::gtAlgorithmAliasMap(), i, m_algoAutoSelect, m_algoBit, m_algoCertification, m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_currentLS, m_ErrorMonitor, m_l1GtUtils, m_lhcFill, m_refPrescaleSet, m_selectedTriggers, m_verbose, relval_steps::menu, edm::ESHandle< class >::product(), L1GtUtils::retrieveL1EventSetup(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), L1TMenuHelper::testAlgos(), UNKNOWN, WARNING_DB_CONN_FAILED, WARNING_DB_INCORRECT_NBUNCHES, and WARNING_DB_QUERY_FAILED.

227  {
228 
229  if (m_verbose){cout << "[L1TSync_Offline] Called beginRun." << endl;}
230 
231  // Initializing variables
232  int maxNbins = 2501;
233 
234  // Reseting run dependent variables
235  m_lhcFill = 0;
236  m_currentLS = 0;
237  m_certFirstLS.clear();
238  m_certLastLS .clear();
239 
240  // Getting Trigger menu from GT
242  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
243  const L1GtTriggerMenu* menu = menuRcd.product();
244 
245  // Filling Alias-Bit Map
246  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
247  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
248  }
249 
250  // Getting fill number for this run
251  //Handle<ConditionsInRunBlock> runConditions;
252  //iRun.getByType(runConditions);
253  //int lhcFillNumber = runConditions->lhcFillNumber;
254  //
255  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
256  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
257  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
258 
259  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
260 
262 
264  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
265  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
266 
267  // Initializing DQM Monitor Elements
268  ibooker.setCurrentFolder("L1T/L1TSync");
269  m_ErrorMonitor = ibooker.book1D("ErrorMonitor","ErrorMonitor",7,0,7);
270  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
271  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
272  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
273  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
274  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
275  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
276  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
277 
278  // Looping over selected triggers
279  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
280 
281  string tCategory = (*i).first;
282  string tTrigger = (*i).second;
283 
284  // Initializing LS blocks for certification
285  m_certFirstLS[(*i).second] = 0;
286  m_certLastLS [(*i).second] = 0;
287 
288  // Initializing DQM Monitors
289  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
290  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
291  m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
292 
293  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
294  m_algoCertification[tTrigger] = ibooker.book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
295  m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);
296 
297  }
298 }
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certLastLS
MonitorElement * m_ErrorMonitor
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, unsigned int > m_certFirstLS
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
L1GtUtils m_l1GtUtils
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< TString, int > m_algoBit
unsigned int m_lhcFill
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:121
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::map< TString, MonitorElement * > m_algoCertification
tuple cout
Definition: gather_cfg.py:145
unsigned int m_currentLS
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
std::map< std::string, bool > m_algoAutoSelect
std::map< TString, MonitorElement * > m_algoVsBunchStructure
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)
void L1TSync_Offline::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
protectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 221 of file L1TSync_Offline.cc.

221  {
222 
223 }
void L1TSync_Offline::getBeamConfOffline ( const edm::Event iEvent)
private

Definition at line 445 of file L1TSync_Offline.cc.

References a, L1TBeamConfiguration::beam1, L1TBeamConfiguration::beam2, edm::Event::getByToken(), edm::HandleBase::isValid(), m_algoBit, m_beamConfig, m_l1GtDataDaqInputTag, m_selectedTriggers, and L1TBeamConfiguration::m_valid.

Referenced by analyze().

445  {
446 
447  //Getting connection parameters
448  // [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
449  // [11:21:51] Joao Pela: no
450  // [11:21:56] Pietro Vischia: cool
451  // [11:21:58] Pietro Vischia: tks
452  // [11:22:00] Joao Pela: well
453  // [11:22:02] Joao Pela: maybe
454  // [11:22:05] Joao Pela: but assume no
455  // [11:22:22] Joao Pela: definitely assume no
456  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync
457 
458  // string oracleDB = m_parameters.getParameter<string>("oracleDB");
459  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
460 
461  // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
462  // m_lhcFill -> lhcFillNumber
463  // errorRetrieve -> error
464  // m_beamConfig -> bConfig
465 
466 
467  // No error codes at the moment. Taking info from BPTX fires
468  // int errorRetrieve = 0; // NO_ERROR;
469  m_beamConfig.m_valid = true;
470 
471 
472 
473  // bool beamSingleConfig = false; // Single beam configured for this event
474  bool firedAlgo = false; // Algo fired in this event
475  // int eventBx = -1;
476 
477  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
478  // Getting Final Decision Logic (FDL) Data from GT
479  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
480  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
481 
482  if(gtReadoutRecordData.isValid()){
483 
484  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
485 
486  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
487  // Selecting the FDL that triggered
488  if(gtFdlVectorData[a].bxInEvent() == 0){
489  //eventBx = gtFdlVectorData[a].localBxNr();
490  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers["BPTX"] ] ]){firedAlgo = true;}
491  }
492 
493  // Fill beam status with BPTX fires
494  if(firedAlgo){
495  m_beamConfig.beam1.push_back(true);
496  m_beamConfig.beam2.push_back(true);
497  }
498  else {
499  m_beamConfig.beam1.push_back(false);
500  m_beamConfig.beam2.push_back(false);
501  }
502  // End fill beam status with BPTX fires
503  } // End loop on FDL
504  } // End if readout is valid
505 
506 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, int > m_algoBit
bool isValid() const
Definition: HandleBase.h:75
std::vector< bool > beam2
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
std::vector< bool > beam1
L1TBeamConfiguration m_beamConfig

Member Data Documentation

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

Definition at line 148 of file L1TSync_Offline.h.

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

Definition at line 156 of file L1TSync_Offline.h.

Referenced by bookHistograms(), and L1TSync_Offline().

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

Definition at line 151 of file L1TSync_Offline.h.

Referenced by analyze(), bookHistograms(), and getBeamConfOffline().

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

Definition at line 154 of file L1TSync_Offline.h.

Referenced by bookHistograms().

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

Definition at line 155 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

L1TBeamConfiguration L1TSync_Offline::m_beamConfig
private

Definition at line 145 of file L1TSync_Offline.h.

Referenced by analyze(), and getBeamConfOffline().

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

Definition at line 152 of file L1TSync_Offline.h.

Referenced by bookHistograms().

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

Definition at line 153 of file L1TSync_Offline.h.

Referenced by bookHistograms().

unsigned int L1TSync_Offline::m_currentLS
private

Definition at line 140 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

bool L1TSync_Offline::m_currentLSValid
private

Definition at line 135 of file L1TSync_Offline.h.

Referenced by analyze(), and beginLuminosityBlock().

MonitorElement* L1TSync_Offline::m_ErrorMonitor
private

Definition at line 160 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1TSync_Offline::m_l1GtDataDaqInputTag
private

Definition at line 164 of file L1TSync_Offline.h.

Referenced by analyze(), getBeamConfOffline(), and L1TSync_Offline().

edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> L1TSync_Offline::m_l1GtEvmSource
private

Definition at line 163 of file L1TSync_Offline.h.

Referenced by analyze(), and L1TSync_Offline().

L1GtUtils L1TSync_Offline::m_l1GtUtils
private

Definition at line 166 of file L1TSync_Offline.h.

Referenced by bookHistograms().

unsigned int L1TSync_Offline::m_lhcFill
private

Definition at line 142 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

std::string L1TSync_Offline::m_outputFile
private

Definition at line 131 of file L1TSync_Offline.h.

Referenced by L1TSync_Offline().

edm::ParameterSet L1TSync_Offline::m_parameters
private

Definition at line 128 of file L1TSync_Offline.h.

Referenced by L1TSync_Offline().

bool* L1TSync_Offline::m_processedLS
private

Definition at line 136 of file L1TSync_Offline.h.

int L1TSync_Offline::m_refPrescaleSet
private

Definition at line 139 of file L1TSync_Offline.h.

Referenced by bookHistograms(), and L1TSync_Offline().

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

Definition at line 157 of file L1TSync_Offline.h.

Referenced by analyze(), bookHistograms(), getBeamConfOffline(), and L1TSync_Offline().

bool L1TSync_Offline::m_verbose
private

Definition at line 134 of file L1TSync_Offline.h.

Referenced by analyze(), beginLuminosityBlock(), bookHistograms(), and L1TSync_Offline().