CMS 3D CMS Logo

TrackingRecHitAlgorithm.cc
Go to the documentation of this file.
2 
10 
13 
15 
17 
20 
22 
24 
27  edm::ConsumesCollector& consumesCollector)
28  : _name(name),
29  _selectionString(config.getParameter<std::string>("select")),
30  _trackerTopology(nullptr),
31  _trackerGeometry(nullptr),
32  _misalignedTrackerGeometry(nullptr),
33  _randomEngine(nullptr) {}
34 
36  if (!_trackerTopology) {
37  throw cms::Exception("TrackingRecHitAlgorithm ") << _name << ": TrackerTopology not defined";
38  }
39  return *_trackerTopology;
40 }
41 
43  if (!_trackerGeometry) {
44  throw cms::Exception("TrackingRecHitAlgorithm ") << _name << ": TrackerGeometry not defined";
45  }
46  return *_trackerGeometry;
47 }
48 
51  throw cms::Exception("TrackingRecHitAlgorithm ") << _name << ": MisalignedGeometry not defined";
52  }
54 }
55 
57  if (!_randomEngine) {
58  throw cms::Exception("TrackingRecHitAlgorithm ") << _name << ": RandomEngineAndDistribution not defined";
59  }
60  return *_randomEngine;
61 }
62 
64  _randomEngine = std::make_shared<RandomEngineAndDistribution>(id);
65 }
66 
68  const edm::EventSetup& eventSetup,
69  const SiPixelTemplateDBObject* pixelTemplateDBObjectPtr,
70  std::vector<SiPixelTemplateStore>& tempStoreRef) {
71  // The default is to do nothing.
72 }
73 
75  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
76  edm::ESHandle<TrackerGeometry> trackerGeometryHandle;
77  edm::ESHandle<TrackerGeometry> misalignedGeometryHandle;
78 
79  eventSetup.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
80  eventSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometryHandle);
81  eventSetup.get<TrackerDigiGeometryRecord>().get("MisAligned", misalignedGeometryHandle);
82 
83  _trackerTopology = trackerTopologyHandle.product();
84  _trackerGeometry = trackerGeometryHandle.product();
85  _misalignedTrackerGeometry = misalignedGeometryHandle.product();
86 }
87 
89 
91  //set these to 0 -> ensures that beginEvent needs to be executed before accessing these pointers again
92  _trackerGeometry = nullptr;
93  _trackerTopology = nullptr;
95 }
96 
98 
#define nullptr
const TrackerGeometry & getTrackerGeometry() const
Definition: config.py:1
const TrackerGeometry * _trackerGeometry
virtual void beginEvent(edm::Event &event, const edm::EventSetup &eventSetup)
TrackingRecHitAlgorithm(const std::string &name, const edm::ParameterSet &config, edm::ConsumesCollector &consumesCollector)
const TrackerGeometry * _misalignedTrackerGeometry
const RandomEngineAndDistribution & getRandomEngine() const
const TrackerTopology & getTrackerTopology() const
std::shared_ptr< TrackingRecHitProduct > TrackingRecHitProductPtr
virtual void beginRun(edm::Run const &run, const edm::EventSetup &eventSetup, const SiPixelTemplateDBObject *pixelTemplateDBObjectPtr, std::vector< SiPixelTemplateStore > &tempStoreRef)
const TrackerTopology * _trackerTopology
virtual TrackingRecHitProductPtr process(TrackingRecHitProductPtr product) const
std::shared_ptr< RandomEngineAndDistribution > _randomEngine
T get() const
Definition: EventSetup.h:73
const TrackerGeometry & getMisalignedGeometry() const
virtual void beginStream(const edm::StreamID &id)
T const * product() const
Definition: ESHandle.h:86
virtual void endEvent(edm::Event &event, const edm::EventSetup &eventSetup)
Definition: event.py:1
Definition: Run.h:45