Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:34

0001 #ifndef DQMOFFLINE_L1TRIGGER_L1TRATE_OFFLINE_H
0002 #define DQMOFFLINE_L1TRIGGER_L1TRATE_OFFLINE_H
0003 
0004 // system include files
0005 #include <memory>
0006 #include <unistd.h>
0007 
0008 // user include files
0009 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/LuminosityBlock.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0019 
0020 //DataFormats
0021 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0022 #include "DataFormats/Scalers/interface/LumiScalers.h"
0023 #include "DataFormats/Scalers/interface/Level1TriggerRates.h"
0024 #include "DataFormats/Scalers/interface/Level1TriggerScalers.h"
0025 #include "DataFormats/Common/interface/ConditionsInEdm.h"  // Parameters associated to Run, LS and Event
0026 #include "DataFormats/Luminosity/interface/LumiDetails.h"  // Luminosity Information
0027 #include "DataFormats/Luminosity/interface/LumiSummary.h"  // Luminosity Information
0028 
0029 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"
0030 
0031 #include "DQM/L1TMonitor/interface/L1TMenuHelper.h"
0032 
0033 #include <TString.h>
0034 
0035 #include <iostream>
0036 #include <fstream>
0037 #include <vector>
0038 
0039 //
0040 // class declaration
0041 //
0042 
0043 class L1TRate_Offline : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0044 public:
0045   enum Errors { UNKNOWN = 1, WARNING_PY_MISSING_FIT = 2 };
0046 
0047 public:
0048   L1TRate_Offline(const edm::ParameterSet& ps);  // Constructor
0049   ~L1TRate_Offline() override;                   // Destructor
0050 
0051 protected:
0052   void analyze(const edm::Event& e, const edm::EventSetup& c) override;  // Analyze
0053   void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override;
0054 
0055   void beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
0056   void endLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
0057 
0058   // Private methods
0059   //private:
0060 
0061   //    bool getXSexFitsOMDS  (const edm::ParameterSet& ps);
0062   bool getXSexFitsPython(const edm::ParameterSet& ps);
0063 
0064   // Private variables
0065 private:
0066   // bool
0067   bool m_verbose;
0068 
0069   // int
0070   int m_refPrescaleSet;  // What is the reference prescale index to use for trigger choice
0071   int m_maxNbins;        // Maximum number of bins for MonitorElement
0072   int m_lsShiftGTRates;  // What shift (if any) to be applied to GT Rates LS number
0073 
0074   // string
0075   std::string m_outputFile;  // External output file name (for testiting)
0076 
0077   // Vectors
0078   const std::vector<std::vector<int> >* m_listsPrescaleFactors;  // Collection os all sets of prescales
0079 
0080   // Maps
0081   std::map<int, double> m_lsDeadTime;                           // Map of dead time for each LS
0082   std::map<int, int> m_lsPrescaleIndex;                         // Map of precale index for each LS
0083   std::map<int, double> m_lsLuminosity;                         // Map of luminosity recorded for each LS
0084   std::map<int, std::map<TString, double> > m_lsRates;          // Map of rates (by bit) recorded for each LS
0085   std::map<TString, int> m_algoBit;                             // Map of bit associated with a L1 Algo alias
0086   std::map<TString, TF1*> m_algoFit;                            // Map of bit associated with a L1 Algo alias
0087   std::map<std::string, bool> m_inputCategories;                // Map of categories to monitor
0088   std::map<std::string, std::string> m_selectedTriggers;        // Map of what trigger to monitor for each category
0089   std::map<TString, MonitorElement*> m_xSecObservedToExpected;  // Monitor Elements for Observed to Expected Algo XSec
0090   std::map<TString, MonitorElement*> m_xSecVsInstLumi;          // Monitor Elements for Algo XSec vs Instant Luminosity
0091 
0092   std::map<TString, MonitorElement*> m_xSecObservedVsDelivLumi;
0093   std::map<TString, MonitorElement*> m_xSecObservedVsRecorLumi;
0094 
0095   std::map<TString, MonitorElement*> m_CountsVsLS;      // Monitor Elements for counts
0096   std::map<TString, MonitorElement*> m_InstLumiVsLS;    // Monitor Elements for Instant Lumi
0097   std::map<TString, MonitorElement*> m_PrescIndexVsLS;  // Monitor Elements for Prescale Index
0098   //  std::map<TString,MonitorElement*>       m_DeadTimeVsLS;         // Monitor Elements (Check Purpose)
0099 
0100   std::map<TString, MonitorElement*> m_xSecObservedVsLS;
0101   std::map<TString, MonitorElement*> m_DelivLumiVsLS;
0102   std::map<TString, MonitorElement*> m_RecorLumiVsLS;
0103 
0104   std::map<TString, TF1*> m_templateFunctions;  // For each trigger template f(InstLumi)=XSec
0105 
0106   std::map<int, std::map<TString, double> > m_lsCounts;  // Map of counts (by bit) recorded for each LS
0107 
0108   // Input tags
0109   edm::EDGetTokenT<LumiScalersCollection> m_scalersSource_LSCollection;             // Where to get L1 Scalers
0110   edm::EDGetTokenT<Level1TriggerScalersCollection> m_scalersSource_L1TSCollection;  // Where to get L1 Scalers
0111   edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtDataDaqInputTag;             // Where to get L1 GT Data DAQ
0112 
0113   // ParameterSet
0114   edm::ParameterSet m_parameters;
0115 
0116   // MonitorElement
0117   MonitorElement* m_ErrorMonitor;
0118 
0119   const edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> m_menuToken;
0120   const edm::ESGetToken<L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd> m_l1GtPfAlgoToken;
0121   L1TMenuHelper::Tokens m_helperTokens;
0122   L1GtUtils m_l1GtUtils;
0123 };
0124 
0125 #endif