CMS 3D CMS Logo

MuonSensitiveDetectorBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SimG4CMS/Muon
4 // Class : MuonSensitiveDetectorBuilder
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Christopher Jones
10 // Created: Fri, 04 Jun 2021 18:18:17 GMT
11 //
12 
13 // system include files
14 
15 // user include files
19 
22 
24 
31 
33 public:
35  : offmap_{nullptr},
36  mdc_{nullptr},
37  offsetToken_{cc.esConsumes<edm::Transition::BeginRun>()},
39 
40  void beginRun(const edm::EventSetup& es) final {
41  edm::ESHandle<MuonOffsetMap> mom = es.getHandle(offsetToken_);
42  offmap_ = (mom.isValid()) ? mom.product() : nullptr;
43  edm::LogVerbatim("MuonSim") << "Finds the offset map at " << offmap_;
44  mdc_ = &es.getData(geomConstantsToken_);
45  }
46 
47  std::unique_ptr<SensitiveDetector> make(const std::string& iname,
48  const SensitiveDetectorCatalog& clg,
49  const edm::ParameterSet& p,
50  const SimTrackManager* man,
51  SimActivityRegistry& reg) const final {
52  auto sd = std::make_unique<MuonSensitiveDetector>(iname, offmap_, *mdc_, clg, p, man);
54  return sd;
55  }
56 
57 private:
64  bool printHits_;
65  bool dd4hep_;
66 };
67 
Log< level::Info, true > LogVerbatim
MuonSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
const MuonGeometryConstants * mdc_
const edm::ESGetToken< MuonOffsetMap, IdealGeometryRecord > offsetToken_
const edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > geomConstantsToken_
static void enroll(SimActivityRegistry &iReg, T *iObj)
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
void beginRun(const edm::EventSetup &es) final
bool isValid() const
Definition: ESHandle.h:44