diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index 44338fcda433d403c9d563cdc041d287d4899902..17b0f426afbfeb22a7f6cf52570d65cc65e2607d 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -181,7 +181,7 @@ namespace DD4hep { std::string path; int combineHits; Volume volume; - Readout readout; + // Readout readout; Alignment alignment; Conditions conditions; PlacedVolume placement; @@ -338,12 +338,16 @@ namespace DD4hep { DetElement& setRegion(const LCDD& lcdd, const std::string& name, const Volume& volume); /// Set the limits to the detector element DetElement& setLimitSet(const LCDD& lcdd, const std::string& name, const Volume& volume); - + +#if 0 + !!!! + !!!! MUST remove this: double caching and invalid information in case of reflection etc. + !!!! /// Access the readout structure Readout readout() const; /// Assign readout definition DetElement& setReadout(const Readout& readout); - +#endif /// Access to the logical volume of the daughter placement Volume volume() const; diff --git a/DDCore/include/DD4hep/Handle.h b/DDCore/include/DD4hep/Handle.h index 79cbc88eb4f48aeb8895824de74846b0a3582d2c..954ed8901a499b35a491227a7aa420b1a293881a 100644 --- a/DDCore/include/DD4hep/Handle.h +++ b/DDCore/include/DD4hep/Handle.h @@ -105,7 +105,7 @@ namespace DD4hep { void increment_object_validations(); std::string typeName(const std::type_info& type); - static unsigned long magic_word() { return 0xFEEDAFFEDEADFACEL; } + inline unsigned long magic_word() { return 0xFEEDAFFEDEADFACEL; } /** @class Value Handle.h * @@ -201,7 +201,7 @@ namespace DD4hep { /// Helper to delete objects from heap and reset the handle template <typename T> inline void destroyHandle(T& h) { deletePtr(h.m_element); - }; + } /// Functor to delete objects from heap and reset the pointer template <typename T> struct DestroyObject { void operator()(T& p) const { diff --git a/DDCore/include/DD4hep/VolumeManager.h b/DDCore/include/DD4hep/VolumeManager.h index d145ccf3d78f49c888badb4aa9ece08c2f67e56a..c992230ae08dbf12a4bd9a84ed5a4e539ef18792 100644 --- a/DDCore/include/DD4hep/VolumeManager.h +++ b/DDCore/include/DD4hep/VolumeManager.h @@ -197,14 +197,14 @@ namespace DD4hep { * Please see enum PopulateFlags for further info. * No action whatsoever is performed here, if the detector element is not valid. */ - VolumeManager(const std::string& name, DetElement world=DetElement(), int flags=NONE); + VolumeManager(const std::string& name, DetElement world=DetElement(), Readout ro=Readout(), int flags=NONE); /// Add a new Volume manager section according to a new subdetector - VolumeManager addSubdetector(DetElement detector); + VolumeManager addSubdetector(DetElement detector, Readout ro); /// Access the volume manager by cell id VolumeManager subdetector(VolumeID id) const; /// Assign the top level detector element to this manager - void setDetector(DetElement e); + void setDetector(DetElement det_eleemnt, Readout ro); /// Access the top level detector element DetElement detector() const; /// Assign IDDescription to VolumeManager structure diff --git a/DDCore/src/Detector.cpp b/DDCore/src/Detector.cpp index 9c1296801f11ab1ecc76aeb3270098ec1ee37fc0..3f07f3f0a580aae3c2f8fdb69d329205e17f8e63 100644 --- a/DDCore/src/Detector.cpp +++ b/DDCore/src/Detector.cpp @@ -124,7 +124,7 @@ static DetElement _par(DetElement o, DetElement top, vector<TGeoNode*>& det_node /// Default constructor DetElement::Object::Object() - : magic(magic_word()), id(0), combineHits(0), readout(), + : magic(magic_word()), id(0), combineHits(0),// readout(), alignment(), placement(), parent(), children(), worldTrafo(0), parentTrafo(0), referenceTrafo(0) { @@ -138,7 +138,7 @@ DetElement::Object::~Object() { deletePtr(parentTrafo); deletePtr(referenceTrafo); volume.clear(); - readout.clear(); + //readout.clear(); alignment.clear(); conditions.clear(); placement.clear(); @@ -166,7 +166,7 @@ Value<TNamed,DetElement::Object>* DetElement::Object::clone(int new_id, int flag Ref_t det(obj); obj->id = new_id; obj->combineHits = combineHits; - obj->readout = readout; + //obj->readout = readout; obj->volume = volume; obj->alignment = Alignment(); obj->conditions = Conditions(); @@ -372,7 +372,7 @@ DetElement& DetElement::setCombineHits(bool value, SensitiveDetector& sens) { if ( sens.isValid() ) sens.setCombineHits(value); return *this; } - +#if 0 Readout DetElement::readout() const { return _data().readout; } @@ -381,7 +381,7 @@ DetElement& DetElement::setReadout(const Readout& readout) { _data().readout = readout; return *this; } - +#endif const DetElement::Children& DetElement::children() const { return _data().children; } diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp index 0790ab6ee50199f56e94f53108893434ca26e874..6d66e0e4ed75440830817032cec04616818d8577 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/LCDDImp.cpp @@ -322,7 +322,9 @@ namespace { const vector<const TGeoNode*>& elt_nodes) { static int s_count = 0; - Readout ro = parent.readout(); + Volume vol = PlacedVolume(n).volume(); + SensitiveDetector sd = vol.sensitiveDetector(); + Readout ro = sd.readout(); const IDDescriptor& en = ro.idSpec(); IDDescriptor::VolumeID volume_id = encode_cell(ro,ids); PlacedVolume pv = Ref_t(n); @@ -393,11 +395,12 @@ void LCDDImp::endDocument() { /// we will rename them to use the name of the volume they are assigned to mgr->CloseGeometry(); m_world.setPlacement(PlacedVolume(mgr->GetTopNode())); - m_volManager = VolumeManager("World", m_world, VolumeManager::TREE); + m_volManager = VolumeManager("World", m_world, Readout(), VolumeManager::TREE); ShapePatcher patcher(m_volManager,m_world); patcher.patchShapes(); //patcher.printVolumes(); - cout << m_volManager << endl; + //cout << m_volManager << endl; + cout << "++ Volume manager populated and shaped names successfully updated." << endl; } } diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index ed3bd47c3ac6616148459e0471bfef9f33c812a0..a64cded473a5d7d342b88466e09137c08bd6b3db 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -62,11 +62,26 @@ namespace { { const TGeoNode* node = pv.ptr(); if ( node ) { + Volume vol = pv.volume(); node_chain.push_back(node); elt_nodes.push_back(node); ids.PlacedVolume::VolIDs::Base::insert(ids.end(),pv.volIDs().begin(),pv.volIDs().end()); - if ( pv.volume().isSensitive() ) { - add_entry(parent, e, node, ids, node_chain, elt_nodes); + if ( vol.isSensitive() ) { + SensitiveDetector sd = vol.sensitiveDetector(); + Readout ro = sd.readout(); + //Readout ro = parent.readout(); + if ( ro.isValid() ) { + add_entry(parent, e, node, ids, node_chain, elt_nodes); + } + else { + cout << "VolumeManager [" << parent.name() + << "]: Strange constellation volume " << pv.volume().name() + << " is sensitive, but has no readout!" + << " sd:" << sd.ptr() + << " ro:" << ro.ptr() << "," << ro.ptr() + << " Id:" << ro.idSpec().ptr() + << endl; + } } for(Int_t idau=0, ndau=node->GetNdaughters(); idau<ndau; ++idau) { TGeoNode* daughter = node->GetDaughter(idau); @@ -98,9 +113,11 @@ namespace { void add_entry(DetElement parent, DetElement e,const TGeoNode* n, const PlacedVolume::VolIDs& ids, const Chain& nodes, const Chain& elt_nodes) { - Readout ro = parent.readout(); - IDDescriptor iddesc = ro.idSpec(); - VolumeManager section = m_volManager.addSubdetector(parent); + Volume vol = PlacedVolume(n).volume(); + SensitiveDetector sd = vol.sensitiveDetector(); + Readout ro = sd.readout(); + IDDescriptor iddesc = ro.idSpec(); + VolumeManager section = m_volManager.addSubdetector(parent,ro); pair<VolumeID,VolumeID> code = encoding(iddesc, ids); // This is the block, we effectively have to save for each physical volume with a VolID @@ -124,7 +141,9 @@ namespace { const PlacedVolume::VolIDs& ids, const Chain& nodes, const Chain& elt_nodes) { static int s_count = 0; - Readout ro = parent.readout(); + Volume vol = PlacedVolume(n).volume(); + SensitiveDetector sd = vol.sensitiveDetector(); + Readout ro = sd.readout(); const IDDescriptor& en = ro.idSpec(); PlacedVolume pv = Ref_t(n); bool sensitive = pv.volume().isSensitive(); @@ -207,14 +226,14 @@ VolumeManager::Context* VolumeManager::Object::search(const VolIdentifier& id) } /// Initializing constructor to create a new object -VolumeManager::VolumeManager(const string& nam, DetElement elt, int flags) +VolumeManager::VolumeManager(const string& nam, DetElement elt, Readout ro, int flags) { Value<TNamed,Object>* ptr = new Value<TNamed,Object>(); assign(ptr,nam,"VolumeManager"); if ( elt.isValid() ) { Populator p(*this); Object& o = _data(); - setDetector(elt); + setDetector(elt, ro); o.top = ptr; o.flags = flags; p.populate(elt); @@ -222,13 +241,12 @@ VolumeManager::VolumeManager(const string& nam, DetElement elt, int flags) } /// Add a new Volume manager section according to a new subdetector -VolumeManager VolumeManager::addSubdetector(DetElement detector) { +VolumeManager VolumeManager::addSubdetector(DetElement detector, Readout ro) { if ( isValid() ) { Object& o = _data(); Detectors::const_iterator i=o.subdetectors.find(detector); if ( i == o.subdetectors.end() ) { // First check all pre-conditions - Readout ro = detector.readout(); if ( !ro.isValid() ) { throw runtime_error("VolumeManager::addSubdetector: Only subdetectors with a " "valid readout descriptor are allowed. [Invalid DetElement]"); @@ -249,7 +267,7 @@ VolumeManager VolumeManager::addSubdetector(DetElement detector) { VolumeManager m = (*i).second; IDDescriptor::Field field = ro.idSpec().field(id.first); Object& mo = m._data(); - m.setDetector(detector); + m.setDetector(detector,ro); mo.top = o.top; mo.flags = o.flags; mo.system = field; @@ -278,11 +296,10 @@ VolumeManager VolumeManager::subdetector(VolumeID id) const { } /// Assign the top level detector element to this manager -void VolumeManager::setDetector(DetElement e) { +void VolumeManager::setDetector(DetElement e, Readout ro) { if ( isValid() ) { if ( e.isValid() ) { Object& o = _data(); - Readout ro = e.readout(); o.id = ro.isValid() ? ro.idSpec() : IDDescriptor(); o.detector = e; return; @@ -329,8 +346,10 @@ void VolumeManager::adoptPlacement(VolumeID sys_id, Context* context) { } if ( i == o.volumes.end() ) { o.volumes[vid] = context; +#if 0 cout << "Inserted new volume:" << o.volumes.size() << " ID:" << (void*)context->identifier << " Mask:" << (void*)context->mask << endl; +#endif return; } err << "Attempt to register twice volume with identical volID to detector " << o.detector.name() diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index b915351f344e9ba7e5dc9c91bf45548b80c9099a..9524a00231c75e03f96ee9ee08d9102c61153d65 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -651,9 +651,6 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { DetElement det(Ref_t(ROOT::Reflex::PluginService::Create<TNamed*>(type,&lcdd,&element,&sens))); if ( det.isValid() ) { setChildTitles(make_pair(name,det)); - if ( attr_ro ) { - det.setReadout(sd.readout()); - } } cout << (det.isValid() ? "Converted" : "FAILED ") << " subdetector:" << name << " of type " << type; diff --git a/DDCore/src/plugins/LCDD2Output.cpp b/DDCore/src/plugins/LCDD2Output.cpp index 0e409a5778f6057111b930dff3c883ee43da55d0..f3ad97ed4dc71bd84f2f3317a4e1ef553a524d88 100644 --- a/DDCore/src/plugins/LCDD2Output.cpp +++ b/DDCore/src/plugins/LCDD2Output.cpp @@ -74,13 +74,11 @@ namespace DD4hep { char text[256]; const DetElement& sd = val; PlacedVolume plc = sd.placement(); - bool rdo = sd.readout().isValid(); bool vis = plc.isValid(); bool env = plc.isValid(); bool mat = plc.isValid(); - ::snprintf(text,sizeof(text),"ID:%-3d Combine Hits:%3s Readout:%s Material:%s Envelope:%s VisAttr:%s", + ::snprintf(text,sizeof(text),"ID:%-3d Combine Hits:%3s Material:%s Envelope:%s VisAttr:%s", sd.id(), yes_no(sd.combineHits()), - rdo ? sd.readout()->GetName() : yes_no(rdo), mat ? plc.material()->GetName() : yes_no(mat), env ? plc.motherVol()->GetName() : yes_no(env), yes_no(vis) diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index fbe09190c4388175c16ce709c4e12cdc091e3055..358123f0a1d2fa7fcadee06ccb2b31fb5a31036e 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -1094,11 +1094,6 @@ xml_doc_t LCDDConverter::createLCDD(DetElement top) { geo.doc_setup.setAttr(_U(version),Unicode("1.0")); // Ensure that all required materials are present in the LCDD material table -#if 0 - const LCDD::HandleMap& mat = lcdd.materials(); - for(LCDD::HandleMap::const_iterator i=mat.begin(); i!=mat.end(); ++i) - geo.materials.insert(dynamic_cast<TGeoMedium*>((*i).second.ptr())); -#endif const LCDD::HandleMap& fld = lcdd.fields(); for(LCDD::HandleMap::const_iterator i=fld.begin(); i!=fld.end(); ++i) geo.fields.insert((*i).second.ptr()); diff --git a/DDExamples/CLICSiD/compact/BarrelCalorimeter.xml b/DDExamples/CLICSiD/compact/BarrelCalorimeter.xml new file mode 100644 index 0000000000000000000000000000000000000000..84a73e42c5a4e0fafa9b5790ea9789ae2692c2ff --- /dev/null +++ b/DDExamples/CLICSiD/compact/BarrelCalorimeter.xml @@ -0,0 +1,427 @@ +<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="clic_sid_cdr" + title="CLIC Silicon Detector CDR" + author="Christian Grefe" + url="https://twiki.cern.ch/twiki/bin/view/CLIC/ClicSidCdr" + status="development" + version="$Id: compact.xml 513 2013-04-05 14:31:53Z gaede $"> + <comment>The compact format for the CLIC Silicon Detector used for the conceptual design report</comment> + </info> + + <includes> + <gdmlFile ref="elements.xml"/> + <gdmlFile ref="materials.xml"/> + <pyBuilder ref="../drivers"/> + </includes> + + <define> + <constant name="world_side" value="30000"/> + <constant name="world_x" value="world_side"/> + <constant name="world_y" value="world_side"/> + <constant name="world_z" value="world_side"/> + + <constant name="CrossingAngle" value="0.020"/> + + <constant name="CaloSides" value="12"/> + <constant name="MuonSides" value="8"/> + + <constant name="EcalBarrel_rmin" value="126.50*cm"/> + <constant name="EcalBarrel_zmax" value="176.50*cm"/> + <constant name="EcalEndcap_rmin" value="21.0*cm"/> + <constant name="EcalEndcap_rmax" value="(EcalBarrel_rmin - 1.5*cm) / (cos(pi/CaloSides))"/> <!-- Correction from going from inner circle to outer circle --> + <constant name="EcalEndcap_zmin" value="165.70*cm"/> + + <constant name="HcalBarrel_rmin" value="141.90*cm"/> + <constant name="HcalBarrel_layers" value="(int) 75"/> + <constant name="HcalBarrel_layer_thickness" value="1.0*cm + 0.65*cm"/> + <constant name="HcalEndcap_zmin" value="EcalBarrel_zmax + 4.0*cm"/> <!-- Gap for cables --> + <constant name="HcalEndcap_rmin" value="50.0*cm"/> + <constant name="HcalEndcap_rmax" value="(HcalBarrel_rmin + HcalBarrel_layers * HcalBarrel_layer_thickness) / (cos(pi/CaloSides))"/> <!-- Correction from going from inner circle to outer circle --> + <constant name="HcalEndcap_layers" value="60"/> + <constant name="HcalEndcap_layer_thickness" value="2.0*cm + 0.65*cm"/> + <constant name="HcalEndcap_zmax" value="HcalEndcap_zmin + HcalEndcap_layers * HcalEndcap_layer_thickness"/> + + <constant name="tracking_region_radius" value="EcalBarrel_rmin - 1.0"/> + <constant name="tracking_region_zmax" value="EcalEndcap_zmin - 1.0"/> + <constant name="VXD_CF_sensor" value="0.026*cm"/> + <constant name="VXD_CF_support" value="0.05*cm"/> + + <constant name="SolenoidBarrelInnerRadius" value="HcalEndcap_rmax + 2.0*cm"/> + <constant name="SolenoidCoilOuterZ" value="HcalEndcap_zmax"/> <!-- Aligned with HCAL endcap --> + <constant name="SolenoidBarrelInnerCryostatThickness" value="3.0*cm"/> + <constant name="SolenoidBarrelInnerAirgapThickness" value="11.0*cm"/> + <constant name="SolenoidBarrelAlConductorThickness" value="38.4*cm"/> + <constant name="SolenoidBarrelQuenchbackThickness" value="5.0*cm"/> + <constant name="SolenoidBarrelOuterAirgapThickness" value="18.7*cm"/> + <constant name="SolenoidBarrelOuterCryostatThickness" value="4.0*cm"/> + <constant name="SolenoidEndcapCryostatThickness" value="6.0*cm"/> + <constant name="SolenoidEndcapAirgapThickness" value="12.0*cm"/> + <constant name="SolenoidBarrelOuterZ" value="SolenoidCoilOuterZ+SolenoidEndcapAirgapThickness"/> + <constant name="SolenoidBarrelConductorInnerRadius" value="SolenoidBarrelInnerRadius + SolenoidBarrelInnerCryostatThickness + SolenoidBarrelInnerAirgapThickness"/> + <constant name="SolenoidBarrelOuterCryostatInnerRadius" value="SolenoidBarrelConductorInnerRadius + SolenoidBarrelAlConductorThickness + SolenoidBarrelQuenchbackThickness"/> + <constant name="SolenoidBarrelOuterRadius" value="SolenoidBarrelOuterCryostatInnerRadius + SolenoidBarrelOuterAirgapThickness + SolenoidBarrelOuterCryostatThickness"/> + <constant name="SolenoidalFieldRadius" value="(SolenoidBarrelConductorInnerRadius + SolenoidBarrelAlConductorThickness / 2.0)"/> + + <constant name="MuonBarrel_rmin" value="SolenoidBarrelOuterRadius + 1.0*cm"/> + <constant name="MuonBarrel_zmax" value="SolenoidBarrelOuterZ + SolenoidEndcapCryostatThickness"/> + <constant name="MuonBarrel_layers" value="15"/> + <constant name="MuonBarrel_layer_thickness" value="10.0*cm + 4.0*cm"/> + <constant name="MuonEndcap_zmin" value="MuonBarrel_zmax + 10.0*cm"/> <!-- Space for cables etc. --> + <constant name="MuonEndcap_rmin" value="69.0*cm"/> <!-- Space for QD0 and anti-solenoid--> + <constant name="MuonEndcap_rmax" value="(MuonBarrel_rmin + 57.0*cm + MuonBarrel_layers * MuonBarrel_layer_thickness) / (cos(pi/MuonSides))"/> <!-- Correction from going from inner circle to outer circle --> + <constant name="MuonEndcap_layers" value="18"/> + <constant name="MuonEndcap_layer_thickness" value="10.0*cm + 4.0*cm"/> + <constant name="MuonEndcap_zmax" value="MuonEndcap_zmin + MuonEndcap_layers * MuonEndcap_layer_thickness"/> + + <constant name="LumiCal_rmin" value="6.4*cm"/> + <constant name="LumiCal_rmax" value="EcalEndcap_rmin + 3.0*cm"/> + <constant name="LumiCal_zmin" value="HcalEndcap_zmin"/> + <constant name="LumiCal_thickness" value="20*0.371*cm + 15*0.643*cm"/> + <constant name="LumiCal_zmax" value="LumiCal_zmin + LumiCal_thickness"/> + <constant name="LumiCalElectronics_rmax" value="LumiCal_rmax+5.0*cm"/> + + <constant name="SupportTube_thickness" value="1.0*cm"/> + <constant name="ForwardVacuumValve_thickness" value="36.0*cm"/> + <constant name="ForwardShielding_thickness" value="5.0*cm"/> + <constant name="ForwardMask_thickness" value="10.0*cm"/> + <constant name="ForwardMask_zmin" value="LumiCal_zmax + ForwardShielding_thickness + ForwardVacuumValve_thickness"/> + <constant name="BeamCal_rmax" value="13.0*cm"/> + <constant name="BeamCal_zmin" value="ForwardMask_zmin + ForwardMask_thickness"/> + + <constant name="VertexSupport_r1" value="16.87*cm"/> + <constant name="VertexSupport_r2" value="18.42*cm"/> + <constant name="VertexSupport_zmax" value="89.48*cm"/> + + <constant name="VertexBarrel_zmax" value="10.0*cm"/> + <constant name="VertexBarrel_r1" value="2.7*cm"/> + <constant name="VertexBarrel_r2" value="3.8*cm"/> + <constant name="VertexBarrel_r3" value="5.1*cm"/> + <constant name="VertexBarrel_r4" value="6.4*cm"/> + <constant name="VertexBarrel_r5" value="7.7*cm"/> + + <constant name="CentralBeamPipe_zmax" value="23.0*cm"/> + <constant name="CentralBeamPipe_rmax" value="VertexBarrel_r1 - 0.2*cm"/> + <constant name="CentralBeamPipe_thickness" value="CentralBeamPipe_rmax * 0.02"/> <!-- 1% of the diameter --> + <constant name="CentralBeamPipe_rmin" value="CentralBeamPipe_rmax - CentralBeamPipe_thickness"/> + <constant name="BeamPipe_thickness" value="0.4*cm"/> + <constant name="BeamPipe_endThickness" value="0.1*cm"/> + <constant name="BeamPipe_zmax" value="LumiCal_zmin - 0.5*cm"/> + <constant name="BeamPipe_rmax" value="19.0*cm"/> + <constant name="BeamPipe_rmin" value="BeamPipe_rmax - BeamPipe_thickness"/> + <constant name="bp_cone_slope" value="(BeamPipe_rmax-CentralBeamPipe_rmax)/(tracking_region_zmax-CentralBeamPipe_zmax)"/> + <constant name="BeamPipe_zmin" value="CentralBeamPipe_zmax + (BeamPipe_thickness - CentralBeamPipe_thickness)/bp_cone_slope"/> + <constant name="BeamPipeLiner_thickness" value="0.0*cm"/> + + <constant name="VertexEndcap_rmax" value="11.5*cm"/> + <constant name="VertexEndcap_z1" value="12.0*cm"/> + <constant name="VertexEndcap_z2" value="16.0*cm"/> + <constant name="VertexEndcap_z3" value="20.0*cm"/> + <constant name="VertexEndcap_z4" value="24.0*cm"/> + <constant name="VertexEndcap_offset" value="0.2*cm"/> + <constant name="VertexEndcapModules" value="16"/> + <constant name="VertexEndcap_rmin1" value="CentralBeamPipe_rmax + VertexEndcap_offset"/> + <constant name="VertexEndcap_rmin2" value="CentralBeamPipe_rmax + VertexEndcap_offset"/> + <constant name="VertexEndcap_rmin3" value="CentralBeamPipe_rmax + VertexEndcap_offset"/> + <constant name="VertexEndcap_rmin4" value="(VertexEndcap_z4 - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexEndcap_offset"/> + + <constant name="ForwardTracker_rmax" value="16.87*cm"/> + <constant name="ForwardTracker_z1" value="28.0*cm"/> + <constant name="ForwardTracker_z2" value="50.0*cm"/> + <constant name="ForwardTracker_z3" value="83.0*cm"/> + <constant name="ForwardTracker_offset" value="0.2*cm"/> + <constant name="ForwardTrackerModules" value="16"/> + <constant name="ForwardTracker_rmin1" value="(ForwardTracker_z1 - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + ForwardTracker_offset"/> + <constant name="ForwardTracker_rmin2" value="(ForwardTracker_z2 - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + ForwardTracker_offset"/> + <constant name="ForwardTracker_rmin3" value="(ForwardTracker_z3 - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + ForwardTracker_offset"/> + + <constant name="VertexService_zmin" value="ForwardTracker_z1 + 1.0*cm"/> + <constant name="VertexService_zmax" value="VertexService_zmin + 2.0*cm"/> + <constant name="VertexServiceThickness" value="0.3*cm"/> + <constant name="VertexCableThickness" value="0.005*cm"/> + + <constant name="IncomingBP_radius" value="0.25*cm"/> + <constant name="IncomingBP_thickness" value="0.05*cm"/> + <constant name="OutgoingBP_radius" value="tan(CrossingAngle/2)*BeamCal_zmin"/> + <constant name="OutgoingBP_thickness" value="0.1*cm"/> + + </define> + <materials> + <material name="TungstenDens23"> + <D value="17.7" unit="g/cm3"/> + <fraction n="0.925" ref="W"/> + <fraction n="0.066" ref="Ni"/> + <fraction n="0.009" ref="Fe"/> + </material> + <material name="TungstenDens24"> + <D value="17.8" unit="g/cm3"/> + <fraction n="0.93" ref="W"/> + <fraction n="0.061" ref="Ni"/> + <fraction n="0.009" ref="Fe"/> + </material> + <material name="TungstenDens25"> + <D value="18.2" unit="g/cm3"/> + <fraction n="0.950" ref="W"/> + <fraction n="0.044" ref="Ni"/> + <fraction n="0.006" ref="Fe"/> + </material> + <material name="CarbonFiber_25percent"> + <D type="density" value="0.375" unit="g/cm3"/> + <fraction n="1.0" ref="CarbonFiber"/> + </material> + <material name="CarbonFiber_15percent"> + <D type="density" value="0.225" unit="g/cm3"/> + <fraction n="1.0" ref="CarbonFiber"/> + </material> + <material name="Rohacell31_50percent"> + <D type="density" value="0.016" unit="g/cm3"/> + <fraction n="1.0" ref="Rohacell31"/> + </material> + <material name="Rohacell31_15percent"> + <D type="density" value="0.0048" unit="g/cm3"/> + <fraction n="1.0" ref="Rohacell31"/> + </material> + <material name="BoratedPolyethylene5"> + <D value="0.93" unit="g/cm3"/> + <fraction n="0.612" ref="C"/> + <fraction n="0.222" ref="O"/> + <fraction n="0.116" ref="H"/> + <fraction n="0.050" ref="B"/> + </material> + <material name="SiliconCarbide"> + <D value="3.1" unit="g/cm3"/> + <composite n="1" ref="Si"/> + <composite n="1" ref="C"/> + </material> + <material name="SiliconCarbide_6percent"> + <D value="0.186" unit="g/cm3"/> + <fraction n="1.0" ref="SiliconCarbide"/> + </material> + <material name="Graphite"> + <D value="1.7" unit="g/cm3"/> + <composite n="1" ref="C"/> + </material> + </materials> + <limits> + <limitset name="cal_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + </limitset> + </limits> + + + <display> + <vis name="InvisibleNoDaughters" showDaughters="false" visible="false"/> + <vis name="InvisibleWithDaughters" showDaughters="true" visible="false"/> + + <vis name="MuonBarrelVis" alpha="1" r="1" g="0.4" b="0.62" showDaughters="true" visible="true"/> + <vis name="MuonBarrelStavesVis" alpha="1" r="0" g="0.7" b="0.3" showDaughters="true" visible="true"/> + <vis name="MuonBarrelLayerVis" alpha="1" r="0" g="1" b="0.3" showDaughters="true" visible="true"/> + <vis name="MuonBarrelSensorVis" alpha="1" r="0.54" g="0.4" b="0.41" visible="true"/> + <vis name="MuonBarrelAbsorberVis" alpha="1" r="0.28" g="0.4" b="0.62" visible="true"/> + + <vis name="MuonEndcapVis" alpha="1" r="1" g="0.4" b="0.62" showDaughters="true" visible="true"/> + <vis name="MuonEndcapLayerVis" alpha="1" r="0" g="1" b="0.3" showDaughters="true" visible="true"/> + <vis name="MuonEndcapSensorVis" alpha="1" r="0.54" g="0.4" b="0.41" visible="true"/> + <vis name="MuonEndcapAbsorberVis" alpha="1" r="0.28" g="0.4" b="0.62" visible="true"/> + + </display> + <detectors> + + <comment>Calorimeters</comment> +<!-- + <detector id="5" name="EcalBarrel" type="EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL"> + <comment>EM Calorimeter Barrel</comment> + <dimensions numsides="(int) CaloSides" rmin="EcalBarrel_rmin" z="EcalBarrel_zmax*2" /> + <staves vis="EcalBarrelStaveVis"/> + <layer repeat="1"> + <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" /> + <slice material = "Copper" thickness = "0.005*cm" /> + <slice material = "Kapton" thickness = "0.030*cm" /> + <slice material = "Air" thickness = "0.033*cm" /> + </layer> + <layer repeat="20"> + <slice material = "TungstenDens24" thickness = "0.25*cm" /> + <slice material = "Air" thickness = "0.025*cm" /> + <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" /> + <slice material = "Copper" thickness = "0.005*cm" /> + <slice material = "Kapton" thickness = "0.030*cm" /> + <slice material = "Air" thickness = "0.033*cm" /> + </layer> + <layer repeat="10"> + <slice material = "TungstenDens24" thickness = "0.5*cm" /> + <slice material = "Air" thickness = "0.025*cm" /> + <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" /> + <slice material = "Copper" thickness = "0.005*cm" /> + <slice material = "Kapton" thickness = "0.030*cm" /> + <slice material = "Air" thickness = "0.033*cm" /> + </layer> + </detector> + + <detector id="6" name="EcalEndcap" type="PolyhedraEndcapCalorimeter2" reflect="true" readout="EcalEndcapHits" vis="EcalEndcapVis" calorimeterType="EM_ENDCAP"> + <comment>EM Calorimeter Endcaps</comment> + <dimensions numsides="(int) CaloSides" zmin="EcalEndcap_zmin" rmin="EcalEndcap_rmin" rmax="EcalEndcap_rmax" /> + <layer repeat="1"> + <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" /> + <slice material = "Copper" thickness = "0.005*cm" /> + <slice material = "Kapton" thickness = "0.030*cm" /> + <slice material = "Air" thickness = "0.033*cm" /> + </layer> + <layer repeat="20"> + <slice material = "TungstenDens24" thickness = "0.25*cm" /> + <slice material = "Air" thickness = "0.025*cm" /> + <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" /> + <slice material = "Copper" thickness = "0.005*cm" /> + <slice material = "Kapton" thickness = "0.030*cm" /> + <slice material = "Air" thickness = "0.033*cm" /> + </layer> + <layer repeat="10"> + <slice material = "TungstenDens24" thickness = "0.5*cm" /> + <slice material = "Air" thickness = "0.025*cm" /> + <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" /> + <slice material = "Copper" thickness = "0.005*cm" /> + <slice material = "Kapton" thickness = "0.030*cm" /> + <slice material = "Air" thickness = "0.033*cm" /> + </layer> + </detector> +--> + + <detector id="10" name="MuonBarrel" type="PolyhedraBarrelCalorimeter2" readout="MuonBarrelHits" vis="MuonBarrelVis" calorimeterType="MUON_BARREL" gap="0.*cm" material="Steel235"> + <comment>Muon Calorimeter Barrel</comment> + <dimensions numsides="(int) MuonSides" rmin="MuonBarrel_rmin" z="MuonBarrel_zmax * 2"/> + <staves vis="MuonBarrelStavesVis"/> + <!-- Start with an active layer, followed by a thin 5.0cm absorber layer. The second active layer is followed by a thick 20.0cm steel layer to take the forces. --> + <layer repeat="1" vis="MuonBarrelLayerVis"> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="1.0*cm" /> + <slice material="Iron" thickness="5.0*cm" vis="MuonBarrelAbsorberVis"/> + </layer> + <layer repeat="1" vis="MuonBarrelLayerVis"> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="1.0*cm" /> + <slice material="Iron" thickness="20.0*cm" vis="MuonBarrelAbsorberVis"/> + </layer> + <layer repeat="(int) MuonBarrel_layers" vis="MuonBarrelLayerVis"> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="1.0*cm" /> + <slice material="Iron" thickness="10.0*cm" vis="MuonBarrelAbsorberVis"/> + </layer> + <!-- The last Iron layer is again 20.0cm to take the forces. --> + <layer repeat="1" vis="MuonBarrelLayerVis"> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonBarrelSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="1.0*cm" /> + <slice material="Iron" thickness="20.0*cm" vis="MuonBarrelAbsorberVis"/> + </layer> + </detector> + +<!-- + <detector id="11" name="MuonEndcap" type="PolyhedraEndcapCalorimeter2" readout="MuonEndcapHits" reflect="true" vis="MuonEndcapVis" calorimeterType="MUON_ENDCAP"> + <comment>Muon Calorimeter Endcaps</comment> + <dimensions numsides="(int) MuonSides" zmin="MuonEndcap_zmin" rmin="MuonEndcap_rmin" rmax="MuonEndcap_rmax" /> + <layer repeat="(int) MuonEndcap_layers" vis="MuonEndcapLayerVis"> + <slice material="Iron" thickness="10.0*cm" vis="MuonEndcapAbsorberVis"/> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonEndcapSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="RPCGasDefault" thickness="0.2*cm" sensitive="yes" vis="MuonEndcapSensorVis"/> + <slice material="PyrexGlass" thickness="0.2*cm" /> + <slice material="Air" thickness="0.35*cm" /> + <slice material="Aluminum" thickness="0.1*cm" /> + <slice material="Air" thickness="1.0*cm" /> + </layer> + </detector> +--> + </detectors> + + <readouts> + + <readout name="MuonBarrelHits"> + <segmentation type="RegularNgonCartesianGridXY" gridSizeX="3.0*cm" gridSizeY="3.0*cm" /> + <id>system:8,barrel:3,module:4,layer:8,slice:5,x:32:-16,y:-16</id> + </readout> +<!-- + <readout name="EcalBarrelHits"> + <segmentation type="EcalBarrelCartesianGridXY" gridSizeX="3.5" gridSizeY="3.5" /> + <id>system:6,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16</id> + </readout> + <readout name="EcalEndcapHits"> + <segmentation type="GlobalGridXY" gridSizeX="3.5" gridSizeY="3.5" /> + <id>system:6,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16</id> + </readout> + + <readout name="MuonEndcapHits"> + <segmentation type="GlobalGridXY" gridSizeX="3.0*cm" gridSizeY="3.0*cm" /> + <id>system:8,barrel:3,module:4,layer:8,slice:5,x:32:-16,y:-16</id> + </readout> +--> + </readouts> + + <fields> + <field name="GlobalSolenoid" type="solenoid" + inner_field="5.0*tesla" + outer_field="-1.5*tesla" + zmax="SolenoidCoilOuterZ" + outer_radius="SolenoidalFieldRadius"> + </field> + </fields> +</lccdd> diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index e2315b4f28052b39e17217a451036e77826857fe..9852c3b4ee0350d20cf8d6752b280e6b9d725f0e 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -238,7 +238,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) double phi_start = s->GetPhi1()*DEGREE_2_RAD; double phi_total = (s->GetDphi()+s->GetPhi1())*DEGREE_2_RAD; vector<double> rmin, rmax, z; - for( size_t i=0; i<s->GetNz(); ++i ) { + for( Int_t i=0; i<s->GetNz(); ++i ) { rmin.push_back(s->GetRmin(i)*CM_2_MM); rmax.push_back(s->GetRmax(i)*CM_2_MM); z.push_back(s->GetZ(i)*CM_2_MM); @@ -250,7 +250,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) double phi_start = s->GetPhi1()*DEGREE_2_RAD; double phi_total = (s->GetDphi()+s->GetPhi1())*DEGREE_2_RAD; vector<double> rmin, rmax, z; - for( size_t i=0; i<s->GetNz(); ++i ) { + for( Int_t i=0; i<s->GetNz(); ++i ) { rmin.push_back(s->GetRmin(i)*CM_2_MM); rmax.push_back(s->GetRmax(i)*CM_2_MM); z.push_back(s->GetZ(i)*CM_2_MM); @@ -351,6 +351,7 @@ void* Geant4Converter::handleVolume(const string& name, const TGeoVolume* volume if ( !medium ) { throw runtime_error("G4Converter: No Geant4 material present for volume:"+n); } + //Region reg = _v.region(); SensitiveDetector det = _v.sensitiveDetector(); Geant4SensitiveDetector* sd = 0; @@ -390,7 +391,7 @@ void* Geant4Converter::handleVolume(const string& name, const TGeoVolume* volume } /// Dump logical volume in GDML format to output stream -void* Geant4Converter::collectVolume(const string& name, const TGeoVolume* volume) const { +void* Geant4Converter::collectVolume(const string& /* name */, const TGeoVolume* volume) const { G4GeometryInfo& info = data(); const TGeoVolume* v = volume; Volume _v = Ref_t(v); @@ -485,7 +486,7 @@ void* Geant4Converter::handlePlacement(const string& name, const TGeoNode* node) } /// Convert the geometry type region into the corresponding Geant4 object(s). -void* Geant4Converter::handleRegion(const TNamed* region, const set<const TGeoVolume*>& volumes) const { +void* Geant4Converter::handleRegion(const TNamed* region, const set<const TGeoVolume*>& /* volumes */) const { G4Region* g4 = data().g4Regions[region]; if ( !g4 ) { Region r = Ref_t(region); @@ -526,13 +527,13 @@ void* Geant4Converter::handleRegion(const TNamed* region, const set<const TGeoVo } /// Convert the geometry type LimitSet into the corresponding Geant4 object(s). -void* Geant4Converter::handleLimitSet(const TNamed* limitset, const set<const TGeoVolume*>& volumes) const { +void* Geant4Converter::handleLimitSet(const TNamed* limitset, const set<const TGeoVolume*>& /* volumes */) const { G4UserLimits* g4 = data().g4Limits[limitset]; if ( !g4 ) { LimitSet ls = Ref_t(limitset); g4 = new G4UserLimits(limitset->GetName()); - const LimitSet::Object& obj = ls.limits(); - for(LimitSet::Object::const_iterator i=obj.begin(); i!=obj.end(); ++i) { + const set<Limit>& limits = ls.limits(); + for(LimitSet::Object::const_iterator i=limits.begin(); i!=limits.end(); ++i) { const Limit& l = *i; if ( l.name == "step_length_max" ) g4->SetMaxAllowedStep(l.value); @@ -553,7 +554,7 @@ void* Geant4Converter::handleLimitSet(const TNamed* limitset, const set<const TG } /// Convert the geometry type SensitiveDetector into the corresponding Geant4 object(s). -void* Geant4Converter::handleSensitive(const TNamed* sens_det, const set<const TGeoVolume*>& volumes) const { +void* Geant4Converter::handleSensitive(const TNamed* sens_det, const set<const TGeoVolume*>& /* volumes */) const { G4GeometryInfo& info = data(); Geant4SensitiveDetector* g4 = info.g4SensDets[sens_det]; if ( !g4 ) { @@ -574,7 +575,7 @@ void* Geant4Converter::handleSensitive(const TNamed* sens_det, const set<const T } /// Convert the geometry visualisation attributes to the corresponding Geant4 object(s). -void* Geant4Converter::handleVis(const string& name, const TNamed* vis) const { +void* Geant4Converter::handleVis(const string& /* name */, const TNamed* vis) const { G4GeometryInfo& info = data(); G4VisAttributes* g4 = info.g4Vis[vis]; if ( !g4 ) { @@ -642,7 +643,7 @@ void Geant4Converter::handleProperties(LCDD::Properties& prp) const { /// Convert the geometry type SensitiveDetector into the corresponding Geant4 object(s). -void* Geant4Converter::printSensitive(const TNamed* sens_det, const set<const TGeoVolume*>& volumes) const { +void* Geant4Converter::printSensitive(const TNamed* sens_det, const set<const TGeoVolume*>& /* volumes */) const { G4GeometryInfo& info = data(); Geant4SensitiveDetector* g4 = info.g4SensDets[sens_det]; ConstVolumeSet& volset = info.sensitives[sens_det]; @@ -734,23 +735,15 @@ template <typename O, typename C, typename F> void handleRMap(const O* o, const /// Create geometry conversion void Geant4Converter::create(DetElement top) { - LCDD& lcdd = m_lcdd; G4GeometryInfo& geo = *(m_dataPtr=new G4GeometryInfo); m_data->clear(); collect(top,geo); s_topPtr = top.placement().ptr(); m_checkOverlaps = false; - // Ensure that all required materials are present in the Geant4 material table - const LCDD::HandleMap& mat = lcdd.materials(); - for(LCDD::HandleMap::const_iterator i=mat.begin(); i!=mat.end(); ++i) - geo.materials.insert((TGeoMedium*)(*i).second.ptr()); - // We do not have to handle defines etc. // All positions and the like are not really named. // Hence, start creating the G4 objects for materials, solids and log volumes. - handle(this, geo.materials, &Geant4Converter::handleMaterial); - cout << "++ Handled " << geo.materials.size() << " materials." << endl; handle(this, geo.volumes, &Geant4Converter::collectVolume); diff --git a/DDG4/src/Geant4SensitiveDetector.cpp b/DDG4/src/Geant4SensitiveDetector.cpp index 56715f8717288f0c8acf3ffe5bab12dfc6fbfbb7..ac1dfe23b168c17713b45804565243925f1ba575 100644 --- a/DDG4/src/Geant4SensitiveDetector.cpp +++ b/DDG4/src/Geant4SensitiveDetector.cpp @@ -31,11 +31,11 @@ using namespace DD4hep::Simulation; /// Constructor. The detector element is identified by the name Geant4SensitiveDetector::Geant4SensitiveDetector(const string& name, LCDD& lcdd) - : G4VSensitiveDetector(name), m_detector(), m_lcdd(lcdd), m_hce(0) + : G4VSensitiveDetector(name), m_lcdd(lcdd), m_detector(), m_sensitive(), m_readout(), m_hce(0) { m_sensitive = lcdd.sensitiveDetector(name); m_detector = lcdd.detector(name); - m_readout = m_detector.readout(); + m_readout = m_sensitive.readout(); } /// Standard destructor @@ -54,7 +54,8 @@ bool Geant4SensitiveDetector::defineCollection(const string& coll_name) { /// Access HitCollection container names const string& Geant4SensitiveDetector::hitCollectionName(int which) const { - if ( which >= collectionName.size() || which < 0 ) { + size_t w = which; + if ( w >= collectionName.size() ) { throw runtime_error("The collection name index for subdetector "+name()+" is out of range!"); } return collectionName[which]; @@ -86,7 +87,7 @@ void Geant4SensitiveDetector::Initialize(G4HCofThisEvent* HCE) { } /// Method invoked at the end of each event. -void Geant4SensitiveDetector::EndOfEvent(G4HCofThisEvent* HCE) { +void Geant4SensitiveDetector::EndOfEvent(G4HCofThisEvent* /* HCE */) { m_hce = 0; // Eventuall print event summary } @@ -114,7 +115,8 @@ Geant4SensitiveDetector::HitCollection* Geant4SensitiveDetector::collectionByID( /// Retrieve the hits collection associated with this detector by its serial number Geant4SensitiveDetector::HitCollection* Geant4SensitiveDetector::collection(int which) { - if ( which < collectionName.size() && which >= 0 ) { + size_t w = which; + if ( w < collectionName.size() ) { HitCollection* hc = (HitCollection*)m_hce->GetHC(GetCollectionID(which)); if ( hc ) return hc; throw runtime_error("The collection index for subdetector "+name()+" is wrong!"); @@ -130,7 +132,7 @@ void Geant4SensitiveDetector::clear() { void Geant4SensitiveDetector::dumpStep(G4Step* st, G4TouchableHistory* /* history */) { Geant4StepHandler step(st); Geant4Converter& cnv = Geant4Converter::instance(); - Geant4Converter::G4GeometryInfo& data = cnv.data(); + //Geant4Converter::G4GeometryInfo& data = cnv.data(); Position pos1 = step.prePos(); Position pos2 = step.postPos(); diff --git a/DDG4/src/Geant4Setup.cpp b/DDG4/src/Geant4Setup.cpp index 83550456d0da402205b3715df2973753a74c2669..8928d38c7d07e8eed808eb9f12825350c2a6fedb 100644 --- a/DDG4/src/Geant4Setup.cpp +++ b/DDG4/src/Geant4Setup.cpp @@ -41,7 +41,7 @@ double PropertyMap::toDouble(const string& key) const { return _toDouble(value(key)); } -static long setup_fields(lcdd_t& lcdd, const Geant4Converter& cnv, const map<string,string>& vals) { +static long setup_fields(lcdd_t& lcdd, const Geant4Converter& /* cnv */, const map<string,string>& vals) { PropertyMap pm(vals); DD4hep::Geometry::OverlayedField fld = lcdd.field(); G4MagIntegratorStepper* stepper = 0;