CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DQM/L1TMonitor/interface/L1TSync.h

Go to the documentation of this file.
00001 #ifndef L1TSync_H
00002 #define L1TSync_H
00003 
00004 /*
00005  * \file L1TSync.h
00006  *
00007  * $Date: 2011/08/02 15:49:48 $
00008  * $Revision: 1.8 $
00009  * \author J. Pela
00010  *
00011 */
00012 
00013 // system include files
00014 #include <memory>
00015 #include <unistd.h>
00016 
00017 // user include files
00018 #include "FWCore/Framework/interface/Frameworkfwd.h"
00019 #include "FWCore/Framework/interface/EDAnalyzer.h"
00020 #include "FWCore/Framework/interface/ESHandle.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/Framework/interface/LuminosityBlock.h"
00023 #include "FWCore/Framework/interface/MakerMacros.h"
00024 
00025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00026 
00027 #include "DQMServices/Core/interface/DQMStore.h"
00028 #include "DQMServices/Core/interface/MonitorElement.h"
00029 #include "FWCore/ServiceRegistry/interface/Service.h"
00030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00031 
00032 #include "DQM/L1TMonitor/interface/L1TOMDSHelper.h"
00033 
00034 #include <TString.h>
00035 
00036 #include <iostream>
00037 #include <fstream>
00038 #include <string>
00039 #include <vector>
00040 
00041 class L1TSync : public edm::EDAnalyzer {
00042 
00043   public:
00044 
00045     enum BeamMode{
00046       NOMODE=1,
00047       SETUP=2,
00048       INJPILOT=3,
00049       INJINTR=4,
00050       INJNOMN=5,
00051       PRERAMP=6,
00052       RAMP=7,
00053       FLATTOP=8,
00054       QUEEZE=9,
00055       ADJUST=10,
00056       STABLE=11,
00057       UNSTABLE=12,
00058       BEAMDUMP=13,
00059       RAMPDOWN=14,
00060       RECOVERY=15,
00061       INJDUMP=16,
00062       CIRCDUMP=17,
00063       ABORT=18,
00064       CYCLING=19,
00065       WBDUMP=20,
00066       NOBEAM=21
00067     };
00068 
00069     enum Errors{
00070       UNKNOWN                       = 1,
00071       WARNING_DB_CONN_FAILED        = 2,
00072       WARNING_DB_QUERY_FAILED       = 3,
00073       WARNING_DB_INCORRECT_NBUNCHES = 4,
00074       ERROR_UNABLE_RETRIVE_PRODUCT  = 5,
00075       ERROR_TRIGGERALIAS_NOTVALID   = 6,
00076       ERROR_LSBLOCK_NOTVALID        = 7
00077     };
00078 
00079 
00080   public:
00081 
00082     L1TSync(const edm::ParameterSet& ps);   // Constructor
00083     virtual ~L1TSync();                     // Destructor
00084 
00085   protected:
00086 
00087     void analyze (const edm::Event& e, const edm::EventSetup& c);  // Analyze
00088     void beginJob();                                               // BeginJob
00089     void endJob  (void);                                           // EndJob
00090     void beginRun(const edm::Run& run, const edm::EventSetup& iSetup);
00091     void endRun  (const edm::Run& run, const edm::EventSetup& iSetup);
00092 
00093     virtual void beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c);
00094     virtual void endLuminosityBlock  (edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c);
00095 
00096 
00097   // Private Methods
00098   private:
00099 
00100     void getBeamConfOMDS();
00101     void doFractionInSync(bool iForce=false, bool iBad=false);
00102     void certifyLSBlock  (std::string iTrigger, int iInitLs, int iEndLs ,float iValue);
00103 
00104   // Variables
00105   private:
00106 
00107     DQMStore * dbe; // The DQM Service Handle
00108 
00109     edm::ParameterSet                      m_parameters;
00110 
00111     std::string                            m_outputFile;          // file name for ROOT ouput
00112 
00113     // bool
00114     bool                                   m_verbose;
00115     bool                                   m_currentLSValid;
00116     bool*                                  m_processedLS;                      
00117 
00118     // Int
00119     int                                    m_refPrescaleSet;
00120     unsigned int                           m_currentLS;            // Current LS
00121     //unsigned int                         m_eventLS;
00122     unsigned int                           m_lhcFill;             //
00123 
00124     // Vectors
00125     BeamConfiguration                      m_beamConfig;          // Current Bunch Structure
00126 
00127     // Const Vectors
00128     const std::vector< std::vector<int> >* ListsPrescaleFactors;  // Collection os all sets of prescales
00129 
00130     // Maps
00131     std::map<TString,int>                  m_algoBit;
00132     std::map<TString,unsigned int>         m_certFirstLS;         // First uncertified LS
00133     std::map<TString,unsigned int>         m_certLastLS;          // Last  uncertified LS
00134     std::map<TString,MonitorElement*>      m_algoCertification;
00135     std::map<TString,MonitorElement*>      m_algoVsBunchStructure;
00136     std::map<std::string,bool>             m_algoAutoSelect;      // Map of categories to monitor
00137     std::map<std::string,std::string>      m_selectedTriggers;    // Map of what trigger to monitor for each category
00138 
00139     // MonitorElement
00140     MonitorElement*                        m_ErrorMonitor;
00141 
00142     // Input tags
00143     edm::InputTag                          m_scalersSource;       // Where to get L1 Scalers
00144     edm::InputTag                          m_l1GtEvmSource;
00145     edm::InputTag                          m_l1GtDataDaqInputTag;
00146 
00147 };
00148 
00149 #endif