Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-28 22:23:47

0001 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0002 #include "DQMServices/Core/interface/DQMStore.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ServiceRegistry/interface/Service.h"
0009 #include "FWCore/Framework/interface/MakerMacros.h"
0010 class SiPixelPhase1TrackComparisonHarvester : public DQMEDHarvester {
0011 public:
0012   explicit SiPixelPhase1TrackComparisonHarvester(const edm::ParameterSet&);
0013   ~SiPixelPhase1TrackComparisonHarvester() override = default;
0014   void dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) override;
0015 
0016   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0017 
0018 private:
0019   // ----------member data ---------------------------
0020   const std::string topFolder_;
0021 };
0022 
0023 SiPixelPhase1TrackComparisonHarvester::SiPixelPhase1TrackComparisonHarvester(const edm::ParameterSet& iConfig)
0024     : topFolder_(iConfig.getParameter<std::string>("topFolderName")) {}
0025 
0026 void SiPixelPhase1TrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0027   MonitorElement* hpt_eta_tkAllCPU = igetter.get(topFolder_ + "/ptetatrkAllCPU");
0028   MonitorElement* hpt_eta_tkAllCPUmatched = igetter.get(topFolder_ + "/ptetatrkAllCPUmatched");
0029   MonitorElement* hphi_z_tkAllCPU = igetter.get(topFolder_ + "/phiztrkAllCPU");
0030   MonitorElement* hphi_z_tkAllCPUmatched = igetter.get(topFolder_ + "/phiztrkAllCPUmatched");
0031 
0032   if (hpt_eta_tkAllCPU == nullptr or hpt_eta_tkAllCPUmatched == nullptr or hphi_z_tkAllCPU == nullptr or
0033       hphi_z_tkAllCPUmatched == nullptr) {
0034     edm::LogError("SiPixelPhase1TrackComparisonHarvester")
0035         << "MEs needed for this module are not found in the input file. Skipping.";
0036     return;
0037   }
0038 
0039   ibooker.cd();
0040   ibooker.setCurrentFolder(topFolder_);
0041   MonitorElement* hpt_eta_matchRatio = ibooker.book2D(
0042       "matchingeff_pt_eta", "Efficiency of track matching; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.);
0043   MonitorElement* hphi_z_matchRatio = ibooker.book2D(
0044       "matchingeff_phi_z", "Efficiency of track matching; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.);
0045 
0046   hpt_eta_matchRatio->divide(hpt_eta_tkAllCPUmatched, hpt_eta_tkAllCPU, 1., 1., "B");
0047   hphi_z_matchRatio->divide(hphi_z_tkAllCPUmatched, hphi_z_tkAllCPU, 1., 1., "B");
0048 }
0049 
0050 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0051 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0052 void SiPixelPhase1TrackComparisonHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0053   edm::ParameterSetDescription desc;
0054   desc.add<std::string>("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU/");
0055   descriptions.add("siPixelPhase1TrackComparisonHarvester", desc);
0056 }
0057 
0058 //define this as a plug-in
0059 DEFINE_FWK_MODULE(SiPixelPhase1TrackComparisonHarvester);