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:
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_Offline (const edm::ParameterSet &ps)
 
virtual ~L1TSync_Offline ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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)
 
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 getBeamConfOffline (const edm::Event &)
 

Private Attributes

DQMStoredbe
 
const std::vector< std::vector
< int > > * 
ListsPrescaleFactors
 
std::map< std::string, bool > m_algoAutoSelect
 
std::map< TString, int > m_algoBit
 
std::map< TString,
MonitorElement * > 
m_algoCertification
 
std::map< TString,
MonitorElement * > 
m_algoVsBunchStructure
 
L1TBeamConfiguration m_beamConfig
 
std::map< TString, unsigned int > m_certFirstLS
 
std::map< TString, unsigned int > m_certLastLS
 
unsigned int m_currentLS
 
bool m_currentLSValid
 
MonitorElementm_ErrorMonitor
 
edm::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 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 59 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 63 of file L1TSync_Offline.h.

63  {
64  NOMODE=1,
65  SETUP=2,
66  INJPILOT=3,
67  INJINTR=4,
68  INJNOMN=5,
69  PRERAMP=6,
70  RAMP=7,
71  FLATTOP=8,
72  QUEEZE=9,
73  ADJUST=10,
74  STABLE=11,
75  UNSTABLE=12,
76  BEAMDUMP=13,
77  RAMPDOWN=14,
78  RECOVERY=15,
79  INJDUMP=16,
80  CIRCDUMP=17,
81  ABORT=18,
82  CYCLING=19,
83  WBDUMP=20,
84  NOBEAM=21
85  };
Enumerator
UNKNOWN 
WARNING_DB_CONN_FAILED 
WARNING_DB_QUERY_FAILED 
WARNING_DB_INCORRECT_NBUNCHES 
ERROR_UNABLE_RETRIVE_PRODUCT 
ERROR_TRIGGERALIAS_NOTVALID 
ERROR_LSBLOCK_NOTVALID 

Definition at line 87 of file L1TSync_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(), NULL, cppFunctionSkipper::operator, 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 
205  if (pset.getUntrackedParameter < bool > ("dqmStore", false)) {
207  dbe->setVerbose(0);
208  }
209 
210  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");
211 
212  if (m_outputFile.size() != 0) {
213  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
214  }
215 
216  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
217  if (disable) {m_outputFile = "";}
218 
219  if (dbe != NULL) {dbe->setCurrentFolder("L1T/L1TSync");}
220 
221 }
T getParameter(std::string const &) const
std::map< std::string, std::string > m_selectedTriggers
#define NULL
Definition: scimark2.h:8
edm::ParameterSet m_parameters
std::string m_outputFile
void setVerbose(unsigned level)
Definition: DQMStore.cc:619
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
tuple cout
Definition: gather_cfg.py:121
std::map< std::string, bool > m_algoAutoSelect
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
L1TSync_Offline::~L1TSync_Offline ( )
virtual

Definition at line 225 of file L1TSync_Offline.cc.

225 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 359 of file L1TSync_Offline.cc.

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

