From 652309ff40b8dd64a11f7a7e0d700da1854e52ff Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 19 Jul 2021 21:06:19 +0200 Subject: [PATCH 1/2] Use new SD constructions for ECAL TB and FP420 --- .../EcalTestBeam/interface/EcalTBH4BeamSD.h | 2 -- .../plugins/EcalTBH4BeamDetectorBuilder.cc | 33 +++++++++++++++++++ SimG4CMS/EcalTestBeam/plugins/SealModule.cc | 5 --- SimG4CMS/EcalTestBeam/src/EcalTBH4BeamSD.cc | 1 - SimG4CMS/FP420/interface/FP420SD.h | 1 - .../plugins/FP420SensitiveDetectorBuilder.cc | 33 +++++++++++++++++++ SimG4CMS/FP420/plugins/module.cc | 5 --- SimG4CMS/FP420/{plugins => src}/FP420SD.cc | 1 - 8 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 SimG4CMS/EcalTestBeam/plugins/EcalTBH4BeamDetectorBuilder.cc create mode 100644 SimG4CMS/FP420/plugins/FP420SensitiveDetectorBuilder.cc rename SimG4CMS/FP420/{plugins => src}/FP420SD.cc (99%) diff --git a/SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h b/SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h index 817efa60ba779..4282452232074 100644 --- a/SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h +++ b/SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h @@ -14,7 +14,6 @@ #include "FWCore/ParameterSet/interface/ParameterSetfwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -//#include "G4String.hh" #include class EcalBaseNumber; @@ -22,7 +21,6 @@ class EcalBaseNumber; class EcalTBH4BeamSD : public CaloSD { public: EcalTBH4BeamSD(const std::string &, - const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *); diff --git a/SimG4CMS/EcalTestBeam/plugins/EcalTBH4BeamDetectorBuilder.cc b/SimG4CMS/EcalTestBeam/plugins/EcalTBH4BeamDetectorBuilder.cc new file mode 100644 index 0000000000000..31f76d6d599ca --- /dev/null +++ b/SimG4CMS/EcalTestBeam/plugins/EcalTBH4BeamDetectorBuilder.cc @@ -0,0 +1,33 @@ +// system include files +#include + +// user include files +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h" +#include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h" +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" + +#include "SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class EcalTBH4BeamDetectorBuilder : public SensitiveDetectorMakerBase { +public: + explicit EcalTBH4BeamDetectorBuilder(const edm::ParameterSet& 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 EcalTBH4BeamSD EcalTBH4BeamDetector; +DEFINE_SENSITIVEDETECTORBUILDER(EcalTBH4BeamDetectorBuilder, EcalTBH4BeamDetector); diff --git a/SimG4CMS/EcalTestBeam/plugins/SealModule.cc b/SimG4CMS/EcalTestBeam/plugins/SealModule.cc index 3fa8d846abd61..12a5c370f26b6 100644 --- a/SimG4CMS/EcalTestBeam/plugins/SealModule.cc +++ b/SimG4CMS/EcalTestBeam/plugins/SealModule.cc @@ -1,8 +1,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/PluginManager/interface/ModuleDef.h" -#include "SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h" #include "SimG4CMS/EcalTestBeam/interface/EcalTBH4Trigger.h" -#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" #include "SimG4Core/Watcher/interface/SimWatcherFactory.h" #include "SimG4CMS/EcalTestBeam/interface/EcalTBMCInfoProducer.h" @@ -17,7 +15,4 @@ DEFINE_FWK_MODULE(TBHodoActiveVolumeRawInfoProducer); #include "SimG4CMS/EcalTestBeam/interface/FakeTBEventHeaderProducer.h" DEFINE_FWK_MODULE(FakeTBEventHeaderProducer); -typedef EcalTBH4BeamSD EcalTBH4BeamDetector; -DEFINE_SENSITIVEDETECTOR(EcalTBH4BeamDetector); - DEFINE_SIMWATCHER(EcalTBH4Trigger); diff --git a/SimG4CMS/EcalTestBeam/src/EcalTBH4BeamSD.cc b/SimG4CMS/EcalTestBeam/src/EcalTBH4BeamSD.cc index 4989286206d8b..118cc88d87913 100644 --- a/SimG4CMS/EcalTestBeam/src/EcalTBH4BeamSD.cc +++ b/SimG4CMS/EcalTestBeam/src/EcalTBH4BeamSD.cc @@ -20,7 +20,6 @@ #include "G4SystemOfUnits.hh" EcalTBH4BeamSD::EcalTBH4BeamSD(const std::string &name, - const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *manager) diff --git a/SimG4CMS/FP420/interface/FP420SD.h b/SimG4CMS/FP420/interface/FP420SD.h index da09591a5abde..7ea193e1a5e27 100644 --- a/SimG4CMS/FP420/interface/FP420SD.h +++ b/SimG4CMS/FP420/interface/FP420SD.h @@ -47,7 +47,6 @@ class FP420SD : public SensitiveTkDetector, public Observer { public: FP420SD(const std::string&, - const edm::EventSetup&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*); diff --git a/SimG4CMS/FP420/plugins/FP420SensitiveDetectorBuilder.cc b/SimG4CMS/FP420/plugins/FP420SensitiveDetectorBuilder.cc new file mode 100644 index 0000000000000..c266dc2dc6c37 --- /dev/null +++ b/SimG4CMS/FP420/plugins/FP420SensitiveDetectorBuilder.cc @@ -0,0 +1,33 @@ +// system include files +#include + +// user include files +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h" +#include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h" +#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" + +#include "SimG4CMS/FP420/interface/FP420SD.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class FP420SensitiveDetectorBuilder : public SensitiveDetectorMakerBase { +public: + explicit FP420SensitiveDetectorBuilder(const edm::ParameterSet& 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 FP420SD FP420SensitiveDetector; +DEFINE_SENSITIVEDETECTORBUILDER(FP420SensitiveDetectorBuilder, FP420SensitiveDetector); diff --git a/SimG4CMS/FP420/plugins/module.cc b/SimG4CMS/FP420/plugins/module.cc index 1aa5ad04d6f53..fcc8aee1713b1 100644 --- a/SimG4CMS/FP420/plugins/module.cc +++ b/SimG4CMS/FP420/plugins/module.cc @@ -1,10 +1,5 @@ #include "SimG4CMS/FP420/interface/FP420Test.h" -#include "SimG4CMS/FP420/interface/FP420SD.h" -#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" #include "SimG4Core/Watcher/interface/SimWatcherFactory.h" #include "FWCore/PluginManager/interface/ModuleDef.h" -//#include "FWCore/Framework/interface/MakerMacros.h" -typedef FP420SD FP420SensitiveDetector; -DEFINE_SENSITIVEDETECTOR(FP420SensitiveDetector); DEFINE_SIMWATCHER(FP420Test); //= diff --git a/SimG4CMS/FP420/plugins/FP420SD.cc b/SimG4CMS/FP420/src/FP420SD.cc similarity index 99% rename from SimG4CMS/FP420/plugins/FP420SD.cc rename to SimG4CMS/FP420/src/FP420SD.cc index 31080ab4dcc3c..8d98096888d85 100644 --- a/SimG4CMS/FP420/plugins/FP420SD.cc +++ b/SimG4CMS/FP420/src/FP420SD.cc @@ -44,7 +44,6 @@ //#define debug //------------------------------------------------------------------- FP420SD::FP420SD(const std::string& name, - const edm::EventSetup& es, const SensitiveDetectorCatalog& clg, edm::ParameterSet const& p, const SimTrackManager* manager) From 3126315f169eabbbc8e0231600f5904accf22b54 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 19 Jul 2021 21:34:07 +0200 Subject: [PATCH 2/2] Code check --- SimG4CMS/FP420/interface/FP420SD.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/SimG4CMS/FP420/interface/FP420SD.h b/SimG4CMS/FP420/interface/FP420SD.h index 7ea193e1a5e27..f6ffc9c71de96 100644 --- a/SimG4CMS/FP420/interface/FP420SD.h +++ b/SimG4CMS/FP420/interface/FP420SD.h @@ -46,10 +46,7 @@ class FP420SD : public SensitiveTkDetector, public Observer, public Observer { public: - FP420SD(const std::string&, - const SensitiveDetectorCatalog&, - edm::ParameterSet const&, - const SimTrackManager*); + FP420SD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*); ~FP420SD() override;