diff --git a/DDCore/include/DD4hep/DetectorData.h b/DDCore/include/DD4hep/DetectorData.h index 37f36deccb7f4c62b74d12165ca4de913112de8d..4679e19e8e349e9155fa5cb63c6300b2223d0193 100644 --- a/DDCore/include/DD4hep/DetectorData.h +++ b/DDCore/include/DD4hep/DetectorData.h @@ -148,6 +148,11 @@ namespace dd4hep { /// Assignment operator //DetectorData& operator=(const DetectorData& copy) = delete; public: + /// Patch the ROOT streamers to adapt for DD4hep (set fUserExtension persistent) + static void patchRootStreamer(TClass* cl); + /// UNPatch the ROOT streamers to adapt for DD4hep (set fUserExtension transient) + static void unpatchRootStreamer(TClass* cl); + /// Clear data content: releases all allocated resources void destroyData(bool destroy_mgr=true); /// Clear data content: DOES NOT RELEASEW ALLOCATED RESOURCES! diff --git a/DDCore/include/Parsers/Printout.h b/DDCore/include/Parsers/Printout.h index 534d7828635b94db2e6072aae06f322ad3ece7fc..3833908c753ecc7d1ef33ba37e81d0241dfd5c8a 100644 --- a/DDCore/include/Parsers/Printout.h +++ b/DDCore/include/Parsers/Printout.h @@ -58,6 +58,13 @@ namespace dd4hep { * @return String containing the concatenated arguments */ std::string arguments(int argc, char** argv); + + /// Decode printlevel from string to value + /** + * @arg level_as_string [string,read-only] String value of print level + * @return Print level as enumeration + */ + PrintLevel decodePrintLevel(const std::string& level_as_string); /// Calls the display action with a given severity level /** diff --git a/DDCore/include/Parsers/detail/Dimension.h b/DDCore/include/Parsers/detail/Dimension.h index 5dd1731827864c191a64acb4a1a0e29ad4ed8969..e239362b8bc88c2cab390ecb2e785a1c46228680 100644 --- a/DDCore/include/Parsers/detail/Dimension.h +++ b/DDCore/include/Parsers/detail/Dimension.h @@ -554,29 +554,33 @@ namespace dd4hep { /// Access child element with tag "dimensions" as Dimension object Dimension dimensions(bool throw_if_not_present = true) const; - /// Child access: position + /// Access child element with tag "params" as Dimension object + Dimension params(bool throw_if_not_present = true) const; + /// Access child element with tag "parameters" as Dimension object + Dimension parameters(bool throw_if_not_present = true) const; + /// Access child element with tag "position" as Dimension object Dimension position(bool throw_if_not_present = true) const; - /// Child access: rotation + /// Access child element with tag "rotation" as Dimension object Dimension rotation(bool throw_if_not_present = true) const; - /// Child access: cone + /// Access child element with tag "cone" as Dimension object Dimension cone(bool throw_if_not_present = true) const; - /// Child access: sphere + /// Access child element with tag "sphere" as Dimension object Dimension sphere(bool throw_if_not_present = true) const; - /// Child access: torus + /// Access child element with tag "torus" as Dimension object Dimension torus(bool throw_if_not_present = true) const; - /// Child access: trap + /// Access child element with tag "trap" as Dimension object Dimension trap(bool throw_if_not_present = true) const; - /// Child access: trapezoid + /// Access child element with tag "trapezoid" as Dimension object Dimension trapezoid(bool throw_if_not_present = true) const; - /// Child access: trd + /// Access child element with tag "trd" as Dimension object Dimension trd(bool throw_if_not_present = true) const; - /// Child access: tubs + /// Access child element with tag "tubs" as Dimension object Dimension tubs(bool throw_if_not_present = true) const; - /// Child access: staves + /// Access child element with tag "staves" as Dimension object Dimension staves(bool throw_if_not_present = true) const; - /// Child access: beampipe + /// Access child element with tag "beampipe" as Dimension object Dimension beampipe(bool throw_if_not_present = true) const; - /// Child access: beampipe + /// Access child element with tag "beampipe" as Dimension object Dimension envelope(bool throw_if_not_present = true) const; /// Access "name" attribute as STL string diff --git a/DDCore/include/Parsers/detail/Dimension.imp b/DDCore/include/Parsers/detail/Dimension.imp index 8dca96b2621d7d7cffc125cbc64084e8decf14ec..404c539a347c6d2b9ead550665c87a0c819f291c 100644 --- a/DDCore/include/Parsers/detail/Dimension.imp +++ b/DDCore/include/Parsers/detail/Dimension.imp @@ -183,6 +183,8 @@ XML_ATTR_ACCESSOR_DOUBLE(temperature) XML_CHILD_ACCESSOR_XML_DIM(dimensions) +XML_CHILD_ACCESSOR_XML_DIM(params) +XML_CHILD_ACCESSOR_XML_DIM(parameters) XML_CHILD_ACCESSOR_XML_DIM(position) XML_CHILD_ACCESSOR_XML_DIM(rotation) XML_CHILD_ACCESSOR_XML_DIM(cone) diff --git a/DDCore/include/XML/UnicodeValues.h b/DDCore/include/XML/UnicodeValues.h index 078f64d13237e9d67497d87b712622543ffb098f..4ab21a11ed6c24f5d8a001b3bc2586feafe53d2a 100644 --- a/DDCore/include/XML/UnicodeValues.h +++ b/DDCore/include/XML/UnicodeValues.h @@ -146,6 +146,7 @@ UNICODE (firstposition); UNICODE (firstrotation); UNICODE (formula); UNICODE (fraction); +UNICODE (frame); UNICODE (funit); UNICODE (g); @@ -295,12 +296,14 @@ UNICODE (outst); UNICODE (p); UNICODE (P); UNICODE (padPitch); +UNICODE (pad); UNICODE (pads); UNICODE (para); UNICODE (paraboloid); UNICODE (parallelworld_volume); UNICODE (param); UNICODE (parameter); +UNICODE (parameters); UNICODE (params); UNICODE (parent); UNICODE (particles); @@ -315,6 +318,7 @@ UNICODE (phiBins); UNICODE (phi_size_max); UNICODE (physvol); UNICODE (physvolid); +UNICODE (pitch); UNICODE (pivot); UNICODE (pivot_point); UNICODE (plane); diff --git a/DDCore/src/DetectorData.cpp b/DDCore/src/DetectorData.cpp index 15de7d2cd47a18c101e2e1e2bcc1324e4b5cc9d0..97ad6100fbbab2124b6efd859589840ad1812420 100644 --- a/DDCore/src/DetectorData.cpp +++ b/DDCore/src/DetectorData.cpp @@ -167,17 +167,8 @@ DetectorData::DetectorData() cl->AdoptStreamer(new TClassStreamer(stream_opaque_datablock)); printout(INFO,"PersistencyIO","+++ Set Streamer to %s",cl->GetName()); } - TDataMember* m = 0; - cl = TGeoVolume::Class(); - printout(INFO,"PersistencyIO","+++ Patching %s.fUserExtension to persistent",cl->GetName()); - m = cl->GetDataMember("fUserExtension"); - m->SetTitle(m->GetTitle()+2); - m->SetBit(BIT(2)); - cl = TGeoNode::Class(); - printout(INFO,"PersistencyIO","+++ Patching %s.fUserExtension to persistent",cl->GetName()); - m = cl->GetDataMember("fUserExtension"); - m->SetTitle(m->GetTitle()+2); - m->SetBit(BIT(2)); + DetectorData::patchRootStreamer(TGeoVolume::Class()); + DetectorData::patchRootStreamer(TGeoNode::Class()); } InstanceCount::increment(this); } @@ -188,6 +179,28 @@ DetectorData::~DetectorData() { InstanceCount::decrement(this); } +/// Patch the ROOT streamers to adapt for DD4hep +void DetectorData::patchRootStreamer(TClass* cl) { + TDataMember* m = 0; + printout(INFO,"PersistencyIO", + "+++ Set data member %s.fUserExtension as PERSISTENT.", + cl->GetName()); + m = cl->GetDataMember("fUserExtension"); + m->SetTitle(m->GetTitle()+2); + m->SetBit(BIT(2)); +} + +/// UNPatch the ROOT streamers to adapt for DD4hep +void DetectorData::unpatchRootStreamer(TClass* cl) { + TDataMember* m = 0; + printout(INFO,"PersistencyIO", + "+++ Set data member %s.fUserExtension as TRANSIENT.", + cl->GetName()); + m = cl->GetDataMember("fUserExtension"); + m->SetTitle((std::string("! ")+m->GetTitle()).c_str()); + m->ResetBit(BIT(2)); +} + /// Clear data content: releases all allocated resources void DetectorData::destroyData(bool destroy_mgr) { m_extensions.clear(); diff --git a/DDCore/src/Printout.cpp b/DDCore/src/Printout.cpp index 0a00c5f12d110df9f551e29fc2135e57c3ad32fc..a9242f7d90417997f01e04e296363ec8b48b34a9 100644 --- a/DDCore/src/Printout.cpp +++ b/DDCore/src/Printout.cpp @@ -87,6 +87,35 @@ namespace { } } +dd4hep::PrintLevel dd4hep::decodePrintLevel(const std::string& val) { + switch(::toupper(val[0])) { + case '1': + case 'V': + return dd4hep::VERBOSE; + case '2': + case 'D': + return dd4hep::DEBUG; + case '3': + case 'I': + return dd4hep::INFO; + case '4': + case 'W': + return dd4hep::WARNING; + case '5': + case 'E': + return dd4hep::ERROR; + case '6': + case 'F': + return dd4hep::FATAL; + case '7': + case 'A': + return dd4hep::FATAL; + default: + std::cout << "Unknown print level supplied:'" << val << "'. Argument ignored." << std::endl; + throw std::runtime_error("Invalid printLevel:"+val); + } +} + /// Helper function to serialize argument list to a single string /** * \arg argc [int,read-only] Number of arguments. diff --git a/DDCore/src/gdml/DetElementCreator.cpp b/DDCore/src/gdml/DetElementCreator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a03ced90b17bad5fcb922b52c6f73151a390c1a --- /dev/null +++ b/DDCore/src/gdml/DetElementCreator.cpp @@ -0,0 +1,434 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== +// +// Specialized generic detector constructor +// +//========================================================================== +#ifndef DD4HEP_DETELEMENTCREATOR_H +#define DD4HEP_DETELEMENTCREATOR_H + +// Framework include files +#include "DD4hep/VolumeProcessor.h" +#include "DD4hep/Printout.h" + +namespace dd4hep { + + /// 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 DetElementCreator : public PlacedVolumeProcessor { + struct Data { + 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; + }; + 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,DetElement> Detectors; + typedef std::map<DetElement,Count> Counters; + typedef std::map<std::pair<DetElement,int>, std::pair<int,int> > LeafCount; + + Detector& description; + Material sensitive_material; + Counters counters; + LeafCount leafCount; + VolumeStack stack; + Detectors subdetectors; + DetElement current_detector; + std::string sensitive_material_name; + std::string sensitive_type; + std::string detector_volume_match; + std::string detector_volume_veto; + size_t detector_volume_level = 0; + int max_volume_level = 9999; + PrintLevel printLevel = INFO; + 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); + /// Generate the name of the DetElement object from the placed volume + std::string detElementName(PlacedVolume pv) const; + public: + /// Initializing constructor + DetElementCreator(Detector& desc, const std::string& sd_type, + const std::string& sd_match, + const std::string& sd_veto, + const std::string& sd_mat, + int sd_lvl, + PrintLevel p); + /// Default destructor + virtual ~DetElementCreator(); + /// Callback to output PlacedVolume information of an single Placement + 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); + }; +} +#endif /* DD4HEP_DETELEMENTCREATOR_H */ + +// Framework include files +#include "DD4hep/detail/DetectorInterna.h" +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DetectorHelper.h" +#include "DD4hep/Printout.h" + +// C/C++ include files +#include <sstream> + +using namespace std; +using namespace dd4hep; + +/// Initializing constructor +DetElementCreator::DetElementCreator(Detector& desc, const string& sd_match, + const string& sd_veto, + const string& sd_type, + const string& sd_mat, int sd_lvl, + PrintLevel p) + : description(desc), sensitive_material_name(sd_mat), + sensitive_type(sd_type), detector_volume_match(sd_match), + detector_volume_veto(sd_veto), max_volume_level(sd_lvl), printLevel(p) +{ + DetectorHelper helper(description); + sensitive_material = desc.material(sensitive_material_name); + if ( !sensitive_material.isValid() ) { + except("DetElementCreator", + "++ Failed to extract MATERIAL from the element table."); + } + stack.reserve(32); + detector_volume_level = 0; +} + +/// Default destructor +DetElementCreator::~DetElementCreator() { + Count total; + stringstream str, id_str; + const char* pref = detector_volume_match.c_str(); + printout(INFO,pref,"DetElementCreator: +++++++++++++++ Summary of sensitve elements ++++++++++++++++++++++++"); + for ( const auto& c : counters ) { + printout(INFO,pref,"DetElementCreator: ++ 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,pref,"DetElementCreator: ++ Summary: %-24s %7d DetElements %7d sensitives out of %7d volumes", + "Grand Total:",total.elements,total.sensitives,total.volumes); + printout(INFO,pref,"DetElementCreator: +++++++++++++++ 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,pref,"DetElementCreator: ++ 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,pref,"DetElementCreator: ++ Summary: %-24s %d.","Total DetElements:",total_cnt); + printout(INFO,pref,"DetElementCreator: +++++++++++++++ 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,pref,"DetElementCreator: ++ Setting up readout for subdetector:%-24s id:%04X", + f.first.name(), f.first.id()); + } + printout(INFO,pref,"DetElementCreator: " + "+++++++++++++++ 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,pref, "DetElementCreator: ++ 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, pref, "DetElementCreator: ++ 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()); +} + +/// Generate the name of the DetElement object from the placed volume +string DetElementCreator::detElementName(PlacedVolume pv) const { + if ( pv.isValid() ) { + string nam = pv.name(); + size_t idx = string::npos; // nam.rfind('_'); + string nnam = nam.substr(0, idx); + return nnam; + } + except("DetElementCreator","++ Cannot deduce name from invalid PlacedVolume handle!"); + return string(); +} + +/// Create a new detector element +DetElement DetElementCreator::createElement(const char* /* debug_tag */, PlacedVolume pv, int id) { + string name = detElementName(pv); + DetElement det(name, id); + det.setPlacement(pv); + /* + printout(INFO,"DetElementCreator","++ Created detector element [%s]: %s (%s) %p", + debug_tag, det.name(), name.c_str(), det.ptr()); + */ + return det; +} + +/// Create the top level detectors +void DetElementCreator::createTopLevelDetectors(PlacedVolume pv) { + auto& data = stack.back(); + data.element = current_detector = addSubdetector(detElementName(pv), pv, true); +} + +/// Add new subdetector to the detector description +DetElement DetElementCreator::addSubdetector(const std::string& nam, PlacedVolume pv, bool volid) { + Detectors::iterator idet = subdetectors.find(nam); + if ( idet == subdetectors.end() ) { + DetElement det(nam, description.detectors().size()+1); + det.setPlacement(pv); + if ( volid ) { + det.placement().addPhysVolID("system",det.id()); + } + idet = subdetectors.insert(make_pair(nam,det)).first; + description.add(det); + printout(printLevel,"DetElementCreator","++ Added sub-detector element: %s",det.path().c_str()); + } + return idet->second; +} + +/// Callback to output PlacedVolume information of an single Placement +int DetElementCreator::operator()(PlacedVolume pv, int vol_level) { + if ( detector_volume_level > 0 ) { + Material mat = pv.volume().material(); + if ( mat == sensitive_material ) { + 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 DetElementCreator::process(PlacedVolume pv, int lvl, bool recursive) { + int ret; + string pv_nam = pv.name(); + if ( detector_volume_level > 0 || + ( (!detector_volume_match.empty() && + pv_nam.find(detector_volume_match) != string::npos) && + (detector_volume_veto.empty() || + pv_nam.find(detector_volume_veto) == string::npos) ) ) + { + stack.push_back(Data(pv)); + if ( 0 == detector_volume_level ) { + detector_volume_level = stack.size(); + createTopLevelDetectors(pv); + } + ret = PlacedVolumeProcessor::process(pv,lvl,recursive); + /// Complete structures if the stack size is > 3! + if ( stack.size() > detector_volume_level ) { + // 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(), sensitive_type); + 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 + for(size_t i=1; i<stack.size(); ++i) { + auto& d = stack[i]; + auto& p = stack[i-1]; + if ( !d.element.isValid() ) { + char text[32]; + ::snprintf(text, sizeof(text), "Lv%d", lvl); + d.pv.addPhysVolID(text, d.pv->GetMotherVolume()->GetIndex(d.pv.ptr())+1); + d.element = createElement("Element", d.pv, current_detector.id()); + (i==1 ? current_detector : p.element).add(d.element); + ++counts.elements; + } + p.has_sensitive = true; + } + printout(printLevel,"DetElementCreator", + "++ 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); + 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 = lvl; + 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; + printout(printLevel,"DetElementCreator","++ [%ld] Added element: %s", + stack.size(), data.element.path().c_str()); + } + 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() == detector_volume_level ) { + current_sensitive = SensitiveDetector(); + current_detector = DetElement(); + detector_volume_level = 0; + ret = 0; + } + stack.pop_back(); + } + else if ( lvl < max_volume_level ) { + //printout(printLevel, "", "+++ Skip volume %s", pv_nam.c_str()); + ret = PlacedVolumeProcessor::process(pv,lvl,recursive); + } + return ret; +} + +static void* create_object(Detector& description, int argc, char** argv) { + PrintLevel prt = DEBUG; + size_t sd_level = 99999; + string sd_mat, sd_match, sd_veto, sd_type; + for(int i = 0; i < argc && argv[i]; ++i) { + if ( 0 == ::strncmp("-material",argv[i],5) ) + sd_mat = argv[++i]; + else if ( 0 == ::strncmp("-match",argv[i],5) ) + sd_match = argv[++i]; + else if ( 0 == ::strncmp("-veto",argv[i],5) ) + sd_veto = argv[++i]; + else if ( 0 == ::strncmp("-type",argv[i],5) ) + sd_type = argv[++i]; + else if ( 0 == ::strncmp("-level",argv[i],5) ) + sd_level = ::atol(argv[++i]); + else if ( 0 == ::strncmp("-print",argv[i],5) ) + prt = decodePrintLevel(argv[++i]); + else + break; + } + if ( sd_mat.empty() || sd_match.empty() || sd_type.empty() ) { + cout << + "Usage: -plugin <name> -arg [-arg] \n" + " name: factory name DD4hep_ROOTGDMLParse \n" + " -material <string> Sensitive material name (identifier) \n" + " -match <string> Matching string for subdetector identification \n" + "\tArguments given: " << arguments(argc,argv) << endl << flush; + ::exit(EINVAL); + } + PlacedVolumeProcessor* proc = new DetElementCreator(description, sd_match, sd_veto, sd_type, sd_mat, sd_level, prt); + return (void*)proc; +} + +// first argument is the type from the xml file +DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_DetElementCreator,create_object) + diff --git a/DDCore/src/gdml/DetNominalCreator.cpp b/DDCore/src/gdml/DetNominalCreator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e0ec5de66c2a97c751a050aa41f212b50652ffc --- /dev/null +++ b/DDCore/src/gdml/DetNominalCreator.cpp @@ -0,0 +1,65 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== +// +// Specialized generic detector constructor +// +//========================================================================== +#ifndef DD4HEP_DETNOMINALCREATOR_H +#define DD4HEP_DETNOMINALCREATOR_H + +// Framework include files +#include "DD4hep/DetElement.h" + +namespace dd4hep { + + /// 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 DetNominalCreator { + Detector& description; + public: + DetNominalCreator(Detector& d) : description(d) {} + DetNominalCreator(const DetNominalCreator& c) : description(c.description) {} + virtual ~DetNominalCreator() = default; + int operator()(DetElement de, int /* level */) const { + if ( de.nominal().isValid() ) return 1; + return 0; + } + }; +} +#endif /* DD4HEP_DETNOMINALCREATOR_H */ + +// Framework include files +#include "DD4hep/DetectorProcessor.h" +#include "DD4hep/DetFactoryHelper.h" + +// C/C++ include files + + +using namespace std; +using namespace dd4hep; + +static void* create_object(Detector& description, int argc, char** argv) { + for(int i = 0; i < argc && argv[i]; ++i) { } + shared_ptr<DetNominalCreator> obj(new DetNominalCreator(description)); + DetectorProcessorShared<DetNominalCreator>* proc = + new DetectorProcessorShared<DetNominalCreator>(obj); + return (void*)proc; +} + +// first argument is the type from the xml file +DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_DetNominalCreator,create_object) diff --git a/DDCore/src/gdml/ImportPlainRoot.cpp b/DDCore/src/gdml/ImportPlainRoot.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5d4d70e80145a04dc530813829b6b9258361746a --- /dev/null +++ b/DDCore/src/gdml/ImportPlainRoot.cpp @@ -0,0 +1,187 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files +#include "DD4hep/Detector.h" +#include "DD4hep/Memory.h" +#include "DD4hep/DD4hepUI.h" +#include "DD4hep/Factories.h" +#include "DD4hep/Printout.h" +#include "DD4hep/DetectorData.h" +#include "DD4hep/DetectorTools.h" + +// ROOT includes +#include "TInterpreter.h" +#include "TGeoElement.h" +#include "TGeoManager.h" +#include "TGDMLParse.h" +#include "TGDMLWrite.h" +#include "TFile.h" +#include "TUri.h" + +using namespace std; +using namespace dd4hep; + +/// ROOT geometry dump plugin +/** + * Factory: DD4hep_PlainROOTDump + * + * \author M.Frank + * \version 1.0 + * \date 01/07/2014 + */ +static long plain_root_dump(Detector& description, int argc, char** argv) { + struct TGeoManip { + DetectorData* detector; + size_t num_nodes = 0; + size_t num_volume_patches = 0; + size_t num_placement_patches = 0; + int max_level = 9999; + bool import = false; + PrintLevel printLevel = DEBUG; + TGeoManip(DetectorData* dsc, int mx, bool imp, PrintLevel p) + : detector(dsc), max_level(mx), import(imp), printLevel(p) + { + } + ~TGeoManip() { + printout(INFO, "PlainROOTDump","+++ Scanned a total of %9ld NODES",num_nodes); + if ( import ) { + printout(INFO,"PlainROOTDump","+++ Scanned a total of %9ld VOLUMES",num_volume_patches); + printout(INFO,"PlainROOTDump","+++ Scanned a total of %9ld PLACEMENTS",num_placement_patches); + } + } + void operator()(int lvl, TGeoNode* n) { + char fmt[255]; + int npatch = 0; + TGeoVolume* v = n->GetVolume(); + bool v_ext = false, a_ext = false, p_ext = false; + if ( import ) { + if ( !v->GetUserExtension() ) { + if ( v->IsA() == TGeoVolume::Class() ) { + v->SetUserExtension(new Volume::Object()); + v_ext = true; + } + else { + v->SetUserExtension(new Assembly::Object()); + a_ext = true; + } + ++npatch; + ++num_volume_patches; + } + if ( !n->GetUserExtension() ) { + n->SetUserExtension(new PlacedVolume::Object()); + ++num_placement_patches; + p_ext = true; + ++npatch; + } + if ( lvl == 0 ) { + } + } + ++num_nodes; + if ( lvl <= max_level ) { + if ( !import || (import && npatch > 0) ) { + snprintf(fmt,sizeof(fmt),"%-5d %%-%ds %%s NDau:%%d Ext:%%p Vol:%%s Mother:%%s Ext:%%p Mat:%%s",lvl,lvl); + TGeoVolume* m = n->GetMotherVolume(); + printout(printLevel,"PlainROOTDump",fmt,"", + n->GetName(), n->GetNdaughters(), n->GetUserExtension(), + v->GetName(), m ? m->GetName() : "-----", + v->GetUserExtension(), v->GetMedium()->GetName()); + if ( import ) { + if ( v_ext ) { + ::snprintf(fmt,sizeof(fmt),"%-5d %%-%ds --> Adding VOLUME extension object",lvl,lvl); + printout(printLevel,"PlainROOTDump",fmt,""); + } + else if ( a_ext ) { + ::snprintf(fmt,sizeof(fmt),"%-5d %%-%ds --> Adding VOLUME ASSEMBLY extension object",lvl,lvl); + printout(printLevel,"PlainROOTDump",fmt,""); + } + else if ( p_ext ) { + ::snprintf(fmt,sizeof(fmt),"%-5d %%-%ds --> Adding PLACEMENT extension object",lvl,lvl); + printout(printLevel,"PlainROOTDump",fmt,""); + } + if ( lvl == 0 ) { + } + } + } + } + for (Int_t idau = 0, ndau = n->GetNdaughters(); idau < ndau; ++idau) { + TGeoNode* daughter = n->GetDaughter(idau); + this->operator()(lvl+1, daughter); + } + } + }; + if ( argc > 0 ) { + int level = 99999; + PrintLevel prt = DEBUG; + bool do_import = false; + string input, in_obj = "Geometry", air, vacuum; + for(int i = 0; i < argc && argv[i]; ++i) { + if ( 0 == ::strncmp("-input",argv[i],5) ) + input = argv[++i]; + else if ( 0 == ::strncmp("-object",argv[i],5) ) + in_obj = argv[++i]; + else if ( 0 == ::strncmp("-air",argv[i],5) ) + air = argv[++i]; + else if ( 0 == ::strncmp("-vacuum",argv[i],5) ) + vacuum = argv[++i]; + else if ( 0 == ::strncmp("-level",argv[i],5) ) + level = ::atol(argv[++i]); + else if ( 0 == ::strncmp("-import",argv[i],5) ) + do_import = true; + else if ( 0 == ::strncmp("-print",argv[i],5) ) + prt = decodePrintLevel(argv[++i]); + else + goto Error; + } + if ( input.empty() || in_obj.empty() ) { + Error: + cout << + "Usage: -plugin <name> -arg [-arg] \n" + " name: factory name DD4hep_ROOTGDMLParse \n" + " -input <string> Input file name. \n" + " -object <string> Name of geometry object in file. Default: \"Geometry\"\n" + "\tArguments given: " << arguments(argc,argv) << endl << flush; + ::exit(EINVAL); + } + printout(INFO,"ROOTGDMLParse","+++ Read geometry from GDML file file:%s",input.c_str()); + DetectorData::unpatchRootStreamer(TGeoVolume::Class()); + DetectorData::unpatchRootStreamer(TGeoNode::Class()); + TFile* f = TFile::Open(input.c_str()); + if ( f && !f->IsZombie() ) { + DetectorData* det = dynamic_cast<DetectorData*>(&description); + TGeoManager* mgr = (TGeoManager*)f->Get(in_obj.c_str()); + TGeoManip manip(det, level, do_import, prt); + DetectorData::patchRootStreamer(TGeoVolume::Class()); + DetectorData::patchRootStreamer(TGeoNode::Class()); + det->m_manager = mgr; + manip(0, mgr->GetTopNode()); + det->m_worldVol = mgr->GetTopNode()->GetVolume(); + if ( !air.empty() ) { + description.addConstant(Constant("Air",air)); + } + if ( !vacuum.empty() ) { + description.addConstant(Constant("Vacuum",vacuum)); + } + description.init(); + description.endDocument(); + detail::deleteObject(f); + return 1; + } + detail::deleteObject(f); + } + DetectorData::patchRootStreamer(TGeoVolume::Class()); + DetectorData::patchRootStreamer(TGeoNode::Class()); + except("ROOTGDMLParse","+++ No input file name given."); + return 0; +} +DECLARE_APPLY(DD4hep_PlainROOT,plain_root_dump) diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 2c224577fb0ced64c317673d58edff8eea94f409..b83422f20214bc836023cfd2d5503be18724b144 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -279,13 +279,20 @@ template <> void Converter<Plugin>::operator()(xml_h e) const { * */ template <> void Converter<Constant>::operator()(xml_h e) const { - xml_ref_t constant(e); - string nam = constant.attr<string>(_U(name)); - string val = constant.attr<string>(_U(value)); - string typ = constant.hasAttr(_U(type)) ? constant.attr<string>(_U(type)) : "number"; - Constant c(nam, val, typ); - _toDictionary(nam, val, typ); - description.addConstant(c); + if ( e.tag() != "include" ) { + xml_ref_t constant(e); + string nam = constant.attr<string>(_U(name)); + string val = constant.attr<string>(_U(value)); + string typ = constant.hasAttr(_U(type)) ? constant.attr<string>(_U(type)) : "number"; + Constant c(nam, val, typ); + _toDictionary(nam, val, typ); + description.addConstant(c); + return; + } + xml::DocumentHolder doc(xml::DocumentHandler().load(e, e.attr_value(_U(ref)))); + xml_h root = doc.root(); + xml_coll_t(root, _U(define)).for_each(_U(constant), Converter<Constant>(description)); + xml_coll_t(root, _U(constant)).for_each(Converter<Constant>(description)); } /** Convert compact constant objects (defines) diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index 61284cc980b0e6fa1b33655b5aeb1b6fb46983a7..7c90c6e55e8d4eb8662d43950c7f3da251618961 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -112,9 +112,9 @@ namespace { IDDescriptor iddesc = ro.idSpec(); VolumeID code = iddesc.encode(ids); Registries::const_iterator i = m_entries.find(code); - PrintLevel print_action = VERBOSE; - PrintLevel print_chain = VERBOSE; - PrintLevel print_res = VERBOSE; + PrintLevel print_action = INFO; + PrintLevel print_chain = INFO; + PrintLevel print_res = INFO; printout(print_action,"Geant4VolumeManager","+++ Add path:%s vid:%016X", detail::tools::placementPath(nodes,false).c_str(),code); diff --git a/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h index 341f0631a62d10bc415b601fd81371d5e6cca049..09a23f5ebc167daf05190b1f1ac71ac9e85bb5a5 100644 --- a/UtilityApps/src/run_plugin.h +++ b/UtilityApps/src/run_plugin.h @@ -117,7 +117,7 @@ namespace { //______________________________________________________________________________ struct Args { bool volmgr, dry_run, destroy, interpreter, ui; - int print; + dd4hep::PrintLevel print; std::vector<const char*> geo_files, build_types; std::vector<std::vector<const char*> > plugins; @@ -148,7 +148,7 @@ namespace { else if ( ::strncmp(argv[i],"-dry-run",5)==0 ) dry_run = true; else if ( ::strncmp(argv[i],"-print",4)==0 ) - dd4hep::setPrintLevel(dd4hep::PrintLevel(print = decodePrintLevel(argv[++i]))); + dd4hep::setPrintLevel(dd4hep::PrintLevel(print = dd4hep::decodePrintLevel(argv[++i]))); else if ( ::strncmp(argv[i],"-destroy",5)==0 ) destroy = true; else if ( ::strncmp(argv[i],"-no-destroy",8)==0 ) @@ -214,36 +214,6 @@ namespace { result = run_plugin(description,name,a.first,a.second); return result; } - - //____________________________________________________________________________ - int decodePrintLevel(const std::string& val) { - switch(::toupper(val[0])) { - case '1': - case 'V': - return dd4hep::VERBOSE; - case '2': - case 'D': - return dd4hep::DEBUG; - case '3': - case 'I': - return dd4hep::INFO; - case '4': - case 'W': - return dd4hep::WARNING; - case '5': - case 'E': - return dd4hep::ERROR; - case '6': - case 'F': - return dd4hep::FATAL; - case '7': - case 'A': - return dd4hep::FATAL; - default: - std::cout << "Unknown print level supplied:'" << val << "'. Argument ignored." << std::endl; - throw std::runtime_error("Invalid printLevel:"+val); - } - } }; //______________________________________________________________________________ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5a3025c4f78324bcb4dae769c2e8e2204d02d1e1..44d8dbe162e9edef21219e74d64af39433ed1849 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -54,13 +54,13 @@ dd4hep_enable_tests ( Persistency SimpleDetector DDG4_MySensDet + DDCodex ) # # XercesC dependent stuff if ( DD4HEP_USE_XERCESC ) dd4hep_print("|++> XercesC PRESENT. Building DDDB examples.") dd4hep_enable_tests (DDDB) - dd4hep_enable_tests (DDCodex) else() dd4hep_print("|++> XercesC is not present. NOT building DDDB examples.") endif() diff --git a/examples/DDCMS/CMakeLists.txt b/examples/DDCMS/CMakeLists.txt index 632bd172c5b2c07afce23dd94fc2e63cbbe01387..e88a5d51fa4dfe83b6d9278001263c40e571c3a8 100644 --- a/examples/DDCMS/CMakeLists.txt +++ b/examples/DDCMS/CMakeLists.txt @@ -24,7 +24,7 @@ dd4hep_package( DDCMS [ROOT REQUIRED COMPONENTS Geom GenVector] INCLUDE_DIRS include INSTALL_INCLUDES include/DDCMS) - +# # # We only create only library for DDCMS. The whole package is a single component # library. A priory there is no need to seperate the implementation from the diff --git a/examples/DDCMS/src/plugins/DDCMSDetElementCreator.cpp b/examples/DDCMS/src/plugins/DDCMSDetElementCreator.cpp index 3eb6a54f84deb305aa253d024f6408cfeb27ecb4..d3a3c638985bedbf13446b47c2afe178f5205a94 100644 --- a/examples/DDCMS/src/plugins/DDCMSDetElementCreator.cpp +++ b/examples/DDCMS/src/plugins/DDCMSDetElementCreator.cpp @@ -14,6 +14,8 @@ // Specialized generic detector constructor // //========================================================================== +#ifndef DD4HEP_DDCMSDETELEMENTCREATOR_H +#define DD4HEP_DDCMSDETELEMENTCREATOR_H // Framework include files #include "DD4hep/VolumeProcessor.h" @@ -53,9 +55,9 @@ namespace dd4hep { 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; + typedef std::map<std::string,DetElement> Detectors; + typedef std::map<DetElement,Count> Counters; + typedef std::map<std::pair<DetElement,int>, std::pair<int,int> > LeafCount; Counters counters; LeafCount leafCount; @@ -83,7 +85,7 @@ namespace dd4hep { virtual int process(PlacedVolume pv, int level, bool recursive); }; } - +#endif /* DD4HEP_DDCMSDETELEMENTCREATOR_H */ #include "DD4hep/detail/DetectorInterna.h" #include "DD4hep/DetFactoryHelper.h" diff --git a/examples/DDCodex/CodexB_2018-06-29_22-48.root b/examples/DDCodex/CodexB_2018-06-29_22-48.root deleted file mode 100644 index 1b1cfeb361a5792b1de9dff3597bff68670720bf..0000000000000000000000000000000000000000 Binary files a/examples/DDCodex/CodexB_2018-06-29_22-48.root and /dev/null differ diff --git a/examples/DDCodex/CodexB_2018-07-18_20-34.root b/examples/DDCodex/CodexB_2018-07-18_20-34.root new file mode 100644 index 0000000000000000000000000000000000000000..7ecacdb791e013c47ee7baeb4e5f5b07fd236120 Binary files /dev/null and b/examples/DDCodex/CodexB_2018-07-18_20-34.root differ diff --git a/examples/DDCodex/README.txt b/examples/DDCodex/README.txt index 65846d340158b6f3052d5fb86657cc32b933fcf7..d37e23e11d0de8cedbc47082980ee09796f515c8 100644 --- a/examples/DDCodex/README.txt +++ b/examples/DDCodex/README.txt @@ -115,15 +115,100 @@ Running Standalone ================== Display: - +-------- $> geoDisplay -input file:checkout/examples/DDCodex/compact/CODEX-b-alone.xml DDG4 simulation: +---------------- +$> python ../DD4hep/examples/DDCodex/python/CODEX-b-alone.py + +Reading the output file: +------------------------ +$> root.exe + ------------------------------------------------------------ + | Welcome to ROOT 6.12/06 http://root.cern.ch | + | (c) 1995-2017, The ROOT Team | + | Built for linuxx8664gcc | + | From tag v6-12-06, 9 February 2018 | + | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' | + ------------------------------------------------------------ -$> python ../DD4hep//examples/DDCodex/python/CODEX-b-alone.py +root [0] gSystem->Load("libDDG4Plugins.so") +(int) 0 +root [1] TFile*f=TFile::Open("CodexB_2018-07-18_20-34.root"); +root [2] TTree* t=(TTree*)f->Get("EVENT") +(TTree *) 0x2f53670 +root [3] TBranch* br=t->GetBranch("MCParticles") +(TBranch *) 0x444a1b0 +root [4] std::vector<dd4hep::sim::Geant4Particle*> particles; +root [5] std::vector<dd4hep::sim::Geant4Particle*>* p_particles = &particles; +root [6] br->SetAddress(&p_particles); +root [7] br->GetEntry(1) +(int) 1014 +root [8] particles.size() +(unsigned long) 4 +root [9] particles[0]->psx +(double) 866025.30 +root [10] particles[1]->psx +(double) 127.60460 +root [11] particles[2]->psx +(double) 419.25210 +root [12] particles[3]->psx +(double) 359.89637 +root [13] -Visualisation of the hits: +Visualisation of the hits: +-------------------------- $> root.exe ../DD4hep/examples/DDEve/DDEve.C +Setup: + +******************************************************************************** +* ---- LHCb Login v9r2p4 ---- * +* Building with gcc62 on slc6 x86_64 system (x86_64-slc6-gcc62-opt) * +******************************************************************************** + --- User_release_area is set to /afs/cern.ch/user/j/jongho/cmtuser + --- LHCBPROJECTPATH is set to: + /cvmfs/lhcb.cern.ch/lib/lhcb + /cvmfs/lhcb.cern.ch/lib/lcg/releases + /cvmfs/lhcb.cern.ch/lib/lcg/app/releases + /cvmfs/lhcb.cern.ch/lib/lcg/external +------------------------------------------------------------------------------------------------------------------------------------------------- + +Install command: +$ git clone https://github.com/MarkusFrankATcernch/DD4hep.git +$ source dd4hep-ci.d/init_x86_64.sh + +================================================== + Add new environment command in init_x86_64.sh: + export Geant4_DIR=${G4INSTALL}/lib/Geant4-10.4.0 +================================================= + +$ mkdir build && cd build/ +$ cmake -DDD4HEP_USE_GEANT4=ON -DBoost_NO_BOOST_CMAKE=ON -DDD4HEP_USE_LCIO=ON -DBUILD_TESTING=ON -DGeant4_DIR=$G4INSTALL/lib/Geant4-10.4.0 -DROOT_DIR=$ROOTSYS .. +$ make -j4 +$ make install + +move to upper directory +$ cd ../ +$ source bin/thisdd4hep.sh + +then go to examples directory +$ cd examples +$ mkdir build +$ cd build +$ cmake .. + +$ make -j5 install + +$ source /afs/cern.ch/work/j/jongho/Project_DD4hep/Test/DD4hep/examples/bin/thisDDCodex.sh +$ geoDisplay -input file:/afs/cern.ch/work/j/jongho/Project_DD4hep/Test/DD4hep/examples/DDCodex/compact/CODEX-b-alone.xml +$ python /afs/cern.ch/work/j/jongho/Project_DD4hep/Test/DD4hep/examples/DDCodex/python/CODEX-b-alone.py +$ root.exe $DD4hepINSTALL/examples/DDEve/DDEve.C + + +====================================================================================== + + diff --git a/examples/DDCodex/compact/CODEX-b-alone.xml b/examples/DDCodex/compact/CODEX-b-alone.xml index 21bb24ab0e35605a058199016d9b68353d0853a6..1424f9047addae296cbb7602067c1c764ad6ba1e 100644 --- a/examples/DDCodex/compact/CODEX-b-alone.xml +++ b/examples/DDCodex/compact/CODEX-b-alone.xml @@ -7,7 +7,21 @@ <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/materials.xml"/> </includes> - + <materials> + <material name="Concrete"> + <D value="2.30" unit="g/cm3" /> + <fraction n="0.529" ref="O"/> + <fraction n="0.337" ref="Si"/> + <fraction n="0.044" ref="Ca"/> + <fraction n="0.039" ref="Al"/> + <fraction n="0.016" ref="Na"/> + <fraction n="0.014" ref="Fe"/> + <fraction n="0.013" ref="K"/> + <fraction n="0.010" ref="H"/> + <fraction n="0.002" ref="Mg"/> + <fraction n="0.001" ref="C"/> + </material> + </materials> <define> <!-- Define the world box --> <constant name="world_side" value="50000*mm"/> @@ -24,14 +38,14 @@ <include ref="CODEX-b.xml" type="xml"/> <detector id="3" name="LHCb" type="DD4hep_BoxSegment" vis="B2_vis"> <material name="Air"/> - <box x="1000*cm" y="1000*cm" z="2500*cm"/> + <box x="500*cm" y="500*cm" z="2500*cm"/> <position x="0" y="0" z="1000*cm"/> <rotation x="0" y="0" z="0"/> </detector> <detector id="4" name="WALL" type="DD4hep_BoxSegment" vis="WALL_vis"> - <material name="Air"/> - <box x="200*cm" y="1000*cm" z="2500*cm"/> - <position x="1210*cm" y="0" z="1000*cm"/> + <material name="Concrete"/> + <box x="200*cm" y="500*cm" z="2500*cm"/> + <position x="2250*cm*sin(60*degree)" y="0" z="2500*cm*cos(60*degree)"/> <rotation x="0" y="0" z="0"/> </detector> <detector name="Beampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> diff --git a/examples/DDCodex/compact/CODEX-b.xml b/examples/DDCodex/compact/CODEX-b.xml index 01447458fc5e19d0f087cc06844c96bf1d4adc0d..59baf9f22de406a83b4d43f39e0cef1898045efd 100644 --- a/examples/DDCodex/compact/CODEX-b.xml +++ b/examples/DDCodex/compact/CODEX-b.xml @@ -10,14 +10,17 @@ <define> <constant name="COBEX_beam_angle" value="60*degree"/> <constant name="COBEX_cone_len" value="50*m"/> + <constant name="Global_gap" value="3*cm" /> + <constant name="Layer_thickness" value="1*cm" /> + <constant name="Layer_pitch" value="4*cm" /> </define> <comment>Common Generic visualization attributes</comment> <display> <vis name="BlackVis" alpha="1" r="0.1" g="0.1" b="0.1" showDaughters="false" visible="true"/> - <vis name="Codex_Envelope_Vis" alpha=".3" r="0.7" g="0.7" b="0.7" showDaughters="true" visible="true"/> - <vis name="Codex_Module1_Vis" alpha="1" r="0.8" g="0.2" b="0.2" showDaughters="true" visible="true"/> - <vis name="Codex_Module2_Vis" alpha="1" r="0.2" g="0.8" b="0.2" showDaughters="true" visible="true"/> + <vis name="Codex_Envelope_Vis" alpha="0.7" r="0.2" g="0.2" b="0.7" showDaughters="true" visible="true"/> + <vis name="Codex_Module1_Vis" alpha="0.4" r="0.8" g="0.2" b="0.2" showDaughters="true" visible="true"/> + <vis name="Codex_Module2_Vis" alpha="0.4" r="0.2" g="0.8" b="0.2" showDaughters="true" visible="true"/> <vis name="Codex_Module3_Vis" alpha="1" r="0.2" g="0.2" b="0.8" showDaughters="true" visible="true"/> <vis name="Codex_Shield_Pb_Vis" alpha="1" r="0.4" g="0.4" b="0.4" showDaughters="false" visible="true"/> <vis name="Codex_Shield_Veto_Vis" alpha="1" r="0.9" g="0.9" b="0.0" showDaughters="true" visible="true"/> @@ -28,29 +31,30 @@ <!-- Includes for sensitives and support --> <detectors> - <detector id="1" name="CODEXb" type="DD4hep_CODEXb" vis="Codex_Envelope_Vis" readout="CodexHits"> -<!-- limits="codex_limits" --> + <detector id="1" name="Shield" type="DD4hep_CODEXb_shield" vis="Codex_Envelope_Vis" readout="ShieldHits"> - <envelope angle="COBEX_beam_angle" dz="COBEX_cone_len" rmax="8*m"/> - <shield name="Pb-shield-1" z="7*m" dz="1.5*m" material="Lead" sensitive="true" vis="Codex_Shield_Pb_Vis"/> + <envelope angle="COBEX_beam_angle" dz="COBEX_cone_len" rmax="8*m" /> + <shield name="Pb-shield-1" z="7*m" dz="1.5*m" material="Lead" sensitive="false" vis="Codex_Shield_Pb_Vis"/> <shield name="Shield-veto" z="8.5*m" dz="0.1*m" material="Si" sensitive="true" vis="Codex_Shield_Veto_Vis"/> - <shield name="Pb-shield-2" z="8.6*m" dz="0.5*m" material="Lead" sensitive="true" vis="Codex_Shield_Pb_Vis"/> - - <station z="12*m" width="10*m" height="10*m" thickness="2*cm" - material="Si" sensitive="true" vis="Codex_Module1_Vis" - repeat="3" distance="20*cm"/> - <station width="10*m" height="10*m" thickness="2*cm" - material="Si" sensitive="true" vis="Codex_Module2_Vis" - repeat="8" distance="30*cm"/> - <station width="10*m" height="10*m" thickness="2*cm" - material="Si" sensitive="true" vis="Codex_Module3_Vis" - repeat="5" distance="40*cm"/> + <shield name="Pb-shield-2" z="8.6*m" dz="0.5*m" material="Lead" sensitive="false" vis="Codex_Shield_Pb_Vis"/> <position x="-sin(COBEX_beam_angle)*COBEX_cone_len/2" y="0" z="cos(COBEX_beam_angle)*COBEX_cone_len/2"/> <rotation x="0" y="COBEX_beam_angle" z="0"/> + </detector> + + <detector id="2" name="CODEXb" type="DD4hep_CODEXb_layer" vis="Codex_Envelope_Vis" readout="CodexHits" > + <envelope width="5*m" length="5*m" height="5*m" vis="Codex_Module1_Vis" /> + <station material="Al" width="5*m" thickness="60*cm" height="5*m" + x="1.67*m" y="0" z="0" gap="1.67*m" repeat="5" vis="Codex_Module1_Vis" /> + <layer material="Si" width="5*m" thickness="Layer_thickness" height="5*m" sensitive="true" + x="0" y="0" z="0" gap="Global_gap" distance="Layer_pitch*10" repeat="3" vis="Codex_Module2_Vis" /> + + <position x="2500*cm*sin(60*degree)+500*cm" y="0" z="2500*cm*cos(60*degree)" /> </detector> - </detectors> + + + </detectors> <limits> <limitset name="codex_limits"> <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> @@ -59,8 +63,13 @@ <readouts> <readout name="CodexHits"> <segmentation type="CartesianGridXY" grid_size_x="1*cm" grid_size_y="1*cm" /> - <id>system:8,type:3,station:10,x:32:-16,y:-16</id> - </readout> + <id>system:8,station:5,layer:5,x:32:-16,y:-16</id> + </readout> + <readout name="ShieldHits"> + <segmentation type="CartesianGridXY" grid_size_x="1*cm" grid_size_y="1*cm" /> + <id>system:8,station:5,x:32:-16,y:-16</id> + </readout> + </readouts> <fields> diff --git a/examples/DDCodex/python/CODEX-b-alone.py b/examples/DDCodex/python/CODEX-b-alone.py index c15e530e6d652e5a659158a11f493f21da1fa673..59f2012cb9e3a93e2ed1cb22945b0f52d943959e 100644 --- a/examples/DDCodex/python/CODEX-b-alone.py +++ b/examples/DDCodex/python/CODEX-b-alone.py @@ -39,8 +39,9 @@ def run(): evt_root = geant4.setupROOTOutput('RootOutput','CodexB_'+time.strftime('%Y-%m-%d_%H-%M')) # Setup particle gun - gun = geant4.setupGun("Gun",particle='pi+', - energy=50*GeV, + #gun = geant4.setupGun("Gun",particle='pi+', + gun = geant4.setupGun("Gun",particle='mu-', + energy=1000*GeV, multiplicity=1, isotrop=False,Standalone=True, direction=(0.866025,0,0.5), @@ -49,6 +50,8 @@ def run(): #seq,action = geant4.setupTracker('CODEXb') seq,action = geant4.setupCalorimeter('CODEXb') action.OutputLevel = Output.ERROR + seq,action = geant4.setupCalorimeter('Shield') + action.OutputLevel = Output.ERROR #geant4.setupTracker('CODEX-b-Shield') #geant4.setupTracker('CODEX-b-Stations') diff --git a/examples/DDCodex/src/CODEXb_box.cpp b/examples/DDCodex/src/CODEXb_box.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ed320fa8c0ff1eddc68fbfcf6dce9c451b8a05a0 --- /dev/null +++ b/examples/DDCodex/src/CODEXb_box.cpp @@ -0,0 +1,128 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : Jongho.Lee +// +//========================================================================== +// +// Specialized generic detector constructor +// +//========================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" + +using namespace std; +using namespace dd4hep; +using namespace dd4hep::detail; + +static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { + xml_det_t x_det (e); + xml_comp_t x_box = x_det.envelope(); + xml_dim_t pos = x_det.position(); + string det_name = x_det.nameStr(); + DetElement det(det_name,x_det.id()); + //double env_dz .dz()/2.0; + double env_width = x_box.width(); + double env_length = x_box.length(); + double env_height = x_box.height(); + // If the cone should be removed and replaced by an assembly, + // comment the upper to and enable the lower line + Assembly env_vol(det_name); + PlacedVolume pv; + SensitiveDetector sd = sens; + + sd.setType("tracker"); + // Set visualization, limits and region (if present) + env_vol.setRegion(description, x_det.regionStr()); + env_vol.setLimitSet(description, x_det.limitsStr()); + env_vol.setVisAttributes(description, x_det.visStr()); + printout(INFO,"CODEX-b box","%s width=%g length=%g height= %g", + det_name.c_str(), env_width, env_length, env_height ); + + ///// Test for 1 layer into a CODEXb-box ///// + int type_st_num = 0; + for(xml_coll_t i(x_det, _U(station)); i; ++i, ++type_st_num) { + xml_comp_t station = i; + double st_width = station.width(); + double st_thick = station.thickness(); + double st_height = station.height(); + double st_x = station.x()+pos.x()-env_width; + double st_y = station.y()+pos.y(); + double st_z = station.z()+pos.z(); + int st_repeat = station.repeat(); + double st_gap = station.gap(); + string st_nam = _toString(type_st_num, "CODEX_station_type_%d"); + Box st_box(st_thick, st_height, st_width); + Material st_mat(description.material(station.attr<string>(_U(material)))); + Volume st_vol(st_nam,st_box,st_mat); + st_vol.setVisAttributes(description, station.visStr()); + + int type_la_num = 0; + xml_comp_t layer = x_det.child(_U(layer)); + double la_width = layer.width(); + double la_thick = layer.thickness(); + double la_height = layer.height(); + //double la_gap = layer.gap(); + double la_x = 0; + double la_y = 0; + double la_z = 0; + int la_repeat = layer.repeat(); + double la_pitch = layer.distance(); + string la_nam = _toString(type_la_num, "CODEX_layer_type_%d"); + Box la_box(la_thick, la_height, la_width); + Material la_mat(description.material(layer.attr<string>(_U(material)))); + Volume la_vol(la_nam, la_box, la_mat); + + la_vol.setVisAttributes(description, layer.visStr()); + + if( layer.isSensitive() ) { + la_vol.setSensitiveDetector(sd); + } + + la_x = -st_thick + la_pitch/2.0; + vector<PlacedVolume> la_places; + for(int k=0, layer_number=1; k < la_repeat; ++k, ++layer_number) { + pv = st_vol.placeVolume(la_vol,Position(la_x, la_y, la_z)); + pv.addPhysVolID("layer", layer_number); + printout(INFO, "CODEX-b-layer"," Station: %s layer %d x=%g y=%g z=%g", st_vol.name(), layer_number, la_x, la_y, la_z); + la_places.push_back(pv); + la_x += la_pitch; + } + + for (int j=0, station_number=1; j < st_repeat; ++j, ++station_number ) { + DetElement st_det(det, _toString(station_number, "Station%d"), x_det.id()); + pv = env_vol.placeVolume(st_vol, Position(st_x, st_y, st_z)); + pv.addPhysVolID("station", station_number); + st_det.setPlacement(pv); + printout(INFO, "CODEX-b-station"," Station: %d x=%g y=%g z=%g", station_number,st_x, st_y, st_z); + for(int k=0, layer_number=1; k < la_repeat; ++k, ++layer_number) { + DetElement la_det(st_det, _toString(layer_number, "Layer%d"), x_det.id()); + la_det.setPlacement(la_places[k]); + } + st_x += st_gap; + } // station loop + } + + if ( x_det.isSensitive() ) { + xml_dim_t sd_typ = x_det.child(_U(sensitive)); + env_vol.setSensitiveDetector(sens); + sd.setType(sd_typ.typeStr()); + } + Volume mother = description.pickMotherVolume(det); + //Transform3D trafo(Position(pos.x(),pos.y(),pos.z())); + //Direction dir = trafo*Direction(0,0,1.); + pv = mother.placeVolume(env_vol); + if ( x_det.hasAttr(_U(id)) ) { + pv.addPhysVolID("system",x_det.id()); + } + det.setPlacement(pv); + return det; +} + +DECLARE_DETELEMENT(DD4hep_CODEXb_layer,create_element) diff --git a/examples/DDCodex/src/CODEXb_geo.cpp b/examples/DDCodex/src/CODEXb_geo.cpp index 77a93bfb882e87e73f2fe4de4b96afbe276adb30..7c652e958a8e847797f0e2fc257ad043c8f79512 100644 --- a/examples/DDCodex/src/CODEXb_geo.cpp +++ b/examples/DDCodex/src/CODEXb_geo.cpp @@ -43,16 +43,6 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { SensitiveDetector sd = sens; sd.setType("tracker"); - -#if 0 - Box b(2000,2000,2000); - Volume vb(det_name+"_bbb",b,description.material("Si")); - pv = env_vol.placeVolume(vb, Position(0,0,0)); - vb.setSensitiveDetector(sd); - pv.addPhysVolID("type", 0); - pv.addPhysVolID("station", 20); -#endif - // Set visualization, limits and region (if present) env_vol.setRegion(description, x_det.regionStr()); env_vol.setLimitSet(description, x_det.limitsStr()); @@ -65,7 +55,7 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { tub_vol.setVisAttributes(description, "BlackVis"); pv = env_vol.placeVolume(tub_vol, Position(0,0,0)); - int num_sensitive = 0; + int num_sensitive = 1; for(xml_coll_t i(x_det,_U(shield)); i; ++i) { xml_comp_t shield = i; double z = shield.z(), dz = shield.dz(); @@ -82,56 +72,13 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { if ( shield.isSensitive() ) { DetElement det(sdet, "shield_"+nam, x_det.id()); vol.setSensitiveDetector(sd); - pv.addPhysVolID("type", 0); +// pv.addPhysVolID("type", 0); pv.addPhysVolID("station", num_sensitive); det.setPlacement(pv); ++num_sensitive; } } - int type_num = 0, station_number = 0; - double z0 = 0.0, x0 = 0.0, x_tot = 0.0; - for(xml_coll_t i(x_det,_U(station)); i; ++i, ++type_num) { - xml_comp_t station = i; - x_tot += double(station.repeat())*(station.distance()+station.thickness()); - } - printout(INFO,"CODEX-b","%s X_tot= %g",det_name.c_str(), x_tot); - for(xml_coll_t i(x_det,_U(station)); i; ++i, ++type_num) { - xml_comp_t station = i; - int repeat = station.repeat(); - string nam = _toString(station_number,"CODEX_station_type%d"); - Box box(station.width()/2., station.height()/2., station.thickness()/2.); - Material mat(description.material(station.attr<string>(_U(material)))); - Volume vol(nam,box,mat); - double dist = station.thickness()+station.distance(); - double dx = dist/sin_beam; - double dz = dist/cos_beam; - if ( station.hasAttr(_U(z)) ) { - z0 = station.z()+x_tot/2.0/cos_beam; - x0 = -x_tot/2.0/sin_beam; - } - // Set visualization, limits and region (if present) - vol.setVisAttributes(description, station.visStr()); - vol.setLimitSet(description, station.limitsStr()); - vol.setRegion(description, station.regionStr()); - if ( station.isSensitive() ) { - vol.setSensitiveDetector(sd); - } - for(int j=0; j < repeat; ++j) { - DetElement det(sdet, _toString(station_number,"module%d"), station_number); - pv = env_vol.placeVolume(vol, Transform3D(RotationZYX(0,M_PI/2.0-env_angle,0), Position(x0,0,z0))); - pv.addPhysVolID("type", 1); - pv.addPhysVolID("station", station_number); - printout(INFO,"CODEX-b","%s Module: %2d %-12s x=%g y=%g z=%7g Dist:%g dx:%g dz:%g", - det_name.c_str(), station_number, ('['+string(mat.name())+']').c_str(), - x0, 0.0, z0, dist, dx, dz); - det.setPlacement(pv); - x0 += dx; - z0 += dz; - ++station_number; - } - } - Volume mother = description.pickMotherVolume(sdet); Transform3D trafo(RotationZYX(rot.z(),rot.y(),rot.x()),Position(-pos.x(),-pos.y(),pos.z())); Direction dir = trafo*Direction(0,0,1.); @@ -144,5 +91,5 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_CODEXb,create_element) +DECLARE_DETELEMENT(DD4hep_CODEXb_shield,create_element) diff --git a/examples/DDDB/data/lhcbfull.root b/examples/DDDB/data/lhcbfull.root new file mode 100644 index 0000000000000000000000000000000000000000..065a44924241dfb7d4f9ff137f7ca01f31c0df46 Binary files /dev/null and b/examples/DDDB/data/lhcbfull.root differ diff --git a/examples/DDDB/data/lhcbfull_plugins.xml b/examples/DDDB/data/lhcbfull_plugins.xml new file mode 100644 index 0000000000000000000000000000000000000000..77811e46271f3d8b29b0a9a8d8cf3a1c4803588e --- /dev/null +++ b/examples/DDDB/data/lhcbfull_plugins.xml @@ -0,0 +1,336 @@ +<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + <info name="lhcb_full" + title="LHCb detector geometry imported from plain ROOT file" + author="Markus Frank" + url="http://lhcb.cern.ch" + status="development" + version="1.0"> + <comment>The conversion of a detector in plain ROOT format</comment> + </info> + + <geometry open="false" close="false"> + </geometry> + + <display> + <vis name="Velo_Inactive_vis" alpha="0.5" r="0" g="0.4" b="0.6" showDaughters="true" visible="true"/> + <vis name="Velo_Active_vis" alpha="1.0" r="0" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="TT_Inactive_vis" alpha="0.5" r="0" g="0.0" b="0.4" showDaughters="true" visible="true"/> + <vis name="TT_Active_vis" alpha="1.0" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="OT_Inactive_vis" alpha="0.5" r="0.4" g="0.0" b="0.4" showDaughters="true" visible="true"/> + <vis name="OT_Active_vis" alpha="1.0" r="0.8" g="0.0" b="0.8" showDaughters="true" visible="true"/> + + </display> + + <plugins> + + <!-- Load the geometry file in ROOT format --> + <plugin name="DD4hep_PlainROOT"> + <argument value="-input"/> + <argument value="checkout/examples/DDDB/data/lhcbfull.root"/> + <argument value="-import"/> + <argument value="-air"/> + <argument value="sAir"/> + <argument value="-vacuum"/> + <argument value="sVacuum"/> + <argument value="-level"/> + <argument value="11"/> + <argument value="-print"/> + <argument value="DEBUG"/> + </plugin> + + <!-- execute the VELO processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sSilicon"/> + <argument value="-match"/> + <argument value="VelolvVelo"/> + <argument value="-veto"/> + <argument value="VeloSupports"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + <!-- execute the IT processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sSilicon"/> + <argument value="-match"/> + <argument value="ITITS"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + <!-- execute the OT processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sTrackerOTPassiveMix"/> + <argument value="-match"/> + <argument value="OTlvOTStation"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + <!-- execute the PRS processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sPrsPrsScin"/> + <argument value="-match"/> + <argument value="PrsInstallationPrs"/> + <argument value="-type"/> + <argument value="calorimeter"/> + </plugin> + + <!-- execute the SPD processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sSpdSpdScin"/> + <argument value="-match"/> + <argument value="SpdInstallationSpd"/> + <argument value="-type"/> + <argument value="calorimeter"/> + </plugin> + + <!-- execute the ECAL processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sEcalEcalSc"/> + <argument value="-match"/> + <argument value="EcalInstallationEcal"/> + <argument value="-type"/> + <argument value="calorimeter"/> + </plugin> + + <!-- execute the HCAL processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sHcalHcalSc"/> + <argument value="-match"/> + <argument value="HcalInstallationlvHcal"/> + <argument value="-type"/> + <argument value="calorimeter"/> + </plugin> + + + <!-- execute the MUON processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sMuonS_CPC_gas"/> + <argument value="-match"/> + <argument value="Muon"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + <!-- execute the RICH1 processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sRichMaterialsAerogel"/> + <argument value="-match"/> + <argument value="Rich1lvRich1Master"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + <!-- execute the RICH2 processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_PlacedVolumeProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetElementCreator"/> + <argument value="-print"/> + <argument value="DEBUG"/> + <argument value="-level"/> + <argument value="2"/> + <argument value="-material"/> + <argument value="sRichMaterialsRich2Nitrogen"/> + <argument value="-match"/> + <argument value="Rich2lvRich2Master"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + <!-- execute the RICH2 processor to generate readout and sensitive structure(s) --> + <plugin name="DD4hep_DetElementProcessor"> + <argument value="-recursive"/> + <argument value="-processor"/> + <argument value="DD4hep_DetNominalCreator"/> + <argument value="-type"/> + <argument value="tracker"/> + </plugin> + + + <plugin name="DD4hep_VolumeManager"/> + <plugin name="DD4hep_InteractiveUI"/> + + <plugin name="DD4hep_CheckSensitives"/> + <plugin name="DD4hep_CheckReadouts"/> + <plugin name="DD4hep_CheckVolumeManager"/> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-detector"/> + <arg value="VelolvVelo_4842"/> + <arg value="-processor"/> + <arg value="DD4hep_VisMaterialProcessor"/> + <arg value="-name"/> + <arg value="Si_Vis"/> + <arg value="-vis-active"/> + <arg value="Velo_Active_Vis"/> + <arg value="-vis-inactive"/> + <arg value="Velo_Inactive_Vis"/> + <arg value="-mat-active"/> + <arg value="sSilicon"/> + <arg value="-show"/> + </plugin> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-detector"/> + <arg value="ITITS5lvITS5_4831"/> + <arg value="-processor"/> + <arg value="DD4hep_VisMaterialProcessor"/> + <arg value="-name"/> + <arg value="Si_Vis"/> + <arg value="-vis-active"/> + <arg value="TT_Active_Vis"/> + <arg value="-vis-inactive"/> + <arg value="TT_Inactive_Vis"/> + <arg value="-mat-active"/> + <arg value="sSilicon"/> + <arg value="-show"/> + </plugin> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-detector"/> + <arg value="ITITS4lvITS4_4832"/> + <arg value="-processor"/> + <arg value="DD4hep_VisMaterialProcessor"/> + <arg value="-name"/> + <arg value="Si_Vis"/> + <arg value="-vis-active"/> + <arg value="TT_Active_Vis"/> + <arg value="-vis-inactive"/> + <arg value="TT_Inactive_Vis"/> + <arg value="-mat-active"/> + <arg value="sSilicon"/> + <arg value="-show"/> + </plugin> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-detector"/> + <arg value="ITITS3lvITS3_4833"/> + <arg value="-processor"/> + <arg value="DD4hep_VisMaterialProcessor"/> + <arg value="-name"/> + <arg value="Si_Vis"/> + <arg value="-vis-active"/> + <arg value="TT_Active_Vis"/> + <arg value="-vis-inactive"/> + <arg value="TT_Inactive_Vis"/> + <arg value="-mat-active"/> + <arg value="sSilicon"/> + <arg value="-show"/> + </plugin> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-detector"/> + <arg value="ITITS2lvITS2_4834"/> + <arg value="-processor"/> + <arg value="DD4hep_VisMaterialProcessor"/> + <arg value="-name"/> + <arg value="Si_Vis"/> + <arg value="-vis-active"/> + <arg value="TT_Active_Vis"/> + <arg value="-vis-inactive"/> + <arg value="TT_Inactive_Vis"/> + <arg value="-mat-active"/> + <arg value="sSilicon"/> + <arg value="-show"/> + </plugin> + + <plugin name="DD4hep_PlacedVolumeProcessor"> + <arg value="-recursive"/> + <arg value="-detector"/> + <arg value="ITITS1lvITS1_4835"/> + <arg value="-processor"/> + <arg value="DD4hep_VisMaterialProcessor"/> + <arg value="-name"/> + <arg value="Si_Vis"/> + <arg value="-vis-active"/> + <arg value="TT_Active_Vis"/> + <arg value="-vis-inactive"/> + <arg value="TT_Inactive_Vis"/> + <arg value="-mat-active"/> + <arg value="sSilicon"/> + <arg value="-show"/> + </plugin> + + </plugins> +</lccdd>