diff --git a/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp b/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp index 298e6ef98ff6d7eec8018d77ec80e42546af5646..9f6bf3b5bf18b1b3e1ea554adb9cb0c8effae9d6 100644 --- a/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp +++ b/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp @@ -41,7 +41,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens Tube slice_tube(r,router,z*2); Volume slice_vol (slice_name,slice_tube,slice_mat); - if ( x_slice.isSensitive() ) slice_vol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("calorimeter"); + slice_vol.setSensitiveDetector(sens); + } r = router; slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // Instantiate physical volume diff --git a/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp b/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp index 02cab3aea44d8ac4e6c9717efe344828574a8e8e..5d7fff3b09d2be26828dcb153914c1e78c9beed4 100644 --- a/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp +++ b/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp @@ -18,9 +18,9 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens xml_dim_t dim = x_det.dimensions(); Material air = lcdd.air(); string det_name = x_det.nameStr(); + bool reflect = x_det.reflect(); Tube envelope; Volume envelopeVol(det_name,envelope,air); - bool reflect = x_det.reflect(); double zmin = dim.inner_z(); double rmin = dim.inner_r(); double rmax = dim.outer_r(); @@ -45,8 +45,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens Material slice_mat = lcdd.material(x_slice.materialStr()); Volume slice_vol (slice_name,Tube(rmin,rmax,w),slice_mat); - if ( x_slice.isSensitive() ) slice_vol.setSensitiveDetector(sens); - + if ( x_slice.isSensitive() ) { + sens.setType("calorimeter"); + slice_vol.setSensitiveDetector(sens); + } // Set attributes of slice slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); layer_vol.placeVolume(slice_vol,Position(0,0,z-zlayer-layerWidth/2+w/2)); diff --git a/DDExamples/CLICSiD/src/DiskTracker_geo.cpp b/DDExamples/CLICSiD/src/DiskTracker_geo.cpp index e582252e1128d9b3a02b17599f1ff76b2e656297..c75e004af5bdf9dac6cb95ef65e08a1d8a80fad9 100644 --- a/DDExamples/CLICSiD/src/DiskTracker_geo.cpp +++ b/DDExamples/CLICSiD/src/DiskTracker_geo.cpp @@ -44,7 +44,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens string s_nam = l_nam+_toString(s_num,"_slice%d"); Volume s_vol(s_nam, Tube(rmin,rmax,thick), mat); - if ( x_slice.isSensitive() ) s_vol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("tracker"); + s_vol.setSensitiveDetector(sens); + } s_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); PlacedVolume spv = l_vol.placeVolume(s_vol,Position(0,0,z-zmin-layerWidth/2+thick/2)); @@ -65,7 +68,9 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens sdet.add(layerR.setPlacement(lpvR)); } } - sdet.setCombineHits(x_det.attr<bool>(_A(combineHits)),sens); + if ( x_det.hasAttr(_A(combineHits)) ) { + sdet.setCombineHits(x_det.attr<bool>(_A(combineHits)),sens); + } return sdet; } diff --git a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp index 9b5366896770d9a6b1d98ffa18398f639f05ebba..fe1a2f23e951372ef62e2cb4a994754a173f0091 100644 --- a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp +++ b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp @@ -99,7 +99,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens Volume s_vol(det_name+"_"+l_name+"_"+s_name,s_box,lcdd.material(x_slice.materialStr())); DetElement slice(layer,s_name,det_id); - if ( x_slice.isSensitive() ) s_vol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("calorimeter"); + s_vol.setSensitiveDetector(sens); + } slice.setAttributes(lcdd,s_vol,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // Slice placement. diff --git a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp index 2148b3c6f61b433957a513c428f071fff242441e..4d2652b10804fa40b941fa57159b2c88f086a31f 100644 --- a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp +++ b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp @@ -122,7 +122,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens // Slice LV. Volume sliceVol(det_name+"_"+layer_nam+"_"+slice_nam, sliceSubtraction2, slice_mat); - if ( x_slice.isSensitive() ) sliceVol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("tracker"); + sliceVol.setSensitiveDetector(sens); + } // Set attributes of slice slice.setAttributes(lcdd, sliceVol, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); diff --git a/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp b/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp index e95ffb3dfd4512ea85d0f2b15e1cd1da546e1e07..b0de7e0538d1b128d70f100eb654ae765475cc82 100644 --- a/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp +++ b/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp @@ -41,7 +41,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens Volume s_vol(s_name, s_tub, mat); r += thickness; - if ( x_slice.isSensitive() ) s_vol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("tracker"); + s_vol.setSensitiveDetector(sens); + } // Set Attributes s_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); PlacedVolume spv = l_vol.placeVolume(s_vol,IdentityPos()); @@ -56,7 +59,9 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens lpv.addPhysVolID("system",sdet.id()).addPhysVolID(_X(barrel),0); layer.setPlacement(lpv); } - sdet.setCombineHits(x_det.attr<bool>(_A(combineHits)),sens); + if ( x_det.hasAttr(_A(combineHits)) ) { + sdet.setCombineHits(x_det.attr<bool>(_A(combineHits)),sens); + } return sdet; } diff --git a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp index 3c8bc4d6fc370e552def4f0e59eac6afd2b3197d..f9df0ac95896f43d5335ac1f5d43138e5a4b6372 100644 --- a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp +++ b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp @@ -124,7 +124,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens // Slice volume & box Volume slice_vol(slice_name,Box(layer_dim_x,detZ/2,slice_thickness),slice_material); - if ( x_slice.isSensitive() ) slice_vol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("calorimeter"); + slice_vol.setSensitiveDetector(sens); + } // Set region, limitset, and vis. slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // slice PlacedVolume diff --git a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp index dc6d554066b0d7feb5ff281ed0200f74e7bdf217..92b05c0893cdd3f80ad0b1d84821ba8038197a63 100644 --- a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp +++ b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp @@ -48,7 +48,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens Material s_mat = lcdd.material(x_slice.materialStr()); Volume s_vol(s_name,PolyhedraRegular(numsides,rmin,rmax,s_thick),s_mat); - if ( x_slice.isSensitive() ) s_vol.setSensitiveDetector(sens); + if ( x_slice.isSensitive() ) { + sens.setType("calorimeter"); + s_vol.setSensitiveDetector(sens); + } s_vol.setVisAttributes(lcdd.visAttributes(x_slice.visStr())); sliceZ += s_thick/2; PlacedVolume s_phv = l_vol.placeVolume(s_vol,Position(0,0,sliceZ)); diff --git a/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp index fea62cf01124abc78126c91c33b7c549415fb277..33ea5747edf307fc9b6a638b7cfe4d3ce36d3532 100644 --- a/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp +++ b/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp @@ -25,7 +25,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens xml_comp_t x_mod = mi; xml_comp_t m_env = x_mod.child(_X(module_envelope)); string m_nam = x_mod.nameStr(); - Volume m_vol(m_nam,Box(m_env.width(),m_env.length(),m_env.thickness()),air); + Volume m_vol(det_name+"_"+m_nam,Box(m_env.width(),m_env.length(),m_env.thickness()),air); DetElement m_elt(sdet, m_nam, det_id); int ncomponents = 0, sensor_number = 0; @@ -54,6 +54,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens c_phv = m_vol.placeVolume(c_vol); } if ( x_comp.isSensitive() ) { + sens.setType("tracker"); c_phv.addPhysVolID(_X(sensor),sensor_number++); c_vol.setSensitiveDetector(sens); } diff --git a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp index 48ce8a1e79408a0ec71ed196e5bab288d65293c7..5d5a722107adab172de5b23a6ec77be9e77c2287 100644 --- a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp +++ b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp @@ -20,7 +20,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens Material vacuum = lcdd.vacuum(); int det_id = x_det.id(); string det_name = x_det.nameStr(); - bool reflect = x_det.reflect(); + bool reflect = x_det.reflect(false); DetElement sdet (det_name,det_id); Volume motherVol = lcdd.trackingVolume(); int m_id=0, c_id=0, n_sensor=0; @@ -54,6 +54,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens PlacedVolume phv = m_volume.placeVolume(vol,Position(0,posY+c_thick/2,0)); phv.addPhysVolID(_X(component),c_id); if ( c.isSensitive() ) { + sens.setType("tracker"); sdet.check(n_sensor > 1,"SiTrackerEndcap2::fromCompact: "+c_name+" Max of 2 modules allowed!"); phv.addPhysVolID("sensor",c_id); vol.setSensitiveDetector(sens);