Warning, file /DD4hep/DDCore/src/plugins/DetectorHelperTest.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Detector.h>
0016 #include <DD4hep/Printout.h>
0017 #include <DD4hep/Factories.h>
0018 #include <DD4hep/DetectorHelper.h>
0019
0020
0021 #include <stdexcept>
0022 #include <algorithm>
0023
0024 using namespace dd4hep;
0025
0026 namespace {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 struct DetectorHelperTest {
0044
0045 DetectorHelperTest(Detector& description, int argc, char** argv) {
0046 DetectorHelper h(&description);
0047 const char* nam = argc>1 ? argv[1]+1 : "SiVertexEndcap";
0048 printSD(h,nam);
0049 walkSD(h,description.detector(nam));
0050 }
0051
0052 virtual ~DetectorHelperTest() {}
0053
0054 void walkSD(DetectorHelper h, DetElement de) const {
0055 printSD(h,de);
0056 for(DetElement::Children::const_iterator i=de.children().begin(); i!=de.children().end(); ++i) {
0057 DetElement child = (*i).second;
0058 printSD(h,child);
0059 if ( child.children().size() > 0 ) walkSD(h,child);
0060 }
0061 }
0062 void printSD(DetectorHelper h, DetElement de) const {
0063 SensitiveDetector sd = h.sensitiveDetector(de);
0064 printout(INFO,"DetectorHelperTest","Sensitive detector[%s]: %p --> %s",de.path().c_str(),(void*)sd.ptr(),
0065 sd.ptr() ? sd.name() : "????");
0066
0067 }
0068 void printSD(DetectorHelper h, const char* nam) const {
0069 SensitiveDetector sd = h.sensitiveDetector(nam);
0070 printout(INFO,"DetectorHelperTest","Sensitive detector[%s]: %p --> %s",nam,(void*)sd.ptr(),
0071 sd.ptr() ? sd.name() : "????");
0072
0073 }
0074
0075 static long run(Detector& description,int argc,char** argv) {
0076 DetectorHelperTest test(description,argc,argv);
0077 return 1;
0078 }
0079 };
0080 }
0081
0082 namespace dd4hep {
0083 using ::DetectorHelperTest;
0084 }
0085 DECLARE_APPLY(CLICSiD_DetectorHelperTest,DetectorHelperTest::run)