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*>,
16  std::vector<SensitiveCaloDetector*> >
18  const SensitiveDetectorCatalog & clg,
19  edm::ParameterSet const & p,
20  const SimTrackManager* man,
21  SimActivityRegistry& reg) const
22 {
23  std::pair< std::vector<SensitiveTkDetector *>,std::vector<SensitiveCaloDetector*> > detList;
24  const std::vector<std::string>& rouNames = clg.readoutNames();
25  edm::LogVerbatim("SimG4CoreSensitiveDetector")
26  << " AttachSD: Initialising " << rouNames.size() << " SDs";
27  for (auto & rname : rouNames) {
28  std::string className = clg.className(rname);
29  std::unique_ptr<SensitiveDetectorMakerBase> temp{SensitiveDetectorPluginFactory::get()->create(className)};
30 
31  std::unique_ptr<SensitiveDetector> sd{temp->make(rname,cpv,clg,p,man,reg)};
32 
33  std::stringstream ss;
34  ss << " AttachSD: created a " << className << " with name " << rname;
35 
36  if(sd->isCaloSD()) {
37  detList.second.push_back(static_cast<SensitiveCaloDetector*>(sd.release()));
38  ss << " + calo SD";
39  } else {
40  detList.first.push_back(static_cast<SensitiveTkDetector*>(sd.release()));
41  ss << " + tracking SD";
42  }
43  edm::LogVerbatim("SimG4CoreSensitiveDetector") << ss.str();
44  }
45  return detList;
46 }
AttachSD()
Definition: AttachSD.cc:11
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
~AttachSD()
Definition: AttachSD.cc:13
std::string className(const std::string &readoutName) const
const std::vector< std::string > & readoutNames(const std::string &className) const
std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > create(const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *, SimActivityRegistry &reg) const
Definition: AttachSD.cc:17
double sd
T get(const Candidate &c)
Definition: component.h:55
std::string className(const T &t)
Definition: ClassName.h:30