From 8614ff6b3d23d32f94a94b7522e63a5f35ff2174 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 20 Jul 2021 17:35:14 +0200 Subject: [PATCH 1/2] New way of SD declaration for PPS detectors --- SimG4CMS/PPS/interface/PPSDiamondSD.h | 1 - SimG4CMS/PPS/interface/PPSPixelSD.h | 1 - SimG4CMS/PPS/interface/TotemRPSD.h | 1 - .../CTPPSDiamondSensitiveDetectorBuilder.cc | 33 +++++++++++++++++++ .../plugins/CTPPSSensitiveDetectorBuilder.cc | 33 +++++++++++++++++++ .../RomanPotSensitiveDetectorBuilder.cc | 33 +++++++++++++++++++ SimG4CMS/PPS/plugins/module.cc | 16 --------- SimG4CMS/PPS/src/PPSDiamondSD.cc | 2 -- SimG4CMS/PPS/src/PPSPixelSD.cc | 2 -- SimG4CMS/PPS/src/TotemRPSD.cc | 2 -- 10 files changed, 99 insertions(+), 25 deletions(-) create mode 100644 SimG4CMS/PPS/plugins/CTPPSDiamondSensitiveDetectorBuilder.cc create mode 100644 SimG4CMS/PPS/plugins/CTPPSSensitiveDetectorBuilder.cc create mode 100644 SimG4CMS/PPS/plugins/RomanPotSensitiveDetectorBuilder.cc diff --git a/SimG4CMS/PPS/interface/PPSDiamondSD.h b/SimG4CMS/PPS/interface/PPSDiamondSD.h index 27073180b796d..1b7e49fa88864 100644 --- a/SimG4CMS/PPS/interface/PPSDiamondSD.h +++ b/SimG4CMS/PPS/interface/PPSDiamondSD.h @@ -33,7 +33,6 @@ class PPSDiamondSD : public SensitiveTkDetector, public Observer { public: PPSDiamondSD(const std::string&, - const edm::EventSetup&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*); diff --git a/SimG4CMS/PPS/interface/PPSPixelSD.h b/SimG4CMS/PPS/interface/PPSPixelSD.h index 8af0c94d9505a..83f87527f228b 100644 --- a/SimG4CMS/PPS/interface/PPSPixelSD.h +++ b/SimG4CMS/PPS/interface/PPSPixelSD.h @@ -48,7 +48,6 @@ class PPSPixelSD : public SensitiveTkDetector, public Observer { public: PPSPixelSD(const std::string&, - const edm::EventSetup&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, SimTrackManager const*); diff --git a/SimG4CMS/PPS/interface/TotemRPSD.h b/SimG4CMS/PPS/interface/TotemRPSD.h index 2eff09d2a94d5..70742c8750444 100644 --- a/SimG4CMS/PPS/interface/TotemRPSD.h +++ b/SimG4CMS/PPS/interface/TotemRPSD.h @@ -30,7 +30,6 @@ class TotemTestHitHBNtuple; class TotemRPSD : public SensitiveTkDetector, public Observer, public Observer { public: TotemRPSD(const std::string&, - const edm::EventSetup&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*); diff --git a/SimG4CMS/PPS/plugins/CTPPSDiamondSensitiveDetectorBuilder.cc b/SimG4CMS/PPS/plugins/CTPPSDiamondSensitiveDetectorBuilder.cc new file mode 100644 index 0000000000000..1a06cb76214fe --- /dev/null +++ b/SimG4CMS/PPS/plugins/CTPPSDiamondSensitiveDetectorBuilder.cc @@ -0,0 +1,33 @@ +// system include files +#include +#include + +// user include files +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h" +#include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h" +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" + +#include "SimG4CMS/PPS/interface/PPSDiamondSD.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class CTPPSDiamondSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { +public: + explicit CTPPSDiamondSensitiveDetectorBuilder(edm::ParameterSet const& p, edm::ConsumesCollector cc) {} + std::unique_ptr make(const std::string& iname, + const SensitiveDetectorCatalog& clg, + const edm::ParameterSet& p, + const SimTrackManager* man, + SimActivityRegistry& reg) const final { + auto sd = std::make_unique(iname, clg, p, man); + SimActivityRegistryEnroller::enroll(reg, sd.get()); + return sd; + } +}; + +typedef PPSDiamondSD CTPPSDiamondSensitiveDetector; +DEFINE_SENSITIVEDETECTORBUILDER(CTPPSDiamondSensitiveDetectorBuilder, CTPPSDiamondSensitiveDetector); diff --git a/SimG4CMS/PPS/plugins/CTPPSSensitiveDetectorBuilder.cc b/SimG4CMS/PPS/plugins/CTPPSSensitiveDetectorBuilder.cc new file mode 100644 index 0000000000000..2802ec9b6f21d --- /dev/null +++ b/SimG4CMS/PPS/plugins/CTPPSSensitiveDetectorBuilder.cc @@ -0,0 +1,33 @@ +// system include files +#include +#include + +// user include files +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h" +#include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h" +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" + +#include "SimG4CMS/PPS/interface/PPSPixelSD.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class CTPPSSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { +public: + explicit CTPPSSensitiveDetectorBuilder(edm::ParameterSet const& p, edm::ConsumesCollector cc) {} + std::unique_ptr make(const std::string& iname, + const SensitiveDetectorCatalog& clg, + const edm::ParameterSet& p, + const SimTrackManager* man, + SimActivityRegistry& reg) const final { + auto sd = std::make_unique(iname, clg, p, man); + SimActivityRegistryEnroller::enroll(reg, sd.get()); + return sd; + } +}; + +typedef PPSPixelSD CTPPSSensitiveDetector; +DEFINE_SENSITIVEDETECTORBUILDER(CTPPSSensitiveDetectorBuilder, CTPPSSensitiveDetector); diff --git a/SimG4CMS/PPS/plugins/RomanPotSensitiveDetectorBuilder.cc b/SimG4CMS/PPS/plugins/RomanPotSensitiveDetectorBuilder.cc new file mode 100644 index 0000000000000..503ff6a61ccf3 --- /dev/null +++ b/SimG4CMS/PPS/plugins/RomanPotSensitiveDetectorBuilder.cc @@ -0,0 +1,33 @@ +// system include files +#include +#include + +// user include files +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h" +#include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h" +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" + +#include "SimG4CMS/PPS/interface/TotemRPSD.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class RomanPotSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { +public: + explicit RomanPotSensitiveDetectorBuilder(edm::ParameterSet const& p, edm::ConsumesCollector cc) {} + std::unique_ptr make(const std::string& iname, + const SensitiveDetectorCatalog& clg, + const edm::ParameterSet& p, + const SimTrackManager* man, + SimActivityRegistry& reg) const final { + auto sd = std::make_unique(iname, clg, p, man); + SimActivityRegistryEnroller::enroll(reg, sd.get()); + return sd; + } +}; + +typedef TotemRPSD RomanPotSensitiveDetector; +DEFINE_SENSITIVEDETECTORBUILDER(RomanPotSensitiveDetectorBuilder, RomanPotSensitiveDetector); diff --git a/SimG4CMS/PPS/plugins/module.cc b/SimG4CMS/PPS/plugins/module.cc index 1a4709109382d..e69de29bb2d1d 100644 --- a/SimG4CMS/PPS/plugins/module.cc +++ b/SimG4CMS/PPS/plugins/module.cc @@ -1,16 +0,0 @@ -#include "SimG4CMS/PPS/interface/TotemRPSD.h" -#include "SimG4CMS/PPS/interface/PPSPixelSD.h" -#include "SimG4CMS/PPS/interface/PPSDiamondSD.h" - -#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -typedef PPSPixelSD CTPPSSensitiveDetector; -DEFINE_SENSITIVEDETECTOR(CTPPSSensitiveDetector); - -typedef TotemRPSD RomanPotSensitiveDetector; -DEFINE_SENSITIVEDETECTOR(RomanPotSensitiveDetector); - -typedef PPSDiamondSD CTPPSDiamondSensitiveDetector; -DEFINE_SENSITIVEDETECTOR(CTPPSDiamondSensitiveDetector); diff --git a/SimG4CMS/PPS/src/PPSDiamondSD.cc b/SimG4CMS/PPS/src/PPSDiamondSD.cc index 026177f5ca5c7..415a885c8f656 100644 --- a/SimG4CMS/PPS/src/PPSDiamondSD.cc +++ b/SimG4CMS/PPS/src/PPSDiamondSD.cc @@ -4,7 +4,6 @@ // 2016 Nov /////////////////////////////////////////////////////////////////////////////// #include "SimG4CMS/PPS/interface/PPSDiamondSD.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimG4Core/Notification/interface/TrackInformation.h" @@ -27,7 +26,6 @@ #include PPSDiamondSD::PPSDiamondSD(const std::string& name_, - const edm::EventSetup& es, const SensitiveDetectorCatalog& clg, edm::ParameterSet const& p, const SimTrackManager* manager) diff --git a/SimG4CMS/PPS/src/PPSPixelSD.cc b/SimG4CMS/PPS/src/PPSPixelSD.cc index 77559dab05d35..e58fdf54b67da 100644 --- a/SimG4CMS/PPS/src/PPSPixelSD.cc +++ b/SimG4CMS/PPS/src/PPSPixelSD.cc @@ -13,7 +13,6 @@ // system include files // user include files -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -36,7 +35,6 @@ #include "G4SystemOfUnits.hh" PPSPixelSD::PPSPixelSD(const std::string& name_, - const edm::EventSetup& es, const SensitiveDetectorCatalog& clg, edm::ParameterSet const& p, SimTrackManager const* manager) diff --git a/SimG4CMS/PPS/src/TotemRPSD.cc b/SimG4CMS/PPS/src/TotemRPSD.cc index 7defb584e54c0..019a490b84438 100644 --- a/SimG4CMS/PPS/src/TotemRPSD.cc +++ b/SimG4CMS/PPS/src/TotemRPSD.cc @@ -5,7 +5,6 @@ #include "SimG4CMS/PPS/interface/TotemRPSD.h" #include "SimG4CMS/PPS/interface/PPSStripNumberingScheme.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -32,7 +31,6 @@ #include TotemRPSD::TotemRPSD(const std::string& name_, - const edm::EventSetup& es, const SensitiveDetectorCatalog& clg, edm::ParameterSet const& p, const SimTrackManager* manager) From 647e2a0349b8f08287b473c12a58732f057efa94 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 20 Jul 2021 17:54:52 +0200 Subject: [PATCH 2/2] Code check --- SimG4CMS/PPS/interface/PPSDiamondSD.h | 5 +---- SimG4CMS/PPS/interface/PPSPixelSD.h | 5 +---- SimG4CMS/PPS/interface/TotemRPSD.h | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/SimG4CMS/PPS/interface/PPSDiamondSD.h b/SimG4CMS/PPS/interface/PPSDiamondSD.h index 1b7e49fa88864..7bef48db01fcc 100644 --- a/SimG4CMS/PPS/interface/PPSDiamondSD.h +++ b/SimG4CMS/PPS/interface/PPSDiamondSD.h @@ -32,10 +32,7 @@ class PPSDiamondSD : public SensitiveTkDetector, public Observer, public Observer { public: - PPSDiamondSD(const std::string&, - const SensitiveDetectorCatalog&, - edm::ParameterSet const&, - const SimTrackManager*); + PPSDiamondSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*); ~PPSDiamondSD() override; void printHitInfo(); diff --git a/SimG4CMS/PPS/interface/PPSPixelSD.h b/SimG4CMS/PPS/interface/PPSPixelSD.h index 83f87527f228b..41a08a2adcea5 100644 --- a/SimG4CMS/PPS/interface/PPSPixelSD.h +++ b/SimG4CMS/PPS/interface/PPSPixelSD.h @@ -47,10 +47,7 @@ class PPSPixelSD : public SensitiveTkDetector, public Observer, public Observer { public: - PPSPixelSD(const std::string&, - const SensitiveDetectorCatalog&, - edm::ParameterSet const&, - SimTrackManager const*); + PPSPixelSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, SimTrackManager const*); ~PPSPixelSD() override; bool ProcessHits(G4Step*, G4TouchableHistory*) override; diff --git a/SimG4CMS/PPS/interface/TotemRPSD.h b/SimG4CMS/PPS/interface/TotemRPSD.h index 70742c8750444..431b139e9efd3 100644 --- a/SimG4CMS/PPS/interface/TotemRPSD.h +++ b/SimG4CMS/PPS/interface/TotemRPSD.h @@ -29,10 +29,7 @@ class TotemTestHitHBNtuple; class TotemRPSD : public SensitiveTkDetector, public Observer, public Observer { public: - TotemRPSD(const std::string&, - const SensitiveDetectorCatalog&, - edm::ParameterSet const&, - const SimTrackManager*); + TotemRPSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*); ~TotemRPSD() override; void printHitInfo();