File indexing completed on 2024-04-06 12:31:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <memory>
0021
0022
0023 #include "FWCore/Framework/interface/ModuleFactory.h"
0024 #include "FWCore/Framework/interface/ESProducer.h"
0025
0026 #include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h"
0027 #include "DetIdAssociatorFactory.h"
0028 #include "DetIdAssociatorMaker.h"
0029
0030 #include "TrackingTools/Records/interface/DetIdAssociatorRecord.h"
0031
0032
0033
0034
0035
0036 class DetIdAssociatorESProducer : public edm::ESProducer {
0037 public:
0038 DetIdAssociatorESProducer(const edm::ParameterSet&);
0039 ~DetIdAssociatorESProducer() override;
0040
0041 typedef std::unique_ptr<DetIdAssociator> ReturnType;
0042
0043 ReturnType produce(const DetIdAssociatorRecord&);
0044
0045 private:
0046 const std::string cName;
0047 std::unique_ptr<const DetIdAssociatorMaker> maker_;
0048 };
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 DetIdAssociatorESProducer::DetIdAssociatorESProducer(const edm::ParameterSet& iConfig)
0062 : cName{iConfig.getParameter<std::string>("ComponentName")},
0063 maker_{DetIdAssociatorFactory::get()->create(cName, iConfig, setWhatProduced(this, cName))} {}
0064
0065 DetIdAssociatorESProducer::~DetIdAssociatorESProducer() {}
0066
0067
0068
0069
0070
0071
0072 DetIdAssociatorESProducer::ReturnType DetIdAssociatorESProducer::produce(const DetIdAssociatorRecord& iRecord) {
0073 using namespace edm::es;
0074 LogTrace("TrackAssociator") << "Making DetIdAssociatorRecord with label: " << cName;
0075 ReturnType dia = maker_->make(iRecord);
0076 dia->buildMap();
0077 LogTrace("TrackAssociator") << "Map id built for DetIdAssociatorRecord with label: " << cName;
0078 return dia;
0079 }
0080
0081
0082 DEFINE_FWK_EVENTSETUP_MODULE(DetIdAssociatorESProducer);