/// Given a detector element, access it's sensitive detector (if the sub-detector is sensitive!) SensitiveDetector LCDDHelper::sensitiveDetector(DetElement detector) const { for(DetElement par = detector; par.isValid(); par = par.parent()) { if ( par.ptr() != ptr()->world().ptr() ) { PlacedVolume pv = par.placement(); if ( pv.isValid() ) { const PlacedVolume::VolIDs& ids = pv.volIDs(); for(PlacedVolume::VolIDs::const_iterator i=ids.begin(); i!=ids.end();++i) { if ( (*i).first == "system" ) { return sensitiveDetector(par.name()); } } } } } return SensitiveDetector(0); }
static void* create_printer(Detector& description, int argc,char** argv) { PrintLevel print_level = INFO; string prefix = "", name = ""; int flags = 0, have_pool = 0, arg_error = false; for(int i=0; i<argc && argv[i]; ++i) { if ( 0 == ::strncmp("-prefix",argv[i],4) ) prefix = argv[++i]; else if ( 0 == ::strncmp("-name",argv[i],5) ) name = argv[++i]; else if ( 0 == ::strncmp("-flags",argv[i],5) ) flags = ::atol(argv[++i]); else if ( 0 == ::strncmp("-pool",argv[i],5) ) have_pool = 1; else if ( 0 == ::strncmp("-print",argv[i],5) ) print_level = dd4hep::printLevel(argv[++i]); else arg_error = true; } if ( arg_error ) { /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" " name: factory name(s) DD4hep_ConditionsPrinter, \n" " dd4hep_AlignmentsPrinter \n" " dd4hep_AlignedVolumePrinter \n" " -prefix <string> Printout prefix for user customized output. \n" " -flags <number> Printout processing flags. \n" " -pool Attach conditions user pool from \n" " PluginTester's slice instance attached. \n\n" " -print <value> Printout level for the printer object. \n" "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } DetElement world = description.world(); printout(INFO,"Printer","World=%s [%p]",world.path().c_str(),world.ptr()); ConditionsSlice* slice = 0; if ( have_pool ) { PluginTester* test = description.extension<PluginTester>(); slice = test->extension<ConditionsSlice>("ConditionsTestSlice"); } PRINTER* p = (flags) ? new PRINTER(slice, prefix, flags) : new PRINTER(slice, prefix); p->printLevel = print_level; if ( !name.empty() ) p->name = name; return (void*)dynamic_cast<WRAPPER*>(createProcessorWrapper(p)); }