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},
39  edm::ParameterSet muonSD = p.getParameter<edm::ParameterSet>("MuonSD");
40  ePersistentCutGeV_ = muonSD.getParameter<double>("EnergyThresholdForPersistency") / CLHEP::GeV; //Default 1. GeV
41  allMuonsPersistent_ = muonSD.getParameter<bool>("AllMuonsPersistent");
42  printHits_ = muonSD.getParameter<bool>("PrintHits");
43  dd4hep_ = p.getParameter<bool>("g4GeometryDD4hepSource");
44  }
45 
46  void beginRun(const edm::EventSetup& es) final {
47  edm::ESHandle<MuonOffsetMap> mom = es.getHandle(offsetToken_);
48  offmap_ = (mom.isValid()) ? mom.product() : nullptr;
49  edm::LogVerbatim("MuonSim") << "Finds the offset map at " << offmap_;
50  mdc_ = &es.getData(geomConstantsToken_);
51  }
52 
53  std::unique_ptr<SensitiveDetector> make(const std::string& iname,
54  const SensitiveDetectorCatalog& clg,
55  const edm::ParameterSet& p,
56  const SimTrackManager* man,
57  SimActivityRegistry& reg) const final {
58  auto sd = std::make_unique<MuonSensitiveDetector>(
61  return sd;
62  }
63 
64 private:
71  bool printHits_;
72  bool dd4hep_;
73 };
74 
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
SimTrackManager
Definition: SimTrackManager.h:35
MuonSensitiveDetectorBuilder::beginRun
void beginRun(const edm::EventSetup &es) final
Definition: MuonSensitiveDetectorBuilder.cc:46
MuonSensitiveDetectorBuilder::printHits_
bool printHits_
Definition: MuonSensitiveDetectorBuilder.cc:71
ESHandle.h
MuonSensitiveDetectorBuilder::ePersistentCutGeV_
double ePersistentCutGeV_
Definition: MuonSensitiveDetectorBuilder.cc:69
MuonGeometryConstants.h
MuonSensitiveDetectorBuilder::allMuonsPersistent_
bool allMuonsPersistent_
Definition: MuonSensitiveDetectorBuilder.cc:70
ESGetToken.h
MuonOffsetMap
Definition: MuonOffsetMap.h:9
MuonSensitiveDetector
Definition: MuonSensitiveDetector.h:38
MuonSensitiveDetectorBuilder
Definition: MuonSensitiveDetectorBuilder.cc:32
MuonSensitiveDetectorBuilder::offmap_
const MuonOffsetMap * offmap_
Definition: MuonSensitiveDetectorBuilder.cc:65
edm::ESHandle
Definition: DTSurvey.h:22
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GeV
const double GeV
Definition: MathUtil.h:16
MuonSensitiveDetectorBuilder::offsetToken_
const edm::ESGetToken< MuonOffsetMap, IdealGeometryRecord > offsetToken_
Definition: MuonSensitiveDetectorBuilder.cc:67
MuonSensitiveDetectorBuilder::mdc_
const MuonGeometryConstants * mdc_
Definition: MuonSensitiveDetectorBuilder.cc:66
SensitiveDetectorMakerBase
Definition: SensitiveDetectorMakerBase.h:28
ModuleDef.h
SimActivityRegistryEnroller::enroll
static void enroll(SimActivityRegistry &iReg, T *iObj)
Definition: SimActivityRegistryEnroller.h:50
MuonSensitiveDetectorBuilder::MuonSensitiveDetectorBuilder
MuonSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
Definition: MuonSensitiveDetectorBuilder.cc:34
MuonSensitiveDetectorBuilder::dd4hep_
bool dd4hep_
Definition: MuonSensitiveDetectorBuilder.cc:72
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:58
MuonSensitiveDetector.h
cc
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
edm::ESGetToken< MuonOffsetMap, IdealGeometryRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimActivityRegistryEnroller.h
SimActivityRegistry
Definition: SimActivityRegistry.h:39
DEFINE_SENSITIVEDETECTORBUILDER
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
Definition: SensitiveDetectorPluginFactory.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::Transition::BeginRun
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
sd
double sd
Definition: CascadeWrapper.h:113
ConsumesCollector.h
SensitiveDetectorPluginFactory.h
ParameterSet.h
MuonSensitiveDetectorBuilder::make
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
Definition: MuonSensitiveDetectorBuilder.cc:53
MuonSensitiveDetectorBuilder::geomConstantsToken_
const edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > geomConstantsToken_
Definition: MuonSensitiveDetectorBuilder.cc:68
SensitiveDetectorMakerBase.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45