359  {
360 
361 
362  if(m_verbose){cout << "[L1TSync_Offline] Called analyze." << endl;}
363 
364  // We only start analyzing if current LS is still valid
365  if(m_currentLSValid){
366 
367  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
368 
369  // Retriving information from GT
371  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
372 
373  // Determining beam mode and fill number
374  if(gtEvmReadoutRecord.isValid()){
375 
376  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
377  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
378 
379  if(m_lhcFill == 0){
380  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
381 
382  //I AM HERE
383  getBeamConfOffline(iEvent); // Getting Beam Configuration from OMDS
384  // no OMDS //
385  /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
386  Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
387  The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
388  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.
389  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.
390  */
391  // no OMDS // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that
392 
393 
394 
395 
396  }
397 
398  if(lhcBeamMode != STABLE){m_currentLSValid = false;
399  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << "because beams mode not stable, being " << lhcBeamMode << endl;}
400  } // If Beams are not stable we invalidate this LS
401  }else{
402  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
403  eCount++;
404  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
405  }
406  }else{
407  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
408  }
409 
410  // Commenting out un-necessary print outs (S.Dutta)
411  /* for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
412  cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
413  }*/
414  //------------------------------------------------------------------------------
415  // If current LS is valid and Beam Configuration is Valid we analyse this event
416  //------------------------------------------------------------------------------
418 
419  // Getting Final Decision Logic (FDL) Data from GT
420  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
421  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
422 
423  if(gtReadoutRecordData.isValid()){
424 
425  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
426 
427  // Running over selected triggers
428  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
429 
430  string tTrigger = (*i).second;
431 
432  // Analyse only defined triggers
433  if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){
434 
435  bool beamSingleConfig = false; // Single beam configured for this event
436  bool firedAlgo = false; // Algo fired in this event
437  unsigned int eventBx = ~0;
438 
439  // Running over FDL results to get which bits fired
440  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
441 
442  // Selecting the FDL that triggered
443  if(gtFdlVectorData[a].bxInEvent() == 0){
444  eventBx = gtFdlVectorData[a].localBxNr();
445  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
446  }
447  }
448 
449  // Checking beam configuration
450  if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
451  if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
452  if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
453  }
454  // Analyse only if this trigger fired in this event
455  // NOTE: Veto cases where a single beam is configured since
456  // for this cases this could be a real-satelite bunch collision
457  // -> Calculate the minimum bx diference between this event and a configured bx
458  if(firedAlgo && !beamSingleConfig){
459 
460  int DifAlgoVsBunchStructure = 9999; // Majorated
461 
462  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
463 
464  int bxFDL = gtFdlVectorData[a].localBxNr();
465  int bxInEvent = gtFdlVectorData[a].bxInEvent();
466 
467  if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
468  DifAlgoVsBunchStructure = -1*bxInEvent;
469  }
470  }
471 
472  m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
473 
474  }
475  }
476  }
477  }
478  else{
479  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
480  eCount++;
481  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
482  }
483 
484  }
485 }
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:76
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::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 229 of file L1TSync_Offline.cc.

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

229  {
230 
231  if (m_verbose){cout << "[L1TSync_Offline] Called beginJob." << endl;}
232 
233  // get hold of back-end interface
234  DQMStore *dbe = 0;
235  dbe = Service < DQMStore > ().operator->();
236 
237  if (dbe) {
238  dbe->setCurrentFolder("L1T/L1TSync");
239  dbe->rmdir("L1T/L1TSync");
240  }
241 
242 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3051
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void L1TSync_Offline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 336 of file L1TSync_Offline.cc.

References gather_cfg::cout.

336  {
337 
338  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
339 
340  m_currentLSValid = true;
341 
342  }
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Offline::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 260 of file L1TSync_Offline.cc.

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

260  {
261 
262  if (m_verbose){cout << "[L1TSync_Offline] Called beginRun." << endl;}
263 
264  // Initializing variables
265  int maxNbins = 2501;
266 
267  // Reseting run dependent variables
268  m_lhcFill = 0;
269  m_currentLS = 0;
270  m_certFirstLS.clear();
271  m_certLastLS .clear();
272 
273  // Getting Trigger menu from GT
275  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
276  const L1GtTriggerMenu* menu = menuRcd.product();
277 
278  // Filling Alias-Bit Map
279  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
280  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
281  }
282 
283  // Getting fill number for this run
284  //Handle<ConditionsInRunBlock> runConditions;
285  //iRun.getByType(runConditions);
286  //int lhcFillNumber = runConditions->lhcFillNumber;
287  //
288  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
289  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
290  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
291 
292  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
293 
295 
296  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet);
297  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
298 
299  // Initializing DQM Monitor Elements
300  dbe->setCurrentFolder("L1T/L1TSync");
301  m_ErrorMonitor = dbe->book1D("ErrorMonitor","ErrorMonitor",7,0,7);
302  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
303  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
304  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
305  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
306  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
307  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
308  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
309 
310  // Looping over selected triggers
311  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
312 
313  string tCategory = (*i).first;
314  string tTrigger = (*i).second;
315 
316  // Initializing LS blocks for certification
317  m_certFirstLS[(*i).second] = 0;
318  m_certLastLS [(*i).second] = 0;
319 
320  // Initializing DQM Monitors
321  dbe->setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
322  m_algoVsBunchStructure[tTrigger] = dbe->book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
323  m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
324 
325  dbe->setCurrentFolder("L1T/L1TSync/Certification/");
326  m_algoCertification[tTrigger] = dbe->book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
327  m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);
328 
329  }
330 
331 }
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certLastLS
MonitorElement * m_ErrorMonitor
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
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< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors)
std::map< TString, int > m_algoBit
unsigned int m_lhcFill
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
std::map< std::string, bool > m_algoAutoSelect
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
std::map< TString, MonitorElement * > m_algoVsBunchStructure
void L1TSync_Offline::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 246 of file L1TSync_Offline.cc.

References gather_cfg::cout.

