Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-11 04:32:27

0001 #ifndef DTLocalTriggerBaseTest_H
0002 #define DTLocalTriggerBaseTest_H
0003 
0004 /** \class DTLocalTriggerBaseTest
0005  * *
0006  *  DQM Base for TriggerTests
0007  *
0008  *  \author  C. Battilana S. Marcellini - INFN Bologna
0009  *
0010  *  threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my
0011  *
0012  *   
0013  */
0014 
0015 #include "FWCore/Framework/interface/Frameworkfwd.h"
0016 #include "DataFormats/Common/interface/Handle.h"
0017 #include "FWCore/Framework/interface/ESHandle.h"
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/Framework/interface/MakerMacros.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Framework/interface/LuminosityBlock.h"
0022 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0023 
0024 #include "DQMServices/Core/interface/DQMStore.h"
0025 #include "FWCore/ServiceRegistry/interface/Service.h"
0026 
0027 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0028 
0029 #include <string>
0030 #include <map>
0031 
0032 class DTChamberId;
0033 class DTGeometry;
0034 class TH1F;
0035 class TH2F;
0036 class TH1D;
0037 
0038 class DTLocalTriggerBaseTest : public DQMEDHarvester {
0039 public:
0040   /// Constructor
0041   DTLocalTriggerBaseTest() : muonGeomToken_(esConsumes<edm::Transition::BeginRun>()) {}
0042 
0043   /// Destructor
0044   ~DTLocalTriggerBaseTest() override;
0045 
0046 protected:
0047   /// BeginRun
0048   void beginRun(edm::Run const& run, edm::EventSetup const& context) override;
0049 
0050   /// Perform client diagnostic in online
0051   void dqmEndLuminosityBlock(DQMStore::IBooker&,
0052                              DQMStore::IGetter&,
0053                              edm::LuminosityBlock const&,
0054                              edm::EventSetup const&) override;
0055 
0056   /// Perform client diagnostic in offline
0057   void endRun(edm::Run const& run, edm::EventSetup const& context) override;
0058 
0059   void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;
0060 
0061   /// Perform client analysis
0062   virtual void runClientDiagnostic(DQMStore::IBooker&, DQMStore::IGetter&) = 0;
0063 
0064   /// Book the new MEs (for each sector)
0065   void bookSectorHistos(DQMStore::IBooker&, int wheel, int sector, std::string hTag, std::string folder = "");
0066 
0067   /// Book the new MEs (for each wheel)
0068   void bookWheelHistos(DQMStore::IBooker&, int wheel, std::string hTag, std::string folder = "");
0069 
0070   /// Book the new MEs (CMS summary)
0071   void bookCmsHistos(DQMStore::IBooker&, std::string hTag, std::string folder = "", bool isGlb = false);
0072 
0073   /// Calculate phi range for histograms
0074   std::pair<float, float> phiRange(const DTChamberId& id);
0075 
0076   /// Convert ME to Histogram fo type T
0077   template <class T>
0078   T* getHisto(MonitorElement* me);
0079 
0080   /// Set configuration variables
0081   void setConfig(const edm::ParameterSet& ps, std::string name);
0082 
0083   /// Create fullname from histo partial name
0084   std::string fullName(std::string htype);
0085 
0086   /// Get the ME name (by chamber)
0087   std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId& chambid);
0088 
0089   /// Get the ME name (by wheel)
0090   std::string getMEName(std::string histoTag, std::string subfolder, int wh);
0091 
0092   /// Get top folder name
0093   inline std::string& topFolder() { return baseFolderTM; };
0094 
0095   /// Get message logger name
0096   inline std::string category() { return "DTDQM|DTMonitorClient|" + testName + "Test"; };
0097 
0098   int nevents;
0099   unsigned int nLumiSegs;
0100   int prescaleFactor;
0101   int run;
0102   std::string testName;
0103   std::vector<std::string> trigSources;
0104   std::vector<std::string> hwSources;
0105 
0106   std::string sourceFolder;
0107   edm::ParameterSet parameters;
0108   bool runOnline;
0109   std::string baseFolderTM;
0110   std::string trigSource;
0111   std::string hwSource;
0112 
0113   edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0114   const DTGeometry* muonGeom;
0115   std::map<int, std::map<std::string, MonitorElement*> > secME;
0116   std::map<int, std::map<std::string, MonitorElement*> > whME;
0117   std::map<std::string, MonitorElement*> cmsME;
0118 };
0119 
0120 template <class T>
0121 T* DTLocalTriggerBaseTest::getHisto(MonitorElement* me) {
0122   return me ? dynamic_cast<T*>(me->getRootObject()) : nullptr;
0123 }
0124 
0125 #endif