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 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
 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 (const std::string &iProcessName, std::vector< const char * > &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::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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
 
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 61 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 65 of file L1TSync_Offline.h.

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

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

Definition at line 216 of file L1TSync_Offline.cc.

216 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 310 of file L1TSync_Offline.cc.

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

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

References gather_cfg::cout.

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

BeginRun.

Implements DQMEDAnalyzer.

Definition at line 226 of file L1TSync_Offline.cc.

References HLT_25ns14e33_v1_cff::algo, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), gather_cfg::cout, edm::EventSetup::get(), L1TMenuHelper::getLUSOTrigger(), L1GtTriggerMenu::gtAlgorithmAliasMap(), i, relval_steps::menu, edm::ESHandle< class >::product(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), L1TMenuHelper::testAlgos(), and pat::UNKNOWN.

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

Reimplemented from DQMEDAnalyzer.

Definition at line 220 of file L1TSync_Offline.cc.

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

Definition at line 443 of file L1TSync_Offline.cc.

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

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

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

Definition at line 154 of file L1TSync_Offline.h.

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

Definition at line 149 of file L1TSync_Offline.h.

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

Definition at line 152 of file L1TSync_Offline.h.

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

Definition at line 153 of file L1TSync_Offline.h.

L1TBeamConfiguration L1TSync_Offline::m_beamConfig
private

Definition at line 143 of file L1TSync_Offline.h.

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

Definition at line 150 of file L1TSync_Offline.h.

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

Definition at line 151 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_currentLS
private

Definition at line 138 of file L1TSync_Offline.h.

bool L1TSync_Offline::m_currentLSValid
private

Definition at line 133 of file L1TSync_Offline.h.

MonitorElement* L1TSync_Offline::m_ErrorMonitor
private

Definition at line 158 of file L1TSync_Offline.h.

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

Definition at line 162 of file L1TSync_Offline.h.

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

Definition at line 161 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_lhcFill
private

Definition at line 140 of file L1TSync_Offline.h.

std::string L1TSync_Offline::m_outputFile
private

Definition at line 129 of file L1TSync_Offline.h.

edm::ParameterSet L1TSync_Offline::m_parameters
private

Definition at line 126 of file L1TSync_Offline.h.

bool* L1TSync_Offline::m_processedLS
private

Definition at line 134 of file L1TSync_Offline.h.

int L1TSync_Offline::m_refPrescaleSet
private

Definition at line 137 of file L1TSync_Offline.h.

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

Definition at line 155 of file L1TSync_Offline.h.

bool L1TSync_Offline::m_verbose
private

Definition at line 132 of file L1TSync_Offline.h.