CMS 3D CMS Logo

List of all members | Public Member Functions
AttachSD Class Reference

#include <AttachSD.h>

Public Member Functions

 AttachSD ()
 
std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > create (const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *, SimActivityRegistry &reg) const
 
 ~AttachSD ()
 

Detailed Description

Definition at line 17 of file AttachSD.h.

Constructor & Destructor Documentation

◆ AttachSD()

AttachSD::AttachSD ( )

Definition at line 11 of file AttachSD.cc.

11 {}

◆ ~AttachSD()

AttachSD::~AttachSD ( )

Definition at line 13 of file AttachSD.cc.

13 {}

Member Function Documentation

◆ create()

std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > AttachSD::create ( const edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager man,
SimActivityRegistry reg 
) const

Definition at line 15 of file AttachSD.cc.

20  {
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 }

References SensitiveDetectorCatalog::className(), className(), get, AlCaHLTBitMon_ParallelJobs::p, SensitiveDetectorCatalog::readoutNames(), rname, sd, contentValuesCheck::ss, and groupFilesInBlocks::temp.

Referenced by RunManager::initG4(), RunManagerMTWorker::initializeG4(), and GeometryProducer::produce().

SensitiveDetectorCatalog::className
std::string_view className(const std::string &readoutName) const
Definition: SensitiveDetectorCatalog.cc:44
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:48
get
#define get
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