Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-31 23:13:57

0001 #ifndef L1TGT_H
0002 #define L1TGT_H
0003 
0004 /**
0005  * \class L1TGT
0006  *
0007  *
0008  * Description: DQM for L1 Global Trigger.
0009  *
0010  * \author J. Berryhill, I. Mikulec
0011  * \author Vasile Mihai Ghete - HEPHY Vienna
0012  *
0013  *
0014  */
0015 
0016 // system include files
0017 #include <memory>
0018 #include <unistd.h>
0019 #include <vector>
0020 #include <utility>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 
0025 #include "FWCore/Framework/interface/Event.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 
0030 #include "DQMServices/Core/interface/DQMStore.h"
0031 #include "FWCore/ServiceRegistry/interface/Service.h"
0032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0033 #include "FWCore/Framework/interface/EventSetup.h"
0034 #include "FWCore/Framework/interface/ESHandle.h"
0035 
0036 //L1 trigger includes
0037 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0038 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0039 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
0040 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0041 
0042 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0043 
0044 //
0045 // class declaration
0046 //
0047 
0048 class L1TGT : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0049 public:
0050   // constructor
0051   L1TGT(const edm::ParameterSet& ps);
0052 
0053   // destructor
0054   ~L1TGT() override;
0055 
0056 protected:
0057   //virtual void beginJob();
0058   void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
0059   void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) override;
0060   void analyze(const edm::Event&, const edm::EventSetup&) override;
0061 
0062   /// end section
0063   void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) final {}
0064   void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override;
0065 
0066 private:
0067   /// book all histograms for the module
0068 
0069   bool isActive(int word, int bit);
0070   // Active boards DAQ record bit number:
0071   // 0 FDL
0072   // 1 PSB_0 9 Techn.Triggers for FDL
0073   // 2 PSB_1 13 Calo data for GTL
0074   // 3 PSB_2 14 Calo data for GTL
0075   // 4 PSB_3 15 Calo data for GTL
0076   // 5 PSB_4 19 M/Q bits for GMT
0077   // 6 PSB_5 20 M/Q bits for GMT
0078   // 7 PSB_6 21 M/Q bits for GMT
0079   // 8 GMT
0080   enum activeDAQ { FDL = 0, PSB9, PSB13, PSB14, PSB15, PSB19, PSB20, PSB21, GMT };
0081   // Active boards EVM record bit number:
0082   // 0 TCS
0083   // 1 FDL
0084   enum activeEVM { TCS, FDLEVM };
0085 
0086   // count the number of indices per Ls for prescale factor sets
0087   // if no errors, it must be 1
0088   void countPfsIndicesPerLs();
0089 
0090 private:
0091   /// input parameters
0092 
0093   /// input tag for L1 GT DAQ readout record
0094   edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> gtSource_L1GT_;
0095   edm::EDGetTokenT<L1MuGMTReadoutCollection> gtSource_L1MuGMT_;
0096 
0097   /// input tag for L1 GT EVM readout record
0098   edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> gtEvmSource_;
0099   edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> l1gtTrigmenuToken_;
0100 
0101   /// switches to choose the running of various methods
0102   bool m_runInEventLoop;
0103   bool m_runInEndLumi;
0104 
0105   /// verbosity switch
0106   bool verbose_;
0107 
0108 private:
0109   MonitorElement* algo_bits;
0110   MonitorElement* algo_bits_corr;
0111   MonitorElement* tt_bits;
0112   MonitorElement* tt_bits_corr;
0113   MonitorElement* algo_tt_bits_corr;
0114   MonitorElement* algo_bits_lumi;
0115   MonitorElement* tt_bits_lumi;
0116   MonitorElement* event_type;
0117 
0118   MonitorElement* event_number;
0119   MonitorElement* event_lumi;
0120   MonitorElement* trigger_number;
0121   MonitorElement* trigger_lumi;
0122   MonitorElement* evnum_trignum_lumi;
0123   MonitorElement* orbit_lumi;
0124   MonitorElement* setupversion_lumi;
0125 
0126   MonitorElement* gtfe_bx;
0127   MonitorElement* dbx_module;
0128 
0129   MonitorElement* BST_MasterStatus;
0130   MonitorElement* BST_turnCountNumber;
0131   MonitorElement* BST_lhcFillNumber;
0132   MonitorElement* BST_beamMode;
0133   MonitorElement* BST_beamMomentum;
0134   MonitorElement* BST_intensityBeam1;
0135   MonitorElement* BST_intensityBeam2;
0136   MonitorElement* gpsfreq;
0137   MonitorElement* gpsfreqwide;
0138   MonitorElement* gpsfreqlum;
0139 
0140   MonitorElement* m_monL1PrescaleFactorSet;
0141   MonitorElement* m_monL1PfIndicesPerLs;
0142 
0143   MonitorElement* m_monOrbitNrDiffTcsFdlEvm;
0144   MonitorElement* m_monLsNrDiffTcsFdlEvm;
0145   // maximum difference in orbit number, luminosity number
0146   // histogram range: -(MaxOrbitNrDiffTcsFdlEvm+1), (MaxOrbitNrDiffTcsFdlEvm+1)
0147   //   if value is greater than the maximum difference, fill an entry in the last but one bin
0148   //   if value is smaller than the negative value of maximum difference, fill an entry
0149   //     in the second bin
0150   //   if no value can be retrieved for TCS, fill an entry in the first bin
0151   //   if no value can be retrieved for FDL, fill an entry in the last bin
0152   static const int MaxOrbitNrDiffTcsFdlEvm;
0153   static const int MaxLsNrDiffTcsFdlEvm;
0154 
0155   MonitorElement* m_monOrbitNrDiffTcsFdlEvmLs;
0156   MonitorElement* m_monLsNrDiffTcsFdlEvmLs;
0157 
0158   MonitorElement* h_L1AlgoBX1;
0159   MonitorElement* h_L1AlgoBX2;
0160   MonitorElement* h_L1AlgoBX3;
0161   MonitorElement* h_L1AlgoBX4;
0162   MonitorElement* h_L1TechBX;
0163 
0164   //MonitorElement* m_monDiffEvmDaqFdl;
0165 
0166 private:
0167   /// number of events processed
0168   int m_nrEvJob;
0169   int m_nrEvRun;
0170 
0171   /// histogram folder for L1 GT plots
0172   std::string m_histFolder;
0173 
0174   uint64_t preGps_;
0175   uint64_t preOrb_;
0176 
0177   std::string algoBitToName[128];
0178   std::string techBitToName[64];
0179   std::map<std::string, bool> l1TriggerDecision, l1TechTriggerDecision;
0180   std::map<std::string, bool>::iterator trig_iter;
0181 
0182   std::vector<std::pair<int, int> > m_pairLsNumberPfIndex;
0183   typedef std::vector<std::pair<int, int> >::const_iterator CItVecPair;
0184 };
0185 
0186 #endif