diff --git a/DDCMS/README.txt b/DDCMS/README.txt index 020398cad9cf0ba80a9821c875dc7d84cc7661ae..7f84b2ab94951fb6924dd25828540075e89061b2 100644 --- a/DDCMS/README.txt +++ b/DDCMS/README.txt @@ -7,3 +7,12 @@ It is by no means complete. M.Frank, September 2017 + +geoPluginRun -input file:checkout/examples/DDCMS/data/cms_tracker.xml \ + -ui -interpreter \ + -plugin DD4hep_PlacedVolumeProcessor -recursive -processor DDCMS_DetElementCreator \ + -plugin DD4hep_VolumeManager \ + -plugin DD4hep_DetectorDump -sensitive \ + -plugin DD4hep_VolumeDump -sensitive -volids \ + -plugin DD4hep_GeometryDisplay + -end-plugin diff --git a/DDCMS/include/DDCMS/DDCMS.h b/DDCMS/include/DDCMS/DDCMS.h index 9eafbf207e1e6f0c62b1c94a386d6b6db963a194..db8d91cf4defdc8bd1d7ddd4945488ad84b10475 100644 --- a/DDCMS/include/DDCMS/DDCMS.h +++ b/DDCMS/include/DDCMS/DDCMS.h @@ -189,8 +189,17 @@ namespace dd4hep { std::vector<std::string> vecStr(const std::string& nam) const; }; + /// Re-direct debug messages to the DD4hep printer + /* + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CORE + */ class LogDebug : public std::stringstream { + protected: std::string tag; + int level; bool pop = false; public: LogDebug() = delete; @@ -201,7 +210,28 @@ namespace dd4hep { ~LogDebug(); static void setDebugAlgorithms(bool value); }; - + + /// Re-direct warning messages to the DD4hep printer + /* + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CORE + */ + class LogWarn : public LogDebug { + public: + LogWarn() = delete; + LogWarn(const LogWarn& copy) = delete; + LogWarn& operator=(const LogWarn& copy) = delete; + LogWarn(const std::string& tag_value); + }; + + + /// Helper: Convert the name of a placed volume into a subdetector name + std::string detElementName(PlacedVolume pv); + /// Compute the material fraction of a given element in a volume + double material_fraction(Volume vol, const TGeoElement* e); + /// Create 3D rotation matrix from angles. Rotation3D make_rotation3D(double thetaX, double phiX, double thetaY, double phiY, diff --git a/DDCMS/src/DDCMS.cpp b/DDCMS/src/DDCMS.cpp index 35f9f5109de9c73465c638db18775e18f620a46d..39f7f455062f034c5939b801ad7ef16e51c5a8c5 100644 --- a/DDCMS/src/DDCMS.cpp +++ b/DDCMS/src/DDCMS.cpp @@ -33,6 +33,7 @@ using namespace dd4hep::cms; #define NAMESPACE_SEP '_' +/// Create 3D rotation matrix from angles. Rotation3D dd4hep::cms::make_rotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ) { @@ -43,6 +44,45 @@ Rotation3D dd4hep::cms::make_rotation3D(double thetaX, double phiX, return rot; } +/// Helper: Convert the name of a placed volume into a subdetector name +string dd4hep::cms::detElementName(PlacedVolume pv) { + if ( pv.isValid() ) { + string nam = pv.name(); + string nnam = nam.substr(nam.find('_')+1); + return nnam; + //size_t idx = nnam.rfind('_'); + //return idx == string::npos ? nnam : nnam.substr(0,idx); + } + except("DDCMS","++ Cannot deduce name from invalid PlacedVolume handle!"); + return string(); +} + +/// Compute the material fraction of a given element in a volume +double dd4hep::cms::material_fraction(Volume vol, const TGeoElement* element) { + double frac = 0e0, tot = 0e0; + TGeoMaterial* m = vol.material()->GetMaterial(); + for ( int i=0, n=m->GetNelements(); i<n; ++i ) { + TGeoElement* e = m->GetElement(i); + if ( m->IsMixture() ) { + TGeoMixture* mix = (TGeoMixture*)m; + tot += mix->GetWmixt()[i]; + } + else { + tot = 1e0; + } + if ( e == element ) { + if ( m->IsMixture() ) { + TGeoMixture* mix = (TGeoMixture*)m; + frac += mix->GetWmixt()[i]; + } + else { + frac = 1e0; + } + } + } + return tot>1e-20 ? frac/tot : 0.0; +} + /// Initializing constructor Namespace::Namespace(ParsingContext* ctx, xml_h element) : context(ctx) { xml_dim_t elt(element); @@ -474,18 +514,22 @@ namespace { } LogDebug::LogDebug(const std::string& tag_value, bool /* set_context */) { + level = s_debug_algorithms ? ALWAYS : DEBUG; s_algorithms.push_back(tag_value); pop = true; } LogDebug::LogDebug(const std::string& t) : stringstream(), tag(t) { - if ( pop ) s_algorithms.pop_back(); + level = s_debug_algorithms ? ALWAYS : DEBUG; } LogDebug::~LogDebug() { - if ( pop ) return; + if ( pop ) { + s_algorithms.pop_back(); + return; + } if ( this->str().empty() ) return; - printout(s_debug_algorithms ? ALWAYS : DEBUG, + printout(PrintLevel(level), currentAlg(),"%s: %s", tag.c_str(),this->str().c_str()); } @@ -494,3 +538,6 @@ void LogDebug::setDebugAlgorithms(bool value) { s_debug_algorithms = value; } +LogWarn::LogWarn(const std::string& t) : LogDebug(t) { + level = WARNING; +} diff --git a/DDCMS/src/plugins/DDCMSDetElementCreator.cpp b/DDCMS/src/plugins/DDCMSDetElementCreator.cpp index 972b29df9a7c802b2f79272165a5879c72c86863..d83b69e6efe00f5f35e5f5733a8e885cfce83c24 100644 --- a/DDCMS/src/plugins/DDCMSDetElementCreator.cpp +++ b/DDCMS/src/plugins/DDCMSDetElementCreator.cpp @@ -17,70 +17,346 @@ // Framework include files #include "DD4hep/VolumeProcessor.h" +#include "DD4hep/detail/DetectorInterna.h" #include "DD4hep/DetFactoryHelper.h" +// ROOT include files +#include "TGeoElement.h" +#include "TGeoManager.h" + +//#include <set> + using namespace std; using namespace dd4hep; - namespace { - + /// DD4hep DetElement creator for the CMS geometry. + /* Heuristically assign DetElement structures to the sensitive volume pathes. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CORE + */ class DDCMSDetElementCreator : public PlacedVolumeProcessor { + Detector& description; + TGeoElement* silicon = 0; struct Data { - bool sensitive = false; + PlacedVolume pv {0}; + DetElement element {}; + bool sensitive = false; + bool has_sensitive = false; + int vol_count = 0; + int daughter_count = 0; + int sensitive_count = 0; + Data() = default; + Data(PlacedVolume v) : pv(v) {} Data(const Data& d) = default; Data& operator=(const Data& d) = default; }; - typedef std::vector<std::pair<PlacedVolume,Data> > VolumeStack; - VolumeStack* stack; + struct Count { + int elements = 0; + int volumes = 0; + int sensitives = 0; + Count() = default; + Count(const Count&) = default; + Count& operator=(const Count&) = default; + }; + typedef std::vector<Data> VolumeStack; + typedef std::map<std::string,dd4hep::DetElement> Detectors; + typedef std::map<dd4hep::DetElement,Count> Counters; + typedef std::map<std::pair<dd4hep::DetElement,int>, std::pair<int,int> > LeafCount; + + Counters counters; + LeafCount leafCount; + VolumeStack stack; + Detectors subdetectors; + DetElement tracker, current_detector; + SensitiveDetector current_sensitive; + std::map<PlacedVolume, std::pair<int,int> > all_placements; + + /// Add new subdetector to the detector description + DetElement addSubdetector(const std::string& nam, PlacedVolume pv, bool volid); + /// Create a new detector element + DetElement createElement(const char* debug_tag, PlacedVolume pv, int id); + /// Create the top level detectors + void createTopLevelDetectors(PlacedVolume pv); public: /// Initializing constructor - DDCMSDetElementCreator(); + DDCMSDetElementCreator(Detector& desc); /// Default destructor virtual ~DDCMSDetElementCreator(); /// Callback to output PlacedVolume information of an single Placement - virtual int operator()(PlacedVolume pv, int level) const; + virtual int operator()(PlacedVolume pv, int level); /// Callback to output PlacedVolume information of an entire Placement - virtual int process(PlacedVolume pv, int level, bool recursive) const; + virtual int process(PlacedVolume pv, int level, bool recursive); }; } #include "DD4hep/Printout.h" +#include "DDCMS/DDCMS.h" +#include <sstream> /// Initializing constructor -DDCMSDetElementCreator::DDCMSDetElementCreator() { - stack = new VolumeStack(); +DDCMSDetElementCreator::DDCMSDetElementCreator(Detector& desc) + : description(desc) +{ + TGeoElementTable* tab = description.manager().GetElementTable(); + silicon = tab->FindElement("SI"); + if ( !silicon ) silicon = tab->FindElement("Si"); + if ( !silicon ) silicon = tab->FindElement("si"); + if ( !silicon ) { + except("DDCMSDetElementCreator", + "++ Failed to extract SILICON from the element table."); + } + stack.reserve(32); } /// Default destructor DDCMSDetElementCreator::~DDCMSDetElementCreator() { - detail::deletePtr(stack); + Count total; + stringstream str, id_str; + + printout(INFO,"DDCMSDetElementCreator","+++++++++++++++ Summary of sensitve elements ++++++++++++++++++++++++"); + for ( const auto& c : counters ) { + printout(INFO,"DDCMSDetElementCreator","++ Summary: SD: %-24s %7d DetElements %7d sensitives out of %7d volumes", + (c.first.name()+string(":")).c_str(), c.second.elements, c.second.sensitives, c.second.volumes); + total.elements += c.second.elements; + total.sensitives += c.second.sensitives; + total.volumes += c.second.volumes; + } + printout(INFO,"DDCMSDetElementCreator", "++ Summary: %-24s %7d DetElements %7d sensitives out of %7d volumes", + "Grand Total:",total.elements,total.sensitives,total.volumes); + printout(INFO,"DDCMSDetElementCreator","+++++++++++++++ Summary of geometry depth analysis ++++++++++++++++++"); + int total_cnt = 0, total_depth = 0; + map<DetElement, vector<pair<int,int> > > fields; + for ( const auto& l : leafCount ) { + DetElement de = l.first.first; + printout(INFO,"DDCMSDetElementCreator","++ Summary: SD: %-24s system:%04X Lvl:%3d Sensitives: %6d [Max: %6d].", + (de.name()+string(":")).c_str(), de.id(), + l.first.second, l.second.second, l.second.first); + fields[de].push_back(make_pair(l.first.second,l.second.first)); + total_depth += l.second.second; + ++total_cnt; + } + printout(INFO,"DDCMSDetElementCreator","++ Summary: %-24s %d.","Total DetElements:",total_cnt); + printout(INFO,"DDCMSDetElementCreator","+++++++++++++++ Readout structure generation ++++++++++++++++++++++++"); + str << endl; + for( const auto& f : fields ) { + string ro_name = f.first.name() + string("Hits"); + int num_bits = 8; + id_str.str(""); + id_str << "system:" << num_bits; + for( const auto& q : f.second ) { + int bits = 0; + if ( q.second < 1<<0 ) bits = 1; + else if ( q.second < 1<<1 ) bits = 1; + else if ( q.second < 1<<2 ) bits = 2; + else if ( q.second < 1<<3 ) bits = 3; + else if ( q.second < 1<<4 ) bits = 4; + else if ( q.second < 1<<5 ) bits = 5; + else if ( q.second < 1<<6 ) bits = 6; + else if ( q.second < 1<<7 ) bits = 7; + else if ( q.second < 1<<8 ) bits = 8; + else if ( q.second < 1<<9 ) bits = 9; + else if ( q.second < 1<<10 ) bits = 10; + else if ( q.second < 1<<11 ) bits = 11; + else if ( q.second < 1<<12 ) bits = 12; + else if ( q.second < 1<<13 ) bits = 13; + else if ( q.second < 1<<14 ) bits = 14; + else if ( q.second < 1<<15 ) bits = 15; + bits += 1; + id_str << ",Lv" << q.first << ":" << bits; + num_bits += bits; + } + string idspec = id_str.str(); + str << "<readout name=\"" << ro_name << "\">" << endl + << "\t<id>" + << idspec + << "</id> <!-- Number of bits: " << num_bits << " -->" << endl + << "</readout>" << endl; + /// Create ID Descriptors and readout configurations + IDDescriptor dsc(ro_name,idspec); + description.addIDSpecification(dsc); + Readout ro(ro_name); + ro.setIDDescriptor(dsc); + description.addReadout(ro); + SensitiveDetector sd = description.sensitiveDetector(f.first.name()); + sd.setHitsCollection(ro.name()); + sd.setReadout(ro); + printout(INFO,"DDCMSDetElementCreator", + "++ Setting up readout for subdetector:%-24s id:%04X", + f.first.name(), f.first.id()); + } + printout(INFO,"DDCMSDetElementCreator","+++++++++++++++ ID Descriptor generation ++++++++++++++++++++++++++++"); + printout(INFO,"",str.str().c_str()); + char volid[32]; + for(auto& p : all_placements ) { + PlacedVolume place = p.first; + Volume vol = place.volume(); + ::snprintf(volid,sizeof(volid),"Lv%d", p.second.first); + printout(DEBUG,"DDCMSDetElementCreator", + "++ Set volid (%-24s): %-6s = %3d -> %s (%p)", + vol.isSensitive() ? vol.sensitiveDetector().name() : "Not Sensitive", + volid, p.second.second, place.name(), place.ptr()); + place.addPhysVolID(volid, p.second.second); + } + printout(ALWAYS,"DDCMSDetElementCreator", + "++ Instrumented %ld subdetectors with %d DetElements %d sensitives out of %d volumes and %ld sensitive placements.", + fields.size(),total.elements,total.sensitives,total.volumes,all_placements.size()); +} + +/// Create a new detector element +DetElement DDCMSDetElementCreator::createElement(const char* /* debug_tag */, PlacedVolume pv, int id) { + string name = cms::detElementName(pv); + DetElement det(name, id); + det.setPlacement(pv); + /* + printout(INFO,"DDCMSDetElementCreator","++ Created detector element [%s]: %s (%s) %p", + debug_tag, det.name(), name.c_str(), det.ptr()); + */ + return det; +} + +/// Create the top level detectors +void DDCMSDetElementCreator::createTopLevelDetectors(PlacedVolume pv) { + auto& data = stack.back(); + if ( stack.size() == 2 ) { // Main subssystem: tracker:Tracker + data.element = tracker = addSubdetector(cms::detElementName(pv), pv, false); + tracker->SetTitle("compound"); + } + else if ( stack.size() == 3 ) { // Main subsystem detector: TIB, TEC, .... + data.element = current_detector = addSubdetector(cms::detElementName(pv), pv, true); + } +} + +/// Add new subdetector to the detector description +DetElement DDCMSDetElementCreator::addSubdetector(const std::string& nam, PlacedVolume pv, bool volid) { + Detectors::iterator idet = subdetectors.find(nam); + if ( idet == subdetectors.end() ) { + DetElement det(nam, subdetectors.size()+1); + det.setPlacement(pv); + if ( volid ) { + det.placement().addPhysVolID("system",det.id()); + } + idet = subdetectors.insert(make_pair(nam,det)).first; + description.add(det); + } + return idet->second; } /// Callback to output PlacedVolume information of an single Placement -int DDCMSDetElementCreator::operator()(PlacedVolume pv, int level) const { - Volume vol = pv.volume(); - char sens = vol.isSensitive() ? 'S' : ' '; - printout(INFO,"DDCMSDetElementCreator", - "++ %3d %s [%s] %c", level, pv.name(), vol.name(), sens); - return 1; +int DDCMSDetElementCreator::operator()(PlacedVolume pv, int vol_level) { + double frac_si = dd4hep::cms::material_fraction(pv.volume(),silicon); + if ( frac_si > 90e-2 ) { + Data& data = stack.back(); + data.sensitive = true; + data.has_sensitive = true; + ++data.vol_count; + int idx = pv->GetMotherVolume()->GetIndex(pv.ptr())+1; + auto& cnt = leafCount[make_pair(current_detector,vol_level)]; + cnt.first = std::max(cnt.first,idx); + ++cnt.second; + all_placements[pv] = make_pair(vol_level,idx); + return 1; + } + return 0; } /// Callback to output PlacedVolume information of an entire Placement -int DDCMSDetElementCreator::process(PlacedVolume pv, int level, bool recursive) const { - stack->push_back(make_pair(pv,Data())); +int DDCMSDetElementCreator::process(PlacedVolume pv, int level, bool recursive) { + stack.push_back(Data(pv)); + if ( stack.size() <= 3 ) { + createTopLevelDetectors(pv); + } int ret = PlacedVolumeProcessor::process(pv,level,recursive); - stack->pop_back(); + + /// Complete structures if the stack size is > 3! + if ( stack.size() > 3 ) { + // Note: short-cuts to entries in the stack MUST be local and + // initialized AFTER the call to "process"! The vector may be resized! + auto& data = stack.back(); + auto& parent = stack[stack.size()-2]; + auto& counts = counters[current_detector]; + if ( data.sensitive ) { + /// If this volume is sensitve, we must attach a sensitive detector handle + if ( !current_sensitive.isValid() ) { + SensitiveDetector sd = description.sensitiveDetector(current_detector.name()); + if ( !sd.isValid() ) { + sd = SensitiveDetector(current_detector.name(),"tracker"); + current_detector->flag |= DetElement::Object::HAVE_SENSITIVE_DETECTOR; + description.add(sd); + } + current_sensitive = sd; + } + pv.volume().setSensitiveDetector(current_sensitive); + ++counts.sensitives; + } + ++counts.volumes; + bool added = false; + if ( data.vol_count > 0 ) { + parent.daughter_count += data.vol_count; + parent.daughter_count += data.daughter_count; + data.has_sensitive = true; + } + else { + parent.daughter_count += data.daughter_count; + data.has_sensitive = (data.daughter_count>0); + } + + if ( data.has_sensitive ) { + // If we have sensitive elements at this level or below, + // we must complete the DetElement hierarchy + if ( !data.element.isValid() ) { + data.element = createElement("Element", data.pv, current_detector.id()); + ++counts.elements; + } + if ( !parent.element.isValid() ) { + parent.element = createElement("Parent ", parent.pv, current_detector.id()); + ++counts.elements; + } + printout(DEBUG,"DDCMSDetElementCreator", + "++ Assign detector element: %s (%p, %ld children) to %s (%p) with %ld vols", + data.element.name(), data.element.ptr(), data.element.children().size(), + parent.element.name(), parent.element.ptr(), + data.vol_count); + + // Trickle up the tree only for sensitive pathes. Forget the passive rest + // This should automatically omit non-sensitive pathes + parent.has_sensitive = true; + parent.element.add(data.element); + added = true; + // It is simpler to collect the volumes and later assign the volids + // rather than checking if the volid already exists. + int vol_level = level; + int idx = data.pv->GetMotherVolume()->GetIndex(data.pv.ptr())+1; + all_placements[data.pv] = make_pair(vol_level,idx); // 1...n + // Update counters + auto& cnt_det = leafCount[make_pair(current_detector,vol_level)]; + cnt_det.first = std::max(cnt_det.first,idx); + cnt_det.second += 1; + } + if ( !added && data.element.isValid() ) { + printout(WARNING,"MEMORY-LEAK","Level:%3d Orpahaned DetElement:%s Daugthers:%d Parent:%s", + int(stack.size()), data.element.name(), data.vol_count, parent.pv.name()); + } + } + /// Now the cleanup kicks in.... + if ( stack.size() == 3 ) { + current_sensitive = SensitiveDetector(); + current_detector = DetElement(); + ret = 0; + } + stack.pop_back(); return ret; } -static void* create_object(Detector& /* description */, int /* argc */, char** /* argv */) { - PlacedVolumeProcessor* proc = new DDCMSDetElementCreator(); - return proc; +static void* create_object(Detector& description, int /* argc */, char** /* argv */) { + PlacedVolumeProcessor* proc = new DDCMSDetElementCreator(description); + return (void*)proc; } // first argument is the type from the xml file diff --git a/DDCMS/src/plugins/DDDefinitions2Objects.cpp b/DDCMS/src/plugins/DDDefinitions2Objects.cpp index 83f7c63176c225ba5c548db81d611854cc140354..2d118c06708b01dd1fbcec248f456471f4f261ef 100644 --- a/DDCMS/src/plugins/DDDefinitions2Objects.cpp +++ b/DDCMS/src/plugins/DDDefinitions2Objects.cpp @@ -507,7 +507,7 @@ template <> void Converter<pospart>::operator()(xml_h element) const { if ( child.isValid() ) { Transform3D trafo; Converter<transform3d>(description,param,&trafo)(element); - pv = parent.placeVolume(child,trafo); + pv = parent.placeVolume(child,copy,trafo); } if ( !pv.isValid() ) { printout(ERROR,"DDCMS","+++ Placement FAILED! Parent:%s Child:%s Valid:%s", @@ -729,11 +729,12 @@ template <> void Converter<algorithm>::operator()(xml_h element) const { template <> void Converter<debug>::operator()(xml_h dbg) const { Namespace _ns(_param<ParsingContext>()); - if ( dbg.hasChild(_CMU(debug_constants)) ) _ns.context->debug_constants = true; - if ( dbg.hasChild(_CMU(debug_materials)) ) _ns.context->debug_materials = true; - if ( dbg.hasChild(_CMU(debug_rotations)) ) _ns.context->debug_rotations = true; - if ( dbg.hasChild(_CMU(debug_shapes)) ) _ns.context->debug_shapes = true; - if ( dbg.hasChild(_CMU(debug_volumes)) ) _ns.context->debug_volumes = true; + if ( dbg.hasChild(_CMU(debug_visattr)) ) _ns.context->debug_visattr = true; + if ( dbg.hasChild(_CMU(debug_constants)) ) _ns.context->debug_constants = true; + if ( dbg.hasChild(_CMU(debug_materials)) ) _ns.context->debug_materials = true; + if ( dbg.hasChild(_CMU(debug_rotations)) ) _ns.context->debug_rotations = true; + if ( dbg.hasChild(_CMU(debug_shapes)) ) _ns.context->debug_shapes = true; + if ( dbg.hasChild(_CMU(debug_volumes)) ) _ns.context->debug_volumes = true; if ( dbg.hasChild(_CMU(debug_placements)) ) _ns.context->debug_placements = true; if ( dbg.hasChild(_CMU(debug_namespaces)) ) _ns.context->debug_namespaces = true; if ( dbg.hasChild(_CMU(debug_includes)) ) _ns.context->debug_includes = true; @@ -781,7 +782,8 @@ template <> void Converter<vis_apply>::operator()(xml_h /* dddefinition */) cons } } */ - printout(INFO,"Vis","+++ %-40s Material:%s Dens:%6.1f vis-attrs:%s [%s]", + printout(n_s.context->debug_visattr ? ALWAYS : DEBUG, + "Vis","+++ %-40s Material:%s Dens:%6.1f vis-attrs:%s [%s]", vol.name(), mat.name(), mat.density(), yes_no(vis.isValid()), vis.name()); vol.setVisAttributes(vis); diff --git a/DDCMS/src/plugins/DDPixBarLayerAlgo.cpp b/DDCMS/src/plugins/DDPixBarLayerAlgo.cpp index 198a97b76320c0fe99440bb91609514cfece57d9..a10634e7f5303c4dd8d6c33d939242c93f54e752 100644 --- a/DDCMS/src/plugins/DDPixBarLayerAlgo.cpp +++ b/DDCMS/src/plugins/DDPixBarLayerAlgo.cpp @@ -104,7 +104,7 @@ static long algorithm(Detector& description, ParsingContext& ctxt, xml_h e, Sens << d1 << ", 0"; Volume cool = ns.addVolume(Volume(name, solid, description.material(coolMat))); - pv = coolTube.placeVolume(cool); + pv = coolTube.placeVolume(cool,1); LogDebug("PixelGeom") << "Cool " << cool.name() << " number 1 positioned in " << coolTube.name() << " at (0,0,0) with no rotation"; @@ -136,7 +136,7 @@ static long algorithm(Detector& description, ParsingContext& ctxt, xml_h e, Sens rot = make_rotation3D(90*CLHEP::deg, phix, 90*CLHEP::deg, phiy, 0.,0.); //cpv.position(ladderHalf, layer, copy, tran, rot); - pv = layer.placeVolume(ladderHalfVol, Transform3D(rot,tran)); + pv = layer.placeVolume(ladderHalfVol, copy, Transform3D(rot,tran)); if ( !pv.isValid() ) { } LogDebug("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " @@ -154,7 +154,7 @@ static long algorithm(Detector& description, ParsingContext& ctxt, xml_h e, Sens << ", 0, 0"; rot = make_rotation3D(90*CLHEP::deg, phix, 90*CLHEP::deg, phiy, 0.,0.); //cpv.position(ladderHalf, layer, copy, tran, rot); - pv = layer.placeVolume(ladderHalfVol, Transform3D(rot,tran)); + pv = layer.placeVolume(ladderHalfVol, copy, Transform3D(rot,tran)); if ( !pv.isValid() ) { } LogDebug("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " @@ -176,7 +176,7 @@ static long algorithm(Detector& description, ParsingContext& ctxt, xml_h e, Sens rot = make_rotation3D(90*CLHEP::deg, phix, 90*CLHEP::deg, phiy, 0.,0.); //cpv.position(ladderFull, layer, copy, tran, rot); - pv = layer.placeVolume(ladderFullVol, Transform3D(rot,tran)); + pv = layer.placeVolume(ladderFullVol, copy, Transform3D(rot,tran)); if ( !pv.isValid() ) { } LogDebug("PixelGeom") << "test: " << ladderFullVol.name() << " number " << copy << " positioned in " @@ -195,7 +195,7 @@ static long algorithm(Detector& description, ParsingContext& ctxt, xml_h e, Sens << ", 0, 0"; rot = make_rotation3D(90*CLHEP::deg, phix, 90*CLHEP::deg, phiy, 0.,0.); - pv = layer.placeVolume(coolTube,Transform3D(rot,tran)); + pv = layer.placeVolume(coolTube, i+1, Transform3D(rot,tran)); if ( !pv.isValid() ) { } LogDebug("PixelGeom") << "coolTube: " << coolTube.name() << " number " << i+1 << " positioned in " diff --git a/DDCMS/src/plugins/DDTECCoolAlgo.cpp b/DDCMS/src/plugins/DDTECCoolAlgo.cpp index 061e2079388adc54d2757e05dd9ddf7d9c0cd7dd..3a6aaa9920da51dce0e88743e204048c75ca38b5 100644 --- a/DDCMS/src/plugins/DDTECCoolAlgo.cpp +++ b/DDCMS/src/plugins/DDTECCoolAlgo.cpp @@ -62,7 +62,7 @@ static long algorithm(Detector& /* description */, double ypos = -rPosition*sin(phiPosition.at(i)); // place inserts Position tran(xpos, ypos, 0.0); - mother.placeVolume(child,tran); + mother.placeVolume(child, copyNo, tran); LogDebug("TECGeom") << "test " << child.name() << "[" << copyNo << "] positioned in " << mother.name() << " at " << tran diff --git a/DDCMS/src/plugins/DDTECModuleAlgo.cpp b/DDCMS/src/plugins/DDTECModuleAlgo.cpp index c9eabf69d1cc29090a2a2f062f3ce830ce5e4037..973e297e978d7e80761aa5cb8f43a9ee6d22efce 100644 --- a/DDCMS/src/plugins/DDTECModuleAlgo.cpp +++ b/DDCMS/src/plugins/DDTECModuleAlgo.cpp @@ -24,11 +24,11 @@ using namespace dd4hep; using namespace dd4hep::cms; static void doPos(ParsingContext& ctxt, Volume toPos, Volume mother, - int /* copyNr */, double x, double y, double z, + int copyNr, double x, double y, double z, const string& rotName) { Namespace ns(ctxt); - mother.placeVolume(toPos,Transform3D(ns.rotation(rotName),Position(x,y,z))); + mother.placeVolume(toPos,copyNr,Transform3D(ns.rotation(rotName),Position(x,y,z))); LogDebug("TECGeom") << "Volume: " << mother.name() << " positioned daughter "<< mother.name(); } @@ -592,7 +592,7 @@ static long algorithm(Detector& /* description */, << bl1 << ", " << h1 << ", " << dz; Volume bridgeGap(name, solid, ns.material(genMat)); ns.addVolumeNS(bridgeGap); - /* PlacedVolume pv = */ bridge.placeVolume(bridgeGap); + /* PlacedVolume pv = */ bridge.placeVolume(bridgeGap, 1); LogDebug("TECGeom") << "Solid: " << bridgeGap.name() << " number 1 positioned in " << bridge.name() << " at (0,0,0) with no rotation"; diff --git a/DDCMS/src/plugins/DDTECOptoHybAlgo.cpp b/DDCMS/src/plugins/DDTECOptoHybAlgo.cpp index 803790537c2d3b68ee9fcda6855d83786da76ab7..59a83ba3f6fbeaa156bfbce6e0cb74de7cfac887 100644 --- a/DDCMS/src/plugins/DDTECOptoHybAlgo.cpp +++ b/DDCMS/src/plugins/DDTECOptoHybAlgo.cpp @@ -76,7 +76,7 @@ static long algorithm(Detector& /* description */, rotation = make_rotation3D(theta, phix, theta, phiy, 0., 0.); } } - mother.placeVolume(child, Transform3D(rotation,tran)); + mother.placeVolume(child, copyNo, Transform3D(rotation,tran)); LogDebug("TECGeom") << "test " << child.name() << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " << rotation; diff --git a/DDCMS/src/plugins/DDTECPhiAlgo.cpp b/DDCMS/src/plugins/DDTECPhiAlgo.cpp index e14311814e72f57b5c2f827602734ba88c6489b5..eb90b4c1e50db63d60d7f94a73299f4af2120727 100644 --- a/DDCMS/src/plugins/DDTECPhiAlgo.cpp +++ b/DDCMS/src/plugins/DDTECPhiAlgo.cpp @@ -59,7 +59,7 @@ static long algorithm(Detector& /* description */, double phiy = phix + 90.*CLHEP::deg; Rotation3D rotation = make_rotation3D(theta, phix, theta, phiy, 0, 0); Position tran(0., 0., (i%2 == 0) ? zIn : zOut); - /* PlacedVolume pv = */ mother.placeVolume(child,Transform3D(rotation,tran)); + /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation,tran)); LogDebug("TECGeom") << "test: " << child.name() <<" number " << copyNo << " positioned in " << mother.name() <<" at " << tran << " with " << rotation; diff --git a/DDCMS/src/plugins/DDTECPhiAltAlgo.cpp b/DDCMS/src/plugins/DDTECPhiAltAlgo.cpp index 3d355a498d58303119f768b106ca5919e27002a0..93f6b9f5981e2b2da61b62f4857f6b5bcccc00e6 100644 --- a/DDCMS/src/plugins/DDTECPhiAltAlgo.cpp +++ b/DDCMS/src/plugins/DDTECPhiAltAlgo.cpp @@ -59,7 +59,7 @@ static long algorithm(Detector& /* description */, double phix = phiz + 90.*CLHEP::deg; Rotation3D rotation = make_rotation3D(theta, phix, 0e0, 0e0, theta, phiz); Position tran(0., 0., (i%2 == 0) ? zIn : zOut); - /* PlacedVolume pv = */ mother.placeVolume(child,Transform3D(rotation,tran)); + /* PlacedVolume pv = */ mother.placeVolume(child,copyNo,Transform3D(rotation,tran)); LogDebug("TECGeom") << "test: " << child.name() <<" number " << copyNo << " positioned in " << mother.name() <<" at " << tran << " with " << rotation; diff --git a/DDCMS/src/plugins/DDTIBLayerAlgo.cpp b/DDCMS/src/plugins/DDTIBLayerAlgo.cpp index 75eb159f45a10ab477b472ebb5408cd7ead9e4b6..b19b3ca69ec3d67780dd8081c4ff05de4025be67 100644 --- a/DDCMS/src/plugins/DDTIBLayerAlgo.cpp +++ b/DDCMS/src/plugins/DDTIBLayerAlgo.cpp @@ -170,7 +170,7 @@ static long algorithm(Detector& /* description */, << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5*layerL; Volume layerIn = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); - layer.placeVolume(layerIn); // copyNr=1 ! + layer.placeVolume(layerIn, 1); // copyNr=1 ! LogDebug("TIBGeom") << layerIn.name() << " number 1 positioned in " << layer.name() << " at (0,0,0) with no rotation"; @@ -185,12 +185,11 @@ static long algorithm(Detector& /* description */, double phiy = phix + 90.*CLHEP::deg; Rotation3D rotation = make_rotation3D(theta, phix, theta, phiy, 0., 0.); Position trdet(rposdet*cos(phi), rposdet*sin(phi), 0); - layerIn.placeVolume(detIn, Transform3D(rotation,trdet)); // copyNr=n+1 + layerIn.placeVolume(detIn, n+1, Transform3D(rotation,trdet)); // copyNr=n+1 LogDebug("TIBGeom") << detIn.name() << " number " << n+1 << " positioned in " << layerIn.name() << " at " << trdet << " with " << rotation; } - //Now the external layer rin = cylinderInR + cylinderT; rout = rmax-MFRingT; @@ -201,7 +200,7 @@ static long algorithm(Detector& /* description */, << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5*layerL; Volume layerOut = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); - layer.placeVolume(layerOut); // CopyNr again 1 ?? + layer.placeVolume(layerOut, 1); // CopyNr 1 LogDebug("TIBGeom") << layerOut.name() << " number 1 positioned in " << layer.name() << " at (0,0,0) with no rotation"; @@ -216,7 +215,7 @@ static long algorithm(Detector& /* description */, double phiy = phix + 90.*CLHEP::deg; Rotation3D rotation = make_rotation3D(theta, phix, theta, phiy, 0., 0.); Position trdet(rposdet*cos(phi), rposdet*sin(phi), 0); - layerOut.placeVolume(detOut,Transform3D(rotation,trdet)); + layerOut.placeVolume(detOut, n+1, Transform3D(rotation,trdet)); LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << detectorUp << " number " << n+1 << " positioned in " << layerOut.name() << " at " << trdet << " with " @@ -236,7 +235,7 @@ static long algorithm(Detector& /* description */, << CLHEP::twopi/CLHEP::deg << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5*layerL; Volume cylinder = ns.addVolumeNS(Volume(name, solid, ns.material(cylinderMat))); - layer.placeVolume(cylinder); // CopyNr = 1 + layer.placeVolume(cylinder, 1); // CopyNr = 1 LogDebug("TIBGeom") << cylinder.name() << " number 1 positioned in " << layer.name() << " at (0,0,0) with no rotation"; @@ -252,7 +251,7 @@ static long algorithm(Detector& /* description */, << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5*layerL; Volume cylinderIn = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); - cylinder.placeVolume(cylinderIn); + cylinder.placeVolume(cylinderIn, 1); LogDebug("TIBGeom") << cylinderIn.name() << " number 1 positioned in " << cylinder.name() << " at (0,0,0) with no rotation"; @@ -266,8 +265,8 @@ static long algorithm(Detector& /* description */, << CLHEP::twopi/CLHEP::deg << " with Rin " << rin << " Rout " << rout << " ZHalf " << fillerDz; Volume cylinderFiller = ns.addVolumeNS(Volume(name,solid,ns.material(fillerMat))); - cylinderIn.placeVolume(cylinderFiller,Position(0.0, 0.0, 0.5*layerL-fillerDz)); // copyNr 1 - cylinderIn.placeVolume(cylinderFiller,Position(0.0, 0.0,-0.5*layerL+fillerDz)); // copyNr 2 + cylinderIn.placeVolume(cylinderFiller, 1, Position(0.0, 0.0, 0.5*layerL-fillerDz)); // copyNr 1 + cylinderIn.placeVolume(cylinderFiller, 2, Position(0.0, 0.0,-0.5*layerL+fillerDz)); // copyNr 2 LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << cylinderFiller.name() << " number 1" << " positioned in " << cylinderIn.name() << " at " << Position(0.0, 0.0, 0.5*layerL-fillerDz) @@ -277,7 +276,7 @@ static long algorithm(Detector& /* description */, // Ribs // Material matrib = ns.material(ribMat); - for (int i = 0; i < (int)(ribW.size()); i++) { + for (size_t i = 0; i < ribW.size(); i++) { name = idName + "Rib" + std::to_string(i); double width = 2.*ribW[i]/(rin+rout); double dz = 0.5*layerL-2.*fillerDz; @@ -295,13 +294,13 @@ static long algorithm(Detector& /* description */, double phiy = phix + 90.*CLHEP::deg; Rotation3D rotation = make_rotation3D(theta, phix, theta, phiy, 0., 0.); Position tran(0, 0, 0); - cylinderIn.placeVolume(cylinderRib,Transform3D(rotation,tran));// copyNr=1 + cylinderIn.placeVolume(cylinderRib, 1, Transform3D(rotation,tran));// copyNr=1 LogDebug("TIBGeom") << cylinderRib.name() << " number 1" << " positioned in " << cylinderIn.name() << " at " << tran << " with " << rotation; } - + // //Manifold rings // // Inner ones first @@ -314,8 +313,8 @@ static long algorithm(Detector& /* description */, << CLHEP::twopi/CLHEP::deg << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz; Volume inmfr = ns.addVolumeNS(Volume(name, solid, ns.material(MFIntRingMat))); - layer.placeVolume(inmfr, Position(0.0, 0.0, -0.5*layerL+MFRingDz)); // Copy Nr=1 - layer.placeVolume(inmfr, Position(0.0, 0.0, +0.5*layerL+MFRingDz)); // Copy Nr=2 + layer.placeVolume(inmfr, 1, Position(0.0, 0.0, -0.5*layerL+MFRingDz)); // Copy Nr=1 + layer.placeVolume(inmfr, 2, Position(0.0, 0.0, +0.5*layerL+MFRingDz)); // Copy Nr=2 LogDebug("TIBGeom") << inmfr.name() << " number 1 and 2 positioned in " << layer.name() << " at (0,0,+-" << 0.5*layerL-MFRingDz << ") with no rotation"; @@ -331,13 +330,13 @@ static long algorithm(Detector& /* description */, << " Rout " << rout << " ZHalf " << MFRingDz; Volume outmfr = ns.addVolumeNS(Volume(name, solid, ns.material(MFExtRingMat))); - layer.placeVolume(outmfr,Position(0.0, 0.0, -0.5*layerL+MFRingDz)); // CopyNr=1 - layer.placeVolume(outmfr,Position(0.0, 0.0, +0.5*layerL+MFRingDz)); // CopyNr=2 + layer.placeVolume(outmfr, 1, Position(0.0, 0.0, -0.5*layerL+MFRingDz)); // CopyNr=1 + layer.placeVolume(outmfr, 2, Position(0.0, 0.0, +0.5*layerL+MFRingDz)); // CopyNr=2 LogDebug("TIBGeom") << outmfr.name() << " number 1 and 2 positioned in " << layer.name() << " at (0,0,+-" << 0.5*layerL-MFRingDz << ") with no rotation"; - + // //Central Support rings // // Ring 1 @@ -354,7 +353,7 @@ static long algorithm(Detector& /* description */, << " ZHalf " << centDz; Volume cent1 = ns.addVolumeNS(Volume(name, solid, ns.material(centMat))); - layer.placeVolume(cent1,Position(0.0, 0.0, centZ)); // Copy Nr = 1 + layer.placeVolume(cent1,1, Position(0.0, 0.0, centZ)); // Copy Nr = 1 LogDebug("TIBGeom") << cent1.name() << " positioned in " << layer.name() << " at (0,0," << centZ << ") with no rotation"; // Ring 2 @@ -370,15 +369,15 @@ static long algorithm(Detector& /* description */, << " ZHalf " << centDz; Volume cent2 = ns.addVolumeNS(Volume(name, solid, ns.material(centMat))); - layer.placeVolume(cent2, Position(0e0,0e0,centZ)); // copyNr=1 + layer.placeVolume(cent2, 1, Position(0e0,0e0,centZ)); // copyNr=1 LogDebug("TIBGeom") << cent2.name() << " positioned in " << layer.name() << " at (0,0," << centZ << ") with no rotation"; - + // ////// DOHM // // Preparing DOHM Carrier solid - + // name = idName + "DOHMCarrier"; double dohmCarrierRin = MFRingOutR - MFRingT; double dohmCarrierRout = MFRingOutR; @@ -452,26 +451,24 @@ static long algorithm(Detector& /* description */, Volume dohmCarrier = ns.addVolumeNS(Volume(name,solid,ns.material(dohmCarrierMaterial))); int primReplica = 0; int auxReplica = 0; - - for (int i = 0; i < placeDohm*((int)(dohmList.size())); i++) { - double phi = (std::abs(dohmList[i])+0.5-1.)*dphi; - double phix = phi + 90*CLHEP::deg; - double theta = 90*CLHEP::deg; - double phiy = phix + 90.*CLHEP::deg; +#if 0 + for ( size_t i = 0; i < placeDohm*dohmList.size(); i++ ) { + double phi = (std::abs(dohmList[i])+0.5-1.)*dphi; + double phix = phi + 90*CLHEP::deg; + double theta = 90*CLHEP::deg; + double phiy = phix + 90.*CLHEP::deg; dohmRotation = make_rotation3D(theta, phix, theta, phiy, 0., 0.); - string dohmName; - int dohmReplica = 0; + int dohmReplica = 0; double dohmZ = 0.; Volume dohm; - + if(dohmList[i]<0.) { // Place a Auxiliary DOHM - dohm = ns.volume(dohmAuxName); + dohm = ns.volume(dohmAuxName); dohmZ = dohmCarrierDz - 0.5*dohmAuxL - dohmtoMF; primReplica++; dohmReplica = primReplica; - } else { // Place a Primary DOHM dohm = ns.volume(dohmPrimName); @@ -479,22 +476,23 @@ static long algorithm(Detector& /* description */, auxReplica++; dohmReplica = auxReplica; } - Position dohmTrasl(dohmR*cos(phi), dohmR*sin(phi), dohmZ); - dohmCarrier.placeVolume(dohm,Transform3D(dohmRotation,dohmTrasl)); + dohmCarrier.placeVolume(dohm,dohmReplica,Transform3D(dohmRotation,dohmTrasl)); LogDebug("TIBGeom") << dohm.name() << " replica " << dohmReplica << " positioned in " << dohmCarrier.name() << " at " << dohmTrasl << " with " << dohmRotation; } - - layer.placeVolume(dohmCarrier, Transform3D(rotation,tran));// copyNr = dohmCarrierReplica +#else + LogWarn("TIBGeom") << "DOOHM placement sucks for Geant4. ERASED!"; +#endif + layer.placeVolume(dohmCarrier, dohmCarrierReplica, Transform3D(rotation,tran));// copyNr = dohmCarrierReplica LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << dohmCarrier.name() << " positioned in " << mother << " replica " << dohmCarrierReplica << " at " << tran << " with " << rotation; } - + // ////// PILLARS for (int j = 0; j<4; j++) { vector<double> pillarZ; @@ -553,7 +551,7 @@ static long algorithm(Detector& /* description */, if( pillarPhi[i]>0. ) { pillarTran = Position(0., 0., pillarZ[i]); pillarRota = make_rotation3D(90.*CLHEP::deg, pillarPhi[i], 90.*CLHEP::deg, 90.*CLHEP::deg+pillarPhi[i], 0., 0.); - layer.placeVolume(Pillar,Transform3D(pillarRota,pillarTran)); // copyNr i + layer.placeVolume(Pillar,i,Transform3D(pillarRota,pillarTran)); // copyNr i LogDebug("TIBGeom") << Pillar.name() << " positioned in " << mother << " at " << pillarTran << " with " << pillarRota diff --git a/DDCMS/src/plugins/DDTIDModuleAlgo.cpp b/DDCMS/src/plugins/DDTIDModuleAlgo.cpp index b762fe977a5021d2066f50400a76f89a2c9cc7d7..1e46baa5cf75244e2a393577a86adf511a8c1b60 100644 --- a/DDCMS/src/plugins/DDTIDModuleAlgo.cpp +++ b/DDCMS/src/plugins/DDTIDModuleAlgo.cpp @@ -282,7 +282,7 @@ static long algorithm(Detector& /* description */, Volume holeFrame = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); rot = ns.rotation(holeFrameRot[k]); - sideFrame.placeVolume(holeFrame,Transform3D(rot,Position(0e0,0e0,zpos)));// copyNr=1 + sideFrame.placeVolume(holeFrame,1,Transform3D(rot,Position(0e0,0e0,zpos)));// copyNr=1 LogDebug("TIDGeom") << holeFrame.name() << " number 1 positioned in " << sideFrame.name() << " at (0,0," << zpos << ") with no rotation"; @@ -374,7 +374,7 @@ static long algorithm(Detector& /* description */, Volume holeKapton = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); rot = ns.rotation(holeKaptonRot[k]); - kapton.placeVolume(holeKapton, Transform3D(rot,Position(xpos, 0.0, zpos))); + kapton.placeVolume(holeKapton, 1, Transform3D(rot,Position(xpos, 0.0, zpos))); LogDebug("TIDGeom") << holeKapton.name() << " number 1 positioned in " << kapton.name() << " at (0,0," << zpos << ") with no rotation"; @@ -419,7 +419,7 @@ static long algorithm(Detector& /* description */, Volume active = ns.addVolumeNS(Volume(name, solid, ns.material(activeMat))); rot = ns.rotation(activeRot); Position tran(0.0,-0.5 * backplaneThick[k],0.0); // from the definition of the wafer local axes - wafer.placeVolume(active, Transform3D(rot,tran)); // inactive backplane copyNr=1 + wafer.placeVolume(active, 1, Transform3D(rot,tran)); // inactive backplane copyNr=1 LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() << " number 1 positioned in " << wafer.name() << " at " << tran << " with " << rot; diff --git a/DDCMS/src/plugins/DDTIDModulePosAlgo.cpp b/DDCMS/src/plugins/DDTIDModulePosAlgo.cpp index d9e1bfdbdaa3e39cb4910e2eb9181cb16327906e..b61892720ea0b9164fd75a0034b6dc697647c8b2 100644 --- a/DDCMS/src/plugins/DDTIDModulePosAlgo.cpp +++ b/DDCMS/src/plugins/DDTIDModulePosAlgo.cpp @@ -184,7 +184,7 @@ static long algorithm(Detector& /* description */, zpos = zCool-zCenter; for ( int j2=0; j2<2; j2++) { copy++; - parentVol.placeVolume(ns.volume(name),Position(xpos,ypos,zpos)); + parentVol.placeVolume(ns.volume(name),copy,Position(xpos,ypos,zpos)); LogDebug("TIDGeom") << name <<" number " << copy << " positioned in " << parentName << " at " << Position(xpos,ypos,zpos) << " with " << rot; @@ -203,7 +203,7 @@ static long algorithm(Detector& /* description */, zBotSpacers = 0.5*botSpacersHeight; } zpos = zBotSpacers - zCenter; - parentVol.placeVolume(ns.volume(name),Position(0.0,ypos,zpos)); + parentVol.placeVolume(ns.volume(name),1,Position(0.0,ypos,zpos)); LogDebug("TIDGeom") << name <<" number " << 1 << " positioned in " << parentName << " at " << Position(0.0,ypos,zpos) << " with no rotation"; @@ -233,7 +233,7 @@ static long algorithm(Detector& /* description */, // tilt Side Spacers (parallel to Side Frame) thetax = 90.*CLHEP::deg+thetaz; rot = make_rotation3D(thetax, phix, thetay, phiy, thetaz, phiz); - parentVol.placeVolume(ns.volume(name),Transform3D(rot,Position(xpos,ypos,zpos))); + parentVol.placeVolume(ns.volume(name),copy,Transform3D(rot,Position(xpos,ypos,zpos))); LogDebug("TIDGeom") << name <<" number " << copy << " positioned in " << parentName << " at " << Position(xpos,ypos,zpos) << " with " << rot; xpos = -xpos; @@ -257,7 +257,7 @@ static long algorithm(Detector& /* description */, Position tran(xpos, ypos, zpos); rot = ns.rotation(waferRot[k]); - parentVol.placeVolume(ns.volume(name),Transform3D(rot,tran)); // copyNr=k+1 + parentVol.placeVolume(ns.volume(name),k+1,Transform3D(rot,tran)); // copyNr=k+1 LogDebug("TIDGeom") << name <<" number " << k+1 << " positioned in " << parentName << " at " << tran << " with " << rot; @@ -278,7 +278,7 @@ static long algorithm(Detector& /* description */, zpos = zPitch - zCenter; rot = ns.rotation(pitchRot[k]); tran = Position(xpos,ypos,zpos); - parentVol.placeVolume(ns.volume(name),Transform3D(rot,tran)); // copyNr=k+1 + parentVol.placeVolume(ns.volume(name),k+1,Transform3D(rot,tran)); // copyNr=k+1 LogDebug("TIDGeom") << name <<" number " << k+1 << " positioned in " << parentName << " at " << tran << " with " << rot; @@ -293,7 +293,7 @@ static long algorithm(Detector& /* description */, } zpos = zHybrid - zCenter; tran = Position(0,ypos,zpos); - parentVol.placeVolume(ns.volume(name),tran); // copyNr=k+1 + parentVol.placeVolume(ns.volume(name),k+1,tran); // copyNr=k+1 LogDebug("TIDGeom") << name <<" number " << k+1 << " positioned in " << parentName << " at " << tran; // Box frame @@ -307,7 +307,7 @@ static long algorithm(Detector& /* description */, } zpos = zBoxFrame - zCenter; tran = Position(0,ypos,zpos); - parentVol.placeVolume(ns.volume(name),tran); // copyNr=k+1 + parentVol.placeVolume(ns.volume(name),k+1,tran); // copyNr=k+1 LogDebug("TIDGeom") << name <<" number " << k+1 << " positioned in " << parentName << " at " << tran; // Side frame @@ -322,7 +322,7 @@ static long algorithm(Detector& /* description */, zpos = zSideFrame-zCenter; rot = ns.rotation(sideFrameRot[k]); tran = Position(0,ypos,zpos); - parentVol.placeVolume(ns.volume(name),Transform3D(rot,tran)); + parentVol.placeVolume(ns.volume(name),k+1,Transform3D(rot,tran)); LogDebug("TIDGeom") << name <<" number " << k+1 << " positioned in " << parentName << " at " << tran << " with " << rot; @@ -343,7 +343,7 @@ static long algorithm(Detector& /* description */, zpos = zKapton-zCenter; rot = ns.rotation(kaptonRot[k]); tran = Position(0,ypos,zpos); - parentVol.placeVolume(ns.volume(name),Transform3D(rot,tran)); + parentVol.placeVolume(ns.volume(name),k+1,Transform3D(rot,tran)); LogDebug("TIDGeom") << name <<" number " << k+1 << " positioned in " << parentName << " at " << tran << " with " << rot; diff --git a/DDCMS/src/plugins/DDTIDRingAlgo.cpp b/DDCMS/src/plugins/DDTIDRingAlgo.cpp index d646bd04d558bd93443c2872b57bb0660bd7189d..fc0a1cff2452d2e106a7a9c9334953d6c85ecf5c 100644 --- a/DDCMS/src/plugins/DDTIDRingAlgo.cpp +++ b/DDCMS/src/plugins/DDTIDRingAlgo.cpp @@ -85,7 +85,7 @@ static long algorithm(Detector& /* description */, Position trmod(xpos, ypos, zpos); Rotation3D rotation = make_rotation3D(theta, phix, thetay, phiy, theta, phiz); // int copyNr = i+1; - /* PlacedVolume pv = */ mother.placeVolume(module, Transform3D(rotation,trmod)); + /* PlacedVolume pv = */ mother.placeVolume(module, i+1, Transform3D(rotation,trmod)); LogDebug("TIDGeom") << module.name() << " number " << i+1 << " positioned in " << mother.name() << " at " << trmod << " with " << rotation; @@ -101,7 +101,7 @@ static long algorithm(Detector& /* description */, } // int copyNr = i+1; Position tricc(xpos, ypos, zpos); - /* PlacedVolume pv = */ mother.placeVolume(icc, Transform3D(rotation,tricc)); + /* PlacedVolume pv = */ mother.placeVolume(icc, i+1, Transform3D(rotation,tricc)); LogDebug("TIDGeom") << iccName << " number " << i+1 << " positioned in " << mother.name() << " at " << tricc << " with " << rotation; diff --git a/DDCMS/src/plugins/DDTOBAxCableAlgo.cpp b/DDCMS/src/plugins/DDTOBAxCableAlgo.cpp index ed8042acb0794a799004e12615c86eba16a103e8..dcc720f1319fcdaf6fdccdec131a7f32da1fc5b9 100644 --- a/DDCMS/src/plugins/DDTOBAxCableAlgo.cpp +++ b/DDCMS/src/plugins/DDTOBAxCableAlgo.cpp @@ -92,7 +92,7 @@ static long algorithm(Detector& /* description */, << (startphi+deltaphi)/CLHEP::deg << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; Volume sectorLogic = ns.addVolume(Volume(name,solid, ns.material(sectorMaterial_A[i]))); - tubsVol.placeVolume(sectorLogic); // copyNr: i+1 + tubsVol.placeVolume(sectorLogic,i+1); // copyNr: i+1 LogDebug("TOBGeom") << sectorLogic.name() << " number " << i+1 << " positioned in " << tubsName << " with no translation and no rotation"; @@ -109,7 +109,7 @@ static long algorithm(Detector& /* description */, << " ZHalf " << dz; sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_B[i]))); - tubsVol.placeVolume(sectorLogic); // copyNr: i+1 + tubsVol.placeVolume(sectorLogic,i+1); // copyNr: i+1 LogDebug("TOBGeom") << sectorLogic.name() << " number " << i+1 << " positioned in " << tubsName << " with no translation and no rotation"; @@ -125,7 +125,7 @@ static long algorithm(Detector& /* description */, << (startphi+deltaphi)/CLHEP::deg << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_C[i]))); - tubsVol.placeVolume(sectorLogic); // copyNr: i+1 + tubsVol.placeVolume(sectorLogic,i+1); // copyNr: i+1 LogDebug("TOBGeom") << sectorLogic.name() << " number " << i+1 << " positioned in " << tubsName << " with no translation and no rotation"; diff --git a/DDCMS/src/plugins/DDTOBRadCableAlgo.cpp b/DDCMS/src/plugins/DDTOBRadCableAlgo.cpp index 96ed78ab947b62c107c5900dc9da73da8b914c16..407589eae5c3e7563a20a143f881084062772f75 100644 --- a/DDCMS/src/plugins/DDTOBRadCableAlgo.cpp +++ b/DDCMS/src/plugins/DDTOBRadCableAlgo.cpp @@ -104,7 +104,7 @@ static long algorithm(Detector& /* description */, << " R torus " << coolR1[i]; Volume coolManifoldLogic_a = ns.addVolume(Volume(name,solid,ns.material(coolM1))); Position r1(0, 0, (dz-diskDz)); - disk.placeVolume(coolManifoldLogic_a,r1); // i+1 + disk.placeVolume(coolManifoldLogic_a,i+1,r1); // i+1 LogDebug("TOBGeom") << name << " number " << i+1 << " positioned in " << disk.name() << " at " << r1 << " with no rotation"; @@ -118,7 +118,7 @@ static long algorithm(Detector& /* description */, << " with Rin " << coolRin << " Rout " << coolRout2 << " R torus " << coolR1[i]; Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(name,solid,ns.material(coolM2))); - disk.placeVolume(coolManifoldFluidLogic_a); // i+1 + disk.placeVolume(coolManifoldFluidLogic_a,i+1); // i+1 LogDebug("TOBGeom") << name << " number " << i+1 << " positioned in " << coolM2 << " with no translation and no rotation"; @@ -133,7 +133,7 @@ static long algorithm(Detector& /* description */, << " R torus " << coolR2[i]; Volume coolManifoldLogic_r = ns.addVolume(Volume(name,solid,ns.material(coolM1))); r1 = Position(0, 0, (dz-diskDz)); - disk.placeVolume(coolManifoldLogic_r, r1); // i+1 + disk.placeVolume(coolManifoldLogic_r, i+1, r1); // i+1 LogDebug("TOBGeom") << name << " number " << i+1 << " positioned in " << disk.name() << " at " << r1 << " with no rotation"; @@ -147,7 +147,7 @@ static long algorithm(Detector& /* description */, << " with Rin " << coolRin << " Rout " << coolRout2 << " R torus " << coolR2[i]; Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(name, solid, ns.material(coolM2))); - disk.placeVolume(coolManifoldFluidLogic_r); // i+1 + disk.placeVolume(coolManifoldFluidLogic_r,i+1); // i+1 LogDebug("TOBGeom") << name << " number " << i+1 << " positioned in " << coolM2 << " with no translation and no rotation"; @@ -164,7 +164,7 @@ static long algorithm(Detector& /* description */, << " ZHalf " << dz; Volume connLogic = ns.addVolume(Volume(name, solid, ns.material(connM[i]))); Position r2(0, 0, (dz-diskDz)); - disk.placeVolume(connLogic,r2); // i+1 + disk.placeVolume(connLogic,i+1,r2); // i+1 LogDebug("TOBGeom") << name << " number " << i+1 << " positioned in " << disk.name() << " at " << r2 << " with no rotation"; @@ -195,7 +195,7 @@ static long algorithm(Detector& /* description */, << "\tRmin = " << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii]; Volume cableLogic = ns.addVolume(Volume(name, solid, ns.material(cableM[i]))); Position r3(0, 0, (diskDz-(i+0.5)*cableT)); - disk.placeVolume(cableLogic, r3); // i+1 + disk.placeVolume(cableLogic, i+1, r3); // i+1 LogDebug("TOBGeom") << name << " number " <<i+1 << " positioned in " << disk.name() << " at " << r3 << " with no rotation"; diff --git a/DDCMS/src/plugins/DDTOBRodAlgo.cpp b/DDCMS/src/plugins/DDTOBRodAlgo.cpp index 50d52780f87e2c82b8e374ce23c1c84e53b78245..8d7bbcc6e28acf562a613e5c5f896730971244da 100644 --- a/DDCMS/src/plugins/DDTOBRodAlgo.cpp +++ b/DDCMS/src/plugins/DDTOBRodAlgo.cpp @@ -157,7 +157,7 @@ static long algorithm(Detector& /* description */, for (int j=0; j<(int)(sideRodX.size()); j++) { Position r(sideRodX[j], sideRodY[i], sideRodZ[i]); child = sideRod[i]; - rod.placeVolume(ns.volume(child), /* j+1, */ r); + rod.placeVolume(ns.volume(child), j+1, r); LogDebug("TOBGeom") << child << " number " << j+1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -166,7 +166,7 @@ static long algorithm(Detector& /* description */, for (int i=0; i<(int)(clampX.size()); i++) { Position r(clampX[i], 0, shift+clampZ[i]); child = clamp; - rod.placeVolume(ns.volume(child), /* i+1, */ r); + rod.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -174,7 +174,7 @@ static long algorithm(Detector& /* description */, for (int i=0; i<(int)(sideCoolX.size()); i++) { Position r(sideCoolX[i], sideCoolY[i], shift+sideCoolZ[i]); child = sideCool; - rod.placeVolume(ns.volume(child), /* i+1, */ r); + rod.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -182,7 +182,7 @@ static long algorithm(Detector& /* description */, for (int i=0; i<(int)(optFibreX.size()); i++) { Position r(optFibreX[i], 0, shift+optFibreZ[i]); child = optFibre; - rod.placeVolume(ns.volume(child), /* i+1, */ r); + rod.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -192,7 +192,7 @@ static long algorithm(Detector& /* description */, int j = i/2; Position r(sideClampX[i],moduleY[j],shift+moduleZ[j]+sideClamp1DZ[i]); child = sideClamp1; - rod.placeVolume(ns.volume(child), /* i+1, */ r); + rod.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -200,7 +200,7 @@ static long algorithm(Detector& /* description */, int j = i/2; Position r(sideClampX[i],moduleY[j],shift+moduleZ[j]+sideClamp2DZ[i]); child = sideClamp2; - rod.placeVolume(ns.volume(child), /* i+1, */ r); + rod.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -210,13 +210,13 @@ static long algorithm(Detector& /* description */, for (int i=0; i<(int)(endRod1Y.size()); i++) { Position r(0, endRod1Y[i], shift+endRod1Z[i]); child = endRod1; - cent.placeVolume(ns.volume(child), /* i+1, */ r); + cent.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << centName << " at " << r << " with no rotation"; } Position r1(0, endRod2Y, shift+endRod2Z); child = endRod2; - cent.placeVolume(ns.volume(child), /* 1, */ r1); + cent.placeVolume(ns.volume(child), 1, r1); LogDebug("TOBGeom") << child << " number 1 " << "positioned in " << centName << " at " << r1 << " with no rotation"; @@ -224,14 +224,14 @@ static long algorithm(Detector& /* description */, Position r2(0, endCoolY, shift+endCoolZ); Rotation3D rot2 = ns.rotation(endCoolRot); child = endCool; - cent.placeVolume(ns.volume(child), /* 1, */ Transform3D(rot2,r2)); + cent.placeVolume(ns.volume(child), 1, Transform3D(rot2,r2)); LogDebug("TOBGeom") << child << " number 1 " << "positioned in " << centName << " at " << r2 << " with " << rot2; //Mother cable Position r3(0, 0, shift+cableZ); child = cable; - cent.placeVolume(ns.volume(child), /* 1, */ r3); + cent.placeVolume(ns.volume(child), 1, r3); LogDebug("TOBGeom") << child << " number 1 " << "positioned in " << centName << " at " << r3 << " with no rotation"; @@ -240,7 +240,7 @@ static long algorithm(Detector& /* description */, Position r(0, moduleY[i], shift+moduleZ[i]); Rotation3D rot = ns.rotation(moduleRot[i]); child = module; - cent.placeVolume(ns.volume(child), /* i+1, */ Transform3D(rot,r)); + cent.placeVolume(ns.volume(child), i+1, Transform3D(rot,r)); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << centName << " at " << r << " with " << rot; @@ -250,7 +250,7 @@ static long algorithm(Detector& /* description */, for (int i=0; i<(int)(connect.size()); i++) { Position r(0, connectY[i], shift+connectZ[i]); child = connect[i]; - cent.placeVolume(ns.volume(child), /* i+1, */ r); + cent.placeVolume(ns.volume(child), i+1, r); LogDebug("TOBGeom") << child << " number " << i+1 << " positioned in " << centName << " at " << r << " with no rotation"; } @@ -263,7 +263,7 @@ static long algorithm(Detector& /* description */, copyNumber++; Position r(aohX[i] + 0, aohY[i] + connectY[i], aohZ[i] + shift+connectZ[i]); child = aohName; - cent.placeVolume(ns.volume(child), r); // copyNumber + cent.placeVolume(ns.volume(child), copyNumber, r); LogDebug("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r << " with no rotation"; // if two copies add a copy with (-aohX,-aohZ) translation @@ -271,7 +271,7 @@ static long algorithm(Detector& /* description */, copyNumber++; r = Position(-aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift+connectZ[i]); child = aohName; - cent.placeVolume(ns.volume(child), r); // copyNumber + cent.placeVolume(ns.volume(child), copyNumber, r); LogDebug("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r << " with no rotation"; } @@ -284,18 +284,19 @@ static long algorithm(Detector& /* description */, switch(j) { case 1: rr = Position(-aohX[i] + 0, aohY[i] + connectY[i], +aohZ[i] + shift+connectZ[i]); - cent.placeVolume(ns.volume(child), rr); // copyNumber + cent.placeVolume(ns.volume(child), copyNumber, rr); // copyNumber break; case 2: rr = Position(-aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift+connectZ[i]); - cent.placeVolume(ns.volume(child), rr); // copyNumber + cent.placeVolume(ns.volume(child), copyNumber, rr); // copyNumber break; case 3: rr = Position(+aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift+connectZ[i]); - cent.placeVolume(ns.volume(child), rr); // copyNumber + cent.placeVolume(ns.volume(child), copyNumber, rr); // copyNumber break; } - LogDebug("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " + LogDebug("TOBGeom") << child << " number " << copyNumber + << " positioned in " << centName << " at " << rr << " with no rotation"; } } diff --git a/DDCMS/src/plugins/DDTrackerAngular.cpp b/DDCMS/src/plugins/DDTrackerAngular.cpp index 7611265dca02e9dca0bbb6d8b64b3b4589c5055d..884ccac57bf34e2723b80eba50d3739a3120b182 100644 --- a/DDCMS/src/plugins/DDTrackerAngular.cpp +++ b/DDCMS/src/plugins/DDTrackerAngular.cpp @@ -88,7 +88,7 @@ static long algorithm(Detector& /* description */, double ypos = radius*sin(phi) + center[1]; double zpos = center[2]; Position tran(xpos, ypos, zpos); - mother.placeVolume(child, Transform3D(rotation,tran)); + mother.placeVolume(child, copy, Transform3D(rotation,tran)); LogDebug("TrackerGeom") << "test " << child.name() << " number " << copy << " positioned in " << mother.name() << " at " << tran << " with " << rotation; diff --git a/DDCMS/src/plugins/DDTrackerLinear.cpp b/DDCMS/src/plugins/DDTrackerLinear.cpp index 2d95337847ac8452498c82fd764eb1956d9a003c..ae73a89f96cf66d3571193cd6ade04bd3367f7dc 100644 --- a/DDCMS/src/plugins/DDTrackerLinear.cpp +++ b/DDCMS/src/plugins/DDTrackerLinear.cpp @@ -62,8 +62,8 @@ static long algorithm(Detector& /* description */, Position tran = base + (offset + double(i)*delta)*direction; // Copy number ??? /* PlacedVolume pv = */ rotMat.empty() - ? mother.placeVolume(child,Transform3D(rot,tran)) - : mother.placeVolume(child,tran); + ? mother.placeVolume(child,ci,Transform3D(rot,tran)) + : mother.placeVolume(child,ci,tran); LogDebug("TrackerGeom") << child.name() << " number " << ci << " positioned in " << mother.name() << " at " << tran << " with " << rot; diff --git a/DDCMS/src/plugins/DDTrackerPhiAlgo.cpp b/DDCMS/src/plugins/DDTrackerPhiAlgo.cpp index 29119f4d387fdb762e10a3e17f27aecc8e15d865..4061337fad2da5fcede125bd643cfa6764d3c090 100644 --- a/DDCMS/src/plugins/DDTrackerPhiAlgo.cpp +++ b/DDCMS/src/plugins/DDTrackerPhiAlgo.cpp @@ -66,7 +66,7 @@ static long algorithm(Detector& /* description */, double ypos = radius*sin(phi[i]); Rotation3D rot = make_rotation3D(theta, phix, theta, phiy, 0., 0.); Position tran(xpos, ypos, zpos[i]); - /* PlacedVolume pv = */ mother.placeVolume(child,Transform3D(rot,tran)); + /* PlacedVolume pv = */ mother.placeVolume(child,ci,Transform3D(rot,tran)); LogDebug("TrackerGeom") << "test: " << child.name() << " number " << ci << " positioned in " << mother.name() << " at " << tran << " with " << rot; diff --git a/DDCMS/src/plugins/DDTrackerPhiAltAlgo.cpp b/DDCMS/src/plugins/DDTrackerPhiAltAlgo.cpp index 5ad9bdaa6d1e47520025b52c39d7f8d608ab5c7d..a4bddaf1e6aee3fd0dfbcec7dc0151b9d25fce8d 100644 --- a/DDCMS/src/plugins/DDTrackerPhiAltAlgo.cpp +++ b/DDCMS/src/plugins/DDTrackerPhiAltAlgo.cpp @@ -80,7 +80,7 @@ static long algorithm(Detector& /* description */, ypos = radiusOut*sin(phi); } Position tran(xpos, ypos, zpos); - /* PlacedVolume pv = */ mother.placeVolume(child,Transform3D(rotation,tran)); + /* PlacedVolume pv = */ mother.placeVolume(child,copyNo,Transform3D(rotation,tran)); LogDebug("TrackerGeom") << "" << child.name() << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " diff --git a/DDCMS/src/plugins/DDTrackerXYZPosAlgo.cpp b/DDCMS/src/plugins/DDTrackerXYZPosAlgo.cpp index d2d9c8a889325b931f786eb746c1ad5c17e07cd3..fa4d908702fa50304af8c968c96384d922d9d437 100644 --- a/DDCMS/src/plugins/DDTrackerXYZPosAlgo.cpp +++ b/DDCMS/src/plugins/DDTrackerXYZPosAlgo.cpp @@ -51,16 +51,15 @@ static long algorithm(Detector& /* description */, << ", Rot.Matrix = " << rotMat[i]; } - for (int i=0, copy = startCopyNo; i<(int)(zvec.size()); i++) { + for (int i=0, copy = startCopyNo; i<(int)(zvec.size()); i++, copy += incrCopyNo) { Position tran(xvec[i], yvec[i], zvec[i]); Rotation3D rot; /* PlacedVolume pv = */ rotMat[i] != "NULL" - ? mother.placeVolume(child,Transform3D(ns.rotation(rotMat[i]),tran)) + ? mother.placeVolume(child,copy,Transform3D(ns.rotation(rotMat[i]),tran)) : mother.placeVolume(child,tran); LogDebug("TrackerGeom") << "test: " << child.name() <<" number " << copy << " positioned in " << mother.name() << " at " << tran << " with " << rot; - copy += incrCopyNo; } return 1; } diff --git a/DDCMS/src/plugins/DDTrackerZPosAlgo.cpp b/DDCMS/src/plugins/DDTrackerZPosAlgo.cpp index c7e97b94bcb9350aa2ffb75cb19ff202cba4c415..5a356d8620d8d44e13fadcaada6ab7e5f5070e20 100644 --- a/DDCMS/src/plugins/DDTrackerZPosAlgo.cpp +++ b/DDCMS/src/plugins/DDTrackerZPosAlgo.cpp @@ -31,7 +31,7 @@ static long algorithm(Detector& /* description */, Namespace ns(ctxt, e, true); AlgoArguments args(ctxt, e); int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1; - int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1; + int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1; Volume mother = ns.volume(args.parentName()); Volume child = ns.volume(args.value<string>("ChildName")); vector<double> zvec = args.value<vector<double> >("ZPositions"); // Z positions @@ -45,16 +45,15 @@ static long algorithm(Detector& /* description */, LogDebug("TrackerGeom") << "\t[" << i << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; - for (int i=0, copy = startCopyNo; i<(int)(zvec.size()); i++) { + for (int i=0, copy = startCopyNo; i<(int)(zvec.size()); i++, copy += incrCopyNo) { Position tran(0, 0, zvec[i]); Rotation3D rot; /* PlacedVolume pv = */ rotMat[i] != "NULL" - ? mother.placeVolume(child,Transform3D(ns.rotation(rotMat[i]),tran)) - : mother.placeVolume(child,tran); + ? mother.placeVolume(child,copy,Transform3D(ns.rotation(rotMat[i]),tran)) + : mother.placeVolume(child,copy,tran); LogDebug("TrackerGeom") << "test: " << child.name() <<" number " << copy << " positioned in " << mother.name() << " at " << tran << " with " << rot; - copy += incrCopyNo; } return 1; } diff --git a/DDCore/include/DD4hep/DD4hepUI.h b/DDCore/include/DD4hep/DD4hepUI.h index b03a39274643cbf215991bfcee2b3a981e4c71a3..33bfb4fa73938477bd620239c1d39bddb954d5a1 100644 --- a/DDCore/include/DD4hep/DD4hepUI.h +++ b/DDCore/include/DD4hep/DD4hepUI.h @@ -54,6 +54,11 @@ namespace dd4hep { /// Install the dd4hep alignment manager object Handle<NamedObject> alignmentMgr() const; + /// Create ROOT interpreter instance + long createInterpreter(int argc, char** argv); + /// Execute ROOT interpreter instance + long runInterpreter() const; + /// Detector interface: Manipulate geometry using factory converter virtual long apply(const char* factory, int argc, char** argv) const; /// Detector interface: Read any geometry description or alignment file diff --git a/DDCore/include/DD4hep/VolumeProcessor.h b/DDCore/include/DD4hep/VolumeProcessor.h index f1bedab307bfbd7d0476da97741f35a271a4d5e2..403f34beca41fc5a8dbdfb0cbf351916c7e13eda 100644 --- a/DDCore/include/DD4hep/VolumeProcessor.h +++ b/DDCore/include/DD4hep/VolumeProcessor.h @@ -47,9 +47,9 @@ namespace dd4hep { /// Default assignment PlacedVolumeProcessor& operator=(const PlacedVolumeProcessor& copy) = default; /// Callback to output PlacedVolume information of an single Placement - virtual int operator()(PlacedVolume pv, int level) const = 0; + virtual int operator()(PlacedVolume pv, int level) = 0; /// Callback to output PlacedVolume information of an entire Placement - virtual int process(PlacedVolume pv, int level, bool recursive) const; + virtual int process(PlacedVolume pv, int level, bool recursive); }; /// PlacedVolume scanner using a Processor object @@ -83,7 +83,7 @@ namespace dd4hep { /// Default assignment PlacementProcessor& operator=(const PlacementProcessor& copy) = default; /// Callback to output detector information of an single placement - virtual int operator()(PlacedVolume pv, int level) const final + virtual int operator()(PlacedVolume pv, int level) final { return (processor)(pv, level); } }; @@ -115,7 +115,7 @@ namespace dd4hep { /// Default assignment PlacementProcessorShared& operator=(const PlacementProcessorShared& copy) = default; /// Callback to output detector information of an single DetElement - virtual int operator()(PlacedVolume pv, int level) const final + virtual int operator()(PlacedVolume pv, int level) final { return (*processor)(pv, level); } }; @@ -161,13 +161,16 @@ namespace dd4hep { PlacedVolumeScanner(const Q& proc, PlacedVolume start, int level=0, bool recursive=true) { scan(proc, start, level, recursive); } + /// PlacedVolume element tree scanner using wrapped PlacedVolumeProcessor objects + int scanPlacements(PlacedVolumeProcessor& proc, PlacedVolume start, int level=0, bool recursive=true) const { + return proc.process(start, level, recursive); + } /// PlacedVolume element tree scanner using wrapped PlacedVolumeProcessor objects template <typename Q> int scan(Q& p, PlacedVolume start, int level=0, bool recursive=true) const { auto proc = placementProcessor(p); return proc.process(start, level, recursive); } - /// PlacedVolume element tree scanner using wrapped PlacedVolumeProcessor objects template <typename Q> int scan(const Q& p, PlacedVolume start, int level=0, bool recursive=true) const { diff --git a/DDCore/include/DD4hep/Volumes.h b/DDCore/include/DD4hep/Volumes.h index 3f340579740277be1103dd6651cd8db262165448..f719b195547dcade2ba78ceca7dec10ef1b3842a 100644 --- a/DDCore/include/DD4hep/Volumes.h +++ b/DDCore/include/DD4hep/Volumes.h @@ -269,6 +269,8 @@ namespace dd4hep { /// Check if placement is properly instrumented Object* data() const; + + /** Daughter placements with auto-generated copy number for the daughter volume */ /// Place daughter volume. The position and rotation are the identity PlacedVolume placeVolume(const Volume& vol) const; /// Place daughter volume according to a generic Transform3D @@ -280,6 +282,18 @@ namespace dd4hep { /// Place rotated daughter volume. The position is automatically the identity position PlacedVolume placeVolume(const Volume& vol, const Rotation3D& rot) const; + /** Daughter placements with user supplied copy number for the daughter volume */ + /// Place daughter volume. The position and rotation are the identity + PlacedVolume placeVolume(const Volume& vol, int copy_no) const; + /// Place daughter volume according to a generic Transform3D + PlacedVolume placeVolume(const Volume& volume, int copy_no, const Transform3D& tr) const; + /// Place un-rotated daughter volume at the given position. + PlacedVolume placeVolume(const Volume& vol, int copy_no, const Position& pos) const; + /// Place rotated daughter volume. The position is automatically the identity position + PlacedVolume placeVolume(const Volume& vol, int copy_no, const RotationZYX& rot) const; + /// Place rotated daughter volume. The position is automatically the identity position + PlacedVolume placeVolume(const Volume& vol, int copy_no, const Rotation3D& rot) const; + /// Attach attributes to the volume const Volume& setAttributes(const Detector& description, const std::string& region, const std::string& limits, const std::string& vis) const; diff --git a/DDCore/include/DD4hep/detail/ObjectsInterna.h b/DDCore/include/DD4hep/detail/ObjectsInterna.h index 664c0721a96ebb5bad57cd1776de2a95c1d909a2..9cfce7c7be5e67783d7c6efd857777b4bcca3505 100644 --- a/DDCore/include/DD4hep/detail/ObjectsInterna.h +++ b/DDCore/include/DD4hep/detail/ObjectsInterna.h @@ -195,11 +195,11 @@ namespace dd4hep { typedef std::vector<std::pair<std::string, const BitFieldElement*> > FieldMap; typedef std::vector<std::pair<size_t, std::string> > FieldIDs; /// Map of id-fields in the descriptor - FieldMap fieldMap; //! not ROOT-persistent + FieldMap fieldMap; /// String map of id descriptors - FieldIDs fieldIDs; //! not ROOT-persistent + FieldIDs fieldIDs; /// Decoder object - BitFieldCoder decoder; //! not ROOT-persistent + BitFieldCoder decoder; /// The description string to build the bit-field descriptors. std::string description; @@ -218,5 +218,5 @@ namespace dd4hep { #endif #endif }; -} /* End namespace dd4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_OBJECTSINTERNA_H */ diff --git a/DDCore/include/DD4hep/detail/VolumeManagerInterna.h b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h index 1d727e739a6a2836722b4a47d76703185315f51c..893243f5b95c7cea84b5cb81625db99e7cfb1b8c 100644 --- a/DDCore/include/DD4hep/detail/VolumeManagerInterna.h +++ b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h @@ -52,19 +52,19 @@ namespace dd4hep { /// The container of placements managed by this instance std::map<VolumeID, VolumeManagerContext*> volumes; /// The Detector element handle managed by this instance - DetElement detector; + DetElement detector; /// The ID descriptor object - IDDescriptor id; + IDDescriptor id; /// The reference to the TOP level VolumeManager - VolumeManagerObject* top = 0; + VolumeManagerObject* top = 0; /// The system field descriptor - const BitFieldElement* system = 0; //! Not ROOT persistent + const BitFieldElement* system = 0; /// System identifier - VolumeID sysID = 0; + VolumeID sysID = 0; /// Sub-detector mask - VolumeID detMask = ~0x0ULL; + VolumeID detMask = ~0x0ULL; /// Population flags - int flags = VolumeManager::NONE; + int flags = VolumeManager::NONE; public: /// Default constructor VolumeManagerObject() = default; @@ -84,6 +84,6 @@ namespace dd4hep { void update(unsigned long tags, DetElement& det, void* param); }; - } /* End namespace detail */ -} /* End namespace dd4hep */ -#endif /* DD4HEP_DDCORE_VOLUMEMANAGERINTERNA_H */ + } /* End namespace detail */ +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_VOLUMEMANAGERINTERNA_H */ diff --git a/DDCore/src/DD4hepRootPersistency.cpp b/DDCore/src/DD4hepRootPersistency.cpp index 15d449ab41331e1e7c86be0cc690f6abb7d9f579..24ee51a80d8aacbc889740d96a235023884ab603 100644 --- a/DDCore/src/DD4hepRootPersistency.cpp +++ b/DDCore/src/DD4hepRootPersistency.cpp @@ -76,6 +76,7 @@ int DD4hepRootPersistency::load(Detector& description, const char* fname, const unique_ptr<DD4hepRootPersistency> persist((DD4hepRootPersistency*)f->Get(instance)); if ( persist.get() ) { DetectorData* source = persist->m_data; +#if 0 const auto& iddesc = persist->idSpecifications(); for( const auto& s : iddesc ) { IDDescriptor id = s.second; @@ -83,6 +84,7 @@ int DD4hepRootPersistency::load(Detector& description, const char* fname, const } printout(ALWAYS,"DD4hepRootPersistency", "+++ Fixed %ld IDDescriptor objects.",iddesc.size()); +#endif for( const auto& s : persist->m_segments ) { Readout ro = s.first; IDDescriptor id = s.second.first; diff --git a/DDCore/src/DD4hepUI.cpp b/DDCore/src/DD4hepUI.cpp index 23e8157931979c2be168f97e7a9585f9afe2b037..b173ab7209ecd27ad5d039b613926cb873076048 100644 --- a/DDCore/src/DD4hepUI.cpp +++ b/DDCore/src/DD4hepUI.cpp @@ -14,6 +14,7 @@ // Framework includes #include "DD4hep/DD4hepUI.h" #include "DD4hep/Printout.h" +#include "TRint.h" using namespace std; using namespace dd4hep; @@ -94,12 +95,38 @@ void DD4hepUI::redraw() const { long DD4hepUI::dumpVols(int argc, char** argv) const { if ( argc==0 ) { const void* av[] = {"-positions","-pointers",0}; - return m_detDesc.apply("DD4hepVolumeDump",2,(char**)av); + return m_detDesc.apply("DD4hep_VolumeDump",2,(char**)av); } - return m_detDesc.apply("DD4hepVolumeDump",argc,argv); + return m_detDesc.apply("DD4hep_VolumeDump",argc,argv); } /// Dump the DetElement tree long DD4hepUI::dumpDet() const { - return m_detDesc.apply("DD4hepDetectorVolumeDump",0,0); + return m_detDesc.apply("DD4hep_DetectorVolumeDump",0,0); +} + +/// Create ROOT interpreter instance +long DD4hepUI::createInterpreter(int argc, char** argv) { + if ( 0 == gApplication ) { + pair<int, char**> a(argc,argv); + gApplication = new TRint("DD4hepUI", &a.first, a.second); + printout(INFO,"DD4hepUI","++ Created ROOT interpreter instance for DD4hepUI."); + return 1; + } + printout(WARNING,"DD4hepUI", + "++ Another ROOT application instance already exists. Keep existing instance."); + return 1; +} + +/// Execute ROOT interpreter instance +long DD4hepUI::runInterpreter() const { + if ( 0 != gApplication ) { + if ( !gApplication->IsRunning() ) { + gApplication->Run(); + return 1; + } + except("DD4hepUI","++ The ROOT application is already running."); + } + except("DD4hepUI","++ No ROOT interpreter instance present!"); + return 0; } diff --git a/DDCore/src/SegmentationDictionary.h b/DDCore/src/SegmentationDictionary.h index 5253260383759518baf84f61323357845db3a8fd..4c9c429804e2c668f00c834bbee8f7446be91a52 100644 --- a/DDCore/src/SegmentationDictionary.h +++ b/DDCore/src/SegmentationDictionary.h @@ -84,7 +84,7 @@ typedef dd4hep::DDSegmentation::CellID CellID; #pragma link C++ class dd4hep::DDSegmentation::TiledLayerSegmentation+; #pragma link C++ class dd4hep::DDSegmentation::WaferGridXY+; -#pragma link C++ class dd4hep::DDSegmentation::BitFieldValue+; +#pragma link C++ class dd4hep::DDSegmentation::BitFieldElement+; #pragma link C++ class dd4hep::DDSegmentation::BitFieldCoder+; #endif // __CINT__ diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index c17e32297975c188b98220411b32786e1dd2f88f..cc6eeac1f183b82e6012ee952a549092d46a7d1b 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -287,7 +287,7 @@ namespace dd4hep { } } if ( sd.isValid() ) { - if ( !have_encoding ) { + if ( !have_encoding && !compound ) { printout(ERROR, "VolumeManager","Element %s: Missing SD encoding. Volume manager won't work!", e.path().c_str()); } @@ -368,6 +368,7 @@ namespace dd4hep { DetElement sub_detector = m_detDesc.detector(sd_name); VolumeManager section = m_volManager.addSubdetector(sub_detector, ro); + //m_debug = true; // This is the block, we effectively have to save for each physical volume with a VolID void* mem = nodes.empty() ? VolumeContextAllocator::instance()->alloc_small() diff --git a/DDCore/src/VolumeProcessor.cpp b/DDCore/src/VolumeProcessor.cpp index 84444e0850a887163e6b2eee6ef170bd3b57ad77..86a10a9630e1994e1168d3c2adfc9dd34eede325 100644 --- a/DDCore/src/VolumeProcessor.cpp +++ b/DDCore/src/VolumeProcessor.cpp @@ -22,7 +22,7 @@ PlacedVolumeProcessor::~PlacedVolumeProcessor() { } /// Callback to output PlacedVolume information of an entire DetElement -int PlacedVolumeProcessor::process(PlacedVolume pv, int level, bool recursive) const { +int PlacedVolumeProcessor::process(PlacedVolume pv, int level, bool recursive) { if ( pv.isValid() ) { int ret = (*this)(pv, level); TGeoNode* node = pv.ptr(); diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index 95f9fe4e7e5469db0a7b8b5f60bc1c3e6fdd9145..7c2a91339bafec9876f23df564af9fe529a9b3d3 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -506,13 +506,14 @@ Volume::Object* Volume::data() const { return o; } -static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, TGeoMatrix* transform) { +static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, int id, TGeoMatrix* transform) { + TGeoVolume* parent = par; + if ( !parent ) { + throw runtime_error("dd4hep: Volume: Attempt to assign daughters to an invalid physical parent volume."); + } if ( !daughter ) { throw runtime_error("dd4hep: Volume: Attempt to assign an invalid physical daughter volume."); } - TGeoVolume* parent = par; - TObjArray* a = parent->GetNodes(); - Int_t id = (a ? a->GetEntries() : 0); if (transform && transform != detail::matrix::_identity()) { string nam = string(daughter->GetName()) + "_placement"; transform->SetName(nam.c_str()); @@ -528,14 +529,25 @@ static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, TGeoMatrix* as->ComputeBBox(); } } - parent->AddNode(daughter, id, transform); - //geo_node_t* n = static_cast<geo_node_t*>(parent->GetNode(id)); + geo_node_t* n; TString nam_id = TString::Format("%s_%d", daughter->GetName(), id); - geo_node_t* n = static_cast<geo_node_t*>(parent->GetNode(nam_id)); + n = static_cast<geo_node_t*>(parent->GetNode(nam_id)); + if ( n != 0 ) { + printout(ERROR,"PlacedVolume","++ Attempt to add already exiting node %s",(const char*)nam_id); + } + parent->AddNode(daughter, id, transform); + //n = static_cast<geo_node_t*>(parent->GetNode(id)); + n = static_cast<geo_node_t*>(parent->GetNode(nam_id)); n->geo_node_t::SetUserExtension(new PlacedVolume::Object()); return PlacedVolume(n); } +static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, TGeoMatrix* transform) { + TObjArray* a = par ? par->GetNodes() : 0; + Int_t id = (a ? a->GetEntries() : 0); + return _addNode(par, daughter, id, transform); +} + /// Place daughter volume according to generic Transform3D PlacedVolume Volume::placeVolume(const Volume& volume, const Transform3D& trans) const { return _addNode(m_element, volume, detail::matrix::_transform(trans)); @@ -561,6 +573,31 @@ PlacedVolume Volume::placeVolume(const Volume& volume, const Rotation3D& rot) co return _addNode(m_element, volume, detail::matrix::_rotation3D(rot)); } +/// Place daughter volume according to generic Transform3D +PlacedVolume Volume::placeVolume(const Volume& volume, int copy_no, const Transform3D& trans) const { + return _addNode(m_element, volume, copy_no, detail::matrix::_transform(trans)); +} + +/// Place daughter volume. The position and rotation are the identity +PlacedVolume Volume::placeVolume(const Volume& volume, int copy_no) const { + return _addNode(m_element, volume, copy_no, detail::matrix::_identity()); +} + +/// Place un-rotated daughter volume at the given position. +PlacedVolume Volume::placeVolume(const Volume& volume, int copy_no, const Position& pos) const { + return _addNode(m_element, volume, copy_no, detail::matrix::_translation(pos)); +} + +/// Place rotated daughter volume. The position is automatically the identity position +PlacedVolume Volume::placeVolume(const Volume& volume, int copy_no, const RotationZYX& rot) const { + return _addNode(m_element, volume, copy_no, detail::matrix::_rotationZYX(rot)); +} + +/// Place rotated daughter volume. The position is automatically the identity position +PlacedVolume Volume::placeVolume(const Volume& volume, int copy_no, const Rotation3D& rot) const { + return _addNode(m_element, volume, copy_no, detail::matrix::_rotation3D(rot)); +} + /// Set the volume's material const Volume& Volume::setMaterial(const Material& m) const { if (m.isValid()) { diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 5574a27a67baee1dc6594028f72d9e7938359be1..3ecb221d70cda2fe73fca9b2bb33c5c6544db134 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -46,6 +46,52 @@ using namespace std; using namespace dd4hep; using namespace dd4hep::detail; + +namespace { + struct ProcessorArgs { + bool use = false; + int start = 0, end = 0, argc = 0, count=0; + std::vector<char*> argv; + ProcessorArgs(int ac, char** av) { + for(int i=0; i<ac; ++i) { + if ( 0 == ::strncmp(av[i],"-processor",6) ) { + use = true; + start = i; + } + if ( use ) { + ++argc; ++count; end = i; + if ( 0 == ::strncmp(av[i],"-end-processor",6) ) { + argv.push_back(av[i]); + return; + } + else if ( 0 == ::strncmp(av[i],"-end-plugin",4) ) { // End of current plugin + argv.push_back((char*)"-end-processor"); + return; + } + else if ( 0 == ::strncmp(av[i],"-plugin",4) ) { // Start of next plugin + argv.push_back((char*)"-end-processor"); + return; + } + argv.push_back(av[i]); + } + } + } + }; +} + +/// Dummy plugin to be able to invoke the plugin runner and e.g. only test the geometry +/** + * Factory: DD4hep_DummyPlugin + * + * \author M.Frank + * \version 1.0 + * \date 01/04/2014 + */ +static long dummy_plugin(Detector& , int, char**) { + return 1; +} +DECLARE_APPLY(DD4hep_DummyPlugin,dummy_plugin) + /// Basic entry point to create a Detector instance /** * Factory: Detector_constructor @@ -61,7 +107,7 @@ DECLARE_CONSTRUCTOR(Detector_constructor,create_description_instance) /// Basic entry point to display the currently loaded geometry using the ROOT OpenGL viewer /** - * Factory: DD4hepGeometryDisplay + * Factory: DD4hep_GeometryDisplay * * \author M.Frank * \version 1.0 @@ -97,27 +143,32 @@ static long display(Detector& description, int argc, char** argv) { } return 0; } -DECLARE_APPLY(DD4hepGeometryDisplay,display) +DECLARE_APPLY(DD4hep_GeometryDisplay,display) /// Basic entry point to start the ROOT interpreter. /** - * Factory: dd4hepRint + * Factory: DD4hep_Rint * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ static long run_interpreter(Detector& /* description */, int argc, char** argv) { - pair<int, char**> a(argc,argv); - TRint app("dd4hep", &a.first, a.second); + if ( 0 == gApplication ) { + pair<int, char**> a(argc,argv); + gApplication = new TRint("DD4hepRint", &a.first, a.second); + printout(INFO,"DD4hepRint","++ Created ROOT interpreter instance for DD4hepUI."); + } for(int i=0; i<argc; ++i) { printout(INFO,"DD4hepRint","Excecute[%d]: %s",i,argv[i]); gInterpreter->ProcessLine(argv[i]); } - app.Run(); + if ( !gApplication->IsRunning() ) { + gApplication->Run(); + } return 1; } -DECLARE_APPLY(DD4hepRint,run_interpreter) +DECLARE_APPLY(DD4hep_Rint,run_interpreter) /// Basic entry point to start the ROOT interpreter. /** @@ -125,7 +176,7 @@ DECLARE_APPLY(DD4hepRint,run_interpreter) * in the interpreter with the global variable * dd4hep::DD4hepUI* gdd4hepUI; * - * Factory: DD4hepInteractiveUI + * Factory: DD4hep_InteractiveUI * * \author M.Frank * \version 1.0 @@ -141,13 +192,13 @@ static long root_ui(Detector& description, int /* argc */, char** /* argv */) { "to interact with the detector description."); return 1; } -DECLARE_APPLY(DD4hepInteractiveUI,root_ui) +DECLARE_APPLY(DD4hep_InteractiveUI,root_ui) /// Basic entry point to dump the ROOT TGeoElementTable object /** * Dump the elment table to stdout or file. * - * Factory: DD4hepElementTable -format xml/text(default) -output <file-name> + * Factory: DD4hep_ElementTable -format xml/text(default) -output <file-name> * * \author M.Frank * \version 1.0 @@ -196,7 +247,7 @@ static long root_elements(Detector& description, int argc, char** argv) { if ( c == 't' && i+1<argc ) type = argv[++i]; else if ( c == 'o' && i+1<argc ) output = argv[++i]; else { - ::printf("DD4hepElementTable -opt [-opt] \n" + ::printf("DD4hep_ElementTable -opt [-opt] \n" " -type <string> Output format: text or xml \n" " -output <file-name> Output file specifier (xml only) \n" "\n"); @@ -211,7 +262,7 @@ static long root_elements(Detector& description, int argc, char** argv) { if ( type == "xml" ) { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - " ++++ Linear collider detector description in C++ ++++\n" + " ++++ Generic detector description in C++ ++++\n" " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ Parser:" @@ -246,7 +297,7 @@ static long root_elements(Detector& description, int argc, char** argv) { } return 1; } -DECLARE_APPLY(DD4hepElementTable,root_elements) +DECLARE_APPLY(DD4hep_ElementTable,root_elements) /// Basic entry point to dump the ROOT TGeoElementTable object /** @@ -316,7 +367,7 @@ static long root_materials(Detector& description, int argc, char** argv) { if ( c == 't' && i+1<argc ) type = argv[++i]; else if ( c == 'o' && i+1<argc ) output = argv[++i]; else { - ::printf("DD4hepElementTable -opt [-opt] \n" + ::printf("DD4hep_MaterialTable -opt [-opt] \n" " -type <string> Output format: text or xml \n" " -output <file-name> Output file specifier (xml only) \n" "\n"); @@ -331,14 +382,14 @@ static long root_materials(Detector& description, int argc, char** argv) { if ( type == "xml" ) { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - " ++++ Linear collider detector description in C++ ++++\n" + " ++++ Generic detector description in C++ ++++\n" " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ Parser:" XML_IMPLEMENTATION_TYPE " ++++\n" " ++++ ++++\n" - " ++++ Table of elements as defined in ROOT: " ROOT_RELEASE " ++++\n" + " ++++ Table of elements as defined in ROOT: " ROOT_RELEASE " ++++\n" " ++++ ++++\n" " ++++ M.Frank CERN/LHCb ++++\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n "; @@ -361,7 +412,7 @@ static long root_materials(Detector& description, int argc, char** argv) { } return 1; } -DECLARE_APPLY(DD4hepMaterialTable,root_materials) +DECLARE_APPLY(DD4hep_MaterialTable,root_materials) /// Basic entry point to interprete an XML document /** @@ -370,7 +421,7 @@ DECLARE_APPLY(DD4hepMaterialTable,root_materials) * - The processing hint (build type) is passed as optional * second argument. * - * Factory: DD4hepCompactLoader + * Factory: DD4hep_CompactLoader * * \author M.Frank * \version 1.0 @@ -393,7 +444,7 @@ static long load_compact(Detector& description, int argc, char** argv) { } return 0; } -DECLARE_APPLY(DD4hepCompactLoader,load_compact) +DECLARE_APPLY(DD4hep_CompactLoader,load_compact) /// Basic entry point to process any XML document. /** @@ -404,7 +455,7 @@ DECLARE_APPLY(DD4hepCompactLoader,load_compact) * * The root tag defines the plugin to interprete it. * - * Factory: DD4hepXMLLoader + * Factory: DD4hep_XMLLoader * * \author M.Frank * \version 1.0 @@ -427,7 +478,7 @@ static long load_xml(Detector& description, int argc, char** argv) { } return 0; } -DECLARE_APPLY(DD4hepXMLLoader,load_xml) +DECLARE_APPLY(DD4hep_XMLLoader,load_xml) /// Basic entry point to process any pre-parsed XML document. /** @@ -438,7 +489,7 @@ DECLARE_APPLY(DD4hepXMLLoader,load_xml) * * The root tag defines the plugin to interprete it. * - * Factory: DD4hepXMLProcessor + * Factory: DD4hep_XMLProcessor * * \author M.Frank * \version 1.0 @@ -466,11 +517,11 @@ static long process_xml_doc(Detector& description, int argc, char** argv) { } return 0; } -DECLARE_APPLY(DD4hepXMLProcessor,process_xml_doc) +DECLARE_APPLY(DD4hep_XMLProcessor,process_xml_doc) /// Basic entry point to load the volume manager object /** - * Factory: DD4hepVolumeManager + * Factory: DD4hep_VolumeManager * * \author M.Frank * \version 1.0 @@ -495,11 +546,12 @@ static long load_volmgr(Detector& description, int, char**) { } return 0; } +DECLARE_APPLY(DD4hep_VolumeManager,load_volmgr) DECLARE_APPLY(DD4hepVolumeManager,load_volmgr) /// Basic entry point to dump a dd4hep geometry to a ROOT file /** - * Factory: DD4hepGeometry2ROOT + * Factory: DD4hep_Geometry2ROOT * * \author M.Frank * \version 1.0 @@ -529,11 +581,11 @@ static long dump_geometry2root(Detector& description, int argc, char** argv) { printout(ERROR,"Geometry2ROOT","+++ No output file name given."); return 0; } -DECLARE_APPLY(DD4hepGeometry2ROOT,dump_geometry2root) +DECLARE_APPLY(DD4hep_Geometry2ROOT,dump_geometry2root) /// Basic entry point to load a dd4hep geometry directly from the ROOT file /** - * Factory: DD4hepRootLoader + * Factory: DD4hep_RootLoader * * \author M.Frank * \version 1.0 @@ -547,14 +599,14 @@ static long load_geometryFromroot(Detector& description, int argc, char** argv) return 1; } } - printout(ERROR,"DD4hepRootLoader","+++ No input file name given."); + printout(ERROR,"DD4hep_RootLoader","+++ No input file name given."); return 0; } -DECLARE_APPLY(DD4hepRootLoader,load_geometryFromroot) +DECLARE_APPLY(DD4hep_RootLoader,load_geometryFromroot) /// Basic entry point to check sensitive detector strictures /** - * Factory: DD4hepCheckDetectors + * Factory: DD4hep_CheckDetectors * * \author M.Frank * \version 1.0 @@ -564,7 +616,7 @@ static long check_detectors(Detector& description, int /* argc */, char** /* arg DD4hepRootCheck check(&description); return check.checkDetectors(); } -DECLARE_APPLY(DD4hepCheckDetectors,check_detectors) +DECLARE_APPLY(DD4hep_CheckDetectors,check_detectors) /// Basic entry point to check sensitive detector strictures /** @@ -578,11 +630,11 @@ static long check_sensitives(Detector& description, int /* argc */, char** /* ar DD4hepRootCheck check(&description); return check.checkSensitives(); } -DECLARE_APPLY(DD4hepCheckSensitives,check_sensitives) +DECLARE_APPLY(DD4hep_CheckSensitives,check_sensitives) /// Basic entry point to check sensitive detector strictures /** - * Factory: DD4hepCheckSegmentations + * Factory: DD4hep_CheckSegmentations * * \author M.Frank * \version 1.0 @@ -592,11 +644,11 @@ static long check_segmentations(Detector& description, int /* argc */, char** /* DD4hepRootCheck check(&description); return check.checkSegmentations(); } -DECLARE_APPLY(DD4hepCheckSegmentations,check_segmentations) +DECLARE_APPLY(DD4hep_CheckSegmentations,check_segmentations) /// Basic entry point to check sensitive detector strictures /** - * Factory: DD4hepCheckReadouts + * Factory: DD4hep_CheckReadouts * * \author M.Frank * \version 1.0 @@ -606,11 +658,11 @@ static long check_readouts(Detector& description, int /* argc */, char** /* argv DD4hepRootCheck check(&description); return check.checkReadouts(); } -DECLARE_APPLY(DD4hepCheckReadouts,check_readouts) +DECLARE_APPLY(DD4hep_CheckReadouts,check_readouts) /// Basic entry point to check IDDescriptors of the detector object /** - * Factory: DD4hepCheckIdspecs + * Factory: DD4hep_CheckIdspecs * * \author M.Frank * \version 1.0 @@ -620,11 +672,11 @@ static long check_idspecs(Detector& description, int /* argc */, char** /* argv DD4hepRootCheck check(&description); return check.checkIdSpecs(); } -DECLARE_APPLY(DD4hepCheckIdspecs,check_idspecs) +DECLARE_APPLY(DD4hep_CheckIdspecs,check_idspecs) /// Basic entry point to check IDDescriptors of the detector object /** - * Factory: DD4hepCheckVolumeManager + * Factory: DD4hep_CheckVolumeManager * * \author M.Frank * \version 1.0 @@ -634,11 +686,11 @@ static long check_volumemanager(Detector& description, int /* argc */, char** /* DD4hepRootCheck check(&description); return check.checkVolManager(); } -DECLARE_APPLY(DD4hepCheckVolumeManager,check_volumemanager) +DECLARE_APPLY(DD4hep_CheckVolumeManager,check_volumemanager) /// Basic entry point to check IDDescriptors of the detector object /** - * Factory: DD4hepCheckNominals + * Factory: DD4hep_CheckNominals * * \author M.Frank * \version 1.0 @@ -648,11 +700,11 @@ static long check_nominals(Detector& description, int /* argc */, char** /* argv DD4hepRootCheck check(&description); return check.checkNominals(); } -DECLARE_APPLY(DD4hepCheckNominals,check_nominals) +DECLARE_APPLY(DD4hep_CheckNominals,check_nominals) /// Basic entry point to print out the volume hierarchy /** - * Factory: DD4hepVolumeDump + * Factory: DD4hep_VolumeDump * * \author M.Frank * \version 1.0 @@ -811,7 +863,7 @@ static long dump_volume_tree(Detector& description, int argc, char** argv) { Actor actor(argc,argv); return actor.dump("",description.world().placement().ptr(),pv.ptr(),0,PlacedVolume::VolIDs()); } -DECLARE_APPLY(DD4hepVolumeDump,dump_volume_tree) +DECLARE_APPLY(DD4hep_VolumeDump,dump_volume_tree) // ====================================================================================== /// Plugin function: Apply arbitrary functor callback on the tree of detector elements @@ -828,10 +880,14 @@ DECLARE_APPLY(DD4hepVolumeDump,dump_volume_tree) */ static int detelement_processor(Detector& description, int argc, char** argv) { bool recursive = true; + ProcessorArgs args(argc, argv); DetElement det = description.world(); - unique_ptr<DetectorProcessor> proc(dd4hep::createProcessor<DetectorProcessor>(description, argc, argv)); - for(int i=0, num=std::min(argc,3); i<num; ++i) { - if ( 0 == ::strncmp(argv[i],"-recursive",4) ) + unique_ptr<DetectorProcessor> proc(dd4hep::createProcessor<DetectorProcessor>(description, args.argc, &args.argv[0])); + + for(int i=0; i<argc; ++i) { + if ( i >= args.start && i <= args.end ) + continue; + else if ( 0 == ::strncmp(argv[i],"-recursive",4) ) recursive = true; else if ( 0 == ::strncmp(argv[i],"-no-recursive",7) ) recursive = false; @@ -869,10 +925,13 @@ DECLARE_APPLY(DD4hep_DetElementProcessor,detelement_processor) static int placed_volume_processor(Detector& description, int argc, char** argv) { bool recursive = true; PlacedVolume pv = description.world().placement(); - unique_ptr<PlacedVolumeProcessor> proc(dd4hep::createProcessor<PlacedVolumeProcessor>(description, argc, argv)); + ProcessorArgs args(argc, argv); + unique_ptr<PlacedVolumeProcessor> proc(dd4hep::createProcessor<PlacedVolumeProcessor>(description, args.argc, &args.argv[0])); - for(int i=0, num=std::min(argc,3); i<num; ++i) { - if ( 0 == ::strncmp(argv[i],"-recursive",4) ) + for(int i=0; i<argc; ++i) { + if ( i >= args.start && i <= args.end ) + continue; + else if ( 0 == ::strncmp(argv[i],"-recursive",4) ) recursive = true; else if ( 0 == ::strncmp(argv[i],"-no-recursive",7) ) recursive = false; @@ -896,13 +955,13 @@ static int placed_volume_processor(Detector& description, int argc, char** argv) except("PlacedVolumeProcessor","++ Unknown plugin argument: %s",argv[i]); } } - return PlacedVolumeScanner().scan(*proc, pv, 0, recursive); + return PlacedVolumeScanner().scanPlacements(*proc, pv, 0, recursive); } DECLARE_APPLY(DD4hep_PlacedVolumeProcessor,placed_volume_processor) /// Basic entry point to print out the detector element hierarchy /** - * Factory: DD4hepDetectorDump, DD4hepDetectorVolumeDump + * Factory: DD4hep_DetectorDump, DD4hep_DetectorVolumeDump * * \author M.Frank * \version 1.0 @@ -910,7 +969,12 @@ DECLARE_APPLY(DD4hep_PlacedVolumeProcessor,placed_volume_processor) */ template <int flag> long dump_detelement_tree(Detector& description, int argc, char** argv) { struct Actor { - static long dump(DetElement de,int level, bool sensitive_only) { + long count = 0; + Actor() = default; + ~Actor() { + printout(ALWAYS,"DetectorDump", "+++ Scanned a total of %ld elements.",count); + } + long dump(DetElement de,int level, bool sensitive_only) { const DetElement::Children& c = de.children(); if ( !sensitive_only || 0 != de.volumeID() ) { PlacedVolume place = de.placement(); @@ -918,6 +982,7 @@ template <int flag> long dump_detelement_tree(Detector& description, int argc, c char fmt[128]; switch(flag) { case 0: + ++count; if ( de.placement() == de.idealPlacement() ) { ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s NumDau:%%d VolID:%%08X Place:%%p %%c",level+1,2*level+1); printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(c.size()), @@ -927,17 +992,25 @@ template <int flag> long dump_detelement_tree(Detector& description, int argc, c ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s NumDau:%%d VolID:%%08X Place:%%p [ideal:%%p aligned:%%p] %%c", level+1,2*level+1); printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(c.size()), - (unsigned long)de.volumeID(), (void*)de.idealPlacement().ptr(), (void*)place.ptr(), sens); + (unsigned long)de.volumeID(), (void*)de.idealPlacement().ptr(), + (void*)place.ptr(), sens); break; case 1: - ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Detector: %%s NumDau:%%d VolID:%%p",level+1,2*level+1); + ++count; + ::snprintf(fmt,sizeof(fmt), + "%03d %%-%ds Detector: %%s NumDau:%%d VolID:%%p", + level+1,2*level+1); printout(INFO,"DetectorDump", fmt, "", de.path().c_str(), int(c.size()), (void*)de.volumeID()); if ( de.placement() == de.idealPlacement() ) { - ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Placement: %%s %%c",level+1,2*level+3); + ::snprintf(fmt,sizeof(fmt), + "%03d %%-%ds Placement: %%s %%c", + level+1,2*level+3); printout(INFO,"DetectorDump",fmt,"", de.placementPath().c_str(), sens); break; } - ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Placement: %%s [ideal:%%p aligned:%%p] %%c",level+1,2*level+3); + ::snprintf(fmt,sizeof(fmt), + "%03d %%-%ds Placement: %%s [ideal:%%p aligned:%%p] %%c", + level+1,2*level+3); printout(INFO,"DetectorDump",fmt,"", de.placementPath().c_str(), (void*)de.idealPlacement().ptr(), (void*)place.ptr(), sens); break; @@ -954,10 +1027,11 @@ template <int flag> long dump_detelement_tree(Detector& description, int argc, c for(int i=0; i<argc; ++i) { if ( ::strcmp(argv[i],"--sensitive")==0 ) { sensitive_only = true; } } - return Actor::dump(description.world(),0,sensitive_only); + Actor a; + return a.dump(description.world(),0,sensitive_only); } -DECLARE_APPLY(DD4hepDetectorDump,dump_detelement_tree<0>) -DECLARE_APPLY(DD4hepDetectorVolumeDump,dump_detelement_tree<1>) +DECLARE_APPLY(DD4hep_DetectorDump,dump_detelement_tree<0>) +DECLARE_APPLY(DD4hep_DetectorVolumeDump,dump_detelement_tree<1>) /// Basic entry point to print out the volume hierarchy /** @@ -981,11 +1055,11 @@ static long detelement_cache(Detector& description, int , char** ) { }; return Actor::cache(description.world()); } -DECLARE_APPLY(DD4hepDetElementCache,detelement_cache) +DECLARE_APPLY(DD4hep_DetElementCache,detelement_cache) /// Basic entry point to dump the geometry tree of the description instance /** - * Factory: DD4hepGeometryTreeDump + * Factory: DD4hep_GeometryTreeDump * * \author M.Frank * \version 1.0 @@ -997,7 +1071,7 @@ static long exec_GeometryTreeDump(Detector& description, int, char** ) { dmp.create(description.world()); return 1; } -DECLARE_APPLY(DD4hepGeometryTreeDump,exec_GeometryTreeDump) +DECLARE_APPLY(DD4hep_GeometryTreeDump,exec_GeometryTreeDump) /// Basic entry point to dump the geometry in GDML format /** @@ -1021,11 +1095,11 @@ static long exec_SimpleGDMLWriter(Detector& description, int argc, char** argv) } return 1; } -DECLARE_APPLY(DD4hepSimpleGDMLWriter,exec_SimpleGDMLWriter) +DECLARE_APPLY(DD4hep_SimpleGDMLWriter,exec_SimpleGDMLWriter) /// Basic entry point to print out detector type map /** - * Factory: DD4hepDetectorTypes + * Factory: DD4hep_DetectorTypes * * \author M.Frank * \version 1.0 @@ -1042,7 +1116,7 @@ static long detectortype_cache(Detector& description, int , char** ) { } return 1; } -DECLARE_APPLY(DD4hepDetectorTypes,detectortype_cache) +DECLARE_APPLY(DD4hep_DetectorTypes,detectortype_cache) /// Basic entry point to print out detector type map /** @@ -1058,7 +1132,7 @@ DECLARE_SURFACE_INSTALLER(TestSurfaces,TestSurfacesPlugin) /// Basic entry point to print out detector type map /** - * Factory: DD4hepPluginTester + * Factory: DD4hep_PluginTester * * \author M.Frank * \version 1.0 @@ -1074,5 +1148,5 @@ static long install_plugin_tester(Detector& description, int , char** ) { } return 1; } -DECLARE_APPLY(DD4hepPluginTester,install_plugin_tester) +DECLARE_APPLY(DD4hep_PluginTester,install_plugin_tester) diff --git a/DDCore/src/plugins/VolumeMgrTest.cpp b/DDCore/src/plugins/VolumeMgrTest.cpp index 66ea311afada72241c9d9dffab5539f50d3a74b0..0bfcd8339819b59166541ff76776b384f3203139 100644 --- a/DDCore/src/plugins/VolumeMgrTest.cpp +++ b/DDCore/src/plugins/VolumeMgrTest.cpp @@ -315,4 +315,4 @@ long VolIDTest::run(Detector& description,int argc,char** argv) { return 1; } -DECLARE_APPLY(DD4hepVolumeMgrTest,VolIDTest::run) +DECLARE_APPLY(DD4hep_VolumeMgrTest,VolIDTest::run) diff --git a/DDDB/src/plugins/DDDBExecutor.cpp b/DDDB/src/plugins/DDDBExecutor.cpp index 3ec660ee19c5b16c1a24284c9011bd1f64802246..c22cffef4b748e206da74d09902346f6eb0bc168 100644 --- a/DDDB/src/plugins/DDDBExecutor.cpp +++ b/DDDB/src/plugins/DDDBExecutor.cpp @@ -184,7 +184,7 @@ static long load_xml_dddb(Detector& description, int argc, char** argv) { if ( !attr.empty() ) { const void* args[] = {attr.c_str(), 0}; printout(INFO,"DDDBExecutor","+++ Processing visualization attributes: %s", attr.c_str()); - result = description.apply("DD4hepXMLLoader", 1, (char**)args); + result = description.apply("DD4hep_XMLLoader", 1, (char**)args); check_result(result); } @@ -208,7 +208,7 @@ static long load_xml_dddb(Detector& description, int argc, char** argv) { if ( !xmlFiles.empty() ) { for(size_t i=0; i<xmlFiles.size(); ++i) { const void* args[] = {xmlFiles[i].c_str(), 0}; - description.apply("DD4hepXMLLoader", 1, (char**)args); + description.apply("DD4hep_XMLLoader", 1, (char**)args); } } diff --git a/DDG4/examples/TEve.C b/DDG4/examples/TEve.C index 98683b4073556096dfe0a984e3c137b0c7efdce9..ed26e1a17a9101146503e280ce9f654129e58ee1 100644 --- a/DDG4/examples/TEve.C +++ b/DDG4/examples/TEve.C @@ -29,8 +29,8 @@ using namespace dd4hep::detail; void TEve() { Detector& description = Detector::getInstance(); - const char* fname = "file:../DD4hep.trunk/DDExamples/CLICSiD/compact/compact.xml"; - description.apply("DD4hepCompactLoader",1,(char**)&fname); + const char* fname = "file:../DD4hep/examples/CLICSiD/compact/compact.xml"; + description.apply("DD4hep_CompactLoader",1,(char**)&fname); TEveManager::Create(); //TFile::SetCacheFileDir("."); diff --git a/DDG4/include/DDG4/Geant4Kernel.h b/DDG4/include/DDG4/Geant4Kernel.h index fc488f8c14fd05068632f088f172d53792d242fc..2648acd0b9dafb0236eedbad46e69b31459cf944 100644 --- a/DDG4/include/DDG4/Geant4Kernel.h +++ b/DDG4/include/DDG4/Geant4Kernel.h @@ -54,7 +54,7 @@ namespace dd4hep { /// Reference to Geant4 track manager G4TrackingManager* m_trackMgr; /// Detector description object - Detector* m_detDesc; + Detector* m_detDesc; /// Property pool PropertyManager m_properties; @@ -148,7 +148,7 @@ namespace dd4hep { /// Access phase phases const Phases& phases() const { return m_phases; } /// Access to detector description - Detector& detectorDescription() const { return *m_detDesc; } + Detector& detectorDescription() const { return *m_detDesc; } /// Access the tracking manager G4TrackingManager* trackMgr() const { return m_trackMgr; } /// Access the tracking manager diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp index ecb8462242e3f77c457f5ad9d85f03fed532b420..3408d9a7ad9eb09eacff8429266818dcf9512472 100644 --- a/DDG4/src/Geant4Kernel.cpp +++ b/DDG4/src/Geant4Kernel.cpp @@ -266,14 +266,14 @@ G4RunManager& Geant4Kernel::runManager() { /// Construct detector geometry using description plugin void Geant4Kernel::loadGeometry(const std::string& compact_file) { char* arg = (char*) compact_file.c_str(); - m_detDesc->apply("DD4hepXMLLoader", 1, &arg); + m_detDesc->apply("DD4hep_XMLLoader", 1, &arg); //return *this; } // Utility function to load XML files void Geant4Kernel::loadXML(const char* fname) { const char* args[] = { fname, 0 }; - m_detDesc->apply("DD4hepXMLLoader", 1, (char**) args); + m_detDesc->apply("DD4hep_XMLLoader", 1, (char**) args); } int Geant4Kernel::configure() { diff --git a/UtilityApps/src/converter.cpp b/UtilityApps/src/converter.cpp index 473e5624f80b23a5818adc6b218dd5145cf16d26..f36b6a8a63e1a1db3c1b5412fc28856a377e826d 100644 --- a/UtilityApps/src/converter.cpp +++ b/UtilityApps/src/converter.cpp @@ -87,7 +87,7 @@ namespace { // Load compact files for(size_t i=0; i<geo_files.size(); ++i) { const char* plugin_argv[] = {geo_files[i], 0}; - run_plugin(description,"DD4hepCompactLoader",1,(char**)plugin_argv); + run_plugin(description,"DD4hep_CompactLoader",1,(char**)plugin_argv); } // Create volume manager and populate it required if ( volmgr ) run_plugin(description,"DD4hepVolumeManager",0,0); diff --git a/UtilityApps/src/display.cpp b/UtilityApps/src/display.cpp index f4ab6513d2f649d4ca4cf246bcbb299c595c55e8..b4b640436aac00242e5c795ffea9236b229e9ba2 100644 --- a/UtilityApps/src/display.cpp +++ b/UtilityApps/src/display.cpp @@ -16,5 +16,5 @@ //______________________________________________________________________________ int main(int argc,char** argv) { - return main_default("DD4hepGeometryDisplay",argc,argv); + return main_default("DD4hep_GeometryDisplay",argc,argv); } diff --git a/UtilityApps/src/plugin_runner.cpp b/UtilityApps/src/plugin_runner.cpp index 163fb6e15b260d59d422f4e9ed93960551ae928c..ffd814acc940ae505eaedb7e4744bfdb3860bfda 100644 --- a/UtilityApps/src/plugin_runner.cpp +++ b/UtilityApps/src/plugin_runner.cpp @@ -17,23 +17,27 @@ // Framework include files #include "run_plugin.h" +using namespace std; + //______________________________________________________________________________ namespace { void usage() { - std::cout << + cout << "geoPluginRun -opt [-opt] \n" " -input <file> [OPTIONAL] Specify geometry input file. \n" - " -plugin <name> <args> [args] \n" + " -plugin <name> <args> [args] [-end-plugin] \n" " [REQUIRED] Plugin to be executed and applied. \n" - " -plugin <name> <args> [args] \n" + " -plugin <name> <args> [args] -end-plugin \n" " [OPTIONAL] Next plugin with arguments. \n"; - print_default_args() << std::endl; + print_default_args() << endl; ::exit(EINVAL); } //______________________________________________________________________________ int invoke_plugin_runner(int argc,char** argv) { Args arguments; + arguments.interpreter = false; + for(int i=1; i<argc;++i) { if ( argv[i][0]=='-' ) { if ( arguments.handle(i,argc,argv) ) @@ -43,41 +47,70 @@ namespace { usage(); } } - if ( arguments.plugins.empty() ) + if ( arguments.plugins.empty() ) { usage(); - + } + unique_ptr<TRint> interpreter; dd4hep::Detector& description = dd4hep_instance(); // Load compact files if required by plugin if ( !arguments.geo_files.empty() ) { load_compact(description, arguments); } else { - std::cout << "geoPluginRun: No geometry input supplied. No geometry will be loaded." << std::endl; + cout << "geoPluginRun: No geometry input supplied. " + << "No geometry will be loaded." << endl; + } + // Attach UI instance if requested to ease interaction from the ROOT prompt + if ( arguments.ui ) { + run_plugin(description,"DD4hep_InteractiveUI",0,0); } // Create volume manager and populate it required - if ( arguments.volmgr ) run_plugin(description,"DD4hepVolumeManager",0,0); + if ( arguments.volmgr ) { + run_plugin(description,"DD4hep_VolumeManager",0,0); + } + if ( arguments.interpreter ) { + pair<int, char**> a(0,0); + interpreter.reset(new TRint("geoPluginRun", &a.first, a.second)); + } // Execute plugin for(size_t i=0; i<arguments.plugins.size(); ++i) { - std::vector<const char*>& plug = arguments.plugins[i]; - int num_arg = int(plug.size())-2; - run_plugin(description,plug[0], num_arg,(char**)&plug[1]); + vector<const char*>& plug = arguments.plugins[i]; + int num_args = int(plug.size())-2; + long result = run_plugin(description,plug[0], num_args,(char**)&plug[1]); + if ( result == EINVAL ) { + cout << "geoPluginRun: FAILED to execute dd4hep plugin: '" << plug[0] + << "' with args (" << num_args << ") :[ "; + for(size_t j = 1; j < plug.size(); ++j) { + if ( plug[j] ) cout << plug[j] << " "; + } + cout << "]" << endl; + usage(); + } + cout << "geoPluginRun: Executed dd4hep plugin: '" << plug[0] + << "' with args (" << num_args << ") :[ "; + for(size_t j=1; j<plug.size(); ++j) { + if ( plug[j] ) cout << plug[j] << " "; + } + cout << "]" << endl << flush; + } + if ( interpreter ) { + interpreter->Run(); } if ( arguments.destroy ) delete &description; return 0; } } - /// Main entry point as a program int main(int argc, char** argv) { try { return invoke_plugin_runner(argc, argv); } - catch(const std::exception& e) { - std::cout << "Got uncaught exception: " << e.what() << std::endl; + catch(const exception& e) { + cout << "geoPluginRun: Got uncaught exception: " << e.what() << endl; } catch (...) { - std::cout << "Got UNKNOWN uncaught exception." << std::endl; + cout << "geoPluginRun: Got UNKNOWN uncaught exception." << endl; } return EINVAL; } diff --git a/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h index 0c0d88cb383a7e07cf429a0f93f9abe9fcc40359..341f0631a62d10bc415b601fd81371d5e6cca049 100644 --- a/UtilityApps/src/run_plugin.h +++ b/UtilityApps/src/run_plugin.h @@ -71,7 +71,7 @@ namespace { std::ostream& print_default_args() { std::cout << " -build_type <number/string> Specify the build type \n" - " [OPTIONAL] MUST come immediately after the -compact input.\n" + " [OPTIONAL] MUST come immediately after the -compact input.\n" " Default for each file is: BUILD_DEFAULT [=1] \n" " Allowed: BUILD_SIMU [=1], BUILD_RECO [=2], \n" " BUILD_DISPLAY [=3] or BUILD_ENVELOPE [=4] \n" @@ -82,21 +82,23 @@ namespace { " check the volume ids for duplicates etc. \n" " -no-volmgr [OPTIONAL] Inhibit loading phys.volume manager \n" " -interpreter [OPTIONAL] Start ROOT C++ interpreter after execution. \n" + " -interactive [OPTIONAL] Alias for -interpreter argument. \n" " -no-interpreter [OPTIONAL] Inhibit ROOT C++ interpreter. \n" - " -print <number/string> Specify output level. Default: INFO(=3) \n" + " -print <number/string> Specify output level. Default: INFO(=3) \n" " [OPTIONAL] Allowed values: VERBOSE(=1), DEBUG(=2), \n" " INFO(=3), WARNING(=4), ERROR(=5), FATAL(=6) \n" " The lower the level, the more printout... \n" " -dry-run [OPTIONAL] Only load description. No execution. \n" - " -plugin <name> <args> Execute plugin <name> after loading geometry. \n" - " All arguments following until the next \n" - " '-plugin' tag are considered as arguments \n" - " to the current plugin. \n" " -ui [OPTIONAL] Install ROOT interpreter UI for dd4hep \n" " Will show up in the global interpreter variable\n" " 'dd4hep::ROOTUI* gdd4hepUI' and allows the user\n" " to interact with the the Detector instance from the\n" - " ROOT interactive prompt. \n"; + " ROOT interactive prompt. \n" + " -plugin <name> <args> Execute plugin <name> after loading geometry. \n" + " All arguments following until the next \n" + " '-plugin' tag are considered as arguments \n" + " to the current plugin. \n" + " "; return std::cout; } @@ -121,12 +123,12 @@ namespace { //____________________________________________________________________________ Args() { - ui = false; - volmgr = false; - dry_run = false; - destroy = false; + ui = false; + volmgr = false; + dry_run = false; + destroy = false; interpreter = true; - print = dd4hep::INFO; + print = dd4hep::INFO; } //____________________________________________________________________________ @@ -159,8 +161,14 @@ namespace { interpreter = true; else if ( ::strncmp(argv[i],"-no-interpreter",7)==0 ) interpreter = false; + else if ( ::strncmp(argv[i],"-interactive",6)==0 ) + interpreter = true; + else if ( ::strncmp(argv[i],"-no-interactive",7)==0 ) + interpreter = false; else if ( ::strncmp(argv[i],"-ui",3)==0 ) ui = true; + else if ( ::strncmp(argv[i],"-no-ui",6)==0 ) + ui = false; else if ( ::strncmp(argv[i],"-plugin",5)==0 ) { // Need to interprete plugin args here locally..... plugins.push_back(std::vector<const char*>()); @@ -197,11 +205,11 @@ namespace { usage_default(name); } std::cout << "Executed dd4hep plugin: '" << plug[0] - << "' with args (" << num_args << ") :[ "; + << "' with args (" << num_args << ") :[ "; for(size_t j=1; j<plug.size(); ++j) { if ( plug[j] ) std::cout << plug[j] << " "; } - std::cout << "]" << std::endl; + std::cout << "]" << std::endl << std::flush; } result = run_plugin(description,name,a.first,a.second); return result; @@ -243,7 +251,7 @@ namespace { // Load all compact files for(size_t i=0; i<args.geo_files.size(); ++i) { const char* argv[] = {args.geo_files[i], args.build_types[i], 0}; - run_plugin(description,"DD4hepCompactLoader",2,(char**)argv); + run_plugin(description,"DD4hep_CompactLoader",2,(char**)argv); } } @@ -268,9 +276,9 @@ namespace { dd4hep::Detector& description = dd4hep_instance(); // Load all compact files load_compact(description, args); - if ( args.ui ) run_plugin(description,"DD4hepInteractiveUI",0,0); + if ( args.ui ) run_plugin(description,"DD4hep_InteractiveUI",0,0); // Create volume manager and populate it required - if ( args.volmgr ) run_plugin(description,"DD4hepVolumeManager",0,0); + if ( args.volmgr ) run_plugin(description,"DD4hep_VolumeManager",0,0); // Create an interactive ROOT application if ( !args.dry_run ) { diff --git a/examples/AlignDet/CMakeLists.txt b/examples/AlignDet/CMakeLists.txt index 10d51bf8b708d83b36b17c058dbe02dba4a67d2c..ab787d167794bf690f82dd85d7d7fc205f2b4f07 100644 --- a/examples/AlignDet/CMakeLists.txt +++ b/examples/AlignDet/CMakeLists.txt @@ -30,7 +30,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_dump_geometry COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -compact file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml - -plugin DD4hepDetectorDump + -plugin DD4hep_DetectorDump REGEX_PASS "/world/Telescope/module_9 NumDau\\:1 VolID\\:00000903 Place" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) @@ -149,7 +149,7 @@ dd4hep_add_test_reg( AlignDet_AlephTPC_global_align -input file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC.xml -destroy -no-interpreter -plugin DD4hep_GlobalAlignmentInstall - -plugin DD4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml BUILD_DEFAULT + -plugin DD4hep_XMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml BUILD_DEFAULT REGEX_PASS "Successfully parsed XML: AlephTPC_alignment.xml" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) @@ -161,8 +161,8 @@ dd4hep_add_test_reg( AlignDet_AlephTPC_global_reset -input file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC.xml -destroy -no-interpreter -plugin DD4hep_GlobalAlignmentInstall - -plugin DD4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml - -plugin DD4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_reset.xml + -plugin DD4hep_XMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml + -plugin DD4hep_XMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_reset.xml REGEX_PASS "Successfully parsed XML: AlephTPC_reset.xml" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index a84267487e21ee1cf475a3804b525a55832e8e55..5dc1900945f84b689c5727c19b9a78a160bb9549 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -43,18 +43,34 @@ dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Dump # Test JSON based detector construction dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Detector COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hepCompactLoader + EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_XMLLoader file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel_json.xml REGEX_PASS "Successfully processed JSON input" REGEX_FAIL "Exception" REGEX_FAIL "FAILED" ) # +# Test JSON based detector construction +dd4hep_add_test_reg( ClientTests_DumpMaterials + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" + EXEC_ARGS geoPluginRun + -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel.xml + -volmgr -destroy -plugin DD4hep_MaterialTable -type xml + REGEX_PASS "material name=\"PEEK\"" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# # Test readout strings of the form: <id>system:8,barrel:-2</id> dd4hep_add_test_reg( ClientTests_DumpElements COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS geoPluginRun -plugin DD4hepElementTable -type xml - REGEX_PASS "formula=\"UUB\" name=\"UUB\"" ) + EXEC_ARGS geoPluginRun + -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel.xml + -volmgr -destroy -plugin DD4hep_ElementTable -type xml + REGEX_PASS "formula=\"UUB\" name=\"UUB\"" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) # # Test long volume IDs Detector setups with placements of # identical volumes at different levels of the hierarchy @@ -62,7 +78,7 @@ dd4hep_add_test_reg( ClientTests_MultiPlace COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/SiBarrelMultiSensitiveLongVolID.xml -volmgr -destroy - -plugin DD4hepVolumeMgrTest SiTrackerBarrel + -plugin DD4hep_VolumeMgrTest SiTrackerBarrel REGEX_PASS "Volume:component1_1 IDDesc:OK \\[S\\] vid:00200668000000ff system:00ff barrel:0000 layer:0001 module:0033 sensor:0001" REGEX_FAIL "FAILED: World transformation DIFFER" @@ -73,7 +89,7 @@ dd4hep_add_test_reg( ClientTests_Bitfield64_LongVoldID COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/SiBarrelMultiSensitiveLongVolID.xml -volmgr -destroy - -plugin DD4hepVolumeMgrTest SiTrackerBarrel + -plugin DD4hep_VolumeMgrTest SiTrackerBarrel REGEX_PASS "Volume:component1_1 IDDesc:OK \\[S\\] vid:00200668000000ff system:00ff barrel:0000 layer:0001 module:0033 sensor:0001" REGEX_FAIL "FAILED: World transformation DIFFER" @@ -84,9 +100,9 @@ dd4hep_add_test_reg( ClientTests_Bitfield64_BarrelSides COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Bitfield_SidesTest.xml -volmgr -destroy - -plugin DD4hepDetectorVolumeDump - -plugin DD4hepVolumeDump volids - -plugin DD4hepVolumeMgrTest all + -plugin DD4hep_DetectorVolumeDump + -plugin DD4hep_VolumeDump volids + -plugin DD4hep_VolumeMgrTest all REGEX_PASS "Volume:Shell_2 IDDesc:OK \\[S\\] vid:0000000000000102 system:0002 barrel:0001") # # Test readout strings of the form: <id>system:16,barrel:16:-5</id> @@ -94,9 +110,9 @@ dd4hep_add_test_reg( ClientTests_Bitfield64_BarrelSides2 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Bitfield_SidesTest2.xml -volmgr -destroy - -plugin DD4hepDetectorVolumeDump - -plugin DD4hepVolumeDump volids - -plugin DD4hepVolumeMgrTest all + -plugin DD4hep_DetectorVolumeDump + -plugin DD4hep_VolumeDump volids + -plugin DD4hep_VolumeMgrTest all REGEX_PASS "Volume:Shell_2 IDDesc:OK \\[S\\] vid:0000000000010002 system:0002 barrel:0001") # # Test handle casting procedures. @@ -104,7 +120,7 @@ dd4hep_add_test_reg( ClientTests_Check_Handle_Casts COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Check_Handles.xml - -plugin DD4hepDetectorVolumeDump + -plugin DD4hep_DetectorVolumeDump REGEX_PASS "| 164 casts PASSED 90 casts FAILED |") # # Test saving geometry to file @@ -112,7 +128,7 @@ dd4hep_add_test_reg( ClientTests_Save_ROOT_MiniTel_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel.xml - -plugin DD4hepGeometry2ROOT -output MiniTel_geometry.root + -plugin DD4hep_Geometry2ROOT -output MiniTel_geometry.root REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file.") # # @@ -126,7 +142,7 @@ foreach (test Assemblies BoxTrafos IronCylinder LheD_tracker MagnetFields Materi COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/${test}.xml - -plugin DD4hepVolumeDump -materials + -plugin DD4hep_VolumeDump -materials REGEX_PASS "\\+\\+\\+ Checked [1-9][0-9]* materials in volume placements. 0 are BAD." ) # Test format conversions diff --git a/examples/ClientTests/compact/MiniTel_json.xml b/examples/ClientTests/compact/MiniTel_json.xml index 37ab8c348dc96f05baa05e299e0ddd948c7b0aa2..bcf4602bd7066d50e6b131af19f9af9b2a4cb8fb 100644 --- a/examples/ClientTests/compact/MiniTel_json.xml +++ b/examples/ClientTests/compact/MiniTel_json.xml @@ -7,7 +7,7 @@ title="Sensor for New experiment" author="Anastasia Karachaliou" status="development" - url="/afs/cern.ch/user/a/akaracha/workspace/MyExperiment/DetDesc/xmlDDescr/geometry_myexper.xml" + url="/geometry_myexper.xml" version= "v0r1"> <comment>simple Detector as a small box</comment> </info> diff --git a/examples/ClientTests/scripts/BoxTrafos.C b/examples/ClientTests/scripts/BoxTrafos.C index 36233034c9ca3c7795331c0f48ff10e4031c1b17..f63d39370bbafcdec917e54916ff980541729939 100644 --- a/examples/ClientTests/scripts/BoxTrafos.C +++ b/examples/ClientTests/scripts/BoxTrafos.C @@ -54,8 +54,8 @@ int BoxTrafos() { gSystem->Load("libDDCore"); Detector& description = Detector::getInstance(); - description.apply("DD4hepCompactLoader",2,(char**)argv); - description.apply("DD4hepGeometryDisplay",0,0); + description.apply("DD4hep_CompactLoader",2,(char**)argv); + description.apply("DD4hep_GeometryDisplay",0,0); DetElement de = description.detector("B3"); diff --git a/examples/Conditions/xml/Sequence_1.xml b/examples/Conditions/xml/Sequence_1.xml index ac8ed09d8c9857e809cc3ef809c7e3d66276b031..aa0282c55843c81e457a895733acae3ce28a4734 100644 --- a/examples/Conditions/xml/Sequence_1.xml +++ b/examples/Conditions/xml/Sequence_1.xml @@ -1,16 +1,16 @@ <plugins> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> </plugin> - <plugin name="DD4hepVolumeManager"/> + <plugin name="DD4hep_VolumeManager"/> <plugin name="DD4hep_ConditionsManagerInstaller"/> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_alignment.xml"/> </plugin> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_reset.xml"/> </plugin> diff --git a/examples/Conditions/xml/Sequence_2.xml b/examples/Conditions/xml/Sequence_2.xml index 7888e5111185a135a9bf4435d55d3827a5b645e6..047e1342bb0a93a1dd55aadb6dbcd4a6208c0ed7 100644 --- a/examples/Conditions/xml/Sequence_2.xml +++ b/examples/Conditions/xml/Sequence_2.xml @@ -1,10 +1,10 @@ <plugins> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> </plugin> - <plugin name="DD4hepVolumeManager"/> + <plugin name="DD4hep_VolumeManager"/> <plugin name="DD4hep_ConditionsManagerInstaller"/> <plugin name="DD4hep_Test_CallbackInstall"/> <plugin name="DD4hep_Test_ConditionsExample3"/> diff --git a/examples/Conditions/xml/plugins.xml b/examples/Conditions/xml/plugins.xml index 4e45726bdc7eccf470ab89a96b003b8dd5365f1b..5e158f795c11306309ba03542eb25706fb9057c4 100644 --- a/examples/Conditions/xml/plugins.xml +++ b/examples/Conditions/xml/plugins.xml @@ -1,25 +1,25 @@ <plugins> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> </plugin> - <plugin name="DD4hepVolumeManager"/> + <plugin name="DD4hep_VolumeManager"/> <plugin name="DD4hep_ConditionsManagerInstaller"/> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_alignment.xml"/> </plugin> - <plugin name="DD4hepXMLLoader"> + <plugin name="DD4hep_XMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_reset.xml"/> </plugin> - <plugin name="DD4hep_Test_CallbackInstallTest"/> + <plugin name="DD4hep_Test_CallbackInstall"/> <!-- <plugin name="DD4hep_Test_ConditionsAccess"/> <plugin name="DD4hep_Test_ConditionsTreeDump"/> --> - <plugin name="DD4hepConditionExample3"/> + <plugin name="DD4hep_ConditionExample3"/> </plugins> diff --git a/examples/DDCMS/CMS-tracker-sim-1.png b/examples/DDCMS/CMS-tracker-sim-1.png new file mode 100644 index 0000000000000000000000000000000000000000..9f8f83e3ccd0f5ecc630601a0ce09996754eb7e2 Binary files /dev/null and b/examples/DDCMS/CMS-tracker-sim-1.png differ diff --git a/examples/DDCMS/CMS-tracker-sim-2.png b/examples/DDCMS/CMS-tracker-sim-2.png new file mode 100644 index 0000000000000000000000000000000000000000..ba4d40d10bfdc13d4c53e028ac5351507e006083 Binary files /dev/null and b/examples/DDCMS/CMS-tracker-sim-2.png differ diff --git a/examples/DDCMS/CMakeLists.txt b/examples/DDCMS/CMakeLists.txt index 083efadc72950a1d2607fb34d9d98532060d9404..67358ebced08e288bf2ac21ff0d8a83952e87040 100644 --- a/examples/DDCMS/CMakeLists.txt +++ b/examples/DDCMS/CMakeLists.txt @@ -27,6 +27,87 @@ dd4hep_package (DDCMS MAJOR 0 MINOR 0 PATCH 1 dd4hep_add_plugin(DDCMSexample SOURCES src/*.cpp) #---Package installation procedure(s) ----------------------------------------- dd4hep_install_dir( data DESTINATION ${DD4hep_DIR}/examples/DDCMS ) +dd4hep_install_dir( eve DESTINATION ${DD4hep_DIR}/examples/DDCMS ) #---Testing-------------------------------------------------------------------- dd4hep_configure_scripts ( DDCMS DEFAULT_SETUP WITH_TESTS ) - +# +# Test CMS tracker detector construction +dd4hep_add_test_reg( DDCMS_LoadGeometry + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/cms_tracker.xml -destroy -print WARNING + -plugin DD4hep_PlacedVolumeProcessor -recursive -processor DDCMS_DetElementCreator + REGEX_PASS "Instrumented 5 subdetectors with 36091 DetElements 25776 sensitives out of 224404 volumes and 1161 sensitive placements." + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Dump CMS material table +dd4hep_add_test_reg( DDCMS_DumpMaterials + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun -print WARNING + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml + -destroy -plugin DD4hep_MaterialTable -type xml + REGEX_PASS "material name=\"tobmaterial_TOB_ax_services_C18\"" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Dump CMS volume tree +dd4hep_add_test_reg( DDCMS_DumpVolumes + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun -print WARNING + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml + -destroy -plugin DD4hep_VolumeDump -sensitive -volids + REGEX_PASS "Checked 224414 physical volume placements. 25776 are sensitive." + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Dump CMS detector element tree +dd4hep_add_test_reg( DDCMS_DumpDetElements + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun -print WARNING + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml + -destroy -plugin DD4hep_DetectorDump -sensitive + REGEX_PASS "Scanned a total of 36101 elements." + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Dump CMS detector element tree of SD PixelBarrel +dd4hep_add_test_reg( DDCMS_VolumeMgrTest_PixelBarrel + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml + -destroy -print WARNING + -plugin DD4hep_VolumeMgrTest PixelBarrel_1 + REGEX_PASS "PASSED: Checked 10981 objects. Num.Errors:0" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Dump CMS detector element tree of SD TIB +dd4hep_add_test_reg( DDCMS_VolumeMgrTest_TIB + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml + -destroy -print WARNING + -plugin DD4hep_VolumeMgrTest TIB_1 + REGEX_PASS "PASSED: Checked 47964 objects. Num.Errors:0" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Dump CMS detector element tree of SD TOB +# Sucks. To be investigated. VolumeManager does not work! +#dd4hep_add_test_reg( DDCMS_VolumeMgrTest_TOB +# COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" +# EXEC_ARGS geoPluginRun +# -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml +# -destroy -print WARNING +# -plugin DD4hep_VolumeMgrTest TOB_1 +# REGEX_PASS "PASSED: Checked 150699 objects. Num.Errors:0" +# REGEX_FAIL "Exception" +# REGEX_FAIL "FAILED" +# ) diff --git a/examples/DDCMS/data/cms_tracker.xml b/examples/DDCMS/data/cms_tracker.xml index 66da5a09de1461852b333d3f26c1353a57ad770b..9ad6d012c384f0e165bbc73b9f360efd69252623 100644 --- a/examples/DDCMS/data/cms_tracker.xml +++ b/examples/DDCMS/data/cms_tracker.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <DDDefinition> <debug> +<!-- <debug_rotations/> <debug_materials/> -<!-- + <debug_shapes/> <debug_volumes/> <debug_constants/> @@ -296,6 +297,8 @@ <Include ref="pixfwdCommon.xml"/> <!-- + +THIS IS THE HORROR. CANNOT GET IT GOING: <Include ref="pixfwdBlade.xml"/> <Include ref="pixfwdPanel.xml"/> <Include ref="pixfwdPanelBase.xml"/> @@ -311,13 +314,14 @@ <Include ref="pixfwdPlaq2x5.xml"/> <Include ref="pixfwd.xml"/> ---> + TEC sucks in Geant4. Ignored. + <Include ref="trackertec.xml"/> +--> <Include ref="trackerbulkhead.xml"/> <Include ref="trackertib.xml"/> <Include ref="trackertid.xml"/> - <Include ref="trackertec.xml"/> <Include ref="trackerother.xml"/> <Include ref="trackerpixbar.xml"/> diff --git a/examples/DDCMS/data/dd4hep-config.xml b/examples/DDCMS/data/dd4hep-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..127114f395a978ce94413c9bdc7dc5af699712d3 --- /dev/null +++ b/examples/DDCMS/data/dd4hep-config.xml @@ -0,0 +1,25 @@ +<plugins> + <plugin name="DD4hep_XMLLoader"> + <arg value="file:${DD4hepINSTALL}/examples/DDCMS/data/cms_tracker.xml"/> + </plugin> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-processor"/> + <arg value="DDCMS_DetElementCreator"/> + </plugin> + <plugin name="DD4hep_VolumeManager"/> + <plugin name="DD4hep_InteractiveUI"/> + +<!-- + <plugin name="DD4hep_DetectorDump"> + <arg value="-sensitive"/> + </plugin> + <plugin name="DD4hep_GeometryDisplay"/> + + <plugin name="DD4hep_VolumeDump"> + <arg value="-sensitive"/> + <arg value="-volids"/> + </plugin> +--> +</plugins> diff --git a/examples/DDCMS/eve/DDEve.xml b/examples/DDCMS/eve/DDEve.xml new file mode 100644 index 0000000000000000000000000000000000000000..21a0bc97840cc69add44ceb947571686334acfac --- /dev/null +++ b/examples/DDCMS/eve/DDEve.xml @@ -0,0 +1,48 @@ +<ddeve> + <display visLevel="7" loadLevel="4"/> + + <collection name="TIDB_2Hits" hits="PointSet" color="kGreen+3" size="0.3" type="21" towerH="3*MeV" emax="10*GeV"/> + <collection name="TIDF_1Hits" hits="PointSet" color="kGreen+3" size="0.3" type="21" towerH="3*MeV" emax="10*GeV"/> + <collection name="TIB_1Hits" hits="PointSet" color="kBlue" size="0.3" type="21" towerH="3*MeV" emax="2*GeV"/> + <collection name="PixelBarrel_1Hits" hits="PointSet" color="kMagenta" size="0.3" type="20"/> + <collection name="TOB_1Hits" hits="PointSet" color="kRed+3" size="0.3" type="20"/> + <collection name="MC_Particles" hits="Particles" size="0.6" width="2" type="kCircle"/> + + <calodata name="PixelBarrel" hits="PixelBarrel_1Hits" towerH="20" emax="200" + n_eta="200" eta_min="-5" eta_max="5" + n_phi="200" phi_min="-pi" phi_max="pi" + alpha="0.5" rmin="0.5" dz="50.0" color="kMagenta"/> + + + <view name="3D Trackers R-Phi (Local)" type="RhoPhiProjection"> + <detelement name="Tracker_2/PixelBarrel_1" load_geo="5" alpha="0.55"/> + <detelement name="Tracker_2/TIB_1" load_geo="5" alpha="0.55"/> + <detelement name="Tracker_2/TIDB_2" load_geo="5" alpha="0.55"/> + <detelement name="Tracker_2/TIDF_1" load_geo="5" alpha="0.55"/> + <detelement name="Tracker_2/TOB_1" load_geo="5" alpha="0.55"/> + </view> + <view name="3D Trackers" type="View3D"> + <detelement name="Tracker_2/PixelBarrel_1" load_geo="-1" alpha="0.55"/> + <detelement name="Tracker_2/TIB_1" load_geo="-1" alpha="0.55"/> + <detelement name="Tracker_2/TIDB_2" load_geo="-1" alpha="0.55"/> + <detelement name="Tracker_2/TIDF_1" load_geo="-1" alpha="0.55"/> + <detelement name="Tracker_2/TOB_1" load_geo="-1" alpha="0.55"/> + </view> + + <view name="PixelBarrel Deposits" type="Calo3DProjection"> + <detelement name="Tracker_2/PixelBarrel_1" load_geo="-1" show_evt="1" alpha="0.55"/> + <calodata name="PixelBarrel"/> + </view> + + <view name="PixelBarrel 2D" type="Calo2DProjection"> + <calodata name="PixelBarrel"/> + <detelement name="Tracker_2/PixelBarrel_1" load_geo="-1" alpha="0.55"/> + <collection name="MC_Particles" use="MC_Particles"/> + </view> + + <view name="Multi (Global)" type="MultiView"> + <detelement name="global"/> + </view> + + <include ref="../data/dd4hep-config.xml"/> +</ddeve> diff --git a/examples/DDCMS/scripts/CMSTrackerSim.py b/examples/DDCMS/scripts/CMSTrackerSim.py new file mode 100644 index 0000000000000000000000000000000000000000..0c10967f16326692afbc7994b6981b4eef0eaa60 --- /dev/null +++ b/examples/DDCMS/scripts/CMSTrackerSim.py @@ -0,0 +1,59 @@ +import os, sys, time, DDG4 +from DDG4 import OutputLevel as Output +from SystemOfUnits import * +# +# +""" + + dd4hep example setup using the python configuration + + \author M.Frank + \version 1.0 + +""" +def run(): + kernel = DDG4.Kernel() + install_dir = os.environ['DD4hepINSTALL'] + kernel.setOutputLevel('Geant4Converter',Output.DEBUG) + kernel.setOutputLevel('Gun',Output.INFO) + kernel.loadGeometry("file:"+install_dir+"/examples/DDCMS/data/cms_tracker.xml") + kernel.detectorDescription().fromXML("file:"+install_dir+"/examples/DDCMS/data/dd4hep-config.xml"); + kernel.NumEvents = 5 + geant4 = DDG4.Geant4(kernel) + geant4.printDetectors() + geant4.setupCshUI() + if len(sys.argv) >= 2 and sys.argv[1] =="batch": + kernel.UI = '' + + # Configure field + field = geant4.setupTrackingField(prt=True) + # Configure I/O + evt_root = geant4.setupROOTOutput('RootOutput','CMSTracker_'+time.strftime('%Y-%m-%d_%H-%M'),mc_truth=True) + # Setup particle gun + geant4.setupGun("Gun",particle='pi-',energy=100*GeV,multiplicity=1) + # Now setup all tracking detectors + for i in geant4.description.detectors(): + o = DDG4.DetElement(i.second.ptr()) + sd = geant4.description.sensitiveDetector(o.name()) + if sd.isValid(): + type = geant4.sensitive_types[sd.type()] + print 'CMSTracker: Configure subdetector %-24s of type %s'%(o.name(),type,) + geant4.setupDetector(o.name(),type) + + # And handle the simulation particles. + part = DDG4.GeneratorAction(kernel,"Geant4ParticleHandler/ParticleHandler") + kernel.generatorAction().adopt(part) + part.SaveProcesses = ['conv','Decay'] + part.MinimalKineticEnergy = 1*MeV + part.OutputLevel = 5 # generator_output_level + part.enableUI() + + # Now build the physics list: + phys = kernel.physicsList() + phys.extends = 'QGSP_BERT' + phys.enableUI() + # and run + geant4.execute() + +if __name__ == "__main__": + run() diff --git a/examples/Persistency/CMakeLists.txt b/examples/Persistency/CMakeLists.txt index eccb0ed23eaa339fc8813acb4daace1135d69be2..33845bb22246182425838e0242e2a4cf5faf3fc9 100644 --- a/examples/Persistency/CMakeLists.txt +++ b/examples/Persistency/CMakeLists.txt @@ -27,7 +27,7 @@ dd4hep_configure_scripts (Persistency DEFAULT_SETUP WITH_TESTS ) dd4hep_add_test_reg( Persist_Conditions_Save COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun - -plugin DD4hep_PersistencyExample_write_cond -output Conditions.root + -plugin DD4hep_PersistencyExample_write_cond -output Conditions.root REGEX_PASS "\\+\\+\\+ PASSED Wrote 14 conditions to file." REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" ) @@ -36,7 +36,7 @@ dd4hep_add_test_reg( Persist_Conditions_Save dd4hep_add_test_reg( Persist_Conditions_Restore COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun - -plugin DD4hep_PersistencyExample_read_cond -input Conditions.root + -plugin DD4hep_PersistencyExample_read_cond -input Conditions.root DEPENDS Persist_Conditions_Save REGEX_PASS "\\+\\+\\+ Read successfully 14 conditions. Result=172" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -47,7 +47,7 @@ dd4hep_add_test_reg( Persist_MiniTel_Save_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/../ClientTests/compact/MiniTel.xml - -plugin DD4hepGeometry2ROOT -output MiniTel_geometry.root + -plugin DD4hep_Geometry2ROOT -output MiniTel_geometry.root REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file." REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" ) @@ -56,7 +56,7 @@ dd4hep_add_test_reg( Persist_MiniTel_Save_LONGTEST dd4hep_add_test_reg( Persist_MiniTel_Restore_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader MiniTel_geometry.root + -plugin DD4hep_RootLoader MiniTel_geometry.root DEPENDS Persist_MiniTel_Save_LONGTEST REGEX_PASS "\\+\\+\\+ Successfully loaded detector description from file" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -66,8 +66,8 @@ dd4hep_add_test_reg( Persist_MiniTel_Restore_LONGTEST dd4hep_add_test_reg( Persist_MiniTel_Restore_VolMgr1_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader MiniTel_geometry.root - -plugin DD4hepCheckVolumeManager + -plugin DD4hep_RootLoader MiniTel_geometry.root + -plugin DD4hep_CheckVolumeManager DEPENDS Persist_MiniTel_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 10 VolumeManager contexts. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -78,8 +78,8 @@ dd4hep_add_test_reg( Persist_MiniTel_Restore_VolMgr1_LONGTEST dd4hep_add_test_reg( Persist_MiniTel_Restore_Nominal_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader MiniTel_geometry.root - -plugin DD4hepCheckNominals + -plugin DD4hep_RootLoader MiniTel_geometry.root + -plugin DD4hep_CheckNominals DEPENDS Persist_MiniTel_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 10 DetElements. Num.Errors: 0" ) @@ -88,8 +88,8 @@ dd4hep_add_test_reg( Persist_MiniTel_Restore_Nominal_LONGTEST dd4hep_add_test_reg( Persist_MiniTel_Restore_Sensitives_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader MiniTel_geometry.root - -plugin DD4hepCheckSensitives + -plugin DD4hep_RootLoader MiniTel_geometry.root + -plugin DD4hep_CheckSensitives DEPENDS Persist_MiniTel_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 10 SensitiveDetector objects. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -99,8 +99,8 @@ dd4hep_add_test_reg( Persist_MiniTel_Restore_Sensitives_LONGTEST dd4hep_add_test_reg( Persist_MiniTel_Restore_Segmentations_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader MiniTel_geometry.root - -plugin DD4hepCheckSegmentations + -plugin DD4hep_RootLoader MiniTel_geometry.root + -plugin DD4hep_CheckSegmentations DEPENDS Persist_MiniTel_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 10 readout segmentations. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -110,8 +110,8 @@ dd4hep_add_test_reg( Persist_MiniTel_Restore_Segmentations_LONGTEST dd4hep_add_test_reg( Persist_MiniTel_Restore_Readouts_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader MiniTel_geometry.root - -plugin DD4hepCheckReadouts + -plugin DD4hep_RootLoader MiniTel_geometry.root + -plugin DD4hep_CheckReadouts DEPENDS Persist_MiniTel_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 10 readout objects. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -121,8 +121,8 @@ dd4hep_add_test_reg( Persist_MiniTel_Restore_Readouts_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Save_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun - -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/../CLICSiD/compact/compact.xml - -plugin DD4hepGeometry2ROOT -output CLICSiD_geometry.root + -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/../CLICSiD/compact/compact.xml + -plugin DD4hep_Geometry2ROOT -output CLICSiD_geometry.root REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file." REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" ) @@ -131,7 +131,7 @@ dd4hep_add_test_reg( Persist_CLICSiD_Save_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root + -plugin DD4hep_RootLoader CLICSiD_geometry.root DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ Successfully loaded detector description from file" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -141,8 +141,8 @@ dd4hep_add_test_reg( Persist_CLICSiD_Restore_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_VolMgr1_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root - -plugin DD4hepCheckVolumeManager + -plugin DD4hep_RootLoader CLICSiD_geometry.root + -plugin DD4hep_CheckVolumeManager DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 29270 VolumeManager contexts. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -152,8 +152,8 @@ dd4hep_add_test_reg( Persist_CLICSiD_Restore_VolMgr1_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_VolMgr2_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root - -plugin DD4hepVolumeMgrTest SiTrackerBarrel + -plugin DD4hep_RootLoader CLICSiD_geometry.root + -plugin DD4hep_VolumeMgrTest SiTrackerBarrel DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED: Checked 81306 objects. Num.Errors:0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -164,8 +164,8 @@ dd4hep_add_test_reg( Persist_CLICSiD_Restore_VolMgr2_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_Nominal_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root - -plugin DD4hepCheckNominals + -plugin DD4hep_RootLoader CLICSiD_geometry.root + -plugin DD4hep_CheckNominals DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ FAILED Checked 15946 DetElements. Num.Errors: 50" ) @@ -174,8 +174,8 @@ dd4hep_add_test_reg( Persist_CLICSiD_Restore_Nominal_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_Sensitives_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root - -plugin DD4hepCheckSensitives + -plugin DD4hep_RootLoader CLICSiD_geometry.root + -plugin DD4hep_CheckSensitives DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 14 SensitiveDetector objects. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -185,8 +185,8 @@ dd4hep_add_test_reg( Persist_CLICSiD_Restore_Sensitives_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_Segmentations_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root - -plugin DD4hepCheckSegmentations + -plugin DD4hep_RootLoader CLICSiD_geometry.root + -plugin DD4hep_CheckSegmentations DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 9 readout segmentations. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED" @@ -196,8 +196,8 @@ dd4hep_add_test_reg( Persist_CLICSiD_Restore_Segmentations_LONGTEST dd4hep_add_test_reg( Persist_CLICSiD_Restore_Readouts_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -print WARNING - -plugin DD4hepRootLoader CLICSiD_geometry.root - -plugin DD4hepCheckReadouts + -plugin DD4hep_RootLoader CLICSiD_geometry.root + -plugin DD4hep_CheckReadouts DEPENDS Persist_CLICSiD_Save_LONGTEST REGEX_PASS "\\+\\+\\+ PASSED Checked 14 readout objects. Num.Errors: 0" REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED"