CMS 3D CMS Logo

AttachSD.cc
Go to the documentation of this file.
6 
8 #include <string>
9 #include <sstream>
10 
12 
14 
15 std::pair<std::vector<SensitiveTkDetector*>, std::vector<SensitiveCaloDetector*> > AttachSD::create(
16  const edm::EventSetup& es,
17  const SensitiveDetectorCatalog& clg,
18  edm::ParameterSet const& p,
19  const SimTrackManager* man,
20  SimActivityRegistry& reg) const {
21  std::pair<std::vector<SensitiveTkDetector*>, std::vector<SensitiveCaloDetector*> > detList;
22  const std::vector<std::string_view>& rouNames = clg.readoutNames();
23  edm::LogVerbatim("SimG4CoreSensitiveDetector") << " AttachSD: Initialising " << rouNames.size() << " SDs";
24  for (auto& rname : rouNames) {
25  std::string_view className = clg.className({rname.data(), rname.size()});
26  std::unique_ptr<SensitiveDetectorMakerBase> temp{
27  SensitiveDetectorPluginFactory::get()->create({className.data(), className.size()})};
28 
29  std::unique_ptr<SensitiveDetector> sd{temp->make({rname.data(), rname.size()}, es, clg, p, man, reg)};
30 
31  std::stringstream ss;
32  ss << " AttachSD: created a " << className << " with name " << rname;
33 
34  if (sd->isCaloSD()) {
35  detList.second.push_back(static_cast<SensitiveCaloDetector*>(sd.release()));
36  ss << " + calo SD";
37  } else {
38  detList.first.push_back(static_cast<SensitiveTkDetector*>(sd.release()));
39  ss << " + tracking SD";
40  }
41  edm::LogVerbatim("SimG4CoreSensitiveDetector") << ss.str();
42  }
43  return detList;
44 }
SimTrackManager
Definition: SimTrackManager.h:35
MessageLogger.h
SensitiveCaloDetector.h
SensitiveDetectorCatalog::className
std::string_view className(const std::string &readoutName) const
Definition: SensitiveDetectorCatalog.cc:44
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
AttachSD::AttachSD
AttachSD()
Definition: AttachSD.cc:11
AttachSD::create
std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > create(const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *, SimActivityRegistry &reg) const
Definition: AttachSD.cc:15
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
SensitiveTkDetector.h
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
AttachSD::~AttachSD
~AttachSD()
Definition: AttachSD.cc:13
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
edm::ParameterSet
Definition: ParameterSet.h:47
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:48
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
AttachSD.h
SimActivityRegistry
Definition: SimActivityRegistry.h:43
SensitiveDetector.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
SensitiveDetectorCatalog::readoutNames
const std::vector< std::string_view > readoutNames(const std::string &className) const
Definition: SensitiveDetectorCatalog.cc:27
className
std::string className(const T &t)
Definition: ClassName.h:31
sd
double sd
Definition: CascadeWrapper.h:113
SensitiveDetectorPluginFactory.h