CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AttachSD.cc
Go to the documentation of this file.
1 //#include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorFactoryByName.h"
5 #include <string>
6 #include <vector>
7 
9 
10 using std::vector;
11 using std::string;
12 using std::cout;
13 using std::endl;
14 
15 // #define DEBUG
16 
18 
20 
21 std::pair< std::vector<SensitiveTkDetector*>,
22  std::vector<SensitiveCaloDetector*> >
24  const DDCompactView & cpv,
25  const SensitiveDetectorCatalog & clg,
26  edm::ParameterSet const & p,
27  const SimTrackManager* m,
28  SimActivityRegistry& reg) const
29 {
30  std::pair< std::vector<SensitiveTkDetector *>,
31  std::vector<SensitiveCaloDetector*> > detList;
32 //#ifdef DEBUG
33  //cout << " Initializing AttachSD " << endl;
34  LogDebug("SimG4CoreSensitiveDetector") << " AttachSD: Initializing" ;
35 //#endif
36  const std::vector<std::string>& rouNames = clg.readoutNames();
37  for (std::vector<std::string>::const_iterator it = rouNames.begin();
38  it != rouNames.end(); it++) {
39  std::string className = clg.className(*it);
40  //std::cout<<" trying to find something for "<<className<<" " <<*it<<std::endl;
41  edm::LogInfo("SimG4CoreSensitiveDetector") << " AttachSD: trying to find something for " << className << " " << *it ;
42  std::auto_ptr<SensitiveDetectorMakerBase> temp(
44  std::auto_ptr<SensitiveTkDetector> tkDet;
45  std::auto_ptr<SensitiveCaloDetector> caloDet;
46  temp->make(*it,cpv,clg,p,m,reg,tkDet,caloDet);
47  if(tkDet.get()){
48  detList.first.push_back(tkDet.get());
49  tkDet.release();
50  }
51  if(caloDet.get()){
52  detList.second.push_back(caloDet.get());
53  caloDet.release();
54  }
55 //#ifdef DEBUG
56  // cout << " AttachSD: created a " << className << " with name " << *it << endl;
57  LogDebug("SimG4CoreSensitiveDetector") << " AttachSD: created a " << className << " with name " << *it ;
58  //#endif
59  }
60  return detList;
61 }
62 
#define LogDebug(id)
AttachSD()
Definition: AttachSD.cc:17
const double w
Definition: UKUtility.cc:23
type of data representation of DDCompactView
Definition: DDCompactView.h:76
~AttachSD()
Definition: AttachSD.cc:19
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 DDDWorld &w, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *m, SimActivityRegistry &reg) const
Definition: AttachSD.cc:23
tuple cout
Definition: gather_cfg.py:121
T get(const Candidate &c)
Definition: component.h:55
std::string className(const T &t)
Definition: ClassName.h:30