CMS 3D CMS Logo

TrackingRecHitAlgorithm.cc
Go to the documentation of this file.
2 
10 
13 
15 
17 
20 
22 
23 
24 
26  const std::string& name,
28  edm::ConsumesCollector& consumesCollector
29 ):
30  _name(name),
31  _selectionString(config.getParameter<std::string>("select")),
32  _trackerTopology(nullptr),
33  _trackerGeometry(nullptr),
34  _misalignedTrackerGeometry(nullptr),
35  _randomEngine(nullptr)
36 {
37 }
38 
40 {
41  if (!_trackerTopology)
42  {
43  throw cms::Exception("TrackingRecHitAlgorithm ") << _name <<": TrackerTopology not defined";
44  }
45  return *_trackerTopology;
46 }
47 
49 {
50  if (!_trackerGeometry)
51  {
52  throw cms::Exception("TrackingRecHitAlgorithm ") << _name <<": TrackerGeometry not defined";
53  }
54  return *_trackerGeometry;
55 }
56 
58 {
60  {
61  throw cms::Exception("TrackingRecHitAlgorithm ") << _name <<": MisalignedGeometry not defined";
62  }
64 }
65 
67 {
68  if (!_randomEngine)
69  {
70  throw cms::Exception("TrackingRecHitAlgorithm ") << _name <<": RandomEngineAndDistribution not defined";
71  }
72  return *_randomEngine;
73 }
74 
76 {
77  _randomEngine = std::make_shared<RandomEngineAndDistribution>(id);
78 }
79 
81 {
82  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
83  edm::ESHandle<TrackerGeometry> trackerGeometryHandle;
84  edm::ESHandle<TrackerGeometry> misalignedGeometryHandle;
85 
86  eventSetup.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
87  eventSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometryHandle);
88  eventSetup.get<TrackerDigiGeometryRecord>().get("MisAligned",misalignedGeometryHandle);
89 
90  _trackerTopology = trackerTopologyHandle.product();
91  _trackerGeometry = trackerGeometryHandle.product();
92  _misalignedTrackerGeometry = misalignedGeometryHandle.product();
93 }
94 
96 {
97  return product;
98 }
99 
101 {
102  //set these to 0 -> ensures that beginEvent needs to be executed before accessing these pointers again
103  _trackerGeometry=nullptr;
104  _trackerTopology=nullptr;
106 }
107 
109 {
110  _randomEngine.reset();
111 }
112 
114 {
115 }
const TrackerGeometry & getTrackerGeometry() const
Definition: config.py:1
const TrackerGeometry * _trackerGeometry
#define nullptr
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
const TrackerTopology * _trackerTopology
virtual TrackingRecHitProductPtr process(TrackingRecHitProductPtr product) const
const T & get() const
Definition: EventSetup.h:56
std::shared_ptr< RandomEngineAndDistribution > _randomEngine
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