Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1TStage2CaloLayer2Offline_H
0002 #define L1TStage2CaloLayer2Offline_H
0003 
0004 //Framework
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Utilities/interface/InputTag.h"
0007 #include "FWCore/ServiceRegistry/interface/Service.h"
0008 
0009 //event
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0013 
0014 //DQM
0015 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0016 #include "DQMServices/Core/interface/DQMStore.h"
0017 
0018 //Candidate handling
0019 #include "DataFormats/Candidate/interface/Candidate.h"
0020 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0021 
0022 // Electron
0023 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0024 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0025 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0026 
0027 // PFMET
0028 #include "DataFormats/METReco/interface/PFMET.h"
0029 #include "DataFormats/METReco/interface/PFMETCollection.h"
0030 
0031 // Vertex utilities
0032 #include "DataFormats/VertexReco/interface/Vertex.h"
0033 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0034 
0035 // PFJets
0036 #include "DataFormats/JetReco/interface/PFJet.h"
0037 
0038 // Calo MET
0039 #include "DataFormats/METReco/interface/CaloMET.h"
0040 #include "DataFormats/METReco/interface/CaloMETCollection.h"
0041 
0042 // Conversions
0043 #include "CommonTools/Egamma/interface/ConversionTools.h"
0044 
0045 // Trigger
0046 #include "DataFormats/Common/interface/TriggerResults.h"
0047 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0048 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0049 #include "FWCore/Common/interface/TriggerNames.h"
0050 
0051 // stage2 collections:
0052 #include "DataFormats/L1Trigger/interface/Jet.h"
0053 #include "DataFormats/L1Trigger/interface/EtSum.h"
0054 
0055 #include "DQMOffline/L1Trigger/interface/HistDefinition.h"
0056 
0057 class L1TStage2CaloLayer2Offline : public DQMEDAnalyzer {
0058 public:
0059   L1TStage2CaloLayer2Offline(const edm::ParameterSet& ps);
0060   ~L1TStage2CaloLayer2Offline() override;
0061 
0062   enum ControlPlots {
0063     L1MET,
0064     L1ETMHF,
0065     L1MHT,
0066     L1ETT,
0067     L1HTT,
0068     OfflineMET,
0069     OfflineETMHF,
0070     OfflinePFMetNoMu,
0071     OfflineMHT,
0072     OfflineETT,
0073     OfflineHTT,
0074     L1JetET,
0075     OfflineJetET,
0076     NumberOfControlPlots
0077   };
0078 
0079   typedef std::map<L1TStage2CaloLayer2Offline::ControlPlots, MonitorElement*> ControlPlotMap;
0080 
0081   enum PlotConfig { nVertex, ETvsET, PHIvsPHI };
0082 
0083   static const std::map<std::string, unsigned int> PlotConfigNames;
0084 
0085 protected:
0086   void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;
0087   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0088   void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
0089 
0090 private:
0091   //histos booking function
0092   void bookHistos(DQMStore::IBooker&);
0093   void bookEnergySumHistos(DQMStore::IBooker&);
0094   void bookJetHistos(DQMStore::IBooker&);
0095 
0096   void fillEnergySums(edm::Event const& e, const unsigned int nVertex);
0097   void fillJets(edm::Event const& e, const unsigned int nVertex);
0098   void fillJetEfficiencies(const double& recoEt, const double& l1Et, const double& recoEta);
0099 
0100   bool doesNotOverlapWithHLTObjects(const l1t::Jet& jet) const;
0101 
0102   void normalise2DHistogramsToBinArea();
0103 
0104   //private variables
0105   math::XYZPoint PVPoint_;
0106 
0107   //variables from config file
0108   edm::EDGetTokenT<reco::PFJetCollection> thePFJetCollection_;
0109   edm::EDGetTokenT<reco::CaloMETCollection> thecaloMETCollection_;
0110   edm::EDGetTokenT<reco::CaloMETCollection> thecaloETMHFCollection_;
0111   edm::EDGetTokenT<reco::PFMETCollection> thePFMETNoMuCollection_;
0112   edm::EDGetTokenT<reco::VertexCollection> thePVCollection_;
0113   edm::EDGetTokenT<reco::BeamSpot> theBSCollection_;
0114   edm::EDGetTokenT<trigger::TriggerEvent> triggerInputTag_;
0115   edm::EDGetTokenT<edm::TriggerResults> triggerResultsInputTag_;
0116   std::string triggerProcess_;
0117   std::vector<std::string> triggerNames_;
0118   std::string histFolderEtSum_;
0119   std::string histFolderJet_;
0120   std::string efficiencyFolderEtSum_;
0121   std::string efficiencyFolderJet_;
0122 
0123   edm::EDGetTokenT<l1t::JetBxCollection> stage2CaloLayer2JetToken_;
0124   edm::EDGetTokenT<l1t::EtSumBxCollection> stage2CaloLayer2EtSumToken_;
0125 
0126   std::vector<double> jetEfficiencyThresholds_;
0127   std::vector<double> metEfficiencyThresholds_;
0128   std::vector<double> mhtEfficiencyThresholds_;
0129   std::vector<double> ettEfficiencyThresholds_;
0130   std::vector<double> httEfficiencyThresholds_;
0131 
0132   std::vector<double> jetEfficiencyBins_;
0133   std::vector<double> metEfficiencyBins_;
0134   std::vector<double> mhtEfficiencyBins_;
0135   std::vector<double> ettEfficiencyBins_;
0136   std::vector<double> httEfficiencyBins_;
0137 
0138   double recoHTTMaxEta_;
0139   double recoMHTMaxEta_;
0140 
0141   HLTConfigProvider hltConfig_;
0142   std::vector<unsigned int> triggerIndices_;
0143   edm::TriggerResults triggerResults_;
0144   trigger::TriggerEvent triggerEvent_;
0145   dqmoffline::l1t::HistDefinitions histDefinitions_;
0146 
0147   // TODO: add turn-on cuts (vectors of doubles)
0148   // Histograms
0149   MonitorElement* h_nVertex_;
0150 
0151   // control plots
0152   ControlPlotMap h_controlPlots_;
0153 
0154   // energy sums reco vs L1
0155   MonitorElement* h_L1METvsCaloMET_;
0156   MonitorElement* h_L1ETMHFvsCaloETMHF_;
0157   MonitorElement* h_L1METvsPFMetNoMu_;
0158   MonitorElement* h_L1MHTvsRecoMHT_;
0159   MonitorElement* h_L1METTvsCaloETT_;
0160   MonitorElement* h_L1HTTvsRecoHTT_;
0161 
0162   MonitorElement* h_L1METPhivsCaloMETPhi_;
0163   MonitorElement* h_L1ETMHFPhivsCaloETMHFPhi_;
0164   MonitorElement* h_L1METPhivsPFMetNoMuPhi_;
0165   MonitorElement* h_L1MHTPhivsRecoMHTPhi_;
0166 
0167   // energy sum resolutions
0168   MonitorElement* h_resolutionMET_;
0169   MonitorElement* h_resolutionETMHF_;
0170   MonitorElement* h_resolutionPFMetNoMu_;
0171   MonitorElement* h_resolutionMHT_;
0172   MonitorElement* h_resolutionETT_;
0173   MonitorElement* h_resolutionHTT_;
0174   MonitorElement* h_resolutionMETPhi_;
0175   MonitorElement* h_resolutionETMHFPhi_;
0176   MonitorElement* h_resolutionPFMetNoMuPhi_;
0177   MonitorElement* h_resolutionMHTPhi_;
0178 
0179   // energy sum turn ons
0180   std::map<double, MonitorElement*> h_efficiencyMET_pass_;
0181   std::map<double, MonitorElement*> h_efficiencyETMHF_pass_;
0182   std::map<double, MonitorElement*> h_efficiencyPFMetNoMu_pass_;
0183   std::map<double, MonitorElement*> h_efficiencyMHT_pass_;
0184   std::map<double, MonitorElement*> h_efficiencyETT_pass_;
0185   std::map<double, MonitorElement*> h_efficiencyHTT_pass_;
0186 
0187   std::map<double, MonitorElement*> h_efficiencyMET_total_;
0188   std::map<double, MonitorElement*> h_efficiencyETMHF_total_;
0189   std::map<double, MonitorElement*> h_efficiencyPFMetNoMu_total_;
0190   std::map<double, MonitorElement*> h_efficiencyMHT_total_;
0191   std::map<double, MonitorElement*> h_efficiencyETT_total_;
0192   std::map<double, MonitorElement*> h_efficiencyHTT_total_;
0193 
0194   // jet reco vs L1
0195   MonitorElement* h_L1JetETvsPFJetET_HB_;
0196   MonitorElement* h_L1JetETvsPFJetET_HE_;
0197   MonitorElement* h_L1JetETvsPFJetET_HF_;
0198   MonitorElement* h_L1JetETvsPFJetET_HB_HE_;
0199 
0200   MonitorElement* h_L1JetPhivsPFJetPhi_HB_;
0201   MonitorElement* h_L1JetPhivsPFJetPhi_HE_;
0202   MonitorElement* h_L1JetPhivsPFJetPhi_HF_;
0203   MonitorElement* h_L1JetPhivsPFJetPhi_HB_HE_;
0204 
0205   MonitorElement* h_L1JetEtavsPFJetEta_;
0206 
0207   // jet resolutions
0208   MonitorElement* h_resolutionJetET_HB_;
0209   MonitorElement* h_resolutionJetET_HE_;
0210   MonitorElement* h_resolutionJetET_HF_;
0211   MonitorElement* h_resolutionJetET_HB_HE_;
0212 
0213   MonitorElement* h_resolutionJetPhi_HB_;
0214   MonitorElement* h_resolutionJetPhi_HE_;
0215   MonitorElement* h_resolutionJetPhi_HF_;
0216   MonitorElement* h_resolutionJetPhi_HB_HE_;
0217 
0218   MonitorElement* h_resolutionJetEta_;
0219 
0220   // jet turn-ons
0221   std::map<double, MonitorElement*> h_efficiencyJetEt_HB_pass_;
0222   std::map<double, MonitorElement*> h_efficiencyJetEt_HE_pass_;
0223   std::map<double, MonitorElement*> h_efficiencyJetEt_HF_pass_;
0224   std::map<double, MonitorElement*> h_efficiencyJetEt_HB_HE_pass_;
0225 
0226   // we could drop the map here, but L1TEfficiency_Harvesting expects
0227   // identical names except for the suffix
0228   std::map<double, MonitorElement*> h_efficiencyJetEt_HB_total_;
0229   std::map<double, MonitorElement*> h_efficiencyJetEt_HE_total_;
0230   std::map<double, MonitorElement*> h_efficiencyJetEt_HF_total_;
0231   std::map<double, MonitorElement*> h_efficiencyJetEt_HB_HE_total_;
0232 };
0233 
0234 #endif