Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:22

0001 #include "FWCore/Framework/interface/ESProducer.h"
0002 #include "FWCore/Framework/interface/ModuleFactory.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "FastSimulation/TrackerSetup/interface/TrackerInteractionGeometry.h"
0005 #include "FastSimulation/TrackerSetup/interface/TrackerInteractionGeometryRecord.h"
0006 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0007 
0008 #include <memory>
0009 #include <string>
0010 
0011 class TrackerInteractionGeometryESProducer : public edm::ESProducer {
0012 public:
0013   TrackerInteractionGeometryESProducer(const edm::ParameterSet& p);
0014   ~TrackerInteractionGeometryESProducer() override = default;
0015   std::unique_ptr<TrackerInteractionGeometry> produce(const TrackerInteractionGeometryRecord&);
0016 
0017 private:
0018   edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> geoSearchToken_;
0019   std::string label_;
0020   edm::ParameterSet theTrackerMaterial_;
0021 };
0022 
0023 TrackerInteractionGeometryESProducer::TrackerInteractionGeometryESProducer(const edm::ParameterSet& p) {
0024   auto cc = setWhatProduced(this);
0025   label_ = p.getUntrackedParameter<std::string>("trackerGeometryLabel", "");
0026   geoSearchToken_ = cc.consumes(edm::ESInputTag("", label_));
0027   theTrackerMaterial_ = p.getParameter<edm::ParameterSet>("TrackerMaterial");
0028 }
0029 
0030 std::unique_ptr<TrackerInteractionGeometry> TrackerInteractionGeometryESProducer::produce(
0031     const TrackerInteractionGeometryRecord& iRecord) {
0032   const GeometricSearchTracker* theGeomSearchTracker = &iRecord.get(geoSearchToken_);
0033   return std::make_unique<TrackerInteractionGeometry>(theTrackerMaterial_, theGeomSearchTracker);
0034 }
0035 
0036 DEFINE_FWK_EVENTSETUP_MODULE(TrackerInteractionGeometryESProducer);