File indexing completed on 2024-04-06 12:30:31
0001 #ifndef Watcher_SimWatcherMaker_h
0002 #define Watcher_SimWatcherMaker_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <memory>
0024
0025
0026 #include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h"
0027 #include "SimG4Core/Watcher/interface/SimWatcherMakerBase.h"
0028
0029
0030
0031 template <class T>
0032 class SimWatcherMaker : public SimWatcherMakerBase {
0033 public:
0034 SimWatcherMaker() {}
0035
0036
0037 void make(const edm::ParameterSet &p,
0038 SimActivityRegistry ®,
0039 std::shared_ptr<SimWatcher> &oWatcher,
0040 std::shared_ptr<SimProducer> &oProd) const override {
0041 auto returnValue = std::make_shared<T>(p);
0042 SimActivityRegistryEnroller::enroll(reg, returnValue.get());
0043 oWatcher = returnValue;
0044
0045
0046 oProd = this->getSimProducer(returnValue.get(), returnValue);
0047 }
0048
0049 private:
0050 std::shared_ptr<SimProducer> getSimProducer(SimProducer *, std::shared_ptr<T> &iProd) const {
0051 return std::shared_ptr<SimProducer>(iProd);
0052 }
0053 std::shared_ptr<SimProducer> getSimProducer(void *, std::shared_ptr<T> &iProd) const {
0054 return std::shared_ptr<SimProducer>();
0055 }
0056 };
0057
0058 #endif