Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:58:27

0001 #ifndef DQMOFFLINE_TRIGGER_EGHLTOFFLINESUMMARYCLIENT
0002 #define DQMOFFLINE_TRIGGER_EGHLTOFFLINESUMMARYCLIENT
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    EgammaHLTOfflineSummaryClient
0007 // Class:      EgammaHLTOffline
0008 //
0009 /*
0010  Description: This module makes the summary histogram of the E/g HLT offline
0011 
0012  Notes:
0013    this takes the results of the quality tests and produces a module summarising each one. There are two summary histograms, one with each E/g trigger which is either green or red and one eta/phi bad/good region
0014 
0015 */
0016 //
0017 // Original Author:  Sam Harper
0018 //         Created:  March 2009
0019 //
0020 //
0021 //
0022 
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0025 #include "DQMServices/Core/interface/DQMStore.h"
0026 
0027 #include <vector>
0028 #include <string>
0029 
0030 class EgHLTOfflineSummaryClient
0031     : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
0032 public:
0033   typedef dqm::legacy::MonitorElement MonitorElement;
0034   typedef dqm::legacy::DQMStore DQMStore;
0035 
0036   struct SumHistBinData {
0037     std::string name;
0038     std::vector<std::string> qTestPatterns;
0039   };
0040 
0041 private:
0042   DQMStore* dbe_;  //dbe seems to be the standard name for this, I dont know why. We of course dont own it
0043   std::string dirName_;
0044   std::string egHLTSumHistName_;
0045 
0046   std::vector<std::string> eleHLTFilterNames_;  //names of the filters monitored using electrons to make plots for
0047   std::vector<std::string> phoHLTFilterNames_;  //names of the filters monitored using photons to make plots for
0048   std::vector<std::string> egHLTFiltersToMon_;  //names of the filters to include in summary histogram
0049 
0050   std::vector<std::string> eleHLTFilterNamesForSumBit_;  //names of the filters to include in the summary bit
0051   std::vector<std::string> phoHLTFilterNamesForSumBit_;  //names of the filters to include in the summary bit
0052 
0053   //the name of the bin label and the regex pattern to search for the quality tests to pass
0054   std::vector<SumHistBinData> egHLTSumHistXBins_;
0055   std::vector<SumHistBinData> eleQTestsForSumBit_;
0056   std::vector<SumHistBinData> phoQTestsForSumBit_;
0057 
0058   bool runClientEndLumiBlock_;
0059   bool runClientEndRun_;
0060   bool runClientEndJob_;
0061 
0062   std::vector<std::string> egHLTFiltersToMonPaths_;
0063   bool usePathNames_;
0064 
0065   bool filterInactiveTriggers_;
0066   bool isSetup_;
0067   std::string hltTag_;
0068 
0069   //disabling copying/assignment (in theory this is copyable but lets not just in case)
0070   EgHLTOfflineSummaryClient(const EgHLTOfflineSummaryClient& rhs) {}
0071   EgHLTOfflineSummaryClient& operator=(const EgHLTOfflineSummaryClient& rhs) { return *this; }
0072 
0073 public:
0074   explicit EgHLTOfflineSummaryClient(const edm::ParameterSet&);
0075   ~EgHLTOfflineSummaryClient() override;
0076 
0077   void beginJob() override;
0078   void analyze(const edm::Event&, const edm::EventSetup&) override;  //dummy
0079   void endJob() override;
0080   void beginRun(const edm::Run& run, const edm::EventSetup& c) override;
0081   void endRun(const edm::Run& run, const edm::EventSetup& c) override;
0082 
0083   void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override {}
0084   // DQM Client Diagnostic
0085   void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override;
0086 
0087 private:
0088   void runClient_();  //master function which runs the client
0089 
0090   int getQTestBinData_(const edm::ParameterSet&);
0091 
0092   //takes a vector of strings of the form stringA:stringB and splits them into pairs containing stringA stringB
0093   void splitStringsToPairs_(const std::vector<std::string>& stringsToSplit,
0094                             std::vector<std::pair<std::string, std::string> >& splitStrings);
0095 
0096   MonitorElement* getEgHLTSumHist_();  //makes our histogram
0097   //gets a list of filters we are monitoring
0098   //the reason we pass in ele and photon triggers seperately and then combine rather than passsing in a combined
0099   //list is to be able to share the declearation with the rest of the E/g HLT DQM Offline modules
0100   void getEgHLTFiltersToMon_(std::vector<std::string>& filterNames) const;
0101 
0102   //gets the quality tests for the filter matching pattern, if any of them fail it returns a 0, otherwise a 1
0103   //it does not care if the tests exist and in this situation will return a 1 (default to good)
0104   int getQTestResults_(const std::string& filterName, const std::vector<std::string>& pattern) const;
0105 
0106   static void fillQTestData_(const edm::ParameterSet& iConfig,
0107                              std::vector<SumHistBinData>& qTests,
0108                              const std::string& label);
0109 };
0110 
0111 #endif