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
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

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

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
void beginRun (const edm::Run &run, const edm::EventSetup &iSetup)
 BeginRun. More...
 
void endJob (void)
 
void endRun (const edm::Run &run, const edm::EventSetup &iSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void 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::InputTag m_l1GtDataDaqInputTag
 
edm::InputTag m_l1GtEvmSource
 
unsigned int m_lhcFill
 
std::string m_outputFile
 
edm::ParameterSet m_parameters
 
bool * m_processedLS
 
int m_refPrescaleSet
 
edm::InputTag m_scalersSource
 
std::map< std::string,
std::string > 
m_selectedTriggers
 
bool m_verbose
 

Additional Inherited Members

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

Detailed Description

Definition at line 60 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 64 of file L1TSync_Offline.h.

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

Constructor & Destructor Documentation

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

Definition at line 67 of file L1TSync_Offline.cc.

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

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

Definition at line 232 of file L1TSync_Offline.cc.

232 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 366 of file L1TSync_Offline.cc.

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

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

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

236  {
237 
238  if (m_verbose){cout << "[L1TSync_Offline] Called beginJob." << endl;}
239 
240  // get hold of back-end interface
241  DQMStore *dbe = 0;
242  dbe = Service < DQMStore > ().operator->();
243 
244  if (dbe) {
245  dbe->setCurrentFolder("L1T/L1TSync");
246  dbe->rmdir("L1T/L1TSync");
247  }
248 
249 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TSync_Offline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 343 of file L1TSync_Offline.cc.

References gather_cfg::cout.

343  {
344 
345  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
346 
347  m_currentLSValid = true;
348 
349  }
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 267 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.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 253 of file L1TSync_Offline.cc.

References gather_cfg::cout.

253  {
254 
255  if (m_verbose){cout << "[L1TSync_Offline] Called endJob." << endl;}
256 
257  if (m_outputFile.size() != 0 && dbe)
259 
260  return;
261 
262 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
std::string m_outputFile
tuple cout
Definition: gather_cfg.py:121
void L1TSync_Offline::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 353 of file L1TSync_Offline.cc.

References gather_cfg::cout.

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

Definition at line 499 of file L1TSync_Offline.cc.

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

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

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

Definition at line 150 of file L1TSync_Offline.h.

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

Definition at line 158 of file L1TSync_Offline.h.

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

Definition at line 153 of file L1TSync_Offline.h.

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

Definition at line 156 of file L1TSync_Offline.h.

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

Definition at line 157 of file L1TSync_Offline.h.

L1TBeamConfiguration L1TSync_Offline::m_beamConfig
private

Definition at line 147 of file L1TSync_Offline.h.

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

Definition at line 154 of file L1TSync_Offline.h.

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

Definition at line 155 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_currentLS
private

Definition at line 142 of file L1TSync_Offline.h.

bool L1TSync_Offline::m_currentLSValid
private

Definition at line 137 of file L1TSync_Offline.h.

MonitorElement* L1TSync_Offline::m_ErrorMonitor
private

Definition at line 162 of file L1TSync_Offline.h.

edm::InputTag L1TSync_Offline::m_l1GtDataDaqInputTag
private

Definition at line 167 of file L1TSync_Offline.h.

edm::InputTag L1TSync_Offline::m_l1GtEvmSource
private

Definition at line 166 of file L1TSync_Offline.h.

unsigned int L1TSync_Offline::m_lhcFill
private

Definition at line 144 of file L1TSync_Offline.h.

std::string L1TSync_Offline::m_outputFile
private

Definition at line 133 of file L1TSync_Offline.h.

edm::ParameterSet L1TSync_Offline::m_parameters
private

Definition at line 130 of file L1TSync_Offline.h.

bool* L1TSync_Offline::m_processedLS
private

Definition at line 138 of file L1TSync_Offline.h.

int L1TSync_Offline::m_refPrescaleSet
private

Definition at line 141 of file L1TSync_Offline.h.

edm::InputTag L1TSync_Offline::m_scalersSource
private

Definition at line 165 of file L1TSync_Offline.h.

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

Definition at line 159 of file L1TSync_Offline.h.

bool L1TSync_Offline::m_verbose
private

Definition at line 136 of file L1TSync_Offline.h.