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  std::unique_ptr<SensitiveDetectorMakerBase> temp;
28  for (auto & rname : rouNames) {
29  std::string className = clg.className(rname);
30  temp.reset(SensitiveDetectorPluginFactory::get()->create(className));
31 
32  SensitiveDetector* sd = temp.get()->make(rname,cpv,clg,p,man,reg);
33 
34  std::stringstream ss;
35  ss << " AttachSD: created a " << className << " with name " << rname;
36 
37  if(sd->isCaloSD()) {
39  detList.second.push_back(caloDet);
40  ss << " + calo SD";
41  } else {
43  detList.first.push_back(tkDet);
44  ss << " + tracking SD";
45  }
46  edm::LogVerbatim("SimG4CoreSensitiveDetector") << ss.str();
47  }
48  return detList;
49 }
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
bool isCaloSD() const
T get(const Candidate &c)
Definition: component.h:55
std::string className(const T &t)
Definition: ClassName.h:30