CMS 3D CMS Logo

TrackingRecHitAlgorithm.cc
Go to the documentation of this file.
2 
10 
13 
15 
17 
20 
22 
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 
80 
82  const SiPixelTemplateDBObject * pixelTemplateDBObjectPtr,
83  std::vector< SiPixelTemplateStore > & tempStoreRef )
84 {
85  // The default is to do nothing.
86 }
87 
88 
90 {
91  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
92  edm::ESHandle<TrackerGeometry> trackerGeometryHandle;
93  edm::ESHandle<TrackerGeometry> misalignedGeometryHandle;
94 
95  eventSetup.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
96  eventSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometryHandle);
97  eventSetup.get<TrackerDigiGeometryRecord>().get("MisAligned",misalignedGeometryHandle);
98 
99  _trackerTopology = trackerTopologyHandle.product();
100  _trackerGeometry = trackerGeometryHandle.product();
101  _misalignedTrackerGeometry = misalignedGeometryHandle.product();
102 
103 }
104 
106 {
107  return product;
108 }
109 
111 {
112  //set these to 0 -> ensures that beginEvent needs to be executed before accessing these pointers again
113  _trackerGeometry=nullptr;
114  _trackerTopology=nullptr;
116 }
117 
119 {
120  _randomEngine.reset();
121 }
122 
124 {
125 }
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
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:63
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:44