246  {
247 
248  if (m_verbose){cout << "[L1TSync_Offline] Called endJob." << endl;}
249 
250  if (m_outputFile.size() != 0 && dbe)
252 
253  return;
254 
255 }
std::string m_outputFile
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2490
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Offline::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 346 of file L1TSync_Offline.cc.

References gather_cfg::cout.

346  {
347 
348  if(m_verbose){cout << "[L1TSync_Offline] Called endRun." << endl;}
349 
350  // When the run end for closing of the LS certification blocks and evaluation
351  // of synchronization for that block
352 
353  // This will be for Harvesting
354  // doFractionInSync(true,false);
355 
356 }
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Offline::getBeamConfOffline ( const edm::Event iEvent)
private

Definition at line 492 of file L1TSync_Offline.cc.

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

492  {
493 
494  //Getting connection parameters
495  // [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
496  // [11:21:51] Joao Pela: no
497  // [11:21:56] Pietro Vischia: cool
498  // [11:21:58] Pietro Vischia: tks
499  // [11:22:00] Joao Pela: well
500  // [11:22:02] Joao Pela: maybe
501  // [11:22:05] Joao Pela: but assume no
502  // [11:22:22] Joao Pela: definitely assume no
503  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync
504 
505  // string oracleDB = m_parameters.getParameter<string>("oracleDB");
506  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
507 
508  // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
509  // m_lhcFill -> lhcFillNumber
510  // errorRetrieve -> error
511  // m_beamConfig -> bConfig
512 
513 
514  // No error codes at the moment. Taking info from BPTX fires
515  // int errorRetrieve = 0; // NO_ERROR;
516  m_beamConfig.m_valid = true;
517 
518 
519 
520  // bool beamSingleConfig = false; // Single beam configured for this event
521  bool firedAlgo = false; // Algo fired in this event
522  // int eventBx = -1;
523 
524  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
525  // Getting Final Decision Logic (FDL) Data from GT
526  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
527  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
528 
529  if(gtReadoutRecordData.isValid()){
530 
531  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
532 
533  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
534  // Selecting the FDL that triggered
535  if(gtFdlVectorData[a].bxInEvent() == 0){
536  //eventBx = gtFdlVectorData[a].localBxNr();
537  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers["BPTX"] ] ]){firedAlgo = true;}
538  }
539 
540  // Fill beam status with BPTX fires
541  if(firedAlgo){
542  m_beamConfig.beam1.push_back(true);
543  m_beamConfig.beam2.push_back(true);
544  }
545  else {
546  m_beamConfig.beam1.push_back(false);
547  m_beamConfig.beam2.push_back(false);
548  }
549  // End fill beam status with BPTX fires
550  } // End loop on FDL
551  } // End if readout is valid
552 
553 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, int > m_algoBit
bool isValid() const
Definition: HandleBase.h:76
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

DQMStore* L1TSync_Offline::dbe
private

Definition at line 126 of file L1TSync_Offline.h.

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

Definition at line 149 of file L1TSync_Offline.h.

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

Definition at line 157 of file L1TSync_Offline.h.

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

Definition at line 152 of file L1TSync_Offline.h.

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

Definition at line 155 of file L1TSync_Offline.h.

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

Definition at line 156 of file L1TSync_Offline.h.

L1TBeamConfiguration L1TSync_Offline::m_beamConfig
private

Definition at line 146 of file L1TSync_Offline.h.

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

Definition at line 153 of file L1TSync_Offline.h.

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

Definition at line 154 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_currentLS
private

Definition at line 141 of file L1TSync_Offline.h.

bool L1TSync_Offline::m_currentLSValid
private

Definition at line 136 of file L1TSync_Offline.h.

MonitorElement* L1TSync_Offline::m_ErrorMonitor
private

Definition at line 161 of file L1TSync_Offline.h.

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

Definition at line 165 of file L1TSync_Offline.h.

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

Definition at line 164 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_lhcFill
private

Definition at line 143 of file L1TSync_Offline.h.

std::string L1TSync_Offline::m_outputFile
private

Definition at line 132 of file L1TSync_Offline.h.

edm::ParameterSet L1TSync_Offline::m_parameters
private

Definition at line 129 of file L1TSync_Offline.h.

bool* L1TSync_Offline::m_processedLS
private

Definition at line 137 of file L1TSync_Offline.h.

int L1TSync_Offline::m_refPrescaleSet
private

Definition at line 140 of file L1TSync_Offline.h.

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

Definition at line 158 of file L1TSync_Offline.h.

bool L1TSync_Offline::m_verbose
private

Definition at line 135 of file L1TSync_Offline.h.